]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'master' of /var/www/trunk
authorEvan Prodromou <evan@controlyourself.ca>
Mon, 19 Jan 2009 13:35:17 +0000 (13:35 +0000)
committerEvan Prodromou <evan@controlyourself.ca>
Mon, 19 Jan 2009 13:35:17 +0000 (13:35 +0000)
Conflicts:

actions/facebookhome.php
actions/facebooksettings.php

302 files changed:
.gitignore
actions/accesstoken.php
actions/all.php
actions/allrss.php
actions/api.php
actions/avatarbynickname.php
actions/avatarsettings.php [new file with mode: 0644]
actions/block.php
actions/confirmaddress.php
actions/deletenotice.php
actions/deleteprofile.php
actions/disfavor.php
actions/doc.php
actions/emailsettings.php
actions/facebookhome.php
actions/facebookinvite.php
actions/facebookremove.php
actions/facebooksettings.php
actions/favor.php
actions/favorited.php
actions/favoritesrss.php
actions/featured.php
actions/finishaddopenid.php
actions/finishopenidlogin.php
actions/finishremotesubscribe.php
actions/foaf.php
actions/imsettings.php
actions/invite.php
actions/login.php
actions/logout.php
actions/microsummary.php
actions/newmessage.php
actions/newnotice.php
actions/noticesearch.php
actions/nudge.php
actions/openidlogin.php
actions/openidsettings.php
actions/opensearch.php
actions/othersettings.php
actions/passwordsettings.php [new file with mode: 0644]
actions/peoplesearch.php
actions/peopletag.php
actions/postnotice.php
actions/profilesettings.php
actions/public.php
actions/publicxrds.php
actions/recoverpassword.php
actions/register.php
actions/remotesubscribe.php
actions/replies.php
actions/repliesrss.php
actions/requesttoken.php
actions/showfavorites.php
actions/showmessage.php
actions/shownotice.php
actions/showstream.php
actions/smssettings.php
actions/subedit.php
actions/subscribe.php
actions/subscriptions.php
actions/sup.php
actions/tag.php
actions/tagother.php
actions/tagrss.php
actions/twitapiaccount.php
actions/twitapiblocks.php
actions/twitapidirect_messages.php
actions/twitapifavorites.php
actions/twitapifriendships.php
actions/twitapihelp.php
actions/twitapilaconica.php
actions/twitapinotifications.php
actions/twitapistatuses.php
actions/twitapiusers.php
actions/twittersettings.php
actions/unblock.php
actions/unsubscribe.php
actions/updateprofile.php
actions/userauthorization.php
actions/userbyid.php
actions/userrss.php
actions/xrds.php
htaccess.sample
index.php
js/jcrop/Jcrop.gif [deleted file]
js/jcrop/jquery.Jcrop.css [deleted file]
js/jcrop/jquery.Jcrop.go.js [deleted file]
js/jcrop/jquery.Jcrop.pack.js [deleted file]
js/jquery.Jcrop.go.js [new file with mode: 0644]
js/jquery.Jcrop.pack.js [new file with mode: 0644]
js/jquery.js
js/jquery.min.js
js/util.js
js/xbImportNode.js
lib/accountsettingsaction.php [new file with mode: 0644]
lib/action.php
lib/blockform.php [new file with mode: 0644]
lib/common.php
lib/connectsettingsaction.php [new file with mode: 0644]
lib/disfavorform.php [new file with mode: 0644]
lib/favorform.php [new file with mode: 0644]
lib/feedlist.php [new file with mode: 0644]
lib/form.php [new file with mode: 0644]
lib/htmloutputter.php [new file with mode: 0644]
lib/logingroupnav.php [new file with mode: 0644]
lib/messageform.php [new file with mode: 0644]
lib/microid.php [new file with mode: 0644]
lib/noticeform.php [new file with mode: 0644]
lib/noticelist.php
lib/nudgeform.php [new file with mode: 0644]
lib/personal.php
lib/personalgroupnav.php [new file with mode: 0644]
lib/publicgroupnav.php [new file with mode: 0644]
lib/rssaction.php
lib/settingsaction.php
lib/stream.php
lib/subscribeform.php [new file with mode: 0644]
lib/theme.php
lib/unblockform.php [new file with mode: 0644]
lib/unsubscribeform.php [new file with mode: 0644]
lib/util.php
lib/widget.php [new file with mode: 0644]
lib/xmloutputter.php [new file with mode: 0644]
theme/base/css/display.css [new file with mode: 0644]
theme/base/css/ie.css [new file with mode: 0644]
theme/base/css/ie7.css [new file with mode: 0644]
theme/base/css/initial_states.css [new file with mode: 0644]
theme/base/css/jquery.Jcrop.css [new file with mode: 0644]
theme/base/css/thickbox.css [new file with mode: 0644]
theme/base/images/icons/icon_atom.jpg [new file with mode: 0644]
theme/base/images/icons/icon_foaf.gif [new file with mode: 0644]
theme/base/images/icons/icon_rss.jpg [new file with mode: 0644]
theme/base/images/icons/icon_vcard.gif [new file with mode: 0644]
theme/base/images/illustrations/illu_jcrop.gif [new file with mode: 0644]
theme/base/images/illustrations/illu_progress_loading-01.gif [new file with mode: 0644]
theme/default/css/display.css [new file with mode: 0644]
theme/default/images/icons/icon_atom.jpg [new file with mode: 0644]
theme/default/images/icons/icon_foaf.gif [new file with mode: 0644]
theme/default/images/icons/icon_rss.jpg [new file with mode: 0644]
theme/default/images/icons/icon_vcard.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/against.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/arrow-down.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/arrow-downleft.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/arrow-downright.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/arrow-left.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/arrow-right.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/arrow-up.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/arrow-upleft.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/arrow-upright.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/back-forth.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/bookmark.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/bulb.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/calendar.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/calendar2.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/camera.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/cart.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/caution.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/chart.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/checkmark.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/clipboard.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/clock.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/closed-folder.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/database.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/disfavourite.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/diskette.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/document.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/double-arrow.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/edit.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/eject.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/exclaim.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/fastforward.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/favourite.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/flag.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/graph.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/grow.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/headphones.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/home.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/hourglass.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/info.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/key.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/lock.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/mail.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/move.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/music.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/news.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/note.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/open-folder.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/paper-clip.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/paper-clip2.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/pause.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/phone.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/play.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/plus.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/print.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/question-mark.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/quote.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/refresh.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/reply.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/rewind.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/search.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/shield.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/skip-back.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/skip.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/skull.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/statusbar.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/stop.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/template.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/text-bigger.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/text-smaller.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/trash.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/two-docs.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/twotone.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/undo.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/user.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/vegetable.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/x.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/zoom-in.gif [new file with mode: 0644]
theme/default/images/icons/twotone/green/zoom-out.gif [new file with mode: 0644]
theme/identica/css/display.css [new file with mode: 0644]
theme/identica/images/icons/icon_atom.jpg [new file with mode: 0644]
theme/identica/images/icons/icon_foaf.gif [new file with mode: 0644]
theme/identica/images/icons/icon_rss.jpg [new file with mode: 0644]
theme/identica/images/icons/icon_vcard.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/against.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/arrow-down.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/arrow-downleft.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/arrow-downright.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/arrow-left.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/arrow-right.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/arrow-up.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/arrow-upleft.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/arrow-upright.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/back-forth.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/bookmark.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/bulb.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/calendar.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/calendar2.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/camera.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/cart.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/caution.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/chart.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/checkmark.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/clipboard.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/clock.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/closed-folder.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/database.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/disfavourite.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/diskette.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/document.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/double-arrow.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/edit.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/eject.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/exclaim.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/fastforward.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/favourite.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/flag.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/graph.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/grow.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/headphones.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/home.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/hourglass.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/info.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/key.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/lock.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/mail.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/move.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/music.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/news.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/note.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/open-folder.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/paper-clip.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/paper-clip2.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/pause.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/phone.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/play.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/plus.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/print.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/question-mark.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/quote.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/refresh.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/reply.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/rewind.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/search.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/shield.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/skip-back.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/skip.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/skull.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/statusbar.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/stop.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/template.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/text-bigger.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/text-smaller.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/trash.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/two-docs.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/twotone.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/undo.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/user.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/vegetable.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/x.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/zoom-in.gif [new file with mode: 0644]
theme/identica/images/icons/twotone/green/zoom-out.gif [new file with mode: 0644]
theme/identica/logo.png

index fb5d478fe879a1bedc8543a3e4083048ae3c7927..f5a3e0212f8d7b11cf2a542d176a99da57b04819 100644 (file)
@@ -4,3 +4,8 @@ _darcs/*
 config.php
 .htaccess
 *.tmproj
+dataobject.ini
+*~
+*.bak
+*.orig
+*.rej
index 072ce27eb5c5e15d30a4c8c5dd1dfe16f571bf56..ad03b7019047c98908b0ca8373eae6698cb34aa9 100644 (file)
@@ -38,7 +38,7 @@ class AccesstokenAction extends Action
             common_debug('printing the access token', __FILE__);
             print $token;
         } catch (OAuthException $e) {
-            common_server_error($e->getMessage());
+            $this->serverError($e->getMessage());
         }
     }
 }
index 526ac5f40881257217885ac0b99a68729a164e48..428466f243edb7555b8d12de3a4a99418e114f53 100644 (file)
 
 if (!defined('LACONICA')) { exit(1); }
 
-require_once(INSTALLDIR.'/actions/showstream.php');
+require_once INSTALLDIR.'/lib/personalgroupnav.php';
+require_once INSTALLDIR.'/lib/noticelist.php';
+require_once INSTALLDIR.'/lib/feedlist.php';
 
-class AllAction extends StreamAction
+class AllAction extends Action
 {
+    var $user = null;
+    var $page = null;
 
-    function handle($args)
+    function isReadOnly()
     {
+        return true;
+    }
 
-        parent::handle($args);
-
+    function prepare($args)
+    {
+        parent::prepare($args);
         $nickname = common_canonical_nickname($this->arg('nickname'));
-        $user = User::staticGet('nickname', $nickname);
-
-        if (!$user) {
-            $this->client_error(_('No such user.'));
-            return;
+        $this->user = User::staticGet('nickname', $nickname);
+        $this->page = $this->trimmed('page');
+        if (!$this->page) {
+            $this->page = 1;
         }
+        return true;
+    }
 
-        $profile = $user->getProfile();
+    function handle($args)
+    {
+        parent::handle($args);
 
-        if (!$profile) {
-            common_server_error(_('User has no profile.'));
+        if (!$this->user) {
+            $this->clientError(_('No such user.'));
             return;
         }
 
-        # Looks like we're good; show the header
-
-        common_show_header(sprintf(_("%s and friends"), $profile->nickname),
-                           array($this, 'show_header'), $user,
-                           array($this, 'show_top'));
-
-        $this->show_notices($user);
+        $this->showPage();
+    }
 
-        common_show_footer();
+    function title()
+    {
+        if ($this->page > 1) {
+            return sprintf(_("%s and friends, page %d"), $this->user->nickname, $this->page);
+        } else {
+            return sprintf(_("%s and friends"), $this->user->nickname);
+        }
     }
 
-    function show_header($user)
+    function showFeeds()
     {
-        common_element('link', array('rel' => 'alternate',
+        $this->element('link', array('rel' => 'alternate',
                                      'href' => common_local_url('allrss', array('nickname' =>
-                                                                               $user->nickname)),
+                                                                                $this->user->nickname)),
                                      'type' => 'application/rss+xml',
-                                     'title' => sprintf(_('Feed for friends of %s'), $user->nickname)));
+                                     'title' => sprintf(_('Feed for friends of %s'), $this->user->nickname)));
     }
 
-    function show_top($user)
+    function showLocalNav()
     {
-        $cur = common_current_user();
-
-        if ($cur && $cur->id == $user->id) {
-            common_notice_form('all');
-        }
-
-        $this->views_menu();
-
-        $this->show_feeds_list(array(0=>array('href'=>common_local_url('allrss', array('nickname' => $user->nickname)),
-                                              'type' => 'rss',
-                                              'version' => 'RSS 1.0',
-                                              'item' => 'allrss')));
+        $nav = new PersonalGroupNav($this);
+        $nav->show();
     }
 
-    function show_notices($user)
+    function showExportData()
     {
+        $fl = new FeedList($this);
+        $fl->show(array(0=>array('href'=>common_local_url('allrss', array('nickname' => $this->user->nickname)),
+                                 'type' => 'rss',
+                                 'version' => 'RSS 1.0',
+                                 'item' => 'allrss')));
+    }
 
-        $page = $this->trimmed('page');
-        if (!$page) {
-            $page = 1;
-        }
+    function showContent()
+    {
+        $notice = $this->user->noticesWithFriends(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
 
-        $notice = $user->noticesWithFriends(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
+        $nl = new NoticeList($notice, $this);
 
-        $cnt = $this->show_notice_list($notice);
+        $cnt = $nl->show();
 
-        common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
-                          $page, 'all', array('nickname' => $user->nickname));
+        $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
+                          $this->page, 'all', array('nickname' => $this->user->nickname));
     }
 }
index 660afb9e2da095f120b2796185b260e2239cbbbe..56818d605c708de1d24130eeebfadba118eeabd4 100644 (file)
@@ -34,7 +34,7 @@ class AllrssAction extends Rss10Action
         $this->user = User::staticGet('nickname', $nickname);
 
         if (!$this->user) {
-            common_user_error(_('No such user.'));
+            $this->clientError(_('No such user.'));
             return false;
         } else {
             return true;
index 7a075983158354e53bc2bcc329961954ff639945..47c1196052e25bd5a3ccf3dfe0a84b1ddcd55765 100644 (file)
@@ -103,10 +103,10 @@ class ApiAction extends Action
 
                 call_user_func(array($action_obj, $this->api_method), $_REQUEST, $apidata);
             } else {
-                common_user_error("API method not found!", $code=404);
+                $this->clientError("API method not found!", $code=404);
             }
         } else {
-            common_user_error("API method not found!", $code=404);
+            $this->clientError("API method not found!", $code=404);
         }
     }
 
@@ -159,10 +159,10 @@ class ApiAction extends Action
         if ($this->content_type == 'xml') {
             header('Content-Type: application/xml; charset=utf-8');
             common_start_xml();
-            common_element_start('hash');
-            common_element('error', null, $msg);
-            common_element('request', null, $_SERVER['REQUEST_URI']);
-            common_element_end('hash');
+            $this->elementStart('hash');
+            $this->element('error', null, $msg);
+            $this->element('request', null, $_SERVER['REQUEST_URI']);
+            $this->elementEnd('hash');
             common_end_xml();
         } else if ($this->content_type == 'json')  {
             header('Content-Type: application/json; charset=utf-8');
@@ -174,7 +174,7 @@ class ApiAction extends Action
         }
     }
 
-    function is_readonly()
+    function isReadOnly()
     {
         # NOTE: before handle(), can't use $this->arg
         $apiaction = $_REQUEST['apiaction'];
index 666f386f66a19ec1373730fb1cb31adae05488e7..d2d078b61f1590cdf4ba8c6959e63bc28f98f717 100644 (file)
@@ -26,28 +26,28 @@ class AvatarbynicknameAction extends Action
         parent::handle($args);
         $nickname = $this->trimmed('nickname');
         if (!$nickname) {
-            $this->client_error(_('No nickname.'));
+            $this->clientError(_('No nickname.'));
             return;
         }
         $size = $this->trimmed('size');
         if (!$size) {
-            $this->client_error(_('No size.'));
+            $this->clientError(_('No size.'));
             return;
         }
         $size = strtolower($size);
         if (!in_array($size, array('original', '96', '48', '24'))) {
-            $this->client_error(_('Invalid size.'));
+            $this->clientError(_('Invalid size.'));
             return;
         }
 
         $user = User::staticGet('nickname', $nickname);
         if (!$user) {
-            $this->client_error(_('No such user.'));
+            $this->clientError(_('No such user.'));
             return;
         }
         $profile = $user->getProfile();
         if (!$profile) {
-            $this->client_error(_('User has no profile.'));
+            $this->clientError(_('User has no profile.'));
             return;
         }
         if ($size == 'original') {
diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php
new file mode 100644 (file)
index 0000000..a9b381b
--- /dev/null
@@ -0,0 +1,306 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Upload an avatar
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Settings
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Zach Copley <zach@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/accountsettingsaction.php';
+
+/**
+ * Upload an avatar
+ *
+ * We use jQuery to crop the image after upload.
+ *
+ * @category Settings
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Zach Copley <zach@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ */
+
+class AvatarsettingsAction extends AccountSettingsAction
+{
+    /**
+     * Title of the page
+     *
+     * @return string Title of the page
+     */
+
+    function title()
+    {
+        return _('Avatar');
+    }
+
+    /**
+     * Instructions for use
+     *
+     * @return instructions for use
+     */
+
+    function getInstructions()
+    {
+        return _('Set your personal avatar.');
+    }
+
+    /**
+     * Content area of the page
+     *
+     * Shows a form for uploading an avatar.
+     *
+     * @return void
+     */
+
+    function showContent()
+    {
+        $user = common_current_user();
+
+        $profile = $user->getProfile();
+
+        if (!$profile) {
+            common_log_db_error($user, 'SELECT', __FILE__);
+            $this->serverError(_('User without matching profile'));
+            return;
+        }
+
+        $original = $profile->getOriginalAvatar();
+
+        $this->elementStart('form', array('enctype' => 'multipart/form-data',
+                                          'method' => 'POST',
+                                          'id' => 'avatar',
+                                          'action' =>
+                                          common_local_url('avatarsettings')));
+        $this->hidden('token', common_session_token());
+
+        if ($original) {
+            $this->elementStart('div',
+                                array('id' => 'avatar_original',
+                                      'class' => 'avatar_view'));
+            $this->element('h3', null, _("Original:"));
+            $this->elementStart('div', array('id'=>'avatar_original_view'));
+            $this->element('img', array('src' => $original->url,
+                                        'class' => 'avatar original',
+                                        'width' => $original->width,
+                                        'height' => $original->height,
+                                        'alt' => $user->nickname));
+            $this->elementEnd('div');
+            $this->elementEnd('div');
+        }
+
+        $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
+
+        if ($avatar) {
+            $this->elementStart('div',
+                                array('id' => 'avatar_preview',
+                                      'class' => 'avatar_view'));
+            $this->element('h3', null, _("Preview:"));
+            $this->elementStart('div', array('id'=>'avatar_preview_view'));
+            $this->element('img', array('src' => $original->url,//$avatar->url,
+                                        'class' => 'avatar profile',
+                                        'width' => AVATAR_PROFILE_SIZE,
+                                        'height' => AVATAR_PROFILE_SIZE,
+                                        'alt' => $user->nickname));
+            $this->elementEnd('div');
+            $this->elementEnd('div');
+
+            foreach (array('avatar_crop_x', 'avatar_crop_y',
+                           'avatar_crop_w', 'avatar_crop_h') as $crop_info) {
+                $this->element('input', array('name' => $crop_info,
+                                              'type' => 'hidden',
+                                              'id' => $crop_info));
+            }
+            $this->submit('crop', _('Crop'));
+        }
+
+        $this->element('input', array('name' => 'MAX_FILE_SIZE',
+                                      'type' => 'hidden',
+                                      'id' => 'MAX_FILE_SIZE',
+                                      'value' => MAX_AVATAR_SIZE));
+
+        $this->elementStart('p');
+
+        $this->element('input', array('name' => 'avatarfile',
+                                      'type' => 'file',
+                                      'id' => 'avatarfile'));
+        $this->elementEnd('p');
+
+        $this->submit('upload', _('Upload'));
+        $this->elementEnd('form');
+
+    }
+
+    /**
+     * Handle a post
+     *
+     * We mux on the button name to figure out what the user actually wanted.
+     *
+     * @return void
+     */
+
+    function handlePost()
+    {
+        // CSRF protection
+
+        $token = $this->trimmed('token');
+        if (!$token || $token != common_session_token()) {
+            $this->show_form(_('There was a problem with your session token. '.
+                               'Try again, please.'));
+            return;
+        }
+
+        if ($this->arg('upload')) {
+            $this->uploadAvatar();
+        } else if ($this->arg('crop')) {
+            $this->cropAvatar();
+        } else {
+            $this->showForm(_('Unexpected form submission.'));
+        }
+    }
+
+    /**
+     * Handle an image upload
+     *
+     * Does all the magic for handling an image upload, and crops the
+     * image by default.
+     *
+     * @return void
+     */
+
+    function uploadAvatar()
+    {
+        switch ($_FILES['avatarfile']['error']) {
+        case UPLOAD_ERR_OK: // success, jump out
+            break;
+        case UPLOAD_ERR_INI_SIZE:
+        case UPLOAD_ERR_FORM_SIZE:
+            $this->showForm(_('That file is too big.'));
+            return;
+        case UPLOAD_ERR_PARTIAL:
+            @unlink($_FILES['avatarfile']['tmp_name']);
+            $this->showForm(_('Partial upload.'));
+            return;
+        default:
+            $this->showForm(_('System error uploading file.'));
+            return;
+        }
+
+        $info = @getimagesize($_FILES['avatarfile']['tmp_name']);
+
+        if (!$info) {
+            @unlink($_FILES['avatarfile']['tmp_name']);
+            $this->showForm(_('Not an image or corrupt file.'));
+            return;
+        }
+
+        switch ($info[2]) {
+        case IMAGETYPE_GIF:
+        case IMAGETYPE_JPEG:
+        case IMAGETYPE_PNG:
+            break;
+        default:
+            $this->showForm(_('Unsupported image file format.'));
+            return;
+        }
+
+        $user = common_current_user();
+
+        $profile = $user->getProfile();
+
+        if ($profile->setOriginal($_FILES['avatarfile']['tmp_name'])) {
+            $this->showForm(_('Avatar updated.'), true);
+        } else {
+            $this->showForm(_('Failed updating avatar.'));
+        }
+
+        @unlink($_FILES['avatarfile']['tmp_name']);
+    }
+
+    /**
+     * Handle the results of jcrop.
+     *
+     * @return void
+     */
+
+    function cropAvatar()
+    {
+        $user = common_current_user();
+
+        $profile = $user->getProfile();
+
+        $x = $this->arg('avatar_crop_x');
+        $y = $this->arg('avatar_crop_y');
+        $w = $this->arg('avatar_crop_w');
+        $h = $this->arg('avatar_crop_h');
+
+        if ($profile->crop_avatars($x, $y, $w, $h)) {
+            $this->showForm(_('Avatar updated.'), true);
+        } else {
+            $this->showForm(_('Failed updating avatar.'));
+        }
+    }
+
+    /**
+     * Add the jCrop stylesheet
+     *
+     * @return void
+     */
+
+    function showStylesheets()
+    {
+        parent::showStylesheets();
+        $jcropStyle =
+          common_path('js/jcrop/jquery.Jcrop.css?version='.LACONICA_VERSION);
+
+        $this->element('link', array('rel' => 'stylesheet',
+                                     'type' => 'text/css',
+                                     'href' => $jcropStyle,
+                                     'media' => 'screen, projection, tv'));
+    }
+
+    /**
+     * Add the jCrop scripts
+     *
+     * @return void
+     */
+
+    function showScripts()
+    {
+        parent::showScripts();
+
+        $jcropPack = common_path('js/jcrop/jquery.Jcrop.pack.js');
+        $jcropGo   = common_path('js/jcrop/jquery.Jcrop.go.js');
+
+        $this->element('script', array('type' => 'text/javascript',
+                                       'src' => $jcropPack));
+        $this->element('script', array('type' => 'text/javascript',
+                                       'src' => $jcropGo));
+    }
+}
index c1ff7c04462308ef20af2332a268ed2b4b95369b..738cbfbf7142e6a381bbb4b54e69e7239d5ac2f6 100644 (file)
@@ -30,28 +30,28 @@ class BlockAction extends Action
         parent::prepare($args);
 
         if (!common_logged_in()) {
-            $this->client_error(_('Not logged in.'));
+            $this->clientError(_('Not logged in.'));
             return false;
         }
 
         $token = $this->trimmed('token');
 
         if (!$token || $token != common_session_token()) {
-            $this->client_error(_('There was a problem with your session token. Try again, please.'));
+            $this->clientError(_('There was a problem with your session token. Try again, please.'));
             return;
         }
 
         $id = $this->trimmed('blockto');
 
         if (!$id) {
-            $this->client_error(_('No profile specified.'));
+            $this->clientError(_('No profile specified.'));
             return false;
         }
 
         $this->profile = Profile::staticGet('id', $id);
 
         if (!$this->profile) {
-            $this->client_error(_('No profile with that ID.'));
+            $this->clientError(_('No profile with that ID.'));
             return false;
         }
 
@@ -81,34 +81,34 @@ class BlockAction extends Action
 
         common_show_header(_('Block user'));
 
-        common_element('p', null,
+        $this->element('p', null,
                        _('Are you sure you want to block this user? '.
                          'Afterwards, they will be unsubscribed from you, '.
                          'unable to subscribe to you in the future, and '.
                          'you will not be notified of any @-replies from them.'));
 
-        common_element_start('form', array('id' => 'block-' . $id,
+        $this->elementStart('form', array('id' => 'block-' . $id,
                                            'method' => 'post',
                                            'class' => 'block',
                                            'action' => common_local_url('block')));
 
-        common_hidden('token', common_session_token());
+        $this->hidden('token', common_session_token());
 
-        common_element('input', array('id' => 'blockto-' . $id,
+        $this->element('input', array('id' => 'blockto-' . $id,
                                       'name' => 'blockto',
                                       'type' => 'hidden',
                                       'value' => $id));
 
         foreach ($this->args as $k => $v) {
             if (substr($k, 0, 9) == 'returnto-') {
-                common_hidden($k, $v);
+                $this->hidden($k, $v);
             }
         }
 
-        common_submit('no', _('No'));
-        common_submit('yes', _('Yes'));
+        $this->submit('no', _('No'));
+        $this->submit('yes', _('Yes'));
 
-        common_element_end('form');
+        $this->elementEnd('form');
 
         common_show_footer();
     }
@@ -119,14 +119,14 @@ class BlockAction extends Action
         $cur = common_current_user();
 
         if ($cur->hasBlocked($this->profile)) {
-            $this->client_error(_('You have already blocked this user.'));
+            $this->clientError(_('You have already blocked this user.'));
             return;
         }
 
         $result = $cur->block($this->profile);
 
         if (!$result) {
-            $this->server_error(_('Failed to save block information.'));
+            $this->serverError(_('Failed to save block information.'));
             return;
         }
 
index 1d5c53ff2e3319313d9883b2cbc75cfcd0092da3..725c1f1e3bb37a3f7da8e03d6f0beef07ba9a295 100644 (file)
@@ -1,9 +1,12 @@
 <?php
-/*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+/**
+ * Laconica, the distributed open-source microblogging tool
  *
- * This program is free software: you can redistribute it and/or modify
+ * Confirm an address
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Confirm
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+/**
+ * Confirm an address
+ *
+ * When users change their SMS, email, Jabber, or other addresses, we send out
+ * a confirmation code to make sure the owner of that address approves. This class
+ * accepts those codes.
+ *
+ * @category Confirm
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ */
 
 class ConfirmaddressAction extends Action
 {
+    /** type of confirmation. */
+
+    var $type = null;
+
+    /**
+     * Accept a confirmation code
+     *
+     * Checks the code and confirms the address in the
+     * user record
+     *
+     * @param args $args $_REQUEST array
+     *
+     * @return void
+     */
 
     function handle($args)
     {
         parent::handle($args);
         if (!common_logged_in()) {
-            common_set_returnto($this->self_url());
+            common_set_returnto($this->selfUrl());
             common_redirect(common_local_url('login'));
             return;
         }
         $code = $this->trimmed('code');
         if (!$code) {
-            $this->client_error(_('No confirmation code.'));
+            $this->clientError(_('No confirmation code.'));
             return;
         }
         $confirm = Confirm_address::staticGet('code', $code);
         if (!$confirm) {
-            $this->client_error(_('Confirmation code not found.'));
+            $this->clientError(_('Confirmation code not found.'));
             return;
         }
         $cur = common_current_user();
         if ($cur->id != $confirm->user_id) {
-            $this->client_error(_('That confirmation code is not for you!'));
+            $this->clientError(_('That confirmation code is not for you!'));
             return;
         }
         $type = $confirm->address_type;
         if (!in_array($type, array('email', 'jabber', 'sms'))) {
-            $this->server_error(sprintf(_('Unrecognized address type %s'), $type));
+            $this->serverError(sprintf(_('Unrecognized address type %s'), $type));
             return;
         }
         if ($cur->$type == $confirm->address) {
-            $this->client_error(_('That address has already been confirmed.'));
+            $this->clientError(_('That address has already been confirmed.'));
             return;
         }
 
@@ -62,8 +102,8 @@ class ConfirmaddressAction extends Action
         $cur->$type = $confirm->address;
 
         if ($type == 'sms') {
-            $cur->carrier = ($confirm->address_extra)+0;
-            $carrier = Sms_carrier::staticGet($cur->carrier);
+            $cur->carrier  = ($confirm->address_extra)+0;
+            $carrier       = Sms_carrier::staticGet($cur->carrier);
             $cur->smsemail = $carrier->toEmailAddress($cur->sms);
         }
 
@@ -71,7 +111,7 @@ class ConfirmaddressAction extends Action
 
         if (!$result) {
             common_log_db_error($cur, 'UPDATE', __FILE__);
-            $this->server_error(_('Couldn\'t update user.'));
+            $this->serverError(_('Couldn\'t update user.'));
             return;
         }
 
@@ -83,15 +123,41 @@ class ConfirmaddressAction extends Action
 
         if (!$result) {
             common_log_db_error($confirm, 'DELETE', __FILE__);
-            $this->server_error(_('Couldn\'t delete email confirmation.'));
+            $this->serverError(_('Couldn\'t delete email confirmation.'));
             return;
         }
 
         $cur->query('COMMIT');
 
-        common_show_header(_('Confirm Address'));
-        common_element('p', null,
-                       sprintf(_('The address "%s" has been confirmed for your account.'), $cur->$type));
-        common_show_footer();
+        $this->type = $type;
+        $this->showPage();
+    }
+
+    /**
+     * Title of the page
+     *
+     * @return string title
+     */
+
+    function title()
+    {
+        return _('Confirm Address');
+    }
+
+    /**
+     * Show a confirmation message.
+     *
+     * @return void
+     */
+
+    function showContent()
+    {
+        $cur  = common_current_user();
+        $type = $this->type;
+
+        $this->element('p', null,
+                       sprintf(_('The address "%s" has been '.
+                                 'confirmed for your account.'),
+                               $cur->$type));
     }
 }
index e9b4b32549b47719a152acc2331b42e39c8eeed5..bae0eac1b42ba7ef67f2448f3ca433b44422c81a 100644 (file)
@@ -51,24 +51,24 @@ class DeletenoticeAction extends DeleteAction
 
         common_show_header($this->get_title(), array($this, 'show_header'), $error,
                            array($this, 'show_top'));
-        common_element_start('form', array('id' => 'notice_delete_form',
+        $this->elementStart('form', array('id' => 'notice_delete_form',
                                    'method' => 'post',
                                    'action' => common_local_url('deletenotice')));
-        common_hidden('token', common_session_token());
-        common_hidden('notice', $this->trimmed('notice'));
-        common_element_start('p');
-        common_element('span', array('id' => 'confirmation_text'), _('Are you sure you want to delete this notice?'));
+        $this->hidden('token', common_session_token());
+        $this->hidden('notice', $this->trimmed('notice'));
+        $this->elementStart('p');
+        $this->element('span', array('id' => 'confirmation_text'), _('Are you sure you want to delete this notice?'));
 
-        common_element('input', array('id' => 'submit_no',
+        $this->element('input', array('id' => 'submit_no',
                           'name' => 'submit',
                           'type' => 'submit',
                           'value' => _('No')));
-        common_element('input', array('id' => 'submit_yes',
+        $this->element('input', array('id' => 'submit_yes',
                           'name' => 'submit',
                           'type' => 'submit',
                           'value' => _('Yes')));
-        common_element_end('p');
-        common_element_end('form');
+        $this->elementEnd('p');
+        $this->elementEnd('form');
         common_show_footer();
     }
 
index e12fe131a73aeaba4322d82beeb53bcb2086f550..cc236f84749f647c08c17abb4282095c3829d8c0 100644 (file)
@@ -24,7 +24,7 @@ class DeleteprofileAction extends Action
     function handle($args)
     {
         parent::handle($args);
-        $this->server_error(_('Code not yet ready.'));
+        $this->serverError(_('Code not yet ready.'));
         return;
         if ('POST' === $_SERVER['REQUEST_METHOD']) {
             $this->handle_post();
@@ -49,15 +49,15 @@ class DeleteprofileAction extends Action
 
     function show_feeds_list($feeds)
     {
-        common_element_start('div', array('class' => 'feedsdel'));
-        common_element('p', null, 'Feeds:');
-        common_element_start('ul', array('class' => 'xoxo'));
+        $this->elementStart('div', array('class' => 'feedsdel'));
+        $this->element('p', null, 'Feeds:');
+        $this->elementStart('ul', array('class' => 'xoxo'));
 
         foreach ($feeds as $key => $value) {
             $this->common_feed_item($feeds[$key]);
         }
-        common_element_end('ul');
-        common_element_end('div');
+        $this->elementEnd('ul');
+        $this->elementEnd('div');
     }
 
     //TODO move to common.php (and retrace its origin)
@@ -81,19 +81,19 @@ class DeleteprofileAction extends Action
                 $feed['textContent'] = "FOAF";
                 break;
         }
-        common_element_start('li');
-        common_element('a', array('href' => $feed['href'],
+        $this->elementStart('li');
+        $this->element('a', array('href' => $feed['href'],
                                   'class' => $feed_classname,
                                   'type' => $feed_mimetype,
                                   'title' => $feed_title),
                             $feed['textContent']);
-        common_element_end('li');
+        $this->elementEnd('li');
     }
 
     function show_form($msg=null, $success=false)
     {
         $this->form_header(_('Delete my account'), $msg, $success);
-        common_element('h2', null, _('Delete my account confirmation'));
+        $this->element('h2', null, _('Delete my account confirmation'));
         $this->show_confirm_delete_form();
         common_show_footer();
     }
@@ -105,13 +105,13 @@ class DeleteprofileAction extends Action
         $notices->profile_id = $user->id;
         $notice_count = (int) $notices->count();
 
-        common_element_start('form', array('method' => 'POST',
+        $this->elementStart('form', array('method' => 'POST',
                                            'id' => 'delete',
                                            'action' =>
                                            common_local_url('deleteprofile')));
 
-        common_hidden('token', common_session_token());
-        common_element('p', null, "Last chance to copy your notices and contacts by saving the two links below before deleting your account. Be careful, this operation cannot be undone.");
+        $this->hidden('token', common_session_token());
+        $this->element('p', null, "Last chance to copy your notices and contacts by saving the two links below before deleting your account. Be careful, this operation cannot be undone.");
 
         $this->show_feeds_list(array(0=>array('href'=>common_local_url('userrss', array('limit' => $notice_count, 'nickname' => $user->nickname)),
                                               'type' => 'rss',
@@ -122,10 +122,10 @@ class DeleteprofileAction extends Action
                                               'version' => 'FOAF',
                                               'item' => 'foaf')));
 
-        common_checkbox('confirmation', _('Check if you are sure you want to delete your account.'));
+        $this->checkbox('confirmation', _('Check if you are sure you want to delete your account.'));
 
-        common_submit('deleteaccount', _('Delete my account'));
-        common_element_end('form');
+        $this->submit('deleteaccount', _('Delete my account'));
+        $this->elementEnd('form');
     }
 
     function handle_post()
@@ -238,9 +238,9 @@ class DeleteprofileAction extends Action
         } else {
             $inst = $this->get_instructions();
             $output = common_markup_to_html($inst);
-            common_element_start('div', 'instructions');
-            common_raw($output);
-            common_element_end('div');
+            $this->elementStart('div', 'instructions');
+            $this->raw($output);
+            $this->elementEnd('div');
         }
         $this->settings_menu();
     }
@@ -272,7 +272,7 @@ class DeleteprofileAction extends Action
                       _('Other options')));
 
         $action = $this->trimmed('action');
-        common_element_start('ul', array('id' => 'nav_views'));
+        $this->elementStart('ul', array('id' => 'nav_views'));
         foreach ($menu as $menuaction => $menudesc) {
             if ($menuaction == 'imsettings' &&
                 !common_config('xmpp', 'enabled')) {
@@ -283,7 +283,7 @@ class DeleteprofileAction extends Action
                     $menudesc[1],
                     $action == $menuaction);
         }
-        common_element_end('ul');
+        $this->elementEnd('ul');
     }
 }
 
index 74aae86cc716e046aa38102852b9a8a85a60ef78..3e3e4a5476d48e43743c3807cb07f5df20455fd5 100644 (file)
@@ -28,7 +28,7 @@ class DisfavorAction extends Action
         parent::handle($args);
 
         if (!common_logged_in()) {
-            common_user_error(_('Not logged in.'));
+            $this->clientError(_('Not logged in.'));
             return;
         }
 
@@ -46,7 +46,7 @@ class DisfavorAction extends Action
         $token = $this->trimmed('token-'.$notice->id);
 
         if (!$token || $token != common_session_token()) {
-            $this->client_error(_("There was a problem with your session token. Try again, please."));
+            $this->clientError(_("There was a problem with your session token. Try again, please."));
             return;
         }
 
@@ -54,7 +54,7 @@ class DisfavorAction extends Action
         $fave->user_id = $this->id;
         $fave->notice_id = $notice->id;
         if (!$fave->find(true)) {
-            $this->client_error(_('This notice is not a favorite!'));
+            $this->clientError(_('This notice is not a favorite!'));
             return;
         }
 
@@ -62,21 +62,21 @@ class DisfavorAction extends Action
 
         if (!$result) {
             common_log_db_error($fave, 'DELETE', __FILE__);
-            $this->server_error(_('Could not delete favorite.'));
+            $this->serverError(_('Could not delete favorite.'));
             return;
         }
         
         $user->blowFavesCache();
 
         if ($this->boolean('ajax')) {
-            common_start_html('text/xml;charset=utf-8', true);
-            common_element_start('head');
-            common_element('title', null, _('Add to favorites'));
-            common_element_end('head');
-            common_element_start('body');
+            $this->startHTML('text/xml;charset=utf-8', true);
+            $this->elementStart('head');
+            $this->element('title', null, _('Add to favorites'));
+            $this->elementEnd('head');
+            $this->elementStart('body');
             common_favor_form($notice);
-            common_element_end('body');
-            common_element_end('html');
+            $this->elementEnd('body');
+            $this->elementEnd('html');
         } else {
             common_redirect(common_local_url('showfavorites',
                                              array('nickname' => $user->nickname)));
index 856025e665217fca550aae57013eb6383745b218..3d14b25b8a194e6d5a2563e31b727dc907c7eb82 100644 (file)
@@ -28,13 +28,13 @@ class DocAction extends Action
         $title = $this->trimmed('title');
         $filename = INSTALLDIR.'/doc/'.$title;
         if (!file_exists($filename)) {
-            common_user_error(_('No such document.'));
+            $this->clientError(_('No such document.'));
             return;
         }
         $c = file_get_contents($filename);
         $output = common_markup_to_html($c);
         common_show_header(_(ucfirst($title)));
-        common_raw($output);
+        $this->raw($output);
         common_show_footer();
     }
 }
index 3fa8ce2968b3e48089a1f0d873cd88908b987c53..b84acb214150902cc15e68b6bfe1794f64fa8ab1 100644 (file)
@@ -1,9 +1,12 @@
 <?php
-/*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+/**
+ * Laconica, the distributed open-source microblogging tool
  *
- * This program is free software: you can redistribute it and/or modify
+ * Settings for email
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Settings
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Zach Copley <zach@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+    exit(1);
+}
 
-require_once(INSTALLDIR.'/lib/settingsaction.php');
+require_once INSTALLDIR.'/lib/accountsettingsaction.php';
 
-class EmailsettingsAction extends SettingsAction
+/**
+ * Settings for email
+ *
+ * @category Settings
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Zach Copley <zach@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      Widget
+ */
+
+class EmailsettingsAction extends AccountSettingsAction
 {
+    /**
+     * Title of the page
+     *
+     * @return string Title of the page
+     */
+
+    function title()
+    {
+        return _('Email Settings');
+    }
+
+    /**
+     * Instructions for use
+     *
+     * @return instructions for use
+     */
 
-    function get_instructions()
+    function getInstructions()
     {
         return _('Manage how you get email from %%site.name%%.');
     }
 
-    function show_form($msg=null, $success=false)
+    /**
+     * Content area of the page
+     *
+     * Shows a form for adding and removing email addresses and setting
+     * email preferences.
+     *
+     * @return void
+     */
+
+    function showContent()
     {
         $user = common_current_user();
-        $this->form_header(_('Email Settings'), $msg, $success);
-        common_element_start('form', array('method' => 'post',
-                                           'id' => 'emailsettings',
-                                           'action' =>
-                                           common_local_url('emailsettings')));
-        common_hidden('token', common_session_token());
 
-        common_element('h2', null, _('Address'));
+        $this->elementStart('form', array('method' => 'post',
+                                          'id' => 'form_settings_email',
+                                          'class' => 'form_settings',
+                                          'action' =>
+                                          common_local_url('emailsettings')));
+
+        $this->elementStart('fieldset', array('id' => 'settings_email_address'));
+        $this->element('legend', null, _('Address'));
+        $this->hidden('token', common_session_token());
 
         if ($user->email) {
-            common_element_start('p');
-            common_element('span', 'address confirmed', $user->email);
-            common_element('span', 'input_instructions',
-                           _('Current confirmed email address.'));
-            common_hidden('email', $user->email);
-            common_element_end('p');
-            common_submit('remove', _('Remove'));
+            $this->element('p', array('id' => 'form_confirmed'), $user->email);
+            $this->element('p', array('class' => 'form_note'), _('Current confirmed email address.'));
+            $this->hidden('email', $user->email);
+            $this->submit('remove', _('Remove'));
         } else {
-            $confirm = $this->get_confirmation();
+            $confirm = $this->getConfirmation();
             if ($confirm) {
-                common_element_start('p');
-                common_element('span', 'address unconfirmed', $confirm->address);
-                common_element('span', 'input_instructions',
-                               _('Awaiting confirmation on this address. Check your inbox (and spam box!) for a message with further instructions.'));
-                common_hidden('email', $confirm->address);
-                common_element_end('p');
-                common_submit('cancel', _('Cancel'));
+                $this->element('p', array('id' => 'form_unconfirmed'), $confirm->address);
+                $this->element('p', array('class' => 'form_note'),
+                                        _('Awaiting confirmation on this address. '.
+                                        'Check your inbox (and spam box!) for a message '.
+                                        'with further instructions.'));
+                $this->hidden('email', $confirm->address);
+                $this->submit('cancel', _('Cancel'));
             } else {
-                common_input('email', _('Email Address'),
+                $this->elementStart('ul', 'form_data');
+                $this->elementStart('li');
+                $this->input('email', _('Email Address'),
                              ($this->arg('email')) ? $this->arg('email') : null,
                              _('Email address, like "UserName@example.org"'));
-                common_submit('add', _('Add'));
+                $this->elementEnd('li');
+                $this->elementEnd('ul');
+                $this->submit('add', _('Add'));
             }
         }
+        $this->elementEnd('fieldset');
 
-        if ($user->email) {
-            common_element('h2', null, _('Incoming email'));
-            
+       if ($user->email) {
+            $this->elementStart('fieldset', array('id' => 'settings_email_incoming'));
+            $this->element('legend',_('Incoming email'));
             if ($user->incomingemail) {
-                common_element_start('p');
-                common_element('span', 'address', $user->incomingemail);
-                common_element('span', 'input_instructions',
+                $this->elementStart('p');
+                $this->element('span', 'address', $user->incomingemail);
+                $this->element('span', 'input_instructions',
                                _('Send email to this address to post new notices.'));
-                common_element_end('p');
-                common_submit('removeincoming', _('Remove'));
+                $this->elementEnd('p');
+                $this->submit('removeincoming', _('Remove'));
             }
-            
-            common_element_start('p');
-            common_element('span', 'input_instructions',
-                           _('Make a new email address for posting to; cancels the old one.'));
-            common_element_end('p');
-            common_submit('newincoming', _('New'));
+
+            $this->elementStart('p');
+            $this->element('span', 'input_instructions',
+                           _('Make a new email address for posting to; '.
+                             'cancels the old one.'));
+            $this->elementEnd('p');
+            $this->submit('newincoming', _('New'));
+            $this->elementEnd('fieldset');
         }
-        
-        common_element('h2', null, _('Preferences'));
 
-        common_checkbox('emailnotifysub',
+        $this->elementStart('fieldset', array('id' => 'settings_email_preferences'));
+        $this->element('legend', null, _('Preferences'));
+
+        $this->elementStart('ul', 'form_data');
+        $this->elementStart('li');
+        $this->checkbox('emailnotifysub',
                         _('Send me notices of new subscriptions through email.'),
                         $user->emailnotifysub);
-        common_checkbox('emailnotifyfav',
-                        _('Send me email when someone adds my notice as a favorite.'),
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->checkbox('emailnotifyfav',
+                        _('Send me email when someone '.
+                          'adds my notice as a favorite.'),
                         $user->emailnotifyfav);
-        common_checkbox('emailnotifymsg',
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->checkbox('emailnotifymsg',
                         _('Send me email when someone sends me a private message.'),
                         $user->emailnotifymsg);
-        common_checkbox('emailnotifynudge',
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->checkbox('emailnotifynudge',
                         _('Allow friends to nudge me and send me an email.'),
                         $user->emailnotifynudge);
-        common_checkbox('emailpost',
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->checkbox('emailpost',
                         _('I want to post notices by email.'),
                         $user->emailpost);
-        common_checkbox('emailmicroid',
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->checkbox('emailmicroid',
                         _('Publish a MicroID for my email address.'),
                         $user->emailmicroid);
-
-        common_submit('save', _('Save'));
-        
-        common_element_end('form');
-        common_show_footer();
+        $this->elementEnd('li');
+        $this->elementEnd('ul');
+        $this->submit('save', _('Save'));
+        $this->elementEnd('fieldset');
+        $this->elementEnd('form');
     }
 
-    function get_confirmation()
+    /**
+     * Gets any existing email address confirmations we're waiting for
+     *
+     * @return Confirm_address Email address confirmation for user, or null
+     */
+
+    function getConfirmation()
     {
         $user = common_current_user();
+
         $confirm = new Confirm_address();
-        $confirm->user_id = $user->id;
+
+        $confirm->user_id      = $user->id;
         $confirm->address_type = 'email';
+
         if ($confirm->find(true)) {
             return $confirm;
         } else {
@@ -126,133 +206,165 @@ class EmailsettingsAction extends SettingsAction
         }
     }
 
-    function handle_post()
+    /**
+     * Handle posts
+     *
+     * Since there are a lot of different options on the page, we
+     * figure out what we're supposed to do based on which button was
+     * pushed
+     *
+     * @return void
+     */
+
+    function handlePost()
     {
-
-        # CSRF protection
+        // CSRF protection
         $token = $this->trimmed('token');
         if (!$token || $token != common_session_token()) {
-            $this->show_form(_('There was a problem with your session token. Try again, please.'));
+            $this->show_form(_('There was a problem with your session token. '.
+                               'Try again, please.'));
             return;
         }
 
         if ($this->arg('save')) {
-            $this->save_preferences();
+            $this->savePreferences();
         } else if ($this->arg('add')) {
-            $this->add_address();
+            $this->addAddress();
         } else if ($this->arg('cancel')) {
-            $this->cancel_confirmation();
+            $this->cancelConfirmation();
         } else if ($this->arg('remove')) {
-            $this->remove_address();
+            $this->removeAddress();
         } else if ($this->arg('removeincoming')) {
-            $this->remove_incoming();
+            $this->removeIncoming();
         } else if ($this->arg('newincoming')) {
-            $this->new_incoming();
+            $this->newIncoming();
         } else {
-            $this->show_form(_('Unexpected form submission.'));
+            $this->showForm(_('Unexpected form submission.'));
         }
     }
 
-    function save_preferences()
-    {
+    /**
+     * Save email preferences
+     *
+     * @return void
+     */
 
-        $emailnotifysub = $this->boolean('emailnotifysub');
-        $emailnotifyfav = $this->boolean('emailnotifyfav');
-        $emailnotifymsg = $this->boolean('emailnotifymsg');
+    function savePreferences()
+    {
+        $emailnotifysub   = $this->boolean('emailnotifysub');
+        $emailnotifyfav   = $this->boolean('emailnotifyfav');
+        $emailnotifymsg   = $this->boolean('emailnotifymsg');
         $emailnotifynudge = $this->boolean('emailnotifynudge');
-        $emailmicroid = $this->boolean('emailmicroid');
-        $emailpost = $this->boolean('emailpost');
+        $emailmicroid     = $this->boolean('emailmicroid');
+        $emailpost        = $this->boolean('emailpost');
 
         $user = common_current_user();
 
-        assert(!is_null($user)); # should already be checked
+        assert(!is_null($user)); // should already be checked
 
         $user->query('BEGIN');
 
         $original = clone($user);
 
-        $user->emailnotifysub = $emailnotifysub;
-        $user->emailnotifyfav = $emailnotifyfav;
-        $user->emailnotifymsg = $emailnotifymsg;
+        $user->emailnotifysub   = $emailnotifysub;
+        $user->emailnotifyfav   = $emailnotifyfav;
+        $user->emailnotifymsg   = $emailnotifymsg;
         $user->emailnotifynudge = $emailnotifynudge;
-        $user->emailmicroid = $emailmicroid;
-        $user->emailpost = $emailpost;
+        $user->emailmicroid     = $emailmicroid;
+        $user->emailpost        = $emailpost;
 
         $result = $user->update($original);
 
         if ($result === false) {
             common_log_db_error($user, 'UPDATE', __FILE__);
-            common_server_error(_('Couldn\'t update user.'));
+            $this->serverError(_('Couldn\'t update user.'));
             return;
         }
 
         $user->query('COMMIT');
 
-        $this->show_form(_('Preferences saved.'), true);
+        $this->showForm(_('Preferences saved.'), true);
     }
 
-    function add_address()
-    {
+    /**
+     * Add the address passed in by the user
+     *
+     * @return void
+     */
 
+    function addAddress()
+    {
         $user = common_current_user();
 
         $email = $this->trimmed('email');
 
-        # Some validation
+        // Some validation
 
         if (!$email) {
-            $this->show_form(_('No email address.'));
+            $this->showForm(_('No email address.'));
             return;
         }
 
         $email = common_canonical_email($email);
 
         if (!$email) {
-            $this->show_form(_('Cannot normalize that email address'));
+            $this->showForm(_('Cannot normalize that email address'));
             return;
         }
         if (!Validate::email($email, true)) {
-            $this->show_form(_('Not a valid email address'));
+            $this->showForm(_('Not a valid email address'));
             return;
         } else if ($user->email == $email) {
-            $this->show_form(_('That is already your email address.'));
+            $this->showForm(_('That is already your email address.'));
             return;
-        } else if ($this->email_exists($email)) {
-            $this->show_form(_('That email address already belongs to another user.'));
+        } else if ($this->emailExists($email)) {
+            $this->showForm(_('That email address already belongs '.
+                              'to another user.'));
             return;
         }
 
-          $confirm = new Confirm_address();
-           $confirm->address = $email;
-           $confirm->address_type = 'email';
-           $confirm->user_id = $user->id;
-           $confirm->code = common_confirmation_code(64);
+        $confirm = new Confirm_address();
+
+        $confirm->address      = $email;
+        $confirm->address_type = 'email';
+        $confirm->user_id      = $user->id;
+        $confirm->code         = common_confirmation_code(64);
 
         $result = $confirm->insert();
 
         if ($result === false) {
             common_log_db_error($confirm, 'INSERT', __FILE__);
-            common_server_error(_('Couldn\'t insert confirmation code.'));
+            $this->serverError(_('Couldn\'t insert confirmation code.'));
             return;
         }
 
         mail_confirm_address($user, $confirm->code, $user->nickname, $email);
 
-        $msg = _('A confirmation code was sent to the email address you added. Check your inbox (and spam box!) for the code and instructions on how to use it.');
+        $msg = _('A confirmation code was sent to the email address you added. '.
+                 'Check your inbox (and spam box!) for the code and instructions '.
+                 'on how to use it.');
 
-        $this->show_form($msg, true);
+        $this->showForm($msg, true);
     }
 
-    function cancel_confirmation()
+    /**
+     * Handle a request to cancel email confirmation
+     *
+     * @return void
+     */
+
+    function cancelConfirmation()
     {
         $email = $this->arg('email');
-        $confirm = $this->get_confirmation();
+
+        $confirm = $this->getConfirmation();
+
         if (!$confirm) {
-            $this->show_form(_('No pending confirmation to cancel.'));
+            $this->showForm(_('No pending confirmation to cancel.'));
             return;
         }
         if ($confirm->address != $email) {
-            $this->show_form(_('That is the wrong IM address.'));
+            $this->showForm(_('That is the wrong IM address.'));
             return;
         }
 
@@ -260,79 +372,115 @@ class EmailsettingsAction extends SettingsAction
 
         if (!$result) {
             common_log_db_error($confirm, 'DELETE', __FILE__);
-            $this->server_error(_('Couldn\'t delete email confirmation.'));
+            $this->serverError(_('Couldn\'t delete email confirmation.'));
             return;
         }
 
-        $this->show_form(_('Confirmation cancelled.'), true);
+        $this->showForm(_('Confirmation cancelled.'), true);
     }
 
-    function remove_address()
-    {
+    /**
+     * Handle a request to remove an address from the user's account
+     *
+     * @return void
+     */
 
+    function removeAddress()
+    {
         $user = common_current_user();
+
         $email = $this->arg('email');
 
-        # Maybe an old tab open...?
+        // Maybe an old tab open...?
 
         if ($user->email != $email) {
-            $this->show_form(_('That is not your email address.'));
+            $this->showForm(_('That is not your email address.'));
             return;
         }
 
         $user->query('BEGIN');
+
         $original = clone($user);
+
         $user->email = null;
+
         $result = $user->updateKeys($original);
+
         if (!$result) {
             common_log_db_error($user, 'UPDATE', __FILE__);
-            common_server_error(_('Couldn\'t update user.'));
+            $this->serverError(_('Couldn\'t update user.'));
             return;
         }
         $user->query('COMMIT');
 
-        $this->show_form(_('The address was removed.'), true);
+        $this->showForm(_('The address was removed.'), true);
     }
 
-    function remove_incoming()
+    /**
+     * Handle a request to remove an incoming email address
+     *
+     * @return void
+     */
+
+    function removeIncoming()
     {
         $user = common_current_user();
-        
+
         if (!$user->incomingemail) {
-            $this->show_form(_('No incoming email address.'));
+            $this->showForm(_('No incoming email address.'));
             return;
         }
-        
+
         $orig = clone($user);
+
         $user->incomingemail = null;
 
         if (!$user->updateKeys($orig)) {
             common_log_db_error($user, 'UPDATE', __FILE__);
-            $this->server_error(_("Couldn't update user record."));
+            $this->serverError(_("Couldn't update user record."));
         }
-        
-        $this->show_form(_('Incoming email address removed.'), true);
+
+        $this->showForm(_('Incoming email address removed.'), true);
     }
 
-    function new_incoming()
+    /**
+     * Generate a new incoming email address
+     *
+     * @return void
+     */
+
+    function newIncoming()
     {
         $user = common_current_user();
-        
+
         $orig = clone($user);
+
         $user->incomingemail = mail_new_incoming_address();
-        
+
         if (!$user->updateKeys($orig)) {
             common_log_db_error($user, 'UPDATE', __FILE__);
-            $this->server_error(_("Couldn't update user record."));
+            $this->serverError(_("Couldn't update user record."));
         }
 
-        $this->show_form(_('New incoming email address added.'), true);
+        $this->showForm(_('New incoming email address added.'), true);
     }
-    
-    function email_exists($email)
+
+    /**
+     * Does another user already have this email address?
+     *
+     * Email addresses are unique for users.
+     *
+     * @param string $email Address to check
+     *
+     * @return boolean Whether the email already exists.
+     */
+
+    function emailExists($email)
     {
         $user = common_current_user();
+
         $other = User::staticGet('email', $email);
+
         if (!$other) {
             return false;
         } else {
index 3696df90ac534b962e803de50e042be78e6fbfc3..ae29ee1f841feb508807ae4eda4babd854aae0f2 100644 (file)
@@ -30,7 +30,7 @@ class FacebookhomeAction extends FacebookAction
 
         $facebook = get_facebook();
         $fbuid = $facebook->require_login();
+
         // Check to see whether there's already a Facebook link for this user
         $flink = Foreign_link::getByForeignID($fbuid, FACEBOOK_SERVICE);
 
@@ -44,7 +44,7 @@ class FacebookhomeAction extends FacebookAction
 
         if ($flink) {
 
-            if ($_POST['submit'] == 'Send') {       
+            if ($_POST['submit'] == 'Send') {
                 $this->saveNewNotice($flink);
                 return;
             }
@@ -141,10 +141,10 @@ class FacebookhomeAction extends FacebookAction
         $notice = $user->getCurrentNotice();
         update_profile_box($facebook, $fbuid, $user, $notice);
 
-        $this->showHeader($msg);      
+        $this->showHeader($msg);
         $this->showNoticeForm($user);
         $this->showNav('Home');
-        
+
         echo $this->showNotices($user);
 
         $this->showFooter();
@@ -224,13 +224,13 @@ class FacebookhomeAction extends FacebookAction
         common_end_xml();
 
     }
-    
+
     function saveNewNotice($flink)
     {
-        
+
         $user = $flink->getUser();
 
-        $content = $_POST['status_textarea']; 
+        $content = $_POST['status_textarea'];
 
         if (!$content) {
             $this->showHome($flink, _('No content!'));
@@ -268,5 +268,5 @@ class FacebookhomeAction extends FacebookAction
         common_broadcast_notice($notice);
         $this->showHome($flink, 'Success!');
     }
-    
+
 }
index e67bfaa0006422378b843b271921a353ca5b1e37..1e6f6496e0ae093d49e8f0b00623ede4559727b9 100644 (file)
@@ -43,22 +43,22 @@ class FacebookinviteAction extends FacebookAction
 
         $this->showHeader('Invite');
 
-        common_element('h2', null, _('Thanks for inviting your friends to use Identi.ca!'));
-        common_element('p', null, _('Invitations have been sent to the following users:'));
+        $this->element('h2', null, _('Thanks for inviting your friends to use Identi.ca!'));
+        $this->element('p', null, _('Invitations have been sent to the following users:'));
 
         $friend_ids = $_POST['ids']; // Hmm... $this->arg('ids') doesn't seem to work
 
-        common_element_start("ul");
+        $this->elementStart("ul");
 
         foreach ($friend_ids as $friend) {
-            common_element_start('li');
-            common_element('fb:profile-pic', array('uid' => $friend));
-            common_element('fb:name', array('uid' => $friend,
+            $this->elementStart('li');
+            $this->element('fb:profile-pic', array('uid' => $friend));
+            $this->element('fb:name', array('uid' => $friend,
                                             'capitalize' => 'true'));
-            common_element_end('li');
+            $this->elementEnd('li');
         }
 
-        common_element_end("ul");
+        $this->elementEnd("ul");
 
         $this->showFooter();
     }
@@ -78,32 +78,32 @@ class FacebookinviteAction extends FacebookAction
         $content = _('You have been invited to Identi.ca!') .
             htmlentities('<fb:req-choice url="http://apps.facebook.com/identica_app/" label="Add"/>');
 
-        common_element_start('fb:request-form', array('action' => 'invite.php',
+        $this->elementStart('fb:request-form', array('action' => 'invite.php',
                                                       'method' => 'post',
                                                       'invite' => 'true',
                                                       'type' => 'Identi.ca',
                                                       'content' => $content));
-        common_hidden('invite', 'true');
+        $this->hidden('invite', 'true');
         $actiontext = 'Invite your friends to use Identi.ca.';
-        common_element('fb:multi-friend-selector', array('showborder' => 'false',
+        $this->element('fb:multi-friend-selector', array('showborder' => 'false',
                                                                'actiontext' => $actiontext,
                                                                'exclude_ids' => implode(',', $exclude_ids),
                                                                'bypass' => 'cancel'));
 
-        common_element_end('fb:request-form');
+        $this->elementEnd('fb:request-form');
 
-        common_element('h2', null, _('Friends already using Identi.ca:'));
-        common_element_start("ul");
+        $this->element('h2', null, _('Friends already using Identi.ca:'));
+        $this->elementStart("ul");
 
         foreach ($exclude_ids as $friend) {
-            common_element_start('li');
-            common_element('fb:profile-pic', array('uid' => $friend));
-            common_element('fb:name', array('uid' => $friend,
+            $this->elementStart('li');
+            $this->element('fb:profile-pic', array('uid' => $friend));
+            $this->element('fb:name', array('uid' => $friend,
                                             'capitalize' => 'true'));
-            common_element_end('li');
+            $this->elementEnd('li');
         }
 
-        common_element_end("ul");
+        $this->elementEnd("ul");
 
         $this->showFooter();
 
index 557c0655b48b0e826d36750d58abd6fa4e9dbea9..376e12a2e9ddfb2d64ae8f282945197c86d567b3 100644 (file)
@@ -53,7 +53,7 @@ class FacebookremoveAction extends FacebookAction
 
             if (!$result) {
                 common_log_db_error($flink, 'DELETE', __FILE__);
-                common_server_error(_('Couldn\'t remove Facebook user.'));
+                $this->serverError(_('Couldn\'t remove Facebook user.'));
                 return;
             }
 
index a08abc93719117d9a161b29121494a9591ef5b5a..bc034bc46d7a3e538fa60efd9b544e9e09f2a88d 100644 (file)
@@ -72,26 +72,25 @@ class FacebooksettingsAction extends FacebookAction
 
         if ($facebook->api_client->users_hasAppPermission('status_update')) {
 
-            common_element_start('form', array('method' => 'post',
+            $this->elementStart('form', array('method' => 'post',
                                                'id' => 'facebook_settings'));
 
-            common_element('h2', null, _('Sync preferences'));
+            $this->element('h2', null, _('Sync preferences'));
 
-            common_checkbox('noticesync', _('Automatically update my Facebook status with my notices.'),
+            $this->checkbox('noticesync', _('Automatically update my Facebook status with my notices.'),
                                 ($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND) : true);
 
-            common_checkbox('replysync', _('Send "@" replies to Facebook.'),
+            $this->checkbox('replysync', _('Send "@" replies to Facebook.'),
                              ($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : true);
 
             $prefix = $facebook->api_client->data_getUserPreference(1);
 
-
-            common_input('prefix', _('Prefix'),
+            $this->input('prefix', _('Prefix'),
                          ($prefix) ? $prefix : null,
                          _('A string to prefix notices with.'));
-            common_submit('save', _('Save'));
+            $this->submit('save', _('Save'));
 
-            common_element_end('form');
+            $this->elementEnd('form');
 
         } else {
 
index 8103f8181b72a699bdaa36a0b3236bb212f65256..afda93cff29ae109c81a6e287ad797934f7d7814 100644 (file)
@@ -29,7 +29,7 @@ class FavorAction extends Action
         parent::handle($args);
 
         if (!common_logged_in()) {
-            common_user_error(_('Not logged in.'));
+            $this->clientError(_('Not logged in.'));
             return;
         }
 
@@ -48,19 +48,19 @@ class FavorAction extends Action
 
         $token = $this->trimmed('token-'.$notice->id);
         if (!$token || $token != common_session_token()) {
-            $this->client_error(_("There was a problem with your session token. Try again, please."));
+            $this->clientError(_("There was a problem with your session token. Try again, please."));
             return;
         }
 
         if ($user->hasFave($notice)) {
-            $this->client_error(_('This notice is already a favorite!'));
+            $this->clientError(_('This notice is already a favorite!'));
             return;
         }
 
         $fave = Fave::addNew($user, $notice);
 
         if (!$fave) {
-            $this->server_error(_('Could not create favorite.'));
+            $this->serverError(_('Could not create favorite.'));
             return;
         }
 
@@ -68,14 +68,14 @@ class FavorAction extends Action
         $user->blowFavesCache();
         
         if ($this->boolean('ajax')) {
-            common_start_html('text/xml;charset=utf-8', true);
-            common_element_start('head');
-            common_element('title', null, _('Disfavor favorite'));
-            common_element_end('head');
-            common_element_start('body');
+            $this->startHTML('text/xml;charset=utf-8', true);
+            $this->elementStart('head');
+            $this->element('title', null, _('Disfavor favorite'));
+            $this->elementEnd('head');
+            $this->elementStart('body');
             common_disfavor_form($notice);
-            common_element_end('body');
-            common_element_end('html');
+            $this->elementEnd('body');
+            $this->elementEnd('html');
         } else {
             common_redirect(common_local_url('showfavorites',
                                              array('nickname' => $user->nickname)));
index 71a9e026e5a7f863c6fa517de644b94449e704d1..0223564f34e754fbdc27eba4bea23d723b3d29ce 100644 (file)
 <?php
-/*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+/**
+ * Laconica, the distributed open-source microblogging tool
  *
- * This program is free software: you can redistribute it and/or modify
+ * List of popular notices
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU Affero General Public License for more details.
  *
  * You should have received a copy of the GNU Affero General Public License
- * along with this program.     If not, see <http://www.gnu.org/licenses/>.
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Public
+ * @package   Laconica
+ * @author    Zach Copley <zach@controlyourself.ca>
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+    exit(1);
+}
 
-require_once(INSTALLDIR.'/lib/stream.php');
+require_once INSTALLDIR.'/lib/publicgroupnav.php';
+require_once INSTALLDIR.'/lib/noticelist.php';
 
-class FavoritedAction extends StreamAction
+/**
+ * List of popular notices
+ *
+ * We provide a list of the most popular notices. Popularity
+ * is measured by
+ *
+ * @category Personal
+ * @package  Laconica
+ * @author   Zach Copley <zach@controlyourself.ca>
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ */
+
+class FavoritedAction extends Action
 {
+    var $page = null;
 
-    function handle($args)
+    /**
+     * Title of the page
+     *
+     * @return string Title of the page
+     */
+
+    function title()
     {
-        parent::handle($args);
+        if ($this->page == 1) {
+            return _('Popular notices');
+        } else {
+            return sprintf(_('Popular notices, page %d'), $this->page);
+        }
+    }
 
-        $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
+    /**
+     * Instructions for use
+     *
+     * @return instructions for use
+     */
 
-        common_show_header(_('Popular notices'),
-                           array($this, 'show_header'), null,
-                           array($this, 'show_top'));
+    function getInstructions()
+    {
+        return _('The most popular notices on the site right now.');
+    }
 
-        $this->show_notices($page);
+    /**
+     * Is this page read-only?
+     *
+     * @return boolean true
+     */
 
-        common_show_footer();
+    function isReadOnly()
+    {
+        return true;
     }
 
-    function show_top()
+    /**
+     * Take arguments for running
+     *
+     * @param array $args $_REQUEST args
+     *
+     * @return boolean success flag
+     *
+     * @todo move queries from showContent() to here
+     */
+
+    function prepare($args)
     {
-        $instr = $this->get_instructions();
-        $output = common_markup_to_html($instr);
-        common_element_start('div', 'instructions');
-        common_raw($output);
-        common_element_end('div');
-        $this->public_views_menu();
+        parent::prepare($args);
+        $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
+        return true;
     }
 
-    function show_header()
+    /**
+     * Handle request
+     *
+     * Shows a page with list of favorite notices
+     *
+     * @param array $args $_REQUEST args; handled in prepare()
+     *
+     * @return void
+     */
+
+    function handle($args)
     {
-        return;
+        parent::handle($args);
+
+        $this->showPage();
     }
 
-    function get_instructions()
+    /**
+     * Show the page notice
+     *
+     * Shows instructions for the page
+     *
+     * @return void
+     */
+
+    function showPageNotice()
     {
-        return _('Showing recently popular notices');
+        $instr  = $this->getInstructions();
+        $output = common_markup_to_html($instr);
+
+        $this->elementStart('div', 'instructions');
+        $this->raw($output);
+        $this->elementEnd('div');
     }
 
-    function show_notices($page)
+    /**
+     * Local navigation
+     *
+     * This page is part of the public group, so show that.
+     *
+     * @return void
+     */
+
+    function showLocalNav()
     {
+        $nav = new PublicGroupNav($this);
+        $nav->show();
+    }
 
-        $qry = 'SELECT notice.*, sum(exp(-(now() - fave.modified) / %s)) as weight ' .
-                'FROM notice JOIN fave ON notice.id = fave.notice_id ' .
-                'GROUP BY fave.notice_id ' .
-                'ORDER BY weight DESC';
+    /**
+     * Content area
+     *
+     * Shows the list of popular notices
+     *
+     * @return void
+     */
 
-        $offset = ($page - 1) * NOTICES_PER_PAGE;
-        $limit = NOTICES_PER_PAGE + 1;
+    function showContent()
+    {
+        $qry = 'SELECT notice.*, '.
+          'sum(exp(-(now() - fave.modified) / %s)) as weight ' .
+          'FROM notice JOIN fave ON notice.id = fave.notice_id ' .
+          'GROUP BY fave.notice_id ' .
+          'ORDER BY weight DESC';
+
+        $offset = ($this->page - 1) * NOTICES_PER_PAGE;
+        $limit  = NOTICES_PER_PAGE + 1;
 
-        if (common_config('db','type') == 'pgsql') {
+        if (common_config('db', 'type') == 'pgsql') {
             $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
         } else {
             $qry .= ' LIMIT ' . $offset . ', ' . $limit;
         }
 
-        # Figure out how to cache this query
+        // XXX: Figure out how to cache this query
 
         $notice = new Notice;
         $notice->query(sprintf($qry, common_config('popular', 'dropoff')));
 
-        common_element_start('ul', array('id' => 'notices'));
-
-        $cnt = 0;
-
-        while ($notice->fetch() && $cnt <= NOTICES_PER_PAGE) {
-            $cnt++;
+        $nl = new NoticeList($notice, $this);
 
-            if ($cnt > NOTICES_PER_PAGE) {
-                break;
-            }
+        $cnt = $nl->show();
 
-            $item = new NoticeListItem($notice);
-            $item->show();
-        }
-
-        common_element_end('ul');
-
-        common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
-                          $page, 'favorited');
+        $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
+                          $this->page, 'favorited');
     }
-
 }
index 8c7ce52bf16c667a1786383a092e79376a172bfa..3f4ffc63a0481c79cfc646f218b5721157536de5 100644 (file)
@@ -34,7 +34,7 @@ class FavoritesrssAction extends Rss10Action
         $this->user = User::staticGet('nickname', $nickname);
 
         if (!$this->user) {
-            common_user_error(_('No such user.'));
+            $this->clientError(_('No such user.'));
             return false;
         } else {
             return true;
index 2bf8b0b815cf2c8f1e909260b7694fd0ff79cbeb..0356226914d1c3845f78d473ee14422ae4bcc55a 100644 (file)
@@ -44,9 +44,9 @@ class FeaturedAction extends StreamAction
     {
         $instr = $this->get_instructions();
         $output = common_markup_to_html($instr);
-        common_element_start('div', 'instructions');
-        common_raw($output);
-        common_element_end('div');
+        $this->elementStart('div', 'instructions');
+        $this->raw($output);
+        $this->elementEnd('div');
         $this->public_views_menu();
     }
 
index 0ce1680aa60fbaa135d3ac25d1d8219719e02f01..8f10505cffe1b3ac40fc70dbce97385af7bef774 100644 (file)
@@ -1,9 +1,12 @@
 <?php
-/*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+/**
+ * Laconica, the distributed open-source microblogging tool
  *
- * This program is free software: you can redistribute it and/or modify
+ * Complete adding an OpenID
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Settings
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+    exit(1);
+}
 
-require_once(INSTALLDIR.'/lib/openid.php');
+require_once INSTALLDIR.'/lib/openid.php';
+
+/**
+ * Complete adding an OpenID
+ *
+ * Handle the return from an OpenID verification
+ *
+ * @category Settings
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ */
 
 class FinishaddopenidAction extends Action
 {
+    var $msg = null;
+
+    /**
+     * Handle the redirect back from OpenID confirmation
+     *
+     * Check to see if the user's logged in, and then try
+     * to use the OpenID login system.
+     *
+     * @param array $args $_REQUEST arguments
+     *
+     * @return void
+     */
 
     function handle($args)
     {
         parent::handle($args);
         if (!common_logged_in()) {
-            common_user_error(_('Not logged in.'));
+            $this->clientError(_('Not logged in.'));
         } else {
-            $this->try_login();
+            $this->tryLogin();
         }
     }
-    
-    function try_login()
-    {
 
+    /**
+     * Try to log in using OpenID
+     *
+     * Check the OpenID for validity; potentially store it.
+     *
+     * @return void
+     */
+
+    function tryLogin()
+    {
         $consumer =& oid_consumer();
 
         $response = $consumer->complete(common_local_url('finishaddopenid'));
@@ -46,10 +89,11 @@ class FinishaddopenidAction extends Action
             return;
         } else if ($response->status == Auth_OpenID_FAILURE) {
             // Authentication failed; display the error message.
-            $this->message(sprintf(_('OpenID authentication failed: %s'), $response->message));
+            $this->message(sprintf(_('OpenID authentication failed: %s'),
+                                   $response->message));
         } else if ($response->status == Auth_OpenID_SUCCESS) {
 
-            $display = $response->getDisplayIdentifier();
+            $display   = $response->getDisplayIdentifier();
             $canonical = ($response->endpoint && $response->endpoint->canonicalID) ?
               $response->endpoint->canonicalID : $display;
 
@@ -60,6 +104,7 @@ class FinishaddopenidAction extends Action
             }
 
             $cur =& common_current_user();
+
             $other = oid_get_user($canonical);
 
             if ($other) {
@@ -71,7 +116,7 @@ class FinishaddopenidAction extends Action
                 return;
             }
 
-            # start a transaction
+            // start a transaction
 
             $cur->query('BEGIN');
 
@@ -88,7 +133,7 @@ class FinishaddopenidAction extends Action
                 }
             }
 
-            # success!
+            // success!
 
             $cur->query('COMMIT');
 
@@ -98,10 +143,43 @@ class FinishaddopenidAction extends Action
         }
     }
 
+    /**
+     * Show a failure message
+     *
+     * Something went wrong. Save the message, and show the page.
+     *
+     * @param string $msg Error message to show
+     *
+     * @return void
+     */
+
     function message($msg)
     {
-        common_show_header(_('OpenID Login'));
-        common_element('p', null, $msg);
-        common_show_footer();
+        $this->message = $msg;
+        $this->showPage();
+    }
+
+    /**
+     * Title of the page
+     *
+     * @return string title
+     */
+
+    function title()
+    {
+        return _('OpenID Login');
+    }
+
+    /**
+     * Show error message
+     *
+     * @return void
+     */
+
+    function showPageNotice()
+    {
+        if ($this->message) {
+            $this->element('p', 'error', $this->message);
+        }
     }
 }
index bdb8516a321b1459a5d24abf931dd29e137aa3b4..bc33ac330b705e3bcd1ee75b32601042972abdf6 100644 (file)
@@ -28,7 +28,7 @@ class FinishopenidloginAction extends Action
     {
         parent::handle($args);
         if (common_logged_in()) {
-            common_user_error(_('Already logged in.'));
+            $this->clientError(_('Already logged in.'));
         } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $token = $this->trimmed('token');
             if (!$token || $token != common_session_token()) {
@@ -57,10 +57,10 @@ class FinishopenidloginAction extends Action
     function show_top($error=null)
     {
         if ($error) {
-            common_element('div', array('class' => 'error'), $error);
+            $this->element('div', array('class' => 'error'), $error);
         } else {
             global $config;
-            common_element('div', 'instructions',
+            $this->element('div', 'instructions',
                            sprintf(_('This is the first time you\'ve logged into %s so we must connect your OpenID to a local account. You can either create a new account, or connect with your existing account, if you have one.'), $config['site']['name']));
         }
     }
@@ -70,36 +70,36 @@ class FinishopenidloginAction extends Action
         common_show_header(_('OpenID Account Setup'), null, $error,
                            array($this, 'show_top'));
 
-        common_element_start('form', array('method' => 'post',
+        $this->elementStart('form', array('method' => 'post',
                                            'id' => 'account_connect',
                                            'action' => common_local_url('finishopenidlogin')));
-        common_hidden('token', common_session_token());
-        common_element('h2', null,
+        $this->hidden('token', common_session_token());
+        $this->element('h2', null,
                        _('Create new account'));
-        common_element('p', null,
+        $this->element('p', null,
                        _('Create a new user with this nickname.'));
-        common_input('newname', _('New nickname'),
+        $this->input('newname', _('New nickname'),
                      ($username) ? $username : '',
                      _('1-64 lowercase letters or numbers, no punctuation or spaces'));
-        common_element_start('p');
-        common_element('input', array('type' => 'checkbox',
+        $this->elementStart('p');
+        $this->element('input', array('type' => 'checkbox',
                                       'id' => 'license',
                                       'name' => 'license',
                                       'value' => 'true'));
-        common_text(_('My text and files are available under '));
-        common_element('a', array(href => common_config('license', 'url')),
+        $this->text(_('My text and files are available under '));
+        $this->element('a', array(href => common_config('license', 'url')),
                        common_config('license', 'title'));
-        common_text(_(' except this private data: password, email address, IM address, phone number.'));
-        common_element_end('p');
-        common_submit('create', _('Create'));
-        common_element('h2', null,
+        $this->text(_(' except this private data: password, email address, IM address, phone number.'));
+        $this->elementEnd('p');
+        $this->submit('create', _('Create'));
+        $this->element('h2', null,
                        _('Connect existing account'));
-        common_element('p', null,
+        $this->element('p', null,
                        _('If you already have an account, login with your username and password to connect it to your OpenID.'));
-        common_input('nickname', _('Existing nickname'));
-        common_password('password', _('Password'));
-        common_submit('connect', _('Connect'));
-        common_element_end('form');
+        $this->input('nickname', _('Existing nickname'));
+        $this->password('password', _('Password'));
+        $this->submit('connect', _('Connect'));
+        $this->elementEnd('form');
         common_show_footer();
     }
 
@@ -154,7 +154,7 @@ class FinishopenidloginAction extends Action
     function message($msg)
     {
         common_show_header(_('OpenID Login'));
-        common_element('p', null, $msg);
+        $this->element('p', null, $msg);
         common_show_footer();
     }
 
@@ -179,7 +179,7 @@ class FinishopenidloginAction extends Action
         # FIXME: save invite code before redirect, and check here
 
         if (common_config('site', 'closed') || common_config('site', 'inviteonly')) {
-            common_user_error(_('Registration not allowed.'));
+            $this->clientError(_('Registration not allowed.'));
             return;
         }
 
@@ -205,7 +205,7 @@ class FinishopenidloginAction extends Action
         list($display, $canonical, $sreg) = $this->get_saved_values();
 
         if (!$display || !$canonical) {
-            common_server_error(_('Stored OpenID not found.'));
+            $this->serverError(_('Stored OpenID not found.'));
             return;
         }
 
@@ -214,7 +214,7 @@ class FinishopenidloginAction extends Action
         $other = oid_get_user($canonical);
 
         if ($other) {
-            common_server_error(_('Creating new account for OpenID that already has a user.'));
+            $this->serverError(_('Creating new account for OpenID that already has a user.'));
             return;
         }
 
@@ -274,14 +274,14 @@ class FinishopenidloginAction extends Action
         list($display, $canonical, $sreg) = $this->get_saved_values();
 
         if (!$display || !$canonical) {
-            common_server_error(_('Stored OpenID not found.'));
+            $this->serverError(_('Stored OpenID not found.'));
             return;
         }
 
         $result = oid_link_user($user->id, $canonical, $display);
 
         if (!$result) {
-            common_server_error(_('Error connecting user to OpenID.'));
+            $this->serverError(_('Error connecting user to OpenID.'));
             return;
         }
 
index cee3a181875368ec2197b310a897d4bbfa2c42ba..f9094a50cafa91fd2b240d3df930229d9f7471e8 100644 (file)
@@ -30,14 +30,14 @@ class FinishremotesubscribeAction extends Action
         parent::handle($args);
 
         if (common_logged_in()) {
-            common_user_error(_('You can use the local subscription!'));
+            $this->clientError(_('You can use the local subscription!'));
             return;
         }
 
         $omb = $_SESSION['oauth_authorization_request'];
 
         if (!$omb) {
-            common_user_error(_('Not expecting this response!'));
+            $this->clientError(_('Not expecting this response!'));
             return;
         }
 
@@ -51,38 +51,38 @@ class FinishremotesubscribeAction extends Action
         # I think this is the success metric
 
         if ($token != $omb['token']) {
-            common_user_error(_('Not authorized.'));
+            $this->clientError(_('Not authorized.'));
             return;
         }
 
         $version = $req->get_parameter('omb_version');
 
         if ($version != OMB_VERSION_01) {
-            common_user_error(_('Unknown version of OMB protocol.'));
+            $this->clientError(_('Unknown version of OMB protocol.'));
             return;
         }
 
         $nickname = $req->get_parameter('omb_listener_nickname');
 
         if (!$nickname) {
-            common_user_error(_('No nickname provided by remote server.'));
+            $this->clientError(_('No nickname provided by remote server.'));
             return;
         }
 
         $profile_url = $req->get_parameter('omb_listener_profile');
 
         if (!$profile_url) {
-            common_user_error(_('No profile URL returned by server.'));
+            $this->clientError(_('No profile URL returned by server.'));
             return;
         }
 
         if (!Validate::uri($profile_url, array('allowed_schemes' => array('http', 'https')))) {
-            common_user_error(_('Invalid profile URL returned by server.'));
+            $this->clientError(_('Invalid profile URL returned by server.'));
             return;
         }
 
         if ($profile_url == common_local_url('showstream', array('nickname' => $nickname))) {
-            common_user_error(_('You can use the local subscription!'));
+            $this->clientError(_('You can use the local subscription!'));
             return;
         }
 
@@ -91,14 +91,14 @@ class FinishremotesubscribeAction extends Action
         $user = User::staticGet('nickname', $omb['listenee']);
 
         if (!$user) {
-            common_user_error(_('User being listened to doesn\'t exist.'));
+            $this->clientError(_('User being listened to doesn\'t exist.'));
             return;
         }
 
         $other = User::staticGet('uri', $omb['listener']);
 
         if ($other) {
-            common_user_error(_('You can use the local subscription!'));
+            $this->clientError(_('You can use the local subscription!'));
             return;
         }
 
@@ -111,7 +111,7 @@ class FinishremotesubscribeAction extends Action
         list($newtok, $newsecret) = $this->access_token($omb);
 
         if (!$newtok || !$newsecret) {
-            common_user_error(_('Couldn\'t convert request tokens to access tokens.'));
+            $this->clientError(_('Couldn\'t convert request tokens to access tokens.'));
             return;
         }
 
@@ -155,7 +155,7 @@ class FinishremotesubscribeAction extends Action
             $profile->created = DB_DataObject_Cast::dateTime(); # current time
             $id = $profile->insert();
             if (!$id) {
-                common_server_error(_('Error inserting new profile'));
+                $this->serverError(_('Error inserting new profile'));
                 return;
             }
             $remote->id = $id;
@@ -163,7 +163,7 @@ class FinishremotesubscribeAction extends Action
 
         if ($avatar_url) {
             if (!$this->add_avatar($profile, $avatar_url)) {
-                common_server_error(_('Error inserting avatar'));
+                $this->serverError(_('Error inserting avatar'));
                 return;
             }
         }
@@ -173,19 +173,19 @@ class FinishremotesubscribeAction extends Action
 
         if ($exists) {
             if (!$remote->update($orig_remote)) {
-                common_server_error(_('Error updating remote profile'));
+                $this->serverError(_('Error updating remote profile'));
                 return;
             }
         } else {
             $remote->created = DB_DataObject_Cast::dateTime(); # current time
             if (!$remote->insert()) {
-                common_server_error(_('Error inserting remote profile'));
+                $this->serverError(_('Error inserting remote profile'));
                 return;
             }
         }
 
         if ($user->hasBlocked($profile)) {
-            $this->client_error(_('That user has blocked you from subscribing.'));
+            $this->clientError(_('That user has blocked you from subscribing.'));
             return;
         }
 
@@ -215,7 +215,7 @@ class FinishremotesubscribeAction extends Action
 
         if (!$result) {
             common_log_db_error($sub, ($sub_exists) ? 'UPDATE' : 'INSERT', __FILE__);
-            common_user_error(_('Couldn\'t insert new subscription.'));
+            $this->clientError(_('Couldn\'t insert new subscription.'));
             return;
         }
 
index 30e98960c170209b2b50cb32f860d41d50e2907a..9fa321d4a95b79d0ee5fdbdb82ecc2ad3683dc4f 100644 (file)
@@ -26,7 +26,7 @@ define('BOTH', 0);
 class FoafAction extends Action
 {
 
-    function is_readonly()
+    function isReadOnly()
     {
         return true;
     }
@@ -40,21 +40,21 @@ class FoafAction extends Action
         $user = User::staticGet('nickname', $nickname);
 
         if (!$user) {
-            common_user_error(_('No such user.'), 404);
+            $this->clientError(_('No such user.'), 404);
             return;
         }
 
         $profile = $user->getProfile();
 
         if (!$profile) {
-            common_server_error(_('User has no profile.'), 500);
+            $this->serverError(_('User has no profile.'), 500);
             return;
         }
 
         header('Content-Type: application/rdf+xml');
 
         common_start_xml();
-        common_element_start('rdf:RDF', array('xmlns:rdf' =>
+        $this->elementStart('rdf:RDF', array('xmlns:rdf' =>
                                               'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
                                               'xmlns:rdfs' =>
                                               'http://www.w3.org/2000/01/rdf-schema#',
@@ -67,25 +67,25 @@ class FoafAction extends Action
         $this->show_ppd('', $user->uri);
 
         # XXX: might not be a person
-        common_element_start('Person', array('rdf:about' =>
+        $this->elementStart('Person', array('rdf:about' =>
                                              $user->uri));
-        common_element('mbox_sha1sum', null, sha1('mailto:' . $user->email));
+        $this->element('mbox_sha1sum', null, sha1('mailto:' . $user->email));
         if ($profile->fullname) {
-            common_element('name', null, $profile->fullname);
+            $this->element('name', null, $profile->fullname);
         }
         if ($profile->homepage) {
-            common_element('homepage', array('rdf:resource' => $profile->homepage));
+            $this->element('homepage', array('rdf:resource' => $profile->homepage));
         }
         if ($profile->bio) {
-            common_element('rdfs:comment', null, $profile->bio);
+            $this->element('rdfs:comment', null, $profile->bio);
         }
         # XXX: more structured location data
         if ($profile->location) {
-            common_element_start('based_near');
-            common_element_start('geo:SpatialThing');
-            common_element('name', null, $profile->location);
-            common_element_end('geo:SpatialThing');
-            common_element_end('based_near');
+            $this->elementStart('based_near');
+            $this->elementStart('geo:SpatialThing');
+            $this->element('name', null, $profile->location);
+            $this->elementEnd('geo:SpatialThing');
+            $this->elementEnd('based_near');
         }
 
         $this->show_microblogging_account($profile, common_root_url());
@@ -93,18 +93,18 @@ class FoafAction extends Action
         $avatar = $profile->getOriginalAvatar();
 
         if ($avatar) {
-            common_element_start('img');
-            common_element_start('Image', array('rdf:about' => $avatar->url));
+            $this->elementStart('img');
+            $this->elementStart('Image', array('rdf:about' => $avatar->url));
             foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
                 $scaled = $profile->getAvatar($size);
                 if (!$scaled->original) { # sometimes the original has one of our scaled sizes
-                    common_element_start('thumbnail');
-                    common_element('Image', array('rdf:about' => $scaled->url));
-                    common_element_end('thumbnail');
+                    $this->elementStart('thumbnail');
+                    $this->element('Image', array('rdf:about' => $scaled->url));
+                    $this->elementEnd('thumbnail');
                 }
             }
-            common_element_end('Image');
-            common_element_end('img');
+            $this->elementEnd('Image');
+            $this->elementEnd('img');
         }
 
         # Get people user is subscribed to
@@ -126,7 +126,7 @@ class FoafAction extends Action
                     common_debug('Got a bad subscription: '.print_r($sub,true));
                     continue;
                 }
-                common_element('knows', array('rdf:resource' => $other->uri));
+                $this->element('knows', array('rdf:resource' => $other->uri));
                 $person[$other->uri] = array(LISTENEE, $other);
             }
         }
@@ -156,7 +156,7 @@ class FoafAction extends Action
             }
         }
 
-        common_element_end('Person');
+        $this->elementEnd('Person');
 
         foreach ($person as $uri => $p) {
             $foaf_url = null;
@@ -164,44 +164,44 @@ class FoafAction extends Action
                 $foaf_url = common_local_url('foaf', array('nickname' => $p[1]->nickname));
             }
             $profile = Profile::staticGet($p[1]->id);
-            common_element_start('Person', array('rdf:about' => $uri));
+            $this->elementStart('Person', array('rdf:about' => $uri));
             if ($p[0] == LISTENER || $p[0] == BOTH) {
-                common_element('knows', array('rdf:resource' => $user->uri));
+                $this->element('knows', array('rdf:resource' => $user->uri));
             }
             $this->show_microblogging_account($profile, ($p[1] instanceof User) ?
                                               common_root_url() : null);
             if ($foaf_url) {
-                common_element('rdfs:seeAlso', array('rdf:resource' => $foaf_url));
+                $this->element('rdfs:seeAlso', array('rdf:resource' => $foaf_url));
             }
-            common_element_end('Person');
+            $this->elementEnd('Person');
             if ($foaf_url) {
                 $this->show_ppd($foaf_url, $uri);
             }
         }
 
-        common_element_end('rdf:RDF');
+        $this->elementEnd('rdf:RDF');
     }
 
     function show_ppd($foaf_url, $person_uri)
     {
-        common_element_start('PersonalProfileDocument', array('rdf:about' => $foaf_url));
-        common_element('maker', array('rdf:resource' => $person_uri));
-        common_element('primaryTopic', array('rdf:resource' => $person_uri));
-        common_element_end('PersonalProfileDocument');
+        $this->elementStart('PersonalProfileDocument', array('rdf:about' => $foaf_url));
+        $this->element('maker', array('rdf:resource' => $person_uri));
+        $this->element('primaryTopic', array('rdf:resource' => $person_uri));
+        $this->elementEnd('PersonalProfileDocument');
     }
 
     function show_microblogging_account($profile, $service=null)
     {
         # Their account
-        common_element_start('holdsAccount');
-        common_element_start('OnlineAccount');
+        $this->elementStart('holdsAccount');
+        $this->elementStart('OnlineAccount');
         if ($service) {
-            common_element('accountServiceHomepage', array('rdf:resource' =>
+            $this->element('accountServiceHomepage', array('rdf:resource' =>
                                                            $service));
         }
-        common_element('accountName', null, $profile->nickname);
-        common_element('homepage', array('rdf:resource' => $profile->profileurl));
-        common_element_end('OnlineAccount');
-        common_element_end('holdsAccount');
+        $this->element('accountName', null, $profile->nickname);
+        $this->element('homepage', array('rdf:resource' => $profile->profileurl));
+        $this->elementEnd('OnlineAccount');
+        $this->elementEnd('holdsAccount');
     }
 }
index 8ecf200ec9182cd735575a4c9412229009e70e9d..e0f5ede3a7520c1069a9906c229c12416730603c 100644 (file)
@@ -1,9 +1,12 @@
 <?php
-/*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+/**
+ * Laconica, the distributed open-source microblogging tool
  *
- * This program is free software: you can redistribute it and/or modify
+ * Settings for Jabber/XMPP integration
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Settings
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/connectsettingsaction.php';
+require_once INSTALLDIR.'/lib/jabber.php';
 
-require_once(INSTALLDIR.'/lib/settingsaction.php');
-require_once(INSTALLDIR.'/lib/jabber.php');
+/**
+ * Settings for Jabber/XMPP integration
+ *
+ * @category Settings
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      SettingsAction
+ */
 
-class ImsettingsAction extends SettingsAction
+class ImsettingsAction extends ConnectSettingsAction
 {
+    /**
+     * Title of the page
+     *
+     * @return string Title of the page
+     */
 
-    function get_instructions()
+    function title()
     {
-        return _('You can send and receive notices through Jabber/GTalk [instant messages](%%doc.im%%). Configure your address and settings below.');
+        return _('IM Settings');
     }
 
-    function show_form($msg=null, $success=false)
+    /**
+     * Instructions for use
+     *
+     * @return instructions for use
+     */
+
+    function getInstructions()
     {
-        $user = common_current_user();
-        $this->form_header(_('IM Settings'), $msg, $success);
-        common_element_start('form', array('method' => 'post',
-                                           'id' => 'imsettings',
-                                           'action' =>
-                                           common_local_url('imsettings')));
-        common_hidden('token', common_session_token());
+        return _('You can send and receive notices through '.
+                 'Jabber/GTalk [instant messages](%%doc.im%%). '.
+                 'Configure your address and settings below.');
+    }
 
-        common_element('h2', null, _('Address'));
+    /**
+     * Content area of the page
+     *
+     * We make different sections of the form for the different kinds of
+     * functions, and have submit buttons with different names. These
+     * are muxed by handlePost() to see what the user really wants to do.
+     *
+     * @return void
+     */
+
+    function showContent()
+    {
+        $user = common_current_user();
+        $this->elementStart('form', array('method' => 'post',
+                                          'id' => 'form_settings_im',
+                                          'class' => 'form_settings',
+                                          'action' =>
+                                          common_local_url('imsettings')));
+        $this->elementStart('fieldset', array('id' => 'settings_im_address'));
+        $this->element('legend', null, _('Address'));
+        $this->hidden('token', common_session_token());
 
         if ($user->jabber) {
-            common_element_start('p');
-            common_element('span', 'address confirmed', $user->jabber);
-            common_element('span', 'input_instructions',
+            $this->element('p', 'form_confirmed', $user->jabber);
+            $this->element('p', 'form_note',
                            _('Current confirmed Jabber/GTalk address.'));
-            common_hidden('jabber', $user->jabber);
-            common_element_end('p');
-            common_submit('remove', _('Remove'));
+            $this->hidden('jabber', $user->jabber);
+            $this->submit('remove', _('Remove'));
         } else {
-            $confirm = $this->get_confirmation();
+            $confirm = $this->getConfirmation();
             if ($confirm) {
-                common_element_start('p');
-                common_element('span', 'address unconfirmed', $confirm->address);
-                common_element('span', 'input_instructions',
-                                sprintf(_('Awaiting confirmation on this address. Check your Jabber/GTalk account for a message with further instructions. (Did you add %s to your buddy list?)'), jabber_daemon_address()));
-                common_hidden('jabber', $confirm->address);
-                common_element_end('p');
-                common_submit('cancel', _('Cancel'));
+                $this->element('p', 'form_unconfirmed', $confirm->address);
+                $this->element('p', 'form_note',
+                               sprintf(_('Awaiting confirmation on this address. '.
+                                         'Check your Jabber/GTalk account for a '.
+                                         'message with further instructions. '.
+                                         '(Did you add %s to your buddy list?)'),
+                                       jabber_daemon_address()));
+                $this->hidden('jabber', $confirm->address);
+                $this->submit('cancel', _('Cancel'));
             } else {
-                common_input('jabber', _('IM Address'),
+                $this->elementStart('ul', 'form_data');
+                $this->elementStart('li');
+                $this->input('jabber', _('IM Address'),
                              ($this->arg('jabber')) ? $this->arg('jabber') : null,
-                         sprintf(_('Jabber or GTalk address, like "UserName@example.org". First, make sure to add %s to your buddy list in your IM client or on GTalk.'), jabber_daemon_address()));
-                common_submit('add', _('Add'));
+                             sprintf(_('Jabber or GTalk address, '.
+                                       'like "UserName@example.org". '.
+                                       'First, make sure to add %s to your '.
+                                       'buddy list in your IM client or on GTalk.'),
+                                     jabber_daemon_address()));
+                $this->elementEnd('li');
+                $this->elementEnd('ul');
+                $this->submit('add', _('Add'));
             }
         }
-
-        common_element('h2', null, _('Preferences'));
-
-        common_checkbox('jabbernotify',
+        $this->elementEnd('fieldset');
+        
+        $this->elementStart('fieldset', array('id' => 'settings_im_preferences'));
+        $this->element('legend', null, _('Preferences'));
+        $this->elementStart('ul', 'form_data');
+        $this->elementStart('li');
+        $this->checkbox('jabbernotify',
                         _('Send me notices through Jabber/GTalk.'),
                         $user->jabbernotify);
-        common_checkbox('updatefrompresence',
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->checkbox('updatefrompresence',
                         _('Post a notice when my Jabber/GTalk status changes.'),
                         $user->updatefrompresence);
-        common_checkbox('jabberreplies',
-                        _('Send me replies through Jabber/GTalk from people I\'m not subscribed to.'),
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->checkbox('jabberreplies',
+                        _('Send me replies through Jabber/GTalk '.
+                          'from people I\'m not subscribed to.'),
                         $user->jabberreplies);
-        common_checkbox('jabbermicroid',
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->checkbox('jabbermicroid',
                         _('Publish a MicroID for my Jabber/GTalk address.'),
                         $user->jabbermicroid);
-        common_submit('save', _('Save'));
-
-        common_element_end('form');
-        common_show_footer();
+        $this->elementEnd('li');
+        $this->elementEnd('ul');
+        $this->submit('save', _('Save'));
+        $this->elementEnd('fieldset');
+        $this->elementEnd('form');
     }
 
-    function get_confirmation()
+    /**
+     * Get a confirmation code for this user
+     *
+     * @return Confirm_address address object for this user
+     */
+
+    function getConfirmation()
     {
         $user = common_current_user();
+
         $confirm = new Confirm_address();
-        $confirm->user_id = $user->id;
+
+        $confirm->user_id      = $user->id;
         $confirm->address_type = 'jabber';
+
         if ($confirm->find(true)) {
             return $confirm;
         } else {
@@ -101,105 +181,134 @@ class ImsettingsAction extends SettingsAction
         }
     }
 
-    function handle_post()
+    /**
+     * Handle posts to this form
+     *
+     * Based on the button that was pressed, muxes out to other functions
+     * to do the actual task requested.
+     *
+     * All sub-functions reload the form with a message -- success or failure.
+     *
+     * @return void
+     */
+
+    function handlePost()
     {
-
-        # CSRF protection
+        // CSRF protection
         $token = $this->trimmed('token');
         if (!$token || $token != common_session_token()) {
-            $this->show_form(_('There was a problem with your session token. Try again, please.'));
+            $this->showForm(_('There was a problem with your session token. '.
+                              'Try again, please.'));
             return;
         }
 
         if ($this->arg('save')) {
-            $this->save_preferences();
+            $this->savePreferences();
         } else if ($this->arg('add')) {
-            $this->add_address();
+            $this->addAddress();
         } else if ($this->arg('cancel')) {
-            $this->cancel_confirmation();
+            $this->cancelConfirmation();
         } else if ($this->arg('remove')) {
-            $this->remove_address();
+            $this->removeAddress();
         } else {
-            $this->show_form(_('Unexpected form submission.'));
+            $this->showForm(_('Unexpected form submission.'));
         }
     }
 
-    function save_preferences()
+    /**
+     * Save user's Jabber preferences
+     *
+     * These are the checkboxes at the bottom of the page. They're used to
+     * set different settings
+     *
+     * @return void
+     */
+
+    function savePreferences()
     {
 
-        $jabbernotify = $this->boolean('jabbernotify');
+        $jabbernotify       = $this->boolean('jabbernotify');
         $updatefrompresence = $this->boolean('updatefrompresence');
-        $jabberreplies = $this->boolean('jabberreplies');
-        $jabbermicroid = $this->boolean('jabbermicroid');
+        $jabberreplies      = $this->boolean('jabberreplies');
+        $jabbermicroid      = $this->boolean('jabbermicroid');
 
         $user = common_current_user();
 
-        assert(!is_null($user)); # should already be checked
+        assert(!is_null($user)); // should already be checked
 
         $user->query('BEGIN');
 
         $original = clone($user);
 
-        $user->jabbernotify = $jabbernotify;
+        $user->jabbernotify       = $jabbernotify;
         $user->updatefrompresence = $updatefrompresence;
-        $user->jabberreplies = $jabberreplies;
-        $user->jabbermicroid = $jabbermicroid;
+        $user->jabberreplies      = $jabberreplies;
+        $user->jabbermicroid      = $jabbermicroid;
 
         $result = $user->update($original);
 
         if ($result === false) {
             common_log_db_error($user, 'UPDATE', __FILE__);
-            common_server_error(_('Couldn\'t update user.'));
+            $this->serverError(_('Couldn\'t update user.'));
             return;
         }
 
         $user->query('COMMIT');
 
-        $this->show_form(_('Preferences saved.'), true);
+        $this->showForm(_('Preferences saved.'), true);
     }
 
-    function add_address()
-    {
+    /**
+     * Sends a confirmation to the address given
+     *
+     * Stores a confirmation record and sends out a
+     * Jabber message with the confirmation info.
+     *
+     * @return void
+     */
 
+    function addAddress()
+    {
         $user = common_current_user();
 
         $jabber = $this->trimmed('jabber');
 
-        # Some validation
+        // Some validation
 
         if (!$jabber) {
-            $this->show_form(_('No Jabber ID.'));
+            $this->showForm(_('No Jabber ID.'));
             return;
         }
 
         $jabber = jabber_normalize_jid($jabber);
 
         if (!$jabber) {
-            $this->show_form(_('Cannot normalize that Jabber ID'));
+            $this->showForm(_('Cannot normalize that Jabber ID'));
             return;
         }
         if (!jabber_valid_base_jid($jabber)) {
-            $this->show_form(_('Not a valid Jabber ID'));
+            $this->showForm(_('Not a valid Jabber ID'));
             return;
         } else if ($user->jabber == $jabber) {
-            $this->show_form(_('That is already your Jabber ID.'));
+            $this->showForm(_('That is already your Jabber ID.'));
             return;
-        } else if ($this->jabber_exists($jabber)) {
-            $this->show_form(_('Jabber ID already belongs to another user.'));
+        } else if ($this->jabberExists($jabber)) {
+            $this->showForm(_('Jabber ID already belongs to another user.'));
             return;
         }
 
-          $confirm = new Confirm_address();
-           $confirm->address = $jabber;
-           $confirm->address_type = 'jabber';
-           $confirm->user_id = $user->id;
-           $confirm->code = common_confirmation_code(64);
+        $confirm = new Confirm_address();
+
+        $confirm->address      = $jabber;
+        $confirm->address_type = 'jabber';
+        $confirm->user_id      = $user->id;
+        $confirm->code         = common_confirmation_code(64);
 
         $result = $confirm->insert();
 
         if ($result === false) {
             common_log_db_error($confirm, 'INSERT', __FILE__);
-            common_server_error(_('Couldn\'t insert confirmation code.'));
+            $this->serverError(_('Couldn\'t insert confirmation code.'));
             return;
         }
 
@@ -209,21 +318,35 @@ class ImsettingsAction extends SettingsAction
                                    $jabber);
         }
 
-        $msg = sprintf(_('A confirmation code was sent to the IM address you added. You must approve %s for sending messages to you.'), jabber_daemon_address());
+        $msg = sprintf(_('A confirmation code was sent '.
+                         'to the IM address you added. '.
+                         'You must approve %s for '.
+                         'sending messages to you.'),
+                       jabber_daemon_address());
 
-        $this->show_form($msg, true);
+        $this->showForm($msg, true);
     }
 
-    function cancel_confirmation()
+    /**
+     * Cancel a confirmation
+     *
+     * If a confirmation exists, cancel it.
+     *
+     * @return void
+     */
+
+    function cancelConfirmation()
     {
         $jabber = $this->arg('jabber');
-        $confirm = $this->get_confirmation();
+
+        $confirm = $this->getConfirmation();
+
         if (!$confirm) {
-            $this->show_form(_('No pending confirmation to cancel.'));
+            $this->showForm(_('No pending confirmation to cancel.'));
             return;
         }
         if ($confirm->address != $jabber) {
-            $this->show_form(_('That is the wrong IM address.'));
+            $this->showForm(_('That is the wrong IM address.'));
             return;
         }
 
@@ -231,46 +354,70 @@ class ImsettingsAction extends SettingsAction
 
         if (!$result) {
             common_log_db_error($confirm, 'DELETE', __FILE__);
-            $this->server_error(_('Couldn\'t delete email confirmation.'));
+            $this->serverError(_('Couldn\'t delete email confirmation.'));
             return;
         }
 
-        $this->show_form(_('Confirmation cancelled.'), true);
+        $this->showForm(_('Confirmation cancelled.'), true);
     }
 
-    function remove_address()
-    {
+    /**
+     * Remove an address
+     *
+     * If the user has a confirmed address, remove it.
+     *
+     * @return void
+     */
 
+    function removeAddress()
+    {
         $user = common_current_user();
+
         $jabber = $this->arg('jabber');
 
-        # Maybe an old tab open...?
+        // Maybe an old tab open...?
 
         if ($user->jabber != $jabber) {
-            $this->show_form(_('That is not your Jabber ID.'));
+            $this->showForm(_('That is not your Jabber ID.'));
             return;
         }
 
         $user->query('BEGIN');
+
         $original = clone($user);
+
         $user->jabber = null;
+
         $result = $user->updateKeys($original);
+
         if (!$result) {
             common_log_db_error($user, 'UPDATE', __FILE__);
-            common_server_error(_('Couldn\'t update user.'));
+            $this->serverError(_('Couldn\'t update user.'));
             return;
         }
         $user->query('COMMIT');
 
-        # XXX: unsubscribe to the old address
+        // XXX: unsubscribe to the old address
 
-        $this->show_form(_('The address was removed.'), true);
+        $this->showForm(_('The address was removed.'), true);
     }
 
-    function jabber_exists($jabber)
+    /**
+     * Does this Jabber ID exist?
+     *
+     * Checks if we already have another user with this address.
+     *
+     * @param string $jabber Address to check
+     *
+     * @return boolean whether the Jabber ID exists
+     */
+
+    function jabberExists($jabber)
     {
         $user = common_current_user();
+
         $other = User::staticGet('jabber', $jabber);
+
         if (!$other) {
             return false;
         } else {
index 80e022a3df26b3602eadec59a954a4b865219ef3..95d96bcde002305832ee768a8c1b63075fa3223f 100644 (file)
@@ -22,7 +22,7 @@ if (!defined('LACONICA')) { exit(1); }
 class InviteAction extends Action
 {
 
-    function is_readonly()
+    function isReadOnly()
     {
         return false;
     }
@@ -31,7 +31,7 @@ class InviteAction extends Action
     {
         parent::handle($args);
         if (!common_logged_in()) {
-            $this->client_error(sprintf(_('You must be logged in to invite other users to use %s'),
+            $this->clientError(sprintf(_('You must be logged in to invite other users to use %s'),
                                         common_config('site', 'name')));
             return;
         } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
@@ -89,29 +89,29 @@ class InviteAction extends Action
 
         common_show_header(_('Invitation(s) sent'));
         if ($already) {
-            common_element('p', null, _('You are already subscribed to these users:'));
-            common_element_start('ul');
+            $this->element('p', null, _('You are already subscribed to these users:'));
+            $this->elementStart('ul');
             foreach ($already as $other) {
-                common_element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
+                $this->element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
             }
-            common_element_end('ul');
+            $this->elementEnd('ul');
         }
         if ($subbed) {
-            common_element('p', null, _('These people are already users and you were automatically subscribed to them:'));
-            common_element_start('ul');
+            $this->element('p', null, _('These people are already users and you were automatically subscribed to them:'));
+            $this->elementStart('ul');
             foreach ($subbed as $other) {
-                common_element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
+                $this->element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
             }
-            common_element_end('ul');
+            $this->elementEnd('ul');
         }
         if ($sent) {
-            common_element('p', null, _('Invitation(s) sent to the following people:'));
-            common_element_start('ul');
+            $this->element('p', null, _('Invitation(s) sent to the following people:'));
+            $this->elementStart('ul');
             foreach ($sent as $other) {
-                common_element('li', null, $other);
+                $this->element('li', null, $other);
             }
-            common_element_end('ul');
-            common_element('p', null, _('You will be notified when your invitees accept the invitation and register on the site. Thanks for growing the community!'));
+            $this->elementEnd('ul');
+            $this->element('p', null, _('You will be notified when your invitees accept the invitation and register on the site. Thanks for growing the community!'));
         }
         common_show_footer();
     }
@@ -119,12 +119,12 @@ class InviteAction extends Action
     function show_top($error=null)
     {
         if ($error) {
-            common_element('p', 'error', $error);
+            $this->element('p', 'error', $error);
         } else {
-            common_element_start('div', 'instructions');
-            common_element('p', null,
+            $this->elementStart('div', 'instructions');
+            $this->element('p', null,
                            _('Use this form to invite your friends and colleagues to use this service.'));
-            common_element_end('div');
+            $this->elementEnd('div');
         }
     }
 
@@ -135,22 +135,22 @@ class InviteAction extends Action
 
         common_show_header(_('Invite new users'), null, $error, array($this, 'show_top'));
 
-        common_element_start('form', array('method' => 'post',
+        $this->elementStart('form', array('method' => 'post',
                                            'id' => 'invite',
                                            'action' => common_local_url('invite')));
-        common_hidden('token', common_session_token());
+        $this->hidden('token', common_session_token());
 
-        common_textarea('addresses', _('Email addresses'),
+        $this->textarea('addresses', _('Email addresses'),
                         $this->trimmed('addresses'),
                         _('Addresses of friends to invite (one per line)'));
 
-        common_textarea('personal', _('Personal message'),
+        $this->textarea('personal', _('Personal message'),
                         $this->trimmed('personal'),
                         _('Optionally add a personal message to the invitation.'));
 
-        common_submit('send', _('Send'));
+        $this->submit('send', _('Send'));
 
-        common_element_end('form');
+        $this->elementEnd('form');
 
         common_show_footer();
     }
index 8600d44fd3e05f82605ebbce04dd8ab6cc1d0efe..11cf1f02a6e77b9bea67664acde0977205e34a6d 100644 (file)
@@ -1,9 +1,12 @@
 <?php
-/*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+/**
+ * Laconica, the distributed open-source microblogging tool
  *
- * This program is free software: you can redistribute it and/or modify
+ * Login form
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Login
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+/**
+ * Login form
+ *
+ * @category Personal
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ */
 
 class LoginAction extends Action
 {
+    /**
+     * Has there been an error?
+     */
+
+    var $error = null;
+
+    /**
+     * Is this a read-only action?
+     *
+     * @return boolean false
+     */
 
-    function is_readonly()
+    function isReadOnly()
     {
-        return true;
+        return false;
     }
 
+    /**
+     * Handle input, produce output
+     *
+     * Switches on request method; either shows the form or handles its input.
+     *
+     * @param array $args $_REQUEST data
+     *
+     * @return void
+     */
+
     function handle($args)
     {
         parent::handle($args);
         if (common_is_real_login()) {
-            common_user_error(_('Already logged in.'));
+            $this->clientError(_('Already logged in.'));
         } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-            $this->check_login();
+            $this->checkLogin();
         } else {
-            $this->show_form();
+            $this->showForm();
         }
     }
 
-    function check_login()
+    /**
+     * Check the login data
+     *
+     * Determines if the login data is valid. If so, logs the user
+     * in, and redirects to the 'with friends' page, or to the stored
+     * return-to URL.
+     *
+     * @return void
+     */
+
+    function checkLogin()
     {
-        # XXX: login throttle
+        // XXX: login throttle
 
-        # CSRF protection - token set in common_notice_form()
+        // CSRF protection - token set in common_notice_form()
         $token = $this->trimmed('token');
         if (!$token || $token != common_session_token()) {
-            $this->client_error(_('There was a problem with your session token. Try again, please.'));
+            $this->clientError(_('There was a problem with your session token. '.
+                                 'Try again, please.'));
             return;
         }
 
         $nickname = common_canonical_nickname($this->trimmed('nickname'));
         $password = $this->arg('password');
         if (common_check_user($nickname, $password)) {
-            # success!
+            // success!
             if (!common_set_user($nickname)) {
-                common_server_error(_('Error setting user.'));
+                $this->serverError(_('Error setting user.'));
                 return;
             }
             common_real_login(true);
@@ -63,10 +117,10 @@ class LoginAction extends Action
                 common_debug('Adding rememberme cookie for ' . $nickname);
                 common_rememberme();
             }
-            # success!
+            // success!
             $url = common_get_returnto();
             if ($url) {
-                # We don't have to return to it again
+                // We don't have to return to it again
                 common_set_returnto(null);
             } else {
                 $url = common_local_url('all',
@@ -75,13 +129,13 @@ class LoginAction extends Action
             }
             common_redirect($url);
         } else {
-            $this->show_form(_('Incorrect username or password.'));
+            $this->showForm(_('Incorrect username or password.'));
             return;
         }
 
-        # success!
+        // success!
         if (!common_set_user($user)) {
-            common_server_error(_('Error setting user.'));
+            $this->serverError(_('Error setting user.'));
             return;
         }
 
@@ -91,10 +145,10 @@ class LoginAction extends Action
             common_debug('Adding rememberme cookie for ' . $nickname);
             common_rememberme($user);
         }
-        # success!
+        // success!
         $url = common_get_returnto();
         if ($url) {
-            # We don't have to return to it again
+            // We don't have to return to it again
             common_set_returnto(null);
         } else {
             $url = common_local_url('all',
@@ -104,35 +158,109 @@ class LoginAction extends Action
         common_redirect($url);
     }
 
-    function show_form($error=null)
+    /**
+     * Store an error and show the page
+     *
+     * This used to show the whole page; now, it's just a wrapper
+     * that stores the error in an attribute.
+     *
+     * @param string $error error, if any.
+     *
+     * @return void
+     */
+
+    function showForm($error=null)
+    {
+        $this->error = $error;
+        $this->showPage();
+    }
+
+    /**
+     * Title of the page
+     *
+     * @return string title of the page
+     */
+
+    function title()
     {
-        common_show_header(_('Login'), null, $error, array($this, 'show_top'));
-        common_element_start('form', array('method' => 'post',
-                                           'id' => 'login',
+        return _('Login');
+    }
+
+    /**
+     * Show page notice
+     *
+     * Display a notice for how to use the page, or the
+     * error if it exists.
+     *
+     * @return void
+     */
+
+    function showPageNotice()
+    {
+        if ($this->error) {
+            $this->element('p', 'error', $this->error);
+        } else {
+            $instr  = $this->getInstructions();
+            $output = common_markup_to_html($instr);
+
+            $this->raw($output);
+        }
+    }
+
+    /**
+     * Core of the display code
+     *
+     * Shows the login form.
+     *
+     * @return void
+     */
+
+    function showContent()
+    {
+        $this->elementStart('form', array('method' => 'post',
+                                           'id' => 'form_login',
+                                           'class' => 'form_settings',
                                            'action' => common_local_url('login')));
-        common_input('nickname', _('Nickname'));
-        common_password('password', _('Password'));
-        common_checkbox('rememberme', _('Remember me'), false,
+        $this->elementStart('fieldset');
+        $this->element('legend', null, _('Login to site'));
+        $this->elementStart('ul', 'form_data');
+        $this->elementStart('li');
+        $this->input('nickname', _('Nickname'));
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->password('password', _('Password'));
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->checkbox('rememberme', _('Remember me'), false,
                         _('Automatically login in the future; ' .
                            'not for shared computers!'));
-        common_submit('submit', _('Login'));
-        common_hidden('token', common_session_token());
-        common_element_end('form');
-        common_element_start('p');
-        common_element('a', array('href' => common_local_url('recoverpassword')),
+        $this->elementEnd('li');
+        $this->elementEnd('ul');
+        $this->submit('submit', _('Login'));
+        $this->hidden('token', common_session_token());
+        $this->elementEnd('fieldset');
+        $this->elementEnd('form');
+        $this->elementStart('p');
+        $this->element('a', array('href' => common_local_url('recoverpassword')),
                        _('Lost or forgotten password?'));
-        common_element_end('p');
-        common_show_footer();
+        $this->elementEnd('p');
     }
 
-    function get_instructions()
+    /**
+     * Instructions for using the form
+     *
+     * For "remembered" logins, we make the user re-login when they
+     * try to change settings. Different instructions for this case.
+     *
+     * @return void
+     */
+
+    function getInstructions()
     {
-        if (common_logged_in() &&
-            !common_is_real_login() &&
-            common_get_returnto())
-        {
-            # rememberme logins have to reauthenticate before
-            # changing any profile settings (cookie-stealing protection)
+        if (common_logged_in() && !common_is_real_login() &&
+            common_get_returnto()) {
+            // rememberme logins have to reauthenticate before
+            // changing any profile settings (cookie-stealing protection)
             return _('For security reasons, please re-enter your ' .
                      'user name and password ' .
                      'before changing your settings.');
@@ -144,16 +272,17 @@ class LoginAction extends Action
         }
     }
 
-    function show_top($error=null)
+    /**
+     * A local menu
+     *
+     * Shows different login/register actions.
+     *
+     * @return void
+     */
+
+    function showLocalNav()
     {
-        if ($error) {
-            common_element('p', 'error', $error);
-        } else {
-            $instr = $this->get_instructions();
-            $output = common_markup_to_html($instr);
-            common_element_start('div', 'instructions');
-            common_raw($output);
-            common_element_end('div');
-        }
+        $nav = new LoginGroupNav($this);
+        $nav->show();
     }
 }
index 201378730d312403fb6e6af85c6e19205a9b2f7f..86d6270abe550020f63f741ddceb8adc8e6fc1b2 100644 (file)
@@ -24,7 +24,7 @@ require_once(INSTALLDIR.'/lib/openid.php');
 class LogoutAction extends Action
 {
     
-    function is_readonly()
+    function isReadOnly()
     {
         return true;
     }
@@ -33,7 +33,7 @@ class LogoutAction extends Action
     {
         parent::handle($args);
         if (!common_logged_in()) {
-            common_user_error(_('Not logged in.'));
+            $this->clientError(_('Not logged in.'));
         } else {
             common_set_user(null);
             common_real_login(false); # not logged in
index 13ddc4e3ed35bd456bac4665964e0cb2814628f3..b46c5bee532a907f532eac49fa9bf52e1d8da57f 100644 (file)
@@ -31,14 +31,14 @@ class MicrosummaryAction extends Action
         $user = User::staticGet('nickname', $nickname);
 
         if (!$user) {
-            $this->client_error(_('No such user'), 404);
+            $this->clientError(_('No such user'), 404);
             return;
         }
         
         $notice = $user->getCurrentNotice();
         
         if (!$notice) {
-            $this->client_error(_('No current status'), 404);
+            $this->clientError(_('No current status'), 404);
         }
         
         header('Content-Type: text/plain');
index 27fa9d5182c3c162afe31d5407c956ac4b1be456..510a5f8f37af3018b6dca6eb795b36aa97dd5a59 100644 (file)
@@ -27,7 +27,7 @@ class NewmessageAction extends Action
         parent::handle($args);
 
         if (!common_logged_in()) {
-            $this->client_error(_('Not logged in.'), 403);
+            $this->clientError(_('Not logged in.'), 403);
         } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $this->save_new_message();
         } else {
@@ -71,10 +71,10 @@ class NewmessageAction extends Action
             $this->show_form(_('No recipient specified.'));
             return;
         } else if (!$user->mutuallySubscribed($other)) {
-            $this->client_error(_('You can\'t send a message to this user.'), 404);
+            $this->clientError(_('You can\'t send a message to this user.'), 404);
             return;
         } else if ($user->id == $other->id) {
-            $this->client_error(_('Don\'t send a message to yourself; just say it to yourself quietly instead.'), 403);
+            $this->clientError(_('Don\'t send a message to yourself; just say it to yourself quietly instead.'), 403);
             return;
         }
         
@@ -113,12 +113,12 @@ class NewmessageAction extends Action
         $other = User::staticGet('id', $to);
 
         if (!$other) {
-            $this->client_error(_('No such user'), 404);
+            $this->clientError(_('No such user'), 404);
             return;
         }
 
         if (!$user->mutuallySubscribed($other)) {
-            $this->client_error(_('You can\'t send a message to this user.'), 404);
+            $this->clientError(_('You can\'t send a message to this user.'), 404);
             return;
         }
         
@@ -127,7 +127,7 @@ class NewmessageAction extends Action
                            array($this, 'show_top'));
         
         if ($msg) {
-            common_element('p', array('id'=>'error'), $msg);
+            $this->element('p', array('id'=>'error'), $msg);
         }
         
         common_show_footer();
index c412e893decb675e01aa74a9b86a4fe14a947243..572adbb23978edd12113aa8a889a4e8a2b07439b 100644 (file)
 <?php
-/*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+/**
+ * Laconica, the distributed open-source microblogging tool
  *
- * This program is free software: you can redistribute it and/or modify
+ * Handler for posting new notices
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU Affero General Public License for more details.
  *
  * You should have received a copy of the GNU Affero General Public License
- * along with this program.     If not, see <http://www.gnu.org/licenses/>.
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Personal
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Zach Copley <zach@controlyourself.ca>
+ * @author    Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/noticelist.php';
 
-require_once INSTALLDIR . '/lib/noticelist.php';
+/**
+ * Action for posting new notices
+ *
+ * @category Personal
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Zach Copley <zach@controlyourself.ca>
+ * @author   Sarven Capadisli <csarven@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ */
 
 class NewnoticeAction extends Action
 {
+    /**
+     * Error message, if any
+     */
+
+    var $msg = null;
+
+    /**
+     * Title of the page
+     *
+     * Note that this usually doesn't get called unless something went wrong
+     *
+     * @return string page title
+     */
+
+    function title()
+    {
+        return _('New notice');
+    }
+
+    /**
+     * Handle input, produce output
+     *
+     * Switches based on GET or POST method. On GET, shows a form
+     * for posting a notice. On POST, saves the results of that form.
+     *
+     * Results may be a full page, or just a single notice list item,
+     * depending on whether AJAX was requested.
+     *
+     * @param array $args $_REQUEST contents
+     *
+     * @return void
+     */
 
     function handle($args)
     {
         parent::handle($args);
 
         if (!common_logged_in()) {
-            common_user_error(_('Not logged in.'));
+            $this->clientError(_('Not logged in.'));
         } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
 
-            # CSRF protection - token set in common_notice_form()
+            // CSRF protection - token set in common_notice_form()
             $token = $this->trimmed('token');
             if (!$token || $token != common_session_token()) {
-                $this->client_error(_('There was a problem with your session token. Try again, please.'));
+                $this->clientError(_('There was a problem with your session token. '.
+                                     'Try again, please.'));
                 return;
             }
 
-            $this->save_new_notice();
+            $this->saveNewNotice();
         } else {
-            $this->show_form();
+            $this->showForm();
         }
     }
 
-    function save_new_notice()
-    {
+    /**
+     * Save a new notice, based on arguments
+     *
+     * If successful, will show the notice, or return an Ajax-y result.
+     * If not, it will show an error message -- possibly Ajax-y.
+     *
+     * Also, if the notice input looks like a command, it will run the
+     * command and show the results -- again, possibly ajaxy.
+     *
+     * @return void
+     */
 
+    function saveNewNotice()
+    {
         $user = common_current_user();
-        assert($user); # XXX: maybe an error instead...
+        assert($user); // XXX: maybe an error instead...
         $content = $this->trimmed('status_textarea');
 
         if (!$content) {
-            $this->show_form(_('No content!'));
+            $this->showForm(_('No content!'));
             return;
         } else {
             $content_shortened = common_shorten_links($content);
 
             if (mb_strlen($content_shortened) > 140) {
-                common_debug("Content = '$content_shortened'", __FILE__);
-                common_debug("mb_strlen(\$content) = " . mb_strlen($content_shortened), __FILE__);
-                $this->show_form(_('That\'s too long. Max notice size is 140 chars.'));
+                $this->showForm(_('That\'s too long. '.
+                                  'Max notice size is 140 chars.'));
                 return;
             }
         }
@@ -81,24 +150,25 @@ class NewnoticeAction extends Action
 
         $replyto = $this->trimmed('inreplyto');
 
-        $notice = Notice::saveNew($user->id, $content, 'web', 1, ($replyto == 'false') ? null : $replyto);
+        $notice = Notice::saveNew($user->id, $content, 'web', 1,
+                                  ($replyto == 'false') ? null : $replyto);
 
         if (is_string($notice)) {
-            $this->show_form($notice);
+            $this->showForm($notice);
             return;
         }
 
         common_broadcast_notice($notice);
 
         if ($this->boolean('ajax')) {
-            common_start_html('text/xml;charset=utf-8', true);
-            common_element_start('head');
-            common_element('title', null, _('Notice posted'));
-            common_element_end('head');
-            common_element_start('body');
-            $this->show_notice($notice);
-            common_element_end('body');
-            common_element_end('html');
+            $this->startHTML('text/xml;charset=utf-8', true);
+            $this->elementStart('head');
+            $this->element('title', null, _('Notice posted'));
+            $this->elementEnd('head');
+            $this->elementStart('body');
+            $this->showNotice($notice);
+            $this->elementEnd('body');
+            $this->elementEnd('html');
         } else {
             $returnto = $this->trimmed('returnto');
 
@@ -113,29 +183,64 @@ class NewnoticeAction extends Action
         }
     }
 
-    function ajax_error_msg($msg)
+    /**
+     * Show an Ajax-y error message
+     *
+     * Goes back to the browser, where it's shown in a popup.
+     *
+     * @param string $msg Message to show
+     *
+     * @return void
+     */
+
+    function ajaxErrorMsg($msg)
     {
         common_start_html('text/xml;charset=utf-8', true);
-        common_element_start('head');
-        common_element('title', null, _('Ajax Error'));
-        common_element_end('head');
-        common_element_start('body');
-        common_element('p', array('id' => 'error'), $msg);
-        common_element_end('body');
-        common_element_end('html');
+        $this->elementStart('head');
+        $this->element('title', null, _('Ajax Error'));
+        $this->elementEnd('head');
+        $this->elementStart('body');
+        $this->element('p', array('id' => 'error'), $msg);
+        $this->elementEnd('body');
+        $this->elementEnd('html');
     }
 
-    function show_top($content=null)
-    {
-        common_notice_form(null, $content);
-    }
+    /**
+     * Formerly page output
+     *
+     * This used to be the whole page output; now that's been largely
+     * subsumed by showPage. So this just stores an error message, if
+     * it was passed, and calls showPage.
+     *
+     * Note that since we started doing Ajax output, this page is rarely
+     * seen.
+     *
+     * @param string $msg An error message, if any
+     *
+     * @return void
+     */
 
-    function show_form($msg=null)
+    function showForm($msg=null)
     {
         if ($msg && $this->boolean('ajax')) {
-            $this->ajax_error_msg($msg);
+            $this->ajaxErrorMsg($msg);
             return;
         }
+
+        $this->msg = $msg;
+        $this->showPage();
+    }
+
+    /**
+     * Overload for replies or bad results
+     *
+     * We show content in the notice form if there were replies or results.
+     *
+     * @return void
+     */
+
+    function showNoticeForm()
+    {
         $content = $this->trimmed('status_textarea');
         if (!$content) {
             $replyto = $this->trimmed('replyto');
@@ -144,18 +249,41 @@ class NewnoticeAction extends Action
                 $content = '@' . $profile->nickname . ' ';
             }
         }
-        common_show_header(_('New notice'), null, $content,
-                           array($this, 'show_top'));
-        if ($msg) {
-            common_element('p', array('id' => 'error'), $msg);
+
+        $notice_form = new NoticeForm($this, $content);
+        $notice_form->show();
+    }
+
+    /**
+     * Show an error message
+     *
+     * Shows an error message if there is one.
+     *
+     * @return void
+     *
+     * @todo maybe show some instructions?
+     */
+
+    function showPageNotice()
+    {
+        if ($this->msg) {
+            $this->element('p', array('id' => 'error'), $this->msg);
         }
-        common_show_footer();
     }
 
-    function show_notice($notice)
+    /**
+     * Output a notice
+     *
+     * Used to generate the notice code for Ajax results.
+     *
+     * @param Notice $notice Notice that was saved
+     *
+     * @return void
+     */
+
+    function showNotice($notice)
     {
-        $nli = new NoticeListItem($notice);
+        $nli = new NoticeListItem($notice, $this);
         $nli->show();
     }
-
 }
index b36fc8ad200aa1f5b80bb27abdeeb1c27c66468b..336e39bd3a2855ea2a548c228719b21d1ad625a3 100644 (file)
@@ -58,7 +58,7 @@ class NoticesearchAction extends SearchAction
         }
         if ($cnt > 0) {
             $terms = preg_split('/[\s,]+/', $q);
-            common_element_start('ul', array('id' => 'notices'));
+            $this->elementStart('ul', array('id' => 'notices'));
             for ($i = 0; $i < min($cnt, NOTICES_PER_PAGE); $i++) {
                 if ($notice->fetch()) {
                     $this->show_notice($notice, $terms);
@@ -67,9 +67,9 @@ class NoticesearchAction extends SearchAction
                     break;
                 }
             }
-            common_element_end('ul');
+            $this->elementEnd('ul');
         } else {
-            common_element('p', 'error', _('No results'));
+            $this->element('p', 'error', _('No results'));
         }
 
         common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
@@ -82,7 +82,7 @@ class NoticesearchAction extends SearchAction
             $q = $arr[0];
         }
         if ($q) {
-            common_element('link', array('rel' => 'alternate',
+            $this->element('link', array('rel' => 'alternate',
                                          'href' => common_local_url('noticesearchrss',
                                                                     array('q' => $q)),
                                          'type' => 'application/rss+xml',
@@ -97,62 +97,62 @@ class NoticesearchAction extends SearchAction
         $profile = $notice->getProfile();
         if (!$profile) {
             common_log_db_error($notice, 'SELECT', __FILE__);
-            $this->server_error(_('Notice without matching profile'));
+            $this->serverError(_('Notice without matching profile'));
             return;
         }
         # XXX: RDFa
-        common_element_start('li', array('class' => 'notice_single',
+        $this->elementStart('li', array('class' => 'notice_single',
                                           'id' => 'notice-' . $notice->id));
         $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
-        common_element_start('a', array('href' => $profile->profileurl));
-        common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE),
+        $this->elementStart('a', array('href' => $profile->profileurl));
+        $this->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE),
                                     'class' => 'avatar stream',
                                     'width' => AVATAR_STREAM_SIZE,
                                     'height' => AVATAR_STREAM_SIZE,
                                     'alt' =>
                                     ($profile->fullname) ? $profile->fullname :
                                     $profile->nickname));
-        common_element_end('a');
-        common_element('a', array('href' => $profile->profileurl,
+        $this->elementEnd('a');
+        $this->element('a', array('href' => $profile->profileurl,
                                   'class' => 'nickname'),
                        $profile->nickname);
         # FIXME: URL, image, video, audio
-        common_element_start('p', array('class' => 'content'));
+        $this->elementStart('p', array('class' => 'content'));
         if ($notice->rendered) {
-            common_raw($this->highlight($notice->rendered, $terms));
+            $this->raw($this->highlight($notice->rendered, $terms));
         } else {
             # XXX: may be some uncooked notices in the DB,
             # we cook them right now. This should probably disappear in future
             # versions (>> 0.4.x)
-            common_raw($this->highlight(common_render_content($notice->content, $notice), $terms));
+            $this->raw($this->highlight(common_render_content($notice->content, $notice), $terms));
         }
-        common_element_end('p');
+        $this->elementEnd('p');
         $noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
-        common_element_start('p', 'time');
-        common_element('a', array('class' => 'permalink',
+        $this->elementStart('p', 'time');
+        $this->element('a', array('class' => 'permalink',
                                   'href' => $noticeurl,
                                   'title' => common_exact_date($notice->created)),
                        common_date_string($notice->created));
         if ($notice->reply_to) {
             $replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to));
-            common_text(' (');
-            common_element('a', array('class' => 'inreplyto',
+            $this->text(' (');
+            $this->element('a', array('class' => 'inreplyto',
                                       'href' => $replyurl),
                            _('in reply to...'));
-            common_text(')');
+            $this->text(')');
         }
-        common_element_start('a',
+        $this->elementStart('a',
                              array('href' => common_local_url('newnotice',
                                                               array('replyto' => $profile->nickname)),
                                    'onclick' => 'doreply("'.$profile->nickname.'"); return false',
                                    'title' => _('reply'),
                                    'class' => 'replybutton'));
-        common_hidden('posttoken', common_session_token());
+        $this->hidden('posttoken', common_session_token());
         
-        common_raw('&rarr;');
-        common_element_end('a');
-        common_element_end('p');
-        common_element_end('li');
+        $this->raw('&rarr;');
+        $this->elementEnd('a');
+        $this->elementEnd('p');
+        $this->elementEnd('li');
     }
 
     function highlight($text, $terms)
index a6480a5827cc8c5bfb094f74d19c5c81ee09771b..49223d43153fac1680b4b73fea07615f209ba873 100644 (file)
@@ -29,7 +29,7 @@ class NudgeAction extends Action
         parent::handle($args);
 
         if (!common_logged_in()) {
-            $this->client_error(_('Not logged in.'));
+            $this->clientError(_('Not logged in.'));
             return;
         }
 
@@ -46,12 +46,12 @@ class NudgeAction extends Action
         $token = $this->trimmed('token');
         
         if (!$token || $token != common_session_token()) {
-            $this->client_error(_('There was a problem with your session token. Try again, please.'));
+            $this->clientError(_('There was a problem with your session token. Try again, please.'));
             return;
         }
 
         if (!$other->email || !$other->emailnotifynudge) {
-            $this->client_error(_('This user doesn\'t allow nudges or hasn\'t confirmed or set his email yet.'));
+            $this->clientError(_('This user doesn\'t allow nudges or hasn\'t confirmed or set his email yet.'));
             return;
         }
 
@@ -59,13 +59,13 @@ class NudgeAction extends Action
 
         if ($this->boolean('ajax')) {
             common_start_html('text/xml;charset=utf-8', true);
-            common_element_start('head');
-            common_element('title', null, _('Nudge sent'));
-            common_element_end('head');
-            common_element_start('body');
+            $this->elementStart('head');
+            $this->element('title', null, _('Nudge sent'));
+            $this->elementEnd('head');
+            $this->elementStart('body');
             common_nudge_response();
-            common_element_end('body');
-            common_element_end('html');
+            $this->elementEnd('body');
+            $this->elementEnd('html');
         } else {
             // display a confirmation to the user
             common_redirect(common_local_url('showstream',
index 09679e372ebc0aa6f0e54e5f2361cbe0b673af4f..d1989e0dea736dad06e744b9dc28b69316b17d7d 100644 (file)
@@ -28,7 +28,7 @@ class OpenidloginAction extends Action
     {
         parent::handle($args);
         if (common_logged_in()) {
-            common_user_error(_('Already logged in.'));
+            $this->clientError(_('Already logged in.'));
         } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $openid_url = $this->trimmed('openid_url');
 
@@ -66,13 +66,13 @@ class OpenidloginAction extends Action
     function show_top($error=null)
     {
         if ($error) {
-            common_element('div', array('class' => 'error'), $error);
+            $this->element('div', array('class' => 'error'), $error);
         } else {
             $instr = $this->get_instructions();
             $output = common_markup_to_html($instr);
-            common_element_start('div', 'instructions');
-            common_raw($output);
-            common_element_end('div');
+            $this->elementStart('div', 'instructions');
+            $this->raw($output);
+            $this->elementEnd('div');
         }
     }
 
@@ -80,18 +80,18 @@ class OpenidloginAction extends Action
     {
         common_show_header(_('OpenID Login'), null, $error, array($this, 'show_top'));
         $formaction = common_local_url('openidlogin');
-        common_element_start('form', array('method' => 'post',
+        $this->elementStart('form', array('method' => 'post',
                                            'id' => 'openidlogin',
                                            'action' => $formaction));
-        common_hidden('token', common_session_token());
-        common_input('openid_url', _('OpenID URL'),
+        $this->hidden('token', common_session_token());
+        $this->input('openid_url', _('OpenID URL'),
                      $openid_url,
                      _('Your OpenID URL'));
-        common_checkbox('rememberme', _('Remember me'), false,
+        $this->checkbox('rememberme', _('Remember me'), false,
                         _('Automatically login in the future; ' .
                            'not for shared computers!'));
-        common_submit('submit', _('Login'));
-        common_element_end('form');
+        $this->submit('submit', _('Login'));
+        $this->elementEnd('form');
         common_show_footer();
     }
 }
index 039236048ae842affcc3731b483046f2090eb4be..92469d20f89a1af6046a09b6ff27e6a2eed02902 100644 (file)
@@ -1,9 +1,12 @@
 <?php
-/*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+/**
+ * Laconica, the distributed open-source microblogging tool
  *
- * This program is free software: you can redistribute it and/or modify
+ * Settings for OpenID
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Settings
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+    exit(1);
+}
 
-require_once(INSTALLDIR.'/lib/settingsaction.php');
-require_once(INSTALLDIR.'/lib/openid.php');
+require_once INSTALLDIR.'/lib/accountsettingsaction.php';
+require_once INSTALLDIR.'/lib/openid.php';
 
-class OpenidsettingsAction extends SettingsAction
+/**
+ * Settings for OpenID
+ *
+ * Lets users add, edit and delete OpenIDs from their account
+ *
+ * @category Settings
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ */
+
+class OpenidsettingsAction extends AccountSettingsAction
 {
+    /**
+     * Title of the page
+     *
+     * @return string Page title
+     */
 
-    function get_instructions()
+    function title()
     {
-        return _('[OpenID](%%doc.openid%%) lets you log into many sites ' .
-                  ' with the same user account. '.
-                  ' Manage your associated OpenIDs from here.');
+        return _('OpenID settings');
     }
 
-    function show_form($msg=null, $success=false)
+    /**
+     * Instructions for use
+     *
+     * @return string Instructions for use
+     */
+
+    function getInstructions()
     {
+        return _('[OpenID](%%doc.openid%%) lets you log into many sites ' .
+                 ' with the same user account. '.
+                 ' Manage your associated OpenIDs from here.');
+    }
 
-        $user = common_current_user();
+    /**
+     * Show the form for OpenID management
+     *
+     * We have one form with a few different submit buttons to do different things.
+     *
+     * @return void
+     */
 
-        $this->form_header(_('OpenID settings'), $msg, $success);
+    function showContent()
+    {
+        $user = common_current_user();
 
-        common_element_start('form', array('method' => 'post',
-                                           'id' => 'openidadd',
-                                           'action' =>
-                                           common_local_url('openidsettings')));
-        common_hidden('token', common_session_token());
-        common_element('h2', null, _('Add OpenID'));
-        common_element('p', null,
+        $this->elementStart('form', array('method' => 'post',
+                                          'id' => 'form_settings_openid_add',
+                                          'class' => 'form_settings',
+                                          'action' =>
+                                          common_local_url('openidsettings')));
+        $this->elementStart('fieldset', array('id' => 'settings_openid_add'));
+        $this->element('legend', null, _('Add OpenID'));
+        $this->hidden('token', common_session_token());
+        $this->element('p', 'form_guide',
                        _('If you want to add an OpenID to your account, ' .
-                          'enter it in the box below and click "Add".'));
-        common_element_start('p');
-        common_element('label', array('for' => 'openid_url'),
+                         'enter it in the box below and click "Add".'));
+        $this->elementStart('ul', 'form_data');
+        $this->elementStart('li');
+        $this->element('label', array('for' => 'openid_url'),
                        _('OpenID URL'));
-        common_element('input', array('name' => 'openid_url',
+        $this->element('input', array('name' => 'openid_url',
                                       'type' => 'text',
                                       'id' => 'openid_url'));
-        common_element('input', array('type' => 'submit',
-                                      'id' => 'add',
+        $this->elementEnd('li');
+        $this->elementEnd('ul');
+        $this->element('input', array('type' => 'submit',
+                                      'id' => 'settings_openid_add_action-submit',
                                       'name' => 'add',
                                       'class' => 'submit',
                                       'value' => _('Add')));
-        common_element_end('p');
-        common_element_end('form');
+        $this->elementEnd('fieldset');
+        $this->elementEnd('form');
 
         $oid = new User_openid();
+
         $oid->user_id = $user->id;
 
         $cnt = $oid->find();
 
         if ($cnt > 0) {
 
-            common_element('h2', null, _('Remove OpenID'));
+            $this->element('h2', null, _('Remove OpenID'));
 
             if ($cnt == 1 && !$user->password) {
 
-                common_element('p', null,
-                               _('Removing your only OpenID would make it impossible to log in! ' .
-                                  'If you need to remove it, add another OpenID first.'));
+                $this->element('p', 'form_guide',
+                               _('Removing your only OpenID '.
+                                 'would make it impossible to log in! ' .
+                                 'If you need to remove it, '.
+                                 'add another OpenID first.'));
 
                 if ($oid->fetch()) {
-                    common_element_start('p');
-                    common_element('a', array('href' => $oid->canonical),
+                    $this->elementStart('p');
+                    $this->element('a', array('href' => $oid->canonical),
                                    $oid->display);
-                    common_element_end('p');
+                    $this->elementEnd('p');
                 }
 
             } else {
 
-                common_element('p', null,
+                $this->element('p', 'form_guide',
                                _('You can remove an OpenID from your account '.
-                                  'by clicking the button marked "Remove".'));
+                                 'by clicking the button marked "Remove".'));
                 $idx = 0;
 
                 while ($oid->fetch()) {
-                    common_element_start('form', array('method' => 'POST',
-                                                       'id' => 'openiddelete' . $idx,
-                                                       'action' =>
-                                                       common_local_url('openidsettings')));
-                    common_element_start('p');
-                    common_hidden('token', common_session_token());
-                    common_element('a', array('href' => $oid->canonical),
+                    $this->elementStart('form',
+                                        array('method' => 'POST',
+                                              'id' => 'form_settings_openid_delete' . $idx,
+                                              'class' => 'form_settings',
+                                              'action' =>
+                                              common_local_url('openidsettings')));
+                    $this->elementStart('fieldset');
+                    $this->hidden('token', common_session_token());
+                    $this->element('a', array('href' => $oid->canonical),
                                    $oid->display);
-                    common_element('input', array('type' => 'hidden',
+                    $this->element('input', array('type' => 'hidden',
                                                   'id' => 'openid_url'.$idx,
                                                   'name' => 'openid_url',
                                                   'value' => $oid->canonical));
-                    common_element('input', array('type' => 'submit',
+                    $this->element('input', array('type' => 'submit',
                                                   'id' => 'remove'.$idx,
                                                   'name' => 'remove',
-                                                  'class' => 'submit',
+                                                  'class' => 'submit remove',
                                                   'value' => _('Remove')));
-                    common_element_end('p');
-                    common_element_end('form');
+                    $this->elementEnd('fieldset');
+                    $this->elementEnd('form');
                     $idx++;
                 }
             }
         }
-
-        common_show_footer();
     }
 
-    function handle_post()
+    /**
+     * Handle a POST request
+     *
+     * Muxes to different sub-functions based on which button was pushed
+     *
+     * @return void
+     */
+
+    function handlePost()
     {
-        # CSRF protection
+        // CSRF protection
         $token = $this->trimmed('token');
         if (!$token || $token != common_session_token()) {
-            $this->show_form(_('There was a problem with your session token. Try again, please.'));
+            $this->showForm(_('There was a problem with your session token. '.
+                              'Try again, please.'));
             return;
         }
 
         if ($this->arg('add')) {
-            $result = oid_authenticate($this->trimmed('openid_url'), 'finishaddopenid');
-            if (is_string($result)) { # error message
-                $this->show_form($result);
+            $result = oid_authenticate($this->trimmed('openid_url'),
+                                       'finishaddopenid');
+            if (is_string($result)) { // error message
+                $this->showForm($result);
             }
         } else if ($this->arg('remove')) {
-            $this->remove_openid();
+            $this->removeOpenid();
         } else {
-            $this->show_form(_('Something weird happened.'));
+            $this->showForm(_('Something weird happened.'));
         }
     }
 
-    function remove_openid()
-    {
+    /**
+     * Handles a request to remove an OpenID from the user's account
+     *
+     * Validates input and, if everything is OK, deletes the OpenID.
+     * Reloads the form with a success or error notification.
+     *
+     * @return void
+     */
 
+    function removeOpenid()
+    {
         $openid_url = $this->trimmed('openid_url');
+
         $oid = User_openid::staticGet('canonical', $openid_url);
+
         if (!$oid) {
-            $this->show_form(_('No such OpenID.'));
+            $this->showForm(_('No such OpenID.'));
             return;
         }
         $cur = common_current_user();
         if (!$cur || $oid->user_id != $cur->id) {
-            $this->show_form(_('That OpenID does not belong to you.'));
+            $this->showForm(_('That OpenID does not belong to you.'));
             return;
         }
         $oid->delete();
-        $this->show_form(_('OpenID removed.'), true);
+        $this->showForm(_('OpenID removed.'), true);
         return;
     }
 }
index 96691fa6f34d6de96dd27e5263a6cd11c4ed330d..6e6e794e9603b16dbec2bbf60efa3db04f09cc4a 100644 (file)
@@ -41,21 +41,21 @@ class OpensearchAction extends Action
         header('Content-Type: text/html');
 
         common_start_xml();
-        common_element_start('OpenSearchDescription', array('xmlns' => 'http://a9.com/-/spec/opensearch/1.1/'));
+        $this->elementStart('OpenSearchDescription', array('xmlns' => 'http://a9.com/-/spec/opensearch/1.1/'));
 
         $short_name =  common_config('site', 'name').' '.$short_name;
-        common_element('ShortName', null, $short_name);
-        common_element('Contact', null, common_config('site', 'email'));
-        common_element('Url', array('type' => 'text/html', 'method' => 'get',
+        $this->element('ShortName', null, $short_name);
+        $this->element('Contact', null, common_config('site', 'email'));
+        $this->element('Url', array('type' => 'text/html', 'method' => 'get',
                        'template' => str_replace('---', '{searchTerms}', common_local_url($type, array('q' => '---')))));
-        common_element('Image', array('height' => 16, 'width' => 16, 'type' => 'image/vnd.microsoft.icon'), common_path('favicon.ico'));
-        common_element('Image', array('height' => 50, 'width' => 50, 'type' => 'image/png'), theme_path('logo.png'));
-        common_element('AdultContent', null, 'false');
-        common_element('Language', null, common_language());
-        common_element('OutputEncoding', null, 'UTF-8');
-        common_element('InputEncoding', null, 'UTF-8');
-
-        common_element_end('OpenSearchDescription');
+        $this->element('Image', array('height' => 16, 'width' => 16, 'type' => 'image/vnd.microsoft.icon'), common_path('favicon.ico'));
+        $this->element('Image', array('height' => 50, 'width' => 50, 'type' => 'image/png'), theme_path('logo.png'));
+        $this->element('AdultContent', null, 'false');
+        $this->element('Language', null, common_language());
+        $this->element('OutputEncoding', null, 'UTF-8');
+        $this->element('InputEncoding', null, 'UTF-8');
+
+        $this->elementEnd('OpenSearchDescription');
         common_end_xml();
     }
 }
index c2f08934c0b20ca84d0302da5deb511e4db86d8f..b542233ca79ee72dc5bde18531822288c572f4ac 100644 (file)
@@ -1,9 +1,12 @@
 <?php
-/*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+/**
+ * Laconica, the distributed open-source microblogging tool
  *
- * This program is free software: you can redistribute it and/or modify
+ * Miscellaneous settings
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Settings
+ * @package   Laconica
+ * @author    Robin Millette <millette@controlyourself.ca>
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+    exit(1);
+}
 
-require_once(INSTALLDIR.'/lib/settingsaction.php');
+require_once INSTALLDIR.'/lib/accountsettingsaction.php';
 
-class OthersettingsAction extends SettingsAction
+/**
+ * Miscellaneous settings actions
+ *
+ * Currently this just manages URL shortening.
+ *
+ * @category Settings
+ * @package  Laconica
+ * @author   Robin Millette <millette@controlyourself.ca>
+ * @author   Zach Copley <zach@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ */
+
+class OthersettingsAction extends AccountSettingsAction
 {
+    /**
+     * Title of the page
+     *
+     * @return string Title of the page
+     */
 
-    function get_instructions()
+    function title()
     {
-        return _('Manage various other options.');
+        return _('Other Settings');
     }
 
-    function show_form($msg=null, $success=false)
-    {
-        $user = common_current_user();
-
-        $this->form_header(_('Other Settings'), $msg, $success);
-
-        common_element('h2', null, _('URL Auto-shortening'));
-        common_element_start('form', array('method' => 'post',
-                                           'id' => 'othersettings',
-                                           'action' =>
-                                           common_local_url('othersettings')));
-        common_hidden('token', common_session_token());
+    /**
+     * Instructions for use
+     *
+     * @return instructions for use
+     */
 
-        $services = array(
-            '' => 'None',
-            'ur1.ca' => 'ur1.ca (free service)',
-            '2tu.us' => '2tu.us (free service)',
-            'ptiturl.com' => 'ptiturl.com',
-            'bit.ly' => 'bit.ly',
-            'tinyurl.com' => 'tinyurl.com',
-            'is.gd' => 'is.gd',
-            'snipr.com' => 'snipr.com',
-            'metamark.net' => 'metamark.net'
-        );
-
-        common_dropdown('urlshorteningservice', _('Service'), $services, _('Automatic shortening service to use.'), false, $user->urlshorteningservice);
+    function getInstructions()
+    {
+        return _('Manage various other options.');
+    }
 
-        common_submit('save', _('Save'));
+    /**
+     * Content area of the page
+     *
+     * Shows a form for uploading an avatar.
+     *
+     * @return void
+     */
 
-        common_element_end('form');
+    function showContent()
+    {
+        $user = common_current_user();
 
-//        common_element('h2', null, _('Delete my account'));
-//        $this->show_delete_form();
 
-        common_show_footer();
-    }
+        $this->elementStart('form', array('method' => 'post',
+                                          'id' => 'form_settings_other',
+                                          'class' => 'form_settings',
+                                          'action' =>
+                                          common_local_url('othersettings')));
+        $this->elementStart('fieldset');
+        $this->element('legend', null, _('URL Auto-shortening'));
+        $this->hidden('token', common_session_token());
 
-    function show_feeds_list($feeds)
-    {
-        common_element_start('div', array('class' => 'feedsdel'));
-        common_element('p', null, 'Feeds:');
-        common_element_start('ul', array('class' => 'xoxo'));
+        // I18N
 
-        foreach ($feeds as $key => $value) {
-            $this->common_feed_item($feeds[$key]);
-        }
-        common_element_end('ul');
-        common_element_end('div');
+        $services = array(
+                          '' => 'None',
+                          'ur1.ca' => 'ur1.ca (free service)',
+                          '2tu.us' => '2tu.us (free service)',
+                          'ptiturl.com' => 'ptiturl.com',
+                          'bit.ly' => 'bit.ly',
+                          'tinyurl.com' => 'tinyurl.com',
+                          'is.gd' => 'is.gd',
+                          'snipr.com' => 'snipr.com',
+                          'metamark.net' => 'metamark.net'
+                          );
+
+        $this->elementStart('ul', 'form_data');
+        $this->elementStart('li');
+        $this->dropdown('urlshorteningservice', _('Service'),
+                        $services, _('Automatic shortening service to use.'),
+                        false, $user->urlshorteningservice);
+        $this->elementEnd('li');
+        $this->elementEnd('ul');
+        $this->submit('save', _('Save'));
+        $this->elementEnd('fieldset');
+        $this->elementEnd('form');
     }
 
-    //TODO move to common.php (and retrace its origin)
-    function common_feed_item($feed)
-    {
-        $user = common_current_user();
-        $nickname = $user->nickname;
-
-        switch($feed['item']) {
-            case 'notices': default:
-                $feed_classname = $feed['type'];
-                $feed_mimetype = "application/".$feed['type']."+xml";
-                $feed_title = "$nickname's ".$feed['version']." notice feed";
-                $feed['textContent'] = "RSS";
-                break;
-
-            case 'foaf':
-                $feed_classname = "foaf";
-                $feed_mimetype = "application/".$feed['type']."+xml";
-                $feed_title = "$nickname's FOAF file";
-                $feed['textContent'] = "FOAF";
-                break;
-        }
-        common_element_start('li');
-        common_element('a', array('href' => $feed['href'],
-                                  'class' => $feed_classname,
-                                  'type' => $feed_mimetype,
-                                  'title' => $feed_title),
-                            $feed['textContent']);
-        common_element_end('li');
-    }
+    /**
+     * Handle a post
+     *
+     * Saves the changes to url-shortening prefs and shows a success or failure
+     * message.
+     *
+     * @return void
+     */
 
-//    function show_delete_form() {
-//        $user = common_current_user();
-//      $notices = DB_DataObject::factory('notice');
-//      $notices->profile_id = $user->id;
-//      $notice_count = (int) $notices->count();
-//
-//        common_element_start('form', array('method' => 'POST',
-//                                           'id' => 'delete',
-//                                           'action' =>
-//                                           common_local_url('deleteprofile')));
-//
-//        common_hidden('token', common_session_token());
-//      common_element('p', null, "You can copy your notices and contacts by saving the two links below before deleting your account. Be careful, this operation cannot be undone.");
-//
-//        $this->show_feeds_list(array(0=>array('href'=>common_local_url('userrss', array('limit' => $notice_count, 'nickname' => $user->nickname)),
-//                                              'type' => 'rss',
-//                                              'version' => 'RSS 1.0',
-//                                              'item' => 'notices'),
-//                                     1=>array('href'=>common_local_url('foaf',array('nickname' => $user->nickname)),
-//                                              'type' => 'rdf',
-//                                              'version' => 'FOAF',
-//                                              'item' => 'foaf')));
-//
-//        common_submit('deleteaccount', _('Delete my account'));
-//        common_element_end('form');
-//    }
-
-    function handle_post()
+    function handlePost()
     {
-
-        # CSRF protection
+        // CSRF protection
         $token = $this->trimmed('token');
         if (!$token || $token != common_session_token()) {
-            $this->show_form(_('There was a problem with your session token. Try again, please.'));
+            $this->showForm(_('There was a problem with your session token. '.
+                              'Try again, please.'));
             return;
         }
 
-        if ($this->arg('save')) {
-            $this->save_preferences();
-        }else {
-            $this->show_form(_('Unexpected form submission.'));
-        }
-    }
-
-    function save_preferences()
-    {
-
         $urlshorteningservice = $this->trimmed('urlshorteningservice');
 
         if (!is_null($urlshorteningservice) && strlen($urlshorteningservice) > 50) {
-            $this->show_form(_('URL shortening service is too long (max 50 chars).'));
+            $this->showForm(_('URL shortening service is too long (max 50 chars).'));
             return;
         }
 
         $user = common_current_user();
 
-        assert(!is_null($user)); # should already be checked
+        assert(!is_null($user)); // should already be checked
 
         $user->query('BEGIN');
 
@@ -177,12 +159,12 @@ class OthersettingsAction extends SettingsAction
 
         if ($result === false) {
             common_log_db_error($user, 'UPDATE', __FILE__);
-            common_server_error(_('Couldn\'t update user.'));
+            $this->serverError(_('Couldn\'t update user.'));
             return;
         }
 
         $user->query('COMMIT');
 
-        $this->show_form(_('Preferences saved.'), true);
+        $this->showForm(_('Preferences saved.'), true);
     }
 }
diff --git a/actions/passwordsettings.php b/actions/passwordsettings.php
new file mode 100644 (file)
index 0000000..f96da13
--- /dev/null
@@ -0,0 +1,161 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Change user password
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Settings
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Zach Copley <zach@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/accountsettingsaction.php';
+
+/**
+ * Change password
+ *
+ * @category Settings
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Zach Copley <zach@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ */
+
+class PasswordsettingsAction extends AccountSettingsAction
+{
+    /**
+     * Title of the page
+     *
+     * @return string Title of the page
+     */
+
+    function title()
+    {
+        return _('Change password');
+    }
+
+    /**
+     * Instructions for use
+     *
+     * @return instructions for use
+     */
+
+    function getInstructions()
+    {
+        return _('Change your password.');
+    }
+
+    /**
+     * Content area of the page
+     *
+     * Shows a form for changing the password
+     *
+     * @return void
+     */
+
+    function showContent()
+    {
+        $user = common_current_user();
+        $this->elementStart('form', array('method' => 'POST',
+                                          'id' => 'password',
+                                          'action' =>
+                                          common_local_url('profilesettings')));
+
+        $this->hidden('token', common_session_token());
+
+        // Users who logged in with OpenID won't have a pwd
+        if ($user->password) {
+            $this->password('oldpassword', _('Old password'));
+        }
+        $this->password('newpassword', _('New password'),
+                        _('6 or more characters'));
+        $this->password('confirm', _('Confirm'),
+                        _('same as password above'));
+        $this->submit('changepass', _('Change'));
+        $this->elementEnd('form');
+    }
+
+    /**
+     * Handle a post
+     *
+     * Validate input and save changes. Reload the form with a success
+     * or error message.
+     *
+     * @return void
+     */
+
+    function handlePost()
+    {
+        // CSRF protection
+
+        $token = $this->trimmed('token');
+        if (!$token || $token != common_session_token()) {
+            $this->showForm(_('There was a problem with your session token. '.
+                               'Try again, please.'));
+            return;
+        }
+
+        $user = common_current_user();
+        assert(!is_null($user)); // should already be checked
+
+        // FIXME: scrub input
+
+        $newpassword = $this->arg('newpassword');
+        $confirm     = $this->arg('confirm');
+
+        if (0 != strcmp($newpassword, $confirm)) {
+            $this->showForm(_('Passwords don\'t match.'));
+            return;
+        }
+
+        if ($user->password) {
+            $oldpassword = $this->arg('oldpassword');
+
+            if (!common_check_user($user->nickname, $oldpassword)) {
+                $this->showForm(_('Incorrect old password'));
+                return;
+            }
+        }
+
+        $original = clone($user);
+
+        $user->password = common_munge_password($newpassword, $user->id);
+
+        $val = $user->validate();
+        if ($val !== true) {
+            $this->showForm(_('Error saving user; invalid.'));
+            return;
+        }
+
+        if (!$user->update($original)) {
+            $this->serverError(_('Can\'t save new password.'));
+            return;
+        }
+
+        $this->showForm(_('Password saved.'), true);
+    }
+}
\ No newline at end of file
index 0d0fae4e5c635f64659807b020f0db49af59f391..2b13b08128201115527b8c45ee57bca1f7f97311 100644 (file)
@@ -60,7 +60,7 @@ class PeoplesearchAction extends SearchAction
             $results = new PeopleSearchResults($profile, $terms);
             $results->show_list();
         } else {
-            common_element('p', 'error', _('No results'));
+            $this->element('p', 'error', _('No results'));
         }
 
         $profile->free();
index 13a0b7a41324ed9deaa86ba9e13aa667ceabf060..7bcfcb93e36581e202afd205ebd04facc873b928 100644 (file)
@@ -32,7 +32,7 @@ class PeopletagAction extends Action
         $tag = $this->trimmed('tag');
         
         if (!common_valid_profile_tag($tag)) {
-            $this->client_error(sprintf(_('Not a valid people tag: %s'), $tag));
+            $this->clientError(sprintf(_('Not a valid people tag: %s'), $tag));
             return;
         }
 
@@ -90,11 +90,11 @@ class PeopletagAction extends Action
     {
         $instr = sprintf(_('These are users who have tagged themselves "%s" ' .
                            'to show a common interest, characteristic, hobby or job.'), $tag);
-        common_element_start('div', 'instructions');
-        common_element_start('p');
-        common_text($instr);
-        common_element_end('p');
-        common_element_end('div');
+        $this->elementStart('div', 'instructions');
+        $this->elementStart('p');
+        $this->text($instr);
+        $this->elementEnd('p');
+        $this->elementEnd('div');
     }
 
     function get_title()
index dec62a678f27b2d842f3f060a12f34b866e40cc6..0b47352964f8685538ee84ee9213e193932f9b94 100644 (file)
@@ -36,7 +36,7 @@ class PostnoticeAction extends Action
                 print "omb_version=".OMB_VERSION_01;
             }
         } catch (OAuthException $e) {
-            common_server_error($e->getMessage());
+            $this->serverError($e->getMessage());
             return;
         }
     }
@@ -45,36 +45,36 @@ class PostnoticeAction extends Action
     {
         $version = $req->get_parameter('omb_version');
         if ($version != OMB_VERSION_01) {
-            common_user_error(_('Unsupported OMB version'), 400);
+            $this->clientError(_('Unsupported OMB version'), 400);
             return false;
         }
         # First, check to see
         $listenee =  $req->get_parameter('omb_listenee');
         $remote_profile = Remote_profile::staticGet('uri', $listenee);
         if (!$remote_profile) {
-            common_user_error(_('Profile unknown'), 403);
+            $this->clientError(_('Profile unknown'), 403);
             return false;
         }
         $sub = Subscription::staticGet('token', $token->key);
         if (!$sub) {
-            common_user_error(_('No such subscription'), 403);
+            $this->clientError(_('No such subscription'), 403);
             return false;
         }
         $content = $req->get_parameter('omb_notice_content');
         $content_shortened = common_shorten_links($content);
         if (mb_strlen($content_shortened) > 140) {
-            common_user_error(_('Invalid notice content'), 400);
+            $this->clientError(_('Invalid notice content'), 400);
             return false;
         }
         $notice_uri = $req->get_parameter('omb_notice');
         if (!Validate::uri($notice_uri) &&
             !common_valid_tag($notice_uri)) {
-            common_user_error(_('Invalid notice uri'), 400);
+            $this->clientError(_('Invalid notice uri'), 400);
             return false;
         }
         $notice_url = $req->get_parameter('omb_notice_url');
         if ($notice_url && !common_valid_http_url($notice_url)) {
-            common_user_error(_('Invalid notice url'), 400);
+            $this->clientError(_('Invalid notice url'), 400);
             return false;
         }
         $notice = Notice::staticGet('uri', $notice_uri);
index d861919b920e7f18e5ed3fe89a515faff95eb118..6dd4775e5a036455788d8df6f731db1856e9acae 100644 (file)
@@ -1,9 +1,12 @@
 <?php
-/*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+/**
+ * Laconica, the distributed open-source microblogging tool
  *
- * This program is free software: you can redistribute it and/or modify
+ * Change profile settings
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Settings
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Zach Copley <zach@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/accountsettingsaction.php';
 
-require_once(INSTALLDIR.'/lib/settingsaction.php');
+/**
+ * Change profile settings
+ *
+ * @category Settings
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Zach Copley <zach@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ */
 
-class ProfilesettingsAction extends SettingsAction
+class ProfilesettingsAction extends AccountSettingsAction
 {
+    /**
+     * Title of the page
+     *
+     * @return string Title of the page
+     */
 
-    function get_instructions()
+    function title()
     {
-        return _('You can update your personal profile info here '.
-                  'so people know more about you.');
+        return _('Profile settings');
     }
 
-    function show_form($msg=null, $success=false)
-    {
-        $this->form_header(_('Profile settings'), $msg, $success);
-        $this->show_settings_form();
-        common_element('h2', null, _('Avatar'));
-        $this->show_avatar_form();
-        common_element('h2', null, _('Change password'));
-        $this->show_password_form();
-//        common_element('h2', null, _('Delete my account'));
-//        $this->show_delete_form();
-        common_show_footer();
-    }
+    /**
+     * Instructions for use
+     *
+     * @return instructions for use
+     */
 
-    function handle_post()
+    function getInstructions()
     {
-
-        # CSRF protection
-
-        $token = $this->trimmed('token');
-        if (!$token || $token != common_session_token()) {
-            $this->show_form(_('There was a problem with your session token. Try again, please.'));
-            return;
-        }
-
-        if ($this->arg('save')) {
-            $this->save_profile();
-        } else if ($this->arg('upload')) {
-            $this->upload_avatar();
-        } else if ($this->arg('crop')) {
-            $this->crop_avatar();
-        } else if ($this->arg('changepass')) {
-            $this->change_password();
-        } else {
-            $this->show_form(_('Unexpected form submission.'));
-        }
-
+        return _('You can update your personal profile info here '.
+                  'so people know more about you.');
     }
 
-    function show_settings_form()
-    {
+    /**
+     * Content area of the page
+     *
+     * Shows a form for uploading an avatar.
+     *
+     * @return void
+     */
 
+    function showContent()
+    {
         $user = common_current_user();
         $profile = $user->getProfile();
 
-        common_element_start('form', array('method' => 'POST',
-                                           'id' => 'profilesettings',
+        $this->elementStart('form', array('method' => 'POST',
+                                           'id' => 'form_settings_profile',
+                                           'class' => 'form_settings',
                                            'action' => common_local_url('profilesettings')));
-        common_hidden('token', common_session_token());
-        
+        $this->elementStart('fieldset');
+        $this->element('legend', null, _('Profile information'));
+        $this->hidden('token', common_session_token());
+
         # too much common patterns here... abstractable?
-        
-        common_input('nickname', _('Nickname'),
+
+        $this->elementStart('ul', 'form_data');
+        $this->elementStart('li');
+        $this->input('nickname', _('Nickname'),
                      ($this->arg('nickname')) ? $this->arg('nickname') : $profile->nickname,
                      _('1-64 lowercase letters or numbers, no punctuation or spaces'));
-        common_input('fullname', _('Full name'),
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->input('fullname', _('Full name'),
                      ($this->arg('fullname')) ? $this->arg('fullname') : $profile->fullname);
-        common_input('homepage', _('Homepage'),
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->input('homepage', _('Homepage'),
                      ($this->arg('homepage')) ? $this->arg('homepage') : $profile->homepage,
                      _('URL of your homepage, blog, or profile on another site'));
-        common_textarea('bio', _('Bio'),
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->textarea('bio', _('Bio'),
                         ($this->arg('bio')) ? $this->arg('bio') : $profile->bio,
                         _('Describe yourself and your interests in 140 chars'));
-        common_input('location', _('Location'),
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->input('location', _('Location'),
                      ($this->arg('location')) ? $this->arg('location') : $profile->location,
                      _('Where you are, like "City, State (or Region), Country"'));
-        common_input('tags', _('Tags'),
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->input('tags', _('Tags'),
                      ($this->arg('tags')) ? $this->arg('tags') : implode(' ', $user->getSelfTags()),
                      _('Tags for yourself (letters, numbers, -, ., and _), comma- or space- separated'));
-
+        $this->elementEnd('li');
+        $this->elementStart('li');
         $language = common_language();
-        common_dropdown('language', _('Language'), get_nice_language_list(), _('Preferred language'), true, $language);
+        $this->dropdown('language', _('Language'),
+                        get_nice_language_list(), _('Preferred language'),
+                        true, $language);
+        $this->elementEnd('li');
         $timezone = common_timezone();
         $timezones = array();
         foreach(DateTimeZone::listIdentifiers() as $k => $v) {
             $timezones[$v] = $v;
         }
-        common_dropdown('timezone', _('Timezone'), $timezones, _('What timezone are you normally in?'), true, $timezone);
-
-        common_checkbox('autosubscribe', _('Automatically subscribe to whoever subscribes to me (best for non-humans)'),
-                        ($this->arg('autosubscribe')) ? $this->boolean('autosubscribe') : $user->autosubscribe);
-
-        common_submit('save', _('Save'));
-
-        common_element_end('form');
+        $this->elementStart('li');
+        $this->dropdown('timezone', _('Timezone'),
+                        $timezones, _('What timezone are you normally in?'),
+                        true, $timezone);
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->checkbox('autosubscribe',
+                        _('Automatically subscribe to whoever '.
+                          'subscribes to me (best for non-humans)'),
+                        ($this->arg('autosubscribe')) ?
+                        $this->boolean('autosubscribe') : $user->autosubscribe);
+        $this->elementEnd('li');
+        $this->elementEnd('ul');
+        $this->submit('save', _('Save'));
+
+        $this->elementEnd('fieldset');
+        $this->elementEnd('form');
 
     }
 
-    function show_avatar_form()
-    {
-
-        $user = common_current_user();
-        $profile = $user->getProfile();
-
-        if (!$profile) {
-            common_log_db_error($user, 'SELECT', __FILE__);
-            $this->server_error(_('User without matching profile'));
-            return;
-        }
-        
-        $original = $profile->getOriginalAvatar();
-
-
-        common_element_start('form', array('enctype' => 'multipart/form-data',
-                                           'method' => 'POST',
-                                           'id' => 'avatar',
-                                           'action' =>
-                                           common_local_url('profilesettings')));
-        common_hidden('token', common_session_token());
-
-        if ($original) {
-            common_element_start('div', array('id'=>'avatar_original', 'class'=>'avatar_view'));
-            common_element('h3', null, _("Original:"));
-            common_element_start('div', array('id'=>'avatar_original_view'));
-            common_element('img', array('src' => $original->url,
-                                        'class' => 'avatar original',
-                                        'width' => $original->width,
-                                        'height' => $original->height,
-                                        'alt' => $user->nickname));
-            common_element_end('div');
-            common_element_end('div');
-        }
-
-        $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
-
-        if ($avatar) {
-            common_element_start('div', array('id'=>'avatar_preview', 'class'=>'avatar_view'));
-            common_element('h3', null, _("Preview:"));
-            common_element_start('div', array('id'=>'avatar_preview_view'));
-            common_element('img', array('src' => $original->url,//$avatar->url,
-                                        'class' => 'avatar profile',
-                                        'width' => AVATAR_PROFILE_SIZE,
-                                        'height' => AVATAR_PROFILE_SIZE,
-                                        'alt' => $user->nickname));
-            common_element_end('div');
-            common_element_end('div');
-
-            foreach(array('avatar_crop_x', 'avatar_crop_y', 'avatar_crop_w', 'avatar_crop_h') as $crop_info) {
-                common_element('input', array('name' => $crop_info,
-                                              'type' => 'hidden',
-                                              'id' => $crop_info));
-            }
-            common_submit('crop', _('Crop'));
-        }
-
-        common_element('input', array('name' => 'MAX_FILE_SIZE',
-                                      'type' => 'hidden',
-                                      'id' => 'MAX_FILE_SIZE',
-                                      'value' => MAX_AVATAR_SIZE));
-
-        common_element_start('p');
+    /**
+     * Handle a post
+     *
+     * Validate input and save changes. Reload the form with a success
+     * or error message.
+     *
+     * @return void
+     */
 
-        common_element('input', array('name' => 'avatarfile',
-                                      'type' => 'file',
-                                      'id' => 'avatarfile'));
-        common_element_end('p');
-
-        common_submit('upload', _('Upload'));
-        common_element_end('form');
-
-    }
-
-    function show_password_form()
+    function handlePost()
     {
+        # CSRF protection
 
-        $user = common_current_user();
-        common_element_start('form', array('method' => 'POST',
-                                           'id' => 'password',
-                                           'action' =>
-                                           common_local_url('profilesettings')));
-
-        common_hidden('token', common_session_token());
-
-        # Users who logged in with OpenID won't have a pwd
-        if ($user->password) {
-            common_password('oldpassword', _('Old password'));
+        $token = $this->trimmed('token');
+        if (!$token || $token != common_session_token()) {
+            $this->showForm(_('There was a problem with your session token. '.
+                               'Try again, please.'));
+            return;
         }
-        common_password('newpassword', _('New password'),
-                        _('6 or more characters'));
-        common_password('confirm', _('Confirm'),
-                        _('same as password above'));
-        common_submit('changepass', _('Change'));
-        common_element_end('form');
-    }
 
-    function save_profile()
-    {
         $nickname = $this->trimmed('nickname');
         $fullname = $this->trimmed('fullname');
         $homepage = $this->trimmed('homepage');
@@ -225,38 +183,38 @@ class ProfilesettingsAction extends SettingsAction
         $language = $this->trimmed('language');
         $timezone = $this->trimmed('timezone');
         $tagstring = $this->trimmed('tags');
-        
+
         # Some validation
 
         if (!Validate::string($nickname, array('min_length' => 1,
                                                'max_length' => 64,
                                                'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
-            $this->show_form(_('Nickname must have only lowercase letters and numbers and no spaces.'));
+            $this->showForm(_('Nickname must have only lowercase letters and numbers and no spaces.'));
             return;
         } else if (!User::allowed_nickname($nickname)) {
-            $this->show_form(_('Not a valid nickname.'));
+            $this->showForm(_('Not a valid nickname.'));
             return;
         } else if (!is_null($homepage) && (strlen($homepage) > 0) &&
                    !Validate::uri($homepage, array('allowed_schemes' => array('http', 'https')))) {
-            $this->show_form(_('Homepage is not a valid URL.'));
+            $this->showForm(_('Homepage is not a valid URL.'));
             return;
         } else if (!is_null($fullname) && strlen($fullname) > 255) {
-            $this->show_form(_('Full name is too long (max 255 chars).'));
+            $this->showForm(_('Full name is too long (max 255 chars).'));
             return;
         } else if (!is_null($bio) && strlen($bio) > 140) {
-            $this->show_form(_('Bio is too long (max 140 chars).'));
+            $this->showForm(_('Bio is too long (max 140 chars).'));
             return;
         } else if (!is_null($location) && strlen($location) > 255) {
-            $this->show_form(_('Location is too long (max 255 chars).'));
+            $this->showForm(_('Location is too long (max 255 chars).'));
             return;
         }  else if (is_null($timezone) || !in_array($timezone, DateTimeZone::listIdentifiers())) {
-            $this->show_form(_('Timezone not selected.'));
+            $this->showForm(_('Timezone not selected.'));
             return;
-        } else if ($this->nickname_exists($nickname)) {
-            $this->show_form(_('Nickname already in use. Try another one.'));
+        } else if ($this->nicknameExists($nickname)) {
+            $this->showForm(_('Nickname already in use. Try another one.'));
             return;
         } else if (!is_null($language) && strlen($language) > 50) {
-            $this->show_form(_('Language is too long (max 50 chars).'));
+            $this->showForm(_('Language is too long (max 50 chars).'));
             return;
         }
 
@@ -265,14 +223,14 @@ class ProfilesettingsAction extends SettingsAction
         } else {
             $tags = array();
         }
-            
+
         foreach ($tags as $tag) {
             if (!common_valid_profile_tag($tag)) {
-                $this->show_form(sprintf(_('Invalid tag: "%s"'), $tag));
+                $this->showForm(sprintf(_('Invalid tag: "%s"'), $tag));
                 return;
             }
         }
-        
+
         $user = common_current_user();
 
         $user->query('BEGIN');
@@ -298,7 +256,7 @@ class ProfilesettingsAction extends SettingsAction
 
             if ($result === false) {
                 common_log_db_error($user, 'UPDATE', __FILE__);
-                common_server_error(_('Couldn\'t update user.'));
+                $this->serverError(_('Couldn\'t update user.'));
                 return;
             } else {
                 # Re-initialize language environment if it changed
@@ -318,7 +276,7 @@ class ProfilesettingsAction extends SettingsAction
 
             if ($result === false) {
                 common_log_db_error($user, 'UPDATE', __FILE__);
-                common_server_error(_('Couldn\'t update user for autosubscribe.'));
+                $this->serverError(_('Couldn\'t update user for autosubscribe.'));
                 return;
             }
         }
@@ -341,144 +299,34 @@ class ProfilesettingsAction extends SettingsAction
 
         if (!$result) {
             common_log_db_error($profile, 'UPDATE', __FILE__);
-            common_server_error(_('Couldn\'t save profile.'));
+            $this->serverError(_('Couldn\'t save profile.'));
             return;
         }
 
         # Set the user tags
-        
+
         $result = $user->setSelfTags($tags);
 
         if (!$result) {
-            common_server_error(_('Couldn\'t save tags.'));
+            $this->serverError(_('Couldn\'t save tags.'));
             return;
         }
-        
+
         $user->query('COMMIT');
 
         common_broadcast_profile($profile);
 
-        $this->show_form(_('Settings saved.'), true);
+        $this->showForm(_('Settings saved.'), true);
     }
 
-
-    function upload_avatar()
-    {
-        switch ($_FILES['avatarfile']['error']) {
-         case UPLOAD_ERR_OK: # success, jump out
-            break;
-         case UPLOAD_ERR_INI_SIZE:
-         case UPLOAD_ERR_FORM_SIZE:
-            $this->show_form(_('That file is too big.'));
-            return;
-         case UPLOAD_ERR_PARTIAL:
-            @unlink($_FILES['avatarfile']['tmp_name']);
-            $this->show_form(_('Partial upload.'));
-            return;
-         default:
-            $this->show_form(_('System error uploading file.'));
-            return;
-        }
-
-        $info = @getimagesize($_FILES['avatarfile']['tmp_name']);
-
-        if (!$info) {
-            @unlink($_FILES['avatarfile']['tmp_name']);
-            $this->show_form(_('Not an image or corrupt file.'));
-            return;
-        }
-
-        switch ($info[2]) {
-         case IMAGETYPE_GIF:
-         case IMAGETYPE_JPEG:
-         case IMAGETYPE_PNG:
-            break;
-         default:
-            $this->show_form(_('Unsupported image file format.'));
-            return;
-        }
-
-        $user = common_current_user();
-        $profile = $user->getProfile();
-
-        if ($profile->setOriginal($_FILES['avatarfile']['tmp_name'])) {
-            $this->show_form(_('Avatar updated.'), true);
-        } else {
-            $this->show_form(_('Failed updating avatar.'));
-        }
-
-        @unlink($_FILES['avatarfile']['tmp_name']);
-    }
-
-    function crop_avatar() {
-
-        $user = common_current_user();
-        $profile = $user->getProfile();
-
-        $x = $this->arg('avatar_crop_x');
-        $y = $this->arg('avatar_crop_y');
-        $w = $this->arg('avatar_crop_w');
-        $h = $this->arg('avatar_crop_h');
-
-        if ($profile->crop_avatars($x, $y, $w, $h)) {
-            $this->show_form(_('Avatar updated.'), true);
-        } else {
-            $this->show_form(_('Failed updating avatar.'));
-        }
-    }
-
-    function nickname_exists($nickname)
+    function nicknameExists($nickname)
     {
         $user = common_current_user();
         $other = User::staticGet('nickname', $nickname);
         if (!$other) {
-            return false;
+           return false;
         } else {
             return $other->id != $user->id;
         }
     }
-
-    function change_password()
-    {
-
-        $user = common_current_user();
-        assert(!is_null($user)); # should already be checked
-
-        # FIXME: scrub input
-
-        $newpassword = $this->arg('newpassword');
-        $confirm = $this->arg('confirm');
-        $token = $this->arg('token');
-
-        if (0 != strcmp($newpassword, $confirm)) {
-            $this->show_form(_('Passwords don\'t match.'));
-            return;
-        }
-
-        if ($user->password) {
-            $oldpassword = $this->arg('oldpassword');
-
-            if (!common_check_user($user->nickname, $oldpassword)) {
-                $this->show_form(_('Incorrect old password'));
-                return;
-            }
-        }
-
-        $original = clone($user);
-
-        $user->password = common_munge_password($newpassword, $user->id);
-
-        $val = $user->validate();
-        if ($val !== true) {
-            $this->show_form(_('Error saving user; invalid.'));
-            return;
-        }
-
-        if (!$user->update($original)) {
-            common_server_error(_('Can\'t save new password.'));
-            return;
-        }
-
-        $this->show_form(_('Password saved.'), true);
-    }
 }
index 039e885e6ba4b53f22fd1fc2dc3298a17e2fb53f..0ceeef98e8c1cf4f5e5e5a25f46d8733ad1cfd7a 100644 (file)
@@ -1,9 +1,12 @@
 <?php
-/*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+/**
+ * Laconica, the distributed open-source microblogging tool
  *
- * This program is free software: you can redistribute it and/or modify
+ * Action for displaying the public stream
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Public
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+    exit(1);
+}
 
-require_once(INSTALLDIR.'/lib/stream.php');
+require_once INSTALLDIR.'/lib/publicgroupnav.php';
+require_once INSTALLDIR.'/lib/noticelist.php';
+require_once INSTALLDIR.'/lib/feedlist.php';
 
-class PublicAction extends StreamAction
+/**
+ * Action for displaying the public stream
+ *
+ * @category Public
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      PublicrssAction
+ * @see      PublicxrdsAction
+ */
+
+class PublicAction extends Action
 {
+    /**
+     * page of the stream we're on; default = 1
+     */
 
-    function handle($args)
-    {
-        parent::handle($args);
+    var $page = null;
 
-        $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
+    /**
+     * Read and validate arguments
+     *
+     * @param array $args URL parameters
+     *
+     * @return boolean success value
+     */
 
-        header('X-XRDS-Location: '. common_local_url('publicxrds'));
+    function prepare($args)
+    {
+        parent::prepare($args);
+        $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
+        return true;
+    }
 
-        common_show_header(_('Public timeline'),
-                           array($this, 'show_header'), null,
-                           array($this, 'show_top'));
+    /**
+     * handle request
+     *
+     * Show the public stream, using recipe method showPage()
+     *
+     * @param array $args arguments, mostly unused
+     *
+     * @return void
+     */
 
-        # XXX: Public sidebar here?
+    function handle($args)
+    {
+        parent::handle($args);
 
-        $this->show_notices($page);
+        header('X-XRDS-Location: '. common_local_url('publicxrds'));
 
-        common_show_footer();
+        $this->showPage();
     }
 
-    function show_top()
+    /**
+     * Title of the page
+     *
+     * @return page title, including page number if over 1
+     */
+
+    function title()
     {
-        if (common_logged_in()) {
-            common_notice_form('public');
+        if ($this->page > 1) {
+            return sprintf(_('Public timeline, page %d'), $this->page);
         } else {
-            $instr = $this->get_instructions();
-            $output = common_markup_to_html($instr);
-            common_element_start('div', 'instructions');
-            common_raw($output);
-            common_element_end('div');
+            return _('Public timeline');
         }
-
-        $this->public_views_menu();
-
-        $this->show_feeds_list(array(0=>array('href'=>common_local_url('publicrss'),
-                                              'type' => 'rss',
-                                              'version' => 'RSS 1.0',
-                                              'item' => 'publicrss'),
-                                     1=>array('href'=>common_local_url('publicatom'),
-                                              'type' => 'atom',
-                                              'version' => 'Atom 1.0',
-                                              'item' => 'publicatom')));
     }
 
-    function get_instructions()
-    {
-        return _('This is %%site.name%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
-                 'based on the Free Software [Laconica](http://laconi.ca/) tool. ' .
-                 '[Join now](%%action.register%%) to share notices about yourself with friends, family, and colleagues! ([Read more](%%doc.help%%))');
-    }
+    /**
+     * Output <head> elements for RSS and Atom feeds
+     *
+     * @return void
+     */
 
-    function show_header()
+    function showFeeds()
     {
-        common_element('link', array('rel' => 'alternate',
+        $this->element('link', array('rel' => 'alternate',
                                      'href' => common_local_url('publicrss'),
                                      'type' => 'application/rss+xml',
                                      'title' => _('Public Stream Feed')));
-        # for client side of OpenID authentication
-        common_element('meta', array('http-equiv' => 'X-XRDS-Location',
+    }
+
+    /**
+     * Extra head elements
+     *
+     * We include a <meta> element linking to the publicxrds page, for OpenID
+     * client-side authentication.
+     *
+     * @return void
+     */
+
+    function extraHead()
+    {
+        // for client side of OpenID authentication
+        $this->element('meta', array('http-equiv' => 'X-XRDS-Location',
                                      'content' => common_local_url('publicxrds')));
     }
 
-    function show_notices($page)
+    /**
+     * Show tabset for this page
+     *
+     * Uses the PublicGroupNav widget
+     *
+     * @return void
+     * @see PublicGroupNav
+     */
+
+    function showLocalNav()
     {
+        $nav = new PublicGroupNav($this);
+        $nav->show();
+    }
+
+    /**
+     * Fill the content area
+     *
+     * Shows a list of the notices in the public stream, with some pagination
+     * controls.
+     *
+     * @return void
+     */
 
-        $cnt = 0;
-        $notice = Notice::publicStream(($page-1)*NOTICES_PER_PAGE,
+    function showContent()
+    {
+        $notice = Notice::publicStream(($this->page-1)*NOTICES_PER_PAGE,
                                        NOTICES_PER_PAGE + 1);
 
         if (!$notice) {
-            $this->server_error(_('Could not retrieve public stream.'));
+            $this->serverError(_('Could not retrieve public stream.'));
             return;
         }
 
-        $cnt = $this->show_notice_list($notice);
+        $nl = new NoticeList($notice, $this);
+
+        $cnt = $nl->show();
 
-        common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
-                          $page, 'public');
+        $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
+                          $this->page, 'public');
+    }
+
+    /**
+     * Makes a list of exported feeds for this page
+     *
+     * @return void
+     *
+     * @todo I18N
+     */
+
+    function showExportData()
+    {
+        $fl = new FeedList($this);
+        $fl->show(array(0 => array('href' => common_local_url('publicrss'),
+                                   'type' => 'rss',
+                                   'version' => 'RSS 1.0',
+                                   'item' => 'publicrss'),
+                        1 => array('href' => common_local_url('publicatom'),
+                                   'type' => 'atom',
+                                   'version' => 'Atom 1.0',
+                                   'item' => 'publicatom')));
     }
 }
index 3d731d79fa7e435fb06b17761fcfa8909f038d0c..e765fb1c92426a2db1eb4ce212494d784fabf3eb 100644 (file)
@@ -26,7 +26,7 @@ require_once(INSTALLDIR.'/lib/openid.php');
 class PublicxrdsAction extends Action
 {
 
-    function is_readonly()
+    function isReadOnly()
     {
         return true;
     }
@@ -39,45 +39,45 @@ class PublicxrdsAction extends Action
         header('Content-Type: application/xrds+xml');
 
         common_start_xml();
-        common_element_start('XRDS', array('xmlns' => 'xri://$xrds'));
+        $this->elementStart('XRDS', array('xmlns' => 'xri://$xrds'));
 
-        common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
+        $this->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
                                           'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
                                           'version' => '2.0'));
 
-        common_element('Type', null, 'xri://$xrds*simple');
+        $this->element('Type', null, 'xri://$xrds*simple');
 
         foreach (array('finishopenidlogin', 'finishaddopenid', 'finishimmediate') as $finish) {
             $this->show_service(Auth_OpenID_RP_RETURN_TO_URL_TYPE,
                                 common_local_url($finish));
         }
 
-        common_element_end('XRD');
+        $this->elementEnd('XRD');
 
-        common_element_end('XRDS');
+        $this->elementEnd('XRDS');
         common_end_xml();
     }
 
     function show_service($type, $uri, $params=null, $sigs=null, $localId=null)
     {
-        common_element_start('Service');
+        $this->elementStart('Service');
         if ($uri) {
-            common_element('URI', null, $uri);
+            $this->element('URI', null, $uri);
         }
-        common_element('Type', null, $type);
+        $this->element('Type', null, $type);
         if ($params) {
             foreach ($params as $param) {
-                common_element('Type', null, $param);
+                $this->element('Type', null, $param);
             }
         }
         if ($sigs) {
             foreach ($sigs as $sig) {
-                common_element('Type', null, $sig);
+                $this->element('Type', null, $sig);
             }
         }
         if ($localId) {
-            common_element('LocalID', null, $localId);
+            $this->element('LocalID', null, $localId);
         }
-        common_element_end('Service');
+        $this->elementEnd('Service');
     }
 }
\ No newline at end of file
index bb6ef81d602e4dc31a9b3242318716164d9fa6e6..3d839e7514d6c45e154da5ef2035dc5378a032f6 100644 (file)
@@ -30,7 +30,7 @@ class RecoverpasswordAction extends Action
     {
         parent::handle($args);
         if (common_logged_in()) {
-            $this->client_error(_('You are already logged in!'));
+            $this->clientError(_('You are already logged in!'));
             return;
         } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             if ($this->arg('recover')) {
@@ -38,7 +38,7 @@ class RecoverpasswordAction extends Action
             } else if ($this->arg('reset')) {
                 $this->reset_password();
             } else {
-                $this->client_error(_('Unexpected form submission.'));
+                $this->clientError(_('Unexpected form submission.'));
             }
         } else {
             if ($this->trimmed('code')) {
@@ -56,18 +56,18 @@ class RecoverpasswordAction extends Action
         $confirm = Confirm_address::staticGet('code', $code);
 
         if (!$confirm) {
-            $this->client_error(_('No such recovery code.'));
+            $this->clientError(_('No such recovery code.'));
             return;
         }
         if ($confirm->address_type != 'recover') {
-            $this->client_error(_('Not a recovery code.'));
+            $this->clientError(_('Not a recovery code.'));
             return;
         }
 
         $user = User::staticGet($confirm->user_id);
 
         if (!$user) {
-            $this->server_error(_('Recovery code for unknown user.'));
+            $this->serverError(_('Recovery code for unknown user.'));
             return;
         }
 
@@ -80,7 +80,7 @@ class RecoverpasswordAction extends Action
 
         if (!$result) {
             common_log_db_error($confirm, 'DELETE', __FILE__);
-            common_server_error(_('Error with confirmation code.'));
+            $this->serverError(_('Error with confirmation code.'));
             return;
         }
 
@@ -91,7 +91,7 @@ class RecoverpasswordAction extends Action
             common_log(LOG_WARNING, 
                        'Attempted redemption on recovery code ' .
                        'that is ' . $touched . ' seconds old. ');
-            $this->client_error(_('This confirmation code is too old. ' .
+            $this->clientError(_('This confirmation code is too old. ' .
                                    'Please start again.'));
             return;
         }
@@ -105,7 +105,7 @@ class RecoverpasswordAction extends Action
             $result = $user->updateKeys($orig);
             if (!$result) {
                 common_log_db_error($user, 'UPDATE', __FILE__);
-                $this->server_error(_('Could not update user with confirmed email address.'));
+                $this->serverError(_('Could not update user with confirmed email address.'));
                 return;
             }
         }
@@ -141,24 +141,24 @@ class RecoverpasswordAction extends Action
     function show_top($msg=null)
     {
         if ($msg) {
-            common_element('div', 'error', $msg);
+            $this->element('div', 'error', $msg);
         } else {
-            common_element_start('div', 'instructions');
-            common_element('p', null, 
+            $this->elementStart('div', 'instructions');
+            $this->element('p', null, 
                            _('If you\'ve forgotten or lost your' .
                               ' password, you can get a new one sent to' .
                               ' the email address you have stored ' .
                               ' in your account.'));
-            common_element_end('div');
+            $this->elementEnd('div');
         }
     }
 
     function show_password_top($msg=null)
     {
         if ($msg) {
-            common_element('div', 'error', $msg);
+            $this->element('div', 'error', $msg);
         } else {
-            common_element('div', 'instructions',
+            $this->element('div', 'instructions',
                            _('You\'ve been identified. Enter a ' .
                               ' new password below. '));
         }
@@ -170,15 +170,15 @@ class RecoverpasswordAction extends Action
         common_show_header(_('Recover password'), null,
         $msg, array($this, 'show_top'));
 
-        common_element_start('form', array('method' => 'post',
+        $this->elementStart('form', array('method' => 'post',
                                            'id' => 'recoverpassword',
                                            'action' => common_local_url('recoverpassword')));
-        common_input('nicknameoremail', _('Nickname or email'),
+        $this->input('nicknameoremail', _('Nickname or email'),
                      $this->trimmed('nicknameoremail'),
                      _('Your nickname on this server, ' .
                         'or your registered email address.'));
-        common_submit('recover', _('Recover'));
-        common_element_end('form');
+        $this->submit('recover', _('Recover'));
+        $this->elementEnd('form');
         common_show_footer();
     }
 
@@ -188,16 +188,16 @@ class RecoverpasswordAction extends Action
         common_show_header(_('Reset password'), null,
         $msg, array($this, 'show_password_top'));
 
-        common_element_start('form', array('method' => 'post',
+        $this->elementStart('form', array('method' => 'post',
                                            'id' => 'recoverpassword',
                                            'action' => common_local_url('recoverpassword')));
-        common_hidden('token', common_session_token());
-        common_password('newpassword', _('New password'),
+        $this->hidden('token', common_session_token());
+        $this->password('newpassword', _('New password'),
                         _('6 or more characters, and don\'t forget it!'));
-        common_password('confirm', _('Confirm'),
+        $this->password('confirm', _('Confirm'),
                         _('Same as password above'));
-        common_submit('reset', _('Reset'));
-        common_element_end('form');
+        $this->submit('reset', _('Reset'));
+        $this->elementEnd('form');
         common_show_footer();
     }
 
@@ -240,7 +240,7 @@ class RecoverpasswordAction extends Action
         }
 
         if (!$user->email && !$confirm_email) {
-            $this->client_error(_('No registered email address for that user.'));
+            $this->clientError(_('No registered email address for that user.'));
             return;
         }
 
@@ -254,7 +254,7 @@ class RecoverpasswordAction extends Action
 
         if (!$confirm->insert()) {
             common_log_db_error($confirm, 'INSERT', __FILE__);
-            $this->server_error(_('Error saving address confirmation.'));
+            $this->serverError(_('Error saving address confirmation.'));
             return;
         }
 
@@ -278,7 +278,7 @@ class RecoverpasswordAction extends Action
         mail_to_user($user, _('Password recovery requested'), $body, $confirm->address);
 
         common_show_header(_('Password recovery requested'));
-        common_element('p', null,
+        $this->element('p', null,
                        _('Instructions for recovering your password ' .
                           'have been sent to the email address registered to your ' .
                           'account.'));
@@ -298,7 +298,7 @@ class RecoverpasswordAction extends Action
         $user = $this->get_temp_user();
 
         if (!$user) {
-            $this->client_error(_('Unexpected password reset.'));
+            $this->clientError(_('Unexpected password reset.'));
             return;
         }
 
@@ -322,21 +322,21 @@ class RecoverpasswordAction extends Action
 
         if (!$user->update($original)) {
             common_log_db_error($user, 'UPDATE', __FILE__);
-            common_server_error(_('Can\'t save new password.'));
+            $this->serverError(_('Can\'t save new password.'));
             return;
         }
 
         $this->clear_temp_user();
 
         if (!common_set_user($user->nickname)) {
-            common_server_error(_('Error setting user.'));
+            $this->serverError(_('Error setting user.'));
             return;
         }
 
         common_real_login(true);
 
         common_show_header(_('Password saved.'));
-        common_element('p', null, _('New password successfully saved. ' .
+        $this->element('p', null, _('New password successfully saved. ' .
                                      'You are now logged in.'));
         common_show_footer();
     }
index c479816ef5d532b4a98e69f0f5a802eed19a5714..159daaa737417b73229710b2db8cfbd0ace22f10 100644 (file)
@@ -1,9 +1,12 @@
 <?php
-/*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+/**
+ * Laconica, the distributed open-source microblogging tool
  *
- * This program is free software: you can redistribute it and/or modify
+ * Register a new user account
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Login
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+/**
+ * An action for registering a new user account
+ *
+ * @category Login
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ */
 
 class RegisterAction extends Action
 {
+    /**
+     * Has there been an error?
+     */
+
+    var $error = null;
+
+    /**
+     * Have we registered?
+     */
+
+    var $registered = false;
+
+    /**
+     * Title of the page
+     *
+     * @return string title
+     */
+
+    function title()
+    {
+        if ($this->registered) {
+            return _('Registration successful');
+        } else {
+            return _('Register');
+        }
+    }
+
+    /**
+     * Handle input, produce output
+     *
+     * Switches on request method; either shows the form or handles its input.
+     *
+     * Checks if registration is closed and shows an error if so.
+     *
+     * @param array $args $_REQUEST data
+     *
+     * @return void
+     */
+
     function handle($args)
     {
         parent::handle($args);
 
         if (common_config('site', 'closed')) {
-            common_user_error(_('Registration not allowed.'));
+            $this->clientError(_('Registration not allowed.'));
         } else if (common_logged_in()) {
-            common_user_error(_('Already logged in.'));
+            $this->clientError(_('Already logged in.'));
         } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-            $this->try_register();
+            $this->tryRegister();
         } else {
-            $this->show_form();
+            $this->showForm();
         }
     }
 
-    function try_register()
+    /**
+     * Try to register a user
+     *
+     * Validates the input and tries to save a new user and profile
+     * record. On success, shows an instructions page.
+     *
+     * @return void
+     */
+
+    function tryRegister()
     {
         $token = $this->trimmed('token');
         if (!$token || $token != common_session_token()) {
-            $this->show_form(_('There was a problem with your session token. Try again, please.'));
+            $this->showForm(_('There was a problem with your session token. '.
+                              'Try again, please.'));
             return;
         }
 
         $nickname = $this->trimmed('nickname');
-        $email = $this->trimmed('email');
+        $email    = $this->trimmed('email');
         $fullname = $this->trimmed('fullname');
         $homepage = $this->trimmed('homepage');
-        $bio = $this->trimmed('bio');
+        $bio      = $this->trimmed('bio');
         $location = $this->trimmed('location');
 
-        # We don't trim these... whitespace is OK in a password!
+        // We don't trim these... whitespace is OK in a password!
 
         $password = $this->arg('password');
-        $confirm = $this->arg('confirm');
+        $confirm  = $this->arg('confirm');
 
-        # invitation code, if any
+        // invitation code, if any
 
         $code = $this->trimmed('code');
 
@@ -65,84 +136,109 @@ class RegisterAction extends Action
         }
 
         if (common_config('site', 'inviteonly') && !($code && $invite)) {
-            $this->client_error(_('Sorry, only invited people can register.'));
+            $this->clientError(_('Sorry, only invited people can register.'));
             return;
         }
 
-        # Input scrubbing
+        // Input scrubbing
 
         $nickname = common_canonical_nickname($nickname);
-        $email = common_canonical_email($email);
+        $email    = common_canonical_email($email);
 
         if (!$this->boolean('license')) {
-            $this->show_form(_('You can\'t register if you don\'t agree to the license.'));
+            $this->showForm(_('You can\'t register if you don\'t '.
+                              'agree to the license.'));
         } else if ($email && !Validate::email($email, true)) {
-            $this->show_form(_('Not a valid email address.'));
+            $this->showForm(_('Not a valid email address.'));
         } else if (!Validate::string($nickname, array('min_length' => 1,
                                                       'max_length' => 64,
-                                                      'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
-            $this->show_form(_('Nickname must have only lowercase letters and numbers and no spaces.'));
-        } else if ($this->nickname_exists($nickname)) {
-            $this->show_form(_('Nickname already in use. Try another one.'));
+                                                      'format' => NICKNAME_FMT))) {
+            $this->showForm(_('Nickname must have only lowercase letters '.
+                              'and numbers and no spaces.'));
+        } else if ($this->nicknameExists($nickname)) {
+            $this->showForm(_('Nickname already in use. Try another one.'));
         } else if (!User::allowed_nickname($nickname)) {
-            $this->show_form(_('Not a valid nickname.'));
-        } else if ($this->email_exists($email)) {
-            $this->show_form(_('Email address already exists.'));
+            $this->showForm(_('Not a valid nickname.'));
+        } else if ($this->emailExists($email)) {
+            $this->showForm(_('Email address already exists.'));
         } else if (!is_null($homepage) && (strlen($homepage) > 0) &&
-                   !Validate::uri($homepage, array('allowed_schemes' => array('http', 'https')))) {
-            $this->show_form(_('Homepage is not a valid URL.'));
+                   !Validate::uri($homepage,
+                                  array('allowed_schemes' =>
+                                        array('http', 'https')))) {
+            $this->showForm(_('Homepage is not a valid URL.'));
             return;
         } else if (!is_null($fullname) && strlen($fullname) > 255) {
-            $this->show_form(_('Full name is too long (max 255 chars).'));
+            $this->showForm(_('Full name is too long (max 255 chars).'));
             return;
         } else if (!is_null($bio) && strlen($bio) > 140) {
-            $this->show_form(_('Bio is too long (max 140 chars).'));
+            $this->showForm(_('Bio is too long (max 140 chars).'));
             return;
         } else if (!is_null($location) && strlen($location) > 255) {
-            $this->show_form(_('Location is too long (max 255 chars).'));
+            $this->showForm(_('Location is too long (max 255 chars).'));
             return;
         } else if (strlen($password) < 6) {
-            $this->show_form(_('Password must be 6 or more characters.'));
+            $this->showForm(_('Password must be 6 or more characters.'));
             return;
         } else if ($password != $confirm) {
-            $this->show_form(_('Passwords don\'t match.'));
-        } else if ($user = User::register(array('nickname' => $nickname, 'password' => $password, 'email' => $email,
-                                                'fullname' => $fullname, 'homepage' => $homepage, 'bio' => $bio,
-                                                'location' => $location, 'code' => $code))) {
+            $this->showForm(_('Passwords don\'t match.'));
+        } else if ($user = User::register(array('nickname' => $nickname,
+                                                'password' => $password,
+                                                'email' => $email,
+                                                'fullname' => $fullname,
+                                                'homepage' => $homepage,
+                                                'bio' => $bio,
+                                                'location' => $location,
+                                                'code' => $code))) {
             if (!$user) {
-                $this->show_form(_('Invalid username or password.'));
+                $this->showForm(_('Invalid username or password.'));
                 return;
             }
-            # success!
+            // success!
             if (!common_set_user($user)) {
-                common_server_error(_('Error setting user.'));
+                $this->serverError(_('Error setting user.'));
                 return;
             }
-            # this is a real login
+            // this is a real login
             common_real_login(true);
             if ($this->boolean('rememberme')) {
                 common_debug('Adding rememberme cookie for ' . $nickname);
                 common_rememberme($user);
             }
-            # Re-init language env in case it changed (not yet, but soon)
+            // Re-init language env in case it changed (not yet, but soon)
             common_init_language();
-            $this->show_success();
+            $this->showSuccess();
         } else {
-            $this->show_form(_('Invalid username or password.'));
+            $this->showForm(_('Invalid username or password.'));
         }
     }
 
-    # checks if *CANONICAL* nickname exists
+    /**
+     * Does the given nickname already exist?
+     *
+     * Checks a canonical nickname against the database.
+     *
+     * @param string $nickname nickname to check
+     *
+     * @return boolean true if the nickname already exists
+     */
 
-    function nickname_exists($nickname)
+    function nicknameExists($nickname)
     {
         $user = User::staticGet('nickname', $nickname);
         return ($user !== false);
     }
 
-    # checks if *CANONICAL* email exists
+    /**
+     * Does the given email address already exist?
+     *
+     * Checks a canonical email address against the database.
+     *
+     * @param string $email email address to check
+     *
+     * @return boolean true if the address already exists
+     */
 
-    function email_exists($email)
+    function emailExists($email)
     {
         $email = common_canonical_email($email);
         if (!$email || strlen($email) == 0) {
@@ -152,26 +248,78 @@ class RegisterAction extends Action
         return ($user !== false);
     }
 
-    function show_top($error=null)
+    /**
+     * Instructions or a notice for the page
+     *
+     * Shows the error, if any, or instructions for registration.
+     *
+     * @return void
+     */
+
+    function showPageNotice()
     {
-        if ($error) {
-            common_element('p', 'error', $error);
+        if ($this->registered) {
+            return;
+        } else if ($this->error) {
+            $this->element('p', 'error', $this->error);
         } else {
-            $instr = common_markup_to_html(_('With this form you can create a new account. ' .
-                                             'You can then post notices and link up to friends and colleagues. '.
-                                             '(Have an [OpenID](http://openid.net/)? ' .
-                                             'Try our [OpenID registration](%%action.openidlogin%%)!)'));
-
-            common_element_start('div', 'instructions');
-            common_raw($instr);
-            common_element_end('div');
+            $instr =
+              common_markup_to_html(_('With this form you can create '.
+                                      ' a new account. ' .
+                                      'You can then post notices and '.
+                                      'link up to friends and colleagues. '.
+                                      '(Have an [OpenID](http://openid.net/)? ' .
+                                      'Try our [OpenID registration]'.
+                                      '(%%action.openidlogin%%)!)'));
+
+            $this->elementStart('div', 'instructions');
+            $this->raw($instr);
+            $this->elementEnd('div');
         }
     }
 
-    function show_form($error=null)
+    /**
+     * Wrapper for showing a page
+     *
+     * Stores an error and shows the page
+     *
+     * @param string $error Error, if any
+     *
+     * @return void
+     */
+
+    function showForm($error=null)
+    {
+        $this->error = $error;
+        $this->showPage();
+    }
+
+    /**
+     * Show the page content
+     *
+     * Either shows the registration form or, if registration was successful,
+     * instructions for using the site.
+     *
+     * @return void
+     */
+
+    function showContent()
     {
-        global $config;
+        if ($this->registered) {
+            $this->showSuccessContent();
+        } else {
+            $this->showFormContent();
+        }
+    }
+
+    /**
+     * Show the registration form
+     *
+     * @return void
+     */
 
+    function showFormContent()
+    {
         $code = $this->trimmed('code');
 
         if ($code) {
@@ -179,90 +327,170 @@ class RegisterAction extends Action
         }
 
         if (common_config('site', 'inviteonly') && !($code && $invite)) {
-            $this->client_error(_('Sorry, only invited people can register.'));
+            $this->clientError(_('Sorry, only invited people can register.'));
             return;
         }
 
-        common_show_header(_('Register'), null, $error, array($this, 'show_top'));
-        common_element_start('form', array('method' => 'post',
-                                           'id' => 'login',
-                                           'action' => common_local_url('register')));
-
-        common_hidden('token', common_session_token());
+        $this->elementStart('form', array('method' => 'post',
+                                          'id' => 'form_register',
+                                          'class' => 'form_settings',
+                                          'action' => common_local_url('register')));
+        $this->elementStart('fieldset');
+        $this->element('legend', null, 'Account settings');
+        $this->hidden('token', common_session_token());
 
         if ($code) {
-            common_hidden('code', $code);
+            $this->hidden('code', $code);
         }
 
-        common_input('nickname', _('Nickname'), $this->trimmed('nickname'),
-                     _('1-64 lowercase letters or numbers, no punctuation or spaces. Required.'));
-        common_password('password', _('Password'),
+        $this->elementStart('ul', 'form_data');
+        $this->elementStart('li');
+        $this->input('nickname', _('Nickname'), $this->trimmed('nickname'),
+                     _('1-64 lowercase letters or numbers, '.
+                       'no punctuation or spaces. Required.'));
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->password('password', _('Password'),
                         _('6 or more characters. Required.'));
-        common_password('confirm', _('Confirm'),
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->password('confirm', _('Confirm'),
                         _('Same as password above. Required.'));
+        $this->elementEnd('li');
+        $this->elementStart('li');
         if ($invite && $invite->address_type == 'email') {
-            common_input('email', _('Email'), $invite->address,
-                     _('Used only for updates, announcements, and password recovery'));
+            $this->input('email', _('Email'), $invite->address,
+                         _('Used only for updates, announcements, '.
+                           'and password recovery'));
         } else {
-            common_input('email', _('Email'), $this->trimmed('email'),
-                         _('Used only for updates, announcements, and password recovery'));
+            $this->input('email', _('Email'), $this->trimmed('email'),
+                         _('Used only for updates, announcements, '.
+                           'and password recovery'));
         }
-        common_input('fullname', _('Full name'),
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->input('fullname', _('Full name'),
                      $this->trimmed('fullname'),
-                      _('Longer name, preferably your "real" name'));
-        common_input('homepage', _('Homepage'),
+                     _('Longer name, preferably your "real" name'));
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->input('homepage', _('Homepage'),
                      $this->trimmed('homepage'),
-                     _('URL of your homepage, blog, or profile on another site'));
-        common_textarea('bio', _('Bio'),
+                     _('URL of your homepage, blog, '.
+                       'or profile on another site'));
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->textarea('bio', _('Bio'),
                         $this->trimmed('bio'),
-                         _('Describe yourself and your interests in 140 chars'));
-        common_input('location', _('Location'),
+                        _('Describe yourself and your '.
+                          'interests in 140 chars'));
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->input('location', _('Location'),
                      $this->trimmed('location'),
-                     _('Where you are, like "City, State (or Region), Country"'));
-        common_checkbox('rememberme', _('Remember me'),
+                     _('Where you are, like "City, '.
+                       'State (or Region), Country"'));
+        $this->elementEnd('li');
+        $this->elementStart('li', array('id' => 'settings_rememberme'));
+        $this->checkbox('rememberme', _('Remember me'),
                         $this->boolean('rememberme'),
-                        _('Automatically login in the future; not for shared computers!'));
-        common_element_start('p');
+                        _('Automatically login in the future; '.
+                          'not for shared computers!'));
+        $this->elementEnd('li');
         $attrs = array('type' => 'checkbox',
                        'id' => 'license',
+                       'class' => 'checkbox',
                        'name' => 'license',
                        'value' => 'true');
         if ($this->boolean('license')) {
             $attrs['checked'] = 'checked';
         }
-        common_element('input', $attrs);
-        common_text(_('My text and files are available under '));
-        common_element('a', array('href' => $config['license']['url']),
+        $this->elementStart('li');
+        $this->element('input', $attrs);
+        $this->text(_('My text and files are available under '));
+        $this->element('a', array('href' => common_config('license', 'url')),
                        $config['license']['title']);
-        common_text(_(' except this private data: password, email address, IM address, phone number.'));
-        common_element_end('p');
-        common_submit('submit', _('Register'));
-        common_element_end('form');
-        common_show_footer();
+        $this->text(_(' except this private data: password, '.
+                      'email address, IM address, phone number.'));
+        $this->elementEnd('li');
+        $this->elementEnd('ul');
+        $this->submit('submit', _('Register'));
+        $this->elementEnd('fieldset');
+        $this->elementEnd('form');
     }
 
-    function show_success()
+    /**
+     * Show some information about registering for the site
+     *
+     * Save the registration flag, run showPage
+     *
+     * @return void
+     */
+
+    function showSuccess()
+    {
+        $this->registered = true;
+        $this->showPage();
+    }
+
+    /**
+     * Show some information about registering for the site
+     *
+     * Gives some information and options for new registrees.
+     *
+     * @return void
+     */
+
+    function showSuccessContent()
     {
         $nickname = $this->arg('nickname');
-        common_show_header(_('Registration successful'));
-        common_element_start('div', 'success');
-        $instr = sprintf(_('Congratulations, %s! And welcome to %%%%site.name%%%%. From here, you may want to...'. "\n\n" .
-                           '* Go to [your profile](%s) and post your first message.' .  "\n" .
-                           '* Add a [Jabber/GTalk address](%%%%action.imsettings%%%%) so you can send notices through instant messages.' . "\n" .
-                           '* [Search for people](%%%%action.peoplesearch%%%%) that you may know or that share your interests. ' . "\n" .
-                           '* Update your [profile settings](%%%%action.profilesettings%%%%) to tell others more about you. ' . "\n" .
-                           '* Read over the [online docs](%%%%doc.help%%%%) for features you may have missed. ' . "\n\n" .
-                           'Thanks for signing up and we hope you enjoy using this service.'),
-                         $nickname, common_local_url('showstream', array('nickname' => $nickname)));
-        common_raw(common_markup_to_html($instr));
+
+        $profileurl = common_local_url('showstream',
+                                       array('nickname' => $nickname));
+
+        $this->elementStart('div', 'success');
+        $instr = sprintf(_('Congratulations, %s! And welcome to %%%%site.name%%%%. '.
+                           'From here, you may want to...'. "\n\n" .
+                           '* Go to [your profile](%s) '.
+                           'and post your first message.' .  "\n" .
+                           '* Add a [Jabber/GTalk address]'.
+                           '(%%%%action.imsettings%%%%) '.
+                           'so you can send notices '.
+                           'through instant messages.' . "\n" .
+                           '* [Search for people](%%%%action.peoplesearch%%%%) '.
+                           'that you may know or '.
+                           'that share your interests. ' . "\n" .
+                           '* Update your [profile settings]'.
+                           '(%%%%action.profilesettings%%%%)'.
+                           ' to tell others more about you. ' . "\n" .
+                           '* Read over the [online docs](%%%%doc.help%%%%)'.
+                           ' for features you may have missed. ' . "\n\n" .
+                           'Thanks for signing up and we hope '.
+                           'you enjoy using this service.'),
+                         $nickname, $profileurl);
+
+        $this->raw(common_markup_to_html($instr));
+
         $have_email = $this->trimmed('email');
         if ($have_email) {
-            $emailinstr = _('(You should receive a message by email momentarily, with ' .
-                            'instructions on how to confirm your email address.)');
-            common_raw(common_markup_to_html($emailinstr));
+            $emailinstr = _('(You should receive a message by email '.
+                            'momentarily, with ' .
+                            'instructions on how to confirm '.
+                            'your email address.)');
+            $this->raw(common_markup_to_html($emailinstr));
         }
-        common_element_end('div');
-        common_show_footer();
+        $this->elementEnd('div');
     }
 
+    /**
+     * Show the login group nav menu
+     *
+     * @return void
+     */
+
+    function showLocalNav()
+    {
+        $nav = new LoginGroupNav($this);
+        $nav->show();
+    }
 }
index a9494772eb707802a9a9a2fef64118d5689c9946..32e9bf3d37a7834bdc67d4582dedc1b5399b97f3 100644 (file)
@@ -30,7 +30,7 @@ class RemotesubscribeAction extends Action
         parent::handle($args);
 
         if (common_logged_in()) {
-            common_user_error(_('You can use the local subscription!'));
+            $this->clientError(_('You can use the local subscription!'));
             return;
         }
 
@@ -61,13 +61,13 @@ class RemotesubscribeAction extends Action
     function show_top($err=null)
     {
         if ($err) {
-            common_element('div', 'error', $err);
+            $this->element('div', 'error', $err);
         } else {
             $instructions = $this->get_instructions();
             $output = common_markup_to_html($instructions);
-            common_element_start('div', 'instructions');
-            common_raw($output);
-            common_element_end('p');
+            $this->elementStart('div', 'instructions');
+            $this->raw($output);
+            $this->elementEnd('p');
         }
     }
 
@@ -79,15 +79,15 @@ class RemotesubscribeAction extends Action
                            array($this, 'show_top'));
         # id = remotesubscribe conflicts with the
         # button on profile page
-        common_element_start('form', array('id' => 'remsub', 'method' => 'post',
+        $this->elementStart('form', array('id' => 'remsub', 'method' => 'post',
                                            'action' => common_local_url('remotesubscribe')));
-        common_hidden('token', common_session_token());
-        common_input('nickname', _('User nickname'), $nickname,
+        $this->hidden('token', common_session_token());
+        $this->input('nickname', _('User nickname'), $nickname,
                      _('Nickname of the user you want to follow'));
-        common_input('profile_url', _('Profile URL'), $profile,
+        $this->input('profile_url', _('Profile URL'), $profile,
                      _('URL of your profile on another compatible microblogging service'));
-        common_submit('submit', _('Subscribe'));
-        common_element_end('form');
+        $this->submit('submit', _('Subscribe'));
+        $this->elementEnd('form');
         common_show_footer();
     }
 
@@ -342,7 +342,7 @@ class RemotesubscribeAction extends Action
         $profile = $user->getProfile();
         if (!$profile) {
             common_log_db_error($user, 'SELECT', __FILE__);
-            $this->server_error(_('User without matching profile'));
+            $this->serverError(_('User without matching profile'));
             return;
         }
 
index eceeb4d650fa7b6aa9c4d14e2031c4b6140df716..ea8ef4764373bd4984d859b07e7c6fa5f3b53a9a 100644 (file)
@@ -1,9 +1,12 @@
 <?php
-/*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+/**
+ * Laconica, the distributed open-source microblogging tool
  *
- * This program is free software: you can redistribute it and/or modify
+ * List of replies
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Personal
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+    exit(1);
+}
 
-require_once(INSTALLDIR.'/actions/showstream.php');
+require_once INSTALLDIR.'/lib/personalgroupnav.php';
+require_once INSTALLDIR.'/lib/noticelist.php';
+require_once INSTALLDIR.'/lib/feedlist.php';
 
-class RepliesAction extends StreamAction
-{
+/**
+ * List of replies
+ *
+ * @category Personal
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ */
 
-    function handle($args)
+class RepliesAction extends Action
+{
+    var $user = null;
+    var $page = null;
+
+    /**
+     * Prepare the object
+     *
+     * Check the input values and initialize the object.
+     * Shows an error page on bad input.
+     *
+     * @param array $args $_REQUEST data
+     *
+     * @return boolean success flag
+     */
+
+    function prepare($args)
     {
-
-        parent::handle($args);
+        parent::prepare($args);
 
         $nickname = common_canonical_nickname($this->arg('nickname'));
-        $user = User::staticGet('nickname', $nickname);
 
-        if (!$user) {
-            $this->no_such_user();
-            return;
+        $this->user = User::staticGet('nickname', $nickname);
+
+        if (!$this->user) {
+            $this->clientError(_('No such user.'));
+            return false;
         }
 
-        $profile = $user->getProfile();
+        $profile = $this->user->getProfile();
 
         if (!$profile) {
-            common_server_error(_('User has no profile.'));
-            return;
+            $this->serverError(_('User has no profile.'));
+            return false;
         }
 
-        # Looks like we're good; show the header
+        $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
 
-        common_show_header(sprintf(_("Replies to %s"), $profile->nickname),
-                           array($this, 'show_header'), $user,
-                           array($this, 'show_top'));
+        return true;
+    }
 
-        $this->show_replies($user);
+    /**
+     * Handle a request
+     *
+     * Just show the page. All args already handled.
+     *
+     * @param array $args $_REQUEST data
+     *
+     * @return void
+     */
 
-        common_show_footer();
+    function handle($args)
+    {
+        parent::handle($args);
+        $this->showPage();
     }
 
-    function no_such_user()
+    /**
+     * Title of the page
+     *
+     * Includes name of user and page number.
+     *
+     * @return string title of page
+     */
+
+    function title()
     {
-        common_user_error(_('No such user.'));
+        if ($this->page == 1) {
+            return sprintf(_("Replies to %s"), $this->user->nickname);
+        } else {
+            return sprintf(_("Replies to %s, page %d"),
+                           $profile->nickname,
+                           $this->page);
+        }
     }
 
-    function show_header($user)
+    /**
+     * Feeds for the <head> section
+     *
+     * @return void
+     */
+
+    function showFeeds()
     {
-        common_element('link', array('rel' => 'alternate',
-                                     'href' => common_local_url('repliesrss', array('nickname' =>
-                                                                                    $user->nickname)),
+        $rssurl   = common_local_url('repliesrss',
+                                     array('nickname' => $this->user->nickname));
+        $rsstitle = sprintf(_('Feed for replies to %s'), $this->user->nickname);
+
+        $this->element('link', array('rel' => 'alternate',
+                                     'href' => $rssurl,
                                      'type' => 'application/rss+xml',
-                                     'title' => sprintf(_('Feed for replies to %s'), $user->nickname)));
+                                     'title' => $rsstitle));
     }
 
-    function show_top($user)
+    /**
+     * show the personal group nav
+     *
+     * @return void
+     */
+
+    function showLocalNav()
     {
-        $cur = common_current_user();
+        $nav = new PersonalGroupNav($this);
+        $nav->show();
+    }
 
-        if ($cur && $cur->id == $user->id) {
-            common_notice_form('replies');
-        }
+    /**
+     * Show the replies feed links
+     *
+     * @return void
+     */
+
+    function showExportData()
+    {
+        $fl = new FeedList($this);
 
-        $this->views_menu();
+        $rssurl = common_local_url('repliesrss',
+                                   array('nickname' => $this->user->nickname));
 
-        $this->show_feeds_list(array(0=>array('href'=>common_local_url('repliesrss', array('nickname' => $user->nickname)),
-                                              'type' => 'rss',
-                                              'version' => 'RSS 1.0',
-                                              'item' => 'repliesrss')));
+        $fl->show(array(0=>array('href'=> $rssurl,
+                                 'type' => 'rss',
+                                 'version' => 'RSS 1.0',
+                                 'item' => 'repliesrss')));
     }
 
-    function show_replies($user)
-    {
+    /**
+     * Show the content
+     *
+     * A list of notices that are replies to the user, plus pagination.
+     *
+     * @return void
+     */
 
-        $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
+    function showContent()
+    {
+        $notice = $this->user->getReplies(($this->page-1) * NOTICES_PER_PAGE,
+                                          NOTICES_PER_PAGE + 1);
 
-        $notice = $user->getReplies(($page-1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
+        $nl = new NoticeList($notice, $this);
 
-        $cnt = $this->show_notice_list($notice);
+        $cnt = $nl->show();
 
-        common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
-                          $page, 'replies', array('nickname' => $user->nickname));
+        $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
+                          $this->page, 'replies',
+                          array('nickname' => $this->user->nickname));
     }
 }
index 5f85f8d2e8b27ebd9096d49dae228a320b511c62..43be133a43a3ffb8a21e05474b96738ab504c465 100644 (file)
@@ -34,7 +34,7 @@ class RepliesrssAction extends Rss10Action
         $this->user = User::staticGet('nickname', $nickname);
 
         if (!$this->user) {
-            common_user_error(_('No such user.'));
+            $this->clientError(_('No such user.'));
             return false;
         } else {
             return true;
index a745487393c4fa7f707eb479e5a05b4aca303f45..5058deedb5a55b23c2a9ce990a7129bc4704a316 100644 (file)
@@ -24,7 +24,7 @@ require_once(INSTALLDIR.'/lib/omb.php');
 class RequesttokenAction extends Action
 {
     
-    function is_readonly()
+    function isReadOnly()
     {
         return false;
     }
@@ -39,7 +39,7 @@ class RequesttokenAction extends Action
             $token = $server->fetch_request_token($req);
             print $token;
         } catch (OAuthException $e) {
-            common_server_error($e->getMessage());
+            $this->serverError($e->getMessage());
         }
     }
 }
index f4344833d9ea572c6f5c08908a8c632ef631c31b..caa823893d7051afb44e02abca4ea49c3f24c38b 100644 (file)
@@ -33,14 +33,14 @@ class ShowfavoritesAction extends StreamAction
         $user = User::staticGet('nickname', $nickname);
 
         if (!$user) {
-            $this->client_error(_('No such user.'));
+            $this->clientError(_('No such user.'));
             return;
         }
 
         $profile = $user->getProfile();
 
         if (!$profile) {
-            common_server_error(_('User has no profile.'));
+            $this->serverError(_('User has no profile.'));
             return;
         }
 
@@ -57,7 +57,7 @@ class ShowfavoritesAction extends StreamAction
 
     function show_header($user)
     {
-        common_element('link', array('rel' => 'alternate',
+        $this->element('link', array('rel' => 'alternate',
                                      'href' => common_local_url('favoritesrss', array('nickname' =>
                                                                                       $user->nickname)),
                                      'type' => 'application/rss+xml',
@@ -90,7 +90,7 @@ class ShowfavoritesAction extends StreamAction
         $notice = $user->favoriteNotices(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
 
         if (!$notice) {
-            $this->server_error(_('Could not retrieve favorite notices.'));
+            $this->serverError(_('Could not retrieve favorite notices.'));
             return;
         }
 
index 25330a568f6d23ea8e56944af1ee7e69cb3c7c65..d13e9f671fc32f284ab9d3b0cc1b79efd9a984eb 100644 (file)
@@ -32,7 +32,7 @@ class ShowmessageAction extends MailboxAction
         $message = $this->get_message();
 
         if (!$message) {
-            $this->client_error(_('No such message.'), 404);
+            $this->clientError(_('No such message.'), 404);
             return;
         }
         
@@ -41,7 +41,7 @@ class ShowmessageAction extends MailboxAction
         if ($cur && ($cur->id == $message->from_profile || $cur->id == $message->to_profile)) {
             $this->show_page($cur, 1);
         } else {
-            $this->client_error(_('Only the sender and recipient may read this message.'), 403);
+            $this->clientError(_('Only the sender and recipient may read this message.'), 403);
             return;
         }
     }
index 2df09cb3fcdad121a9536a57de81799fc90dbc5b..52faba93ef76dae9ce63fdc8bd27b0c31d705ca1 100644 (file)
@@ -1,9 +1,12 @@
 <?php
-/*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+/**
+ * Laconica, the distributed open-source microblogging tool
  *
- * This program is free software: you can redistribute it and/or modify
+ * Show a single notice
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Personal
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+    exit(1);
+}
 
-require_once(INSTALLDIR.'/lib/stream.php');
+require_once INSTALLDIR.'/lib/personalgroupnav.php';
+require_once INSTALLDIR.'/lib/noticelist.php';
+require_once INSTALLDIR.'/lib/feedlist.php';
 
-class ShownoticeAction extends StreamAction
+/**
+ * Show a single notice
+ *
+ * @category Personal
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ */
+
+class ShownoticeAction extends Action
 {
+    /**
+     * Notice object to show
+     */
 
     var $notice = null;
+
+    /**
+     * Profile of the notice object
+     */
+
     var $profile = null;
+
+    /**
+     * Avatar of the profile of the notice object
+     */
+
     var $avatar = null;
 
+    /**
+     * Load attributes based on database arguments
+     *
+     * Loads all the DB stuff
+     *
+     * @param array $args $_REQUEST array
+     *
+     * @return success flag
+     */
+
     function prepare($args)
     {
-
         parent::prepare($args);
 
         $id = $this->arg('notice');
+
         $this->notice = Notice::staticGet($id);
 
         if (!$this->notice) {
-            $this->client_error(_('No such notice.'), 404);
+            $this->clientError(_('No such notice.'), 404);
             return false;
         }
 
         $this->profile = $this->notice->getProfile();
 
         if (!$this->profile) {
-            $this->server_error(_('Notice has no profile'), 500);
+            $this->serverError(_('Notice has no profile'), 500);
             return false;
         }
 
@@ -53,45 +100,112 @@ class ShownoticeAction extends StreamAction
         return true;
     }
 
-    function last_modified()
+    /**
+     * Is this action read-only?
+     *
+     * @return boolean true
+     */
+
+    function isReadOnly()
+    {
+        return true;
+    }
+
+    /**
+     * Last-modified date for page
+     *
+     * When was the content of this page last modified? Based on notice,
+     * profile, avatar.
+     *
+     * @return int last-modified date as unix timestamp
+     */
+
+    function lastModified()
     {
         return max(strtotime($this->notice->created),
                    strtotime($this->profile->modified),
                    ($this->avatar) ? strtotime($this->avatar->modified) : 0);
     }
 
+    /**
+     * An entity tag for this page
+     *
+     * Shows the ETag for the page, based on the notice ID and timestamps
+     * for the notice, profile, and avatar. It's weak, since we change
+     * the date text "one hour ago", etc.
+     *
+     * @return string etag
+     */
+
     function etag()
     {
+        $avtime = ($this->avatar) ?
+          strtotime($this->avatar->modified) : 0;
+
         return 'W/"' . implode(':', array($this->arg('action'),
                                           common_language(),
                                           $this->notice->id,
                                           strtotime($this->notice->created),
                                           strtotime($this->profile->modified),
-                                          ($this->avatar) ? strtotime($this->avatar->modified) : 0)) . '"';
+                                          $avtime)) . '"';
     }
 
-    function handle($args)
+    /**
+     * Title of the page
+     *
+     * @return string title of the page
+     */
+
+    function title()
     {
+        return sprintf(_('%1$s\'s status on %2$s'),
+                       $this->profile->nickname,
+                       common_exact_date($this->notice->created));
+    }
+
+    /**
+     * Handle input
+     *
+     * Only handles get, so just show the page.
+     *
+     * @param array $args $_REQUEST data (unused)
+     *
+     * @return void
+     */
 
+    function handle($args)
+    {
         parent::handle($args);
 
-        common_show_header(sprintf(_('%1$s\'s status on %2$s'),
-                                   $this->profile->nickname,
-                                   common_exact_date($this->notice->created)),
-                           array($this, 'show_header'), null,
-                           array($this, 'show_top'));
+        $this->showPage();
+    }
 
-        common_element_start('ul', array('id' => 'notices'));
-        $nli = new NoticeListItem($this->notice);
-        $nli->show();
-        common_element_end('ul');
+    /**
+     * Fill the content area of the page
+     *
+     * Shows a single notice list item.
+     *
+     * @return void
+     */
 
-        common_show_footer();
+    function showContent()
+    {
+        $this->elementStart('ul', array('id' => 'notices'));
+        $nli = new NoticeListItem($this->notice, $this);
+        $nli->show();
+        $this->elementEnd('ul');
     }
 
-    function show_header()
-    {
+    /**
+     * Extra <head> content
+     *
+     * We show the microid(s) for the author, if any.
+     *
+     * @return void
+     */
 
+    function extraHead()
+    {
         $user = User::staticGet($this->profile->id);
 
         if (!$user) {
@@ -99,26 +213,17 @@ class ShownoticeAction extends StreamAction
         }
 
         if ($user->emailmicroid && $user->email && $this->notice->uri) {
-            common_element('meta', array('name' => 'microid',
-                                         'content' => "mailto+http:sha1:" . sha1(sha1('mailto:' . $user->email) . sha1($this->notice->uri))));
+            $id = new Microid('mailto:'. $user->email,
+                              $this->notice->uri);
+            $this->element('meta', array('name' => 'microid',
+                                         'content' => $id->toString()));
         }
 
         if ($user->jabbermicroid && $user->jabber && $this->notice->uri) {
-            common_element('meta', array('name' => 'microid',
-                                         'content' => "xmpp+http:sha1:" . sha1(sha1('xmpp:' . $user->jabber) . sha1($this->notice->uri))));
-        }
-    }
-
-    function show_top()
-    {
-        $cur = common_current_user();
-        if ($cur && $cur->id == $this->profile->id) {
-            common_notice_form();
+            $id = new Microid('xmpp:', $user->jabber,
+                              $this->notice->uri);
+            $this->element('meta', array('name' => 'microid',
+                                         'content' => $id->toString()));
         }
     }
-
-    function no_such_notice()
-    {
-        common_user_error(_('No such notice.'));
-    }
 }
index e4e5d96d15d1c3e296ebd4fbe5b2c511f8bbe0fa..ed38c67f95ccd90e00fbe73ffa06de8db86582c3 100644 (file)
@@ -56,7 +56,7 @@ class ShowstreamAction extends StreamAction
         $profile = $user->getProfile();
 
         if (!$profile) {
-            common_server_error(_('User has no profile.'));
+            $this->serverError(_('User has no profile.'));
             return;
         }
 
@@ -106,66 +106,66 @@ class ShowstreamAction extends StreamAction
     function show_header($user)
     {
         # Feeds
-        common_element('link', array('rel' => 'alternate',
+        $this->element('link', array('rel' => 'alternate',
                                      'href' => common_local_url('api',
                                                                 array('apiaction' => 'statuses',
                                                                       'method' => 'user_timeline.rss',
                                                                       'argument' => $user->nickname)),
                                      'type' => 'application/rss+xml',
                                      'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
-        common_element('link', array('rel' => 'alternate feed',
+        $this->element('link', array('rel' => 'alternate feed',
                                      'href' => common_local_url('api',
                                                                 array('apiaction' => 'statuses',
                                                                       'method' => 'user_timeline.atom',
                                                                       'argument' => $user->nickname)),
                                      'type' => 'application/atom+xml',
                                      'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
-        common_element('link', array('rel' => 'alternate',
+        $this->element('link', array('rel' => 'alternate',
                                      'href' => common_local_url('userrss', array('nickname' =>
                                                                                $user->nickname)),
                                      'type' => 'application/rdf+xml',
                                      'title' => sprintf(_('Notice feed for %s'), $user->nickname)));
         # FOAF
-        common_element('link', array('rel' => 'meta',
+        $this->element('link', array('rel' => 'meta',
                                      'href' => common_local_url('foaf', array('nickname' =>
                                                                               $user->nickname)),
                                      'type' => 'application/rdf+xml',
                                      'title' => 'FOAF'));
         # for remote subscriptions etc.
-        common_element('meta', array('http-equiv' => 'X-XRDS-Location',
+        $this->element('meta', array('http-equiv' => 'X-XRDS-Location',
                                      'content' => common_local_url('xrds', array('nickname' =>
                                                                                $user->nickname))));
         $profile = $user->getProfile();
         if ($profile->bio) {
-            common_element('meta', array('name' => 'description',
+            $this->element('meta', array('name' => 'description',
                                          'content' => $profile->bio));
         }
 
         if ($user->emailmicroid && $user->email && $profile->profileurl) {
-            common_element('meta', array('name' => 'microid',
+            $this->element('meta', array('name' => 'microid',
                                          'content' => "mailto+http:sha1:" . sha1(sha1('mailto:' . $user->email) . sha1($profile->profileurl))));
         }
         if ($user->jabbermicroid && $user->jabber && $profile->profileurl) {
-            common_element('meta', array('name' => 'microid',
+            $this->element('meta', array('name' => 'microid',
                                          'content' => "xmpp+http:sha1:" . sha1(sha1('xmpp:' . $user->jabber) . sha1($profile->profileurl))));
         }
 
         # See https://wiki.mozilla.org/Microsummaries
 
-        common_element('link', array('rel' => 'microsummary',
+        $this->element('link', array('rel' => 'microsummary',
                                      'href' => common_local_url('microsummary',
                                                                 array('nickname' => $profile->nickname))));
     }
 
     function no_such_user()
     {
-        $this->client_error(_('No such user.'), 404);
+        $this->clientError(_('No such user.'), 404);
     }
 
     function show_profile($profile)
     {
 
-        common_element_start('div', array('id' => 'profile', 'class' => 'vcard'));
+        $this->elementStart('div', array('id' => 'profile', 'class' => 'vcard'));
 
         $this->show_personal($profile);
 
@@ -175,23 +175,23 @@ class ShowstreamAction extends StreamAction
 
         $this->show_subscriptions($profile);
 
-        common_element_end('div');
+        $this->elementEnd('div');
     }
 
     function show_personal($profile)
     {
 
         $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
-        common_element_start('div', array('id' => 'profile_avatar'));
-        common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE),
+        $this->elementStart('div', array('id' => 'profile_avatar'));
+        $this->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE),
                                     'class' => 'avatar profile photo',
                                     'width' => AVATAR_PROFILE_SIZE,
                                     'height' => AVATAR_PROFILE_SIZE,
                                     'alt' => $profile->nickname));
 
-        common_element_start('ul', array('id' => 'profile_actions'));
+        $this->elementStart('ul', array('id' => 'profile_actions'));
 
-        common_element_start('li', array('id' => 'profile_subscribe'));
+        $this->elementStart('li', array('id' => 'profile_subscribe'));
         $cur = common_current_user();
         if ($cur) {
             if ($cur->id != $profile->id) {
@@ -204,14 +204,14 @@ class ShowstreamAction extends StreamAction
         } else {
             $this->show_remote_subscribe_link($profile);
         }
-        common_element_end('li');
+        $this->elementEnd('li');
 
         $user = User::staticGet('id', $profile->id);
         common_profile_new_message_nudge($cur, $user, $profile);
 
         if ($cur && $cur->id != $profile->id) {
             $blocked = $cur->hasBlocked($profile);
-            common_element_start('li', array('id' => 'profile_block'));
+            $this->elementStart('li', array('id' => 'profile_block'));
             if ($blocked) {
                 common_unblock_form($profile, array('action' => 'showstream',
                                                     'nickname' => $profile->nickname));
@@ -219,62 +219,62 @@ class ShowstreamAction extends StreamAction
                 common_block_form($profile, array('action' => 'showstream',
                                                   'nickname' => $profile->nickname));
             }
-            common_element_end('li');
+            $this->elementEnd('li');
         }
 
-        common_element_end('ul');
+        $this->elementEnd('ul');
 
-        common_element_end('div');
+        $this->elementEnd('div');
 
-        common_element_start('div', array('id' => 'profile_information'));
+        $this->elementStart('div', array('id' => 'profile_information'));
 
         if ($profile->fullname) {
-            common_element('h1', array('class' => 'fn'), $profile->fullname . ' (' . $profile->nickname . ')');
+            $this->element('h1', array('class' => 'fn'), $profile->fullname . ' (' . $profile->nickname . ')');
         } else {
-            common_element('h1', array('class' => 'fn nickname'), $profile->nickname);
+            $this->element('h1', array('class' => 'fn nickname'), $profile->nickname);
         }
 
         if ($profile->location) {
-            common_element('p', 'location', $profile->location);
+            $this->element('p', 'location', $profile->location);
         }
         if ($profile->bio) {
-            common_element('p', 'description note', $profile->bio);
+            $this->element('p', 'description note', $profile->bio);
         }
         if ($profile->homepage) {
-            common_element_start('p', 'website');
-            common_element('a', array('href' => $profile->homepage,
+            $this->elementStart('p', 'website');
+            $this->element('a', array('href' => $profile->homepage,
                                       'rel' => 'me', 'class' => 'url'),
                            $profile->homepage);
-            common_element_end('p');
+            $this->elementEnd('p');
         }
 
         $this->show_statistics($profile);
 
-        common_element_end('div');
+        $this->elementEnd('div');
     }
 
     function show_remote_subscribe_link($profile)
     {
         $url = common_local_url('remotesubscribe',
                                 array('nickname' => $profile->nickname));
-        common_element('a', array('href' => $url,
+        $this->element('a', array('href' => $url,
                                   'id' => 'remotesubscribe'),
                        _('Subscribe'));
     }
 
     function show_unsubscribe_form($profile)
     {
-        common_element_start('form', array('id' => 'unsubscribe', 'method' => 'post',
+        $this->elementStart('form', array('id' => 'unsubscribe', 'method' => 'post',
                                            'action' => common_local_url('unsubscribe')));
-        common_hidden('token', common_session_token());
-        common_element('input', array('id' => 'unsubscribeto',
+        $this->hidden('token', common_session_token());
+        $this->element('input', array('id' => 'unsubscribeto',
                                       'name' => 'unsubscribeto',
                                       'type' => 'hidden',
                                       'value' => $profile->nickname));
-        common_element('input', array('type' => 'submit',
+        $this->element('input', array('type' => 'submit',
                                       'class' => 'submit',
                                       'value' => _('Unsubscribe')));
-        common_element_end('form');
+        $this->elementEnd('form');
     }
 
     function show_subscriptions($profile)
@@ -293,13 +293,13 @@ class ShowstreamAction extends StreamAction
 
         $subs_count = $subs->find();
 
-        common_element_start('div', array('id' => 'subscriptions'));
+        $this->elementStart('div', array('id' => 'subscriptions'));
 
-        common_element('h2', null, _('Subscriptions'));
+        $this->element('h2', null, _('Subscriptions'));
 
         if ($subs_count > 0) {
 
-            common_element_start('ul', array('id' => 'subscriptions_avatars'));
+            $this->elementStart('ul', array('id' => 'subscriptions_avatars'));
 
             for ($i = 0; $i < min($subs_count, SUBSCRIPTIONS); $i++) {
 
@@ -315,39 +315,39 @@ class ShowstreamAction extends StreamAction
                     continue;
                 }
 
-                common_element_start('li', 'vcard');
-                common_element_start('a', array('title' => ($other->fullname) ?
+                $this->elementStart('li', 'vcard');
+                $this->elementStart('a', array('title' => ($other->fullname) ?
                                                 $other->fullname :
                                                 $other->nickname,
                                                 'href' => $other->profileurl,
                                                 'rel' => 'contact',
                                                  'class' => 'subscription fn url'));
                 $avatar = $other->getAvatar(AVATAR_MINI_SIZE);
-                common_element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) :  common_default_avatar(AVATAR_MINI_SIZE)),
+                $this->element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) :  common_default_avatar(AVATAR_MINI_SIZE)),
                                             'width' => AVATAR_MINI_SIZE,
                                             'height' => AVATAR_MINI_SIZE,
                                             'class' => 'avatar mini photo',
                                             'alt' =>  ($other->fullname) ?
                                             $other->fullname :
                                             $other->nickname));
-                common_element_end('a');
-                common_element_end('li');
+                $this->elementEnd('a');
+                $this->elementEnd('li');
             }
 
-            common_element_end('ul');
+            $this->elementEnd('ul');
         }
 
         if ($subs_count > SUBSCRIPTIONS) {
-            common_element_start('p', array('id' => 'subscriptions_viewall'));
+            $this->elementStart('p', array('id' => 'subscriptions_viewall'));
 
-            common_element('a', array('href' => common_local_url('subscriptions',
+            $this->element('a', array('href' => common_local_url('subscriptions',
                                                                  array('nickname' => $profile->nickname)),
                                       'class' => 'moresubscriptions'),
                            _('All subscriptions'));
-            common_element_end('p');
+            $this->elementEnd('p');
         }
 
-        common_element_end('div');
+        $this->elementEnd('div');
     }
 
     function show_statistics($profile)
@@ -366,49 +366,49 @@ class ShowstreamAction extends StreamAction
         $notices->profile_id = $profile->id;
         $notice_count = (int) $notices->count();
 
-        common_element_start('div', 'statistics');
-        common_element('h2', 'statistics', _('Statistics'));
+        $this->elementStart('div', 'statistics');
+        $this->element('h2', 'statistics', _('Statistics'));
 
         # Other stats...?
-        common_element_start('dl', 'statistics');
-        common_element('dt', 'membersince', _('Member since'));
-        common_element('dd', 'membersince', date('j M Y',
+        $this->elementStart('dl', 'statistics');
+        $this->element('dt', 'membersince', _('Member since'));
+        $this->element('dd', 'membersince', date('j M Y',
                                                  strtotime($profile->created)));
 
-        common_element_start('dt', 'subscriptions');
-        common_element('a', array('href' => common_local_url('subscriptions',
+        $this->elementStart('dt', 'subscriptions');
+        $this->element('a', array('href' => common_local_url('subscriptions',
                                                              array('nickname' => $profile->nickname))),
                        _('Subscriptions'));
-        common_element_end('dt');
-        common_element('dd', 'subscriptions', (is_int($subs_count)) ? $subs_count : '0');
-        common_element_start('dt', 'subscribers');
-        common_element('a', array('href' => common_local_url('subscribers',
+        $this->elementEnd('dt');
+        $this->element('dd', 'subscriptions', (is_int($subs_count)) ? $subs_count : '0');
+        $this->elementStart('dt', 'subscribers');
+        $this->element('a', array('href' => common_local_url('subscribers',
                                                              array('nickname' => $profile->nickname))),
                        _('Subscribers'));
-        common_element_end('dt');
-        common_element('dd', 'subscribers', (is_int($subbed_count)) ? $subbed_count : '0');
-        common_element('dt', 'notices', _('Notices'));
-        common_element('dd', 'notices', (is_int($notice_count)) ? $notice_count : '0');
+        $this->elementEnd('dt');
+        $this->element('dd', 'subscribers', (is_int($subbed_count)) ? $subbed_count : '0');
+        $this->element('dt', 'notices', _('Notices'));
+        $this->element('dd', 'notices', (is_int($notice_count)) ? $notice_count : '0');
         # XXX: link these to something
-        common_element('dt', 'tags', _('Tags'));
-        common_element_start('dd', 'tags');
+        $this->element('dt', 'tags', _('Tags'));
+        $this->elementStart('dd', 'tags');
         $tags = Profile_tag::getTags($profile->id, $profile->id);
 
-        common_element_start('ul', 'tags xoxo');
+        $this->elementStart('ul', 'tags xoxo');
         foreach ($tags as $tag) {
-            common_element_start('li');
-            common_element('a', array('rel' => 'bookmark tag',
+            $this->elementStart('li');
+            $this->element('a', array('rel' => 'bookmark tag',
                                       'href' => common_local_url('peopletag',
                                                                  array('tag' => $tag))),
                            $tag);
-            common_element_end('li');
+            $this->elementEnd('li');
         }
-        common_element_end('ul');
-        common_element_end('dd');
+        $this->elementEnd('ul');
+        $this->elementEnd('dd');
 
-        common_element_end('dl');
+        $this->elementEnd('dl');
 
-        common_element_end('div');
+        $this->elementEnd('div');
     }
 
     function show_notices($user)
@@ -428,22 +428,22 @@ class ShowstreamAction extends StreamAction
     function show_last_notice($profile)
     {
 
-        common_element('h2', null, _('Currently'));
+        $this->element('h2', null, _('Currently'));
 
         $notice = $profile->getCurrentNotice();
 
         if ($notice) {
             # FIXME: URL, image, video, audio
-            common_element_start('p', array('class' => 'notice_current'));
+            $this->elementStart('p', array('class' => 'notice_current'));
             if ($notice->rendered) {
-                common_raw($notice->rendered);
+                $this->raw($notice->rendered);
             } else {
                 # XXX: may be some uncooked notices in the DB,
                 # we cook them right now. This can probably disappear in future
                 # versions (>> 0.4.x)
-                common_raw(common_render_content($notice->content, $notice));
+                $this->raw(common_render_content($notice->content, $notice));
             }
-            common_element_end('p');
+            $this->elementEnd('p');
         }
     }
 }
index fad71135ccecb1610159c697103246a9dc778d61..f89cbe1ab9dda11bec07ced6f3203ed27e28a2a3 100644 (file)
@@ -1,9 +1,12 @@
 <?php
-/*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+/**
+ * Laconica, the distributed open-source microblogging tool
  *
- * This program is free software: you can redistribute it and/or modify
+ * Settings for SMS
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Settings
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+    exit(1);
+}
 
-require_once(INSTALLDIR.'/lib/settingsaction.php');
-require_once(INSTALLDIR.'/actions/emailsettings.php');
+require_once INSTALLDIR.'/lib/connectsettingsaction.php';
+
+/**
+ * Settings for SMS
+ *
+ * @category Settings
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      SettingsAction
+ */
 
-class SmssettingsAction extends EmailsettingsAction
+class SmssettingsAction extends ConnectSettingsAction
 {
+    /**
+     * Title of the page
+     *
+     * @return string Title of the page
+     */
 
-    function get_instructions()
+    function title()
+    {
+        return _('SMS Settings');
+    }
+
+    /**
+     * Instructions for use
+     *
+     * @return instructions for use
+     */
+
+    function getInstructions()
     {
         return _('You can receive SMS messages through email from %%site.name%%.');
     }
 
-    function show_form($msg=null, $success=false)
+    /**
+     * Content area of the page
+     *
+     * Shows a form for adding and removing SMS phone numbers and setting
+     * SMS preferences.
+     *
+     * @return void
+     */
+
+    function showContent()
     {
         $user = common_current_user();
-        $this->form_header(_('SMS Settings'), $msg, $success);
-        common_element_start('form', array('method' => 'post',
-                                           'id' => 'smssettings',
-                                           'action' =>
-                                           common_local_url('smssettings')));
-        common_hidden('token', common_session_token());
-        common_element('h2', null, _('Address'));
+
+        $this->elementStart('form', array('method' => 'post',
+                                          'id' => 'form_settings_sms',
+                                          'class' => 'form_settings',
+                                          'action' =>
+                                          common_local_url('smssettings')));
+
+        $this->elementStart('fieldset', array('id' => 'settings_sms_address'));
+        $this->element('legend', null, _('Address'));
+        $this->hidden('token', common_session_token());
 
         if ($user->sms) {
-            common_element_start('p');
             $carrier = $user->getCarrier();
-            common_element('span', 'address confirmed', $user->sms . ' (' . $carrier->name . ')');
-            common_element('span', 'input_instructions',
+            $this->element('p', 'form_confirmed',
+                           $user->sms . ' (' . $carrier->name . ')');
+            $this->element('p', 'form_guide',
                            _('Current confirmed SMS-enabled phone number.'));
-            common_hidden('sms', $user->sms);
-            common_hidden('carrier', $user->carrier);
-            common_element_end('p');
-            common_submit('remove', _('Remove'));
+            $this->hidden('sms', $user->sms);
+            $this->hidden('carrier', $user->carrier);
+            $this->submit('remove', _('Remove'));
         } else {
-            $confirm = $this->get_confirmation();
+            $confirm = $this->getConfirmation();
             if ($confirm) {
                 $carrier = Sms_carrier::staticGet($confirm->address_extra);
-                common_element_start('p');
-                common_element('span', 'address unconfirmed', $confirm->address . ' (' . $carrier->name . ')');
-                common_element('span', 'input_instructions',
+                $this->element('p', 'form_unconfirmed',
+                               $confirm->address . ' (' . $carrier->name . ')');
+                $this->element('p', 'form_guide',
                                _('Awaiting confirmation on this phone number.'));
-                common_hidden('sms', $confirm->address);
-                common_hidden('carrier', $confirm->address_extra);
-                common_element_end('p');
-                common_submit('cancel', _('Cancel'));
-                common_input('code', _('Confirmation code'), null,
+                $this->hidden('sms', $confirm->address);
+                $this->hidden('carrier', $confirm->address_extra);
+                $this->submit('cancel', _('Cancel'));
+
+                $this->elementStart('ul', 'form_data');
+                $this->elementStart('li');
+                $this->input('code', _('Confirmation code'), null,
                              _('Enter the code you received on your phone.'));
-                common_submit('confirm', _('Confirm'));
+                $this->elementEnd('li');
+                $this->elementEnd('ul');
+                $this->submit('confirm', _('Confirm'));
             } else {
-                common_input('sms', _('SMS Phone number'),
+                $this->elementStart('ul', 'form_data');
+                $this->elementStart('li');
+                $this->input('sms', _('SMS Phone number'),
                              ($this->arg('sms')) ? $this->arg('sms') : null,
-                             _('Phone number, no punctuation or spaces, with area code'));
-                $this->carrier_select();
-                common_submit('add', _('Add'));
+                             _('Phone number, no punctuation or spaces, '.
+                               'with area code'));
+                $this->elementEnd('li');
+                $this->elementEnd('ul');
+                $this->carrierSelect();
+                $this->submit('add', _('Add'));
             }
         }
+        $this->elementEnd('fieldset');
 
         if ($user->sms) {
-            common_element('h2', null, _('Incoming email'));
-            
+        $this->elementStart('fieldset', array('id' => 'settings_sms_incoming_email'));
+            $this->element('legend', null, _('Incoming email'));
+
             if ($user->incomingemail) {
-                common_element_start('p');
-                common_element('span', 'address', $user->incomingemail);
-                common_element('span', 'input_instructions',
+                $this->element('p', 'form_unconfirmed', $user->incomingemail);
+                $this->element('p', 'form_note',
                                _('Send email to this address to post new notices.'));
-                common_element_end('p');
-                common_submit('removeincoming', _('Remove'));
+                $this->submit('removeincoming', _('Remove'));
             }
-            
-            common_element_start('p');
-            common_element('span', 'input_instructions',
-                           _('Make a new email address for posting to; cancels the old one.'));
-            common_element_end('p');
-            common_submit('newincoming', _('New'));
+
+            $this->element('p', 'form_guide',
+                           _('Make a new email address for posting to; '.
+                             'cancels the old one.'));
+            $this->submit('newincoming', _('New'));
+            $this->elementEnd('fieldset');
         }
-        
-        common_element('h2', null, _('Preferences'));
-        
-        common_checkbox('smsnotify',
-                        _('Send me notices through SMS; I understand I may incur exorbitant charges from my carrier.'),
+
+        $this->elementStart('fieldset', array('id' => 'settings_sms_preferences'));
+        $this->element('legend', null, _('Preferences'));
+
+        $this->elementStart('ul', 'form_data');
+        $this->elementStart('li');
+        $this->checkbox('smsnotify',
+                        _('Send me notices through SMS; '.
+                          'I understand I may incur '.
+                          'exorbitant charges from my carrier.'),
                         $user->smsnotify);
-            
-        common_submit('save', _('Save'));
-        
-        common_element_end('form');
-        common_show_footer();
+        $this->elementEnd('li');
+        $this->elementEnd('ul');
+
+        $this->submit('save', _('Save'));
+
+        $this->elementEnd('fieldset');
+        $this->elementEnd('form');
     }
 
-    function get_confirmation()
+    /**
+     * Get a pending confirmation, if any, for this user
+     *
+     * @return void
+     *
+     * @todo very similar to EmailsettingsAction::getConfirmation(); refactor?
+     */
+
+    function getConfirmation()
     {
         $user = common_current_user();
+
         $confirm = new Confirm_address();
-        $confirm->user_id = $user->id;
+
+        $confirm->user_id      = $user->id;
         $confirm->address_type = 'sms';
+
         if ($confirm->find(true)) {
             return $confirm;
         } else {
@@ -119,44 +196,62 @@ class SmssettingsAction extends EmailsettingsAction
         }
     }
 
-    function handle_post()
+    /**
+     * Handle posts to this form
+     *
+     * Based on the button that was pressed, muxes out to other functions
+     * to do the actual task requested.
+     *
+     * All sub-functions reload the form with a message -- success or failure.
+     *
+     * @return void
+     */
+
+    function handlePost()
     {
-
-        # CSRF protection
+        // CSRF protection
 
         $token = $this->trimmed('token');
         if (!$token || $token != common_session_token()) {
-            $this->show_form(_('There was a problem with your session token. Try again, please.'));
+            $this->showForm(_('There was a problem with your session token. '.
+                              'Try again, please.'));
             return;
         }
 
         if ($this->arg('save')) {
-            $this->save_preferences();
+            $this->savePreferences();
         } else if ($this->arg('add')) {
-            $this->add_address();
+            $this->addAddress();
         } else if ($this->arg('cancel')) {
-            $this->cancel_confirmation();
+            $this->cancelConfirmation();
         } else if ($this->arg('remove')) {
-            $this->remove_address();
+            $this->removeAddress();
         } else if ($this->arg('removeincoming')) {
-            $this->remove_incoming();
+            $this->removeIncoming();
         } else if ($this->arg('newincoming')) {
-            $this->new_incoming();
+            $this->newIncoming();
         } else if ($this->arg('confirm')) {
-            $this->confirm_code();
+            $this->confirmCode();
         } else {
-            $this->show_form(_('Unexpected form submission.'));
+            $this->showForm(_('Unexpected form submission.'));
         }
     }
 
-    function save_preferences()
-    {
+    /**
+     * Handle a request to save preferences
+     *
+     * Sets the user's SMS preferences in the DB.
+     *
+     * @return void
+     */
 
+    function savePreferences()
+    {
         $smsnotify = $this->boolean('smsnotify');
-        
+
         $user = common_current_user();
 
-        assert(!is_null($user)); # should already be checked
+        assert(!is_null($user)); // should already be checked
 
         $user->query('BEGIN');
 
@@ -168,85 +263,103 @@ class SmssettingsAction extends EmailsettingsAction
 
         if ($result === false) {
             common_log_db_error($user, 'UPDATE', __FILE__);
-            common_server_error(_('Couldn\'t update user.'));
+            $this->serverError(_('Couldn\'t update user.'));
             return;
         }
 
         $user->query('COMMIT');
 
-        $this->show_form(_('Preferences saved.'), true);
+        $this->showForm(_('Preferences saved.'), true);
     }
 
-    function add_address()
-    {
+    /**
+     * Add a new SMS number for confirmation
+     *
+     * When the user requests a new SMS number, sends a confirmation
+     * message.
+     *
+     * @return void
+     */
 
+    function addAddress()
+    {
         $user = common_current_user();
 
-        $sms = $this->trimmed('sms');
+        $sms        = $this->trimmed('sms');
         $carrier_id = $this->trimmed('carrier');
-        
-        # Some validation
+
+        // Some validation
 
         if (!$sms) {
-            $this->show_form(_('No phone number.'));
+            $this->showForm(_('No phone number.'));
             return;
         }
 
         if (!$carrier_id) {
-            $this->show_form(_('No carrier selected.'));
+            $this->showForm(_('No carrier selected.'));
             return;
         }
-        
+
         $sms = common_canonical_sms($sms);
-        
+
         if ($user->sms == $sms) {
-            $this->show_form(_('That is already your phone number.'));
+            $this->showForm(_('That is already your phone number.'));
             return;
-        } else if ($this->sms_exists($sms)) {
-            $this->show_form(_('That phone number already belongs to another user.'));
+        } else if ($this->smsExists($sms)) {
+            $this->showForm(_('That phone number already belongs to another user.'));
             return;
         }
 
-          $confirm = new Confirm_address();
-           $confirm->address = $sms;
-           $confirm->address_extra = $carrier_id;
-           $confirm->address_type = 'sms';
-           $confirm->user_id = $user->id;
-           $confirm->code = common_confirmation_code(40);
+        $confirm = new Confirm_address();
+
+        $confirm->address       = $sms;
+        $confirm->address_extra = $carrier_id;
+        $confirm->address_type  = 'sms';
+        $confirm->user_id       = $user->id;
+        $confirm->code          = common_confirmation_code(40);
 
         $result = $confirm->insert();
 
         if ($result === false) {
             common_log_db_error($confirm, 'INSERT', __FILE__);
-            common_server_error(_('Couldn\'t insert confirmation code.'));
+            $this->serverError(_('Couldn\'t insert confirmation code.'));
             return;
         }
 
         $carrier = Sms_carrier::staticGet($carrier_id);
-        
+
         mail_confirm_sms($confirm->code,
                          $user->nickname,
                          $carrier->toEmailAddress($sms));
 
-        $msg = _('A confirmation code was sent to the phone number you added. Check your inbox (and spam box!) for the code and instructions on how to use it.');
+        $msg = _('A confirmation code was sent to the phone number you added. '.
+                 'Check your phone for the code and instructions '.
+                 'on how to use it.');
 
-        $this->show_form($msg, true);
+        $this->showForm($msg, true);
     }
 
-    function cancel_confirmation()
+    /**
+     * Cancel a pending confirmation
+     *
+     * Cancels the confirmation.
+     *
+     * @return void
+     */
+
+    function cancelConfirmation()
     {
-        
-        $sms = $this->trimmed('sms');
+        $sms     = $this->trimmed('sms');
         $carrier = $this->trimmed('carrier');
-        
-        $confirm = $this->get_confirmation();
-        
+
+        $confirm = $this->getConfirmation();
+
         if (!$confirm) {
-            $this->show_form(_('No pending confirmation to cancel.'));
+            $this->showForm(_('No pending confirmation to cancel.'));
             return;
         }
         if ($confirm->address != $sms) {
-            $this->show_form(_('That is the wrong confirmation number.'));
+            $this->showForm(_('That is the wrong confirmation number.'));
             return;
         }
 
@@ -254,47 +367,68 @@ class SmssettingsAction extends EmailsettingsAction
 
         if (!$result) {
             common_log_db_error($confirm, 'DELETE', __FILE__);
-            $this->server_error(_('Couldn\'t delete email confirmation.'));
+            $this->serverError(_('Couldn\'t delete email confirmation.'));
             return;
         }
 
-        $this->show_form(_('Confirmation cancelled.'), true);
+        $this->showForm(_('Confirmation cancelled.'), true);
     }
 
-    function remove_address()
-    {
+    /**
+     * Remove a phone number from the user's account
+     *
+     * @return void
+     */
 
+    function removeAddress()
+    {
         $user = common_current_user();
-        $sms = $this->arg('sms');
+
+        $sms     = $this->arg('sms');
         $carrier = $this->arg('carrier');
-        
-        # Maybe an old tab open...?
+
+        // Maybe an old tab open...?
 
         if ($user->sms != $sms) {
-            $this->show_form(_('That is not your phone number.'));
+            $this->showForm(_('That is not your phone number.'));
             return;
         }
 
         $user->query('BEGIN');
+
         $original = clone($user);
-        $user->sms = null;
-        $user->carrier = null;        
-        $user->smsemail = null;        
+
+        $user->sms      = null;
+        $user->carrier  = null;
+        $user->smsemail = null;
+
         $result = $user->updateKeys($original);
         if (!$result) {
             common_log_db_error($user, 'UPDATE', __FILE__);
-            common_server_error(_('Couldn\'t update user.'));
+            $this->serverError(_('Couldn\'t update user.'));
             return;
         }
         $user->query('COMMIT');
 
-        $this->show_form(_('The address was removed.'), true);
+        $this->showForm(_('The address was removed.'), true);
     }
-    
-    function sms_exists($sms)
+
+    /**
+     * Does this sms number exist in our database?
+     *
+     * Also checks if it belongs to someone else
+     *
+     * @param string $sms phone number to check
+     *
+     * @return boolean does the number exist
+     */
+
+    function smsExists($sms)
     {
         $user = common_current_user();
+
         $other = User::staticGet('sms', $sms);
+
         if (!$other) {
             return false;
         } else {
@@ -302,42 +436,58 @@ class SmssettingsAction extends EmailsettingsAction
         }
     }
 
-    function carrier_select()
+    /**
+     * Show a drop-down box with all the SMS carriers in the DB
+     *
+     * @return void
+     */
+
+    function carrierSelect()
     {
         $carrier = new Sms_carrier();
+
         $cnt = $carrier->find();
 
-        common_element_start('p');
-        common_element('label', array('for' => 'carrier'));
-        common_element_start('select', array('name' => 'carrier',
-                                             'id' => 'carrier'));
-        common_element('option', array('value' => 0),
+        $this->elementStart('ul', 'form_data');
+        $this->elementStart('li');
+        $this->element('label', array('for' => 'carrier'), _('Mobile carrier'));
+        $this->elementStart('select', array('name' => 'carrier',
+                                            'id' => 'carrier'));
+        $this->element('option', array('value' => 0),
                        _('Select a carrier'));
         while ($carrier->fetch()) {
-            common_element('option', array('value' => $carrier->id),
+            $this->element('option', array('value' => $carrier->id),
                            $carrier->name);
         }
-        common_element_end('select');
-        common_element_end('p');
-        common_element('span', 'input_instructions',
+        $this->elementEnd('select');
+        $this->element('p', 'form_guide',
                        sprintf(_('Mobile carrier for your phone. '.
-                                 'If you know a carrier that accepts ' . 
+                                 'If you know a carrier that accepts ' .
                                  'SMS over email but isn\'t listed here, ' .
                                  'send email to let us know at %s.'),
                                common_config('site', 'email')));
+        $this->elementEnd('li');
+        $this->elementEnd('ul');
     }
 
-    function confirm_code()
+    /**
+     * Confirm an SMS confirmation code
+     *
+     * Redirects to the confirmaddress page for this code
+     *
+     * @return void
+     */
+
+    function confirmCode()
     {
-        
         $code = $this->trimmed('code');
-        
+
         if (!$code) {
-            $this->show_form(_('No code entered'));
+            $this->showForm(_('No code entered'));
             return;
         }
-        
-        common_redirect(common_local_url('confirmaddress', 
+
+        common_redirect(common_local_url('confirmaddress',
                                          array('code' => $code)));
     }
 }
index 1142b7a0323d10aafacdbf62e8558a34da32c1fb..e22384869b2da242cfa1dae725ba435545563c33 100644 (file)
@@ -30,28 +30,28 @@ class SubeditAction extends Action
         parent::prepare($args);
 
         if (!common_logged_in()) {
-            $this->client_error(_('Not logged in.'));
+            $this->clientError(_('Not logged in.'));
             return false;
         }
 
         $token = $this->trimmed('token');
 
         if (!$token || $token != common_session_token()) {
-            $this->client_error(_('There was a problem with your session token. Try again, please.'));
+            $this->clientError(_('There was a problem with your session token. Try again, please.'));
             return;
         }
 
         $id = $this->trimmed('profile');
 
         if (!$id) {
-            $this->client_error(_('No profile specified.'));
+            $this->clientError(_('No profile specified.'));
             return false;
         }
 
         $this->profile = Profile::staticGet('id', $id);
 
         if (!$this->profile) {
-            $this->client_error(_('No profile with that ID.'));
+            $this->clientError(_('No profile with that ID.'));
             return false;
         }
 
@@ -68,7 +68,7 @@ class SubeditAction extends Action
                                                'subscribed' => $this->profile->id));
 
             if (!$sub) {
-                $this->client_error(_('You are not subscribed to that profile.'));
+                $this->clientError(_('You are not subscribed to that profile.'));
                 return false;
             }
 
@@ -81,7 +81,7 @@ class SubeditAction extends Action
 
             if (!$result) {
                 common_log_db_error($sub, 'UPDATE', __FILE__);
-                $this->server_error(_('Could not save subscription.'));
+                $this->serverError(_('Could not save subscription.'));
                 return false;
             }
 
index f33d1d2077b6010fde138502709b30ae3ddf0a14..b6f03f0f133c70ae2beba9384ab793680c9c4699 100644 (file)
@@ -27,7 +27,7 @@ class SubscribeAction extends Action
         parent::handle($args);
 
         if (!common_logged_in()) {
-            common_user_error(_('Not logged in.'));
+            $this->clientError(_('Not logged in.'));
             return;
         }
 
@@ -43,7 +43,7 @@ class SubscribeAction extends Action
         $token = $this->trimmed('token');
 
         if (!$token || $token != common_session_token()) {
-            $this->client_error(_('There was a problem with your session token. Try again, please.'));
+            $this->clientError(_('There was a problem with your session token. Try again, please.'));
             return;
         }
 
@@ -52,26 +52,26 @@ class SubscribeAction extends Action
         $other = User::staticGet('id', $other_id);
 
         if (!$other) {
-            $this->client_error(_('Not a local user.'));
+            $this->clientError(_('Not a local user.'));
             return;
         }
 
         $result = subs_subscribe_to($user, $other);
 
         if($result != true) {
-            common_user_error($result);
+            $this->clientError($result);
             return;
         }
 
         if ($this->boolean('ajax')) {
             common_start_html('text/xml;charset=utf-8', true);
-            common_element_start('head');
-            common_element('title', null, _('Subscribed'));
-            common_element_end('head');
-            common_element_start('body');
+            $this->elementStart('head');
+            $this->element('title', null, _('Subscribed'));
+            $this->elementEnd('head');
+            $this->elementStart('body');
             common_unsubscribe_form($other->getProfile());
-            common_element_end('body');
-            common_element_end('html');
+            $this->elementEnd('body');
+            $this->elementEnd('html');
         } else {
             common_redirect(common_local_url('subscriptions', array('nickname' =>
                                                                 $user->nickname)));
index afe8fb26095e4a01d4b2fa38cd36f185958e72c3..7a87a144f7640ef8b8a8a5870bb6d0c125e2fa77 100644 (file)
@@ -72,16 +72,16 @@ class SubscriptionsList extends ProfileList
             return;
         }
 
-        common_element_start('form', array('id' => 'subedit-' . $profile->id,
+        $this->elementStart('form', array('id' => 'subedit-' . $profile->id,
                                            'method' => 'post',
                                            'class' => 'subedit',
                                            'action' => common_local_url('subedit')));
-        common_hidden('token', common_session_token());
-        common_hidden('profile', $profile->id);
-        common_checkbox('jabber', _('Jabber'), $sub->jabber);
-        common_checkbox('sms', _('SMS'), $sub->sms);
-        common_submit('save', _('Save'));
-        common_element_end('form');
+        $this->hidden('token', common_session_token());
+        $this->hidden('profile', $profile->id);
+        $this->checkbox('jabber', _('Jabber'), $sub->jabber);
+        $this->checkbox('sms', _('SMS'), $sub->sms);
+        $this->submit('save', _('Save'));
+        $this->elementEnd('form');
         return;
     }
 }
index 6a1897585acd959b968873a36bbc9cf5f35eefb3..38e2e2e59ceb85985e5a61cd4eec79fcdec9826d 100644 (file)
@@ -79,7 +79,7 @@ class SupAction extends Action
         return $updates;
     }
     
-    function is_readonly()
+    function isReadOnly()
     {
         return true;
     }
index 8a3f90c16a3a0f14dce52ae1dfb46f36ff95164f..3096b75b395b281115c8a9578f843cddb5db85f9 100644 (file)
@@ -51,7 +51,7 @@ class TagAction extends StreamAction
     function show_header($tag = false)
     {
         if ($tag) {
-            common_element('link', array('rel' => 'alternate',
+            $this->element('link', array('rel' => 'alternate',
                                          'href' => common_local_url('tagrss', array('tag' => $tag)),
                                          'type' => 'application/rss+xml',
                                          'title' => sprintf(_('Feed for tag %s'), $tag)));
@@ -68,9 +68,9 @@ class TagAction extends StreamAction
         if (!$tag) {
             $instr = $this->get_instructions();
             $output = common_markup_to_html($instr);
-            common_element_start('div', 'instructions');
-            common_raw($output);
-            common_element_end('div');
+            $this->elementStart('div', 'instructions');
+            $this->raw($output);
+            $this->elementEnd('div');
             $this->public_views_menu();
         }
         else {
@@ -110,7 +110,7 @@ class TagAction extends StreamAction
         $cnt = $tags->find();
 
         if ($cnt > 0) {
-            common_element_start('p', 'tagcloud');
+            $this->elementStart('p', 'tagcloud');
 
             $tw = array();
             $sum = 0;
@@ -125,7 +125,7 @@ class TagAction extends StreamAction
                 $this->show_tag($tag, $weight, $weight/$sum);
             }
 
-            common_element_end('p');
+            $this->elementEnd('p');
         }
     }
 
@@ -149,10 +149,10 @@ class TagAction extends StreamAction
             $cls = 'smallest';
         }
 
-        common_element('a', array('class' => "$cls weight-$weight relative-$relative",
+        $this->element('a', array('class' => "$cls weight-$weight relative-$relative",
                                   'href' => common_local_url('tag', array('tag' => $tag))),
                        $tag);
-        common_text(' ');
+        $this->text(' ');
     }
 
     function show_notices($tag)
index ff6788cc620c0c28146e20583ee9ce7cbfc322cc..e60eb8b584342aaadc77d381291f0d71a14f0d93 100644 (file)
@@ -30,7 +30,7 @@ class TagotherAction extends Action
         parent::handle($args);
 
         if (!common_logged_in()) {
-            $this->client_error(_('Not logged in'), 403);
+            $this->clientError(_('Not logged in'), 403);
             return;
         }
 
@@ -39,12 +39,12 @@ class TagotherAction extends Action
         } else {
             $id = $this->trimmed('id');
             if (!$id) {
-                $this->client_error(_('No id argument.'));
+                $this->clientError(_('No id argument.'));
                 return;
             }
             $profile = Profile::staticGet('id', $id);
             if (!$profile) {
-                $this->client_error(_('No profile with that ID.'));
+                $this->clientError(_('No profile with that ID.'));
                 return;
             }
             $this->show_form($profile);
@@ -61,7 +61,7 @@ class TagotherAction extends Action
 
         $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
 
-        common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE),
+        $this->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE),
                                     'class' => 'avatar stream',
                                     'width' => AVATAR_PROFILE_SIZE,
                                     'height' => AVATAR_PROFILE_SIZE,
@@ -69,39 +69,39 @@ class TagotherAction extends Action
                                     ($profile->fullname) ? $profile->fullname :
                                     $profile->nickname));
 
-        common_element('a', array('href' => $profile->profileurl,
+        $this->element('a', array('href' => $profile->profileurl,
                                   'class' => 'external profile nickname'),
                        $profile->nickname);
 
         if ($profile->fullname) {
-            common_element_start('div', 'fullname');
+            $this->elementStart('div', 'fullname');
             if ($profile->homepage) {
-                common_element('a', array('href' => $profile->homepage),
+                $this->element('a', array('href' => $profile->homepage),
                                $profile->fullname);
             } else {
-                common_text($profile->fullname);
+                $this->text($profile->fullname);
             }
-            common_element_end('div');
+            $this->elementEnd('div');
         }
         if ($profile->location) {
-            common_element('div', 'location', $profile->location);
+            $this->element('div', 'location', $profile->location);
         }
         if ($profile->bio) {
-            common_element('div', 'bio', $profile->bio);
+            $this->element('div', 'bio', $profile->bio);
         }
 
-        common_element_start('form', array('method' => 'post',
+        $this->elementStart('form', array('method' => 'post',
                                            'id' => 'tag_user',
                                            'name' => 'tagother',
-                                           'action' => $this->self_url()));
-        common_hidden('token', common_session_token());
-        common_hidden('id', $profile->id);
-        common_input('tags', _('Tags'),
+                                           'action' => $this->selfUrl()));
+        $this->hidden('token', common_session_token());
+        $this->hidden('id', $profile->id);
+        $this->input('tags', _('Tags'),
                      ($this->arg('tags')) ? $this->arg('tags') : implode(' ', Profile_tag::getTags($user->id, $profile->id)),
                      _('Tags for this user (letters, numbers, -, ., and _), comma- or space- separated'));
 
-        common_submit('save', _('Save'));
-        common_element_end('form');
+        $this->submit('save', _('Save'));
+        $this->elementEnd('form');
         common_show_footer();
 
     }
@@ -121,7 +121,7 @@ class TagotherAction extends Action
         $profile = Profile::staticGet('id', $id);
 
         if (!$profile) {
-            $this->client_error(_('No such profile.'));
+            $this->clientError(_('No such profile.'));
             return;
         }
 
@@ -147,14 +147,14 @@ class TagotherAction extends Action
             !Subscription::pkeyGet(array('subscriber' => $profile->id,
                                          'subscribed' => $user->id)))
         {
-            $this->client_error(_('You can only tag people you are subscribed to or who are subscribed to you.'));
+            $this->clientError(_('You can only tag people you are subscribed to or who are subscribed to you.'));
             return;
         }
 
         $result = Profile_tag::setTags($user->id, $profile->id, $tags);
 
         if (!$result) {
-            $this->client_error(_('Could not save tags.'));
+            $this->clientError(_('Could not save tags.'));
             return;
         }
 
@@ -162,20 +162,20 @@ class TagotherAction extends Action
 
         if ($this->boolean('ajax')) {
             common_start_html('text/xml');
-            common_element_start('head');
-            common_element('title', null, _('Tags'));
-            common_element_end('head');
-            common_element_start('body');
-            common_element_start('p', 'subtags');
+            $this->elementStart('head');
+            $this->element('title', null, _('Tags'));
+            $this->elementEnd('head');
+            $this->elementStart('body');
+            $this->elementStart('p', 'subtags');
             foreach ($tags as $tag) {
-                common_element('a', array('href' => common_local_url($action,
+                $this->element('a', array('href' => common_local_url($action,
                                                                      array('nickname' => $user->nickname,
                                                                            'tag' => $tag))),
                                $tag);
             }
-            common_element_end('p');
-            common_element_end('body');
-            common_element_end('html');
+            $this->elementEnd('p');
+            $this->elementEnd('body');
+            $this->elementEnd('html');
         } else {
             common_redirect(common_local_url($action, array('nickname' =>
                                                             $user->nickname)));
@@ -186,12 +186,12 @@ class TagotherAction extends Action
     {
         list($profile, $error) = $arr;
         if ($error) {
-            common_element('p', 'error', $error);
+            $this->element('p', 'error', $error);
         } else {
-            common_element_start('div', 'instructions');
-            common_element('p', null,
+            $this->elementStart('div', 'instructions');
+            $this->element('p', null,
                            _('Use this form to add tags to your subscribers or subscriptions.'));
-            common_element_end('div');
+            $this->elementEnd('div');
         }
     }
 }
index 912d71413d5d6df2b6359fef9a841a1a9542357b..b0227ab391aac76cb98824b9d59885c5a83421a4 100644 (file)
@@ -32,7 +32,7 @@ class TagrssAction extends Rss10Action
         $this->tag = Notice_tag::staticGet('tag', $tag);
 
         if (!$this->tag) {
-            common_user_error(_('No such tag.'));
+            $this->clientError(_('No such tag.'));
             return false;
         } else {
             return true;
index 79e1ed990d7ec9ddc063bff410ea278a9dd74e8d..e51a29a2d01af8580fad261e77c012a7c9419d7d 100644 (file)
@@ -29,7 +29,7 @@ class TwitapiaccountAction extends TwitterapiAction
         parent::handle($args);
 
         if (!in_array($apidata['content-type'], array('xml', 'json'))) {
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
             return;
         }
 
@@ -39,7 +39,7 @@ class TwitapiaccountAction extends TwitterapiAction
     function end_session($args, $apidata)
     {
         parent::handle($args);
-        common_server_error(_('API method under construction.'), $code=501);
+        $this->serverError(_('API method under construction.'), $code=501);
     }
 
     function update_location($args, $apidata)
@@ -47,7 +47,7 @@ class TwitapiaccountAction extends TwitterapiAction
         parent::handle($args);
 
         if ($_SERVER['REQUEST_METHOD'] != 'POST') {
-            $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
+            $this->clientError(_('This method requires a POST.'), 400, $apidata['content-type']);
             return;
         }
 
@@ -56,7 +56,7 @@ class TwitapiaccountAction extends TwitterapiAction
         if (!is_null($location) && strlen($location) > 255) {
 
             // XXX: But Twitter just truncates and runs with it. -- Zach
-            $this->client_error(_('That\'s too long. Max notice size is 255 chars.'), 406, $apidate['content-type']);
+            $this->clientError(_('That\'s too long. Max notice size is 255 chars.'), 406, $apidate['content-type']);
             return;
         }
 
@@ -64,7 +64,7 @@ class TwitapiaccountAction extends TwitterapiAction
         $profile = $user->getProfile();
 
         if (!$profile) {
-            common_server_error(_('User has no profile.'));
+            $this->serverError(_('User has no profile.'));
             return;
         }
 
@@ -75,7 +75,7 @@ class TwitapiaccountAction extends TwitterapiAction
 
         if (!$result) {
             common_log_db_error($profile, 'UPDATE', __FILE__);
-            common_server_error(_('Couldn\'t save profile.'));
+            $this->serverError(_('Couldn\'t save profile.'));
             return;
         }
 
@@ -91,12 +91,12 @@ class TwitapiaccountAction extends TwitterapiAction
     function update_delivery_device($args, $apidata)
     {
         parent::handle($args);
-        common_server_error(_('API method under construction.'), $code=501);
+        $this->serverError(_('API method under construction.'), $code=501);
     }
 
     function rate_limit_status($args, $apidata)
     {
         parent::handle($args);
-        common_server_error(_('API method under construction.'), $code=501);
+        $this->serverError(_('API method under construction.'), $code=501);
     }
 }
\ No newline at end of file
index 5d64f2f7d8b7d1fd8edceab4633d8ae4be5aeefc..8135adef3c2827ed17150082782f547339801b66 100644 (file)
@@ -32,7 +32,7 @@ class TwitapiblocksAction extends TwitterapiAction
         $blockee = $this->get_user($apidata['api_arg'], $apidata);
 
         if (!$blockee) {
-            $this->client_error('Not Found', 404, $apidata['content-type']);
+            $this->clientError('Not Found', 404, $apidata['content-type']);
             return;
         }
 
@@ -44,7 +44,7 @@ class TwitapiblocksAction extends TwitterapiAction
             $this->show_profile($blockee, $type);
             $this->end_document($type);
         } else {
-            common_server_error(_('Block user failed.'));
+            $this->serverError(_('Block user failed.'));
         }
     }
 
@@ -54,7 +54,7 @@ class TwitapiblocksAction extends TwitterapiAction
         $blockee = $this->get_user($apidata['api_arg'], $apidata);
 
         if (!$blockee) {
-            $this->client_error('Not Found', 404, $apidata['content-type']);
+            $this->clientError('Not Found', 404, $apidata['content-type']);
             return;
         }
 
@@ -66,7 +66,7 @@ class TwitapiblocksAction extends TwitterapiAction
             $this->show_profile($blockee, $type);
             $this->end_document($type);
         } else {
-            common_server_error(_('Unblock user failed.'));
+            $this->serverError(_('Unblock user failed.'));
         }
     }
 }
\ No newline at end of file
index e0731f66fbb7ed3e78b2670c7dd9071579bc6e45..db55e8cd0220de6a01c68763af20d7ad5f45cb49 100644 (file)
@@ -108,7 +108,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction
             $this->show_json_dmsgs($message);
             break;
          default:
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
         }
 
     }
@@ -119,7 +119,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction
         parent::handle($args);
 
         if ($_SERVER['REQUEST_METHOD'] != 'POST') {
-            $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
+            $this->clientError(_('This method requires a POST.'), 400, $apidata['content-type']);
             return;
         }
 
@@ -134,11 +134,11 @@ class Twitapidirect_messagesAction extends TwitterapiAction
         $content = $this->trimmed('text');
 
         if (!$content) {
-            $this->client_error(_('No message text!'), $code = 406, $apidata['content-type']);
+            $this->clientError(_('No message text!'), $code = 406, $apidata['content-type']);
         } else {
             $content_shortened = common_shorten_links($content);
             if (mb_strlen($content_shortened) > 140) {
-                $this->client_error(_('That\'s too long. Max message size is 140 chars.'),
+                $this->clientError(_('That\'s too long. Max message size is 140 chars.'),
                     $code = 406, $apidata['content-type']);
                 return;
             }
@@ -147,15 +147,15 @@ class Twitapidirect_messagesAction extends TwitterapiAction
         $other = $this->get_user($this->trimmed('user'));
 
         if (!$other) {
-            $this->client_error(_('Recipient user not found.'), $code = 403, $apidata['content-type']);
+            $this->clientError(_('Recipient user not found.'), $code = 403, $apidata['content-type']);
             return;
         } else if (!$user->mutuallySubscribed($other)) {
-            $this->client_error(_('Can\'t send direct messages to users who aren\'t your friend.'),
+            $this->clientError(_('Can\'t send direct messages to users who aren\'t your friend.'),
                 $code = 403, $apidata['content-type']);
             return;
         } else if ($user->id == $other->id) {
             // Sending msgs to yourself is allowed by Twitter
-            $this->client_error(_('Don\'t send a message to yourself; just say it to yourself quietly instead.'),
+            $this->clientError(_('Don\'t send a message to yourself; just say it to yourself quietly instead.'),
                 $code = 403, $apidata['content-type']);
             return;
         }
@@ -164,7 +164,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction
             html_entity_decode($content, ENT_NOQUOTES, 'UTF-8'), $source);
 
         if (is_string($message)) {
-            $this->server_error($message);
+            $this->serverError($message);
             return;
         }
 
@@ -181,14 +181,14 @@ class Twitapidirect_messagesAction extends TwitterapiAction
     function destroy($args, $apidata)
     {
         parent::handle($args);
-        common_server_error(_('API method under construction.'), $code=501);
+        $this->serverError(_('API method under construction.'), $code=501);
     }
 
     function show_xml_dmsgs($message)
     {
 
         $this->init_document('xml');
-        common_element_start('direct-messages', array('type' => 'array'));
+        $this->elementStart('direct-messages', array('type' => 'array'));
 
         if (is_array($messages)) {
             foreach ($message as $m) {
@@ -202,7 +202,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction
             }
         }
 
-        common_element_end('direct-messages');
+        $this->elementEnd('direct-messages');
         $this->end_document('xml');
 
     }
@@ -236,13 +236,13 @@ class Twitapidirect_messagesAction extends TwitterapiAction
 
         $this->init_document('rss');
 
-        common_element_start('channel');
-        common_element('title', null, $title);
+        $this->elementStart('channel');
+        $this->element('title', null, $title);
 
-        common_element('link', null, $link);
-        common_element('description', null, $subtitle);
-        common_element('language', null, 'en-us');
-        common_element('ttl', null, '40');
+        $this->element('link', null, $link);
+        $this->element('description', null, $subtitle);
+        $this->element('language', null, 'en-us');
+        $this->element('ttl', null, '40');
 
         if (is_array($message)) {
             foreach ($message as $m) {
@@ -256,7 +256,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction
             }
         }
 
-        common_element_end('channel');
+        $this->elementEnd('channel');
         $this->end_twitter_rss();
 
     }
@@ -266,12 +266,12 @@ class Twitapidirect_messagesAction extends TwitterapiAction
 
         $this->init_document('atom');
 
-        common_element('title', null, $title);
+        $this->element('title', null, $title);
         $siteserver = common_config('site', 'server');
-        common_element('id', null, "tag:$siteserver,2008:DirectMessage");
-        common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null);
-        common_element('updated', null, common_date_iso8601(strftime('%c')));
-        common_element('subtitle', null, $subtitle);
+        $this->element('id', null, "tag:$siteserver,2008:DirectMessage");
+        $this->element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null);
+        $this->element('updated', null, common_date_iso8601(strftime('%c')));
+        $this->element('subtitle', null, $subtitle);
 
         if (is_array($message)) {
             foreach ($message as $m) {
index 55e04732f526cc36a248b68e630b18e9d279338e..737b7229f0335a63bc6fa21d08c7895fca1435e7 100644 (file)
@@ -32,14 +32,14 @@ class TwitapifavoritesAction extends TwitterapiAction
         $user = $this->get_user($apidata['api_arg'], $apidata);
 
         if (!$user) {
-            $this->client_error('Not Found', 404, $apidata['content-type']);
+            $this->clientError('Not Found', 404, $apidata['content-type']);
             return;
         }
 
         $profile = $user->getProfile();
 
         if (!$profile) {
-            common_server_error(_('User has no profile.'));
+            $this->serverError(_('User has no profile.'));
             return;
         }
 
@@ -56,7 +56,7 @@ class TwitapifavoritesAction extends TwitterapiAction
         $notice = $user->favoriteNotices((($page-1)*20), $count);
 
         if (!$notice) {
-            common_server_error(_('Could not retrieve favorite notices.'));
+            $this->serverError(_('Could not retrieve favorite notices.'));
             return;
         }
 
@@ -82,7 +82,7 @@ class TwitapifavoritesAction extends TwitterapiAction
             $this->show_json_timeline($notice);
             break;
          default:
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
         }
 
     }
@@ -94,12 +94,12 @@ class TwitapifavoritesAction extends TwitterapiAction
         // Check for RESTfulness
         if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
             // XXX: Twitter just prints the err msg, no XML / JSON.
-            $this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
+            $this->clientError(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
             return;
         }
 
         if (!in_array($apidata['content-type'], array('xml', 'json'))) {
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
             return;
         }
 
@@ -109,20 +109,20 @@ class TwitapifavoritesAction extends TwitterapiAction
         $notice = Notice::staticGet($notice_id);
 
         if (!$notice) {
-            $this->client_error(_('No status found with that ID.'), 404, $apidata['content-type']);
+            $this->clientError(_('No status found with that ID.'), 404, $apidata['content-type']);
             return;
         }
 
         // XXX: Twitter lets you fave things repeatedly via api.
         if ($user->hasFave($notice)) {
-            $this->client_error(_('This notice is already a favorite!'), 403, $apidata['content-type']);
+            $this->clientError(_('This notice is already a favorite!'), 403, $apidata['content-type']);
             return;
         }
 
         $fave = Fave::addNew($user, $notice);
 
         if (!$fave) {
-            common_server_error(_('Could not create favorite.'));
+            $this->serverError(_('Could not create favorite.'));
             return;
         }
 
@@ -140,7 +140,7 @@ class TwitapifavoritesAction extends TwitterapiAction
     function destroy($args, $apidata)
     {
         parent::handle($args);
-        common_server_error(_('API method under construction.'), $code=501);
+        $this->serverError(_('API method under construction.'), $code=501);
     }
 
     // XXX: these two funcs swiped from faves.  Maybe put in util.php, or some common base class?
index ba4afe441ee6504ca7f9b7e3a8606355e1d15ac4..c50c5e84a9dcc948682e80d55c0a26641a726dd6 100644 (file)
@@ -29,7 +29,7 @@ class TwitapifriendshipsAction extends TwitterapiAction
         parent::handle($args);
 
         if ($_SERVER['REQUEST_METHOD'] != 'POST') {
-            $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
+            $this->clientError(_('This method requires a POST.'), 400, $apidata['content-type']);
             return;
         }
 
@@ -38,7 +38,7 @@ class TwitapifriendshipsAction extends TwitterapiAction
         $other = $this->get_user($id);
 
         if (!$other) {
-            $this->client_error(_('Could not follow user: User not found.'), 403, $apidata['content-type']);
+            $this->clientError(_('Could not follow user: User not found.'), 403, $apidata['content-type']);
             return;
         }
 
@@ -46,7 +46,7 @@ class TwitapifriendshipsAction extends TwitterapiAction
 
         if ($user->isSubscribed($other)) {
             $errmsg = sprintf(_('Could not follow user: %s is already on your list.'), $other->nickname);
-            $this->client_error($errmsg, 403, $apidata['content-type']);
+            $this->clientError($errmsg, 403, $apidata['content-type']);
             return;
         }
 
@@ -62,7 +62,7 @@ class TwitapifriendshipsAction extends TwitterapiAction
 
         if (!$result) {
             $errmsg = sprintf(_('Could not follow user: %s is already on your list.'), $other->nickname);
-            $this->client_error($errmsg, 400, $apidata['content-type']);
+            $this->clientError($errmsg, 400, $apidata['content-type']);
             return;
         }
 
@@ -82,7 +82,7 @@ class TwitapifriendshipsAction extends TwitterapiAction
         parent::handle($args);
 
         if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
-            $this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
+            $this->clientError(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
             return;
         }
 
@@ -102,7 +102,7 @@ class TwitapifriendshipsAction extends TwitterapiAction
             $sub->delete();
             $sub->query('COMMIT');
         } else {
-            $this->client_error(_('You are not friends with the specified user.'), 403, $apidata['content-type']);
+            $this->clientError(_('You are not friends with the specified user.'), 403, $apidata['content-type']);
             return;
         }
 
@@ -118,7 +118,7 @@ class TwitapifriendshipsAction extends TwitterapiAction
         parent::handle($args);
 
         if (!in_array($apidata['content-type'], array('xml', 'json'))) {
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
             return;
         }
 
@@ -129,7 +129,7 @@ class TwitapifriendshipsAction extends TwitterapiAction
         $user_b = $this->get_user($user_b_id);
 
         if (!$user_a || !$user_b) {
-            $this->client_error(_('Two user ids or screen_names must be supplied.'), 400, $apidata['content-type']);
+            $this->clientError(_('Two user ids or screen_names must be supplied.'), 400, $apidata['content-type']);
             return;
         }
 
@@ -142,7 +142,7 @@ class TwitapifriendshipsAction extends TwitterapiAction
         switch ($apidata['content-type']) {
          case 'xml':
             $this->init_document('xml');
-            common_element('friends', null, $result);
+            $this->element('friends', null, $result);
             $this->end_document('xml');
             break;
          case 'json':
index 1b84cb11bb744df042716ea1fada5e51002619b7..db5892baf2979a5c5f8a3802973082d969afa063 100644 (file)
@@ -34,14 +34,14 @@ class TwitapihelpAction extends TwitterapiAction
 
         if ($apidata['content-type'] == 'xml') {
             $this->init_document('xml');
-            common_element('ok', null, 'true');
+            $this->element('ok', null, 'true');
             $this->end_document('xml');
         } elseif ($apidata['content-type'] == 'json') {
             $this->init_document('json');
             print '"ok"';
             $this->end_document('json');
         } else {
-            common_user_error(_('API method not found!'), $code=404);
+            $this->clientError(_('API method not found!'), $code=404);
         }
 
     }
@@ -49,7 +49,7 @@ class TwitapihelpAction extends TwitterapiAction
     function downtime_schedule($args, $apidata)
     {
         parent::handle($args);
-        common_server_error(_('API method under construction.'), $code=501);
+        $this->serverError(_('API method under construction.'), $code=501);
     }
 
 }
\ No newline at end of file
index 722423faec6f6285067d4f5441d482ae5426dfd7..8cd7a64b9f40b27de55b9cff9beeb224b3f96134 100644 (file)
@@ -70,7 +70,7 @@ class TwitapilaconicaAction extends TwitterapiAction
         switch ($apidata['content-type']) {
          case 'xml':
             $this->init_document('xml');
-            common_element('version', null, LACONICA_VERSION);
+            $this->element('version', null, LACONICA_VERSION);
             $this->end_document('xml');
             break;
          case 'json':
@@ -79,7 +79,7 @@ class TwitapilaconicaAction extends TwitterapiAction
             $this->end_document('json');
             break;
          default:
-            $this->client_error(_('API method not found!'), $code=404);
+            $this->clientError(_('API method not found!'), $code=404);
         }
     }
 
@@ -115,10 +115,10 @@ class TwitapilaconicaAction extends TwitterapiAction
         switch ($apidata['content-type']) {
          case 'xml':
             $this->init_document('xml');
-            common_element_start('config');
+            $this->elementStart('config');
             // XXX: check that all sections and settings are legal XML elements
             foreach ($keys as $section => $settings) {
-                common_element_start($section);
+                $this->elementStart($section);
                 foreach ($settings as $setting) {
                     $value = common_config($section, $setting);
                     if (is_array($value)) {
@@ -128,11 +128,11 @@ class TwitapilaconicaAction extends TwitterapiAction
                     } else if ($value === true) {
                         $value = 'true';
                     }
-                    common_element($setting, null, $value);
+                    $this->element($setting, null, $value);
                 }
-                common_element_end($section);
+                $this->elementEnd($section);
             }
-            common_element_end('config');
+            $this->elementEnd('config');
             $this->end_document('xml');
             break;
          case 'json':
@@ -148,7 +148,7 @@ class TwitapilaconicaAction extends TwitterapiAction
             $this->end_document('json');
             break;
          default:
-            $this->client_error(_('API method not found!'), $code=404);
+            $this->clientError(_('API method not found!'), $code=404);
         }
     }
 
@@ -169,6 +169,6 @@ class TwitapilaconicaAction extends TwitterapiAction
     function wadl($args, $apidata)
     {
         parent::handle($args);
-        common_server_error(_('API method under construction.'), 501);
+        $this->serverError(_('API method under construction.'), 501);
     }
 }
index a19d652c3d71d7146a58e930c4c450543bdd995f..411971af16ab536f1016b5af9a7128931c342bf0 100644 (file)
@@ -28,13 +28,13 @@ class TwitapinotificationsAction extends TwitterapiAction
     function follow($args, $apidata)
     {
         parent::handle($args);
-        common_server_error(_('API method under construction.'), $code=501);
+        $this->serverError(_('API method under construction.'), $code=501);
     }
 
     function leave($args, $apidata)
     {
         parent::handle($args);
-        common_server_error(_('API method under construction.'), $code=501);
+        $this->serverError(_('API method under construction.'), $code=501);
     }
 
 }
\ No newline at end of file
index e629d5cc416d339df999fc9f66f2cd12a36a0db2..a35f4b12eaa4f1d3f25c4a41628e1bc1260a2c1d 100644 (file)
@@ -76,12 +76,12 @@ class TwitapistatusesAction extends TwitterapiAction
                     $this->show_json_timeline($notice);
                     break;
                 default:
-                    common_user_error(_('API method not found!'), $code = 404);
+                    $this->clientError(_('API method not found!'), $code = 404);
                     break;
             }
 
         } else {
-            common_server_error(_('Couldn\'t find any statuses.'), $code = 503);
+            $this->serverError(_('Couldn\'t find any statuses.'), $code = 503);
         }
 
     }
@@ -144,7 +144,7 @@ class TwitapistatusesAction extends TwitterapiAction
             $this->show_json_timeline($notice);
             break;
          default:
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
         }
 
     }
@@ -157,14 +157,14 @@ class TwitapistatusesAction extends TwitterapiAction
         $user = $this->get_user($apidata['api_arg'], $apidata);
 
         if (!$user) {
-            $this->client_error('Not Found', 404, $apidata['content-type']);
+            $this->clientError('Not Found', 404, $apidata['content-type']);
             return;
         }
 
         $profile = $user->getProfile();
 
         if (!$profile) {
-            common_server_error(_('User has no profile.'));
+            $this->serverError(_('User has no profile.'));
             return;
         }
 
@@ -225,7 +225,7 @@ class TwitapistatusesAction extends TwitterapiAction
             $this->show_json_timeline($notice);
             break;
          default:
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
         }
 
     }
@@ -236,12 +236,12 @@ class TwitapistatusesAction extends TwitterapiAction
         parent::handle($args);
 
         if (!in_array($apidata['content-type'], array('xml', 'json'))) {
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
             return;
         }
 
         if ($_SERVER['REQUEST_METHOD'] != 'POST') {
-            $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
+            $this->clientError(_('This method requires a POST.'), 400, $apidata['content-type']);
             return;
         }
 
@@ -273,7 +273,7 @@ class TwitapistatusesAction extends TwitterapiAction
                 // as "truncated." Sending this error may screw up some clients
                 // that assume Twitter will truncate for them.    Should we just
                 // truncate too? -- Zach
-                $this->client_error(_('That\'s too long. Max notice size is 140 chars.'), $code = 406, $apidata['content-type']);
+                $this->clientError(_('That\'s too long. Max notice size is 140 chars.'), $code = 406, $apidata['content-type']);
                 return;
 
             }
@@ -306,7 +306,7 @@ class TwitapistatusesAction extends TwitterapiAction
                 if ($reply) {
                     $reply_to = $in_reply_to_status_id;
                 } else {
-                    $this->client_error(_('Not found'), $code = 404, $apidata['content-type']);
+                    $this->clientError(_('Not found'), $code = 404, $apidata['content-type']);
                     return;
                 }
             }
@@ -315,7 +315,7 @@ class TwitapistatusesAction extends TwitterapiAction
                 $source, 1, $reply_to);
 
             if (is_string($notice)) {
-                $this->server_error($notice);
+                $this->serverError($notice);
                 return;
             }
 
@@ -389,7 +389,7 @@ class TwitapistatusesAction extends TwitterapiAction
             $this->show_json_timeline($notices);
             break;
          default:
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
         }
 
     }
@@ -399,7 +399,7 @@ class TwitapistatusesAction extends TwitterapiAction
         parent::handle($args);
 
         if (!in_array($apidata['content-type'], array('xml', 'json'))) {
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
             return;
         }
 
@@ -415,7 +415,7 @@ class TwitapistatusesAction extends TwitterapiAction
             }
         } else {
             // XXX: Twitter just sets a 404 header and doens't bother to return an err msg
-            $this->client_error(_('No status with that ID found.'), 404, $apidata['content-type']);
+            $this->clientError(_('No status with that ID found.'), 404, $apidata['content-type']);
         }
 
     }
@@ -426,14 +426,14 @@ class TwitapistatusesAction extends TwitterapiAction
         parent::handle($args);
 
         if (!in_array($apidata['content-type'], array('xml', 'json'))) {
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
             return;
         }
 
         // Check for RESTfulness
         if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
             // XXX: Twitter just prints the err msg, no XML / JSON.
-            $this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
+            $this->clientError(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
             return;
         }
 
@@ -443,7 +443,7 @@ class TwitapistatusesAction extends TwitterapiAction
         $notice = Notice::staticGet($notice_id);
 
         if (!$notice) {
-            $this->client_error(_('No status found with that ID.'), 404, $apidata['content-type']);
+            $this->clientError(_('No status found with that ID.'), 404, $apidata['content-type']);
             return;
         }
 
@@ -460,7 +460,7 @@ class TwitapistatusesAction extends TwitterapiAction
                 $this->show_single_json_status($notice);
             }
         } else {
-            $this->client_error(_('You may not delete another user\'s status.'), 403, $apidata['content-type']);
+            $this->clientError(_('You may not delete another user\'s status.'), 403, $apidata['content-type']);
         }
 
     }
@@ -487,7 +487,7 @@ class TwitapistatusesAction extends TwitterapiAction
         $user = $this->get_user($apidata['api_arg'], $apidata);
 
         if (!$user) {
-            $this->client_error('Not Found', 404, $apidata['content-type']);
+            $this->clientError('Not Found', 404, $apidata['content-type']);
             return;
         }
 
@@ -500,7 +500,7 @@ class TwitapistatusesAction extends TwitterapiAction
         $profile = $user->getProfile();
 
         if (!$profile) {
-            common_server_error(_('User has no profile.'));
+            $this->serverError(_('User has no profile.'));
             return;
         }
 
@@ -538,11 +538,11 @@ class TwitapistatusesAction extends TwitterapiAction
     {
         switch ($type) {
          case 'xml':
-            common_element_start('users', array('type' => 'array'));
+            $this->elementStart('users', array('type' => 'array'));
             foreach ($profiles as $profile) {
                 $this->show_profile($profile);
             }
-            common_element_end('users');
+            $this->elementEnd('users');
             break;
          case 'json':
             $arrays = array();
@@ -552,14 +552,14 @@ class TwitapistatusesAction extends TwitterapiAction
             print json_encode($arrays);
             break;
          default:
-            $this->client_error(_('unsupported file type'));
+            $this->clientError(_('unsupported file type'));
         }
     }
 
     function featured($args, $apidata)
     {
         parent::handle($args);
-        common_server_error(_('API method under construction.'), $code=501);
+        $this->serverError(_('API method under construction.'), $code=501);
     }
 
     function supported($cmd)
index 409986985c2302fdb5028f973ed99c37e3d8fef6..ed2417561157241e8af434dc9b427f68ee68c7f5 100644 (file)
@@ -29,7 +29,7 @@ class TwitapiusersAction extends TwitterapiAction
         parent::handle($args);
 
         if (!in_array($apidata['content-type'], array('xml', 'json'))) {
-            common_user_error(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found!'), $code = 404);
             return;
         }
 
@@ -44,7 +44,7 @@ class TwitapiusersAction extends TwitterapiAction
 
         if (!$user) {
             // XXX: Twitter returns a random(?) user instead of throwing and err! -- Zach
-            $this->client_error(_('Not found.'), 404, $apidata['content-type']);
+            $this->clientError(_('Not found.'), 404, $apidata['content-type']);
             return;
         }
 
index 62262e02110940d9bb9d1aa5e6b4d6e868188ae7..efc8215cdf532287c41562c729ce8a901fbb6f68 100644 (file)
@@ -1,9 +1,12 @@
 <?php
-/*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+/**
+ * Laconica, the distributed open-source microblogging tool
  *
- * This program is free software: you can redistribute it and/or modify
+ * Settings for Twitter integration
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Settings
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+    exit(1);
+}
 
-require_once(INSTALLDIR.'/lib/settingsaction.php');
+require_once INSTALLDIR.'/lib/connectsettingsaction.php';
 
 define('SUBSCRIPTIONS', 80);
 
-class TwittersettingsAction extends SettingsAction
+/**
+ * Settings for Twitter integration
+ *
+ * @category Settings
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      SettingsAction
+ */
+
+class TwittersettingsAction extends ConnectSettingsAction
 {
+    /**
+     * Title of the page
+     *
+     * @return string Title of the page
+     */
 
-    function get_instructions()
+    function title()
     {
-        return _('Add your Twitter account to automatically send your notices to Twitter, ' .
-            'and subscribe to Twitter friends already here.');
+        _('Twitter settings');
     }
 
-    function show_form($msg=null, $success=false)
+    /**
+     * Instructions for use
+     *
+     * @return instructions for use
+     */
+
+    function getInstructions()
+    {
+        return _('Add your Twitter account to automatically send '.
+                 ' your notices to Twitter, ' .
+                 'and subscribe to Twitter friends already here.');
+    }
+
+    /**
+     * Content area of the page
+     *
+     * Shows a form for associating a Twitter account with this
+     * Laconica account. Also lets the user set preferences.
+     *
+     * @return void
+     */
+
+    function showContent()
     {
         $user = common_current_user();
+
         $profile = $user->getProfile();
+
         $fuser = null;
+
         $flink = Foreign_link::getByUserID($user->id, 1); // 1 == Twitter
 
         if ($flink) {
             $fuser = $flink->getForeignUser();
         }
 
-        $this->form_header(_('Twitter settings'), $msg, $success);
-        common_element_start('form', array('method' => 'post',
-                                           'id' => 'twittersettings',
-                                           'action' =>
-                                           common_local_url('twittersettings')));
-        common_hidden('token', common_session_token());
-
-        common_element('h2', null, _('Twitter Account'));
-
+        $this->elementStart('form', array('method' => 'post',
+                                          'id' => 'form_settings_twitter',
+                                          'class' => 'form_settings',
+                                          'action' =>
+                                          common_local_url('twittersettings')));
+        $this->elementStart('fieldset', array('id' => 'settings_twitter_account'));
+        $this->element('legend', null, _('Twitter Account'));
+        $this->hidden('token', common_session_token());
+        $this->elementStart('ul', 'form_data');
         if ($fuser) {
-            common_element_start('p');
-
-            common_element('span', 'twitter_user', $fuser->nickname);
-            common_element('a', array('href' => $fuser->uri),  $fuser->uri);
-            common_element('span', 'input_instructions',
+            $this->elementStart('li');
+            $this->element('span', 'twitter_user', $fuser->nickname);
+            $this->element('a', array('href' => $fuser->uri), $fuser->uri);
+            $this->element('p', 'form_guide',
                            _('Current verified Twitter account.'));
-            common_hidden('flink_foreign_id', $flink->foreign_id);
-            common_element_end('p');
-            common_submit('remove', _('Remove'));
+            $this->hidden('flink_foreign_id', $flink->foreign_id);
+            $this->submit('remove', _('Remove'));
+            $this->elementEnd('li');
         } else {
-            common_input('twitter_username', _('Twitter user name'),
-                         ($this->arg('twitter_username')) ? $this->arg('twitter_username') : $profile->nickname,
+            $this->elementStart('li');
+            $this->input('twitter_username', _('Twitter user name'),
+                         ($this->arg('twitter_username')) ?
+                         $this->arg('twitter_username') :
+                         $profile->nickname,
                          _('No spaces, please.')); // hey, it's what Twitter says
-
-            common_password('twitter_password', _('Twitter password'));
+            $this->elementEnd('li');
+            $this->elementStart('li');
+            $this->password('twitter_password', _('Twitter password'));
+            $this->elementend('li');
         }
-
-        common_element('h2', null, _('Preferences'));
-
-        common_checkbox('noticesync', _('Automatically send my notices to Twitter.'),
-                        ($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND) : true);
-
-        common_checkbox('replysync', _('Send local "@" replies to Twitter.'),
-                        ($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : true);
-
-        common_checkbox('friendsync', _('Subscribe to my Twitter friends here.'),
-                        ($flink) ? ($flink->friendsync & FOREIGN_FRIEND_RECV) : false);
+        $this->elementEnd('ul');
+        $this->elementEnd('fieldset');
+
+        $this->elementStart('fieldset',
+                            array('id' => 'settings_twitter_preferences'));
+        $this->element('legend', null, _('Preferences'));
+
+        $this->elementStart('ul', 'form_data');
+        $this->elementStart('li');
+        $this->checkbox('noticesync',
+                        _('Automatically send my notices to Twitter.'),
+                        ($flink) ?
+                        ($flink->noticesync & FOREIGN_NOTICE_SEND) :
+                        true);
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->checkbox('replysync',
+                        _('Send local "@" replies to Twitter.'),
+                        ($flink) ?
+                        ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) :
+                        true);
+        $this->elementEnd('li');
+        $this->elementStart('li');
+        $this->checkbox('friendsync',
+                        _('Subscribe to my Twitter friends here.'),
+                        ($flink) ?
+                        ($flink->friendsync & FOREIGN_FRIEND_RECV) :
+                        false);
+        $this->elementEnd('li');
+        $this->elementEnd('ul');
 
         if ($flink) {
-            common_submit('save', _('Save'));
+            $this->submit('save', _('Save'));
         } else {
-            common_submit('add', _('Add'));
+            $this->submit('add', _('Add'));
         }
+        $this->elementEnd('fieldset');
 
-        $this->show_twitter_subscriptions();
+        $this->showTwitterSubscriptions();
 
-        common_element_end('form');
-
-        common_show_footer();
+        $this->elementEnd('form');
     }
 
-    function subscribed_twitter_users()
+    /**
+     * Gets some of the user's Twitter friends
+     *
+     * Gets the number of Twitter friends that are on this
+     * instance of Laconica.
+     *
+     * @return array array of User objects
+     */
+
+    function subscribedTwitterUsers()
     {
 
         $current_user = common_current_user();
 
         $qry = 'SELECT user.* ' .
-            'FROM subscription ' .
-            'JOIN user ON subscription.subscribed = user.id ' .
-            'JOIN foreign_link ON foreign_link.user_id = user.id ' .
-            'WHERE subscriber = %d ' .
-            'ORDER BY user.nickname';
+          'FROM subscription ' .
+          'JOIN user ON subscription.subscribed = user.id ' .
+          'JOIN foreign_link ON foreign_link.user_id = user.id ' .
+          'WHERE subscriber = %d ' .
+          'ORDER BY user.nickname';
 
         $user = new User();
 
@@ -123,17 +207,27 @@ class TwittersettingsAction extends SettingsAction
         return $users;
     }
 
-    function show_twitter_subscriptions()
+    /**
+     * Show user's Twitter friends
+     *
+     * Gets the number of Twitter friends that are on this
+     * instance of Laconica, and shows their mini-avatars.
+     *
+     * @return void
+     */
+
+    function showTwitterSubscriptions()
     {
 
-        $friends = $this->subscribed_twitter_users();
+        $friends = $this->subscribedTwitterUsers();
+
         $friends_count = count($friends);
 
         if ($friends_count > 0) {
 
-            common_element('h3', null, _('Twitter Friends'));
-            common_element_start('div', array('id' => 'subscriptions'));
-            common_element_start('ul', array('id' => 'subscriptions_avatars'));
+            $this->element('h3', null, _('Twitter Friends'));
+            $this->elementStart('div', array('id' => 'subscriptions'));
+            $this->elementStart('ul', array('id' => 'subscriptions_avatars'));
 
             for ($i = 0; $i < min($friends_count, SUBSCRIPTIONS); $i++) {
 
@@ -144,112 +238,126 @@ class TwittersettingsAction extends SettingsAction
                     continue;
                 }
 
-                common_element_start('li');
-                common_element_start('a', array('title' => ($other->fullname) ?
-                                                $other->fullname :
-                                                $other->nickname,
-                                                'href' => $other->profileurl,
-                                                'rel' => 'contact',
-                                                'class' => 'subscription'));
+                $this->elementStart('li');
+                $this->elementStart('a', array('title' => ($other->fullname) ?
+                                               $other->fullname :
+                                               $other->nickname,
+                                               'href' => $other->profileurl,
+                                               'rel' => 'contact',
+                                               'class' => 'subscription'));
+
                 $avatar = $other->getAvatar(AVATAR_MINI_SIZE);
-                common_element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) :  common_default_avatar(AVATAR_MINI_SIZE)),
+
+                $avatar_url = ($avatar) ?
+                  common_avatar_display_url($avatar) :
+                  common_default_avatar(AVATAR_MINI_SIZE);
+
+                $this->element('img', array('src' => $avatar_url,
                                             'width' => AVATAR_MINI_SIZE,
                                             'height' => AVATAR_MINI_SIZE,
                                             'class' => 'avatar mini',
                                             'alt' =>  ($other->fullname) ?
                                             $other->fullname :
                                             $other->nickname));
-                common_element_end('a');
-                common_element_end('li');
+                $this->elementEnd('a');
+                $this->elementEnd('li');
 
             }
 
-            common_element_end('ul');
-            common_element_end('div');
+            $this->elementEnd('ul');
+            $this->elementEnd('div');
 
         }
-
-        // XXX Figure out a way to show all Twitter friends... ?
-
-        /*
-        if ($subs_count > SUBSCRIPTIONS) {
-            common_element_start('p', array('id' => 'subscriptions_viewall'));
-
-            common_element('a', array('href' => common_local_url('subscriptions',
-                                                                 array('nickname' => $profile->nickname)),
-                                      'class' => 'moresubscriptions'),
-                           _('All subscriptions'));
-            common_element_end('p');
-        }
-        */
-
     }
 
-    function handle_post()
+    /**
+     * Handle posts to this form
+     *
+     * Based on the button that was pressed, muxes out to other functions
+     * to do the actual task requested.
+     *
+     * All sub-functions reload the form with a message -- success or failure.
+     *
+     * @return void
+     */
+
+    function handlePost()
     {
 
-        # CSRF protection
+        // CSRF protection
         $token = $this->trimmed('token');
         if (!$token || $token != common_session_token()) {
-            $this->show_form(_('There was a problem with your session token. Try again, please.'));
+            $this->showForm(_('There was a problem with your session token. '.
+                              'Try again, please.'));
             return;
         }
 
         if ($this->arg('save')) {
-            $this->save_preferences();
+            $this->savePreferences();
         } else if ($this->arg('add')) {
-            $this->add_twitter_acct();
+            $this->addTwitterAccount();
         } else if ($this->arg('remove')) {
-            $this->remove_twitter_acct();
+            $this->removeTwitterAccount();
         } else {
-            $this->show_form(_('Unexpected form submission.'));
+            $this->showForm(_('Unexpected form submission.'));
         }
     }
 
-    function add_twitter_acct()
-    {
+    /**
+     * Associate a Twitter account with the user's account
+     *
+     * Validates post input; verifies it against Twitter; and if
+     * successful stores in the database.
+     *
+     * @return void
+     */
 
+    function addTwitterAccount()
+    {
         $screen_name = $this->trimmed('twitter_username');
-        $password = $this->trimmed('twitter_password');
-        $noticesync = $this->boolean('noticesync');
-        $replysync = $this->boolean('replysync');
-        $friendsync = $this->boolean('friendsync');
+        $password    = $this->trimmed('twitter_password');
+        $noticesync  = $this->boolean('noticesync');
+        $replysync   = $this->boolean('replysync');
+        $friendsync  = $this->boolean('friendsync');
 
         if (!Validate::string($screen_name,
-                array(    'min_length' => 1,
-                        'max_length' => 15,
-                         'format' => VALIDATE_NUM . VALIDATE_ALPHA . '_'))) {
-            $this->show_form(
-                _('Username must have only numbers, upper- and lowercase letters, and underscore (_). 15 chars max.'));
+                              array('min_length' => 1,
+                                    'max_length' => 15,
+                                    'format' => VALIDATE_NUM.VALIDATE_ALPHA.'_'))) {
+            $this->showForm(_('Username must have only numbers, '.
+                              'upper- and lowercase letters, '.
+                              'and underscore (_). 15 chars max.'));
             return;
         }
 
-        if (!$this->verify_credentials($screen_name, $password)) {
-            $this->show_form(_('Could not verify your Twitter credentials!'));
+        if (!$this->verifyCredentials($screen_name, $password)) {
+            $this->showForm(_('Could not verify your Twitter credentials!'));
             return;
         }
 
         $twit_user = twitter_user_info($screen_name, $password);
 
         if (!$twit_user) {
-            $this->show_form(sprintf(_('Unable to retrieve account information for "%s" from Twitter.'),
-                $screen_name));
+            $this->showForm(sprintf(_('Unable to retrieve account information '.
+                                      'For "%s" from Twitter.'),
+                                    $screen_name));
             return;
         }
 
         if (!save_twitter_user($twit_user->id, $screen_name)) {
-            $this->show_form(_('Unable to save your Twitter settings!'));
+            $this->showForm(_('Unable to save your Twitter settings!'));
             return;
         }
 
         $user = common_current_user();
 
-        $flink = DB_DataObject::factory('foreign_link');
-        $flink->user_id = $user->id;
-        $flink->foreign_id = $twit_user->id;
-        $flink->service = 1; // Twitter
+        $flink = new Foreign_link();
+
+        $flink->user_id     = $user->id;
+        $flink->foreign_id  = $twit_user->id;
+        $flink->service     = 1; // Twitter
         $flink->credentials = $password;
-        $flink->created = common_sql_now();
+        $flink->created     = common_sql_now();
 
         $flink->set_flags($noticesync, $replysync, $friendsync);
 
@@ -257,7 +365,7 @@ class TwittersettingsAction extends SettingsAction
 
         if (!$flink_id) {
             common_log_db_error($flink, 'INSERT', __FILE__);
-            $this->show_form(_('Unable to save your Twitter settings!'));
+            $this->showForm(_('Unable to save your Twitter settings!'));
             return;
         }
 
@@ -265,19 +373,26 @@ class TwittersettingsAction extends SettingsAction
             save_twitter_friends($user, $twit_user->id, $screen_name, $password);
         }
 
-        $this->show_form(_('Twitter settings saved.'), true);
+        $this->showForm(_('Twitter settings saved.'), true);
     }
 
-    function remove_twitter_acct()
-    {
+    /**
+     * Disassociate an existing Twitter account from this account
+     *
+     * @return void
+     */
 
+    function removeTwitterAccount()
+    {
         $user = common_current_user();
+
         $flink = Foreign_link::getByUserID($user->id, 1);
+
         $flink_foreign_id = $this->arg('flink_foreign_id');
 
-        # Maybe an old tab open...?
+        // Maybe an old tab open...?
         if ($flink->foreign_id != $flink_foreign_id) {
-            $this->show_form(_('That is not your Twitter account.'));
+            $this->showForm(_('That is not your Twitter account.'));
             return;
         }
 
@@ -285,19 +400,24 @@ class TwittersettingsAction extends SettingsAction
 
         if (!$result) {
             common_log_db_error($flink, 'DELETE', __FILE__);
-            common_server_error(_('Couldn\'t remove Twitter user.'));
+            $this->serverError(_('Couldn\'t remove Twitter user.'));
             return;
         }
 
-        $this->show_form(_('Twitter account removed.'), true);
+        $this->showForm(_('Twitter account removed.'), true);
     }
 
-    function save_preferences()
-    {
+    /**
+     * Save user's Twitter-bridging preferences
+     *
+     * @return void
+     */
 
+    function savePreferences()
+    {
         $noticesync = $this->boolean('noticesync');
         $friendsync = $this->boolean('friendsync');
-        $replysync = $this->boolean('replysync');
+        $replysync  = $this->boolean('replysync');
 
         $user = common_current_user();
 
@@ -305,30 +425,32 @@ class TwittersettingsAction extends SettingsAction
 
         if (!$flink) {
             common_log_db_error($flink, 'SELECT', __FILE__);
-            $this->show_form(_('Couldn\'t save Twitter preferences.'));
+            $this->showForm(_('Couldn\'t save Twitter preferences.'));
             return;
         }
 
         $twitter_id = $flink->foreign_id;
-        $password = $flink->credentials;
+        $password   = $flink->credentials;
 
         $fuser = $flink->getForeignUser();
 
         if (!$fuser) {
             common_log_db_error($fuser, 'SELECT', __FILE__);
-            $this->show_form(_('Couldn\'t save Twitter preferences.'));
+            $this->showForm(_('Couldn\'t save Twitter preferences.'));
             return;
         }
 
         $screen_name = $fuser->nickname;
 
         $original = clone($flink);
+
         $flink->set_flags($noticesync, $replysync, $friendsync);
+
         $result = $flink->update($original);
 
         if ($result === false) {
             common_log_db_error($flink, 'UPDATE', __FILE__);
-            $this->show_form(_('Couldn\'t save Twitter preferences.'));
+            $this->showForm(_('Couldn\'t save Twitter preferences.'));
             return;
         }
 
@@ -336,12 +458,22 @@ class TwittersettingsAction extends SettingsAction
             save_twitter_friends($user, $flink->foreign_id, $screen_name, $password);
         }
 
-        $this->show_form(_('Twitter preferences saved.'), true);
+        $this->showForm(_('Twitter preferences saved.'), true);
     }
 
-    function verify_credentials($screen_name, $password)
+    /**
+     * Verifies a username and password against Twitter's API
+     *
+     * @param string $screen_name Twitter user name
+     * @param string $password    Twitter password
+     *
+     * @return boolean success flag
+     */
+
+    function verifyCredentials($screen_name, $password)
     {
-        $uri = 'http://twitter.com/account/verify_credentials.json';
+        $uri = 'http://twitter.com/account/verifyCredentials.json';
+
         $data = get_twitter_data($uri, $screen_name, $password);
 
         if (!$data) {
@@ -354,7 +486,7 @@ class TwittersettingsAction extends SettingsAction
             return false;
         }
 
-         $twitter_id = $user->id;
+        $twitter_id = $user->id;
 
         if ($twitter_id) {
             return $twitter_id;
@@ -363,5 +495,4 @@ class TwittersettingsAction extends SettingsAction
         return false;
     }
 
-
-}
\ No newline at end of file
+}
index 112304f71b41331d4aba4b6fb56f4b99b776a306..59270f8821f168964a4e02b6760ccd4efe85bfbe 100644 (file)
@@ -30,28 +30,28 @@ class UnblockAction extends Action
         parent::prepare($args);
 
         if (!common_logged_in()) {
-            $this->client_error(_('Not logged in.'));
+            $this->clientError(_('Not logged in.'));
             return false;
         }
 
         $token = $this->trimmed('token');
 
         if (!$token || $token != common_session_token()) {
-            $this->client_error(_('There was a problem with your session token. Try again, please.'));
+            $this->clientError(_('There was a problem with your session token. Try again, please.'));
             return;
         }
 
         $id = $this->trimmed('unblockto');
 
         if (!$id) {
-            $this->client_error(_('No profile specified.'));
+            $this->clientError(_('No profile specified.'));
             return false;
         }
 
         $this->profile = Profile::staticGet('id', $id);
 
         if (!$this->profile) {
-            $this->client_error(_('No profile with that ID.'));
+            $this->clientError(_('No profile with that ID.'));
             return false;
         }
 
@@ -74,7 +74,7 @@ class UnblockAction extends Action
         $result = $cur->unblock($this->profile);
 
         if (!$result) {
-            $this->server_error(_('Error removing the block.'));
+            $this->serverError(_('Error removing the block.'));
             return;
         }
 
index 1c2e1363593cdf150201f74fd6d7bf486e7c5148..32511a4b49c0f81cc05efe0d000d6a6bd06093d8 100644 (file)
@@ -24,7 +24,7 @@ class UnsubscribeAction extends Action
     {
         parent::handle($args);
         if (!common_logged_in()) {
-            common_user_error(_('Not logged in.'));
+            $this->clientError(_('Not logged in.'));
             return;
         }
 
@@ -40,40 +40,40 @@ class UnsubscribeAction extends Action
         $token = $this->trimmed('token');
 
         if (!$token || $token != common_session_token()) {
-            $this->client_error(_('There was a problem with your session token. Try again, please.'));
+            $this->clientError(_('There was a problem with your session token. Try again, please.'));
             return;
         }
 
         $other_id = $this->arg('unsubscribeto');
 
         if (!$other_id) {
-            $this->client_error(_('No profile id in request.'));
+            $this->clientError(_('No profile id in request.'));
             return;
         }
 
         $other = Profile::staticGet('id', $other_id);
 
         if (!$other_id) {
-            $this->client_error(_('No profile with that id.'));
+            $this->clientError(_('No profile with that id.'));
             return;
         }
 
         $result = subs_unsubscribe_to($user, $other);
 
         if ($result != true) {
-            common_user_error($result);
+            $this->clientError($result);
             return;
         }
 
         if ($this->boolean('ajax')) {
             common_start_html('text/xml;charset=utf-8', true);
-            common_element_start('head');
-            common_element('title', null, _('Unsubscribed'));
-            common_element_end('head');
-            common_element_start('body');
+            $this->elementStart('head');
+            $this->element('title', null, _('Unsubscribed'));
+            $this->elementEnd('head');
+            $this->elementStart('body');
             common_subscribe_form($other);
-            common_element_end('body');
-            common_element_end('html');
+            $this->elementEnd('body');
+            $this->elementEnd('html');
         } else {
             common_redirect(common_local_url('subscriptions', array('nickname' =>
                                                                     $user->nickname)));
index abb034c81e2974c9cf5f8319cd0b674fb886d85c..c79112dace79a514a520814317bd0179f35c2779 100644 (file)
@@ -37,7 +37,7 @@ class UpdateprofileAction extends Action
                 print "omb_version=".OMB_VERSION_01;
             }
         } catch (OAuthException $e) {
-            $this->server_error($e->getMessage());
+            $this->serverError($e->getMessage());
             return;
         }
     }
@@ -46,14 +46,14 @@ class UpdateprofileAction extends Action
     {
         $version = $req->get_parameter('omb_version');
         if ($version != OMB_VERSION_01) {
-            $this->client_error(_('Unsupported OMB version'), 400);
+            $this->clientError(_('Unsupported OMB version'), 400);
             return false;
         }
         # First, check to see if listenee exists
         $listenee =  $req->get_parameter('omb_listenee');
         $remote = Remote_profile::staticGet('uri', $listenee);
         if (!$remote) {
-            $this->client_error(_('Profile unknown'), 404);
+            $this->clientError(_('Profile unknown'), 404);
             return false;
         }
         # Second, check to see if they should be able to post updates!
@@ -64,72 +64,72 @@ class UpdateprofileAction extends Action
         $sub->subscribed = $remote->id;
         $sub->token = $token->key;
         if (!$sub->find(true)) {
-            $this->client_error(_('You did not send us that profile'), 403);
+            $this->clientError(_('You did not send us that profile'), 403);
             return false;
         }
 
         $profile = Profile::staticGet('id', $remote->id);
         if (!$profile) {
             # This one is our fault
-            $this->server_error(_('Remote profile with no matching profile'), 500);
+            $this->serverError(_('Remote profile with no matching profile'), 500);
             return false;
         }
         $nickname = $req->get_parameter('omb_listenee_nickname');
         if ($nickname && !Validate::string($nickname, array('min_length' => 1,
                                                             'max_length' => 64,
                                                             'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
-            $this->client_error(_('Nickname must have only lowercase letters and numbers and no spaces.'));
+            $this->clientError(_('Nickname must have only lowercase letters and numbers and no spaces.'));
             return false;
         }
         $license = $req->get_parameter('omb_listenee_license');
         if ($license && !common_valid_http_url($license)) {
-            $this->client_error(sprintf(_("Invalid license URL '%s'"), $license));
+            $this->clientError(sprintf(_("Invalid license URL '%s'"), $license));
             return false;
         }
         $profile_url = $req->get_parameter('omb_listenee_profile');
         if ($profile_url && !common_valid_http_url($profile_url)) {
-            $this->client_error(sprintf(_("Invalid profile URL '%s'."), $profile_url));
+            $this->clientError(sprintf(_("Invalid profile URL '%s'."), $profile_url));
             return false;
         }
         # optional stuff
         $fullname = $req->get_parameter('omb_listenee_fullname');
         if ($fullname && strlen($fullname) > 255) {
-            $this->client_error(_("Full name is too long (max 255 chars)."));
+            $this->clientError(_("Full name is too long (max 255 chars)."));
             return false;
         }
         $homepage = $req->get_parameter('omb_listenee_homepage');
         if ($homepage && (!common_valid_http_url($homepage) || strlen($homepage) > 255)) {
-            $this->client_error(sprintf(_("Invalid homepage '%s'"), $homepage));
+            $this->clientError(sprintf(_("Invalid homepage '%s'"), $homepage));
             return false;
         }
         $bio = $req->get_parameter('omb_listenee_bio');
         if ($bio && strlen($bio) > 140) {
-            $this->client_error(_("Bio is too long (max 140 chars)."));
+            $this->clientError(_("Bio is too long (max 140 chars)."));
             return false;
         }
         $location = $req->get_parameter('omb_listenee_location');
         if ($location && strlen($location) > 255) {
-            $this->client_error(_("Location is too long (max 255 chars)."));
+            $this->clientError(_("Location is too long (max 255 chars)."));
             return false;
         }
         $avatar = $req->get_parameter('omb_listenee_avatar');
         if ($avatar) {
             if (!common_valid_http_url($avatar) || strlen($avatar) > 255) {
-                $this->client_error(sprintf(_("Invalid avatar URL '%s'"), $avatar));
+                $this->clientError(sprintf(_("Invalid avatar URL '%s'"), $avatar));
                 return false;
             }
             $size = @getimagesize($avatar);
             if (!$size) {
-                $this->client_error(sprintf(_("Can't read avatar URL '%s'"), $avatar));
+                $this->clientError(sprintf(_("Can't read avatar URL '%s'"), $avatar));
                 return false;
             }
             if ($size[0] != AVATAR_PROFILE_SIZE || $size[1] != AVATAR_PROFILE_SIZE) {
-                $this->client_error(sprintf(_("Wrong size image at '%s'"), $avatar));
+                $this->clientError(sprintf(_("Wrong size image at '%s'"), $avatar));
                 return false;
             }
             if (!in_array($size[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG,
                                           IMAGETYPE_PNG))) {
-                $this->client_error(sprintf(_("Wrong image type for '%s'"), $avatar));
+                $this->clientError(sprintf(_("Wrong image type for '%s'"), $avatar));
                 return false;
             }
         }
@@ -156,14 +156,14 @@ class UpdateprofileAction extends Action
         }
 
         if (!$profile->update($orig_profile)) {
-            $this->server_error(_('Could not save new profile info'), 500);
+            $this->serverError(_('Could not save new profile info'), 500);
             return false;
         } else {
             if ($avatar) {
                 $temp_filename = tempnam(sys_get_temp_dir(), 'listenee_avatar');
                 copy($avatar, $temp_filename);
                 if (!$profile->setOriginal($temp_filename)) {
-                    $this->server_error(_('Could not save avatar info'), 500);
+                    $this->serverError(_('Could not save avatar info'), 500);
                     return false;
                 }
             }
index 05efbc16c70ec7ef7d1f125044dde4415be3b58c..838458932b2db81ee6e019cf578c88bc331cedf2 100644 (file)
@@ -54,7 +54,7 @@ class UserauthorizationAction extends Action
                 common_debug('getting new request', __FILE__);
                 $req = $this->get_new_request();
                 if (!$req) {
-                    $this->client_error(_('No request found!'));
+                    $this->clientError(_('No request found!'));
                 }
                 common_debug('validating request', __FILE__);
                 # XXX: only validate new requests, since nonce is one-time use
@@ -64,7 +64,7 @@ class UserauthorizationAction extends Action
                 $this->show_form($req);
             } catch (OAuthException $e) {
                 $this->clear_request();
-                $this->client_error($e->getMessage());
+                $this->clientError($e->getMessage());
                 return;
             }
 
@@ -84,51 +84,51 @@ class UserauthorizationAction extends Action
         $avatar = $req->get_parameter('omb_listenee_avatar');
 
         common_show_header(_('Authorize subscription'));
-        common_element('p', null, _('Please check these details to make sure '.
+        $this->element('p', null, _('Please check these details to make sure '.
                                      'that you want to subscribe to this user\'s notices. '.
                                      'If you didn\'t just ask to subscribe to someone\'s notices, '.
                                      'click "Cancel".'));
-        common_element_start('div', 'profile');
+        $this->elementStart('div', 'profile');
         if ($avatar) {
-            common_element('img', array('src' => $avatar,
+            $this->element('img', array('src' => $avatar,
                                         'class' => 'avatar profile',
                                         'width' => AVATAR_PROFILE_SIZE,
                                         'height' => AVATAR_PROFILE_SIZE,
                                         'alt' => $nickname));
         }
-        common_element('a', array('href' => $profile,
+        $this->element('a', array('href' => $profile,
                                   'class' => 'external profile nickname'),
                        $nickname);
         if ($fullname) {
-            common_element_start('div', 'fullname');
+            $this->elementStart('div', 'fullname');
             if ($homepage) {
-                common_element('a', array('href' => $homepage),
+                $this->element('a', array('href' => $homepage),
                                $fullname);
             } else {
-                common_text($fullname);
+                $this->text($fullname);
             }
-            common_element_end('div');
+            $this->elementEnd('div');
         }
         if ($location) {
-            common_element('div', 'location', $location);
+            $this->element('div', 'location', $location);
         }
         if ($bio) {
-            common_element('div', 'bio', $bio);
+            $this->element('div', 'bio', $bio);
         }
-        common_element_start('div', 'license');
-        common_element('a', array('href' => $license,
+        $this->elementStart('div', 'license');
+        $this->element('a', array('href' => $license,
                                   'class' => 'license'),
                        $license);
-        common_element_end('div');
-        common_element_end('div');
-        common_element_start('form', array('method' => 'post',
+        $this->elementEnd('div');
+        $this->elementEnd('div');
+        $this->elementStart('form', array('method' => 'post',
                                            'id' => 'userauthorization',
                                            'name' => 'userauthorization',
                                            'action' => common_local_url('userauthorization')));
-        common_hidden('token', common_session_token());
-        common_submit('accept', _('Accept'));
-        common_submit('reject', _('Reject'));
-        common_element_end('form');
+        $this->hidden('token', common_session_token());
+        $this->submit('accept', _('Accept'));
+        $this->submit('reject', _('Reject'));
+        $this->elementEnd('form');
         common_show_footer();
     }
 
@@ -137,7 +137,7 @@ class UserauthorizationAction extends Action
         $req = $this->get_stored_request();
 
         if (!$req) {
-            common_user_error(_('No authorization request!'));
+            $this->clientError(_('No authorization request!'));
             return;
         }
 
@@ -145,10 +145,10 @@ class UserauthorizationAction extends Action
 
         if ($this->arg('accept')) {
             if (!$this->authorize_token($req)) {
-                $this->client_error(_('Error authorizing token'));
+                $this->clientError(_('Error authorizing token'));
             }
             if (!$this->save_remote_profile($req)) {
-                $this->client_error(_('Error saving remote profile'));
+                $this->clientError(_('Error saving remote profile'));
             }
             if (!$callback) {
                 $this->show_accept_message($req->get_parameter('oauth_token'));
@@ -160,7 +160,7 @@ class UserauthorizationAction extends Action
                 $profile = $user->getProfile();
                 if (!$profile) {
                     common_log_db_error($user, 'SELECT', __FILE__);
-                    $this->server_error(_('User without matching profile'));
+                    $this->serverError(_('User without matching profile'));
                     return;
                 }
                 $params['omb_listener_nickname'] = $user->nickname;
@@ -328,18 +328,18 @@ class UserauthorizationAction extends Action
     function show_accept_message($tok)
     {
         common_show_header(_('Subscription authorized'));
-        common_element('p', null,
+        $this->element('p', null,
                        _('The subscription has been authorized, but no '.
                           'callback URL was passed. Check with the site\'s instructions for '.
                           'details on how to authorize the subscription. Your subscription token is:'));
-        common_element('blockquote', 'token', $tok);
+        $this->element('blockquote', 'token', $tok);
         common_show_footer();
     }
 
     function show_reject_message($tok)
     {
         common_show_header(_('Subscription rejected'));
-        common_element('p', null,
+        $this->element('p', null,
                        _('The subscription has been rejected, but no '.
                           'callback URL was passed. Check with the site\'s instructions for '.
                           'details on how to fully reject the subscription.'));
index d57ed21a54d233f4e9c1fda45247b84d0ff6340f..4bb896c38e11cd7d67635da6b6e90208cf7feeca 100644 (file)
@@ -22,7 +22,7 @@ if (!defined('LACONICA')) { exit(1); }
 class UserbyidAction extends Action
 {
     
-    function is_readonly()
+    function isReadOnly()
     {                
         return true;
     }
@@ -32,11 +32,11 @@ class UserbyidAction extends Action
         parent::handle($args);
         $id = $this->trimmed('id');
         if (!$id) {
-            $this->client_error(_('No id.'));
+            $this->clientError(_('No id.'));
         }
         $user =& User::staticGet($id);
         if (!$user) {
-            $this->client_error(_('No such user.'));
+            $this->clientError(_('No such user.'));
         }
 
         // support redirecting to FOAF rdf/xml if the agent prefers it
index 1e9fe121f0be78719c9947f88eb13b4d20a1e68e..d14fc523e8930e8a3e611745e98055589a5a8410 100644 (file)
@@ -34,7 +34,7 @@ class UserrssAction extends Rss10Action
         $this->user = User::staticGet('nickname', $nickname);
 
         if (!$this->user) {
-            common_user_error(_('No such user.'));
+            $this->clientError(_('No such user.'));
             return false;
         } else {
             return true;
@@ -78,7 +78,7 @@ class UserrssAction extends Rss10Action
         $profile = $user->getProfile();
         if (!$profile) {
             common_log_db_error($user, 'SELECT', __FILE__);
-            $this->server_error(_('User without matching profile'));
+            $this->serverError(_('User without matching profile'));
             return null;
         }
         $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
index 7edc6aa39cbbfc6ef8070680017226c7e6cb728b..14cb9d503e98a4a2842fa522b41754e6785e63d6 100644 (file)
@@ -24,7 +24,7 @@ require_once(INSTALLDIR.'/lib/omb.php');
 class XrdsAction extends Action
 {
 
-    function is_readonly()
+    function isReadOnly()
     {                
         return true;
     }
@@ -35,7 +35,7 @@ class XrdsAction extends Action
         $nickname = $this->trimmed('nickname');
         $user = User::staticGet('nickname', $nickname);
         if (!$user) {
-            common_user_error(_('No such user.'));
+            $this->clientError(_('No such user.'));
             return;
         }
         $this->show_xrds($user);
@@ -47,14 +47,14 @@ class XrdsAction extends Action
         header('Content-Type: application/xrds+xml');
 
         common_start_xml();
-        common_element_start('XRDS', array('xmlns' => 'xri://$xrds'));
+        $this->elementStart('XRDS', array('xmlns' => 'xri://$xrds'));
 
-        common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
+        $this->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
                                           'xml:id' => 'oauth',
                                           'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
                                           'version' => '2.0'));
 
-        common_element('Type', null, 'xri://$xrds*simple');
+        $this->element('Type', null, 'xri://$xrds*simple');
 
         $this->show_service(OAUTH_ENDPOINT_REQUEST,
                             common_local_url('requesttoken'),
@@ -77,16 +77,16 @@ class XrdsAction extends Action
                             array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY),
                             array(OAUTH_HMAC_SHA1));
 
-        common_element_end('XRD');
+        $this->elementEnd('XRD');
 
         # XXX: decide whether to include user's ID/nickname in postNotice URL
 
-        common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
+        $this->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
                                           'xml:id' => 'omb',
                                           'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
                                           'version' => '2.0'));
 
-        common_element('Type', null, 'xri://$xrds*simple');
+        $this->element('Type', null, 'xri://$xrds*simple');
 
         $this->show_service(OMB_ENDPOINT_POSTNOTICE,
                             common_local_url('postnotice'));
@@ -94,44 +94,44 @@ class XrdsAction extends Action
         $this->show_service(OMB_ENDPOINT_UPDATEPROFILE,
                             common_local_url('updateprofile'));
 
-        common_element_end('XRD');
+        $this->elementEnd('XRD');
 
-        common_element_start('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
+        $this->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
                                           'version' => '2.0'));
 
-        common_element('Type', null, 'xri://$xrds*simple');
+        $this->element('Type', null, 'xri://$xrds*simple');
 
         $this->show_service(OAUTH_DISCOVERY,
                             '#oauth');
         $this->show_service(OMB_NAMESPACE,
                             '#omb');
 
-        common_element_end('XRD');
+        $this->elementEnd('XRD');
 
-        common_element_end('XRDS');
+        $this->elementEnd('XRDS');
         common_end_xml();
     }
 
     function show_service($type, $uri, $params=null, $sigs=null, $localId=null)
     {
-        common_element_start('Service');
+        $this->elementStart('Service');
         if ($uri) {
-            common_element('URI', null, $uri);
+            $this->element('URI', null, $uri);
         }
-        common_element('Type', null, $type);
+        $this->element('Type', null, $type);
         if ($params) {
             foreach ($params as $param) {
-                common_element('Type', null, $param);
+                $this->element('Type', null, $param);
             }
         }
         if ($sigs) {
             foreach ($sigs as $sig) {
-                common_element('Type', null, $sig);
+                $this->element('Type', null, $sig);
             }
         }
         if ($localId) {
-            common_element('LocalID', null, $localId);
+            $this->element('LocalID', null, $localId);
         }
-        common_element_end('Service');
+        $this->elementEnd('Service');
     }
 }
\ No newline at end of file
index e348635a86823d2ddeab8b9034e65b63fa580949..10e51b5b061661a45a31cfe949993955116c6d87 100644 (file)
@@ -52,8 +52,9 @@ RewriteRule ^main/tagother$ index.php?action=tagother [L,QSA]
 
 RewriteRule ^main/block$ index.php?action=block [L,QSA]
 
-RewriteRule ^settings/delete$ index.php?action=deleteprofile [L,QSA]
 RewriteRule ^settings/profile$ index.php?action=profilesettings [L,QSA]
+RewriteRule ^settings/avatar$ index.php?action=avatarsettings [L,QSA]
+RewriteRule ^settings/password$ index.php?action=passwordsettings [L,QSA]
 RewriteRule ^settings/openid$ index.php?action=openidsettings [L,QSA]
 RewriteRule ^settings/im$ index.php?action=imsettings [L,QSA]
 RewriteRule ^settings/email$ index.php?action=emailsettings [L,QSA]
index 3cecb5c8b6c3825d5e2e116ba05a2574191231ba..387b642e2c6a2e8a81772bbbf8b29f36b1c1ffcc 100644 (file)
--- a/index.php
+++ b/index.php
@@ -55,7 +55,7 @@ if (file_exists($actionfile)) {
 
     $action_obj = new $action_class();
 
-    if ($config['db']['mirror'] && $action_obj->is_readonly()) {
+    if ($config['db']['mirror'] && $action_obj->isReadOnly()) {
         if (is_array($config['db']['mirror'])) {
             // "load balancing", ha ha
             $k = array_rand($config['db']['mirror']);
diff --git a/js/jcrop/Jcrop.gif b/js/jcrop/Jcrop.gif
deleted file mode 100644 (file)
index 72ea7cc..0000000
Binary files a/js/jcrop/Jcrop.gif and /dev/null differ
diff --git a/js/jcrop/jquery.Jcrop.css b/js/jcrop/jquery.Jcrop.css
deleted file mode 100644 (file)
index b95178a..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Fixes issue here http://code.google.com/p/jcrop/issues/detail?id=1 */
-.jcrop-holder
-{
-       text-align: left;
-}
-
-.jcrop-vline, .jcrop-hline
-{
-       font-size: 0;
-       position: absolute;
-       background: white url('Jcrop.gif') top left repeat;
-       /*
-       opacity: .5;
-       *filter:alpha(opacity=50);
-       */
-}
-.jcrop-vline { height: 100%; width: 1px !important; }
-.jcrop-hline { width: 100%; height: 1px !important; }
-.jcrop-handle {
-       font-size: 1px;
-       width: 7px !important;
-       height: 7px !important;
-       border: 1px #eee solid;
-       background-color: #333;
-       *width: 9px;
-       *height: 9px;
-}
-
-.jcrop-tracker {
-       *background-color: gray;
-       width: 100%; height: 100%;
-}
-
-.custom .jcrop-vline,
-.custom .jcrop-hline
-{
-       background: yellow;
-}
-.custom .jcrop-handle
-{
-       border-color: black;
-       background-color: #C7BB00;
-       -moz-border-radius: 3px;
-       -webkit-border-radius: 3px;
-}
diff --git a/js/jcrop/jquery.Jcrop.go.js b/js/jcrop/jquery.Jcrop.go.js
deleted file mode 100644 (file)
index 7c5b5e4..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-               $(function(){
-                       jQuery("#avatar_original img.avatar").Jcrop({ onChange: showPreview,
-                                                                                                             setSelect: [ 0, 0, $("#avatar_original img.avatar").attr("width"), $("#avatar_original img.avatar").attr("height") ],
-                                                                                                                 onSelect: updateCoords,
-                                                                                                             aspectRatio: 1,
-                                                                                                                 boxWidth: 480,
-                                                                                                                 boxHeight: 480,
-                                                                                                                 bgColor: '#000',
-                                                                                                                 bgOpacity: .4
-                                                                                               });
-               });
-
-               function showPreview(coords) {
-                       var rx = 96 / coords.w;
-                       var ry = 96 / coords.h;
-
-                       var img_width = $("#avatar_original img.avatar").attr("width");
-                       var img_height = $("#avatar_original img.avatar").attr("height");
-
-
-                       $('#avatar_preview img.avatar').css({
-                               width: Math.round(rx *img_width) + 'px',
-                               height: Math.round(ry * img_height) + 'px',
-                               marginLeft: '-' + Math.round(rx * coords.x) + 'px',
-                               marginTop: '-' + Math.round(ry * coords.y) + 'px'
-                       });
-               };
-
-               function updateCoords(c) {
-                       $('#avatar_crop_x').val(c.x);
-                       $('#avatar_crop_y').val(c.y);
-                       $('#avatar_crop_w').val(c.w);
-                       $('#avatar_crop_h').val(c.h);
-               };
-
-               function checkCoords() {
-                       if (parseInt($('#avatar_crop_w').val())) return true;
-                       alert('Please select a crop region then press submit.');
-                       return false;
-               };
-
diff --git a/js/jcrop/jquery.Jcrop.pack.js b/js/jcrop/jquery.Jcrop.pack.js
deleted file mode 100644 (file)
index aa82e8a..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * Jcrop v.0.9.5 (packed)
- * (c) 2008 Kelly Hallman and DeepLiquid.com
- * More information: http://deepliquid.com/content/Jcrop.html
- * Released under MIT License - this header must remain with code
- */
-
-eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('$.1n=7(G,F){d G=G,F=F;g(1p(G)!==\'2d\')G=$(G)[0];g(1p(F)!==\'2d\')F={};g(!(\'2x\'1a F))F.2x=$.3d.3e?K:M;g(!(\'2c\'1a F))F.2c=$.3d.3e?K:M;d 4f={2x:K,3W:\'4C\',1f:4D,3T:\'4Y\',3x:.6,3O:.4,3P:.5,53:5,3N:9,3D:5,51:14,25:0,2c:M,3I:M,3B:M,30:M,3A:M,49:0,4p:0,4k:8,3V:20,3X:3,2f:K,3n:[0,0],2z:[0,0],2O:[0,0],2D:7(){},2G:7(){}};d j=4f;21(F);d $I=$(G).B({16:\'1b\'});47($I,j.49,j.4p);d S=$I.W(),L=$I.U(),$12=$(\'<12 />\').W(S).U(L).1f(1L(\'4F\')).B({16:\'4H\',4B:j.3T});g(j.1f)$12.1f(j.1f);$I.54($12);d $34=$(\'<I />\').3Y(\'2N\',$I.3Y(\'2N\')).B(\'16\',\'1b\').W(S).U(L);d $2C=$(\'<12 />\').W(1t(V)).U(1t(V)).B({1l:59,16:\'1b\',4o:\'4g\'}).1P($34);d $2g=$(\'<12 />\').W(1t(V)).U(1t(V)).B({1l:5b});d $28=$(\'<12 />\').B({16:\'1b\',1l:55}).3U($I).1P($2C,$2g);d 23=j.4k;d $1S=$(\'<12 />\').1f(1L(\'3v\')).W(S+(23*2)).U(L+(23*2)).B({16:\'1b\',R:D(-23),P:D(-23),1l:3R,1z:0}).3q(48);d 1I,1Q;d 2u=2Q(G),1q,1B,3i,58,3h,1O;g(\'36\'1a j){1I=j.36[0]/S;1Q=j.36[1]/L}d E=7(){d A=0,u=0,q=0,m=0,Z,Y;7 1A(z){d z=2T(z);q=A=z[0];m=u=z[1]};7 1y(z){d z=2T(z);Z=z[0]-q;Y=z[1]-m;q=z[0];m=z[1]};7 3f(){k[Z,Y]};7 2b(2y){d Z=2y[0],Y=2y[1];g(0>A+Z)Z-=Z+A;g(0>u+Y)Y-=Y+u;g(L<m+Y)Y+=L-(m+Y);g(S<q+Z)Z+=S-(q+Z);A+=Z;q+=Z;u+=Y;m+=Y};7 2K(T){d c=Q();1E(T){C\'1s\':k[c.q,c.y];C\'11\':k[c.x,c.y];C\'2e\':k[c.q,c.m];C\'1M\':k[c.x,c.m]}};7 Q(){g(!j.25&&!1B)k 3F();d 1k=j.25?j.25:1B,5c=j.2O,4u=j.2z,1V=q-A,1Z=m-u,3c=N.17(1V),3j=N.17(1Z),3M=3c/3j,15,13;g(3M<1k){13=m;w=3j*1k;15=1V<0?A-w:w+A;g(15<0){15=0;h=N.17((15-A)/1k);13=1Z<0?u-h:h+u}1g g(15>S){15=S;h=N.17((15-A)/1k);13=1Z<0?u-h:h+u}}1g{15=q;h=3c/1k;13=1Z<0?u-h:u+h;g(13<0){13=0;w=N.17((13-u)*1k);15=1V<0?A-w:w+A}1g g(13>L){13=L;w=N.17(13-u)*1k;15=1V<0?A-w:w+A}}k 4E=3g(1F(A,u,15,13))};7 2T(p){g(p[0]<0)p[0]=0;g(p[1]<0)p[1]=0;g(p[0]>S)p[0]=S;g(p[1]>L)p[1]=L;k[p[0],p[1]]};7 1F(A,u,q,m){d 2R=A,3r=q,3o=u,3l=m;g(q<A){2R=q;3r=A}g(m<u){3o=m;3l=u}k[N.1K(2R),N.1K(3o),N.1K(3r),N.1K(3l)]};7 3F(){d 1U=q-A;d 22=m-u;g(2q&&(N.17(1U)>2q))q=(1U>0)?(A+2q):(A-2q);g(2n&&(N.17(22)>2n))m=(22>0)?(u+2n):(u-2n);g(2i&&(N.17(22)<2i))m=(22>0)?(u+2i):(u-2i);g(2m&&(N.17(1U)<2m))q=(1U>0)?(A+2m):(A-2m);g(A<0){q-=A;A-=A}g(u<0){m-=u;u-=u}g(q<0){A-=q;q-=q}g(m<0){u-=m;m-=m}g(q>S){d X=q-S;A-=X;q-=X}g(m>L){d X=m-L;u-=X;m-=X}g(A>S){d X=A-L;m-=X;u-=X}g(u>L){d X=u-L;m-=X;u-=X}k 3g(1F(A,u,q,m))};7 3g(a){k{x:a[0],y:a[1],q:a[2],m:a[3],w:a[2]-a[0],h:a[3]-a[1]}};k{1F:1F,1A:1A,1y:1y,3f:3f,2b:2b,2K:2K,Q:Q}}();d J=7(){d 4v,4z,4y,1R,2U=4x;d 2F={};d H={};d 2E=K;d 1i=j.3D;g(j.30){2F={R:1Y(\'3C\').B(\'R\',$.3d.3e?D(-1):D(0)),3Q:1Y(\'3C\'),P:1Y(\'3z\'),3L:1Y(\'3z\')}}g(j.3A){H.t=1W(\'n\');H.b=1W(\'s\');H.r=1W(\'e\');H.l=1W(\'w\')}j.3B&&2Y([\'n\',\'s\',\'e\',\'w\']);j.3I&&2Y([\'1M\',\'11\',\'1s\',\'2e\']);7 1Y(1u){d 1J=$(\'<12 />\').B({16:\'1b\',1z:j.3O}).1f(1L(1u));$2C.1P(1J);k 1J};7 2W(T,3y){d 1J=$(\'<12 />\').3q(3b(T)).B({3p:T+\'-2A\',16:\'1b\',1l:3y});$2g.1P(1J);k 1J};7 3J(T){k 2W(T,2U++).B({R:D(-1i+1),P:D(-1i+1),1z:j.3P}).1f(1L(\'H\'))};7 1W(T){d s=j.3N,o=1i,h=s,w=s,t=o,l=o;1E(T){C\'n\':C\'s\':w=1t(V);O;C\'e\':C\'w\':h=1t(V);O}k 2W(T,2U++).W(w).U(h).B({R:D(-t+1),P:D(-l+1)})};7 2Y(2J){4U(i 1a 2J)H[2J[i]]=3J(2J[i])};7 31(c){d 3a=N.1K((c.h/2)-1i),35=N.1K((c.w/2)-1i),4V=4W=-1i+1,2a=c.w-1i,1X=c.h-1i,x,y;\'e\'1a H&&H.e.B({R:D(3a),P:D(2a)})&&H.w.B({R:D(3a)})&&H.s.B({R:D(1X),P:D(35)})&&H.n.B({P:D(35)});\'1s\'1a H&&H.1s.B({P:D(2a)})&&H.2e.B({R:D(1X),P:D(2a)})&&H.1M.B({R:D(1X)});\'b\'1a H&&H.b.B({R:D(1X)})&&H.r.B({P:D(2a)})};7 3K(x,y){$34.B({R:D(-y),P:D(-x)});$28.B({R:D(y),P:D(x)})};7 2A(w,h){$28.W(w).U(h)};7 3s(){d p=E.Q();E.1A([p.x,p.y]);E.1y([p.q,p.m])};7 2I(){g(1R)k 1e()};7 1e(){d c=E.Q();2A(c.w,c.h);3K(c.x,c.y);j.30&&2F[\'3L\'].B({P:D(c.w-1)})&&2F[\'3Q\'].B({R:D(c.h-1)});2E&&31(c);1R||1w();j.2D(2H(c))};7 1w(){$28.1w();$I.B(\'1z\',j.3x);1R=M};7 1r(){1o();$28.1v();$I.B(\'1z\',1);1R=K};7 1v(){1r();$I.B(\'1z\',1);1R=K};7 2t(){2E=M;31(E.Q());$2g.1w()};7 1o(){2E=K;$2g.1v()};7 2o(v){(3h=v)?1o():2t()};7 1h(){d c=E.Q();2o(K);3s()};1o();$2C.1P($(\'<12 />\').1f(1L(\'3v\')).3q(3b(\'1N\')).B({3p:\'1N\',16:\'1b\',1l:4M,1z:0}));k{2I:2I,1e:1e,1r:1r,1w:1w,1v:1v,2t:2t,1o:1o,2o:2o,1h:1h}}();d 1j=7(){d 2w=7(){},2v=7(){},2L=j.2x;g(!2L){$1S.3k(2B).2S(26).4N(26)}7 4j(){g(2L){$(3t).3k(2B).2S(26)}$1S.B({1l:4G})}7 4i(){g(2L){$(3t).3H(\'3k\',2B).3H(\'2S\',26)}$1S.B({1l:3R})}7 2B(e){2w(2r(e))};7 26(e){e.2j();e.2k();g(1q){1q=K;2v(2r(e));j.2G(2H(E.Q()));4i();2w=7(){};2v=7(){}}k K};7 1G(1N,1h){1q=M;2w=1N;2v=1h;4j();k K};7 1x(t){$1S.B(\'3p\',t)};$I.4s($1S);k{1G:1G,1x:1x}}();d 33=7(){d $24=$(\'<4w 1u="4L" />\').B({16:\'1b\',P:\'-4O\'}).57(43).56(2f).5a(41),$3S=$(\'<12 />\').B({16:\'1b\',4o:\'4g\'}).1P($24);7 2l(){g(j.2c){$24.1w();$24.4Z()}};7 41(e){$24.1v()};7 2f(e){g(!j.2f)k;d 42=1O,1C;1O=e.4Q?M:K;g(42!=1O){g(1O&&1q){1C=E.Q();1B=1C.w/1C.h}1g 1B=0;J.1e()}e.2k();e.2j();k K};7 29(e,x,y){E.2b([x,y]);J.2I();e.2j();e.2k()};7 43(e){g(e.4T)k M;2f(e);d 2h=1O?10:1;1E(e.5d){C 37:29(e,-2h,0);O;C 39:29(e,2h,0);O;C 38:29(e,0,-2h);O;C 40:29(e,0,2h);O;C 27:J.1r();O;C 9:k M}k K};g(j.2c)$3S.3U($I);k{2l:2l}}();7 D(n){k\'\'+1m(n)+\'D\'};7 1t(n){k\'\'+1m(n)+\'%\'};7 1L(44){k j.3W+\'-\'+44};7 2Q(G){d z=$(G).2y();k[z.P,z.R]};7 2r(e){k[(e.4q-2u[0]),(e.4r-2u[1])]};7 46(1u){g(1u!=3i){1j.1x(1u);3i=1u}};7 4a(19,z){2u=2Q(G);1j.1x(19==\'1N\'?19:19+\'-2A\');g(19==\'1N\')k 1j.1G(4e(z),2P);d 1C=E.Q();E.1A(E.2K(4b(19)));1j.1G(45(19,1C),2P)};7 45(19,f){k 7(z){g(!j.25&&!1B)1E(19){C\'e\':z[1]=f.m;O;C\'w\':z[1]=f.m;O;C\'n\':z[0]=f.q;O;C\'s\':z[0]=f.q;O}1g 1E(19){C\'e\':z[1]=f.y+1;O;C\'w\':z[1]=f.y+1;O;C\'n\':z[0]=f.x+1;O;C\'s\':z[0]=f.x+1;O}E.1y(z);J.1e()}};7 4e(z){d 2M=z;33.2l();k 7(z){E.2b([z[0]-2M[0],z[1]-2M[1]]);2M=z;J.1e()}};7 4b(T){1E(T){C\'n\':k\'1M\';C\'s\':k\'11\';C\'e\':k\'11\';C\'w\':k\'1s\';C\'1s\':k\'1M\';C\'11\':k\'2e\';C\'2e\':k\'11\';C\'1M\':k\'1s\'}};7 3b(T){k 7(e){1q=M;4a(T,2r(e));e.2k();e.2j();k K}};7 47($G,w,h){d 11=$G.W(),1H=$G.U();g((11>w)&&w>0){11=w;1H=(w/$G.W())*$G.U()}g((1H>h)&&h>0){1H=h;11=(h/$G.U())*$G.W()}1I=$G.W()/11;1Q=$G.U()/1H;$G.W(11).U(1H)};7 2H(c){k{x:1m(c.x*1I),y:1m(c.y*1Q),q:1m(c.q*1I),m:1m(c.m*1Q),w:1m(c.w*1I),h:1m(c.h*1Q)}};7 2P(z){d c=E.Q();g(c.w>j.3n[0]&&c.h>j.3n[1]){J.2t();J.1h()}1g{J.1r()}1j.1x(\'2X\')};7 48(e){1q=M;2u=2Q(G);J.1r();J.1o();46(\'2X\');E.1A(2r(e));1j.1G(4c,2P);33.2l();e.2k();e.2j();k K};7 4c(z){E.1y(z);J.1e()};7 2Z(a){d A=a[0],u=a[1],q=a[2],m=a[3];g(3h)k;d 2s=E.1F(A,u,q,m);d c=E.Q();d 18=2p=[c.x,c.y,c.q,c.m];d 3w=j.3V;d x=18[0];d y=18[1];d q=18[2];d m=18[3];d 3Z=2s[0]-2p[0];d 4m=2s[1]-2p[1];d 4n=2s[2]-2p[2];d 4l=2s[3]-2p[3];d 1c=0;d 4h=j.3X;J.2o(M);d 3u=7(){k 7(){1c+=(V-1c)/4h;18[0]=x+((1c/V)*3Z);18[1]=y+((1c/V)*4m);18[2]=q+((1c/V)*4n);18[3]=m+((1c/V)*4l);g(1c<V)32();1g J.1h();g(1c>=4K.8)1c=V;1d(18)}}();7 32(){4I.4t(3u,3w)};32()};7 1d(l){E.1A([l[0],l[1]]);E.1y([l[2],l[3]]);J.1e()};7 21(F){g(1p(F)!=\'2d\')F={};j=$.4X(j,F);g(1p(j.2D)!==\'7\')j.2D=7(){};g(1p(j.2G)!==\'7\')j.2G=7(){}};7 3m(){k 2H(E.Q())};7 2V(){k E.Q()};7 3E(F){21(F);g(\'1d\'1a F){1d(F.1d);J.1h()}};g(1p(F)!=\'2d\')F={};g(\'1d\'1a F){1d(F.1d);J.1h()}d 2q=j.2z[0]||0;d 2n=j.2z[1]||0;d 2m=j.2O[0]||0;d 2i=j.2O[1]||0;1j.1x(\'2X\');k{2Z:2Z,1d:1d,21:3E,3m:3m,2V:2V}};$.5e.1n=7(j){7 3G(1D){d 4d=j.4R||1D.2N;d I=4P 4S();d 1D=1D;I.50=7(){$(1D).1v().4A(I);1D.1n=$.1n(I,j)};I.2N=4d};g(1p(j)!==\'2d\')j={};1T.4J(7(){g(\'1n\'1a 1T){g(j==\'52\')k 1T.1n;1g 1T.1n.21(j)}1g 3G(1T)});k 1T};',62,325,'|||||||function||||||var|||if|||options|return||y2||||x2||||y1|||||pos|x1|css|case|px|Coords|opt|obj|handle|img|Selection|false|boundy|true|Math|break|left|getFixed|top|boundx|ord|height|100|width|delta|oy|ox||nw|div|yy||xx|position|abs|animat|mode|in|absolute|pcent|setSelect|update|addClass|else|done|hhs|Tracker|aspect|zIndex|parseInt|Jcrop|disableHandles|typeof|btndown|release|ne|pct|type|hide|show|setCursor|setCurrent|opacity|setPressed|aspectLock|fc|from|switch|flipCoords|activateHandlers|nh|xscale|jq|round|cssClass|sw|move|shift_down|append|yscale|awake|trk|this|xsize|rw|insertDragbar|south|insertBorder|rh||setOptions|ysize|bound|keymgr|aspectRatio|trackUp||sel|doNudge|east|moveOffset|keySupport|object|se|watchShift|hdl_holder|nudge|ymin|preventDefault|stopPropagation|watchKeys|xmin|ylimit|animMode|initcr|xlimit|mouseAbs|animto|enableHandles|docOffset|onDone|onMove|trackDocument|offset|maxSize|resize|trackMove|img_holder|onChange|seehandles|borders|onSelect|unscale|updateVisible|li|getCorner|trackDoc|lloc|src|minSize|doneSelect|getPos|xa|mouseup|rebound|hdep|tellScaled|dragDiv|crosshair|createHandles|animateTo|drawBorders|moveHandles|animateStart|KeyManager|img2|midhoriz|trueSize||||midvert|createDragger|rwa|browser|msie|getOffset|makeObj|animating|lastcurs|rha|mousemove|yb|tellSelect|minSelect|ya|cursor|mousedown|xb|refresh|document|animator|tracker|interv|bgOpacity|zi|vline|dragEdges|sideHandles|hline|handleOffset|setOptionsNew|getRect|attachWhenDone|unbind|cornerHandles|insertHandle|moveto|right|real_ratio|handleSize|borderOpacity|handleOpacity|bottom|290|keywrap|bgColor|insertBefore|animationDelay|baseClass|swingSpeed|attr|ix1||onBlur|init_shift|parseKey|cl|dragmodeHandler|myCursor|presize|newSelection|boxWidth|startDragMode|oppLockCorner|selectDrag|loadsrc|createMover|defaults|hidden|velocity|toBack|toFront|boundary|iy2|iy1|ix2|overflow|boxHeight|pageX|pageY|before|setTimeout|max|start|input|370|dragmode|end|after|backgroundColor|jcrop|null|last|holder|450|relative|window|each|99|radio|360|mouseout|30px|new|shiftKey|useImg|Image|ctrlKey|for|north|west|extend|black|focus|onload|edgeMargin|api|handlePad|wrap|300|keyup|keydown|dimmed|310|blur|320|min|keyCode|fn'.split('|'),0,{}))
diff --git a/js/jquery.Jcrop.go.js b/js/jquery.Jcrop.go.js
new file mode 100644 (file)
index 0000000..e5d5873
--- /dev/null
@@ -0,0 +1,41 @@
+               $(function(){
+                       jQuery("#photo_original img").Jcrop({
+                               onChange: showPreview,
+                               setSelect: [ 0, 0, $("#photo_original img").attr("width"), $("#photo_original img").attr("height") ],
+                               onSelect: updateCoords,
+                               aspectRatio: 1,
+                               boxWidth: 480,
+                               boxHeight: 480,
+                               bgColor: '#000',
+                               bgOpacity: .4
+                       });
+               });
+
+               function showPreview(coords) {
+                       var rx = 96 / coords.w;
+                       var ry = 96 / coords.h;
+
+                       var img_width = $("#photo_original img").attr("width");
+                       var img_height = $("#photo_original img").attr("height");
+
+                       $('#photo_preview img').css({
+                               width: Math.round(rx *img_width) + 'px',
+                               height: Math.round(ry * img_height) + 'px',
+                               marginLeft: '-' + Math.round(rx * coords.x) + 'px',
+                               marginTop: '-' + Math.round(ry * coords.y) + 'px'
+                       });
+               };
+
+               function updateCoords(c) {
+                       $('#photo_crop_x').val(c.x);
+                       $('#photo_crop_y').val(c.y);
+                       $('#photo_crop_w').val(c.w);
+                       $('#photo_crop_h').val(c.h);
+               };
+
+               function checkCoords() {
+                       if (parseInt($('#photo_crop_w').val())) return true;
+                       alert('Please select a crop region then press submit.');
+                       return false;
+               };
+
diff --git a/js/jquery.Jcrop.pack.js b/js/jquery.Jcrop.pack.js
new file mode 100644 (file)
index 0000000..aa82e8a
--- /dev/null
@@ -0,0 +1,8 @@
+/**
+ * Jcrop v.0.9.5 (packed)
+ * (c) 2008 Kelly Hallman and DeepLiquid.com
+ * More information: http://deepliquid.com/content/Jcrop.html
+ * Released under MIT License - this header must remain with code
+ */
+
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('$.1n=7(G,F){d G=G,F=F;g(1p(G)!==\'2d\')G=$(G)[0];g(1p(F)!==\'2d\')F={};g(!(\'2x\'1a F))F.2x=$.3d.3e?K:M;g(!(\'2c\'1a F))F.2c=$.3d.3e?K:M;d 4f={2x:K,3W:\'4C\',1f:4D,3T:\'4Y\',3x:.6,3O:.4,3P:.5,53:5,3N:9,3D:5,51:14,25:0,2c:M,3I:M,3B:M,30:M,3A:M,49:0,4p:0,4k:8,3V:20,3X:3,2f:K,3n:[0,0],2z:[0,0],2O:[0,0],2D:7(){},2G:7(){}};d j=4f;21(F);d $I=$(G).B({16:\'1b\'});47($I,j.49,j.4p);d S=$I.W(),L=$I.U(),$12=$(\'<12 />\').W(S).U(L).1f(1L(\'4F\')).B({16:\'4H\',4B:j.3T});g(j.1f)$12.1f(j.1f);$I.54($12);d $34=$(\'<I />\').3Y(\'2N\',$I.3Y(\'2N\')).B(\'16\',\'1b\').W(S).U(L);d $2C=$(\'<12 />\').W(1t(V)).U(1t(V)).B({1l:59,16:\'1b\',4o:\'4g\'}).1P($34);d $2g=$(\'<12 />\').W(1t(V)).U(1t(V)).B({1l:5b});d $28=$(\'<12 />\').B({16:\'1b\',1l:55}).3U($I).1P($2C,$2g);d 23=j.4k;d $1S=$(\'<12 />\').1f(1L(\'3v\')).W(S+(23*2)).U(L+(23*2)).B({16:\'1b\',R:D(-23),P:D(-23),1l:3R,1z:0}).3q(48);d 1I,1Q;d 2u=2Q(G),1q,1B,3i,58,3h,1O;g(\'36\'1a j){1I=j.36[0]/S;1Q=j.36[1]/L}d E=7(){d A=0,u=0,q=0,m=0,Z,Y;7 1A(z){d z=2T(z);q=A=z[0];m=u=z[1]};7 1y(z){d z=2T(z);Z=z[0]-q;Y=z[1]-m;q=z[0];m=z[1]};7 3f(){k[Z,Y]};7 2b(2y){d Z=2y[0],Y=2y[1];g(0>A+Z)Z-=Z+A;g(0>u+Y)Y-=Y+u;g(L<m+Y)Y+=L-(m+Y);g(S<q+Z)Z+=S-(q+Z);A+=Z;q+=Z;u+=Y;m+=Y};7 2K(T){d c=Q();1E(T){C\'1s\':k[c.q,c.y];C\'11\':k[c.x,c.y];C\'2e\':k[c.q,c.m];C\'1M\':k[c.x,c.m]}};7 Q(){g(!j.25&&!1B)k 3F();d 1k=j.25?j.25:1B,5c=j.2O,4u=j.2z,1V=q-A,1Z=m-u,3c=N.17(1V),3j=N.17(1Z),3M=3c/3j,15,13;g(3M<1k){13=m;w=3j*1k;15=1V<0?A-w:w+A;g(15<0){15=0;h=N.17((15-A)/1k);13=1Z<0?u-h:h+u}1g g(15>S){15=S;h=N.17((15-A)/1k);13=1Z<0?u-h:h+u}}1g{15=q;h=3c/1k;13=1Z<0?u-h:u+h;g(13<0){13=0;w=N.17((13-u)*1k);15=1V<0?A-w:w+A}1g g(13>L){13=L;w=N.17(13-u)*1k;15=1V<0?A-w:w+A}}k 4E=3g(1F(A,u,15,13))};7 2T(p){g(p[0]<0)p[0]=0;g(p[1]<0)p[1]=0;g(p[0]>S)p[0]=S;g(p[1]>L)p[1]=L;k[p[0],p[1]]};7 1F(A,u,q,m){d 2R=A,3r=q,3o=u,3l=m;g(q<A){2R=q;3r=A}g(m<u){3o=m;3l=u}k[N.1K(2R),N.1K(3o),N.1K(3r),N.1K(3l)]};7 3F(){d 1U=q-A;d 22=m-u;g(2q&&(N.17(1U)>2q))q=(1U>0)?(A+2q):(A-2q);g(2n&&(N.17(22)>2n))m=(22>0)?(u+2n):(u-2n);g(2i&&(N.17(22)<2i))m=(22>0)?(u+2i):(u-2i);g(2m&&(N.17(1U)<2m))q=(1U>0)?(A+2m):(A-2m);g(A<0){q-=A;A-=A}g(u<0){m-=u;u-=u}g(q<0){A-=q;q-=q}g(m<0){u-=m;m-=m}g(q>S){d X=q-S;A-=X;q-=X}g(m>L){d X=m-L;u-=X;m-=X}g(A>S){d X=A-L;m-=X;u-=X}g(u>L){d X=u-L;m-=X;u-=X}k 3g(1F(A,u,q,m))};7 3g(a){k{x:a[0],y:a[1],q:a[2],m:a[3],w:a[2]-a[0],h:a[3]-a[1]}};k{1F:1F,1A:1A,1y:1y,3f:3f,2b:2b,2K:2K,Q:Q}}();d J=7(){d 4v,4z,4y,1R,2U=4x;d 2F={};d H={};d 2E=K;d 1i=j.3D;g(j.30){2F={R:1Y(\'3C\').B(\'R\',$.3d.3e?D(-1):D(0)),3Q:1Y(\'3C\'),P:1Y(\'3z\'),3L:1Y(\'3z\')}}g(j.3A){H.t=1W(\'n\');H.b=1W(\'s\');H.r=1W(\'e\');H.l=1W(\'w\')}j.3B&&2Y([\'n\',\'s\',\'e\',\'w\']);j.3I&&2Y([\'1M\',\'11\',\'1s\',\'2e\']);7 1Y(1u){d 1J=$(\'<12 />\').B({16:\'1b\',1z:j.3O}).1f(1L(1u));$2C.1P(1J);k 1J};7 2W(T,3y){d 1J=$(\'<12 />\').3q(3b(T)).B({3p:T+\'-2A\',16:\'1b\',1l:3y});$2g.1P(1J);k 1J};7 3J(T){k 2W(T,2U++).B({R:D(-1i+1),P:D(-1i+1),1z:j.3P}).1f(1L(\'H\'))};7 1W(T){d s=j.3N,o=1i,h=s,w=s,t=o,l=o;1E(T){C\'n\':C\'s\':w=1t(V);O;C\'e\':C\'w\':h=1t(V);O}k 2W(T,2U++).W(w).U(h).B({R:D(-t+1),P:D(-l+1)})};7 2Y(2J){4U(i 1a 2J)H[2J[i]]=3J(2J[i])};7 31(c){d 3a=N.1K((c.h/2)-1i),35=N.1K((c.w/2)-1i),4V=4W=-1i+1,2a=c.w-1i,1X=c.h-1i,x,y;\'e\'1a H&&H.e.B({R:D(3a),P:D(2a)})&&H.w.B({R:D(3a)})&&H.s.B({R:D(1X),P:D(35)})&&H.n.B({P:D(35)});\'1s\'1a H&&H.1s.B({P:D(2a)})&&H.2e.B({R:D(1X),P:D(2a)})&&H.1M.B({R:D(1X)});\'b\'1a H&&H.b.B({R:D(1X)})&&H.r.B({P:D(2a)})};7 3K(x,y){$34.B({R:D(-y),P:D(-x)});$28.B({R:D(y),P:D(x)})};7 2A(w,h){$28.W(w).U(h)};7 3s(){d p=E.Q();E.1A([p.x,p.y]);E.1y([p.q,p.m])};7 2I(){g(1R)k 1e()};7 1e(){d c=E.Q();2A(c.w,c.h);3K(c.x,c.y);j.30&&2F[\'3L\'].B({P:D(c.w-1)})&&2F[\'3Q\'].B({R:D(c.h-1)});2E&&31(c);1R||1w();j.2D(2H(c))};7 1w(){$28.1w();$I.B(\'1z\',j.3x);1R=M};7 1r(){1o();$28.1v();$I.B(\'1z\',1);1R=K};7 1v(){1r();$I.B(\'1z\',1);1R=K};7 2t(){2E=M;31(E.Q());$2g.1w()};7 1o(){2E=K;$2g.1v()};7 2o(v){(3h=v)?1o():2t()};7 1h(){d c=E.Q();2o(K);3s()};1o();$2C.1P($(\'<12 />\').1f(1L(\'3v\')).3q(3b(\'1N\')).B({3p:\'1N\',16:\'1b\',1l:4M,1z:0}));k{2I:2I,1e:1e,1r:1r,1w:1w,1v:1v,2t:2t,1o:1o,2o:2o,1h:1h}}();d 1j=7(){d 2w=7(){},2v=7(){},2L=j.2x;g(!2L){$1S.3k(2B).2S(26).4N(26)}7 4j(){g(2L){$(3t).3k(2B).2S(26)}$1S.B({1l:4G})}7 4i(){g(2L){$(3t).3H(\'3k\',2B).3H(\'2S\',26)}$1S.B({1l:3R})}7 2B(e){2w(2r(e))};7 26(e){e.2j();e.2k();g(1q){1q=K;2v(2r(e));j.2G(2H(E.Q()));4i();2w=7(){};2v=7(){}}k K};7 1G(1N,1h){1q=M;2w=1N;2v=1h;4j();k K};7 1x(t){$1S.B(\'3p\',t)};$I.4s($1S);k{1G:1G,1x:1x}}();d 33=7(){d $24=$(\'<4w 1u="4L" />\').B({16:\'1b\',P:\'-4O\'}).57(43).56(2f).5a(41),$3S=$(\'<12 />\').B({16:\'1b\',4o:\'4g\'}).1P($24);7 2l(){g(j.2c){$24.1w();$24.4Z()}};7 41(e){$24.1v()};7 2f(e){g(!j.2f)k;d 42=1O,1C;1O=e.4Q?M:K;g(42!=1O){g(1O&&1q){1C=E.Q();1B=1C.w/1C.h}1g 1B=0;J.1e()}e.2k();e.2j();k K};7 29(e,x,y){E.2b([x,y]);J.2I();e.2j();e.2k()};7 43(e){g(e.4T)k M;2f(e);d 2h=1O?10:1;1E(e.5d){C 37:29(e,-2h,0);O;C 39:29(e,2h,0);O;C 38:29(e,0,-2h);O;C 40:29(e,0,2h);O;C 27:J.1r();O;C 9:k M}k K};g(j.2c)$3S.3U($I);k{2l:2l}}();7 D(n){k\'\'+1m(n)+\'D\'};7 1t(n){k\'\'+1m(n)+\'%\'};7 1L(44){k j.3W+\'-\'+44};7 2Q(G){d z=$(G).2y();k[z.P,z.R]};7 2r(e){k[(e.4q-2u[0]),(e.4r-2u[1])]};7 46(1u){g(1u!=3i){1j.1x(1u);3i=1u}};7 4a(19,z){2u=2Q(G);1j.1x(19==\'1N\'?19:19+\'-2A\');g(19==\'1N\')k 1j.1G(4e(z),2P);d 1C=E.Q();E.1A(E.2K(4b(19)));1j.1G(45(19,1C),2P)};7 45(19,f){k 7(z){g(!j.25&&!1B)1E(19){C\'e\':z[1]=f.m;O;C\'w\':z[1]=f.m;O;C\'n\':z[0]=f.q;O;C\'s\':z[0]=f.q;O}1g 1E(19){C\'e\':z[1]=f.y+1;O;C\'w\':z[1]=f.y+1;O;C\'n\':z[0]=f.x+1;O;C\'s\':z[0]=f.x+1;O}E.1y(z);J.1e()}};7 4e(z){d 2M=z;33.2l();k 7(z){E.2b([z[0]-2M[0],z[1]-2M[1]]);2M=z;J.1e()}};7 4b(T){1E(T){C\'n\':k\'1M\';C\'s\':k\'11\';C\'e\':k\'11\';C\'w\':k\'1s\';C\'1s\':k\'1M\';C\'11\':k\'2e\';C\'2e\':k\'11\';C\'1M\':k\'1s\'}};7 3b(T){k 7(e){1q=M;4a(T,2r(e));e.2k();e.2j();k K}};7 47($G,w,h){d 11=$G.W(),1H=$G.U();g((11>w)&&w>0){11=w;1H=(w/$G.W())*$G.U()}g((1H>h)&&h>0){1H=h;11=(h/$G.U())*$G.W()}1I=$G.W()/11;1Q=$G.U()/1H;$G.W(11).U(1H)};7 2H(c){k{x:1m(c.x*1I),y:1m(c.y*1Q),q:1m(c.q*1I),m:1m(c.m*1Q),w:1m(c.w*1I),h:1m(c.h*1Q)}};7 2P(z){d c=E.Q();g(c.w>j.3n[0]&&c.h>j.3n[1]){J.2t();J.1h()}1g{J.1r()}1j.1x(\'2X\')};7 48(e){1q=M;2u=2Q(G);J.1r();J.1o();46(\'2X\');E.1A(2r(e));1j.1G(4c,2P);33.2l();e.2k();e.2j();k K};7 4c(z){E.1y(z);J.1e()};7 2Z(a){d A=a[0],u=a[1],q=a[2],m=a[3];g(3h)k;d 2s=E.1F(A,u,q,m);d c=E.Q();d 18=2p=[c.x,c.y,c.q,c.m];d 3w=j.3V;d x=18[0];d y=18[1];d q=18[2];d m=18[3];d 3Z=2s[0]-2p[0];d 4m=2s[1]-2p[1];d 4n=2s[2]-2p[2];d 4l=2s[3]-2p[3];d 1c=0;d 4h=j.3X;J.2o(M);d 3u=7(){k 7(){1c+=(V-1c)/4h;18[0]=x+((1c/V)*3Z);18[1]=y+((1c/V)*4m);18[2]=q+((1c/V)*4n);18[3]=m+((1c/V)*4l);g(1c<V)32();1g J.1h();g(1c>=4K.8)1c=V;1d(18)}}();7 32(){4I.4t(3u,3w)};32()};7 1d(l){E.1A([l[0],l[1]]);E.1y([l[2],l[3]]);J.1e()};7 21(F){g(1p(F)!=\'2d\')F={};j=$.4X(j,F);g(1p(j.2D)!==\'7\')j.2D=7(){};g(1p(j.2G)!==\'7\')j.2G=7(){}};7 3m(){k 2H(E.Q())};7 2V(){k E.Q()};7 3E(F){21(F);g(\'1d\'1a F){1d(F.1d);J.1h()}};g(1p(F)!=\'2d\')F={};g(\'1d\'1a F){1d(F.1d);J.1h()}d 2q=j.2z[0]||0;d 2n=j.2z[1]||0;d 2m=j.2O[0]||0;d 2i=j.2O[1]||0;1j.1x(\'2X\');k{2Z:2Z,1d:1d,21:3E,3m:3m,2V:2V}};$.5e.1n=7(j){7 3G(1D){d 4d=j.4R||1D.2N;d I=4P 4S();d 1D=1D;I.50=7(){$(1D).1v().4A(I);1D.1n=$.1n(I,j)};I.2N=4d};g(1p(j)!==\'2d\')j={};1T.4J(7(){g(\'1n\'1a 1T){g(j==\'52\')k 1T.1n;1g 1T.1n.21(j)}1g 3G(1T)});k 1T};',62,325,'|||||||function||||||var|||if|||options|return||y2||||x2||||y1|||||pos|x1|css|case|px|Coords|opt|obj|handle|img|Selection|false|boundy|true|Math|break|left|getFixed|top|boundx|ord|height|100|width|delta|oy|ox||nw|div|yy||xx|position|abs|animat|mode|in|absolute|pcent|setSelect|update|addClass|else|done|hhs|Tracker|aspect|zIndex|parseInt|Jcrop|disableHandles|typeof|btndown|release|ne|pct|type|hide|show|setCursor|setCurrent|opacity|setPressed|aspectLock|fc|from|switch|flipCoords|activateHandlers|nh|xscale|jq|round|cssClass|sw|move|shift_down|append|yscale|awake|trk|this|xsize|rw|insertDragbar|south|insertBorder|rh||setOptions|ysize|bound|keymgr|aspectRatio|trackUp||sel|doNudge|east|moveOffset|keySupport|object|se|watchShift|hdl_holder|nudge|ymin|preventDefault|stopPropagation|watchKeys|xmin|ylimit|animMode|initcr|xlimit|mouseAbs|animto|enableHandles|docOffset|onDone|onMove|trackDocument|offset|maxSize|resize|trackMove|img_holder|onChange|seehandles|borders|onSelect|unscale|updateVisible|li|getCorner|trackDoc|lloc|src|minSize|doneSelect|getPos|xa|mouseup|rebound|hdep|tellScaled|dragDiv|crosshair|createHandles|animateTo|drawBorders|moveHandles|animateStart|KeyManager|img2|midhoriz|trueSize||||midvert|createDragger|rwa|browser|msie|getOffset|makeObj|animating|lastcurs|rha|mousemove|yb|tellSelect|minSelect|ya|cursor|mousedown|xb|refresh|document|animator|tracker|interv|bgOpacity|zi|vline|dragEdges|sideHandles|hline|handleOffset|setOptionsNew|getRect|attachWhenDone|unbind|cornerHandles|insertHandle|moveto|right|real_ratio|handleSize|borderOpacity|handleOpacity|bottom|290|keywrap|bgColor|insertBefore|animationDelay|baseClass|swingSpeed|attr|ix1||onBlur|init_shift|parseKey|cl|dragmodeHandler|myCursor|presize|newSelection|boxWidth|startDragMode|oppLockCorner|selectDrag|loadsrc|createMover|defaults|hidden|velocity|toBack|toFront|boundary|iy2|iy1|ix2|overflow|boxHeight|pageX|pageY|before|setTimeout|max|start|input|370|dragmode|end|after|backgroundColor|jcrop|null|last|holder|450|relative|window|each|99|radio|360|mouseout|30px|new|shiftKey|useImg|Image|ctrlKey|for|north|west|extend|black|focus|onload|edgeMargin|api|handlePad|wrap|300|keyup|keydown|dimmed|310|blur|320|min|keyCode|fn'.split('|'),0,{}))
index 88e661eec806dc61eb5dfbd08fd0bae8343f96be..fc06ace272de81b7c91a19439523c47d722feb32 100644 (file)
@@ -1,34 +1,36 @@
-(function(){
-/*
- * jQuery 1.2.6 - New Wave Javascript
+/*!
+ * jQuery JavaScript Library v1.3
+ * http://jquery.com/
  *
- * Copyright (c) 2008 John Resig (jquery.com)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright (c) 2009 John Resig
+ * Dual licensed under the MIT and GPL licenses.
+ * http://docs.jquery.com/License
  *
- * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
- * $Rev: 5685 $
+ * Date: 2009-01-13 12:50:31 -0500 (Tue, 13 Jan 2009)
+ * Revision: 6104
  */
+(function(){
 
-// Map over jQuery in case of overwrite
-var _jQuery = window.jQuery,
-// Map over the $ in case of overwrite
-       _$ = window.$;
-
-var jQuery = window.jQuery = window.$ = function( selector, context ) {
-       // The jQuery object is actually just the init constructor 'enhanced'
-       return new jQuery.fn.init( selector, context );
-};
-
-// A simple way to check for HTML strings or ID strings
-// (both of which we optimize for)
-var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,
-
-// Is it a simple selector
-       isSimple = /^.[^:#\[\.]*$/,
+var 
+       // Will speed up references to window, and allows munging its name.
+       window = this,
+       // Will speed up references to undefined, and allows munging its name.
+       undefined,
+       // Map over jQuery in case of overwrite
+       _jQuery = window.jQuery,
+       // Map over the $ in case of overwrite
+       _$ = window.$,
+
+       jQuery = window.jQuery = window.$ = function( selector, context ) {
+               // The jQuery object is actually just the init constructor 'enhanced'
+               return new jQuery.fn.init( selector, context );
+       },
 
-// Will speed up references to undefined, and allows munging its name.
-       undefined;
+       // A simple way to check for HTML strings or ID strings
+       // (both of which we optimize for)
+       quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
+       // Is it a simple selector
+       isSimple = /^.[^:#\[\.,]*$/;
 
 jQuery.fn = jQuery.prototype = {
        init: function( selector, context ) {
@@ -39,10 +41,11 @@ jQuery.fn = jQuery.prototype = {
                if ( selector.nodeType ) {
                        this[0] = selector;
                        this.length = 1;
+                       this.context = selector;
                        return this;
                }
                // Handle HTML strings
-               if ( typeof selector == "string" ) {
+               if ( typeof selector === "string" ) {
                        // Are we dealing with HTML string or an ID?
                        var match = quickExpr.exec( selector );
 
@@ -65,7 +68,10 @@ jQuery.fn = jQuery.prototype = {
                                                        return jQuery().find( selector );
 
                                                // Otherwise, we inject the element directly into the jQuery object
-                                               return jQuery( elem );
+                                               var ret = jQuery( elem );
+                                               ret.context = document;
+                                               ret.selector = selector;
+                                               return ret;
                                        }
                                        selector = [];
                                }
@@ -78,26 +84,32 @@ jQuery.fn = jQuery.prototype = {
                // HANDLE: $(function)
                // Shortcut for document ready
                } else if ( jQuery.isFunction( selector ) )
-                       return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );
+                       return jQuery( document ).ready( selector );
+
+               // Make sure that old selector state is passed along
+               if ( selector.selector && selector.context ) {
+                       this.selector = selector.selector;
+                       this.context = selector.context;
+               }
 
                return this.setArray(jQuery.makeArray(selector));
        },
 
+       // Start with an empty selector
+       selector: "",
+
        // The current version of jQuery being used
-       jquery: "1.2.6",
+       jquery: "1.3",
 
        // The number of elements contained in the matched element set
        size: function() {
                return this.length;
        },
 
-       // The number of elements contained in the matched element set
-       length: 0,
-
        // Get the Nth element in the matched element set OR
        // Get the whole matched element set as a clean array
        get: function( num ) {
-               return num == undefined ?
+               return num === undefined ?
 
                        // Return a 'clean' array
                        jQuery.makeArray( this ) :
@@ -108,13 +120,20 @@ jQuery.fn = jQuery.prototype = {
 
        // Take an array of elements and push it onto the stack
        // (returning the new matched element set)
-       pushStack: function( elems ) {
+       pushStack: function( elems, name, selector ) {
                // Build a new jQuery matched element set
                var ret = jQuery( elems );
 
                // Add the old object onto the stack (as a reference)
                ret.prevObject = this;
 
+               ret.context = this.context;
+
+               if ( name === "find" )
+                       ret.selector = this.selector + (this.selector ? " " : "") + selector;
+               else if ( name )
+                       ret.selector = this.selector + "." + name + "(" + selector + ")";
+
                // Return the newly-formed element set
                return ret;
        },
@@ -141,8 +160,6 @@ jQuery.fn = jQuery.prototype = {
        // Determine the position of an element within
        // the matched set of elements
        index: function( elem ) {
-               var ret = -1;
-
                // Locate the position of the desired element
                return jQuery.inArray(
                        // If it receives a jQuery object, the first element is used
@@ -154,7 +171,7 @@ jQuery.fn = jQuery.prototype = {
                var options = name;
 
                // Look for the case where we're accessing a style value
-               if ( name.constructor == String )
+               if ( typeof name === "string" )
                        if ( value === undefined )
                                return this[0] && jQuery[ type || "attr" ]( this[0], name );
 
@@ -184,7 +201,7 @@ jQuery.fn = jQuery.prototype = {
        },
 
        text: function( text ) {
-               if ( typeof text != "object" && text != null )
+               if ( typeof text !== "object" && text != null )
                        return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
 
                var ret = "";
@@ -202,20 +219,22 @@ jQuery.fn = jQuery.prototype = {
        },
 
        wrapAll: function( html ) {
-               if ( this[0] )
+               if ( this[0] ) {
                        // The elements to wrap the target around
-                       jQuery( html, this[0].ownerDocument )
-                               .clone()
-                               .insertBefore( this[0] )
-                               .map(function(){
-                                       var elem = this;
+                       var wrap = jQuery( html, this[0].ownerDocument ).clone();
+
+                       if ( this[0].parentNode )
+                               wrap.insertBefore( this[0] );
 
-                                       while ( elem.firstChild )
-                                               elem = elem.firstChild;
+                       wrap.map(function(){
+                               var elem = this;
 
-                                       return elem;
-                               })
-                               .append(this);
+                               while ( elem.firstChild )
+                                       elem = elem.firstChild;
+
+                               return elem;
+                       }).append(this);
+               }
 
                return this;
        },
@@ -233,27 +252,27 @@ jQuery.fn = jQuery.prototype = {
        },
 
        append: function() {
-               return this.domManip(arguments, true, false, function(elem){
+               return this.domManip(arguments, true, function(elem){
                        if (this.nodeType == 1)
                                this.appendChild( elem );
                });
        },
 
        prepend: function() {
-               return this.domManip(arguments, true, true, function(elem){
+               return this.domManip(arguments, true, function(elem){
                        if (this.nodeType == 1)
                                this.insertBefore( elem, this.firstChild );
                });
        },
 
        before: function() {
-               return this.domManip(arguments, false, false, function(elem){
+               return this.domManip(arguments, false, function(elem){
                        this.parentNode.insertBefore( elem, this );
                });
        },
 
        after: function() {
-               return this.domManip(arguments, false, true, function(elem){
+               return this.domManip(arguments, false, function(elem){
                        this.parentNode.insertBefore( elem, this.nextSibling );
                });
        },
@@ -262,20 +281,31 @@ jQuery.fn = jQuery.prototype = {
                return this.prevObject || jQuery( [] );
        },
 
+       // For internal use only.
+       // Behaves like an Array's .push method, not like a jQuery method.
+       push: [].push,
+
        find: function( selector ) {
-               var elems = jQuery.map(this, function(elem){
-                       return jQuery.find( selector, elem );
-               });
+               if ( this.length === 1 && !/,/.test(selector) ) {
+                       var ret = this.pushStack( [], "find", selector );
+                       ret.length = 0;
+                       jQuery.find( selector, this[0], ret );
+                       return ret;
+               } else {
+                       var elems = jQuery.map(this, function(elem){
+                               return jQuery.find( selector, elem );
+                       });
 
-               return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ?
-                       jQuery.unique( elems ) :
-                       elems );
+                       return this.pushStack( /[^+>] [^+>]/.test( selector ) ?
+                               jQuery.unique( elems ) :
+                               elems, "find", selector );
+               }
        },
 
        clone: function( events ) {
                // Do the clone
                var ret = this.map(function(){
-                       if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) {
+                       if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
                                // IE copies events bound via attachEvent when
                                // using cloneNode. Calling detachEvent on the
                                // clone will also remove the events from the orignal
@@ -296,7 +326,7 @@ jQuery.fn = jQuery.prototype = {
                // removeData doesn't work here, IE removes it from the original as well
                // this is primarily for IE but the data expando shouldn't be copied over in any browser
                var clone = ret.find("*").andSelf().each(function(){
-                       if ( this[ expando ] != undefined )
+                       if ( this[ expando ] !== undefined )
                                this[ expando ] = null;
                });
 
@@ -323,14 +353,29 @@ jQuery.fn = jQuery.prototype = {
                                return selector.call( elem, i );
                        }) ||
 
-                       jQuery.multiFilter( selector, this ) );
+                       jQuery.multiFilter( selector, jQuery.grep(this, function(elem){
+                               return elem.nodeType === 1;
+                       }) ), "filter", selector );
+       },
+
+       closest: function( selector ) {
+               var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null;
+
+               return this.map(function(){
+                       var cur = this;
+                       while ( cur && cur.ownerDocument ) {
+                               if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) )
+                                       return cur;
+                               cur = cur.parentNode;
+                       }
+               });
        },
 
        not: function( selector ) {
-               if ( selector.constructor == String )
+               if ( typeof selector === "string" )
                        // test special case where just one selector is passed in
                        if ( isSimple.test( selector ) )
-                               return this.pushStack( jQuery.multiFilter( selector, this, true ) );
+                               return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector );
                        else
                                selector = jQuery.multiFilter( selector, this );
 
@@ -343,7 +388,7 @@ jQuery.fn = jQuery.prototype = {
        add: function( selector ) {
                return this.pushStack( jQuery.unique( jQuery.merge(
                        this.get(),
-                       typeof selector == 'string' ?
+                       typeof selector === "string" ?
                                jQuery( selector ) :
                                jQuery.makeArray( selector )
                )));
@@ -354,15 +399,17 @@ jQuery.fn = jQuery.prototype = {
        },
 
        hasClass: function( selector ) {
-               return this.is( "." + selector );
+               return !!selector && this.is( "." + selector );
        },
 
        val: function( value ) {
-               if ( value == undefined ) {
-
-                       if ( this.length ) {
-                               var elem = this[0];
+               if ( value === undefined ) {                    
+                       var elem = this[0];
 
+                       if ( elem ) {
+                               if( jQuery.nodeName( elem, 'option' ) )
+                                       return (elem.attributes.value || {}).specified ? elem.value : elem.text;
+                               
                                // We need to handle select boxes special
                                if ( jQuery.nodeName( elem, "select" ) ) {
                                        var index = elem.selectedIndex,
@@ -380,7 +427,7 @@ jQuery.fn = jQuery.prototype = {
 
                                                if ( option.selected ) {
                                                        // Get the specifc value for the option
-                                                       value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;
+                                                       value = jQuery(option).val();
 
                                                        // We don't need an array for one selects
                                                        if ( one )
@@ -391,25 +438,25 @@ jQuery.fn = jQuery.prototype = {
                                                }
                                        }
 
-                                       return values;
+                                       return values;                          
+                               }
 
                                // Everything else, we just grab the value
-                               } else
-                                       return (this[0].value || "").replace(/\r/g, "");
+                               return (elem.value || "").replace(/\r/g, "");
 
                        }
 
                        return undefined;
                }
 
-               if( value.constructor == Number )
+               if ( typeof value === "number" )
                        value += '';
 
                return this.each(function(){
                        if ( this.nodeType != 1 )
                                return;
 
-                       if ( value.constructor == Array && /radio|checkbox/.test( this.type ) )
+                       if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) )
                                this.checked = (jQuery.inArray(this.value, value) >= 0 ||
                                        jQuery.inArray(this.name, value) >= 0);
 
@@ -430,7 +477,7 @@ jQuery.fn = jQuery.prototype = {
        },
 
        html: function( value ) {
-               return value == undefined ?
+               return value === undefined ?
                        (this[0] ?
                                this[0].innerHTML :
                                null) :
@@ -442,11 +489,12 @@ jQuery.fn = jQuery.prototype = {
        },
 
        eq: function( i ) {
-               return this.slice( i, i + 1 );
+               return this.slice( i, +i + 1 );
        },
 
        slice: function() {
-               return this.pushStack( Array.prototype.slice.apply( this, arguments ) );
+               return this.pushStack( Array.prototype.slice.apply( this, arguments ),
+                       "slice", Array.prototype.slice.call(arguments).join(",") );
        },
 
        map: function( callback ) {
@@ -459,69 +507,29 @@ jQuery.fn = jQuery.prototype = {
                return this.add( this.prevObject );
        },
 
-       data: function( key, value ){
-               var parts = key.split(".");
-               parts[1] = parts[1] ? "." + parts[1] : "";
-
-               if ( value === undefined ) {
-                       var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
-
-                       if ( data === undefined && this.length )
-                               data = jQuery.data( this[0], key );
-
-                       return data === undefined && parts[1] ?
-                               this.data( parts[0] ) :
-                               data;
-               } else
-                       return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
-                               jQuery.data( this, key, value );
-                       });
-       },
-
-       removeData: function( key ){
-               return this.each(function(){
-                       jQuery.removeData( this, key );
-               });
-       },
-
-       domManip: function( args, table, reverse, callback ) {
-               var clone = this.length > 1, elems;
-
-               return this.each(function(){
-                       if ( !elems ) {
-                               elems = jQuery.clean( args, this.ownerDocument );
-
-                               if ( reverse )
-                                       elems.reverse();
-                       }
-
-                       var obj = this;
-
-                       if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) )
-                               obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") );
-
-                       var scripts = jQuery( [] );
-
-                       jQuery.each(elems, function(){
-                               var elem = clone ?
-                                       jQuery( this ).clone( true )[0] :
-                                       this;
-
-                               // execute all scripts after the elements have been injected
-                               if ( jQuery.nodeName( elem, "script" ) )
-                                       scripts = scripts.add( elem );
-                               else {
-                                       // Remove any inner scripts for later evaluation
-                                       if ( elem.nodeType == 1 )
-                                               scripts = scripts.add( jQuery( "script", elem ).remove() );
-
-                                       // Inject the elements into the document
-                                       callback.call( obj, elem );
-                               }
-                       });
+       domManip: function( args, table, callback ) {
+               if ( this[0] ) {
+                       var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(),
+                               scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ),
+                               first = fragment.firstChild,
+                               extra = this.length > 1 ? fragment.cloneNode(true) : fragment;
+
+                       if ( first )
+                               for ( var i = 0, l = this.length; i < l; i++ )
+                                       callback.call( root(this[i], first), i > 0 ? extra.cloneNode(true) : fragment );
+                       
+                       if ( scripts )
+                               jQuery.each( scripts, evalScript );
+               }
 
-                       scripts.each( evalScript );
-               });
+               return this;
+               
+               function root( elem, cur ) {
+                       return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ?
+                               (elem.getElementsByTagName("tbody")[0] ||
+                               elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
+                               elem;
+               }
        }
 };
 
@@ -552,7 +560,7 @@ jQuery.extend = jQuery.fn.extend = function() {
        var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
 
        // Handle a deep copy situation
-       if ( target.constructor == Boolean ) {
+       if ( typeof target === "boolean" ) {
                deep = target;
                target = arguments[1] || {};
                // skip the boolean and the target
@@ -560,7 +568,7 @@ jQuery.extend = jQuery.fn.extend = function() {
        }
 
        // Handle case when target is a string or something (possible in deep copy)
-       if ( typeof target != "object" && typeof target != "function" )
+       if ( typeof target !== "object" && !jQuery.isFunction(target) )
                target = {};
 
        // extend jQuery itself if only one argument is passed
@@ -581,7 +589,7 @@ jQuery.extend = jQuery.fn.extend = function() {
                                        continue;
 
                                // Recurse if we're merging object values
-                               if ( deep && copy && typeof copy == "object" && !copy.nodeType )
+                               if ( deep && copy && typeof copy === "object" && !copy.nodeType )
                                        target[ name ] = jQuery.extend( deep, 
                                                // Never move original objects, clone them
                                                src || ( copy.length != null ? [ ] : { } )
@@ -597,11 +605,11 @@ jQuery.extend = jQuery.fn.extend = function() {
        return target;
 };
 
-var expando = "jQuery" + now(), uuid = 0, windowData = {},
-       // exclude the following css properties to add px
-       exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
+// exclude the following css properties to add px
+var    exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
        // cache defaultView
-       defaultView = document.defaultView || {};
+       defaultView = document.defaultView || {},
+       toString = Object.prototype.toString;
 
 jQuery.extend({
        noConflict: function( deep ) {
@@ -613,10 +621,15 @@ jQuery.extend({
                return jQuery;
        },
 
-       // See test/unit/core.js for details concerning this function.
-       isFunction: function( fn ) {
-               return !!fn && typeof fn != "string" && !fn.nodeName &&
-                       fn.constructor != Array && /^[\s[]?function/.test( fn + "" );
+       // See test/unit/core.js for details concerning isFunction.
+       // Since version 1.3, DOM methods and functions like alert
+       // aren't supported. They return false on IE (#2968).
+       isFunction: function( obj ) {
+               return toString.call(obj) === "[object Function]";
+       },
+
+       isArray: function( obj ) {
+               return toString.call(obj) === "[object Array]";
        },
 
        // check if an element is in a (or is an) XML document
@@ -636,10 +649,10 @@ jQuery.extend({
                                script = document.createElement("script");
 
                        script.type = "text/javascript";
-                       if ( jQuery.browser.msie )
-                               script.text = data;
-                       else
+                       if ( jQuery.support.scriptEval )
                                script.appendChild( document.createTextNode( data ) );
+                       else
+                               script.text = data;
 
                        // Use insertBefore instead of appendChild  to circumvent an IE6 bug.
                        // This arises when a base node is used (#2709).
@@ -652,80 +665,12 @@ jQuery.extend({
                return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
        },
 
-       cache: {},
-
-       data: function( elem, name, data ) {
-               elem = elem == window ?
-                       windowData :
-                       elem;
-
-               var id = elem[ expando ];
-
-               // Compute a unique ID for the element
-               if ( !id )
-                       id = elem[ expando ] = ++uuid;
-
-               // Only generate the data cache if we're
-               // trying to access or manipulate it
-               if ( name && !jQuery.cache[ id ] )
-                       jQuery.cache[ id ] = {};
-
-               // Prevent overriding the named cache with undefined values
-               if ( data !== undefined )
-                       jQuery.cache[ id ][ name ] = data;
-
-               // Return the named cache data, or the ID for the element
-               return name ?
-                       jQuery.cache[ id ][ name ] :
-                       id;
-       },
-
-       removeData: function( elem, name ) {
-               elem = elem == window ?
-                       windowData :
-                       elem;
-
-               var id = elem[ expando ];
-
-               // If we want to remove a specific section of the element's data
-               if ( name ) {
-                       if ( jQuery.cache[ id ] ) {
-                               // Remove the section of cache data
-                               delete jQuery.cache[ id ][ name ];
-
-                               // If we've removed all the data, remove the element's cache
-                               name = "";
-
-                               for ( name in jQuery.cache[ id ] )
-                                       break;
-
-                               if ( !name )
-                                       jQuery.removeData( elem );
-                       }
-
-               // Otherwise, we want to remove all of the element's data
-               } else {
-                       // Clean up the element expando
-                       try {
-                               delete elem[ expando ];
-                       } catch(e){
-                               // IE has trouble directly removing the expando
-                               // but it's ok with using removeAttribute
-                               if ( elem.removeAttribute )
-                                       elem.removeAttribute( expando );
-                       }
-
-                       // Completely remove the data cache
-                       delete jQuery.cache[ id ];
-               }
-       },
-
        // args is for internal usage only
        each: function( object, callback, args ) {
                var name, i = 0, length = object.length;
 
                if ( args ) {
-                       if ( length == undefined ) {
+                       if ( length === undefined ) {
                                for ( name in object )
                                        if ( callback.apply( object[ name ], args ) === false )
                                                break;
@@ -736,7 +681,7 @@ jQuery.extend({
 
                // A special, fast, case for the most common use of each
                } else {
-                       if ( length == undefined ) {
+                       if ( length === undefined ) {
                                for ( name in object )
                                        if ( callback.call( object[ name ], name, object[ name ] ) === false )
                                                break;
@@ -754,7 +699,7 @@ jQuery.extend({
                        value = value.call( elem, i );
 
                // Handle passing in a number to a CSS property
-               return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ?
+               return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ?
                        value + "px" :
                        value;
        },
@@ -771,7 +716,7 @@ jQuery.extend({
                // internal only, use removeClass("class")
                remove: function( elem, classNames ) {
                        if (elem.nodeType == 1)
-                               elem.className = classNames != undefined ?
+                               elem.className = classNames !== undefined ?
                                        jQuery.grep(elem.className.split(/\s+/), function(className){
                                                return !jQuery.className.has( classNames, className );
                                        }).join(" ") :
@@ -828,30 +773,14 @@ jQuery.extend({
        curCSS: function( elem, name, force ) {
                var ret, style = elem.style;
 
-               // A helper method for determining if an element's values are broken
-               function color( elem ) {
-                       if ( !jQuery.browser.safari )
-                               return false;
-
-                       // defaultView is cached
-                       var ret = defaultView.getComputedStyle( elem, null );
-                       return !ret || ret.getPropertyValue("color") == "";
-               }
-
                // We need to handle opacity special in IE
-               if ( name == "opacity" && jQuery.browser.msie ) {
+               if ( name == "opacity" && !jQuery.support.opacity ) {
                        ret = jQuery.attr( style, "opacity" );
 
                        return ret == "" ?
                                "1" :
                                ret;
                }
-               // Opera sometimes will give the wrong display answer, this fixes it, see #2037
-               if ( jQuery.browser.opera && name == "display" ) {
-                       var save = style.outline;
-                       style.outline = "0 solid black";
-                       style.outline = save;
-               }
 
                // Make sure we're using the right name for getting the float value
                if ( name.match( /float/i ) )
@@ -870,38 +799,9 @@ jQuery.extend({
 
                        var computedStyle = defaultView.getComputedStyle( elem, null );
 
-                       if ( computedStyle && !color( elem ) )
+                       if ( computedStyle )
                                ret = computedStyle.getPropertyValue( name );
 
-                       // If the element isn't reporting its values properly in Safari
-                       // then some display: none elements are involved
-                       else {
-                               var swap = [], stack = [], a = elem, i = 0;
-
-                               // Locate all of the parent display: none elements
-                               for ( ; a && color(a); a = a.parentNode )
-                                       stack.unshift(a);
-
-                               // Go through and make them visible, but in reverse
-                               // (It would be better if we knew the exact display type that they had)
-                               for ( ; i < stack.length; i++ )
-                                       if ( color( stack[ i ] ) ) {
-                                               swap[ i ] = stack[ i ].style.display;
-                                               stack[ i ].style.display = "block";
-                                       }
-
-                               // Since we flip the display style, we have to handle that
-                               // one special, otherwise get the value
-                               ret = name == "display" && swap[ stack.length - 1 ] != null ?
-                                       "none" :
-                                       ( computedStyle && computedStyle.getPropertyValue( name ) ) || "";
-
-                               // Finally, revert the display styles back
-                               for ( i = 0; i < swap.length; i++ )
-                                       if ( swap[ i ] != null )
-                                               stack[ i ].style.display = swap[ i ];
-                       }
-
                        // We should always get a number back from opacity
                        if ( name == "opacity" && ret == "" )
                                ret = "1";
@@ -936,22 +836,32 @@ jQuery.extend({
                return ret;
        },
 
-       clean: function( elems, context ) {
-               var ret = [];
+       clean: function( elems, context, fragment ) {
                context = context || document;
+
                // !context.createElement fails in IE with an error but returns typeof 'object'
-               if (typeof context.createElement == 'undefined')
+               if ( typeof context.createElement === "undefined" )
                        context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
 
+               // If a single string is passed in and it's a single tag
+               // just do a createElement and skip the rest
+               if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) {
+                       var match = /^<(\w+)\s*\/?>$/.exec(elems[0]);
+                       if ( match )
+                               return [ context.createElement( match[1] ) ];
+               }
+
+               var ret = [], scripts = [], div = context.createElement("div");
+
                jQuery.each(elems, function(i, elem){
+                       if ( typeof elem === "number" )
+                               elem += '';
+
                        if ( !elem )
                                return;
 
-                       if ( elem.constructor == Number )
-                               elem += '';
-
                        // Convert html string into DOM nodes
-                       if ( typeof elem == "string" ) {
+                       if ( typeof elem === "string" ) {
                                // Fix "XHTML"-style tags in all browsers
                                elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
                                        return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
@@ -960,7 +870,7 @@ jQuery.extend({
                                });
 
                                // Trim whitespace, otherwise indexOf won't work as expected
-                               var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div");
+                               var tags = jQuery.trim( elem ).toLowerCase();
 
                                var wrap =
                                        // option or optgroup
@@ -984,7 +894,7 @@ jQuery.extend({
                                        [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
 
                                        // IE can't serialize <link> and <script> tags normally
-                                       jQuery.browser.msie &&
+                                       !jQuery.support.htmlSerialize &&
                                        [ 1, "div<div>", "</div>" ] ||
 
                                        [ 0, "", "" ];
@@ -997,7 +907,7 @@ jQuery.extend({
                                        div = div.lastChild;
 
                                // Remove IE's autoinserted <tbody> from table fragments
-                               if ( jQuery.browser.msie ) {
+                               if ( !jQuery.support.tbody ) {
 
                                        // String was a <table>, *may* have spurious <tbody>
                                        var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ?
@@ -1012,26 +922,36 @@ jQuery.extend({
                                                if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
                                                        tbody[ j ].parentNode.removeChild( tbody[ j ] );
 
-                                       // IE completely kills leading whitespace when innerHTML is used
-                                       if ( /^\s/.test( elem ) )
-                                               div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
-
-                               }
+                                       }
 
+                               // IE completely kills leading whitespace when innerHTML is used
+                               if ( !jQuery.support.leadingWhitespace && /^\s/.test( elem ) )
+                                       div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
+                               
                                elem = jQuery.makeArray( div.childNodes );
                        }
 
-                       if ( elem.length === 0 && (!jQuery.nodeName( elem, "form" ) && !jQuery.nodeName( elem, "select" )) )
-                               return;
-
-                       if ( elem[0] == undefined || jQuery.nodeName( elem, "form" ) || elem.options )
+                       if ( elem.nodeType )
                                ret.push( elem );
-
                        else
                                ret = jQuery.merge( ret, elem );
 
                });
 
+               if ( fragment ) {
+                       for ( var i = 0; ret[i]; i++ ) {
+                               if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
+                                       scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
+                               } else {
+                                       if ( ret[i].nodeType === 1 )
+                                               ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
+                                       fragment.appendChild( ret[i] );
+                               }
+                       }
+                       
+                       return scripts;
+               }
+
                return ret;
        },
 
@@ -1042,8 +962,7 @@ jQuery.extend({
 
                var notxml = !jQuery.isXMLDoc( elem ),
                        // Whether we are setting (or getting)
-                       set = value !== undefined,
-                       msie = jQuery.browser.msie;
+                       set = value !== undefined;
 
                // Try to normalize/fix the name
                name = notxml && jQuery.props[ name ] || name;
@@ -1057,7 +976,7 @@ jQuery.extend({
 
                        // Safari mis-reports the default selected property of a hidden option
                        // Accessing the parent's selectedIndex property fixes it
-                       if ( name == "selected" && jQuery.browser.safari )
+                       if ( name == "selected" && elem.parentNode )
                                elem.parentNode.selectedIndex;
 
                        // If applicable, access the attribute via the DOM 0 way
@@ -1074,17 +993,28 @@ jQuery.extend({
                                if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
                                        return elem.getAttributeNode( name ).nodeValue;
 
+                               // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
+                               // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
+                               if ( name == "tabIndex" ) {
+                                       var attributeNode = elem.getAttributeNode( "tabIndex" );
+                                       return attributeNode && attributeNode.specified
+                                               ? attributeNode.value
+                                               : elem.nodeName.match(/^(a|area|button|input|object|select|textarea)$/i)
+                                                       ? 0
+                                                       : undefined;
+                               }
+
                                return elem[ name ];
                        }
 
-                       if ( msie && notxml &&  name == "style" )
+                       if ( !jQuery.support.style && notxml &&  name == "style" )
                                return jQuery.attr( elem.style, "cssText", value );
 
                        if ( set )
                                // convert the value to a string (all browsers do this but IE) see #1070
                                elem.setAttribute( name, "" + value );
 
-                       var attr = msie && notxml && special
+                       var attr = !jQuery.support.hrefNormalized && notxml && special
                                        // Some attributes require a special call on IE
                                        ? elem.getAttribute( name, 2 )
                                        : elem.getAttribute( name );
@@ -1096,7 +1026,7 @@ jQuery.extend({
                // elem is actually elem.style ... set the style
 
                // IE uses filters for opacity
-               if ( msie && name == "opacity" ) {
+               if ( !jQuery.support.opacity && name == "opacity" ) {
                        if ( set ) {
                                // IE has trouble with opacity if it does not have layout
                                // Force it by setting the zoom level
@@ -1131,8 +1061,8 @@ jQuery.extend({
 
                if( array != null ){
                        var i = array.length;
-                       //the window, strings and functions also have 'length'
-                       if( i == null || array.split || array.setInterval || array.call )
+                       // The window, strings (and functions) also have 'length'
+                       if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval )
                                ret[0] = array;
                        else
                                while( i )
@@ -1157,13 +1087,13 @@ jQuery.extend({
                var i = 0, elem, pos = first.length;
                // Also, we need to make sure that the correct elements are being returned
                // (IE returns comment nodes in a '*' query)
-               if ( jQuery.browser.msie ) {
-                       while ( elem = second[ i++ ] )
+               if ( !jQuery.support.getAll ) {
+                       while ( (elem = second[ i++ ]) != null )
                                if ( elem.nodeType != 8 )
                                        first[ pos++ ] = elem;
 
                } else
-                       while ( elem = second[ i++ ] )
+                       while ( (elem = second[ i++ ]) != null )
                                first[ pos++ ] = elem;
 
                return first;
@@ -1218,37 +1148,21 @@ jQuery.extend({
        }
 });
 
+// Use of jQuery.browser is deprecated.
+// It's included for backwards compatibility and plugins,
+// although they should work to migrate away.
+
 var userAgent = navigator.userAgent.toLowerCase();
 
 // Figure out what browser is being used
 jQuery.browser = {
-       version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
+       version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
        safari: /webkit/.test( userAgent ),
        opera: /opera/.test( userAgent ),
        msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
        mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
 };
 
-var styleFloat = jQuery.browser.msie ?
-       "styleFloat" :
-       "cssFloat";
-
-jQuery.extend({
-       // Check to see if the W3C box model is being used
-       boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
-
-       props: {
-               "for": "htmlFor",
-               "class": "className",
-               "float": styleFloat,
-               cssFloat: styleFloat,
-               styleFloat: styleFloat,
-               readonly: "readOnly",
-               maxlength: "maxLength",
-               cellspacing: "cellSpacing"
-       }
-});
-
 jQuery.each({
        parent: function(elem){return elem.parentNode;},
        parents: function(elem){return jQuery.dir(elem,"parentNode");},
@@ -1266,7 +1180,7 @@ jQuery.each({
                if ( selector && typeof selector == "string" )
                        ret = jQuery.multiFilter( selector, ret );
 
-               return this.pushStack( jQuery.unique( ret ) );
+               return this.pushStack( jQuery.unique( ret ), name, selector );
        };
 });
 
@@ -1302,14 +1216,16 @@ jQuery.each({
                jQuery.className.remove( this, classNames );
        },
 
-       toggleClass: function( classNames ) {
-               jQuery.className[ jQuery.className.has( this, classNames ) ? "remove" : "add" ]( this, classNames );
+       toggleClass: function( classNames, state ) {
+               if( typeof state !== "boolean" )
+                       state = !jQuery.className.has( this, classNames );
+               jQuery.className[ state ? "add" : "remove" ]( this, classNames );
        },
 
        remove: function( selector ) {
-               if ( !selector || jQuery.filter( selector, [ this ] ).r.length ) {
+               if ( !selector || jQuery.filter( selector, [ this ] ).length ) {
                        // Prevent memory leaks
-                       jQuery( "*", this ).add(this).each(function(){
+                       jQuery( "*", this ).add([this]).each(function(){
                                jQuery.event.remove(this);
                                jQuery.removeData(this);
                        });
@@ -1332,489 +1248,1063 @@ jQuery.each({
        };
 });
 
-jQuery.each([ "Height", "Width" ], function(i, name){
-       var type = name.toLowerCase();
+// Helper function used by the dimensions and offset modules
+function num(elem, prop) {
+       return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
+}
+var expando = "jQuery" + now(), uuid = 0, windowData = {};\r
+\r
+jQuery.extend({\r
+       cache: {},\r
+\r
+       data: function( elem, name, data ) {\r
+               elem = elem == window ?\r
+                       windowData :\r
+                       elem;\r
+\r
+               var id = elem[ expando ];\r
+\r
+               // Compute a unique ID for the element\r
+               if ( !id )\r
+                       id = elem[ expando ] = ++uuid;\r
+\r
+               // Only generate the data cache if we're\r
+               // trying to access or manipulate it\r
+               if ( name && !jQuery.cache[ id ] )\r
+                       jQuery.cache[ id ] = {};\r
+\r
+               // Prevent overriding the named cache with undefined values\r
+               if ( data !== undefined )\r
+                       jQuery.cache[ id ][ name ] = data;\r
+\r
+               // Return the named cache data, or the ID for the element\r
+               return name ?\r
+                       jQuery.cache[ id ][ name ] :\r
+                       id;\r
+       },\r
+\r
+       removeData: function( elem, name ) {\r
+               elem = elem == window ?\r
+                       windowData :\r
+                       elem;\r
+\r
+               var id = elem[ expando ];\r
+\r
+               // If we want to remove a specific section of the element's data\r
+               if ( name ) {\r
+                       if ( jQuery.cache[ id ] ) {\r
+                               // Remove the section of cache data\r
+                               delete jQuery.cache[ id ][ name ];\r
+\r
+                               // If we've removed all the data, remove the element's cache\r
+                               name = "";\r
+\r
+                               for ( name in jQuery.cache[ id ] )\r
+                                       break;\r
+\r
+                               if ( !name )\r
+                                       jQuery.removeData( elem );\r
+                       }\r
+\r
+               // Otherwise, we want to remove all of the element's data\r
+               } else {\r
+                       // Clean up the element expando\r
+                       try {\r
+                               delete elem[ expando ];\r
+                       } catch(e){\r
+                               // IE has trouble directly removing the expando\r
+                               // but it's ok with using removeAttribute\r
+                               if ( elem.removeAttribute )\r
+                                       elem.removeAttribute( expando );\r
+                       }\r
+\r
+                       // Completely remove the data cache\r
+                       delete jQuery.cache[ id ];\r
+               }\r
+       },\r
+       queue: function( elem, type, data ) {\r
+               if ( elem ){\r
+       \r
+                       type = (type || "fx") + "queue";\r
+       \r
+                       var q = jQuery.data( elem, type );\r
+       \r
+                       if ( !q || jQuery.isArray(data) )\r
+                               q = jQuery.data( elem, type, jQuery.makeArray(data) );\r
+                       else if( data )\r
+                               q.push( data );\r
+       \r
+               }\r
+               return q;\r
+       },\r
+\r
+       dequeue: function( elem, type ){\r
+               var queue = jQuery.queue( elem, type ),\r
+                       fn = queue.shift();\r
+               \r
+               if( !type || type === "fx" )\r
+                       fn = queue[0];\r
+                       \r
+               if( fn !== undefined )\r
+                       fn.call(elem);\r
+       }\r
+});\r
+\r
+jQuery.fn.extend({\r
+       data: function( key, value ){\r
+               var parts = key.split(".");\r
+               parts[1] = parts[1] ? "." + parts[1] : "";\r
+\r
+               if ( value === undefined ) {\r
+                       var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);\r
+\r
+                       if ( data === undefined && this.length )\r
+                               data = jQuery.data( this[0], key );\r
+\r
+                       return data === undefined && parts[1] ?\r
+                               this.data( parts[0] ) :\r
+                               data;\r
+               } else\r
+                       return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){\r
+                               jQuery.data( this, key, value );\r
+                       });\r
+       },\r
+\r
+       removeData: function( key ){\r
+               return this.each(function(){\r
+                       jQuery.removeData( this, key );\r
+               });\r
+       },\r
+       queue: function(type, data){\r
+               if ( typeof type !== "string" ) {\r
+                       data = type;\r
+                       type = "fx";\r
+               }\r
+\r
+               if ( data === undefined )\r
+                       return jQuery.queue( this[0], type );\r
+\r
+               return this.each(function(){\r
+                       var queue = jQuery.queue( this, type, data );\r
+                       \r
+                        if( type == "fx" && queue.length == 1 )\r
+                               queue[0].call(this);\r
+               });\r
+       },\r
+       dequeue: function(type){\r
+               return this.each(function(){\r
+                       jQuery.dequeue( this, type );\r
+               });\r
+       }\r
+});/*!
+ * Sizzle CSS Selector Engine - v0.9.1
+ *  Copyright 2009, The Dojo Foundation
+ *  Released under the MIT, BSD, and GPL Licenses.
+ *  More information: http://sizzlejs.com/
+ */
+(function(){
 
-       jQuery.fn[ type ] = function( size ) {
-               // Get window width or height
-               return this[0] == window ?
-                       // Opera reports document.body.client[Width/Height] properly in both quirks and standards
-                       jQuery.browser.opera && document.body[ "client" + name ] ||
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|[^[\]]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,
+       done = 0,
+       toString = Object.prototype.toString;
 
-                       // Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths)
-                       jQuery.browser.safari && window[ "inner" + name ] ||
+var Sizzle = function(selector, context, results, seed) {
+       results = results || [];
+       context = context || document;
 
-                       // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
-                       document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] :
+       if ( context.nodeType !== 1 && context.nodeType !== 9 )
+               return [];
+       
+       if ( !selector || typeof selector !== "string" ) {
+               return results;
+       }
 
-                       // Get document width or height
-                       this[0] == document ?
-                               // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
-                               Math.max(
-                                       Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]),
-                                       Math.max(document.body["offset" + name], document.documentElement["offset" + name])
-                               ) :
+       var parts = [], m, set, checkSet, check, mode, extra, prune = true;
+       
+       // Reset the position of the chunker regexp (start from head)
+       chunker.lastIndex = 0;
+       
+       while ( (m = chunker.exec(selector)) !== null ) {
+               parts.push( m[1] );
+               
+               if ( m[2] ) {
+                       extra = RegExp.rightContext;
+                       break;
+               }
+       }
 
-                               // Get or set width or height on the element
-                               size == undefined ?
-                                       // Get width or height on the element
-                                       (this.length ? jQuery.css( this[0], type ) : null) :
+       if ( parts.length > 1 && Expr.match.POS.exec( selector ) ) {
+               if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
+                       var later = "", match;
 
-                                       // Set the width or height on the element (default to pixels if value is unitless)
-                                       this.css( type, size.constructor == String ? size : size + "px" );
-       };
-});
+                       // Position selectors must be done after the filter
+                       while ( (match = Expr.match.POS.exec( selector )) ) {
+                               later += match[0];
+                               selector = selector.replace( Expr.match.POS, "" );
+                       }
 
-// Helper function used by the dimensions and offset modules
-function num(elem, prop) {
-       return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
-}var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ?
-               "(?:[\\w*_-]|\\\\.)" :
-               "(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",
-       quickChild = new RegExp("^>\\s*(" + chars + "+)"),
-       quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"),
-       quickClass = new RegExp("^([#.]?)(" + chars + "*)");
+                       set = Sizzle.filter( later, Sizzle( /\s$/.test(selector) ? selector + "*" : selector, context ) );
+               } else {
+                       set = Expr.relative[ parts[0] ] ?
+                               [ context ] :
+                               Sizzle( parts.shift(), context );
 
-jQuery.extend({
-       expr: {
-               "": function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},
-               "#": function(a,i,m){return a.getAttribute("id")==m[2];},
-               ":": {
-                       // Position Checks
-                       lt: function(a,i,m){return i<m[3]-0;},
-                       gt: function(a,i,m){return i>m[3]-0;},
-                       nth: function(a,i,m){return m[3]-0==i;},
-                       eq: function(a,i,m){return m[3]-0==i;},
-                       first: function(a,i){return i==0;},
-                       last: function(a,i,m,r){return i==r.length-1;},
-                       even: function(a,i){return i%2==0;},
-                       odd: function(a,i){return i%2;},
-
-                       // Child Checks
-                       "first-child": function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},
-                       "last-child": function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},
-                       "only-child": function(a){return !jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},
-
-                       // Parent Checks
-                       parent: function(a){return a.firstChild;},
-                       empty: function(a){return !a.firstChild;},
-
-                       // Text Check
-                       contains: function(a,i,m){return (a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},
-
-                       // Visibility
-                       visible: function(a){return "hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},
-                       hidden: function(a){return "hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},
-
-                       // Form attributes
-                       enabled: function(a){return !a.disabled;},
-                       disabled: function(a){return a.disabled;},
-                       checked: function(a){return a.checked;},
-                       selected: function(a){return a.selected||jQuery.attr(a,"selected");},
-
-                       // Form elements
-                       text: function(a){return "text"==a.type;},
-                       radio: function(a){return "radio"==a.type;},
-                       checkbox: function(a){return "checkbox"==a.type;},
-                       file: function(a){return "file"==a.type;},
-                       password: function(a){return "password"==a.type;},
-                       submit: function(a){return "submit"==a.type;},
-                       image: function(a){return "image"==a.type;},
-                       reset: function(a){return "reset"==a.type;},
-                       button: function(a){return "button"==a.type||jQuery.nodeName(a,"button");},
-                       input: function(a){return /input|select|textarea|button/i.test(a.nodeName);},
-
-                       // :has()
-                       has: function(a,i,m){return jQuery.find(m[3],a).length;},
-
-                       // :header
-                       header: function(a){return /h\d/i.test(a.nodeName);},
-
-                       // :animated
-                       animated: function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}
-               }
-       },
-
-       // The regular expressions that power the parsing engine
-       parse: [
-               // Match: [@value='test'], [@foo]
-               /^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,
-
-               // Match: :contains('foo')
-               /^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,
-
-               // Match: :even, :last-child, #id, .class
-               new RegExp("^([:.#]*)(" + chars + "+)")
-       ],
-
-       multiFilter: function( expr, elems, not ) {
-               var old, cur = [];
-
-               while ( expr && expr != old ) {
-                       old = expr;
-                       var f = jQuery.filter( expr, elems, not );
-                       expr = f.t.replace(/^\s*,\s*/, "" );
-                       cur = not ? elems = f.r : jQuery.merge( cur, f.r );
-               }
-
-               return cur;
-       },
-
-       find: function( t, context ) {
-               // Quickly handle non-string expressions
-               if ( typeof t != "string" )
-                       return [ t ];
-
-               // check to make sure context is a DOM element or a document
-               if ( context && context.nodeType != 1 && context.nodeType != 9)
-                       return [ ];
-
-               // Set the correct context (if none is provided)
-               context = context || document;
+                       while ( parts.length ) {
+                               var tmpSet = [];
 
-               // Initialize the search
-               var ret = [context], done = [], last, nodeName;
+                               selector = parts.shift();
+                               if ( Expr.relative[ selector ] )
+                                       selector += parts.shift();
 
-               // Continue while a selector expression exists, and while
-               // we're no longer looping upon ourselves
-               while ( t && last != t ) {
-                       var r = [];
-                       last = t;
+                               for ( var i = 0, l = set.length; i < l; i++ ) {
+                                       Sizzle( selector, set[i], tmpSet );
+                               }
 
-                       t = jQuery.trim(t);
+                               set = tmpSet;
+                       }
+               }
+       } else {
+               var ret = seed ?
+                       { expr: parts.pop(), set: makeArray(seed) } :
+                       Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context );
+               set = Sizzle.filter( ret.expr, ret.set );
+
+               if ( parts.length > 0 ) {
+                       checkSet = makeArray(set);
+               } else {
+                       prune = false;
+               }
 
-                       var foundToken = false,
+               while ( parts.length ) {
+                       var cur = parts.pop(), pop = cur;
 
-                       // An attempt at speeding up child selectors that
-                       // point to a specific element tag
-                               re = quickChild,
+                       if ( !Expr.relative[ cur ] ) {
+                               cur = "";
+                       } else {
+                               pop = parts.pop();
+                       }
 
-                               m = re.exec(t);
+                       if ( pop == null ) {
+                               pop = context;
+                       }
 
-                       if ( m ) {
-                               nodeName = m[1].toUpperCase();
+                       Expr.relative[ cur ]( checkSet, pop, isXML(context) );
+               }
+       }
 
-                               // Perform our own iteration and filter
-                               for ( var i = 0; ret[i]; i++ )
-                                       for ( var c = ret[i].firstChild; c; c = c.nextSibling )
-                                               if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName) )
-                                                       r.push( c );
+       if ( !checkSet ) {
+               checkSet = set;
+       }
 
-                               ret = r;
-                               t = t.replace( re, "" );
-                               if ( t.indexOf(" ") == 0 ) continue;
-                               foundToken = true;
-                       } else {
-                               re = /^([>+~])\s*(\w*)/i;
+       if ( !checkSet ) {
+               throw "Syntax error, unrecognized expression: " + (cur || selector);
+       }
 
-                               if ( (m = re.exec(t)) != null ) {
-                                       r = [];
+       if ( toString.call(checkSet) === "[object Array]" ) {
+               if ( !prune ) {
+                       results.push.apply( results, checkSet );
+               } else if ( context.nodeType === 1 ) {
+                       for ( var i = 0; checkSet[i] != null; i++ ) {
+                               if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
+                                       results.push( set[i] );
+                               }
+                       }
+               } else {
+                       for ( var i = 0; checkSet[i] != null; i++ ) {
+                               if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
+                                       results.push( set[i] );
+                               }
+                       }
+               }
+       } else {
+               makeArray( checkSet, results );
+       }
 
-                                       var merge = {};
-                                       nodeName = m[2].toUpperCase();
-                                       m = m[1];
+       if ( extra ) {
+               Sizzle( extra, context, results, seed );
+       }
 
-                                       for ( var j = 0, rl = ret.length; j < rl; j++ ) {
-                                               var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild;
-                                               for ( ; n; n = n.nextSibling )
-                                                       if ( n.nodeType == 1 ) {
-                                                               var id = jQuery.data(n);
+       return results;
+};
 
-                                                               if ( m == "~" && merge[id] ) break;
+Sizzle.matches = function(expr, set){
+       return Sizzle(expr, null, null, set);
+};
 
-                                                               if (!nodeName || n.nodeName.toUpperCase() == nodeName ) {
-                                                                       if ( m == "~" ) merge[id] = true;
-                                                                       r.push( n );
-                                                               }
+Sizzle.find = function(expr, context){
+       var set, match;
+
+       if ( !expr ) {
+               return [];
+       }
+
+       for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
+               var type = Expr.order[i], match;
+               
+               if ( (match = Expr.match[ type ].exec( expr )) ) {
+                       var left = RegExp.leftContext;
+
+                       if ( left.substr( left.length - 1 ) !== "\\" ) {
+                               match[1] = (match[1] || "").replace(/\\/g, "");
+                               set = Expr.find[ type ]( match, context );
+                               if ( set != null ) {
+                                       expr = expr.replace( Expr.match[ type ], "" );
+                                       break;
+                               }
+                       }
+               }
+       }
+
+       if ( !set ) {
+               set = context.getElementsByTagName("*");
+       }
+
+       return {set: set, expr: expr};
+};
+
+Sizzle.filter = function(expr, set, inplace, not){
+       var old = expr, result = [], curLoop = set, match, anyFound;
 
-                                                               if ( m == "+" ) break;
+       while ( expr && set.length ) {
+               for ( var type in Expr.filter ) {
+                       if ( (match = Expr.match[ type ].exec( expr )) != null ) {
+                               var filter = Expr.filter[ type ], goodArray = null, goodPos = 0, found, item;
+                               anyFound = false;
+
+                               if ( curLoop == result ) {
+                                       result = [];
+                               }
+
+                               if ( Expr.preFilter[ type ] ) {
+                                       match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not );
+
+                                       if ( !match ) {
+                                               anyFound = found = true;
+                                       } else if ( match === true ) {
+                                               continue;
+                                       } else if ( match[0] === true ) {
+                                               goodArray = [];
+                                               var last = null, elem;
+                                               for ( var i = 0; (elem = curLoop[i]) !== undefined; i++ ) {
+                                                       if ( elem && last !== elem ) {
+                                                               goodArray.push( elem );
+                                                               last = elem;
                                                        }
+                                               }
                                        }
+                               }
 
-                                       ret = r;
+                               if ( match ) {
+                                       for ( var i = 0; (item = curLoop[i]) !== undefined; i++ ) {
+                                               if ( item ) {
+                                                       if ( goodArray && item != goodArray[goodPos] ) {
+                                                               goodPos++;
+                                                       }
+       
+                                                       found = filter( item, match, goodPos, goodArray );
+                                                       var pass = not ^ !!found;
+
+                                                       if ( inplace && found != null ) {
+                                                               if ( pass ) {
+                                                                       anyFound = true;
+                                                               } else {
+                                                                       curLoop[i] = false;
+                                                               }
+                                                       } else if ( pass ) {
+                                                               result.push( item );
+                                                               anyFound = true;
+                                                       }
+                                               }
+                                       }
+                               }
+
+                               if ( found !== undefined ) {
+                                       if ( !inplace ) {
+                                               curLoop = result;
+                                       }
+
+                                       expr = expr.replace( Expr.match[ type ], "" );
+
+                                       if ( !anyFound ) {
+                                               return [];
+                                       }
 
-                                       // And remove the token
-                                       t = jQuery.trim( t.replace( re, "" ) );
-                                       foundToken = true;
+                                       break;
                                }
                        }
+               }
 
-                       // See if there's still an expression, and that we haven't already
-                       // matched a token
-                       if ( t && !foundToken ) {
-                               // Handle multiple expressions
-                               if ( !t.indexOf(",") ) {
-                                       // Clean the result set
-                                       if ( context == ret[0] ) ret.shift();
-
-                                       // Merge the result sets
-                                       done = jQuery.merge( done, ret );
+               expr = expr.replace(/\s*,\s*/, "");
 
-                                       // Reset the context
-                                       r = ret = [context];
+               // Improper expression
+               if ( expr == old ) {
+                       if ( anyFound == null ) {
+                               throw "Syntax error, unrecognized expression: " + expr;
+                       } else {
+                               break;
+                       }
+               }
 
-                                       // Touch up the selector string
-                                       t = " " + t.substr(1,t.length);
+               old = expr;
+       }
 
-                               } else {
-                                       // Optimize for the case nodeName#idName
-                                       var re2 = quickID;
-                                       var m = re2.exec(t);
+       return curLoop;
+};
 
-                                       // Re-organize the results, so that they're consistent
-                                       if ( m ) {
-                                               m = [ 0, m[2], m[3], m[1] ];
+var Expr = Sizzle.selectors = {
+       order: [ "ID", "NAME", "TAG" ],
+       match: {
+               ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
+               CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
+               NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,
+               ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
+               TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,
+               CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
+               POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
+               PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/
+       },
+       attrMap: {
+               "class": "className",
+               "for": "htmlFor"
+       },
+       attrHandle: {
+               href: function(elem){
+                       return elem.getAttribute("href");
+               }
+       },
+       relative: {
+               "+": function(checkSet, part){
+                       for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+                               var elem = checkSet[i];
+                               if ( elem ) {
+                                       var cur = elem.previousSibling;
+                                       while ( cur && cur.nodeType !== 1 ) {
+                                               cur = cur.previousSibling;
+                                       }
+                                       checkSet[i] = typeof part === "string" ?
+                                               cur || false :
+                                               cur === part;
+                               }
+                       }
 
-                                       } else {
-                                               // Otherwise, do a traditional filter check for
-                                               // ID, class, and element selectors
-                                               re2 = quickClass;
-                                               m = re2.exec(t);
+                       if ( typeof part === "string" ) {
+                               Sizzle.filter( part, checkSet, true );
+                       }
+               },
+               ">": function(checkSet, part, isXML){
+                       if ( typeof part === "string" && !/\W/.test(part) ) {
+                               part = isXML ? part : part.toUpperCase();
+
+                               for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+                                       var elem = checkSet[i];
+                                       if ( elem ) {
+                                               var parent = elem.parentNode;
+                                               checkSet[i] = parent.nodeName === part ? parent : false;
+                                       }
+                               }
+                       } else {
+                               for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+                                       var elem = checkSet[i];
+                                       if ( elem ) {
+                                               checkSet[i] = typeof part === "string" ?
+                                                       elem.parentNode :
+                                                       elem.parentNode === part;
                                        }
+                               }
 
-                                       m[2] = m[2].replace(/\\/g, "");
+                               if ( typeof part === "string" ) {
+                                       Sizzle.filter( part, checkSet, true );
+                               }
+                       }
+               },
+               "": function(checkSet, part, isXML){
+                       var doneName = "done" + (done++), checkFn = dirCheck;
 
-                                       var elem = ret[ret.length-1];
+                       if ( !part.match(/\W/) ) {
+                               var nodeCheck = part = isXML ? part : part.toUpperCase();
+                               checkFn = dirNodeCheck;
+                       }
 
-                                       // Try to do a global search by ID, where we can
-                                       if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) {
-                                               // Optimization for HTML document case
-                                               var oid = elem.getElementById(m[2]);
+                       checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
+               },
+               "~": function(checkSet, part, isXML){
+                       var doneName = "done" + (done++), checkFn = dirCheck;
 
-                                               // Do a quick check for the existence of the actual ID attribute
-                                               // to avoid selecting by the name attribute in IE
-                                               // also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form
-                                               if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] )
-                                                       oid = jQuery('[@id="'+m[2]+'"]', elem)[0];
+                       if ( typeof part === "string" && !part.match(/\W/) ) {
+                               var nodeCheck = part = isXML ? part : part.toUpperCase();
+                               checkFn = dirNodeCheck;
+                       }
 
-                                               // Do a quick check for node name (where applicable) so
-                                               // that div#foo searches will be really fast
-                                               ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
-                                       } else {
-                                               // We need to find all descendant elements
-                                               for ( var i = 0; ret[i]; i++ ) {
-                                                       // Grab the tag name being searched for
-                                                       var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2];
+                       checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
+               }
+       },
+       find: {
+               ID: function(match, context){
+                       if ( context.getElementById ) {
+                               var m = context.getElementById(match[1]);
+                               return m ? [m] : [];
+                       }
+               },
+               NAME: function(match, context){
+                       return context.getElementsByName ? context.getElementsByName(match[1]) : null;
+               },
+               TAG: function(match, context){
+                       return context.getElementsByTagName(match[1]);
+               }
+       },
+       preFilter: {
+               CLASS: function(match, curLoop, inplace, result, not){
+                       match = " " + match[1].replace(/\\/g, "") + " ";
+
+                       for ( var i = 0; curLoop[i]; i++ ) {
+                               if ( not ^ (" " + curLoop[i].className + " ").indexOf(match) >= 0 ) {
+                                       if ( !inplace )
+                                               result.push( curLoop[i] );
+                               } else if ( inplace ) {
+                                       curLoop[i] = false;
+                               }
+                       }
 
-                                                       // Handle IE7 being really dumb about <object>s
-                                                       if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" )
-                                                               tag = "param";
+                       return false;
+               },
+               ID: function(match){
+                       return match[1].replace(/\\/g, "");
+               },
+               TAG: function(match, curLoop){
+                       for ( var i = 0; !curLoop[i]; i++ ){}
+                       return isXML(curLoop[i]) ? match[1] : match[1].toUpperCase();
+               },
+               CHILD: function(match){
+                       if ( match[1] == "nth" ) {
+                               // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
+                               var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
+                                       match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" ||
+                                       !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
+
+                               // calculate the numbers (first)n+(last) including if they are negative
+                               match[2] = (test[1] + (test[2] || 1)) - 0;
+                               match[3] = test[3] - 0;
+                       }
 
-                                                       r = jQuery.merge( r, ret[i].getElementsByTagName( tag ));
-                                               }
+                       // TODO: Move to normal caching system
+                       match[0] = "done" + (done++);
 
-                                               // It's faster to filter by class and be done with it
-                                               if ( m[1] == "." )
-                                                       r = jQuery.classFilter( r, m[2] );
+                       return match;
+               },
+               ATTR: function(match){
+                       var name = match[1];
+                       
+                       if ( Expr.attrMap[name] ) {
+                               match[1] = Expr.attrMap[name];
+                       }
 
-                                               // Same with ID filtering
-                                               if ( m[1] == "#" ) {
-                                                       var tmp = [];
+                       if ( match[2] === "~=" ) {
+                               match[4] = " " + match[4] + " ";
+                       }
 
-                                                       // Try to find the element with the ID
-                                                       for ( var i = 0; r[i]; i++ )
-                                                               if ( r[i].getAttribute("id") == m[2] ) {
-                                                                       tmp = [ r[i] ];
-                                                                       break;
-                                                               }
+                       return match;
+               },
+               PSEUDO: function(match, curLoop, inplace, result, not){
+                       if ( match[1] === "not" ) {
+                               // If we're dealing with a complex expression, or a simple one
+                               if ( match[3].match(chunker).length > 1 ) {
+                                       match[3] = Sizzle(match[3], null, null, curLoop);
+                               } else {
+                                       var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
+                                       if ( !inplace ) {
+                                               result.push.apply( result, ret );
+                                       }
+                                       return false;
+                               }
+                       } else if ( Expr.match.POS.test( match[0] ) ) {
+                               return true;
+                       }
+                       
+                       return match;
+               },
+               POS: function(match){
+                       match.unshift( true );
+                       return match;
+               }
+       },
+       filters: {
+               enabled: function(elem){
+                       return elem.disabled === false && elem.type !== "hidden";
+               },
+               disabled: function(elem){
+                       return elem.disabled === true;
+               },
+               checked: function(elem){
+                       return elem.checked === true;
+               },
+               selected: function(elem){
+                       // Accessing this property makes selected-by-default
+                       // options in Safari work properly
+                       elem.parentNode.selectedIndex;
+                       return elem.selected === true;
+               },
+               parent: function(elem){
+                       return !!elem.firstChild;
+               },
+               empty: function(elem){
+                       return !elem.firstChild;
+               },
+               has: function(elem, i, match){
+                       return !!Sizzle( match[3], elem ).length;
+               },
+               header: function(elem){
+                       return /h\d/i.test( elem.nodeName );
+               },
+               text: function(elem){
+                       return "text" === elem.type;
+               },
+               radio: function(elem){
+                       return "radio" === elem.type;
+               },
+               checkbox: function(elem){
+                       return "checkbox" === elem.type;
+               },
+               file: function(elem){
+                       return "file" === elem.type;
+               },
+               password: function(elem){
+                       return "password" === elem.type;
+               },
+               submit: function(elem){
+                       return "submit" === elem.type;
+               },
+               image: function(elem){
+                       return "image" === elem.type;
+               },
+               reset: function(elem){
+                       return "reset" === elem.type;
+               },
+               button: function(elem){
+                       return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON";
+               },
+               input: function(elem){
+                       return /input|select|textarea|button/i.test(elem.nodeName);
+               }
+       },
+       setFilters: {
+               first: function(elem, i){
+                       return i === 0;
+               },
+               last: function(elem, i, match, array){
+                       return i === array.length - 1;
+               },
+               even: function(elem, i){
+                       return i % 2 === 0;
+               },
+               odd: function(elem, i){
+                       return i % 2 === 1;
+               },
+               lt: function(elem, i, match){
+                       return i < match[3] - 0;
+               },
+               gt: function(elem, i, match){
+                       return i > match[3] - 0;
+               },
+               nth: function(elem, i, match){
+                       return match[3] - 0 == i;
+               },
+               eq: function(elem, i, match){
+                       return match[3] - 0 == i;
+               }
+       },
+       filter: {
+               CHILD: function(elem, match){
+                       var type = match[1], parent = elem.parentNode;
 
-                                                       r = tmp;
-                                               }
+                       var doneName = "child" + parent.childNodes.length;
+                       
+                       if ( parent && (!parent[ doneName ] || !elem.nodeIndex) ) {
+                               var count = 1;
+
+                               for ( var node = parent.firstChild; node; node = node.nextSibling ) {
+                                       if ( node.nodeType == 1 ) {
+                                               node.nodeIndex = count++;
+                                       }
+                               }
+
+                               parent[ doneName ] = count - 1;
+                       }
+
+                       if ( type == "first" ) {
+                               return elem.nodeIndex == 1;
+                       } else if ( type == "last" ) {
+                               return elem.nodeIndex == parent[ doneName ];
+                       } else if ( type == "only" ) {
+                               return parent[ doneName ] == 1;
+                       } else if ( type == "nth" ) {
+                               var add = false, first = match[2], last = match[3];
+
+                               if ( first == 1 && last == 0 ) {
+                                       return true;
+                               }
 
-                                               ret = r;
+                               if ( first == 0 ) {
+                                       if ( elem.nodeIndex == last ) {
+                                               add = true;
                                        }
+                               } else if ( (elem.nodeIndex - last) % first == 0 && (elem.nodeIndex - last) / first >= 0 ) {
+                                       add = true;
+                               }
 
-                                       t = t.replace( re2, "" );
+                               return add;
+                       }
+               },
+               PSEUDO: function(elem, match, i, array){
+                       var name = match[1], filter = Expr.filters[ name ];
+
+                       if ( filter ) {
+                               return filter( elem, i, match, array );
+                       } else if ( name === "contains" ) {
+                               return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0;
+                       } else if ( name === "not" ) {
+                               var not = match[3];
+
+                               for ( var i = 0, l = not.length; i < l; i++ ) {
+                                       if ( not[i] === elem ) {
+                                               return false;
+                                       }
                                }
 
+                               return true;
                        }
+               },
+               ID: function(elem, match){
+                       return elem.nodeType === 1 && elem.getAttribute("id") === match;
+               },
+               TAG: function(elem, match){
+                       return (match === "*" && elem.nodeType === 1) || elem.nodeName === match;
+               },
+               CLASS: function(elem, match){
+                       return match.test( elem.className );
+               },
+               ATTR: function(elem, match){
+                       var result = Expr.attrHandle[ match[1] ] ? Expr.attrHandle[ match[1] ]( elem ) : elem[ match[1] ] || elem.getAttribute( match[1] ), value = result + "", type = match[2], check = match[4];
+                       return result == null ?
+                               false :
+                               type === "=" ?
+                               value === check :
+                               type === "*=" ?
+                               value.indexOf(check) >= 0 :
+                               type === "~=" ?
+                               (" " + value + " ").indexOf(check) >= 0 :
+                               !match[4] ?
+                               result :
+                               type === "!=" ?
+                               value != check :
+                               type === "^=" ?
+                               value.indexOf(check) === 0 :
+                               type === "$=" ?
+                               value.substr(value.length - check.length) === check :
+                               type === "|=" ?
+                               value === check || value.substr(0, check.length + 1) === check + "-" :
+                               false;
+               },
+               POS: function(elem, match, i, array){
+                       var name = match[2], filter = Expr.setFilters[ name ];
 
-                       // If a selector string still exists
-                       if ( t ) {
-                               // Attempt to filter it
-                               var val = jQuery.filter(t,r);
-                               ret = r = val.r;
-                               t = jQuery.trim(val.t);
+                       if ( filter ) {
+                               return filter( elem, i, match, array );
                        }
                }
+       }
+};
 
-               // An error occurred with the selector;
-               // just return an empty set instead
-               if ( t )
-                       ret = [];
+for ( var type in Expr.match ) {
+       Expr.match[ type ] = RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
+}
 
-               // Remove the root context
-               if ( ret && context == ret[0] )
-                       ret.shift();
+var makeArray = function(array, results) {
+       array = Array.prototype.slice.call( array );
 
-               // And combine the results
-               done = jQuery.merge( done, ret );
+       if ( results ) {
+               results.push.apply( results, array );
+               return results;
+       }
+       
+       return array;
+};
 
-               return done;
-       },
+// Perform a simple check to determine if the browser is capable of
+// converting a NodeList to an array using builtin methods.
+try {
+       Array.prototype.slice.call( document.documentElement.childNodes );
+
+// Provide a fallback method if it does not work
+} catch(e){
+       makeArray = function(array, results) {
+               var ret = results || [];
 
-       classFilter: function(r,m,not){
-               m = " " + m + " ";
-               var tmp = [];
-               for ( var i = 0; r[i]; i++ ) {
-                       var pass = (" " + r[i].className + " ").indexOf( m ) >= 0;
-                       if ( !not && pass || not && !pass )
-                               tmp.push( r[i] );
+               if ( toString.call(array) === "[object Array]" ) {
+                       Array.prototype.push.apply( ret, array );
+               } else {
+                       if ( typeof array.length === "number" ) {
+                               for ( var i = 0, l = array.length; i < l; i++ ) {
+                                       ret.push( array[i] );
+                               }
+                       } else {
+                               for ( var i = 0; array[i]; i++ ) {
+                                       ret.push( array[i] );
+                               }
+                       }
                }
-               return tmp;
-       },
 
-       filter: function(t,r,not) {
-               var last;
+               return ret;
+       };
+}
+
+// Check to see if the browser returns elements by name when
+// querying by getElementById (and provide a workaround)
+(function(){
+       // We're going to inject a fake input element with a specified name
+       var form = document.createElement("form"),
+               id = "script" + (new Date).getTime();
+       form.innerHTML = "<input name='" + id + "'/>";
+
+       // Inject it into the root element, check its status, and remove it quickly
+       var root = document.documentElement;
+       root.insertBefore( form, root.firstChild );
+
+       // The workaround has to do additional checks after a getElementById
+       // Which slows things down for other browsers (hence the branching)
+       if ( !!document.getElementById( id ) ) {
+               Expr.find.ID = function(match, context){
+                       if ( context.getElementById ) {
+                               var m = context.getElementById(match[1]);
+                               return m ? m.id === match[1] || m.getAttributeNode && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];
+                       }
+               };
+
+               Expr.filter.ID = function(elem, match){
+                       var node = elem.getAttributeNode && elem.getAttributeNode("id");
+                       return elem.nodeType === 1 && node && node.nodeValue === match;
+               };
+       }
 
-               // Look for common filter expressions
-               while ( t && t != last ) {
-                       last = t;
+       root.removeChild( form );
+})();
 
-                       var p = jQuery.parse, m;
+(function(){
+       // Check to see if the browser returns only elements
+       // when doing getElementsByTagName("*")
 
-                       for ( var i = 0; p[i]; i++ ) {
-                               m = p[i].exec( t );
+       // Create a fake element
+       var div = document.createElement("div");
+       div.appendChild( document.createComment("") );
 
-                               if ( m ) {
-                                       // Remove what we just matched
-                                       t = t.substring( m[0].length );
+       // Make sure no comments are found
+       if ( div.getElementsByTagName("*").length > 0 ) {
+               Expr.find.TAG = function(match, context){
+                       var results = context.getElementsByTagName(match[1]);
 
-                                       m[2] = m[2].replace(/\\/g, "");
-                                       break;
+                       // Filter out possible comments
+                       if ( match[1] === "*" ) {
+                               var tmp = [];
+
+                               for ( var i = 0; results[i]; i++ ) {
+                                       if ( results[i].nodeType === 1 ) {
+                                               tmp.push( results[i] );
+                                       }
                                }
+
+                               results = tmp;
                        }
 
-                       if ( !m )
-                               break;
+                       return results;
+               };
+       }
 
-                       // :not() is a special case that can be optimized by
-                       // keeping it out of the expression list
-                       if ( m[1] == ":" && m[2] == "not" )
-                               // optimize if only one selector found (most common case)
-                               r = isSimple.test( m[3] ) ?
-                                       jQuery.filter(m[3], r, true).r :
-                                       jQuery( r ).not( m[3] );
-
-                       // We can get a big speed boost by filtering by class here
-                       else if ( m[1] == "." )
-                               r = jQuery.classFilter(r, m[2], not);
-
-                       else if ( m[1] == "[" ) {
-                               var tmp = [], type = m[3];
-
-                               for ( var i = 0, rl = r.length; i < rl; i++ ) {
-                                       var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ];
-
-                                       if ( z == null || /href|src|selected/.test(m[2]) )
-                                               z = jQuery.attr(a,m[2]) || '';
-
-                                       if ( (type == "" && !!z ||
-                                                type == "=" && z == m[5] ||
-                                                type == "!=" && z != m[5] ||
-                                                type == "^=" && z && !z.indexOf(m[5]) ||
-                                                type == "$=" && z.substr(z.length - m[5].length) == m[5] ||
-                                                (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not )
-                                                       tmp.push( a );
-                               }
+       // Check to see if an attribute returns normalized href attributes
+       div.innerHTML = "<a href='#'></a>";
+       if ( div.firstChild.getAttribute("href") !== "#" ) {
+               Expr.attrHandle.href = function(elem){
+                       return elem.getAttribute("href", 2);
+               };
+       }
+})();
 
-                               r = tmp;
+if ( document.querySelectorAll ) (function(){
+       var oldSizzle = Sizzle;
+       
+       Sizzle = function(query, context, extra, seed){
+               context = context || document;
 
-                       // We can get a speed boost by handling nth-child here
-                       } else if ( m[1] == ":" && m[2] == "nth-child" ) {
-                               var merge = {}, tmp = [],
-                                       // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
-                                       test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
-                                               m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" ||
-                                               !/\D/.test(m[3]) && "0n+" + m[3] || m[3]),
-                                       // calculate the numbers (first)n+(last) including if they are negative
-                                       first = (test[1] + (test[2] || 1)) - 0, last = test[3] - 0;
+               if ( !seed && context.nodeType === 9 ) {
+                       try {
+                               return makeArray( context.querySelectorAll(query), extra );
+                       } catch(e){}
+               }
+               
+               return oldSizzle(query, context, extra, seed);
+       };
 
-                               // loop through all the elements left in the jQuery object
-                               for ( var i = 0, rl = r.length; i < rl; i++ ) {
-                                       var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode);
+       Sizzle.find = oldSizzle.find;
+       Sizzle.filter = oldSizzle.filter;
+       Sizzle.selectors = oldSizzle.selectors;
+       Sizzle.matches = oldSizzle.matches;
+})();
 
-                                       if ( !merge[id] ) {
-                                               var c = 1;
+if ( document.documentElement.getElementsByClassName ) {
+       Expr.order.splice(1, 0, "CLASS");
+       Expr.find.CLASS = function(match, context) {
+               return context.getElementsByClassName(match[1]);
+       };
+}
 
-                                               for ( var n = parentNode.firstChild; n; n = n.nextSibling )
-                                                       if ( n.nodeType == 1 )
-                                                               n.nodeIndex = c++;
+function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+       for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+               var elem = checkSet[i];
+               if ( elem ) {
+                       elem = elem[dir];
+                       var match = false;
+
+                       while ( elem && elem.nodeType ) {
+                               var done = elem[doneName];
+                               if ( done ) {
+                                       match = checkSet[ done ];
+                                       break;
+                               }
 
-                                               merge[id] = true;
-                                       }
+                               if ( elem.nodeType === 1 && !isXML )
+                                       elem[doneName] = i;
+
+                               if ( elem.nodeName === cur ) {
+                                       match = elem;
+                                       break;
+                               }
 
-                                       var add = false;
+                               elem = elem[dir];
+                       }
 
-                                       if ( first == 0 ) {
-                                               if ( node.nodeIndex == last )
-                                                       add = true;
-                                       } else if ( (node.nodeIndex - last) % first == 0 && (node.nodeIndex - last) / first >= 0 )
-                                               add = true;
+                       checkSet[i] = match;
+               }
+       }
+}
 
-                                       if ( add ^ not )
-                                               tmp.push( node );
+function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+       for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+               var elem = checkSet[i];
+               if ( elem ) {
+                       elem = elem[dir];
+                       var match = false;
+
+                       while ( elem && elem.nodeType ) {
+                               if ( elem[doneName] ) {
+                                       match = checkSet[ elem[doneName] ];
+                                       break;
                                }
 
-                               r = tmp;
+                               if ( elem.nodeType === 1 ) {
+                                       if ( !isXML )
+                                               elem[doneName] = i;
 
-                       // Otherwise, find the expression to execute
-                       } else {
-                               var fn = jQuery.expr[ m[1] ];
-                               if ( typeof fn == "object" )
-                                       fn = fn[ m[2] ];
+                                       if ( typeof cur !== "string" ) {
+                                               if ( elem === cur ) {
+                                                       match = true;
+                                                       break;
+                                               }
 
-                               if ( typeof fn == "string" )
-                                       fn = eval("false||function(a,i){return " + fn + ";}");
+                                       } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
+                                               match = elem;
+                                               break;
+                                       }
+                               }
 
-                               // Execute it against the current filter
-                               r = jQuery.grep( r, function(elem, i){
-                                       return fn(elem, i, m, r);
-                               }, not );
+                               elem = elem[dir];
                        }
+
+                       checkSet[i] = match;
                }
+       }
+}
 
-               // Return an array of filtered elements (r)
-               // and the modified expression string (t)
-               return { r: r, t: t };
-       },
+var contains = document.compareDocumentPosition ?  function(a, b){
+       return a.compareDocumentPosition(b) & 16;
+} : function(a, b){
+       return a !== b && (a.contains ? a.contains(b) : true);
+};
 
-       dir: function( elem, dir ){
-               var matched = [],
-                       cur = elem[dir];
-               while ( cur && cur != document ) {
-                       if ( cur.nodeType == 1 )
-                               matched.push( cur );
-                       cur = cur[dir];
-               }
-               return matched;
-       },
+var isXML = function(elem){
+       return elem.documentElement && !elem.body ||
+               elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
+};
 
-       nth: function(cur,result,dir,elem){
-               result = result || 1;
-               var num = 0;
+// EXPOSE
+jQuery.find = Sizzle;
+jQuery.filter = Sizzle.filter;
+jQuery.expr = Sizzle.selectors;
+jQuery.expr[":"] = jQuery.expr.filters;
 
-               for ( ; cur; cur = cur[dir] )
-                       if ( cur.nodeType == 1 && ++num == result )
-                               break;
+Sizzle.selectors.filters.hidden = function(elem){
+       return "hidden" === elem.type ||
+               jQuery.css(elem, "display") === "none" ||
+               jQuery.css(elem, "visibility") === "hidden";
+};
 
-               return cur;
-       },
+Sizzle.selectors.filters.visible = function(elem){
+       return "hidden" !== elem.type &&
+               jQuery.css(elem, "display") !== "none" &&
+               jQuery.css(elem, "visibility") !== "hidden";
+};
 
-       sibling: function( n, elem ) {
-               var r = [];
+Sizzle.selectors.filters.animated = function(elem){
+       return jQuery.grep(jQuery.timers, function(fn){
+               return elem === fn.elem;
+       }).length;
+};
 
-               for ( ; n; n = n.nextSibling ) {
-                       if ( n.nodeType == 1 && n != elem )
-                               r.push( n );
-               }
+jQuery.multiFilter = function( expr, elems, not ) {
+       if ( not ) {
+               expr = ":not(" + expr + ")";
+       }
+
+       return Sizzle.matches(expr, elems);
+};
 
-               return r;
+jQuery.dir = function( elem, dir ){
+       var matched = [], cur = elem[dir];
+       while ( cur && cur != document ) {
+               if ( cur.nodeType == 1 )
+                       matched.push( cur );
+               cur = cur[dir];
        }
-});
+       return matched;
+};
+
+jQuery.nth = function(cur, result, dir, elem){
+       result = result || 1;
+       var num = 0;
+
+       for ( ; cur; cur = cur[dir] )
+               if ( cur.nodeType == 1 && ++num == result )
+                       break;
+
+       return cur;
+};
+
+jQuery.sibling = function(n, elem){
+       var r = [];
+
+       for ( ; n; n = n.nextSibling ) {
+               if ( n.nodeType == 1 && n != elem )
+                       r.push( n );
+       }
+
+       return r;
+};
+
+return;
+
+window.Sizzle = Sizzle;
+
+})();
 /*
  * A number of helper functions used for managing events.
- * Many of the ideas behind this code orignated from
+ * Many of the ideas behind this code originated from
  * Dean Edwards' addEvent library.
  */
 jQuery.event = {
@@ -1827,7 +2317,7 @@ jQuery.event = {
 
                // For whatever reason, IE has trouble passing the window object
                // around, causing it to be cloned in the process
-               if ( jQuery.browser.msie && elem.setInterval )
+               if ( elem.setInterval && elem != window )
                        elem = window;
 
                // Make sure that the function being executed has a unique ID
@@ -1835,15 +2325,12 @@ jQuery.event = {
                        handler.guid = this.guid++;
 
                // if data is passed, bind to handler
-               if( data != undefined ) {
+               if ( data !== undefined ) {
                        // Create temporary function pointer to original handler
                        var fn = handler;
 
                        // Create unique handler function, wrapped around original handler
-                       handler = this.proxy( fn, function() {
-                               // Pass arguments and context to original handler
-                               return fn.apply(this, arguments);
-                       });
+                       handler = this.proxy( fn );
 
                        // Store data in unique handler
                        handler.data = data;
@@ -1854,8 +2341,9 @@ jQuery.event = {
                        handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){
                                // Handle the second event of a trigger and when
                                // an event is called after a page has unloaded
-                               if ( typeof jQuery != "undefined" && !jQuery.event.triggered )
-                                       return jQuery.event.handle.apply(arguments.callee.elem, arguments);
+                               return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
+                                       jQuery.event.handle.apply(arguments.callee.elem, arguments) :
+                                       undefined;
                        });
                // Add elem as a property of the handle function
                // This is to prevent a memory leak with non-native
@@ -1866,12 +2354,15 @@ jQuery.event = {
                // jQuery(...).bind("mouseover mouseout", fn);
                jQuery.each(types.split(/\s+/), function(index, type) {
                        // Namespaced event handlers
-                       var parts = type.split(".");
-                       type = parts[0];
-                       handler.type = parts[1];
+                       var namespaces = type.split(".");
+                       type = namespaces.shift();
+                       handler.type = namespaces.slice().sort().join(".");
 
                        // Get the current list of functions bound to this event
                        var handlers = events[type];
+                       
+                       if ( jQuery.event.specialAll[type] )
+                               jQuery.event.specialAll[type].setup.call(elem, data, namespaces);
 
                        // Init the event handler queue
                        if (!handlers) {
@@ -1880,7 +2371,7 @@ jQuery.event = {
                                // Check for a special event handler
                                // Only use addEventListener/attachEvent if the special
                                // events handler returns false
-                               if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) {
+                               if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem, data, namespaces) === false ) {
                                        // Bind the global event handler to the element
                                        if (elem.addEventListener)
                                                elem.addEventListener(type, handle, false);
@@ -1913,7 +2404,7 @@ jQuery.event = {
 
                if ( events ) {
                        // Unbind all events for the element
-                       if ( types == undefined || (typeof types == "string" && types.charAt(0) == ".") )
+                       if ( types === undefined || (typeof types === "string" && types.charAt(0) == ".") )
                                for ( var type in events )
                                        this.remove( elem, type + (types || "") );
                        else {
@@ -1927,8 +2418,9 @@ jQuery.event = {
                                // jQuery(...).unbind("mouseover mouseout", fn);
                                jQuery.each(types.split(/\s+/), function(index, type){
                                        // Namespaced event handlers
-                                       var parts = type.split(".");
-                                       type = parts[0];
+                                       var namespaces = type.split(".");
+                                       type = namespaces.shift();
+                                       var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
 
                                        if ( events[type] ) {
                                                // remove the given handler for the given type
@@ -1937,15 +2429,18 @@ jQuery.event = {
 
                                                // remove all handlers for the given type
                                                else
-                                                       for ( handler in events[type] )
+                                                       for ( var handle in events[type] )
                                                                // Handle the removal of namespaced events
-                                                               if ( !parts[1] || events[type][handler].type == parts[1] )
-                                                                       delete events[type][handler];
+                                                               if ( namespace.test(events[type][handle].type) )
+                                                                       delete events[type][handle];
+                                                                       
+                                               if ( jQuery.event.specialAll[type] )
+                                                       jQuery.event.specialAll[type].teardown.call(elem, namespaces);
 
                                                // remove generic event handler if no more handlers exist
                                                for ( ret in events[type] ) break;
                                                if ( !ret ) {
-                                                       if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem) === false ) {
+                                                       if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem, namespaces) === false ) {
                                                                if (elem.removeEventListener)
                                                                        elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
                                                                else if (elem.detachEvent)
@@ -1969,97 +2464,95 @@ jQuery.event = {
                }
        },
 
-       trigger: function(type, data, elem, donative, extra) {
-               // Clone the incoming data, if any
-               data = jQuery.makeArray(data);
+       // bubbling is internal
+       trigger: function( event, data, elem, bubbling ) {
+               // Event object or event type
+               var type = event.type || event;
+
+               if( !bubbling ){
+                       event = typeof event === "object" ?
+                               // jQuery.Event object
+                               event[expando] ? event :
+                               // Object literal
+                               jQuery.extend( jQuery.Event(type), event ) :
+                               // Just the event type (string)
+                               jQuery.Event(type);
+
+                       if ( type.indexOf("!") >= 0 ) {
+                               event.type = type = type.slice(0, -1);
+                               event.exclusive = true;
+                       }
 
-               if ( type.indexOf("!") >= 0 ) {
-                       type = type.slice(0, -1);
-                       var exclusive = true;
-               }
+                       // Handle a global trigger
+                       if ( !elem ) {
+                               // Don't bubble custom events when global (to avoid too much overhead)
+                               event.stopPropagation();
+                               // Only trigger if we've ever bound an event for it
+                               if ( this.global[type] )
+                                       jQuery.each( jQuery.cache, function(){
+                                               if ( this.events && this.events[type] )
+                                                       jQuery.event.trigger( event, data, this.handle.elem );
+                                       });
+                       }
 
-               // Handle a global trigger
-               if ( !elem ) {
-                       // Only trigger if we've ever bound an event for it
-                       if ( this.global[type] )
-                               jQuery("*").add([window, document]).trigger(type, data);
+                       // Handle triggering a single element
 
-               // Handle triggering a single element
-               } else {
                        // don't do events on text and comment nodes
-                       if ( elem.nodeType == 3 || elem.nodeType == 8 )
+                       if ( !elem || elem.nodeType == 3 || elem.nodeType == 8 )
                                return undefined;
+                       
+                       // Clean up in case it is reused
+                       event.result = undefined;
+                       event.target = elem;
+                       
+                       // Clone the incoming data, if any
+                       data = jQuery.makeArray(data);
+                       data.unshift( event );
+               }
 
-                       var val, ret, fn = jQuery.isFunction( elem[ type ] || null ),
-                               // Check to see if we need to provide a fake event, or not
-                               event = !data[0] || !data[0].preventDefault;
-
-                       // Pass along a fake event
-                       if ( event ) {
-                               data.unshift({
-                                       type: type,
-                                       target: elem,
-                                       preventDefault: function(){},
-                                       stopPropagation: function(){},
-                                       timeStamp: now()
-                               });
-                               data[0][expando] = true; // no need to fix fake event
-                       }
+               event.currentTarget = elem;
 
-                       // Enforce the right trigger type
-                       data[0].type = type;
-                       if ( exclusive )
-                               data[0].exclusive = true;
-
-                       // Trigger the event, it is assumed that "handle" is a function
-                       var handle = jQuery.data(elem, "handle");
-                       if ( handle )
-                               val = handle.apply( elem, data );
-
-                       // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)
-                       if ( (!fn || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
-                               val = false;
-
-                       // Extra functions don't get the custom event object
-                       if ( event )
-                               data.shift();
-
-                       // Handle triggering of extra function
-                       if ( extra && jQuery.isFunction( extra ) ) {
-                               // call the extra function and tack the current return value on the end for possible inspection
-                               ret = extra.apply( elem, val == null ? data : data.concat( val ) );
-                               // if anything is returned, give it precedence and have it overwrite the previous value
-                               if (ret !== undefined)
-                                       val = ret;
-                       }
+               // Trigger the event, it is assumed that "handle" is a function
+               var handle = jQuery.data(elem, "handle");
+               if ( handle )
+                       handle.apply( elem, data );
 
-                       // Trigger the native events (except for clicks on links)
-                       if ( fn && donative !== false && val !== false && !(jQuery.nodeName(elem, 'a') && type == "click") ) {
-                               this.triggered = true;
-                               try {
-                                       elem[ type ]();
-                               // prevent IE from throwing an error for some hidden elements
-                               } catch (e) {}
-                       }
+               // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)
+               if ( (!elem[type] || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
+                       event.result = false;
 
-                       this.triggered = false;
+               // Trigger the native events (except for clicks on links)
+               if ( !bubbling && elem[type] && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type == "click") ) {
+                       this.triggered = true;
+                       try {
+                               elem[ type ]();
+                       // prevent IE from throwing an error for some hidden elements
+                       } catch (e) {}
                }
 
-               return val;
+               this.triggered = false;
+
+               if ( !event.isPropagationStopped() ) {
+                       var parent = elem.parentNode || elem.ownerDocument;
+                       if ( parent )
+                               jQuery.event.trigger(event, data, parent, true);
+               }
        },
 
        handle: function(event) {
                // returned undefined or false
-               var val, ret, namespace, all, handlers;
+               var all, handlers;
 
                event = arguments[0] = jQuery.event.fix( event || window.event );
 
                // Namespaced event handlers
-               namespace = event.type.split(".");
-               event.type = namespace[0];
-               namespace = namespace[1];
+               var namespaces = event.type.split(".");
+               event.type = namespaces.shift();
+
                // Cache this now, all = true means, any handler
-               all = !namespace && !event.exclusive;
+               all = !namespaces.length && !event.exclusive;
+               
+               var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
 
                handlers = ( jQuery.data(this, "events") || {} )[event.type];
 
@@ -2067,61 +2560,44 @@ jQuery.event = {
                        var handler = handlers[j];
 
                        // Filter the functions by class
-                       if ( all || handler.type == namespace ) {
+                       if ( all || namespace.test(handler.type) ) {
                                // Pass in a reference to the handler function itself
                                // So that we can later remove it
                                event.handler = handler;
                                event.data = handler.data;
 
-                               ret = handler.apply( this, arguments );
-
-                               if ( val !== false )
-                                       val = ret;
+                               var ret = handler.apply(this, arguments);
 
-                               if ( ret === false ) {
-                                       event.preventDefault();
-                                       event.stopPropagation();
+                               if( ret !== undefined ){
+                                       event.result = ret;
+                                       if ( ret === false ) {
+                                               event.preventDefault();
+                                               event.stopPropagation();
+                                       }
                                }
+
+                               if( event.isImmediatePropagationStopped() )
+                                       break;
+
                        }
                }
-
-               return val;
        },
 
+       props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
+
        fix: function(event) {
-               if ( event[expando] == true )
+               if ( event[expando] )
                        return event;
 
                // store a copy of the original event object
                // and "clone" to set read-only properties
                var originalEvent = event;
-               event = { originalEvent: originalEvent };
-               var props = "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");
-               for ( var i=props.length; i; i-- )
-                       event[ props[i] ] = originalEvent[ props[i] ];
-
-               // Mark it as fixed
-               event[expando] = true;
-
-               // add preventDefault and stopPropagation since
-               // they will not work on the clone
-               event.preventDefault = function() {
-                       // if preventDefault exists run it on the original event
-                       if (originalEvent.preventDefault)
-                               originalEvent.preventDefault();
-                       // otherwise set the returnValue property of the original event to false (IE)
-                       originalEvent.returnValue = false;
-               };
-               event.stopPropagation = function() {
-                       // if stopPropagation exists run it on the original event
-                       if (originalEvent.stopPropagation)
-                               originalEvent.stopPropagation();
-                       // otherwise set the cancelBubble property of the original event to true (IE)
-                       originalEvent.cancelBubble = true;
-               };
+               event = jQuery.Event( originalEvent );
 
-               // Fix timeStamp
-               event.timeStamp = event.timeStamp || now();
+               for ( var i = this.props.length, prop; i; ){
+                       prop = this.props[ --i ];
+                       event[ prop ] = originalEvent[ prop ];
+               }
 
                // Fix target property, if necessary
                if ( !event.target )
@@ -2159,6 +2635,7 @@ jQuery.event = {
        },
 
        proxy: function( fn, proxy ){
+               proxy = proxy || function(){ return fn.apply(this, arguments); };
                // Set the guid of unique handler to the same of original handler, so it can be removed
                proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;
                // So proxy can be declared as an argument
@@ -2167,60 +2644,128 @@ jQuery.event = {
 
        special: {
                ready: {
-                       setup: function() {
-                               // Make sure the ready event is setup
-                               bindReady();
-                               return;
-                       },
-
-                       teardown: function() { return; }
-               },
-
-               mouseenter: {
-                       setup: function() {
-                               if ( jQuery.browser.msie ) return false;
-                               jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler);
-                               return true;
+                       // Make sure the ready event is setup
+                       setup: bindReady,
+                       teardown: function() {}
+               }
+       },
+       
+       specialAll: {
+               live: {
+                       setup: function( selector, namespaces ){
+                               jQuery.event.add( this, namespaces[0], liveHandler );
                        },
+                       teardown:  function( namespaces ){
+                               if ( namespaces.length ) {
+                                       var remove = 0, name = RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)");
+                                       
+                                       jQuery.each( (jQuery.data(this, "events").live || {}), function(){
+                                               if ( name.test(this.type) )
+                                                       remove++;
+                                       });
+                                       
+                                       if ( remove < 1 )
+                                               jQuery.event.remove( this, namespaces[0], liveHandler );
+                               }
+                       }
+               }
+       }
+};
 
-                       teardown: function() {
-                               if ( jQuery.browser.msie ) return false;
-                               jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler);
-                               return true;
-                       },
+jQuery.Event = function( src ){
+       // Allow instantiation without the 'new' keyword
+       if( !this.preventDefault )
+               return new jQuery.Event(src);
+       
+       // Event object
+       if( src && src.type ){
+               this.originalEvent = src;
+               this.type = src.type;
+               this.timeStamp = src.timeStamp;
+       // Event type
+       }else
+               this.type = src;
+
+       if( !this.timeStamp )
+               this.timeStamp = now();
+       
+       // Mark it as fixed
+       this[expando] = true;
+};
 
-                       handler: function(event) {
-                               // If we actually just moused on to a sub-element, ignore it
-                               if ( withinElement(event, this) ) return true;
-                               // Execute the right handlers by setting the event type to mouseenter
-                               event.type = "mouseenter";
-                               return jQuery.event.handle.apply(this, arguments);
-                       }
-               },
+function returnFalse(){
+       return false;
+}
+function returnTrue(){
+       return true;
+}
 
-               mouseleave: {
-                       setup: function() {
-                               if ( jQuery.browser.msie ) return false;
-                               jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler);
-                               return true;
-                       },
+// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
+// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
+jQuery.Event.prototype = {
+       preventDefault: function() {
+               this.isDefaultPrevented = returnTrue;
 
-                       teardown: function() {
-                               if ( jQuery.browser.msie ) return false;
-                               jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler);
-                               return true;
-                       },
+               var e = this.originalEvent;
+               if( !e )
+                       return;
+               // if preventDefault exists run it on the original event
+               if (e.preventDefault)
+                       e.preventDefault();
+               // otherwise set the returnValue property of the original event to false (IE)
+               e.returnValue = false;
+       },
+       stopPropagation: function() {
+               this.isPropagationStopped = returnTrue;
 
-                       handler: function(event) {
-                               // If we actually just moused on to a sub-element, ignore it
-                               if ( withinElement(event, this) ) return true;
-                               // Execute the right handlers by setting the event type to mouseleave
-                               event.type = "mouseleave";
-                               return jQuery.event.handle.apply(this, arguments);
-                       }
-               }
+               var e = this.originalEvent;
+               if( !e )
+                       return;
+               // if stopPropagation exists run it on the original event
+               if (e.stopPropagation)
+                       e.stopPropagation();
+               // otherwise set the cancelBubble property of the original event to true (IE)
+               e.cancelBubble = true;
+       },
+       stopImmediatePropagation:function(){
+               this.isImmediatePropagationStopped = returnTrue;
+               this.stopPropagation();
+       },
+       isDefaultPrevented: returnFalse,
+       isPropagationStopped: returnFalse,
+       isImmediatePropagationStopped: returnFalse
+};
+// Checks if an event happened on an element within another element
+// Used in jQuery.event.special.mouseenter and mouseleave handlers
+var withinElement = function(event) {
+       // Check if mouse(over|out) are still within the same parent element
+       var parent = event.relatedTarget;
+       // Traverse up the tree
+       while ( parent && parent != this )
+               try { parent = parent.parentNode; }
+               catch(e) { parent = this; }
+       
+       if( parent != this ){
+               // set the correct event type
+               event.type = event.data;
+               // handle event if we actually just moused on to a non sub-element
+               jQuery.event.handle.apply( this, arguments );
        }
 };
+       
+jQuery.each({ 
+       mouseover: 'mouseenter', 
+       mouseout: 'mouseleave'
+}, function( orig, fix ){
+       jQuery.event.special[ fix ] = {
+               setup: function(){
+                       jQuery.event.add( this, orig, withinElement, fix );
+               },
+               teardown: function(){
+                       jQuery.event.remove( this, orig, withinElement );
+               }
+       };                         
+});
 
 jQuery.fn.extend({
        bind: function( type, data, fn ) {
@@ -2245,14 +2790,20 @@ jQuery.fn.extend({
                });
        },
 
-       trigger: function( type, data, fn ) {
+       trigger: function( type, data ) {
                return this.each(function(){
-                       jQuery.event.trigger( type, data, this, true, fn );
+                       jQuery.event.trigger( type, data, this );
                });
        },
 
-       triggerHandler: function( type, data, fn ) {
-               return this[0] && jQuery.event.trigger( type, data, this[0], false, fn );
+       triggerHandler: function( type, data ) {
+               if( this[0] ){
+                       var event = jQuery.Event(type);
+                       event.preventDefault();
+                       event.stopPropagation();
+                       jQuery.event.trigger( event, data, this[0] );
+                       return event.result;
+               }               
        },
 
        toggle: function( fn ) {
@@ -2276,7 +2827,7 @@ jQuery.fn.extend({
        },
 
        hover: function(fnOver, fnOut) {
-               return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut);
+               return this.mouseenter(fnOver).mouseleave(fnOut);
        },
 
        ready: function(fn) {
@@ -2291,12 +2842,52 @@ jQuery.fn.extend({
                // Otherwise, remember the function for later
                else
                        // Add the function to the wait list
-                       jQuery.readyList.push( function() { return fn.call(this, jQuery); } );
+                       jQuery.readyList.push( fn );
+
+               return this;
+       },
+       
+       live: function( type, fn ){
+               var proxy = jQuery.event.proxy( fn );
+               proxy.guid += this.selector + type;
 
+               jQuery(document).bind( liveConvert(type, this.selector), this.selector, proxy );
+
+               return this;
+       },
+       
+       die: function( type, fn ){
+               jQuery(document).unbind( liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector + type } : null );
                return this;
        }
 });
 
+function liveHandler( event ){
+       var check = RegExp("(^|\\.)" + event.type + "(\\.|$)"),
+               stop = true,
+               elems = [];
+
+       jQuery.each(jQuery.data(this, "events").live || [], function(i, fn){
+               if ( check.test(fn.type) ) {
+                       var elem = jQuery(event.target).closest(fn.data)[0];
+                       if ( elem )
+                               elems.push({ elem: elem, fn: fn });
+               }
+       });
+
+       jQuery.each(elems, function(){
+               if ( !event.isImmediatePropagationStopped() &&
+                       this.fn.call(this.elem, event, this.fn.data) === false )
+                               stop = false;
+       });
+
+       return stop;
+}
+
+function liveConvert(type, selector){
+       return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "|")].join(".");
+}
+
 jQuery.extend({
        isReady: false,
        readyList: [],
@@ -2311,7 +2902,7 @@ jQuery.extend({
                        if ( jQuery.readyList ) {
                                // Execute all of them
                                jQuery.each( jQuery.readyList, function(){
-                                       this.call( document );
+                                       this.call( document, jQuery );
                                });
 
                                // Reset the list of functions
@@ -2330,53 +2921,39 @@ function bindReady(){
        if ( readyBound ) return;
        readyBound = true;
 
-       // Mozilla, Opera (see further below for it) and webkit nightlies currently support this event
-       if ( document.addEventListener && !jQuery.browser.opera)
+       // Mozilla, Opera and webkit nightlies currently support this event
+       if ( document.addEventListener ) {
                // Use the handy event callback
-               document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
-
-       // If IE is used and is not in a frame
-       // Continually check to see if the document is ready
-       if ( jQuery.browser.msie && window == top ) (function(){
-               if (jQuery.isReady) return;
-               try {
-                       // If IE is used, use the trick by Diego Perini
-                       // http://javascript.nwbox.com/IEContentLoaded/
-                       document.documentElement.doScroll("left");
-               } catch( error ) {
-                       setTimeout( arguments.callee, 0 );
-                       return;
-               }
-               // and execute any waiting functions
-               jQuery.ready();
-       })();
-
-       if ( jQuery.browser.opera )
-               document.addEventListener( "DOMContentLoaded", function () {
-                       if (jQuery.isReady) return;
-                       for (var i = 0; i < document.styleSheets.length; i++)
-                               if (document.styleSheets[i].disabled) {
-                                       setTimeout( arguments.callee, 0 );
-                                       return;
-                               }
-                       // and execute any waiting functions
+               document.addEventListener( "DOMContentLoaded", function(){
+                       document.removeEventListener( "DOMContentLoaded", arguments.callee, false );
                        jQuery.ready();
-               }, false);
-
-       if ( jQuery.browser.safari ) {
-               var numStyles;
-               (function(){
-                       if (jQuery.isReady) return;
-                       if ( document.readyState != "loaded" && document.readyState != "complete" ) {
-                               setTimeout( arguments.callee, 0 );
-                               return;
+               }, false );
+
+       // If IE event model is used
+       } else if ( document.attachEvent ) {
+               // ensure firing before onload,
+               // maybe late but safe also for iframes
+               document.attachEvent("onreadystatechange", function(){
+                       if ( document.readyState === "complete" ) {
+                               document.detachEvent( "onreadystatechange", arguments.callee );
+                               jQuery.ready();
                        }
-                       if ( numStyles === undefined )
-                               numStyles = jQuery("style, link[rel=stylesheet]").length;
-                       if ( document.styleSheets.length != numStyles ) {
+               });
+
+               // If IE and not an iframe
+               // continually check to see if the document is ready
+               if ( document.documentElement.doScroll && !window.frameElement ) (function(){
+                       if ( jQuery.isReady ) return;
+
+                       try {
+                               // If IE is used, use the trick by Diego Perini
+                               // http://javascript.nwbox.com/IEContentLoaded/
+                               document.documentElement.doScroll("left");
+                       } catch( error ) {
                                setTimeout( arguments.callee, 0 );
                                return;
                        }
+
                        // and execute any waiting functions
                        jQuery.ready();
                })();
@@ -2387,8 +2964,8 @@ function bindReady(){
 }
 
 jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
-       "mousedown,mouseup,mousemove,mouseover,mouseout,change,select," +
-       "submit,keydown,keypress,keyup,error").split(","), function(i, name){
+       "mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave," +
+       "change,select,submit,keydown,keypress,keyup,error").split(","), function(i, name){
 
        // Handle event binding
        jQuery.fn[name] = function(fn){
@@ -2396,29 +2973,134 @@ jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
        };
 });
 
-// Checks if an event happened on an element within another element
-// Used in jQuery.event.special.mouseenter and mouseleave handlers
-var withinElement = function(event, elem) {
-       // Check if mouse(over|out) are still within the same parent element
-       var parent = event.relatedTarget;
-       // Traverse up the tree
-       while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { parent = elem; }
-       // Return true if we actually just moused on to a sub-element
-       return parent == elem;
-};
-
 // Prevent memory leaks in IE
 // And prevent errors on refresh with events like mouseover in other browsers
 // Window isn't included so as not to unbind existing unload events
-jQuery(window).bind("unload", function() {
-       jQuery("*").add(document).unbind();
-});
+jQuery( window ).bind( 'unload', function(){ 
+       for ( var id in jQuery.cache )
+               // Skip the window
+               if ( id != 1 && jQuery.cache[ id ].handle )
+                       jQuery.event.remove( jQuery.cache[ id ].handle.elem );
+}); 
+(function(){
+
+       jQuery.support = {};
+
+       var root = document.documentElement,
+               script = document.createElement("script"),
+               div = document.createElement("div"),
+               id = "script" + (new Date).getTime();
+
+       div.style.display = "none";
+       div.innerHTML = '   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';
+
+       var all = div.getElementsByTagName("*"),
+               a = div.getElementsByTagName("a")[0];
+
+       // Can't get basic test support
+       if ( !all || !all.length || !a ) {
+               return;
+       }
+
+       jQuery.support = {
+               // IE strips leading whitespace when .innerHTML is used
+               leadingWhitespace: div.firstChild.nodeType == 3,
+               
+               // Make sure that tbody elements aren't automatically inserted
+               // IE will insert them into empty tables
+               tbody: !div.getElementsByTagName("tbody").length,
+               
+               // Make sure that you can get all elements in an <object> element
+               // IE 7 always returns no results
+               objectAll: !!div.getElementsByTagName("object")[0]
+                       .getElementsByTagName("*").length,
+               
+               // Make sure that link elements get serialized correctly by innerHTML
+               // This requires a wrapper element in IE
+               htmlSerialize: !!div.getElementsByTagName("link").length,
+               
+               // Get the style information from getAttribute
+               // (IE uses .cssText insted)
+               style: /red/.test( a.getAttribute("style") ),
+               
+               // Make sure that URLs aren't manipulated
+               // (IE normalizes it by default)
+               hrefNormalized: a.getAttribute("href") === "/a",
+               
+               // Make sure that element opacity exists
+               // (IE uses filter instead)
+               opacity: a.style.opacity === "0.5",
+               
+               // Verify style float existence
+               // (IE uses styleFloat instead of cssFloat)
+               cssFloat: !!a.style.cssFloat,
+
+               // Will be defined later
+               scriptEval: false,
+               noCloneEvent: true,
+               boxModel: null
+       };
+       
+       script.type = "text/javascript";
+       try {
+               script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
+       } catch(e){}
+
+       root.insertBefore( script, root.firstChild );
+       
+       // Make sure that the execution of code works by injecting a script
+       // tag with appendChild/createTextNode
+       // (IE doesn't support this, fails, and uses .text instead)
+       if ( window[ id ] ) {
+               jQuery.support.scriptEval = true;
+               delete window[ id ];
+       }
+
+       root.removeChild( script );
+
+       if ( div.attachEvent && div.fireEvent ) {
+               div.attachEvent("onclick", function(){
+                       // Cloning a node shouldn't copy over any
+                       // bound event handlers (IE does this)
+                       jQuery.support.noCloneEvent = false;
+                       div.detachEvent("onclick", arguments.callee);
+               });
+               div.cloneNode(true).fireEvent("onclick");
+       }
+
+       // Figure out if the W3C box model works as expected
+       // document.body must exist before we can do this
+       jQuery(function(){
+               var div = document.createElement("div");
+               div.style.width = "1px";
+               div.style.paddingLeft = "1px";
+
+               document.body.appendChild( div );
+               jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
+               document.body.removeChild( div );
+       });
+})();
+
+var styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat";
+
+jQuery.props = {
+       "for": "htmlFor",
+       "class": "className",
+       "float": styleFloat,
+       cssFloat: styleFloat,
+       styleFloat: styleFloat,
+       readonly: "readOnly",
+       maxlength: "maxLength",
+       cellspacing: "cellSpacing",
+       rowspan: "rowSpan",
+       tabindex: "tabIndex"
+};
 jQuery.fn.extend({
        // Keep a copy of the old load
        _load: jQuery.fn.load,
 
        load: function( url, params, callback ) {
-               if ( typeof url != 'string' )
+               if ( typeof url !== "string" )
                        return this._load( url );
 
                var off = url.indexOf(" ");
@@ -2427,8 +3109,6 @@ jQuery.fn.extend({
                        url = url.slice(0, off);
                }
 
-               callback = callback || function(){};
-
                // Default to a GET request
                var type = "GET";
 
@@ -2441,7 +3121,7 @@ jQuery.fn.extend({
                                params = null;
 
                        // Otherwise, build a param string
-                       } else {
+                       } else if( typeof params === "object" ) {
                                params = jQuery.param( params );
                                type = "POST";
                        }
@@ -2471,7 +3151,8 @@ jQuery.fn.extend({
                                                // If not, just inject the full result
                                                res.responseText );
 
-                               self.each( callback, [res.responseText, status, res] );
+                               if( callback )
+                                       self.each( callback, [res.responseText, status, res] );
                        }
                });
                return this;
@@ -2482,8 +3163,7 @@ jQuery.fn.extend({
        },
        serializeArray: function() {
                return this.map(function(){
-                       return jQuery.nodeName(this, "form") ?
-                               jQuery.makeArray(this.elements) : this;
+                       return this.elements ? jQuery.makeArray(this.elements) : this;
                })
                .filter(function(){
                        return this.name && !this.disabled &&
@@ -2493,7 +3173,7 @@ jQuery.fn.extend({
                .map(function(i, elem){
                        var val = jQuery(this).val();
                        return val == null ? null :
-                               val.constructor == Array ?
+                               jQuery.isArray(val) ?
                                        jQuery.map( val, function(val, i){
                                                return {name: elem.name, value: val};
                                        }) :
@@ -2512,6 +3192,7 @@ jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".sp
 var jsc = now();
 
 jQuery.extend({
+  
        get: function( url, data, callback, type ) {
                // shift arguments if data argument was ommited
                if ( jQuery.isFunction( data ) ) {
@@ -2559,13 +3240,21 @@ jQuery.extend({
                url: location.href,
                global: true,
                type: "GET",
-               timeout: 0,
                contentType: "application/x-www-form-urlencoded",
                processData: true,
                async: true,
+               /*
+               timeout: 0,
                data: null,
                username: null,
                password: null,
+               */
+               // Create the request object; Microsoft failed to properly
+               // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
+               // This function can be overriden by calling jQuery.ajaxSetup
+               xhr:function(){
+                       return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
+               },
                accepts: {
                        xml: "application/xml, text/xml",
                        html: "text/html",
@@ -2588,7 +3277,7 @@ jQuery.extend({
                        type = s.type.toUpperCase();
 
                // convert data if not already a string
-               if ( s.data && s.processData && typeof s.data != "string" )
+               if ( s.data && s.processData && typeof s.data !== "string" )
                        s.data = jQuery.param(s.data);
 
                // Handle JSONP Parameter Callbacks
@@ -2651,12 +3340,13 @@ jQuery.extend({
                        jQuery.event.trigger( "ajaxStart" );
 
                // Matches an absolute URL, and saves the domain
-               var remote = /^(?:\w+:)?\/\/([^\/?#]+)/;
+               var parts = /^(\w+:)?\/\/([^\/?#]+)/.exec( s.url );
 
                // If we're requesting a remote document
                // and trying to load JSON or Script with a GET
-               if ( s.dataType == "script" && type == "GET"
-                               && remote.test(s.url) && remote.exec(s.url)[1] != location.host ){
+               if ( s.dataType == "script" && type == "GET" && parts
+                       && ( parts[1] && parts[1] != location.protocol || parts[2] != location.host )){
+
                        var head = document.getElementsByTagName("head")[0];
                        var script = document.createElement("script");
                        script.src = s.url;
@@ -2687,9 +3377,8 @@ jQuery.extend({
 
                var requestDone = false;
 
-               // Create the request object; Microsoft failed to properly
-               // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
-               var xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
+               // Create the request object
+               var xhr = s.xhr();
 
                // Open the socket
                // Passing null username, generates a login popup on Opera (#2865)
@@ -2718,10 +3407,11 @@ jQuery.extend({
                                s.accepts._default );
                } catch(e){}
 
-               // Allow custom headers/mimetypes
+               // Allow custom headers/mimetypes and early abort
                if ( s.beforeSend && s.beforeSend(xhr, s) === false ) {
-                       // cleanup active request counter
-                       s.global && jQuery.active--;
+                       // Handle the global AJAX counter
+                       if ( s.global && ! --jQuery.active )
+                               jQuery.event.trigger( "ajaxStop" );
                        // close opended socket
                        xhr.abort();
                        return false;
@@ -2732,8 +3422,18 @@ jQuery.extend({
 
                // Wait for a response to come back
                var onreadystatechange = function(isTimeout){
+                       // The request was aborted, clear the interval and decrement jQuery.active
+                       if (xhr.readyState == 0) {
+                               if (ival) {
+                                       // clear poll interval
+                                       clearInterval(ival);
+                                       ival = null;
+                                       // Handle the global AJAX counter
+                                       if ( s.global && ! --jQuery.active )
+                                               jQuery.event.trigger( "ajaxStop" );
+                               }
                        // The transfer is complete and the data is available, or the request timed out
-                       if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {
+                       } else if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {
                                requestDone = true;
 
                                // clear poll interval
@@ -2742,16 +3442,16 @@ jQuery.extend({
                                        ival = null;
                                }
 
-                               status = isTimeout == "timeout" && "timeout" ||
-                                       !jQuery.httpSuccess( xhr ) && "error" ||
-                                       s.ifModified && jQuery.httpNotModified( xhr, s.url ) && "notmodified" ||
+                               status = isTimeout == "timeout" ? "timeout" :
+                                       !jQuery.httpSuccess( xhr ) ? "error" :
+                                       s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? "notmodified" :
                                        "success";
 
                                if ( status == "success" ) {
                                        // Watch for, and catch, XML document parse errors
                                        try {
                                                // process the data (runs the xml through httpData regardless of callback)
-                                               data = jQuery.httpData( xhr, s.dataType, s.dataFilter );
+                                               data = jQuery.httpData( xhr, s.dataType, s );
                                        } catch(e) {
                                                status = "parsererror";
                                        }
@@ -2792,11 +3492,12 @@ jQuery.extend({
                                setTimeout(function(){
                                        // Check to see if the request is still happening
                                        if ( xhr ) {
-                                               // Cancel the request
-                                               xhr.abort();
-
                                                if( !requestDone )
                                                        onreadystatechange( "timeout" );
+
+                                               // Cancel the request
+                                               if ( xhr )
+                                                       xhr.abort();
                                        }
                                }, s.timeout);
                }
@@ -2857,8 +3558,7 @@ jQuery.extend({
                try {
                        // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
                        return !xhr.status && location.protocol == "file:" ||
-                               ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223 ||
-                               jQuery.browser.safari && xhr.status == undefined;
+                               ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223;
                } catch(e){}
                return false;
        },
@@ -2869,13 +3569,12 @@ jQuery.extend({
                        var xhrRes = xhr.getResponseHeader("Last-Modified");
 
                        // Firefox always returns 200. check Last-Modified date
-                       return xhr.status == 304 || xhrRes == jQuery.lastModified[url] ||
-                               jQuery.browser.safari && xhr.status == undefined;
+                       return xhr.status == 304 || xhrRes == jQuery.lastModified[url];
                } catch(e){}
                return false;
        },
 
-       httpData: function( xhr, type, filter ) {
+       httpData: function( xhr, type, s ) {
                var ct = xhr.getResponseHeader("content-type"),
                        xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
                        data = xml ? xhr.responseXML : xhr.responseText;
@@ -2884,31 +3583,40 @@ jQuery.extend({
                        throw "parsererror";
                        
                // Allow a pre-filtering function to sanitize the response
-               if( filter )
-                       data = filter( data, type );
+               // s != null is checked to keep backwards compatibility
+               if( s && s.dataFilter )
+                       data = s.dataFilter( data, type );
 
-               // If the type is "script", eval it in global context
-               if ( type == "script" )
-                       jQuery.globalEval( data );
+               // The filter can actually parse the response
+               if( typeof data === "string" ){
 
-               // Get the JavaScript object, if JSON is used.
-               if ( type == "json" )
-                       data = eval("(" + data + ")");
+                       // If the type is "script", eval it in global context
+                       if ( type == "script" )
+                               jQuery.globalEval( data );
 
+                       // Get the JavaScript object, if JSON is used.
+                       if ( type == "json" )
+                               data = window["eval"]("(" + data + ")");
+               }
+               
                return data;
        },
 
        // Serialize an array of form elements or a set of
        // key/values into a query string
        param: function( a ) {
-               var s = [];
+               var s = [ ];
+
+               function add( key, value ){
+                       s[ s.length ] = encodeURIComponent(key) + '=' + encodeURIComponent(value);
+               };
 
                // If an array was passed in, assume that it is an array
                // of form elements
-               if ( a.constructor == Array || a.jquery )
+               if ( jQuery.isArray(a) || a.jquery )
                        // Serialize the form elements
                        jQuery.each( a, function(){
-                               s.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( this.value ) );
+                               add( this.name, this.value );
                        });
 
                // Otherwise, assume that it's an object of key/value pairs
@@ -2916,83 +3624,99 @@ jQuery.extend({
                        // Serialize the key/values
                        for ( var j in a )
                                // If the value is an array then the key names need to be repeated
-                               if ( a[j] && a[j].constructor == Array )
+                               if ( jQuery.isArray(a[j]) )
                                        jQuery.each( a[j], function(){
-                                               s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) );
+                                               add( j, this );
                                        });
                                else
-                                       s.push( encodeURIComponent(j) + "=" + encodeURIComponent( jQuery.isFunction(a[j]) ? a[j]() : a[j] ) );
+                                       add( j, jQuery.isFunction(a[j]) ? a[j]() : a[j] );
 
                // Return the resulting serialization
                return s.join("&").replace(/%20/g, "+");
        }
 
 });
+var elemdisplay = {},
+       fxAttrs = [
+               // height animations
+               [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
+               // width animations
+               [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
+               // opacity animations
+               [ "opacity" ]
+       ];
+
+function genFx( type, num ){
+       var obj = {};
+       jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function(){
+               obj[ this ] = type;
+       });
+       return obj;
+}
+
 jQuery.fn.extend({
        show: function(speed,callback){
-               return speed ?
-                       this.animate({
-                               height: "show", width: "show", opacity: "show"
-                       }, speed, callback) :
-
-                       this.filter(":hidden").each(function(){
-                               this.style.display = this.oldblock || "";
-                               if ( jQuery.css(this,"display") == "none" ) {
-                                       var elem = jQuery("<" + this.tagName + " />").appendTo("body");
-                                       this.style.display = elem.css("display");
-                                       // handle an edge condition where css is - div { display:none; } or similar
-                                       if (this.style.display == "none")
-                                               this.style.display = "block";
-                                       elem.remove();
+               if ( speed ) {
+                       return this.animate( genFx("show", 3), speed, callback);
+               } else {
+                       for ( var i = 0, l = this.length; i < l; i++ ){
+                               var old = jQuery.data(this[i], "olddisplay");
+                               
+                               this[i].style.display = old || "";
+                               
+                               if ( jQuery.css(this[i], "display") === "none" ) {
+                                       var tagName = this[i].tagName, display;
+                                       
+                                       if ( elemdisplay[ tagName ] ) {
+                                               display = elemdisplay[ tagName ];
+                                       } else {
+                                               var elem = jQuery("<" + tagName + " />").appendTo("body");
+                                               
+                                               display = elem.css("display");
+                                               if ( display === "none" )
+                                                       display = "block";
+                                               
+                                               elem.remove();
+                                               
+                                               elemdisplay[ tagName ] = display;
+                                       }
+                                       
+                                       this[i].style.display = jQuery.data(this[i], "olddisplay", display);
                                }
-                       }).end();
+                       }
+                       
+                       return this;
+               }
        },
 
        hide: function(speed,callback){
-               return speed ?
-                       this.animate({
-                               height: "hide", width: "hide", opacity: "hide"
-                       }, speed, callback) :
-
-                       this.filter(":visible").each(function(){
-                               this.oldblock = this.oldblock || jQuery.css(this,"display");
-                               this.style.display = "none";
-                       }).end();
+               if ( speed ) {
+                       return this.animate( genFx("hide", 3), speed, callback);
+               } else {
+                       for ( var i = 0, l = this.length; i < l; i++ ){
+                               var old = jQuery.data(this[i], "olddisplay");
+                               if ( !old && old !== "none" )
+                                       jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));
+                               this[i].style.display = "none";
+                       }
+                       return this;
+               }
        },
 
        // Save the old toggle function
        _toggle: jQuery.fn.toggle,
 
        toggle: function( fn, fn2 ){
+               var bool = typeof fn === "boolean";
+
                return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
                        this._toggle.apply( this, arguments ) :
-                       fn ?
-                               this.animate({
-                                       height: "toggle", width: "toggle", opacity: "toggle"
-                               }, fn, fn2) :
+                       fn == null || bool ?
                                this.each(function(){
-                                       jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
-                               });
-       },
-
-       slideDown: function(speed,callback){
-               return this.animate({height: "show"}, speed, callback);
-       },
-
-       slideUp: function(speed,callback){
-               return this.animate({height: "hide"}, speed, callback);
-       },
-
-       slideToggle: function(speed, callback){
-               return this.animate({height: "toggle"}, speed, callback);
-       },
-
-       fadeIn: function(speed, callback){
-               return this.animate({opacity: "show"}, speed, callback);
-       },
-
-       fadeOut: function(speed, callback){
-               return this.animate({opacity: "hide"}, speed, callback);
+                                       var state = bool ? fn : jQuery(this).is(":hidden");
+                                       jQuery(this)[ state ? "show" : "hide" ]();
+                               }) :
+                               this.animate(genFx("toggle", 3), fn, fn2);
        },
 
        fadeTo: function(speed,to,callback){
@@ -3003,17 +3727,16 @@ jQuery.fn.extend({
                var optall = jQuery.speed(speed, easing, callback);
 
                return this[ optall.queue === false ? "each" : "queue" ](function(){
-                       if ( this.nodeType != 1)
-                               return false;
-
+               
                        var opt = jQuery.extend({}, optall), p,
-                               hidden = jQuery(this).is(":hidden"), self = this;
-
+                               hidden = this.nodeType == 1 && jQuery(this).is(":hidden"),
+                               self = this;
+       
                        for ( p in prop ) {
                                if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
                                        return opt.complete.call(this);
 
-                               if ( p == "height" || p == "width" ) {
+                               if ( ( p == "height" || p == "width" ) && this.style ) {
                                        // Store display property
                                        opt.display = jQuery.css(this, "display");
 
@@ -3062,27 +3785,6 @@ jQuery.fn.extend({
                });
        },
 
-       queue: function(type, fn){
-               if ( jQuery.isFunction(type) || ( type && type.constructor == Array )) {
-                       fn = type;
-                       type = "fx";
-               }
-
-               if ( !type || (typeof type == "string" && !fn) )
-                       return queue( this[0], type );
-
-               return this.each(function(){
-                       if ( fn.constructor == Array )
-                               queue(this, type, fn);
-                       else {
-                               queue(this, type).push( fn );
-
-                               if ( queue(this, type).length == 1 )
-                                       fn.call(this);
-                       }
-               });
-       },
-
        stop: function(clearQueue, gotoEnd){
                var timers = jQuery.timers;
 
@@ -3109,46 +3811,31 @@ jQuery.fn.extend({
 
 });
 
-var queue = function( elem, type, array ) {
-       if ( elem ){
-
-               type = type || "fx";
-
-               var q = jQuery.data( elem, type + "queue" );
-
-               if ( !q || array )
-                       q = jQuery.data( elem, type + "queue", jQuery.makeArray(array) );
-
-       }
-       return q;
-};
-
-jQuery.fn.dequeue = function(type){
-       type = type || "fx";
-
-       return this.each(function(){
-               var q = queue(this, type);
-
-               q.shift();
-
-               if ( q.length )
-                       q[0].call( this );
-       });
-};
+// Generate shortcuts for custom animations
+jQuery.each({
+       slideDown: genFx("show", 1),
+       slideUp: genFx("hide", 1),
+       slideToggle: genFx("toggle", 1),
+       fadeIn: { opacity: "show" },
+       fadeOut: { opacity: "hide" }
+}, function( name, props ){
+       jQuery.fn[ name ] = function( speed, callback ){
+               return this.animate( props, speed, callback );
+       };
+});
 
 jQuery.extend({
 
        speed: function(speed, easing, fn) {
-               var opt = speed && speed.constructor == Object ? speed : {
+               var opt = typeof speed === "object" ? speed : {
                        complete: fn || !fn && easing ||
                                jQuery.isFunction( speed ) && speed,
                        duration: speed,
-                       easing: fn && easing || easing && easing.constructor != Function && easing
+                       easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
                };
 
-               opt.duration = (opt.duration && opt.duration.constructor == Number ?
-                       opt.duration :
-                       jQuery.fx.speeds[opt.duration]) || jQuery.fx.speeds.def;
+               opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
+                       jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default;
 
                // Queueing
                opt.old = opt.complete;
@@ -3195,13 +3882,13 @@ jQuery.fx.prototype = {
                (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
 
                // Set display property to block for height/width animations
-               if ( this.prop == "height" || this.prop == "width" )
+               if ( ( this.prop == "height" || this.prop == "width" ) && this.elem.style )
                        this.elem.style.display = "block";
        },
 
        // Get the current size
        cur: function(force){
-               if ( this.elem[this.prop] != null && this.elem.style[this.prop] == null )
+               if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) )
                        return this.elem[ this.prop ];
 
                var r = parseFloat(jQuery.css(this.elem, this.prop, force));
@@ -3216,7 +3903,6 @@ jQuery.fx.prototype = {
                this.unit = unit || this.unit || "px";
                this.now = this.start;
                this.pos = this.state = 0;
-               this.update();
 
                var self = this;
                function t(gotoEnd){
@@ -3227,7 +3913,7 @@ jQuery.fx.prototype = {
 
                jQuery.timers.push(t);
 
-               if ( jQuery.timerId == null ) {
+               if ( t() && jQuery.timerId == null ) {
                        jQuery.timerId = setInterval(function(){
                                var timers = jQuery.timers;
 
@@ -3250,12 +3936,9 @@ jQuery.fx.prototype = {
                this.options.show = true;
 
                // Begin the animation
-               this.custom(0, this.cur());
-
                // Make sure that we start at a small width/height to avoid any
                // flash of content
-               if ( this.prop == "width" || this.prop == "height" )
-                       this.elem.style[this.prop] = "1px";
+               this.custom(this.prop == "width" || this.prop == "height" ? 1 : 0, this.cur());
 
                // Start by showing the element
                jQuery(this.elem).show();
@@ -3275,7 +3958,7 @@ jQuery.fx.prototype = {
        step: function(gotoEnd){
                var t = now();
 
-               if ( gotoEnd || t > this.options.duration + this.startTime ) {
+               if ( gotoEnd || t >= this.options.duration + this.startTime ) {
                        this.now = this.end;
                        this.pos = this.state = 1;
                        this.update();
@@ -3300,7 +3983,7 @@ jQuery.fx.prototype = {
 
                                // Hide the element if the "hide" operation was done
                                if ( this.options.hide )
-                                       this.elem.style.display = "none";
+                                       jQuery(this.elem).hide();
 
                                // Reset the properties, if the item has been hidden or shown
                                if ( this.options.hide || this.options.show )
@@ -3335,124 +4018,106 @@ jQuery.extend( jQuery.fx, {
                slow: 600,
                fast: 200,
                // Default speed
-               def: 400
+               _default: 400
        },
        step: {
-               scrollLeft: function(fx){
-                       fx.elem.scrollLeft = fx.now;
-               },
-
-               scrollTop: function(fx){
-                       fx.elem.scrollTop = fx.now;
-               },
 
                opacity: function(fx){
                        jQuery.attr(fx.elem.style, "opacity", fx.now);
                },
 
                _default: function(fx){
-                       fx.elem.style[ fx.prop ] = fx.now + fx.unit;
+                       if ( fx.elem.style && fx.elem.style[ fx.prop ] != null )
+                               fx.elem.style[ fx.prop ] = fx.now + fx.unit;
+                       else
+                               fx.elem[ fx.prop ] = fx.now;
                }
        }
 });
-// The Offset Method
-// Originally By Brandon Aaron, part of the Dimension Plugin
-// http://jquery.com/plugins/project/dimensions
-jQuery.fn.offset = function() {
-       var left = 0, top = 0, elem = this[0], results;
-
-       if ( elem ) with ( jQuery.browser ) {
-               var parent       = elem.parentNode,
-                   offsetChild  = elem,
-                   offsetParent = elem.offsetParent,
-                   doc          = elem.ownerDocument,
-                   safari2      = safari && parseInt(version) < 522 && !/adobeair/i.test(userAgent),
-                   css          = jQuery.curCSS,
-                   fixed        = css(elem, "position") == "fixed";
-
-               // Use getBoundingClientRect if available
-               if ( elem.getBoundingClientRect ) {
-                       var box = elem.getBoundingClientRect();
-
-                       // Add the document scroll offsets
-                       add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
-                               box.top  + Math.max(doc.documentElement.scrollTop,  doc.body.scrollTop));
-
-                       // IE adds the HTML element's border, by default it is medium which is 2px
-                       // IE 6 and 7 quirks mode the border width is overwritable by the following css html { border: 0; }
-                       // IE 7 standards mode, the border is always 2px
-                       // This border/offset is typically represented by the clientLeft and clientTop properties
-                       // However, in IE6 and 7 quirks mode the clientLeft and clientTop properties are not updated when overwriting it via CSS
-                       // Therefore this method will be off by 2px in IE while in quirksmode
-                       add( -doc.documentElement.clientLeft, -doc.documentElement.clientTop );
-
-               // Otherwise loop through the offsetParents and parentNodes
-               } else {
-
-                       // Initial element offsets
-                       add( elem.offsetLeft, elem.offsetTop );
-
-                       // Get parent offsets
-                       while ( offsetParent ) {
-                               // Add offsetParent offsets
-                               add( offsetParent.offsetLeft, offsetParent.offsetTop );
+if ( document.documentElement["getBoundingClientRect"] )
+       jQuery.fn.offset = function() {
+               if ( !this[0] ) return { top: 0, left: 0 };
+               if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
+               var box  = this[0].getBoundingClientRect(), doc = this[0].ownerDocument, body = doc.body, docElem = doc.documentElement,
+                       clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,
+                       top  = box.top  + (self.pageYOffset || jQuery.boxModel && docElem.scrollTop  || body.scrollTop ) - clientTop,
+                       left = box.left + (self.pageXOffset || jQuery.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft;
+               return { top: top, left: left };
+       };
+else 
+       jQuery.fn.offset = function() {
+               if ( !this[0] ) return { top: 0, left: 0 };
+               if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
+               jQuery.offset.initialized || jQuery.offset.initialize();
+
+               var elem = this[0], offsetParent = elem.offsetParent, prevOffsetParent = elem,
+                       doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement,
+                       body = doc.body, defaultView = doc.defaultView,
+                       prevComputedStyle = defaultView.getComputedStyle(elem, null),
+                       top = elem.offsetTop, left = elem.offsetLeft;
+
+               while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
+                       computedStyle = defaultView.getComputedStyle(elem, null);
+                       top -= elem.scrollTop, left -= elem.scrollLeft;
+                       if ( elem === offsetParent ) {
+                               top += elem.offsetTop, left += elem.offsetLeft;
+                               if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.tagName)) )
+                                       top  += parseInt( computedStyle.borderTopWidth,  10) || 0,
+                                       left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
+                               prevOffsetParent = offsetParent, offsetParent = elem.offsetParent;
+                       }
+                       if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" )
+                               top  += parseInt( computedStyle.borderTopWidth,  10) || 0,
+                               left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
+                       prevComputedStyle = computedStyle;
+               }
 
-                               // Mozilla and Safari > 2 does not include the border on offset parents
-                               // However Mozilla adds the border for table or table cells
-                               if ( mozilla && !/^t(able|d|h)$/i.test(offsetParent.tagName) || safari && !safari2 )
-                                       border( offsetParent );
+               if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" )
+                       top  += body.offsetTop,
+                       left += body.offsetLeft;
 
-                               // Add the document scroll offsets if position is fixed on any offsetParent
-                               if ( !fixed && css(offsetParent, "position") == "fixed" )
-                                       fixed = true;
+               if ( prevComputedStyle.position === "fixed" )
+                       top  += Math.max(docElem.scrollTop, body.scrollTop),
+                       left += Math.max(docElem.scrollLeft, body.scrollLeft);
 
-                               // Set offsetChild to previous offsetParent unless it is the body element
-                               offsetChild  = /^body$/i.test(offsetParent.tagName) ? offsetChild : offsetParent;
-                               // Get next offsetParent
-                               offsetParent = offsetParent.offsetParent;
-                       }
+               return { top: top, left: left };
+       };
 
-                       // Get parent scroll offsets
-                       while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) {
-                               // Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug
-                               if ( !/^inline|table.*$/i.test(css(parent, "display")) )
-                                       // Subtract parent scroll offsets
-                                       add( -parent.scrollLeft, -parent.scrollTop );
+jQuery.offset = {
+       initialize: function() {
+               if ( this.initialized ) return;
+               var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, rules, prop, bodyMarginTop = body.style.marginTop,
+                       html = '<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"cellpadding="0"cellspacing="0"><tr><td></td></tr></table>';
 
-                               // Mozilla does not add the border for a parent that has overflow != visible
-                               if ( mozilla && css(parent, "overflow") != "visible" )
-                                       border( parent );
+               rules = { position: 'absolute', top: 0, left: 0, margin: 0, border: 0, width: '1px', height: '1px', visibility: 'hidden' };
+               for ( prop in rules ) container.style[prop] = rules[prop];
 
-                               // Get next parent
-                               parent = parent.parentNode;
-                       }
+               container.innerHTML = html;
+               body.insertBefore(container, body.firstChild);
+               innerDiv = container.firstChild, checkDiv = innerDiv.firstChild, td = innerDiv.nextSibling.firstChild.firstChild;
 
-                       // Safari <= 2 doubles body offsets with a fixed position element/offsetParent or absolutely positioned offsetChild
-                       // Mozilla doubles body offsets with a non-absolutely positioned offsetChild
-                       if ( (safari2 && (fixed || css(offsetChild, "position") == "absolute")) ||
-                               (mozilla && css(offsetChild, "position") != "absolute") )
-                                       add( -doc.body.offsetLeft, -doc.body.offsetTop );
+               this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
+               this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
 
-                       // Add the document scroll offsets if position is fixed
-                       if ( fixed )
-                               add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
-                                       Math.max(doc.documentElement.scrollTop,  doc.body.scrollTop));
-               }
+               innerDiv.style.overflow = 'hidden', innerDiv.style.position = 'relative';
+               this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
 
-               // Return an object with top and left properties
-               results = { top: top, left: left };
-       }
+               body.style.marginTop = '1px';
+               this.doesNotIncludeMarginInBodyOffset = (body.offsetTop === 0);
+               body.style.marginTop = bodyMarginTop;
 
-       function border(elem) {
-               add( jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true) );
-       }
+               body.removeChild(container);
+               this.initialized = true;
+       },
 
-       function add(l, t) {
-               left += parseInt(l, 10) || 0;
-               top += parseInt(t, 10) || 0;
+       bodyOffset: function(body) {
+               jQuery.offset.initialized || jQuery.offset.initialize();
+               var top = body.offsetTop, left = body.offsetLeft;
+               if ( jQuery.offset.doesNotIncludeMarginInBodyOffset )
+                       top  += parseInt( jQuery.curCSS(body, 'marginTop',  true), 10 ) || 0,
+                       left += parseInt( jQuery.curCSS(body, 'marginLeft', true), 10 ) || 0;
+               return { top: top, left: left };
        }
-
-       return results;
 };
 
 
@@ -3471,11 +4136,11 @@ jQuery.fn.extend({
                        // Subtract element margins
                        // note: when an element has margin: auto the offsetLeft and marginLeft 
                        // are the same in Safari causing offset.left to incorrectly be 0
-                       offset.top  -= num( this, 'marginTop' );
+                       offset.top  -= num( this, 'marginTop'  );
                        offset.left -= num( this, 'marginLeft' );
 
                        // Add offsetParent borders
-                       parentOffset.top  += num( offsetParent, 'borderTopWidth' );
+                       parentOffset.top  += num( offsetParent, 'borderTopWidth'  );
                        parentOffset.left += num( offsetParent, 'borderLeftWidth' );
 
                        // Subtract the two offsets
@@ -3489,7 +4154,7 @@ jQuery.fn.extend({
        },
 
        offsetParent: function() {
-               var offsetParent = this[0].offsetParent;
+               var offsetParent = this[0].offsetParent || document.body;
                while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') )
                        offsetParent = offsetParent.offsetParent;
                return jQuery(offsetParent);
@@ -3502,9 +4167,9 @@ jQuery.each( ['Left', 'Top'], function(i, name) {
        var method = 'scroll' + name;
        
        jQuery.fn[ method ] = function(val) {
-               if (!this[0]) return;
+               if (!this[0]) return null;
 
-               return val != undefined ?
+               return val !== undefined ?
 
                        // Set the scroll offset
                        this.each(function() {
@@ -3545,5 +4210,32 @@ jQuery.each([ "Height", "Width" ], function(i, name){
                        (margin ?
                                num(this, "margin" + tl) + num(this, "margin" + br) : 0);
        };
+       
+       var type = name.toLowerCase();
+
+       jQuery.fn[ type ] = function( size ) {
+               // Get window width or height
+               return this[0] == window ?
+                       // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
+                       document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] ||
+                       document.body[ "client" + name ] :
+
+                       // Get document width or height
+                       this[0] == document ?
+                               // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
+                               Math.max(
+                                       document.documentElement["client" + name],
+                                       document.body["scroll" + name], document.documentElement["scroll" + name],
+                                       document.body["offset" + name], document.documentElement["offset" + name]
+                               ) :
+
+                               // Get or set width or height on the element
+                               size === undefined ?
+                                       // Get width or height on the element
+                                       (this.length ? jQuery.css( this[0], type ) : null) :
+
+                                       // Set the width or height on the element (default to pixels if value is unitless)
+                                       this.css( type, typeof size === "string" ? size : size + "px" );
+       };
 
 });})();
index 82b98e1d76664db1090d5622d804553c5ac66297..396646c84231a63731ab718b8747579bbdff5dfa 100644 (file)
@@ -1,32 +1,19 @@
 /*
- * jQuery 1.2.6 - New Wave Javascript
+ * jQuery JavaScript Library v1.3
+ * http://jquery.com/
  *
- * Copyright (c) 2008 John Resig (jquery.com)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright (c) 2009 John Resig
+ * Dual licensed under the MIT and GPL licenses.
+ * http://docs.jquery.com/License
  *
- * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
- * $Rev: 5685 $
+ * Date: 2009-01-13 12:50:31 -0500 (Tue, 13 Jan 2009)
+ * Revision: 6104
  */
-(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else
-return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
-return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
-selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
-return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
-this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else
-return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
-jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&&copy&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
-script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)if(callback.apply(object[name],args)===false)break;}else
-for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else
-for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
-jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
-ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&&notxml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&&notxml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else
-while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else
-while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
-for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
-jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else
-xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
-jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
-for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
-s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
-e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})();
\ No newline at end of file
+(function(){var l=this,g,x=l.jQuery,o=l.$,n=l.jQuery=l.$=function(D,E){return new n.fn.init(D,E)},C=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;n.fn=n.prototype={init:function(D,G){D=D||document;if(D.nodeType){this[0]=D;this.length=1;this.context=D;return this}if(typeof D==="string"){var F=C.exec(D);if(F&&(F[1]||!G)){if(F[1]){D=n.clean([F[1]],G)}else{var H=document.getElementById(F[3]);if(H){if(H.id!=F[3]){return n().find(D)}var E=n(H);E.context=document;E.selector=D;return E}D=[]}}else{return n(G).find(D)}}else{if(n.isFunction(D)){return n(document).ready(D)}}if(D.selector&&D.context){this.selector=D.selector;this.context=D.context}return this.setArray(n.makeArray(D))},selector:"",jquery:"1.3",size:function(){return this.length},get:function(D){return D===g?n.makeArray(this):this[D]},pushStack:function(E,G,D){var F=n(E);F.prevObject=this;F.context=this.context;if(G==="find"){F.selector=this.selector+(this.selector?" ":"")+D}else{if(G){F.selector=this.selector+"."+G+"("+D+")"}}return F},setArray:function(D){this.length=0;Array.prototype.push.apply(this,D);return this},each:function(E,D){return n.each(this,E,D)},index:function(D){return n.inArray(D&&D.jquery?D[0]:D,this)},attr:function(E,G,F){var D=E;if(typeof E==="string"){if(G===g){return this[0]&&n[F||"attr"](this[0],E)}else{D={};D[E]=G}}return this.each(function(H){for(E in D){n.attr(F?this.style:this,E,n.prop(this,D[E],F,H,E))}})},css:function(D,E){if((D=="width"||D=="height")&&parseFloat(E)<0){E=g}return this.attr(D,E,"curCSS")},text:function(E){if(typeof E!=="object"&&E!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(E))}var D="";n.each(E||this,function(){n.each(this.childNodes,function(){if(this.nodeType!=8){D+=this.nodeType!=1?this.nodeValue:n.fn.text([this])}})});return D},wrapAll:function(D){if(this[0]){var E=n(D,this[0].ownerDocument).clone();if(this[0].parentNode){E.insertBefore(this[0])}E.map(function(){var F=this;while(F.firstChild){F=F.firstChild}return F}).append(this)}return this},wrapInner:function(D){return this.each(function(){n(this).contents().wrapAll(D)})},wrap:function(D){return this.each(function(){n(this).wrapAll(D)})},append:function(){return this.domManip(arguments,true,function(D){if(this.nodeType==1){this.appendChild(D)}})},prepend:function(){return this.domManip(arguments,true,function(D){if(this.nodeType==1){this.insertBefore(D,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(D){this.parentNode.insertBefore(D,this)})},after:function(){return this.domManip(arguments,false,function(D){this.parentNode.insertBefore(D,this.nextSibling)})},end:function(){return this.prevObject||n([])},push:[].push,find:function(D){if(this.length===1&&!/,/.test(D)){var F=this.pushStack([],"find",D);F.length=0;n.find(D,this[0],F);return F}else{var E=n.map(this,function(G){return n.find(D,G)});return this.pushStack(/[^+>] [^+>]/.test(D)?n.unique(E):E,"find",D)}},clone:function(E){var D=this.map(function(){if(!n.support.noCloneEvent&&!n.isXMLDoc(this)){var H=this.cloneNode(true),G=document.createElement("div");G.appendChild(H);return n.clean([G.innerHTML])[0]}else{return this.cloneNode(true)}});var F=D.find("*").andSelf().each(function(){if(this[h]!==g){this[h]=null}});if(E===true){this.find("*").andSelf().each(function(H){if(this.nodeType==3){return}var G=n.data(this,"events");for(var J in G){for(var I in G[J]){n.event.add(F[H],J,G[J][I],G[J][I].data)}}})}return D},filter:function(D){return this.pushStack(n.isFunction(D)&&n.grep(this,function(F,E){return D.call(F,E)})||n.multiFilter(D,n.grep(this,function(E){return E.nodeType===1})),"filter",D)},closest:function(D){var E=n.expr.match.POS.test(D)?n(D):null;return this.map(function(){var F=this;while(F&&F.ownerDocument){if(E?E.index(F)>-1:n(F).is(D)){return F}F=F.parentNode}})},not:function(D){if(typeof D==="string"){if(f.test(D)){return this.pushStack(n.multiFilter(D,this,true),"not",D)}else{D=n.multiFilter(D,this)}}var E=D.length&&D[D.length-1]!==g&&!D.nodeType;return this.filter(function(){return E?n.inArray(this,D)<0:this!=D})},add:function(D){return this.pushStack(n.unique(n.merge(this.get(),typeof D==="string"?n(D):n.makeArray(D))))},is:function(D){return !!D&&n.multiFilter(D,this).length>0},hasClass:function(D){return !!D&&this.is("."+D)},val:function(J){if(J===g){var D=this[0];if(D){if(n.nodeName(D,"option")){return(D.attributes.value||{}).specified?D.value:D.text}if(n.nodeName(D,"select")){var H=D.selectedIndex,K=[],L=D.options,G=D.type=="select-one";if(H<0){return null}for(var E=G?H:0,I=G?H+1:L.length;E<I;E++){var F=L[E];if(F.selected){J=n(F).val();if(G){return J}K.push(J)}}return K}return(D.value||"").replace(/\r/g,"")}return g}if(typeof J==="number"){J+=""}return this.each(function(){if(this.nodeType!=1){return}if(n.isArray(J)&&/radio|checkbox/.test(this.type)){this.checked=(n.inArray(this.value,J)>=0||n.inArray(this.name,J)>=0)}else{if(n.nodeName(this,"select")){var M=n.makeArray(J);n("option",this).each(function(){this.selected=(n.inArray(this.value,M)>=0||n.inArray(this.text,M)>=0)});if(!M.length){this.selectedIndex=-1}}else{this.value=J}}})},html:function(D){return D===g?(this[0]?this[0].innerHTML:null):this.empty().append(D)},replaceWith:function(D){return this.after(D).remove()},eq:function(D){return this.slice(D,+D+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(D){return this.pushStack(n.map(this,function(F,E){return D.call(F,E,F)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=n.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild,D=this.length>1?I.cloneNode(true):I;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),G>0?D.cloneNode(true):I)}}if(F){n.each(F,y)}}return this;function K(N,O){return M&&n.nodeName(N,"table")&&n.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};n.fn.init.prototype=n.fn;function y(D,E){if(E.src){n.ajax({url:E.src,async:false,dataType:"script"})}else{n.globalEval(E.text||E.textContent||E.innerHTML||"")}if(E.parentNode){E.parentNode.removeChild(E)}}function e(){return +new Date}n.extend=n.fn.extend=function(){var I=arguments[0]||{},G=1,H=arguments.length,D=false,F;if(typeof I==="boolean"){D=I;I=arguments[1]||{};G=2}if(typeof I!=="object"&&!n.isFunction(I)){I={}}if(H==G){I=this;--G}for(;G<H;G++){if((F=arguments[G])!=null){for(var E in F){var J=I[E],K=F[E];if(I===K){continue}if(D&&K&&typeof K==="object"&&!K.nodeType){I[E]=n.extend(D,J||(K.length!=null?[]:{}),K)}else{if(K!==g){I[E]=K}}}}}return I};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,p=document.defaultView||{},r=Object.prototype.toString;n.extend({noConflict:function(D){l.$=o;if(D){l.jQuery=x}return n},isFunction:function(D){return r.call(D)==="[object Function]"},isArray:function(D){return r.call(D)==="[object Array]"},isXMLDoc:function(D){return D.documentElement&&!D.body||D.tagName&&D.ownerDocument&&!D.ownerDocument.body},globalEval:function(F){F=n.trim(F);if(F){var E=document.getElementsByTagName("head")[0]||document.documentElement,D=document.createElement("script");D.type="text/javascript";if(n.support.scriptEval){D.appendChild(document.createTextNode(F))}else{D.text=F}E.insertBefore(D,E.firstChild);E.removeChild(D)}},nodeName:function(E,D){return E.nodeName&&E.nodeName.toUpperCase()==D.toUpperCase()},each:function(F,J,E){var D,G=0,H=F.length;if(E){if(H===g){for(D in F){if(J.apply(F[D],E)===false){break}}}else{for(;G<H;){if(J.apply(F[G++],E)===false){break}}}}else{if(H===g){for(D in F){if(J.call(F[D],D,F[D])===false){break}}}else{for(var I=F[0];G<H&&J.call(I,G,I)!==false;I=F[++G]){}}}return F},prop:function(G,H,F,E,D){if(n.isFunction(H)){H=H.call(G,E)}return typeof H==="number"&&F=="curCSS"&&!b.test(D)?H+"px":H},className:{add:function(D,E){n.each((E||"").split(/\s+/),function(F,G){if(D.nodeType==1&&!n.className.has(D.className,G)){D.className+=(D.className?" ":"")+G}})},remove:function(D,E){if(D.nodeType==1){D.className=E!==g?n.grep(D.className.split(/\s+/),function(F){return !n.className.has(E,F)}).join(" "):""}},has:function(E,D){return n.inArray(D,(E.className||E).toString().split(/\s+/))>-1}},swap:function(G,F,H){var D={};for(var E in F){D[E]=G.style[E];G.style[E]=F[E]}H.call(G);for(var E in F){G.style[E]=D[E]}},css:function(F,D,H){if(D=="width"||D=="height"){var J,E={position:"absolute",visibility:"hidden",display:"block"},I=D=="width"?["Left","Right"]:["Top","Bottom"];function G(){J=D=="width"?F.offsetWidth:F.offsetHeight;var L=0,K=0;n.each(I,function(){L+=parseFloat(n.curCSS(F,"padding"+this,true))||0;K+=parseFloat(n.curCSS(F,"border"+this+"Width",true))||0});J-=Math.round(L+K)}if(n(F).is(":visible")){G()}else{n.swap(F,E,G)}return Math.max(0,J)}return n.curCSS(F,D,H)},curCSS:function(H,E,F){var K,D=H.style;if(E=="opacity"&&!n.support.opacity){K=n.attr(D,"opacity");return K==""?"1":K}if(E.match(/float/i)){E=v}if(!F&&D&&D[E]){K=D[E]}else{if(p.getComputedStyle){if(E.match(/float/i)){E="float"}E=E.replace(/([A-Z])/g,"-$1").toLowerCase();var L=p.getComputedStyle(H,null);if(L){K=L.getPropertyValue(E)}if(E=="opacity"&&K==""){K="1"}}else{if(H.currentStyle){var I=E.replace(/\-(\w)/g,function(M,N){return N.toUpperCase()});K=H.currentStyle[E]||H.currentStyle[I];if(!/^\d+(px)?$/i.test(K)&&/^\d/.test(K)){var G=D.left,J=H.runtimeStyle.left;H.runtimeStyle.left=H.currentStyle.left;D.left=K||0;K=D.pixelLeft+"px";D.left=G;H.runtimeStyle.left=J}}}}return K},clean:function(E,J,H){J=J||document;if(typeof J.createElement==="undefined"){J=J.ownerDocument||J[0]&&J[0].ownerDocument||document}if(!H&&E.length===1&&typeof E[0]==="string"){var G=/^<(\w+)\s*\/?>$/.exec(E[0]);if(G){return[J.createElement(G[1])]}}var F=[],D=[],K=J.createElement("div");n.each(E,function(O,Q){if(typeof Q==="number"){Q+=""}if(!Q){return}if(typeof Q==="string"){Q=Q.replace(/(<(\w+)[^>]*?)\/>/g,function(S,T,R){return R.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?S:T+"></"+R+">"});var N=n.trim(Q).toLowerCase();var P=!N.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!N.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||N.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!N.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!N.indexOf("<td")||!N.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!N.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!n.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];K.innerHTML=P[1]+Q+P[2];while(P[0]--){K=K.lastChild}if(!n.support.tbody){var M=!N.indexOf("<table")&&N.indexOf("<tbody")<0?K.firstChild&&K.firstChild.childNodes:P[1]=="<table>"&&N.indexOf("<tbody")<0?K.childNodes:[];for(var L=M.length-1;L>=0;--L){if(n.nodeName(M[L],"tbody")&&!M[L].childNodes.length){M[L].parentNode.removeChild(M[L])}}}if(!n.support.leadingWhitespace&&/^\s/.test(Q)){K.insertBefore(J.createTextNode(Q.match(/^\s*/)[0]),K.firstChild)}Q=n.makeArray(K.childNodes)}if(Q.nodeType){F.push(Q)}else{F=n.merge(F,Q)}});if(H){for(var I=0;F[I];I++){if(n.nodeName(F[I],"script")&&(!F[I].type||F[I].type.toLowerCase()==="text/javascript")){D.push(F[I].parentNode?F[I].parentNode.removeChild(F[I]):F[I])}else{if(F[I].nodeType===1){F.splice.apply(F,[I+1,0].concat(n.makeArray(F[I].getElementsByTagName("script"))))}H.appendChild(F[I])}}return D}return F},attr:function(I,F,J){if(!I||I.nodeType==3||I.nodeType==8){return g}var G=!n.isXMLDoc(I),K=J!==g;F=G&&n.props[F]||F;if(I.tagName){var E=/href|src|style/.test(F);if(F=="selected"&&I.parentNode){I.parentNode.selectedIndex}if(F in I&&G&&!E){if(K){if(F=="type"&&n.nodeName(I,"input")&&I.parentNode){throw"type property can't be changed"}I[F]=J}if(n.nodeName(I,"form")&&I.getAttributeNode(F)){return I.getAttributeNode(F).nodeValue}if(F=="tabIndex"){var H=I.getAttributeNode("tabIndex");return H&&H.specified?H.value:I.nodeName.match(/^(a|area|button|input|object|select|textarea)$/i)?0:g}return I[F]}if(!n.support.style&&G&&F=="style"){return n.attr(I.style,"cssText",J)}if(K){I.setAttribute(F,""+J)}var D=!n.support.hrefNormalized&&G&&E?I.getAttribute(F,2):I.getAttribute(F);return D===null?g:D}if(!n.support.opacity&&F=="opacity"){if(K){I.zoom=1;I.filter=(I.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(J)+""=="NaN"?"":"alpha(opacity="+J*100+")")}return I.filter&&I.filter.indexOf("opacity=")>=0?(parseFloat(I.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}F=F.replace(/-([a-z])/ig,function(L,M){return M.toUpperCase()});if(K){I[F]=J}return I[F]},trim:function(D){return(D||"").replace(/^\s+|\s+$/g,"")},makeArray:function(F){var D=[];if(F!=null){var E=F.length;if(E==null||typeof F==="string"||n.isFunction(F)||F.setInterval){D[0]=F}else{while(E){D[--E]=F[E]}}}return D},inArray:function(F,G){for(var D=0,E=G.length;D<E;D++){if(G[D]===F){return D}}return -1},merge:function(G,D){var E=0,F,H=G.length;if(!n.support.getAll){while((F=D[E++])!=null){if(F.nodeType!=8){G[H++]=F}}}else{while((F=D[E++])!=null){G[H++]=F}}return G},unique:function(J){var E=[],D={};try{for(var F=0,G=J.length;F<G;F++){var I=n.data(J[F]);if(!D[I]){D[I]=true;E.push(J[F])}}}catch(H){E=J}return E},grep:function(E,I,D){var F=[];for(var G=0,H=E.length;G<H;G++){if(!D!=!I(E[G],G)){F.push(E[G])}}return F},map:function(D,I){var E=[];for(var F=0,G=D.length;F<G;F++){var H=I(D[F],F);if(H!=null){E[E.length]=H}}return E.concat.apply([],E)}});var B=navigator.userAgent.toLowerCase();n.browser={version:(B.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(B),opera:/opera/.test(B),msie:/msie/.test(B)&&!/opera/.test(B),mozilla:/mozilla/.test(B)&&!/(compatible|webkit)/.test(B)};n.each({parent:function(D){return D.parentNode},parents:function(D){return n.dir(D,"parentNode")},next:function(D){return n.nth(D,2,"nextSibling")},prev:function(D){return n.nth(D,2,"previousSibling")},nextAll:function(D){return n.dir(D,"nextSibling")},prevAll:function(D){return n.dir(D,"previousSibling")},siblings:function(D){return n.sibling(D.parentNode.firstChild,D)},children:function(D){return n.sibling(D.firstChild)},contents:function(D){return n.nodeName(D,"iframe")?D.contentDocument||D.contentWindow.document:n.makeArray(D.childNodes)}},function(D,E){n.fn[D]=function(F){var G=n.map(this,E);if(F&&typeof F=="string"){G=n.multiFilter(F,G)}return this.pushStack(n.unique(G),D,F)}});n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(D,E){n.fn[D]=function(){var F=arguments;return this.each(function(){for(var G=0,H=F.length;G<H;G++){n(F[G])[E](this)}})}});n.each({removeAttr:function(D){n.attr(this,D,"");if(this.nodeType==1){this.removeAttribute(D)}},addClass:function(D){n.className.add(this,D)},removeClass:function(D){n.className.remove(this,D)},toggleClass:function(E,D){if(typeof D!=="boolean"){D=!n.className.has(this,E)}n.className[D?"add":"remove"](this,E)},remove:function(D){if(!D||n.filter(D,[this]).length){n("*",this).add([this]).each(function(){n.event.remove(this);n.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){n(">*",this).remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(D,E){n.fn[D]=function(){return this.each(E,arguments)}});function j(D,E){return D[0]&&parseInt(n.curCSS(D[0],E,true),10)||0}var h="jQuery"+e(),u=0,z={};n.extend({cache:{},data:function(E,D,F){E=E==l?z:E;var G=E[h];if(!G){G=E[h]=++u}if(D&&!n.cache[G]){n.cache[G]={}}if(F!==g){n.cache[G][D]=F}return D?n.cache[G][D]:G},removeData:function(E,D){E=E==l?z:E;var G=E[h];if(D){if(n.cache[G]){delete n.cache[G][D];D="";for(D in n.cache[G]){break}if(!D){n.removeData(E)}}}else{try{delete E[h]}catch(F){if(E.removeAttribute){E.removeAttribute(h)}}delete n.cache[G]}},queue:function(E,D,G){if(E){D=(D||"fx")+"queue";var F=n.data(E,D);if(!F||n.isArray(G)){F=n.data(E,D,n.makeArray(G))}else{if(G){F.push(G)}}}return F},dequeue:function(G,F){var D=n.queue(G,F),E=D.shift();if(!F||F==="fx"){E=D[0]}if(E!==g){E.call(G)}}});n.fn.extend({data:function(D,F){var G=D.split(".");G[1]=G[1]?"."+G[1]:"";if(F===g){var E=this.triggerHandler("getData"+G[1]+"!",[G[0]]);if(E===g&&this.length){E=n.data(this[0],D)}return E===g&&G[1]?this.data(G[0]):E}else{return this.trigger("setData"+G[1]+"!",[G[0],F]).each(function(){n.data(this,D,F)})}},removeData:function(D){return this.each(function(){n.removeData(this,D)})},queue:function(D,E){if(typeof D!=="string"){E=D;D="fx"}if(E===g){return n.queue(this[0],D)}return this.each(function(){var F=n.queue(this,D,E);if(D=="fx"&&F.length==1){F[0].call(this)}})},dequeue:function(D){return this.each(function(){n.dequeue(this,D)})}});
+/*
+ * Sizzle CSS Selector Engine - v0.9.1
+ *  Copyright 2009, The Dojo Foundation
+ *  Released under the MIT, BSD, and GPL Licenses.
+ *  More information: http://sizzlejs.com/
+ */
+(function(){var N=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|[^[\]]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,I=0,F=Object.prototype.toString;var E=function(ae,S,aa,V){aa=aa||[];S=S||document;if(S.nodeType!==1&&S.nodeType!==9){return[]}if(!ae||typeof ae!=="string"){return aa}var ab=[],ac,Y,ah,ag,Z,R,Q=true;N.lastIndex=0;while((ac=N.exec(ae))!==null){ab.push(ac[1]);if(ac[2]){R=RegExp.rightContext;break}}if(ab.length>1&&G.match.POS.exec(ae)){if(ab.length===2&&G.relative[ab[0]]){var U="",X;while((X=G.match.POS.exec(ae))){U+=X[0];ae=ae.replace(G.match.POS,"")}Y=E.filter(U,E(/\s$/.test(ae)?ae+"*":ae,S))}else{Y=G.relative[ab[0]]?[S]:E(ab.shift(),S);while(ab.length){var P=[];ae=ab.shift();if(G.relative[ae]){ae+=ab.shift()}for(var af=0,ad=Y.length;af<ad;af++){E(ae,Y[af],P)}Y=P}}}else{var ai=V?{expr:ab.pop(),set:D(V)}:E.find(ab.pop(),ab.length===1&&S.parentNode?S.parentNode:S);Y=E.filter(ai.expr,ai.set);if(ab.length>0){ah=D(Y)}else{Q=false}while(ab.length){var T=ab.pop(),W=T;if(!G.relative[T]){T=""}else{W=ab.pop()}if(W==null){W=S}G.relative[T](ah,W,M(S))}}if(!ah){ah=Y}if(!ah){throw"Syntax error, unrecognized expression: "+(T||ae)}if(F.call(ah)==="[object Array]"){if(!Q){aa.push.apply(aa,ah)}else{if(S.nodeType===1){for(var af=0;ah[af]!=null;af++){if(ah[af]&&(ah[af]===true||ah[af].nodeType===1&&H(S,ah[af]))){aa.push(Y[af])}}}else{for(var af=0;ah[af]!=null;af++){if(ah[af]&&ah[af].nodeType===1){aa.push(Y[af])}}}}}else{D(ah,aa)}if(R){E(R,S,aa,V)}return aa};E.matches=function(P,Q){return E(P,null,null,Q)};E.find=function(V,S){var W,Q;if(!V){return[]}for(var R=0,P=G.order.length;R<P;R++){var T=G.order[R],Q;if((Q=G.match[T].exec(V))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){Q[1]=(Q[1]||"").replace(/\\/g,"");W=G.find[T](Q,S);if(W!=null){V=V.replace(G.match[T],"");break}}}}if(!W){W=S.getElementsByTagName("*")}return{set:W,expr:V}};E.filter=function(S,ac,ad,T){var Q=S,Y=[],ah=ac,V,ab;while(S&&ac.length){for(var U in G.filter){if((V=G.match[U].exec(S))!=null){var Z=G.filter[U],R=null,X=0,aa,ag;ab=false;if(ah==Y){Y=[]}if(G.preFilter[U]){V=G.preFilter[U](V,ah,ad,Y,T);if(!V){ab=aa=true}else{if(V===true){continue}else{if(V[0]===true){R=[];var W=null,af;for(var ae=0;(af=ah[ae])!==g;ae++){if(af&&W!==af){R.push(af);W=af}}}}}}if(V){for(var ae=0;(ag=ah[ae])!==g;ae++){if(ag){if(R&&ag!=R[X]){X++}aa=Z(ag,V,X,R);var P=T^!!aa;if(ad&&aa!=null){if(P){ab=true}else{ah[ae]=false}}else{if(P){Y.push(ag);ab=true}}}}}if(aa!==g){if(!ad){ah=Y}S=S.replace(G.match[U],"");if(!ab){return[]}break}}}S=S.replace(/\s*,\s*/,"");if(S==Q){if(ab==null){throw"Syntax error, unrecognized expression: "+S}else{break}}Q=S}return ah};var G=E.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(P){return P.getAttribute("href")}},relative:{"+":function(T,Q){for(var R=0,P=T.length;R<P;R++){var S=T[R];if(S){var U=S.previousSibling;while(U&&U.nodeType!==1){U=U.previousSibling}T[R]=typeof Q==="string"?U||false:U===Q}}if(typeof Q==="string"){E.filter(Q,T,true)}},">":function(U,Q,V){if(typeof Q==="string"&&!/\W/.test(Q)){Q=V?Q:Q.toUpperCase();for(var R=0,P=U.length;R<P;R++){var T=U[R];if(T){var S=T.parentNode;U[R]=S.nodeName===Q?S:false}}}else{for(var R=0,P=U.length;R<P;R++){var T=U[R];if(T){U[R]=typeof Q==="string"?T.parentNode:T.parentNode===Q}}if(typeof Q==="string"){E.filter(Q,U,true)}}},"":function(S,Q,U){var R="done"+(I++),P=O;if(!Q.match(/\W/)){var T=Q=U?Q:Q.toUpperCase();P=L}P("parentNode",Q,R,S,T,U)},"~":function(S,Q,U){var R="done"+(I++),P=O;if(typeof Q==="string"&&!Q.match(/\W/)){var T=Q=U?Q:Q.toUpperCase();P=L}P("previousSibling",Q,R,S,T,U)}},find:{ID:function(Q,R){if(R.getElementById){var P=R.getElementById(Q[1]);return P?[P]:[]}},NAME:function(P,Q){return Q.getElementsByName?Q.getElementsByName(P[1]):null},TAG:function(P,Q){return Q.getElementsByTagName(P[1])}},preFilter:{CLASS:function(S,Q,R,P,U){S=" "+S[1].replace(/\\/g,"")+" ";for(var T=0;Q[T];T++){if(U^(" "+Q[T].className+" ").indexOf(S)>=0){if(!R){P.push(Q[T])}}else{if(R){Q[T]=false}}}return false},ID:function(P){return P[1].replace(/\\/g,"")},TAG:function(Q,P){for(var R=0;!P[R];R++){}return M(P[R])?Q[1]:Q[1].toUpperCase()},CHILD:function(P){if(P[1]=="nth"){var Q=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(P[2]=="even"&&"2n"||P[2]=="odd"&&"2n+1"||!/\D/.test(P[2])&&"0n+"+P[2]||P[2]);P[2]=(Q[1]+(Q[2]||1))-0;P[3]=Q[3]-0}P[0]="done"+(I++);return P},ATTR:function(Q){var P=Q[1];if(G.attrMap[P]){Q[1]=G.attrMap[P]}if(Q[2]==="~="){Q[4]=" "+Q[4]+" "}return Q},PSEUDO:function(T,Q,R,P,U){if(T[1]==="not"){if(T[3].match(N).length>1){T[3]=E(T[3],null,null,Q)}else{var S=E.filter(T[3],Q,R,true^U);if(!R){P.push.apply(P,S)}return false}}else{if(G.match.POS.test(T[0])){return true}}return T},POS:function(P){P.unshift(true);return P}},filters:{enabled:function(P){return P.disabled===false&&P.type!=="hidden"},disabled:function(P){return P.disabled===true},checked:function(P){return P.checked===true},selected:function(P){P.parentNode.selectedIndex;return P.selected===true},parent:function(P){return !!P.firstChild},empty:function(P){return !P.firstChild},has:function(R,Q,P){return !!E(P[3],R).length},header:function(P){return/h\d/i.test(P.nodeName)},text:function(P){return"text"===P.type},radio:function(P){return"radio"===P.type},checkbox:function(P){return"checkbox"===P.type},file:function(P){return"file"===P.type},password:function(P){return"password"===P.type},submit:function(P){return"submit"===P.type},image:function(P){return"image"===P.type},reset:function(P){return"reset"===P.type},button:function(P){return"button"===P.type||P.nodeName.toUpperCase()==="BUTTON"},input:function(P){return/input|select|textarea|button/i.test(P.nodeName)}},setFilters:{first:function(Q,P){return P===0},last:function(R,Q,P,S){return Q===S.length-1},even:function(Q,P){return P%2===0},odd:function(Q,P){return P%2===1},lt:function(R,Q,P){return Q<P[3]-0},gt:function(R,Q,P){return Q>P[3]-0},nth:function(R,Q,P){return P[3]-0==Q},eq:function(R,Q,P){return P[3]-0==Q}},filter:{CHILD:function(P,S){var V=S[1],W=P.parentNode;var U="child"+W.childNodes.length;if(W&&(!W[U]||!P.nodeIndex)){var T=1;for(var Q=W.firstChild;Q;Q=Q.nextSibling){if(Q.nodeType==1){Q.nodeIndex=T++}}W[U]=T-1}if(V=="first"){return P.nodeIndex==1}else{if(V=="last"){return P.nodeIndex==W[U]}else{if(V=="only"){return W[U]==1}else{if(V=="nth"){var Y=false,R=S[2],X=S[3];if(R==1&&X==0){return true}if(R==0){if(P.nodeIndex==X){Y=true}}else{if((P.nodeIndex-X)%R==0&&(P.nodeIndex-X)/R>=0){Y=true}}return Y}}}}},PSEUDO:function(V,R,S,W){var Q=R[1],T=G.filters[Q];if(T){return T(V,S,R,W)}else{if(Q==="contains"){return(V.textContent||V.innerText||"").indexOf(R[3])>=0}else{if(Q==="not"){var U=R[3];for(var S=0,P=U.length;S<P;S++){if(U[S]===V){return false}}return true}}}},ID:function(Q,P){return Q.nodeType===1&&Q.getAttribute("id")===P},TAG:function(Q,P){return(P==="*"&&Q.nodeType===1)||Q.nodeName===P},CLASS:function(Q,P){return P.test(Q.className)},ATTR:function(T,R){var P=G.attrHandle[R[1]]?G.attrHandle[R[1]](T):T[R[1]]||T.getAttribute(R[1]),U=P+"",S=R[2],Q=R[4];return P==null?false:S==="="?U===Q:S==="*="?U.indexOf(Q)>=0:S==="~="?(" "+U+" ").indexOf(Q)>=0:!R[4]?P:S==="!="?U!=Q:S==="^="?U.indexOf(Q)===0:S==="$="?U.substr(U.length-Q.length)===Q:S==="|="?U===Q||U.substr(0,Q.length+1)===Q+"-":false},POS:function(T,Q,R,U){var P=Q[2],S=G.setFilters[P];if(S){return S(T,R,Q,U)}}}};for(var K in G.match){G.match[K]=RegExp(G.match[K].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var D=function(Q,P){Q=Array.prototype.slice.call(Q);if(P){P.push.apply(P,Q);return P}return Q};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(J){D=function(T,S){var Q=S||[];if(F.call(T)==="[object Array]"){Array.prototype.push.apply(Q,T)}else{if(typeof T.length==="number"){for(var R=0,P=T.length;R<P;R++){Q.push(T[R])}}else{for(var R=0;T[R];R++){Q.push(T[R])}}}return Q}}(function(){var Q=document.createElement("form"),R="script"+(new Date).getTime();Q.innerHTML="<input name='"+R+"'/>";var P=document.documentElement;P.insertBefore(Q,P.firstChild);if(!!document.getElementById(R)){G.find.ID=function(T,U){if(U.getElementById){var S=U.getElementById(T[1]);return S?S.id===T[1]||S.getAttributeNode&&S.getAttributeNode("id").nodeValue===T[1]?[S]:g:[]}};G.filter.ID=function(U,S){var T=U.getAttributeNode&&U.getAttributeNode("id");return U.nodeType===1&&T&&T.nodeValue===S}}P.removeChild(Q)})();(function(){var P=document.createElement("div");P.appendChild(document.createComment(""));if(P.getElementsByTagName("*").length>0){G.find.TAG=function(Q,U){var T=U.getElementsByTagName(Q[1]);if(Q[1]==="*"){var S=[];for(var R=0;T[R];R++){if(T[R].nodeType===1){S.push(T[R])}}T=S}return T}}P.innerHTML="<a href='#'></a>";if(P.firstChild.getAttribute("href")!=="#"){G.attrHandle.href=function(Q){return Q.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var P=E;E=function(T,S,Q,R){S=S||document;if(!R&&S.nodeType===9){try{return D(S.querySelectorAll(T),Q)}catch(U){}}return P(T,S,Q,R)};E.find=P.find;E.filter=P.filter;E.selectors=P.selectors;E.matches=P.matches})()}if(document.documentElement.getElementsByClassName){G.order.splice(1,0,"CLASS");G.find.CLASS=function(P,Q){return Q.getElementsByClassName(P[1])}}function L(Q,W,V,Z,X,Y){for(var T=0,R=Z.length;T<R;T++){var P=Z[T];if(P){P=P[Q];var U=false;while(P&&P.nodeType){var S=P[V];if(S){U=Z[S];break}if(P.nodeType===1&&!Y){P[V]=T}if(P.nodeName===W){U=P;break}P=P[Q]}Z[T]=U}}}function O(Q,V,U,Y,W,X){for(var S=0,R=Y.length;S<R;S++){var P=Y[S];if(P){P=P[Q];var T=false;while(P&&P.nodeType){if(P[U]){T=Y[P[U]];break}if(P.nodeType===1){if(!X){P[U]=S}if(typeof V!=="string"){if(P===V){T=true;break}}else{if(E.filter(V,[P]).length>0){T=P;break}}}P=P[Q]}Y[S]=T}}}var H=document.compareDocumentPosition?function(Q,P){return Q.compareDocumentPosition(P)&16}:function(Q,P){return Q!==P&&(Q.contains?Q.contains(P):true)};var M=function(P){return P.documentElement&&!P.body||P.tagName&&P.ownerDocument&&!P.ownerDocument.body};n.find=E;n.filter=E.filter;n.expr=E.selectors;n.expr[":"]=n.expr.filters;E.selectors.filters.hidden=function(P){return"hidden"===P.type||n.css(P,"display")==="none"||n.css(P,"visibility")==="hidden"};E.selectors.filters.visible=function(P){return"hidden"!==P.type&&n.css(P,"display")!=="none"&&n.css(P,"visibility")!=="hidden"};E.selectors.filters.animated=function(P){return n.grep(n.timers,function(Q){return P===Q.elem}).length};n.multiFilter=function(R,P,Q){if(Q){R=":not("+R+")"}return E.matches(R,P)};n.dir=function(R,Q){var P=[],S=R[Q];while(S&&S!=document){if(S.nodeType==1){P.push(S)}S=S[Q]}return P};n.nth=function(T,P,R,S){P=P||1;var Q=0;for(;T;T=T[R]){if(T.nodeType==1&&++Q==P){break}}return T};n.sibling=function(R,Q){var P=[];for(;R;R=R.nextSibling){if(R.nodeType==1&&R!=Q){P.push(R)}}return P};return;l.Sizzle=E})();n.event={add:function(H,E,G,J){if(H.nodeType==3||H.nodeType==8){return}if(H.setInterval&&H!=l){H=l}if(!G.guid){G.guid=this.guid++}if(J!==g){var F=G;G=this.proxy(F);G.data=J}var D=n.data(H,"events")||n.data(H,"events",{}),I=n.data(H,"handle")||n.data(H,"handle",function(){return typeof n!=="undefined"&&!n.event.triggered?n.event.handle.apply(arguments.callee.elem,arguments):g});I.elem=H;n.each(E.split(/\s+/),function(L,M){var N=M.split(".");M=N.shift();G.type=N.slice().sort().join(".");var K=D[M];if(n.event.specialAll[M]){n.event.specialAll[M].setup.call(H,J,N)}if(!K){K=D[M]={};if(!n.event.special[M]||n.event.special[M].setup.call(H,J,N)===false){if(H.addEventListener){H.addEventListener(M,I,false)}else{if(H.attachEvent){H.attachEvent("on"+M,I)}}}}K[G.guid]=G;n.event.global[M]=true});H=null},guid:1,global:{},remove:function(J,G,I){if(J.nodeType==3||J.nodeType==8){return}var F=n.data(J,"events"),E,D;if(F){if(G===g||(typeof G==="string"&&G.charAt(0)==".")){for(var H in F){this.remove(J,H+(G||""))}}else{if(G.type){I=G.handler;G=G.type}n.each(G.split(/\s+/),function(L,N){var P=N.split(".");N=P.shift();var M=RegExp("(^|\\.)"+P.slice().sort().join(".*\\.")+"(\\.|$)");if(F[N]){if(I){delete F[N][I.guid]}else{for(var O in F[N]){if(M.test(F[N][O].type)){delete F[N][O]}}}if(n.event.specialAll[N]){n.event.specialAll[N].teardown.call(J,P)}for(E in F[N]){break}if(!E){if(!n.event.special[N]||n.event.special[N].teardown.call(J,P)===false){if(J.removeEventListener){J.removeEventListener(N,n.data(J,"handle"),false)}else{if(J.detachEvent){J.detachEvent("on"+N,n.data(J,"handle"))}}}E=null;delete F[N]}}})}for(E in F){break}if(!E){var K=n.data(J,"handle");if(K){K.elem=null}n.removeData(J,"events");n.removeData(J,"handle")}}},trigger:function(H,J,G,D){var F=H.type||H;if(!D){H=typeof H==="object"?H[h]?H:n.extend(n.Event(F),H):n.Event(F);if(F.indexOf("!")>=0){H.type=F=F.slice(0,-1);H.exclusive=true}if(!G){H.stopPropagation();if(this.global[F]){n.each(n.cache,function(){if(this.events&&this.events[F]){n.event.trigger(H,J,this.handle.elem)}})}}if(!G||G.nodeType==3||G.nodeType==8){return g}H.result=g;H.target=G;J=n.makeArray(J);J.unshift(H)}H.currentTarget=G;var I=n.data(G,"handle");if(I){I.apply(G,J)}if((!G[F]||(n.nodeName(G,"a")&&F=="click"))&&G["on"+F]&&G["on"+F].apply(G,J)===false){H.result=false}if(!D&&G[F]&&!H.isDefaultPrevented()&&!(n.nodeName(G,"a")&&F=="click")){this.triggered=true;try{G[F]()}catch(K){}}this.triggered=false;if(!H.isPropagationStopped()){var E=G.parentNode||G.ownerDocument;if(E){n.event.trigger(H,J,E,true)}}},handle:function(J){var I,D;J=arguments[0]=n.event.fix(J||l.event);var K=J.type.split(".");J.type=K.shift();I=!K.length&&!J.exclusive;var H=RegExp("(^|\\.)"+K.slice().sort().join(".*\\.")+"(\\.|$)");D=(n.data(this,"events")||{})[J.type];for(var F in D){var G=D[F];if(I||H.test(G.type)){J.handler=G;J.data=G.data;var E=G.apply(this,arguments);if(E!==g){J.result=E;if(E===false){J.preventDefault();J.stopPropagation()}}if(J.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(G){if(G[h]){return G}var E=G;G=n.Event(E);for(var F=this.props.length,I;F;){I=this.props[--F];G[I]=E[I]}if(!G.target){G.target=G.srcElement||document}if(G.target.nodeType==3){G.target=G.target.parentNode}if(!G.relatedTarget&&G.fromElement){G.relatedTarget=G.fromElement==G.target?G.toElement:G.fromElement}if(G.pageX==null&&G.clientX!=null){var H=document.documentElement,D=document.body;G.pageX=G.clientX+(H&&H.scrollLeft||D&&D.scrollLeft||0)-(H.clientLeft||0);G.pageY=G.clientY+(H&&H.scrollTop||D&&D.scrollTop||0)-(H.clientTop||0)}if(!G.which&&((G.charCode||G.charCode===0)?G.charCode:G.keyCode)){G.which=G.charCode||G.keyCode}if(!G.metaKey&&G.ctrlKey){G.metaKey=G.ctrlKey}if(!G.which&&G.button){G.which=(G.button&1?1:(G.button&2?3:(G.button&4?2:0)))}return G},proxy:function(E,D){D=D||function(){return E.apply(this,arguments)};D.guid=E.guid=E.guid||D.guid||this.guid++;return D},special:{ready:{setup:A,teardown:function(){}}},specialAll:{live:{setup:function(D,E){n.event.add(this,E[0],c)},teardown:function(F){if(F.length){var D=0,E=RegExp("(^|\\.)"+F[0]+"(\\.|$)");n.each((n.data(this,"events").live||{}),function(){if(E.test(this.type)){D++}});if(D<1){n.event.remove(this,F[0],c)}}}}}};n.Event=function(D){if(!this.preventDefault){return new n.Event(D)}if(D&&D.type){this.originalEvent=D;this.type=D.type;this.timeStamp=D.timeStamp}else{this.type=D}if(!this.timeStamp){this.timeStamp=e()}this[h]=true};function k(){return false}function t(){return true}n.Event.prototype={preventDefault:function(){this.isDefaultPrevented=t;var D=this.originalEvent;if(!D){return}if(D.preventDefault){D.preventDefault()}D.returnValue=false},stopPropagation:function(){this.isPropagationStopped=t;var D=this.originalEvent;if(!D){return}if(D.stopPropagation){D.stopPropagation()}D.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=t;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(E){var D=E.relatedTarget;while(D&&D!=this){try{D=D.parentNode}catch(F){D=this}}if(D!=this){E.type=E.data;n.event.handle.apply(this,arguments)}};n.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(E,D){n.event.special[D]={setup:function(){n.event.add(this,E,a,D)},teardown:function(){n.event.remove(this,E,a)}}});n.fn.extend({bind:function(E,F,D){return E=="unload"?this.one(E,F,D):this.each(function(){n.event.add(this,E,D||F,D&&F)})},one:function(F,G,E){var D=n.event.proxy(E||G,function(H){n(this).unbind(H,D);return(E||G).apply(this,arguments)});return this.each(function(){n.event.add(this,F,D,E&&G)})},unbind:function(E,D){return this.each(function(){n.event.remove(this,E,D)})},trigger:function(D,E){return this.each(function(){n.event.trigger(D,E,this)})},triggerHandler:function(D,F){if(this[0]){var E=n.Event(D);E.preventDefault();E.stopPropagation();n.event.trigger(E,F,this[0]);return E.result}},toggle:function(F){var D=arguments,E=1;while(E<D.length){n.event.proxy(F,D[E++])}return this.click(n.event.proxy(F,function(G){this.lastToggle=(this.lastToggle||0)%E;G.preventDefault();return D[this.lastToggle++].apply(this,arguments)||false}))},hover:function(D,E){return this.mouseenter(D).mouseleave(E)},ready:function(D){A();if(n.isReady){D.call(document,n)}else{n.readyList.push(D)}return this},live:function(F,E){var D=n.event.proxy(E);D.guid+=this.selector+F;n(document).bind(i(F,this.selector),this.selector,D);return this},die:function(E,D){n(document).unbind(i(E,this.selector),D?{guid:D.guid+this.selector+E}:null);return this}});function c(G){var D=RegExp("(^|\\.)"+G.type+"(\\.|$)"),F=true,E=[];n.each(n.data(this,"events").live||[],function(H,I){if(D.test(I.type)){var J=n(G.target).closest(I.data)[0];if(J){E.push({elem:J,fn:I})}}});n.each(E,function(){if(!G.isImmediatePropagationStopped()&&this.fn.call(this.elem,G,this.fn.data)===false){F=false}});return F}function i(E,D){return["live",E,D.replace(/\./g,"`").replace(/ /g,"|")].join(".")}n.extend({isReady:false,readyList:[],ready:function(){if(!n.isReady){n.isReady=true;if(n.readyList){n.each(n.readyList,function(){this.call(document,n)});n.readyList=null}n(document).triggerHandler("ready")}}});var w=false;function A(){if(w){return}w=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);n.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);n.ready()}});if(document.documentElement.doScroll&&!l.frameElement){(function(){if(n.isReady){return}try{document.documentElement.doScroll("left")}catch(D){setTimeout(arguments.callee,0);return}n.ready()})()}}}n.event.add(l,"load",n.ready)}n.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(E,D){n.fn[D]=function(F){return F?this.bind(D,F):this.trigger(D)}});n(l).bind("unload",function(){for(var D in n.cache){if(D!=1&&n.cache[D].handle){n.event.remove(n.cache[D].handle.elem)}}});(function(){n.support={};var E=document.documentElement,F=document.createElement("script"),J=document.createElement("div"),I="script"+(new Date).getTime();J.style.display="none";J.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var G=J.getElementsByTagName("*"),D=J.getElementsByTagName("a")[0];if(!G||!G.length||!D){return}n.support={leadingWhitespace:J.firstChild.nodeType==3,tbody:!J.getElementsByTagName("tbody").length,objectAll:!!J.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!J.getElementsByTagName("link").length,style:/red/.test(D.getAttribute("style")),hrefNormalized:D.getAttribute("href")==="/a",opacity:D.style.opacity==="0.5",cssFloat:!!D.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};F.type="text/javascript";try{F.appendChild(document.createTextNode("window."+I+"=1;"))}catch(H){}E.insertBefore(F,E.firstChild);if(l[I]){n.support.scriptEval=true;delete l[I]}E.removeChild(F);if(J.attachEvent&&J.fireEvent){J.attachEvent("onclick",function(){n.support.noCloneEvent=false;J.detachEvent("onclick",arguments.callee)});J.cloneNode(true).fireEvent("onclick")}n(function(){var K=document.createElement("div");K.style.width="1px";K.style.paddingLeft="1px";document.body.appendChild(K);n.boxModel=n.support.boxModel=K.offsetWidth===2;document.body.removeChild(K)})})();var v=n.support.cssFloat?"cssFloat":"styleFloat";n.props={"for":"htmlFor","class":"className","float":v,cssFloat:v,styleFloat:v,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};n.fn.extend({_load:n.fn.load,load:function(F,I,J){if(typeof F!=="string"){return this._load(F)}var H=F.indexOf(" ");if(H>=0){var D=F.slice(H,F.length);F=F.slice(0,H)}var G="GET";if(I){if(n.isFunction(I)){J=I;I=null}else{if(typeof I==="object"){I=n.param(I);G="POST"}}}var E=this;n.ajax({url:F,type:G,dataType:"html",data:I,complete:function(L,K){if(K=="success"||K=="notmodified"){E.html(D?n("<div/>").append(L.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(D):L.responseText)}if(J){E.each(J,[L.responseText,K,L])}}});return this},serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?n.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type))}).map(function(D,E){var F=n(this).val();return F==null?null:n.isArray(F)?n.map(F,function(H,G){return{name:E.name,value:H}}):{name:E.name,value:F}}).get()}});n.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(D,E){n.fn[E]=function(F){return this.bind(E,F)}});var q=e();n.extend({get:function(D,F,G,E){if(n.isFunction(F)){G=F;F=null}return n.ajax({type:"GET",url:D,data:F,success:G,dataType:E})},getScript:function(D,E){return n.get(D,null,E,"script")},getJSON:function(D,E,F){return n.get(D,E,F,"json")},post:function(D,F,G,E){if(n.isFunction(F)){G=F;F={}}return n.ajax({type:"POST",url:D,data:F,success:G,dataType:E})},ajaxSetup:function(D){n.extend(n.ajaxSettings,D)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(L){L=n.extend(true,L,n.extend(true,{},n.ajaxSettings,L));var V,E=/=\?(&|$)/g,Q,U,F=L.type.toUpperCase();if(L.data&&L.processData&&typeof L.data!=="string"){L.data=n.param(L.data)}if(L.dataType=="jsonp"){if(F=="GET"){if(!L.url.match(E)){L.url+=(L.url.match(/\?/)?"&":"?")+(L.jsonp||"callback")+"=?"}}else{if(!L.data||!L.data.match(E)){L.data=(L.data?L.data+"&":"")+(L.jsonp||"callback")+"=?"}}L.dataType="json"}if(L.dataType=="json"&&(L.data&&L.data.match(E)||L.url.match(E))){V="jsonp"+q++;if(L.data){L.data=(L.data+"").replace(E,"="+V+"$1")}L.url=L.url.replace(E,"="+V+"$1");L.dataType="script";l[V]=function(W){U=W;H();K();l[V]=g;try{delete l[V]}catch(X){}if(G){G.removeChild(S)}}}if(L.dataType=="script"&&L.cache==null){L.cache=false}if(L.cache===false&&F=="GET"){var D=e();var T=L.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+D+"$2");L.url=T+((T==L.url)?(L.url.match(/\?/)?"&":"?")+"_="+D:"")}if(L.data&&F=="GET"){L.url+=(L.url.match(/\?/)?"&":"?")+L.data;L.data=null}if(L.global&&!n.active++){n.event.trigger("ajaxStart")}var P=/^(\w+:)?\/\/([^\/?#]+)/.exec(L.url);if(L.dataType=="script"&&F=="GET"&&P&&(P[1]&&P[1]!=location.protocol||P[2]!=location.host)){var G=document.getElementsByTagName("head")[0];var S=document.createElement("script");S.src=L.url;if(L.scriptCharset){S.charset=L.scriptCharset}if(!V){var N=false;S.onload=S.onreadystatechange=function(){if(!N&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){N=true;H();K();G.removeChild(S)}}}G.appendChild(S);return g}var J=false;var I=L.xhr();if(L.username){I.open(F,L.url,L.async,L.username,L.password)}else{I.open(F,L.url,L.async)}try{if(L.data){I.setRequestHeader("Content-Type",L.contentType)}if(L.ifModified){I.setRequestHeader("If-Modified-Since",n.lastModified[L.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}I.setRequestHeader("X-Requested-With","XMLHttpRequest");I.setRequestHeader("Accept",L.dataType&&L.accepts[L.dataType]?L.accepts[L.dataType]+", */*":L.accepts._default)}catch(R){}if(L.beforeSend&&L.beforeSend(I,L)===false){if(L.global&&!--n.active){n.event.trigger("ajaxStop")}I.abort();return false}if(L.global){n.event.trigger("ajaxSend",[I,L])}var M=function(W){if(I.readyState==0){if(O){clearInterval(O);O=null;if(L.global&&!--n.active){n.event.trigger("ajaxStop")}}}else{if(!J&&I&&(I.readyState==4||W=="timeout")){J=true;if(O){clearInterval(O);O=null}Q=W=="timeout"?"timeout":!n.httpSuccess(I)?"error":L.ifModified&&n.httpNotModified(I,L.url)?"notmodified":"success";if(Q=="success"){try{U=n.httpData(I,L.dataType,L)}catch(Y){Q="parsererror"}}if(Q=="success"){var X;try{X=I.getResponseHeader("Last-Modified")}catch(Y){}if(L.ifModified&&X){n.lastModified[L.url]=X}if(!V){H()}}else{n.handleError(L,I,Q)}K();if(L.async){I=null}}}};if(L.async){var O=setInterval(M,13);if(L.timeout>0){setTimeout(function(){if(I){if(!J){M("timeout")}if(I){I.abort()}}},L.timeout)}}try{I.send(L.data)}catch(R){n.handleError(L,I,null,R)}if(!L.async){M()}function H(){if(L.success){L.success(U,Q)}if(L.global){n.event.trigger("ajaxSuccess",[I,L])}}function K(){if(L.complete){L.complete(I,Q)}if(L.global){n.event.trigger("ajaxComplete",[I,L])}if(L.global&&!--n.active){n.event.trigger("ajaxStop")}}return I},handleError:function(E,G,D,F){if(E.error){E.error(G,D,F)}if(E.global){n.event.trigger("ajaxError",[G,E,F])}},active:0,httpSuccess:function(E){try{return !E.status&&location.protocol=="file:"||(E.status>=200&&E.status<300)||E.status==304||E.status==1223}catch(D){}return false},httpNotModified:function(F,D){try{var G=F.getResponseHeader("Last-Modified");return F.status==304||G==n.lastModified[D]}catch(E){}return false},httpData:function(I,G,F){var E=I.getResponseHeader("content-type"),D=G=="xml"||!G&&E&&E.indexOf("xml")>=0,H=D?I.responseXML:I.responseText;if(D&&H.documentElement.tagName=="parsererror"){throw"parsererror"}if(F&&F.dataFilter){H=F.dataFilter(H,G)}if(typeof H==="string"){if(G=="script"){n.globalEval(H)}if(G=="json"){H=l["eval"]("("+H+")")}}return H},param:function(D){var F=[];function G(H,I){F[F.length]=encodeURIComponent(H)+"="+encodeURIComponent(I)}if(n.isArray(D)||D.jquery){n.each(D,function(){G(this.name,this.value)})}else{for(var E in D){if(n.isArray(D[E])){n.each(D[E],function(){G(E,this)})}else{G(E,n.isFunction(D[E])?D[E]():D[E])}}}return F.join("&").replace(/%20/g,"+")}});var m={},d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function s(E,D){var F={};n.each(d.concat.apply([],d.slice(0,D)),function(){F[this]=E});return F}n.fn.extend({show:function(I,K){if(I){return this.animate(s("show",3),I,K)}else{for(var G=0,E=this.length;G<E;G++){var D=n.data(this[G],"olddisplay");this[G].style.display=D||"";if(n.css(this[G],"display")==="none"){var F=this[G].tagName,J;if(m[F]){J=m[F]}else{var H=n("<"+F+" />").appendTo("body");J=H.css("display");if(J==="none"){J="block"}H.remove();m[F]=J}this[G].style.display=n.data(this[G],"olddisplay",J)}}return this}},hide:function(G,H){if(G){return this.animate(s("hide",3),G,H)}else{for(var F=0,E=this.length;F<E;F++){var D=n.data(this[F],"olddisplay");if(!D&&D!=="none"){n.data(this[F],"olddisplay",n.css(this[F],"display"))}this[F].style.display="none"}return this}},_toggle:n.fn.toggle,toggle:function(F,E){var D=typeof F==="boolean";return n.isFunction(F)&&n.isFunction(E)?this._toggle.apply(this,arguments):F==null||D?this.each(function(){var G=D?F:n(this).is(":hidden");n(this)[G?"show":"hide"]()}):this.animate(s("toggle",3),F,E)},fadeTo:function(D,F,E){return this.animate({opacity:F},D,E)},animate:function(H,E,G,F){var D=n.speed(E,G,F);return this[D.queue===false?"each":"queue"](function(){var J=n.extend({},D),L,K=this.nodeType==1&&n(this).is(":hidden"),I=this;for(L in H){if(H[L]=="hide"&&K||H[L]=="show"&&!K){return J.complete.call(this)}if((L=="height"||L=="width")&&this.style){J.display=n.css(this,"display");J.overflow=this.style.overflow}}if(J.overflow!=null){this.style.overflow="hidden"}J.curAnim=n.extend({},H);n.each(H,function(N,R){var Q=new n.fx(I,J,N);if(/toggle|show|hide/.test(R)){Q[R=="toggle"?K?"show":"hide":R](H)}else{var P=R.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),S=Q.cur(true)||0;if(P){var M=parseFloat(P[2]),O=P[3]||"px";if(O!="px"){I.style[N]=(M||1)+O;S=((M||1)/Q.cur(true))*S;I.style[N]=S+O}if(P[1]){M=((P[1]=="-="?-1:1)*M)+S}Q.custom(S,M,O)}else{Q.custom(S,R,"")}}});return true})},stop:function(E,D){var F=n.timers;if(E){this.queue([])}this.each(function(){for(var G=F.length-1;G>=0;G--){if(F[G].elem==this){if(D){F[G](true)}F.splice(G,1)}}});if(!D){this.dequeue()}return this}});n.each({slideDown:s("show",1),slideUp:s("hide",1),slideToggle:s("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(D,E){n.fn[D]=function(F,G){return this.animate(E,F,G)}});n.extend({speed:function(F,G,E){var D=typeof F==="object"?F:{complete:E||!E&&G||n.isFunction(F)&&F,duration:F,easing:E&&G||G&&!n.isFunction(G)&&G};D.duration=n.fx.off?0:typeof D.duration==="number"?D.duration:n.fx.speeds[D.duration]||n.fx.speeds._default;D.old=D.complete;D.complete=function(){if(D.queue!==false){n(this).dequeue()}if(n.isFunction(D.old)){D.old.call(this)}};return D},easing:{linear:function(F,G,D,E){return D+E*F},swing:function(F,G,D,E){return((-Math.cos(F*Math.PI)/2)+0.5)*E+D}},timers:[],timerId:null,fx:function(E,D,F){this.options=D;this.elem=E;this.prop=F;if(!D.orig){D.orig={}}}});n.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(n.fx.step[this.prop]||n.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(E){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var D=parseFloat(n.css(this.elem,this.prop,E));return D&&D>-10000?D:parseFloat(n.curCSS(this.elem,this.prop))||0},custom:function(H,G,F){this.startTime=e();this.start=H;this.end=G;this.unit=F||this.unit||"px";this.now=this.start;this.pos=this.state=0;var D=this;function E(I){return D.step(I)}E.elem=this.elem;n.timers.push(E);if(E()&&n.timerId==null){n.timerId=setInterval(function(){var J=n.timers;for(var I=0;I<J.length;I++){if(!J[I]()){J.splice(I--,1)}}if(!J.length){clearInterval(n.timerId);n.timerId=null}},13)}},show:function(){this.options.orig[this.prop]=n.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());n(this.elem).show()},hide:function(){this.options.orig[this.prop]=n.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(G){var F=e();if(G||F>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var D=true;for(var E in this.options.curAnim){if(this.options.curAnim[E]!==true){D=false}}if(D){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(n.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){n(this.elem).hide()}if(this.options.hide||this.options.show){for(var H in this.options.curAnim){n.attr(this.elem.style,H,this.options.orig[H])}}}if(D){this.options.complete.call(this.elem)}return false}else{var I=F-this.startTime;this.state=I/this.options.duration;this.pos=n.easing[this.options.easing||(n.easing.swing?"swing":"linear")](this.state,I,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};n.extend(n.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(D){n.attr(D.elem.style,"opacity",D.now)},_default:function(D){if(D.elem.style&&D.elem.style[D.prop]!=null){D.elem.style[D.prop]=D.now+D.unit}else{D.elem[D.prop]=D.now}}}});if(document.documentElement.getBoundingClientRect){n.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return n.offset.bodyOffset(this[0])}var F=this[0].getBoundingClientRect(),I=this[0].ownerDocument,E=I.body,D=I.documentElement,K=D.clientTop||E.clientTop||0,J=D.clientLeft||E.clientLeft||0,H=F.top+(self.pageYOffset||n.boxModel&&D.scrollTop||E.scrollTop)-K,G=F.left+(self.pageXOffset||n.boxModel&&D.scrollLeft||E.scrollLeft)-J;return{top:H,left:G}}}else{n.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return n.offset.bodyOffset(this[0])}n.offset.initialized||n.offset.initialize();var I=this[0],F=I.offsetParent,E=I,N=I.ownerDocument,L,G=N.documentElement,J=N.body,K=N.defaultView,D=K.getComputedStyle(I,null),M=I.offsetTop,H=I.offsetLeft;while((I=I.parentNode)&&I!==J&&I!==G){L=K.getComputedStyle(I,null);M-=I.scrollTop,H-=I.scrollLeft;if(I===F){M+=I.offsetTop,H+=I.offsetLeft;if(n.offset.doesNotAddBorder&&!(n.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(I.tagName))){M+=parseInt(L.borderTopWidth,10)||0,H+=parseInt(L.borderLeftWidth,10)||0}E=F,F=I.offsetParent}if(n.offset.subtractsBorderForOverflowNotVisible&&L.overflow!=="visible"){M+=parseInt(L.borderTopWidth,10)||0,H+=parseInt(L.borderLeftWidth,10)||0}D=L}if(D.position==="relative"||D.position==="static"){M+=J.offsetTop,H+=J.offsetLeft}if(D.position==="fixed"){M+=Math.max(G.scrollTop,J.scrollTop),H+=Math.max(G.scrollLeft,J.scrollLeft)}return{top:M,left:H}}}n.offset={initialize:function(){if(this.initialized){return}var K=document.body,E=document.createElement("div"),G,F,M,H,L,D,I=K.style.marginTop,J='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"cellpadding="0"cellspacing="0"><tr><td></td></tr></table>';L={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(D in L){E.style[D]=L[D]}E.innerHTML=J;K.insertBefore(E,K.firstChild);G=E.firstChild,F=G.firstChild,H=G.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(F.offsetTop!==5);this.doesAddBorderForTableAndCells=(H.offsetTop===5);G.style.overflow="hidden",G.style.position="relative";this.subtractsBorderForOverflowNotVisible=(F.offsetTop===-5);K.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(K.offsetTop===0);K.style.marginTop=I;K.removeChild(E);this.initialized=true},bodyOffset:function(D){n.offset.initialized||n.offset.initialize();var F=D.offsetTop,E=D.offsetLeft;if(n.offset.doesNotIncludeMarginInBodyOffset){F+=parseInt(n.curCSS(D,"marginTop",true),10)||0,E+=parseInt(n.curCSS(D,"marginLeft",true),10)||0}return{top:F,left:E}}};n.fn.extend({position:function(){var H=0,G=0,E;if(this[0]){var F=this.offsetParent(),I=this.offset(),D=/^body|html$/i.test(F[0].tagName)?{top:0,left:0}:F.offset();I.top-=j(this,"marginTop");I.left-=j(this,"marginLeft");D.top+=j(F,"borderTopWidth");D.left+=j(F,"borderLeftWidth");E={top:I.top-D.top,left:I.left-D.left}}return E},offsetParent:function(){var D=this[0].offsetParent||document.body;while(D&&(!/^body|html$/i.test(D.tagName)&&n.css(D,"position")=="static")){D=D.offsetParent}return n(D)}});n.each(["Left","Top"],function(E,D){var F="scroll"+D;n.fn[F]=function(G){if(!this[0]){return null}return G!==g?this.each(function(){this==l||this==document?l.scrollTo(!E?G:n(l).scrollLeft(),E?G:n(l).scrollTop()):this[F]=G}):this[0]==l||this[0]==document?self[E?"pageYOffset":"pageXOffset"]||n.boxModel&&document.documentElement[F]||document.body[F]:this[0][F]}});n.each(["Height","Width"],function(G,E){var D=G?"Left":"Top",F=G?"Right":"Bottom";n.fn["inner"+E]=function(){return this[E.toLowerCase()]()+j(this,"padding"+D)+j(this,"padding"+F)};n.fn["outer"+E]=function(I){return this["inner"+E]()+j(this,"border"+D+"Width")+j(this,"border"+F+"Width")+(I?j(this,"margin"+D)+j(this,"margin"+F):0)};var H=E.toLowerCase();n.fn[H]=function(I){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+E]||document.body["client"+E]:this[0]==document?Math.max(document.documentElement["client"+E],document.body["scroll"+E],document.documentElement["scroll"+E],document.body["offset"+E],document.documentElement["offset"+E]):I===g?(this.length?n.css(this[0],H):null):this.css(H,typeof I==="string"?I:I+"px")}})})();
\ No newline at end of file
index 38a9589680ef9e9bb28d42f1240eded954bd1d3e..0a03b86c23e2f8a53a264c4706e52dac4994baea 100644 (file)
@@ -20,21 +20,21 @@ $(document).ready(function(){
        // count character on keyup
        function counter(event){
                var maxLength = 140;
-               var currentLength = $("#status_textarea").val().length;
+               var currentLength = $("#notice_data-text").val().length;
                var remaining = maxLength - currentLength;
-               var counter = $("#counter");
+               var counter = $("#notice_text-count");
                counter.text(remaining);
                
                if (remaining <= 0) {
-                       $("#status_form").addClass("response_error");
+                       $("#form_notice").addClass("warning");
                } else {
-                       $("#status_form").removeClass("response_error");
+                       $("#form_notice").removeClass("warning");
                }
        }
 
        function submitonreturn(event) {
                if (event.keyCode == 13) {
-                       $("#status_form").submit();
+                       $("#form_notice").submit();
                        event.preventDefault();
                        event.stopPropagation();
                        return false;
@@ -42,15 +42,15 @@ $(document).ready(function(){
                return true;
        }
 
-       if ($("#status_textarea").length) {
-               $("#status_textarea").bind("keyup", counter);
-               $("#status_textarea").bind("keydown", submitonreturn);
+       if ($("#notice_data-text").length) {
+               $("#notice_data-text").bind("keyup", counter);
+               $("#notice_data-text").bind("keydown", submitonreturn);
                
                // run once in case there's something in there
                counter();
                
                // set the focus
-               $("#status_textarea").focus();
+               $("#notice_data-text").focus();
        }
 
        // XXX: refactor this code
@@ -81,10 +81,10 @@ $(document).ready(function(){
                this.appendChild(ajax);
        }
 
-       $("form.favor").ajaxForm(favoptions);
-       $("form.disfavor").ajaxForm(disoptions);
-       $("form.favor").each(addAjaxHidden);
-       $("form.disfavor").each(addAjaxHidden);
+       $("form.form_favor").ajaxForm(favoptions);
+       $("form.form_disfavor").ajaxForm(disoptions);
+       $("form.form_favor").each(addAjaxHidden);
+       $("form.form_disfavor").each(addAjaxHidden);
 
        $("#nudge").ajaxForm ({ dataType: 'xml',
                                                        beforeSubmit: function(xml) { $("form#nudge input[type=submit]").attr("disabled", "disabled");
@@ -136,12 +136,12 @@ $(document).ready(function(){
 
 
        var PostNotice = { dataType: 'xml',
-                                          beforeSubmit: function(formData, jqForm, options) { if ($("#status_textarea").get(0).value.length == 0) {
-                                                                                                                                                               $("#status_form").addClass("response_error");
+                                          beforeSubmit: function(formData, jqForm, options) { if ($("#notice_data-text").get(0).value.length == 0) {
+                                                                                                                                                               $("#form_notice").addClass("warning");
                                                                                                                                                                return false;
                                                                                                                                                   }
-                                                                                                                                                  $("#status_form input[type=submit]").attr("disabled", "disabled");
-                                                                                                                                                  $("#status_form input[type=submit]").addClass("disabled");
+                                                                                                                                                  $("#notice_action-submit").attr("disabled", "disabled");
+                                                                                                                                                  $("#notice_action-submit").addClass("disabled");
                                                                                                                                                   return true;
                                                                                                                                                 },
                                           success: function(xml) {     if ($("#error", xml).length > 0 || $("#command_result", xml).length > 0) {
@@ -150,28 +150,37 @@ $(document).ready(function(){
                                                                                                        alert(result);
                                                                                                }
                                                                                                else {
-                                                                                                       $("#notices").prepend(document._importNode($("li", xml).get(0), true));
-                                                                                                       $("#status_textarea").val("");
+                                                                                                       $("#notices_primary .notices").prepend(document._importNode($("li", xml).get(0), true));
+                                                                                                       $("#notice_data-text").val("");
                                                                                                        counter();
-                                                                                                       $(".notice_single:first").css({display:"none"});
-                                                                                                       $(".notice_single:first").fadeIn(2500);
+                                                                                                       $("#notices_primary .notice:first").css({display:"none"});
+                                                                                                       $("#notices_primary .notice:first").fadeIn(2500);
                                                                                                }
-                                                                                               $("#status_form input[type=submit]").removeAttr("disabled");
-                                                                                               $("#status_form input[type=submit]").removeClass("disabled");
+                                                                                               $("#notice_action-submit").removeAttr("disabled");
+                                                                                               $("#notice_action-submit").removeClass("disabled");
                                                                                         }
                                           };
-       $("#status_form").ajaxForm(PostNotice);
-       $("#status_form").each(addAjaxHidden);
+       $("#form_notice").ajaxForm(PostNotice);
+       $("#form_notice").each(addAjaxHidden);
+
+    $(".notice").hover(
+        function () {
+            $(this).addClass('hover');
+        }, 
+        function () {
+            $(this).removeClass('hover');
+        }
+    );
 });
 
 function doreply(nick,id) {
        rgx_username = /^[0-9a-zA-Z\-_.]*$/;
        if (nick.match(rgx_username)) {
                replyto = "@" + nick + " ";
-               if ($("#status_textarea").length) {
-                       $("#status_textarea").val(replyto);
-                       $("form#status_form input#inreplyto").val(id);
-                       $("#status_textarea").focus();
+               if ($("#notice_data-text").length) {
+                       $("#notice_data-text").val(replyto);
+                       $("#form_notice input#notice_in-reply-to").val(id);
+                       $("#notice_data-text").focus();
                        return false;
                }
        }
index 1da6bae69a08ab95ec2ffe6b4f6489df530dd0e5..f600a4789eccfe515faf394ebb3b2a1dabe9e61d 100644 (file)
@@ -44,3 +44,4 @@ document._importNode = function(node, allChildren) {
                        break;
        }
 };
+
diff --git a/lib/accountsettingsaction.php b/lib/accountsettingsaction.php
new file mode 100644 (file)
index 0000000..46090b8
--- /dev/null
@@ -0,0 +1,134 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Base class for account settings actions
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Settings
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/settingsaction.php';
+
+/**
+ * Base class for account settings actions
+ *
+ * @category Settings
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      Widget
+ */
+
+class AccountSettingsAction extends SettingsAction
+{
+    /**
+     * Show the local navigation menu
+     *
+     * This is the same for all settings, so we show it here.
+     *
+     * @return void
+     */
+
+    function showLocalNav()
+    {
+        $menu = new AccountSettingsNav($this);
+        $menu->show();
+    }
+}
+
+/**
+ * A widget for showing the settings group local nav menu
+ *
+ * @category Widget
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      HTMLOutputter
+ */
+
+class AccountSettingsNav extends Widget
+{
+    var $action = null;
+
+    /**
+     * Construction
+     *
+     * @param Action $action current action, used for output
+     */
+
+    function __construct($action=null)
+    {
+        parent::__construct($action);
+        $this->action = $action;
+    }
+
+    /**
+     * Show the menu
+     *
+     * @return void
+     */
+
+    function show()
+    {
+        # action => array('prompt', 'title')
+        $menu =
+          array('profilesettings' =>
+                array(_('Profile'),
+                      _('Change your profile settings')),
+                'avatarsettings' =>
+                array(_('Avatar'),
+                      _('Upload an avatar')),
+                'passwordsettings' =>
+                array(_('Password'),
+                      _('Change your password')),
+                'emailsettings' =>
+                array(_('Email'),
+                      _('Change email handling')),
+                'openidsettings' =>
+                array(_('OpenID'),
+                      _('Add or remove OpenIDs')),
+                'othersettings' =>
+                array(_('Other'),
+                      _('Other options')));
+
+        $action_name = $this->action->trimmed('action');
+        $this->action->elementStart('ul', array('class' => 'nav'));
+
+        foreach ($menu as $menuaction => $menudesc) {
+            $this->action->menuItem(common_local_url($menuaction),
+                                   $menudesc[0],
+                                   $menudesc[1],
+                                   $action_name === $menuaction);
+        }
+
+        $this->action->elementEnd('ul');
+    }
+}
index 486b403878475c423d63711a755865ec12f4339e..c056c128fb135bac1b0355e6a3d2299ab1027874 100644 (file)
@@ -1,9 +1,12 @@
 <?php
 /**
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+ * Laconica, the distributed open-source microblogging tool
  *
- * This program is free software: you can redistribute it and/or modify
+ * Base class for all actions (~views)
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Action
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2008 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
  */
 
 if (!defined('LACONICA')) {
     exit(1);
 }
 
-class Action // lawsuit
-{
+require_once INSTALLDIR.'/lib/noticeform.php';
+require_once INSTALLDIR.'/lib/htmloutputter.php';
 
+/**
+ * Base class for all actions
+ *
+ * This is the base class for all actions in the package. An action is
+ * more or less a "view" in an MVC framework.
+ *
+ * Actions are responsible for extracting and validating parameters; using
+ * model classes to read and write to the database; and doing ouput.
+ *
+ * @category Output
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Sarven Capadisli <csarven@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      HTMLOutputter
+ */
+
+class Action extends HTMLOutputter // lawsuit
+{
     var $args;
 
-    function Action()
+    /**
+     * Constructor
+     *
+     * Just wraps the HTMLOutputter constructor.
+     *
+     * @param string  $output URI to output to, default = stdout
+     * @param boolean $indent Whether to indent output, default true
+     *
+     * @see XMLOutputter::__construct
+     * @see HTMLOutputter::__construct
+     */
+
+    function __construct($output='php://output', $indent=true)
     {
+        parent::__construct($output, $indent);
     }
 
     // For initializing members of the class
@@ -38,10 +83,383 @@ class Action // lawsuit
         return true;
     }
 
+    function showPage()
+    {
+        $this->startHTML();
+        $this->showHead();
+        $this->showBody();
+        $this->endHTML();
+    }
+
+    function showHead()
+    {
+        // XXX: attributes (profile?)
+        $this->elementStart('head');
+        $this->showTitle();
+        $this->showStylesheets();
+        $this->showScripts();
+        $this->showOpenSearch();
+        $this->showFeeds();
+        $this->showDescription();
+        $this->extraHead();
+        $this->elementEnd('head');
+    }
+
+    function showTitle()
+    {
+        $this->element('title', null,
+                       sprintf(_("%s - %s"),
+                               $this->title(),
+                               common_config('site', 'name')));
+    }
+
+    // SHOULD overload
+
+    function title()
+    {
+        return _("Untitled page");
+    }
+
+    function showStylesheets()
+    {
+        $this->element('link', array('rel' => 'stylesheet',
+                                     'type' => 'text/css',
+                                     'href' => theme_path('css/display.css', 'base') . '?version=' . LACONICA_VERSION,
+                                     'media' => 'screen, projection, tv'));
+        $this->element('link', array('rel' => 'stylesheet',
+                                     'type' => 'text/css',
+                                     'href' => theme_path('css/thickbox.css', 'base') . '?version=' . LACONICA_VERSION,
+                                     'media' => 'screen, projection, tv'));
+        $this->element('link', array('rel' => 'stylesheet',
+                                     'type' => 'text/css',
+                                     'href' => theme_path('css/display.css', null) . '?version=' . LACONICA_VERSION,
+                                     'media' => 'screen, projection, tv'));
+        $this->comment('[if IE]><link rel="stylesheet" type="text/css" '.
+                       'href="'.theme_path('css/ie.css', 'base').'?version='.LACONICA_VERSION.'" /><![endif]');
+        foreach (array(6,7) as $ver) {
+            if (file_exists(theme_file('ie'.$ver.'.css'))) {
+                // Yes, IE people should be put in jail.
+                $this->comment('[if lte IE '.$ver.']><link rel="stylesheet" type="text/css" '.
+                               'href="'.theme_path('css/ie'.$ver.'.css', 'base').'?version='.LACONICA_VERSION.'" /><![endif]');
+            }
+        }
+    }
+
+    function showScripts()
+    {
+        $this->element('script', array('type' => 'text/javascript',
+                                       'src' => common_path('js/jquery.min.js')),
+                       ' ');
+        $this->element('script', array('type' => 'text/javascript',
+                                       'src' => common_path('js/jquery.form.js')),
+                       ' ');
+        $this->element('script', array('type' => 'text/javascript',
+                                       'src' => common_path('js/xbImportNode.js')),
+                       ' ');
+        $this->element('script', array('type' => 'text/javascript',
+                                       'src' => common_path('js/util.js?version='.LACONICA_VERSION)),
+                       ' ');
+    }
+
+    function showOpenSearch()
+    {
+        $this->element('link', array('rel' => 'search', 'type' => 'application/opensearchdescription+xml',
+                                     'href' =>  common_local_url('opensearch', array('type' => 'people')),
+                                     'title' => common_config('site', 'name').' People Search'));
+
+        $this->element('link', array('rel' => 'search', 'type' => 'application/opensearchdescription+xml',
+                                     'href' =>  common_local_url('opensearch', array('type' => 'notice')),
+                                     'title' => common_config('site', 'name').' Notice Search'));
+    }
+
+    // MAY overload
+
+    function showFeeds()
+    {
+        // does nothing by default
+    }
+
+    // SHOULD overload
+
+    function showDescription()
+    {
+        // does nothing by default
+    }
+
+    // MAY overload
+
+    function extraHead()
+    {
+        // does nothing by default
+    }
+
+    function showBody()
+    {
+        $this->elementStart('body', array('id' => $this->trimmed('action')));
+        $this->elementStart('div', 'wrap');
+        $this->showHeader();
+        $this->showCore();
+        $this->showFooter();
+        $this->elementEnd('div');
+        $this->elementEnd('body');
+    }
+
+    function showHeader()
+    {
+        $this->elementStart('div', array('id' => 'header'));
+        $this->showLogo();
+        $this->showPrimaryNav();
+        $this->showSiteNotice();
+        if (common_logged_in()) {
+            $this->showNoticeForm();
+        } else {
+            $this->showAnonymousMessage();
+        }
+        $this->elementEnd('div');
+    }
+
+    function showLogo()
+    {
+        $this->elementStart('address', array('id' => 'site_contact',
+                                             'class' => 'vcard'));
+        $this->elementStart('a', array('class' => 'url home bookmark',
+                                       'href' => common_local_url('public')));
+        if (common_config('site', 'logo') || file_exists(theme_file('logo.png')))
+        {
+            $this->element('img', array('class' => 'logo photo',
+                                        'src' => (common_config('site', 'logo')) ? common_config('site', 'logo') : theme_path('logo.png'),
+                                        'alt' => common_config('site', 'name')));
+        }
+        $this->element('span', array('class' => 'fn org'), common_config('site', 'name'));
+        $this->elementEnd('a');
+        $this->elementEnd('address');
+    }
+
+    function showPrimaryNav()
+    {
+        $this->elementStart('dl', array('id' => 'site_nav_global_primary'));
+        $this->element('dt', null, _('Primary site navigation'));
+        $this->elementStart('dd');
+        $user = common_current_user();
+        $this->elementStart('ul', array('class' => 'nav'));
+        if ($user) {
+            $this->menuItem(common_local_url('all', array('nickname' => $user->nickname)),
+                            _('Home'), _('Personal profile and friends timeline'), false, 'nav_home');
+        }
+        $this->menuItem(common_local_url('peoplesearch'),
+                        _('Search'), _('Search for people or text'), false, 'nav_search');
+        if ($user) {
+            $this->menuItem(common_local_url('profilesettings'),
+                            _('Account'), _('Change your email, avatar, password, profile'), false, 'nav_account');
+            $this->menuItem(common_local_url('imsettings'),
+                            _('Connect'), _('Connect to IM, SMS, Twitter'), false, 'nav_connect');
+            $this->menuItem(common_local_url('logout'),
+                            _('Logout'), _('Logout from the site'), false, 'nav_logout');
+        } else {
+            $this->menuItem(common_local_url('login'),
+                            _('Login'), _('Login to the site'), false, 'nav_login');
+            if (!common_config('site', 'closed')) {
+                $this->menuItem(common_local_url('register'),
+                                _('Register'), _('Create an account'), false, 'nav_register');
+            }
+            $this->menuItem(common_local_url('openidlogin'),
+                            _('OpenID'), _('Login with OpenID'), false, 'nav_openid');
+        }
+        $this->menuItem(common_local_url('doc', array('title' => 'help')),
+                        _('Help'), _('Help me!'), false, 'nav_help');
+        $this->elementEnd('ul');
+        $this->elementEnd('dd');
+        $this->elementEnd('dl');
+    }
+
+    // Revist. Should probably do an hAtom pattern here
+    function showSiteNotice()
+    {
+        $text = common_config('site', 'notice');
+        if ($text) {
+            $this->elementStart('dl', array('id' => 'site_notice',
+                                            'class' => 'system_notice'));
+            $this->element('dt', null, _('Site notice'));
+            $this->element('dd', null, $text);
+            $this->elementEnd('dl');
+        }
+    }
+
+    // MAY overload if no notice form needed... or direct message box????
+
+    function showNoticeForm()
+    {
+        $notice_form = new NoticeForm($this);
+        $notice_form->show();
+    }
+
+    function showAnonymousMessage()
+    {
+        // needs to be defined by the class
+    }
+
+    function showCore()
+    {
+        $this->elementStart('div', array('id' => 'core'));
+        $this->elementStart('dl', array('id' => 'site_nav_local_views'));
+        $this->element('dt', null, _('Local views'));
+        $this->elementStart('dd');
+        $this->showLocalNav();
+        $this->elementEnd('dd');
+        $this->elementEnd('dl');
+        $this->showContentBlock();
+        $this->showAside();
+        $this->elementEnd('div');
+    }
+
+    // SHOULD overload
+
+    function showLocalNav()
+    {
+        // does nothing by default
+    }
+
+    function showContentBlock()
+    {
+        $this->elementStart('div', array('id' => 'content'));
+        $this->showPageTitle();
+        $this->showPageNoticeBlock();
+        $this->elementStart('div', array('id' => 'content_inner'));
+        // show the actual content (forms, lists, whatever)
+        $this->showContent();
+        $this->elementEnd('div');
+        $this->elementEnd('div');
+    }
+
+    function showPageTitle() {
+        $this->element('h1', NULL, $this->title());
+    }
+
+    function showPageNoticeBlock()
+    {
+        $this->elementStart('dl', array('id' => 'page_notice',
+                                        'class' => 'system_notice'));
+        $this->element('dt', null, _('Page notice'));
+        $this->elementStart('dd');
+        $this->showPageNotice();
+        $this->elementEnd('dd');
+        $this->elementEnd('dl');
+       }
+
+    // SHOULD overload (unless there's not a notice)
+
+    function showPageNotice()
+    {
+    }
+
+    // MUST overload
+
+    function showContent()
+    {
+    }
+
+    function showAside()
+    {
+        $this->elementStart('div', array('id' => 'aside_primary',
+                                         'class' => 'aside'));
+        $this->showExportData();
+        $this->showSections();
+        $this->elementEnd('div');
+    }
+
+    // MAY overload if there are feeds
+
+    function showExportData()
+    {
+        // is there structure to this?
+        // list of (visible!) feed links
+        // can we reuse list of feeds from showFeeds() ?
+    }
+
+    // SHOULD overload
+
+    function showSections() {
+        // for each section, show it
+    }
+
+    function showFooter()
+    {
+        $this->elementStart('div', array('id' => 'footer'));
+        $this->showSecondaryNav();
+        $this->showLicenses();
+        $this->elementEnd('div');
+    }
+
+    function showSecondaryNav()
+    {
+        $this->elementStart('dl', array('id' => 'site_nav_global_secondary'));
+        $this->element('dt', null, _('Secondary site navigation'));
+        $this->elementStart('dd', null);
+        $this->elementStart('ul', array('class' => 'nav'));
+        $this->menuItem(common_local_url('doc', array('title' => 'help')),
+                        _('Help'));
+        $this->menuItem(common_local_url('doc', array('title' => 'about')),
+                        _('About'));
+        $this->menuItem(common_local_url('doc', array('title' => 'faq')),
+                        _('FAQ'));
+        $this->menuItem(common_local_url('doc', array('title' => 'privacy')),
+                        _('Privacy'));
+        $this->menuItem(common_local_url('doc', array('title' => 'source')),
+                        _('Source'));
+        $this->menuItem(common_local_url('doc', array('title' => 'contact')),
+                        _('Contact'));
+        $this->elementEnd('ul');
+        $this->elementEnd('dd');
+        $this->elementEnd('dl');
+    }
+
+    function showLicenses()
+    {
+        $this->elementStart('dl', array('id' => 'licenses'));
+        $this->showLaconicaLicense();
+        $this->showContentLicense();
+        $this->elementEnd('dl');
+    }
+
+    function showLaconicaLicense()
+    {
+        $this->element('dt', array('id' => 'site_laconica_license'), _('Laconica software license'));
+        $this->elementStart('dd', null);
+        if (common_config('site', 'broughtby')) {
+            $instr = _('**%%site.name%%** is a microblogging service brought to you by [%%site.broughtby%%](%%site.broughtbyurl%%). ');
+        } else {
+            $instr = _('**%%site.name%%** is a microblogging service. ');
+        }
+        $instr .= sprintf(_('It runs the [Laconica](http://laconi.ca/) microblogging software, version %s, available under the [GNU Affero General Public License](http://www.fsf.org/licensing/licenses/agpl-3.0.html).'), LACONICA_VERSION);
+        $output = common_markup_to_html($instr);
+        $this->raw($output);
+        $this->elementEnd('dd');
+        // do it
+    }
+
+    function showContentLicense()
+    {
+        $this->element('dt', array('id' => 'site_content_license'), _('Laconica software license'));
+        $this->elementStart('dd', array('id' => 'site_content_license_cc'));
+        $this->elementStart('p');
+        $this->element('img', array('id' => 'license_cc',
+                                    'src' => common_config('license', 'image'),
+                                    'alt' => common_config('license', 'title')));
+        //TODO: This is dirty: i18n
+        $this->text(_('All '.common_config('site', 'name').' content and data are available under the '));
+        $this->element('a', array('class' => 'license',
+                                  'rel' => 'external license',
+                                  'href' => common_config('license', 'url')),
+                       common_config('license', 'title'));
+        $this->text(_('license.'));
+        $this->elementEnd('p');
+        $this->elementEnd('dd');
+    }
+
     // For comparison with If-Last-Modified
     // If not applicable, return null
 
-    function last_modified()
+    function lastModified()
     {
         return null;
     }
@@ -51,7 +469,7 @@ class Action // lawsuit
         return null;
     }
 
-    function is_readonly()
+    function isReadOnly()
     {
         return false;
     }
@@ -76,7 +494,7 @@ class Action // lawsuit
     function handle($argarray=null)
     {
 
-        $lm = $this->last_modified();
+        $lm = $this->lastModified();
         $etag = $this->etag();
 
         if ($etag) {
@@ -90,7 +508,7 @@ class Action // lawsuit
                 $ims = strtotime($if_modified_since);
                 if ($lm <= $ims) {
                     if (!$etag ||
-                        $this->_has_etag($etag, $_SERVER['HTTP_IF_NONE_MATCH'])) {
+                        $this->_hasEtag($etag, $_SERVER['HTTP_IF_NONE_MATCH'])) {
                         header('HTTP/1.1 304 Not Modified');
                         // Better way to do this?
                         exit(0);
@@ -100,7 +518,7 @@ class Action // lawsuit
         }
     }
 
-    function _has_etag($etag, $if_none_match)
+    function _hasEtag($etag, $if_none_match)
     {
         return ($if_none_match) && in_array($etag, explode(',', $if_none_match));
     }
@@ -120,21 +538,21 @@ class Action // lawsuit
         }
     }
 
-    function server_error($msg, $code=500)
+    function serverError($msg, $code=500)
     {
         $action = $this->trimmed('action');
         common_debug("Server error '$code' on '$action': $msg", __FILE__);
         common_server_error($msg, $code);
     }
 
-    function client_error($msg, $code=400)
+    function clientError($msg, $code=400)
     {
         $action = $this->trimmed('action');
         common_debug("User error '$code' on '$action': $msg", __FILE__);
         common_user_error($msg, $code);
     }
 
-    function self_url()
+    function selfUrl()
     {
         $action = $this->trimmed('action');
         $args = $this->args;
@@ -145,17 +563,63 @@ class Action // lawsuit
         return common_local_url($action, $args);
     }
 
-    function nav_menu($menu)
+    // Added @id to li for some control.
+    // XXX: We might want to move this to htmloutputter.php
+
+    function menuItem($url, $text, $title=null, $is_selected=false, $id=null)
     {
-        $action = $this->trimmed('action');
-        common_element_start('ul', array('id' => 'nav_views'));
-        foreach ($menu as $menuaction => $menudesc) {
-            common_menu_item(common_local_url($menuaction,
-                                              isset($menudesc[2]) ? $menudesc[2] : null),
-                             $menudesc[0],
-                             $menudesc[1],
-                             $action == $menuaction);
-        }
-        common_element_end('ul');
+        $lattrs = array();
+        if ($is_selected) {
+            $lattrs['class'] = 'current';
+        }
+
+        (is_null($id)) ? $lattrs : $lattrs['id'] = $id;
+
+        $this->elementStart('li', $lattrs);
+        $attrs['href'] = $url;
+        if ($title) {
+            $attrs['title'] = $title;
+        }
+        $this->element('a', $attrs, $text);
+        $this->elementEnd('li');
+    }
+
+    // Does a little before-after block for next/prev page
+
+    function pagination($have_before, $have_after, $page, $action, $args=null)
+    {
+        if ($have_before || $have_after) {
+            $this->elementStart('div', array('class' => 'pagination'));
+            $this->elementStart('dl', null);
+            $this->element('dt', null, _('Pagination'));
+            $this->elementStart('dd', null);
+            $this->elementStart('ul', array('class' => 'nav'));
+        }
+
+        if ($have_before) {
+            $pargs = array('page' => $page-1);
+            $newargs = ($args) ? array_merge($args,$pargs) : $pargs;
+
+            $this->elementStart('li', array('class' => 'nav_prev'));
+            $this->element('a', array('href' => common_local_url($action, $newargs), 'rel' => 'prev'),
+                           _('After'));
+            $this->elementEnd('li');
+        }
+
+        if ($have_after) {
+            $pargs = array('page' => $page+1);
+            $newargs = ($args) ? array_merge($args,$pargs) : $pargs;
+            $this->elementStart('li', array('class' => 'nav_next'));
+            $this->element('a', array('href' => common_local_url($action, $newargs), 'rel' => 'next'),
+                           _('Before'));
+            $this->elementEnd('li');
+        }
+
+        if ($have_before || $have_after) {
+            $this->elementEnd('ul');
+            $this->elementEnd('dd');
+            $this->elementEnd('dl');
+            $this->elementEnd('div');
+        }
     }
 }
diff --git a/lib/blockform.php b/lib/blockform.php
new file mode 100644 (file)
index 0000000..51e43f8
--- /dev/null
@@ -0,0 +1,130 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Form for blocking a user
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Form
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/form.php';
+
+/**
+ * Form for blocking a user
+ *
+ * @category Form
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Sarven Capadisli <csarven@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      UnblockForm
+ */
+
+class BlockForm extends Form
+{
+    /**
+     * Profile of user to block
+     */
+
+    var $profile = null;
+
+    /**
+     * Return-to args
+     */
+
+    var $args = null;
+
+    /**
+     * Constructor
+     *
+     * @param HTMLOutputter $out     output channel
+     * @param Profile       $profile profile of user to block
+     * @param array         $args    return-to args
+     */
+
+    function __construct($out=null, $profile=null, $args=null)
+    {
+        parent::__construct($out);
+
+        $this->profile = $profile;
+        $this->args    = $args;
+    }
+
+    /**
+     * ID of the form
+     *
+     * @return int ID of the form
+     */
+
+    function id()
+    {
+        return 'block-' . $this->profile->id;
+    }
+
+    /**
+     * Action of the form
+     *
+     * @return string URL of the action
+     */
+
+    function action()
+    {
+        return common_local_url('block');
+    }
+
+    /**
+     * Data elements of the form
+     *
+     * @return void
+     */
+
+    function formData()
+    {
+        $this->out->hidden('blockto-' . $this->profile->id,
+                           $this->profile->id,
+                           'blockto');
+        if ($this->args) {
+            foreach ($this->args as $k => $v) {
+                $this->out->hidden('returnto-' . $k, $v);
+            }
+        }
+    }
+
+    /**
+     * Action elements
+     *
+     * @return void
+     */
+
+    function formActions()
+    {
+        $this->out->submit('submit', _('Block'));
+    }
+}
\ No newline at end of file
index 74c992f1c9af7c6fd0f080dba98b9d090a0a24bf..1068d4c1350dd5f51b6cfb907dcd9ac8d422be20 100644 (file)
@@ -79,7 +79,7 @@ $config =
         'license' =>
         array('url' => 'http://creativecommons.org/licenses/by/3.0/',
               'title' => 'Creative Commons Attribution 3.0',
-              'image' => 'http://i.creativecommons.org/l/by/3.0/88x31.png'),
+              'image' => 'http://i.creativecommons.org/l/by/3.0/80x15.png'),
         'mail' =>
         array('backend' => 'mail',
               'params' => null),
@@ -163,11 +163,17 @@ require_once(INSTALLDIR.'/lib/subs.php');
 require_once(INSTALLDIR.'/lib/Shorturl_api.php');
 require_once(INSTALLDIR.'/lib/twitter.php');
 
+// XXX: other formats here
+
+define('NICKNAME_FMT', VALIDATE_NUM.VALIDATE_ALPHA_LOWER);
+
 function __autoload($class)
 {
     if ($class == 'OAuthRequest') {
         require_once('OAuth.php');
     } else if (file_exists(INSTALLDIR.'/classes/' . $class . '.php')) {
         require_once(INSTALLDIR.'/classes/' . $class . '.php');
+    } else if (file_exists(INSTALLDIR.'/lib/' . strtolower($class) . '.php')) {
+        require_once(INSTALLDIR.'/lib/' . strtolower($class) . '.php');
     }
 }
diff --git a/lib/connectsettingsaction.php b/lib/connectsettingsaction.php
new file mode 100644 (file)
index 0000000..3062968
--- /dev/null
@@ -0,0 +1,129 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Base class for connection settings actions
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Settings
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/settingsaction.php';
+
+/**
+ * Base class for connection settings actions
+ *
+ * @category Settings
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      Widget
+ */
+
+class ConnectSettingsAction extends SettingsAction
+{
+    /**
+     * Show the local navigation menu
+     *
+     * This is the same for all settings, so we show it here.
+     *
+     * @return void
+     */
+
+    function showLocalNav()
+    {
+        $menu = new ConnectSettingsNav($this);
+        $menu->show();
+    }
+}
+
+/**
+ * A widget for showing the connect group local nav menu
+ *
+ * @category Widget
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      HTMLOutputter
+ */
+
+class ConnectSettingsNav extends Widget
+{
+    var $action = null;
+
+    /**
+     * Construction
+     *
+     * @param Action $action current action, used for output
+     */
+
+    function __construct($action=null)
+    {
+        parent::__construct($action);
+        $this->action = $action;
+    }
+
+    /**
+     * Show the menu
+     *
+     * @return void
+     */
+
+    function show()
+    {
+        # action => array('prompt', 'title')
+        $menu =
+          array('imsettings' =>
+                array(_('IM'),
+                      _('Updates by instant messenger (IM)')),
+                'smssettings' =>
+                array(_('SMS'),
+                      _('Updates by SMS')),
+                'twittersettings' =>
+                array(_('Twitter'),
+                      _('Twitter integration options')));
+
+        $action_name = $this->action->trimmed('action');
+        $this->action->elementStart('ul', array('class' => 'nav'));
+
+        foreach ($menu as $menuaction => $menudesc) {
+            if ($menuaction == 'imsettings' &&
+                !common_config('xmpp', 'enabled')) {
+                continue;
+            }
+            $this->action->menuItem(common_local_url($menuaction),
+                                   $menudesc[0],
+                                   $menudesc[1],
+                                   $action_name === $menuaction);
+        }
+
+        $this->action->elementEnd('ul');
+    }
+}
diff --git a/lib/disfavorform.php b/lib/disfavorform.php
new file mode 100644 (file)
index 0000000..45a9ddb
--- /dev/null
@@ -0,0 +1,154 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Form for disfavoring a notice
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Form
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/form.php';
+
+/**
+ * Form for disfavoring a notice
+ *
+ * @category Form
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Sarven Capadisli <csarven@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      FavorForm
+ */
+
+class DisfavorForm extends Form
+{
+    /**
+     * Notice to disfavor
+     */
+
+    var $notice = null;
+
+    /**
+     * Constructor
+     *
+     * @param HTMLOutputter $out    output channel
+     * @param Notice        $notice notice to disfavor
+     */
+
+    function __construct($out=null, $notice=null)
+    {
+        parent::__construct($out);
+
+        $this->notice = $notice;
+    }
+
+    /**
+     * ID of the form
+     *
+     * @return int ID of the form
+     */
+
+    function id()
+    {
+        return 'disfavor-' . $this->notice->id;
+    }
+
+    /**
+     * Action of the form
+     *
+     * @return string URL of the action
+     */
+
+    function action()
+    {
+        return common_local_url('disfavor');
+    }
+
+    /**
+     * Include a session token for CSRF protection
+     *
+     * @return void
+     */
+
+    function sessionToken()
+    {
+        $this->out->hidden('token-' . $this->notice->id,
+                           common_session_token());
+    }
+
+
+    /**
+     * Legend of the Form
+     *
+     * @return void
+     */
+    function formLegend()
+    {
+        $this->out->element('legend', null, _('Disfavor this notice'));
+    }
+
+
+    /**
+     * Data elements
+     *
+     * @return void
+     */
+
+    function formData()
+    {
+        $this->out->hidden('notice-n'.$this->notice->id,
+                           $this->notice->id,
+                           'notice');
+    }
+
+    /**
+     * Action elements
+     *
+     * @return void
+     */
+
+    function formActions()
+    {
+        $this->out->submit('disfavor-submit-' . $this->notice->id,
+                           _('Disfavor favorite'), 'submit', null, _('Disfavor this notice'));
+    }
+    
+    /**
+     * Class of the form.
+     *
+     * @return string the form's class
+     */
+
+    function formClass()
+    {
+        return 'form_disfavor';
+    }
+
+}
diff --git a/lib/favorform.php b/lib/favorform.php
new file mode 100644 (file)
index 0000000..f3a7a97
--- /dev/null
@@ -0,0 +1,153 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Form for favoring a notice
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Form
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/form.php';
+
+/**
+ * Form for favoring a notice
+ *
+ * @category Form
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Sarven Capadisli <csarven@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      DisfavorForm
+ */
+
+class FavorForm extends Form
+{
+    /**
+     * Notice to favor
+     */
+
+    var $notice = null;
+
+    /**
+     * Constructor
+     *
+     * @param HTMLOutputter $out    output channel
+     * @param Notice        $notice notice to favor
+     */
+
+    function __construct($out=null, $notice=null)
+    {
+        parent::__construct($out);
+
+        $this->notice = $notice;
+    }
+
+    /**
+     * ID of the form
+     *
+     * @return int ID of the form
+     */
+
+    function id()
+    {
+        return 'favor-' . $this->notice->id;
+    }
+
+    /**
+     * Action of the form
+     *
+     * @return string URL of the action
+     */
+
+    function action()
+    {
+        return common_local_url('favor');
+    }
+
+    /**
+     * Include a session token for CSRF protection
+     *
+     * @return void
+     */
+
+    function sessionToken()
+    {
+        $this->out->hidden('token-' . $this->notice->id,
+                           common_session_token());
+    }
+
+
+    /**
+     * Legend of the Form
+     *
+     * @return void
+     */
+    function formLegend()
+    {
+        $this->out->element('legend', null, _('Favor this notice'));
+    }
+
+
+    /**
+     * Data elements
+     *
+     * @return void
+     */
+
+    function formData()
+    {
+        $this->out->hidden('notice-n'.$this->notice->id,
+                           $this->notice->id,
+                           'notice');
+    }
+
+    /**
+     * Action elements
+     *
+     * @return void
+     */
+
+    function formActions()
+    {
+        $this->out->submit('favor-submit-' . $this->notice->id,
+                           _('Favor'), 'submit', null, _('Favor this notice'));
+    }
+    
+    /**
+     * Class of the form.
+     *
+     * @return string the form's class
+     */
+    
+    function formClass()
+    {
+        return 'form_favor';
+    }
+}
diff --git a/lib/feedlist.php b/lib/feedlist.php
new file mode 100644 (file)
index 0000000..47d909e
--- /dev/null
@@ -0,0 +1,158 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Widget for showing a list of feeds
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Widget
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2008 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+/**
+ * Widget for showing a list of feeds
+ *
+ * Typically used for Action::showExportList()
+ *
+ * @category Widget
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Sarven Capadisli <csarven@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      Action::showExportList()
+ */
+
+class FeedList extends Widget
+{
+    var $action = null;
+    
+    function __construct($action=null)
+    {
+       parent::__construct($action);
+       $this->action = $action;
+    }
+
+    function show($feeds)
+    {
+        $this->out->elementStart('div', array('id' => 'export_data',
+                                              'class' => 'section'));
+        $this->out->element('h2', null, _('Export data'));
+        $this->out->elementStart('ul', array('class' => 'xoxo'));
+
+        foreach ($feeds as $key => $value) {
+            $this->feedItem($feeds[$key]);
+        }
+
+        $this->out->elementEnd('ul');
+        $this->out->elementEnd('div');
+    }
+
+    function feedItem($feed)
+    {
+        $nickname = $this->action->trimmed('nickname');
+
+        switch($feed['item']) {
+         case 'notices': default:
+            $feed_classname = $feed['type'];
+            $feed_mimetype = "application/".$feed['type']."+xml";
+            $feed_title = "$nickname's ".$feed['version']." notice feed";
+            $feed['textContent'] = "RSS";
+            break;
+
+         case 'allrss':
+            $feed_classname = $feed['type'];
+            $feed_mimetype = "application/".$feed['type']."+xml";
+            $feed_title = $feed['version']." feed for $nickname and friends";
+            $feed['textContent'] = "RSS";
+            break;
+
+         case 'repliesrss':
+            $feed_classname = $feed['type'];
+            $feed_mimetype = "application/".$feed['type']."+xml";
+            $feed_title = $feed['version']." feed for replies to $nickname";
+            $feed['textContent'] = "RSS";
+            break;
+
+         case 'publicrss':
+            $feed_classname = $feed['type'];
+            $feed_mimetype = "application/".$feed['type']."+xml";
+            $feed_title = "Public timeline ".$feed['version']." feed";
+            $feed['textContent'] = "RSS";
+            break;
+
+         case 'publicatom':
+            $feed_classname = "atom";
+            $feed_mimetype = "application/".$feed['type']."+xml";
+            $feed_title = "Public timeline ".$feed['version']." feed";
+            $feed['textContent'] = "Atom";
+            break;
+
+         case 'tagrss':
+            $feed_classname = $feed['type'];
+            $feed_mimetype = "application/".$feed['type']."+xml";
+            $feed_title = $feed['version']." feed for this tag";
+            $feed['textContent'] = "RSS";
+            break;
+
+         case 'favoritedrss':
+            $feed_classname = $feed['type'];
+            $feed_mimetype = "application/".$feed['type']."+xml";
+            $feed_title = "Favorited ".$feed['version']." feed";
+            $feed['textContent'] = "RSS";
+            break;
+
+         case 'foaf':
+            $feed_classname = "foaf";
+            $feed_mimetype = "application/".$feed['type']."+xml";
+            $feed_title = "$nickname's FOAF file";
+            $feed['textContent'] = "FOAF";
+            break;
+
+         case 'favoritesrss':
+            $feed_classname = "favorites";
+            $feed_mimetype = "application/".$feed['type']."+xml";
+            $feed_title = "Feed for favorites of $nickname";
+            $feed['textContent'] = "RSS";
+            break;
+
+         case 'usertimeline':
+            $feed_classname = "atom";
+            $feed_mimetype = "application/".$feed['type']."+xml";
+            $feed_title = "$nickname's ".$feed['version']." notice feed";
+            $feed['textContent'] = "Atom";
+            break;
+        }
+        $this->out->elementStart('li');
+        $this->out->element('a', array('href' => $feed['href'],
+                                  'class' => $feed_classname,
+                                  'type' => $feed_mimetype,
+                                  'title' => $feed_title),
+                       $feed['textContent']);
+        $this->out->elementEnd('li');
+    }
+}
diff --git a/lib/form.php b/lib/form.php
new file mode 100644 (file)
index 0000000..011d4bf
--- /dev/null
@@ -0,0 +1,168 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Base class for forms
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Widget
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/widget.php';
+
+/**
+ * Base class for forms
+ *
+ * We have a lot of common forms (subscribe, fave, delete) and this superclass
+ * lets us abstract out the basic features of the form.
+ *
+ * @category Widget
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Sarven Capadisli <csarven@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      HTMLOutputter
+ */
+
+class Form extends Widget
+{
+    /**
+     * Show the form
+     *
+     * Uses a recipe to output the form.
+     *
+     * @return void
+     * @see Widget::show()
+     */
+
+    function show()
+    {
+        $this->out->elementStart('form',
+                                 array('id' => $this->id(),
+                                      'class' => $this->formClass(),
+                                       'method' => 'post',
+                                       'action' => $this->action()));
+        $this->out->elementStart('fieldset');
+        $this->formLegend();
+        $this->sessionToken();
+        $this->formData();
+        $this->formActions();
+        $this->out->elementEnd('fieldset');
+        $this->out->elementEnd('form');
+    }
+
+    /**
+     * Include a session token for CSRF protection
+     *
+     * @return void
+     */
+
+    function sessionToken()
+    {
+        $this->out->hidden('token', common_session_token());
+    }
+
+
+    /**
+     * Name of the form
+     *
+     * Sub-classes should overload this with the name of their form.
+     *
+     * @return void
+     */
+
+    function formLegend()
+    {
+    }
+
+
+    /**
+     * Visible or invisible data elements
+     *
+     * Display the form fields that make up the data of the form.
+     * Sub-classes should overload this to show their data.
+     *
+     * @return void
+     */
+
+    function formData()
+    {
+    }
+
+    /**
+     * Buttons for form actions
+     *
+     * Submit and cancel buttons (or whatever)
+     * Sub-classes should overload this to show their own buttons.
+     *
+     * @return void
+     */
+
+    function formActions()
+    {
+    }
+
+    /**
+     * ID of the form
+     *
+     * Should be unique on the page. Sub-classes should overload this
+     * to show their own IDs.
+     *
+     * @return int ID of the form
+     */
+
+    function id()
+    {
+        return null;
+    }
+
+    /**
+     * Action of the form.
+     *
+     * URL to post to. Should be overloaded by subclasses to give
+     * somewhere to post to.
+     *
+     * @return string URL to post to
+     */
+
+    function action()
+    {
+    }
+    
+    /**
+     * Class of the form.
+     *
+     * @return string the form's class
+     */
+
+    function formClass()
+    {
+       return 'form';
+    }
+}
diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php
new file mode 100644 (file)
index 0000000..1e16493
--- /dev/null
@@ -0,0 +1,353 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Low-level generator for HTML
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Output
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2008 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/xmloutputter.php';
+
+define('PAGE_TYPE_PREFS',
+       'text/html,application/xhtml+xml,'.
+       'application/xml;q=0.3,text/xml;q=0.2');
+
+/**
+ * Low-level generator for HTML
+ *
+ * Abstracts some of the code necessary for HTML generation. Especially
+ * has methods for generating HTML form elements. Note that these have
+ * been created kind of haphazardly, not with an eye to making a general
+ * HTML-creation class.
+ *
+ * @category Output
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Sarven Capadisli <csarven@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      Action
+ * @see      XMLOutputter
+ */
+
+class HTMLOutputter extends XMLOutputter
+{
+    /**
+     * Constructor
+     *
+     * Just wraps the XMLOutputter constructor.
+     *
+     * @param string  $output URI to output to, default = stdout
+     * @param boolean $indent Whether to indent output, default true
+     */
+
+    function __construct($output='php://output', $indent=true)
+    {
+        parent::__construct($output, $indent);
+    }
+
+    /**
+     * Start an HTML document
+     *
+     * If $type isn't specified, will attempt to do content negotiation.
+     *
+     * Attempts to do content negotiation for language, also.
+     *
+     * @param string $type MIME type to use; default is to do negotation.
+     *
+     * @todo extract content negotiation code to an HTTP module or class.
+     *
+     * @return void
+     */
+
+    function startHTML($type=null)
+    {
+        if (!$type) {
+            $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ?
+              $_SERVER['HTTP_ACCEPT'] : null;
+
+            // XXX: allow content negotiation for RDF, RSS, or XRDS
+
+            $cp = common_accept_to_prefs($httpaccept);
+            $sp = common_accept_to_prefs(PAGE_TYPE_PREFS);
+
+            $type = common_negotiate_type($cp, $sp);
+
+            if (!$type) {
+                common_user_error(_('This page is not available in a '.
+                                    'media type you accept'), 406);
+                exit(0);
+            }
+        }
+
+        header('Content-Type: '.$type);
+
+        $this->startXML('html',
+                        '-//W3C//DTD XHTML 1.0 Strict//EN',
+                        'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd');
+
+        // FIXME: correct language for interface
+
+        $language = common_language();
+
+        $this->elementStart('html', array('xmlns' => 'http://www.w3.org/1999/xhtml',
+                                          'xml:lang' => $language,
+                                          'lang' => $language));
+    }
+
+    /**
+    *  Ends an HTML document
+    *
+    *  @return void
+    */
+    function endHTML()
+    {
+        $this->elementEnd('html');
+        $this->endXML();
+    }
+
+    /**
+     * Output an HTML text input element
+     *
+     * Despite the name, it is specifically for outputting a
+     * text input element, not other <input> elements. It outputs
+     * a cluster of elements, including a <label> and an associated
+     * instructions span.
+     *
+     * @param string $id           element ID, must be unique on page
+     * @param string $label        text of label for the element
+     * @param string $value        value of the element, default null
+     * @param string $instructions instructions for valid input
+     *
+     * @todo add a $name parameter
+     * @todo add a $maxLength parameter
+     * @todo add a $size parameter
+     *
+     * @return void
+     */
+
+    function input($id, $label, $value=null, $instructions=null)
+    {
+        $this->element('label', array('for' => $id), $label);
+        $attrs = array('name' => $id,
+                       'type' => 'text',
+                       'id' => $id);
+        if ($value) {
+            $attrs['value'] = htmlspecialchars($value);
+        }
+        $this->element('input', $attrs);
+        if ($instructions) {
+            $this->element('p', 'form_guide', $instructions);
+        }
+    }
+
+    /**
+     * output an HTML checkbox and associated elements
+     *
+     * Note that the value is default 'true' (the string), which can
+     * be used by Action::boolean()
+     *
+     * @param string $id           element ID, must be unique on page
+     * @param string $label        text of label for the element
+     * @param string $checked      if the box is checked, default false
+     * @param string $instructions instructions for valid input
+     * @param string $value        value of the checkbox, default 'true'
+     * @param string $disabled     show the checkbox disabled, default false
+     *
+     * @return void
+     *
+     * @todo add a $name parameter
+     */
+
+    function checkbox($id, $label, $checked=false, $instructions=null,
+                      $value='true', $disabled=false)
+    {
+        $attrs = array('name' => $id,
+                       'type' => 'checkbox',
+                       'class' => 'checkbox',
+                       'id' => $id);
+        if ($value) {
+            $attrs['value'] = htmlspecialchars($value);
+        }
+        if ($checked) {
+            $attrs['checked'] = 'checked';
+        }
+        if ($disabled) {
+            $attrs['disabled'] = 'true';
+        }
+        $this->element('input', $attrs);
+        $this->text(' ');
+        $this->element('label', array('class' => 'checkbox',
+                                      'for' => $id),
+                       $label);
+        $this->text(' ');
+        if ($instructions) {
+            $this->element('p', 'form_guide', $instructions);
+        }
+    }
+
+    /**
+     * output an HTML combobox/select and associated elements
+     *
+     * $content is an array of key-value pairs for the dropdown, where
+     * the key is the option value attribute and the value is the option
+     * text. (Careful on the overuse of 'value' here.)
+     *
+     * @param string $id           element ID, must be unique on page
+     * @param string $label        text of label for the element
+     * @param array  $content      options array, value => text
+     * @param string $instructions instructions for valid input
+     * @param string $blank_select whether to have a blank entry, default false
+     * @param string $selected     selected value, default null
+     *
+     * @return void
+     *
+     * @todo add a $name parameter
+     */
+
+    function dropdown($id, $label, $content, $instructions=null,
+                      $blank_select=false, $selected=null)
+    {
+        $this->element('label', array('for' => $id), $label);
+        $this->elementStart('select', array('id' => $id, 'name' => $id));
+        if ($blank_select) {
+            $this->element('option', array('value' => ''));
+        }
+        foreach ($content as $value => $option) {
+            if ($value == $selected) {
+                $this->element('option', array('value' => $value,
+                                               'selected' => $value),
+                               $option);
+            } else {
+                $this->element('option', array('value' => $value), $option);
+            }
+        }
+        $this->elementEnd('select');
+        if ($instructions) {
+            $this->element('p', 'form_guide', $instructions);
+        }
+    }
+
+    /**
+     * output an HTML hidden element
+     *
+     * $id is re-used as name
+     *
+     * @param string $id    element ID, must be unique on page
+     * @param string $value hidden element value, default null
+     * @param string $name  name, if different than ID
+     *
+     * @return void
+     */
+
+    function hidden($id, $value, $name=null)
+    {
+        $this->element('input', array('name' => ($name) ? $name : $id,
+                                      'type' => 'hidden',
+                                      'id' => $id,
+                                      'value' => $value));
+    }
+
+    /**
+     * output an HTML password input and associated elements
+     *
+     * @param string $id           element ID, must be unique on page
+     * @param string $label        text of label for the element
+     * @param string $instructions instructions for valid input
+     *
+     * @return void
+     *
+     * @todo add a $name parameter
+     */
+
+    function password($id, $label, $instructions=null)
+    {
+        $this->element('label', array('for' => $id), $label);
+        $attrs = array('name' => $id,
+                       'type' => 'password',
+                       'class' => 'password',
+                       'id' => $id);
+        $this->element('input', $attrs);
+        if ($instructions) {
+            $this->element('p', 'form_guide', $instructions);
+        }
+    }
+
+    /**
+     * output an HTML submit input and associated elements
+     *
+     * @param string $id    element ID, must be unique on page
+     * @param string $label text of the button
+     * @param string $cls   class of the button, default 'submit'
+     * @param string $name  name, if different than ID
+     *
+     * @return void
+     *
+     * @todo add a $name parameter
+     */
+
+    function submit($id, $label, $cls='submit', $name=null, $title=null)
+    {
+        $this->element('input', array('type' => 'submit',
+                                      'id' => $id,
+                                      'name' => ($name) ? $name : $id,
+                                      'class' => $cls,
+                                      'value' => $label,
+                                      'title' => $title));
+    }
+
+    /**
+     * output an HTML textarea and associated elements
+     *
+     * @param string $id           element ID, must be unique on page
+     * @param string $label        text of label for the element
+     * @param string $content      content of the textarea, default none
+     * @param string $instructions instructions for valid input
+     *
+     * @return void
+     *
+     * @todo add a $name parameter
+     * @todo add a $cols parameter
+     * @todo add a $rows parameter
+     */
+
+    function textarea($id, $label, $content=null, $instructions=null)
+    {
+        $this->element('label', array('for' => $id), $label);
+        $this->element('textarea', array('rows' => 3,
+                                         'cols' => 40,
+                                         'name' => $id,
+                                         'id' => $id),
+                       ($content) ? $content : '');
+        if ($instructions) {
+            $this->element('p', 'form_guide', $instructions);
+        }
+    }
+}
diff --git a/lib/logingroupnav.php b/lib/logingroupnav.php
new file mode 100644 (file)
index 0000000..8c03ecc
--- /dev/null
@@ -0,0 +1,96 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Menu for login group of actions
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Menu
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/widget.php';
+
+/**
+ * Menu for login group of actions
+ *
+ * @category Output
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      Widget
+ */
+
+class LoginGroupNav extends Widget
+{
+    var $action = null;
+
+    /**
+     * Construction
+     *
+     * @param Action $action current action, used for output
+     */
+
+    function __construct($action=null)
+    {
+        parent::__construct($action);
+        $this->action = $action;
+    }
+
+    /**
+     * Show the menu
+     *
+     * @return void
+     */
+
+    function show()
+    {
+        // action => array('prompt', 'title')
+        $menu =
+          array('login' =>
+                array(_('Login'),
+                      _('Login with a username and password')),
+                'register' =>
+                array(_('Register'),
+                      _('Sign up for a new account')),
+                'openid' =>
+                array(_('OpenID'),
+                      _('Login or register with OpenID')));
+
+        $action_name = $this->action->trimmed('action');
+        $this->action->elementStart('ul', array('class' => 'nav'));
+
+        foreach ($menu as $menuaction => $menudesc) {
+            $this->action->menuItem(common_local_url($menuaction),
+                                    $menudesc[0],
+                                    $menudesc[1],
+                                    $action_name === $menuaction);
+        }
+
+        $this->action->elementEnd('ul');
+    }
+}
diff --git a/lib/messageform.php b/lib/messageform.php
new file mode 100644 (file)
index 0000000..eca39cc
--- /dev/null
@@ -0,0 +1,152 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Form for posting a direct message
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Form
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/form.php';
+
+/**
+ * Form for posting a direct message
+ *
+ * @category Form
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Sarven Capadisli <csarven@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      HTMLOutputter
+ */
+
+class MessageForm extends Form
+{
+    /**
+     * User to send a direct message to
+     */
+
+    var $to = null;
+
+    /**
+     * Pre-filled content of the form
+     */
+
+    var $content = null;
+
+    /**
+     * Constructor
+     *
+     * @param HTMLOutputter $out     output channel
+     * @param User          $to      user to send a message to
+     * @param string        $content content to pre-fill
+     */
+
+    function __construct($out=null, $to=null, $content=null)
+    {
+        parent::__construct($out);
+
+        $this->to      = $to;
+        $this->content = $content;
+    }
+
+    /**
+     * ID of the form
+     *
+     * @return int ID of the form
+     */
+
+    function id()
+    {
+        return 'message_form';
+    }
+
+    /**
+     * Action of the form
+     *
+     * @return string URL of the action
+     */
+
+    function action()
+    {
+        return common_local_url('newmessage');
+    }
+
+    /**
+     * Data elements
+     *
+     * @return void
+     */
+
+    function formData()
+    {
+        $user = common_current_user();
+
+        $mutual_users = $user->mutuallySubscribedUsers();
+
+        $mutual = array();
+
+        while ($mutual_users->fetch()) {
+            if ($mutual_users->id != $user->id) {
+                $mutual[$mutual_users->id] = $mutual_users->nickname;
+            }
+        }
+
+        $mutual_users->free();
+        unset($mutual_users);
+
+        $this->out->dropdown('to', _('To'), $mutual, null, false,
+                             $this->to->id);
+
+        $this->out->elementStart('p');
+
+        $this->out->element('textarea', array('id' => 'message_content',
+                                              'cols' => 60,
+                                              'rows' => 3,
+                                              'name' => 'content'),
+                            ($this->content) ? $this->content : '');
+
+        $this->out->elementEnd('p');
+    }
+
+    /**
+     * Action elements
+     *
+     * @return void
+     */
+
+    function formActions()
+    {
+        $this->out->element('input', array('id' => 'message_send',
+                                           'name' => 'message_send',
+                                           'type' => 'submit',
+                                           'value' => _('Send')));
+    }
+}
\ No newline at end of file
diff --git a/lib/microid.php b/lib/microid.php
new file mode 100644 (file)
index 0000000..806b7ee
--- /dev/null
@@ -0,0 +1,97 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Microid class
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  ID
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+/**
+ * A class for microids
+ *
+ * @category ID
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ * @see      http://microid.org/
+ */
+
+class Microid
+{
+    /** Agent part of the ID. */
+
+    var $agent = null;
+
+    /** Resource part of the ID. */
+
+    var $resource = null;
+
+    /**
+     * Constructor
+     *
+     * @param string $agent    Agent of the ID
+     * @param string $resource Resource part
+     */
+
+    function __construct($agent, $resource)
+    {
+        $this->agent    = $agent;
+        $this->resource = $resource;
+
+    }
+
+    /**
+     * Generate a MicroID string
+     *
+     * @return string MicroID for agent and resource
+     */
+
+    function toString()
+    {
+        $agent_proto    = $this->_getProto($this->agent);
+        $resource_proto = $this->_getProto($this->resource);
+
+        return $agent_proto.'+'.$resource_proto.':sha1:'.
+          sha1(sha1($this->agent).sha1($this->resource));
+    }
+
+    /**
+     * Utility for getting the protocol part of a URI
+     *
+     * @param string $uri URI to parse
+     *
+     * @return string scheme part of the URI
+     */
+
+    function _getProto($uri)
+    {
+        $colon = strpos($uri, ':');
+        return substr($uri, 0, $colon);
+    }
+}
diff --git a/lib/noticeform.php b/lib/noticeform.php
new file mode 100644 (file)
index 0000000..f0205f1
--- /dev/null
@@ -0,0 +1,169 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Form for posting a notice
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Form
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/form.php';
+
+/**
+ * Form for posting a notice
+ *
+ * Frequently-used form for posting a notice
+ *
+ * @category Form
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Sarven Capadisli <csarven@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      HTMLOutputter
+ */
+
+class NoticeForm extends Form
+{
+    /**
+     * Current action, used for returning to this page.
+     */
+
+    var $action = null;
+
+    /**
+     * Pre-filled content of the form
+     */
+
+    var $content = null;
+
+    /**
+     * Constructor
+     *
+     * @param HTMLOutputter $out     output channel
+     * @param string        $action  action to return to, if any
+     * @param string        $content content to pre-fill
+     */
+
+    function __construct($out=null, $action=null, $content=null)
+    {
+        parent::__construct($out);
+
+        $this->action  = $action;
+        $this->content = $content;
+    }
+
+    /**
+     * ID of the form
+     *
+     * @return int ID of the form
+     */
+
+    function id()
+    {
+        return 'form_notice';
+    }
+
+    /**
+     * Action of the form
+     *
+     * @return string URL of the action
+     */
+
+    function action()
+    {
+        return common_local_url('newnotice');
+    }
+
+
+    /**
+     * Legend of the Form
+     *
+     * @return void
+     */
+    function formLegend()
+    {
+        $this->out->element('legend', null, _('Send a notice'));
+    }
+
+
+    /**
+     * Data elements
+     *
+     * @return void
+     */
+
+    function formData()
+    {
+        $user = common_current_user();
+
+        $this->out->elementStart('ul', 'form_data');
+        $this->out->elementStart('li', array('id' => 'notice_text'));
+        $this->out->element('label', array('for' => 'notice_data-text'),
+                            sprintf(_('What\'s up, %s?'), $user->nickname));
+        // XXX: vary by defined max size
+        $this->out->element('textarea', array('id' => 'notice_data-text',
+                                              'cols' => 35,
+                                              'rows' => 4,
+                                              'name' => 'status_textarea'),
+                            ($this->content) ? $this->content : '');
+        $this->out->elementEnd('li');
+        $this->out->elementEnd('ul');
+
+        $this->out->elementStart('dl', 'form_note');
+        $this->out->element('dt', null, _('Available characters'));
+        $this->out->element('dd', array('id' => 'notice_text-count'),
+                            '140');
+        $this->out->elementEnd('dl');
+
+        if ($this->action) {
+            $this->out->hidden('notice_return-to', $this->action, 'returnto');
+        }
+        $this->out->hidden('notice_in-reply-to', $this->action, 'inreplyto');
+    }
+
+    /**
+     * Action elements
+     *
+     * @return void
+     */
+
+    function formActions()
+    {
+        $this->out->elementStart('ul', 'form_actions');
+        $this->out->elementStart('li', array('id' => 'notice_submit'));
+        $this->out->element('input', array('id' => 'notice_action-submit',
+                                           'class' => 'submit',
+                                           'name' => 'status_submit',
+                                           'type' => 'submit',
+                                           'value' => _('Send')));
+        $this->out->elementEnd('li');
+        $this->out->elementEnd('ul');
+    }
+}
index 71db067d08e0e7cf842180f23aa7f885b5ca92d2..9c433f81a0a4f218f627452ffb2fc14e5e80c9b5 100644 (file)
@@ -31,6 +31,9 @@ if (!defined('LACONICA')) {
     exit(1);
 }
 
+require_once INSTALLDIR.'/lib/favorform.php';
+require_once INSTALLDIR.'/lib/disfavorform.php';
+
 /**
  * widget for displaying a list of notices
  *
@@ -50,7 +53,7 @@ if (!defined('LACONICA')) {
  * @see      ProfileNoticeList
  */
 
-class NoticeList
+class NoticeList extends Widget
 {
     /** the current stream of notices being displayed. */
 
@@ -62,8 +65,9 @@ class NoticeList
      * @param Notice $notice stream of notices from DB_DataObject
      */
 
-    function __construct($notice)
+    function __construct($notice, $out=null)
     {
+       parent::__construct($out);
         $this->notice = $notice;
     }
 
@@ -78,7 +82,9 @@ class NoticeList
 
     function show()
     {
-        common_element_start('ul', array('id' => 'notices'));
+        $this->out->elementStart('div', array('id' =>'notices_primary'));
+        $this->out->element('h2', null, _('Notices'));
+        $this->out->elementStart('ul', array('class' => 'notices'));
 
         $cnt = 0;
 
@@ -93,7 +99,8 @@ class NoticeList
             $item->show();
         }
 
-        common_element_end('ul');
+        $this->out->elementEnd('ul');
+        $this->out->elementEnd('div');
 
         return $cnt;
     }
@@ -111,7 +118,7 @@ class NoticeList
 
     function newListItem($notice)
     {
-        return new NoticeListItem($notice);
+        return new NoticeListItem($notice, $this->out);
     }
 }
 
@@ -133,7 +140,7 @@ class NoticeList
  * @see      ProfileNoticeListItem
  */
 
-class NoticeListItem
+class NoticeListItem extends Widget
 {
     /** The notice this item will show. */
 
@@ -151,8 +158,9 @@ class NoticeListItem
      * @param Notice $notice The notice we'll display
      */
 
-    function __construct($notice)
+    function __construct($notice, $out=null)
     {
+       parent::__construct($out);
         $this->notice  = $notice;
         $this->profile = $notice->getProfile();
     }
@@ -169,19 +177,39 @@ class NoticeListItem
     function show()
     {
         $this->showStart();
-        $this->showFaveForm();
+        $this->showNotice();
+        $this->showNoticeInfo();
+        $this->showNoticeOptions();
+        $this->showEnd();
+    }
+
+    function showNotice()
+    {
+        $this->out->elementStart('div', 'entry-title');
         $this->showAuthor();
         $this->showContent();
-        $this->startTimeSection();
+        $this->out->elementEnd('div');
+    }
+
+    function showNoticeInfo()
+    {
+        $this->out->elementStart('div', 'entry-content');
         $this->showNoticeLink();
         $this->showNoticeSource();
         $this->showReplyTo();
+        $this->out->elementEnd('div');
+    }
+
+    function showNoticeOptions()
+    {
+        $this->out->elementStart('div', 'notice-options');
+        $this->showFaveForm();
         $this->showReplyLink();
         $this->showDeleteLink();
-        $this->endTimeSection();
-        $this->showEnd();
+        $this->out->elementEnd('div');
     }
 
+
     /**
      * start a single notice.
      *
@@ -191,7 +219,8 @@ class NoticeListItem
     function showStart()
     {
         // XXX: RDFa
-        common_element_start('li', array('class' => 'notice_single hentry',
+        // TODO: add notice_type class e.g., notice_video, notice_image
+        $this->out->elementStart('li', array('class' => 'hentry notice',
                                          'id' => 'notice-' . $this->notice->id));
     }
 
@@ -206,9 +235,11 @@ class NoticeListItem
         $user = common_current_user();
         if ($user) {
             if ($user->hasFave($this->notice)) {
-                common_disfavor_form($this->notice);
+               $disfavor = new DisfavorForm($this->out, $this->notice);
+               $disfavor->show();
             } else {
-                common_favor_form($this->notice);
+               $favor = new FavorForm($this->out, $this->notice);
+               $favor->show();
             }
         }
     }
@@ -223,10 +254,13 @@ class NoticeListItem
 
     function showAuthor()
     {
-        common_element_start('span', 'vcard author');
+        $this->out->elementStart('span', 'vcard author');
+        $this->out->elementStart('a', array('href' => $this->profile->profileurl,
+                                        'class' => 'url'));
         $this->showAvatar();
         $this->showNickname();
-        common_element_end('span');
+        $this->out->elementEnd('a');
+        $this->out->elementEnd('span');
     }
 
     /**
@@ -241,18 +275,17 @@ class NoticeListItem
     function showAvatar()
     {
         $avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
-        common_element_start('a', array('href' => $this->profile->profileurl));
-        common_element('img', array('src' => ($avatar) ?
+
+        $this->out->element('img', array('src' => ($avatar) ?
                                     common_avatar_display_url($avatar) :
                                     common_default_avatar(AVATAR_STREAM_SIZE),
-                                    'class' => 'avatar stream photo',
+                                    'class' => 'avatar photo',
                                     'width' => AVATAR_STREAM_SIZE,
                                     'height' => AVATAR_STREAM_SIZE,
                                     'alt' =>
                                     ($this->profile->fullname) ?
                                     $this->profile->fullname :
                                     $this->profile->nickname));
-        common_element_end('a');
     }
 
     /**
@@ -265,8 +298,7 @@ class NoticeListItem
 
     function showNickname()
     {
-        common_element('a', array('href' => $this->profile->profileurl,
-                                  'class' => 'nickname fn url'),
+        $this->out->element('span', array('class' => 'nickname fn'),
                        $this->profile->nickname);
     }
 
@@ -283,31 +315,16 @@ class NoticeListItem
     function showContent()
     {
         // FIXME: URL, image, video, audio
-        common_element_start('p', array('class' => 'content entry-title'));
+        $this->out->elementStart('p', array('class' => 'entry-content'));
         if ($this->notice->rendered) {
-            common_raw($this->notice->rendered);
+            $this->out->raw($this->notice->rendered);
         } else {
             // XXX: may be some uncooked notices in the DB,
             // we cook them right now. This should probably disappear in future
             // versions (>> 0.4.x)
-            common_raw(common_render_content($this->notice->content, $this->notice));
+            $this->out->raw(common_render_content($this->notice->content, $this->notice));
         }
-        common_element_end('p');
-    }
-
-    /**
-     * show the "time" section of a notice
-     *
-     * This is the greyed-out section that appears beneath the content, including
-     * links to delete or reply to the notice. Probably should be called something
-     * else.
-     *
-     * @return void
-     */
-
-    function startTimeSection()
-    {
-        common_element_start('p', 'time');
+        $this->out->elementEnd('p');
     }
 
     /**
@@ -328,14 +345,18 @@ class NoticeListItem
             preg_match('/^http/', $this->notice->uri)) {
             $noticeurl = $this->notice->uri;
         }
-        common_element_start('a', array('class' => 'permalink',
-                                        'rel' => 'bookmark',
+        $this->out->elementStart('dl', 'timestamp');
+        $this->out->element('dt', null, _('Published')); 
+        $this->out->elementStart('dd', null);
+        $this->out->elementStart('a', array('rel' => 'bookmark',
                                         'href' => $noticeurl));
         $dt = common_date_iso8601($this->notice->created);
-        common_element('abbr', array('class' => 'published',
+        $this->out->element('abbr', array('class' => 'published',
                                      'title' => $dt),
                        common_date_string($this->notice->created));
-        common_element_end('a');
+        $this->out->elementEnd('a');
+        $this->out->elementEnd('dd');
+        $this->out->elementEnd('dl');
     }
 
     /**
@@ -350,7 +371,8 @@ class NoticeListItem
     function showNoticeSource()
     {
         if ($this->notice->source) {
-            common_element('span', null, _(' from '));
+            $this->out->elementStart('dl', 'device');
+            $this->out->element('dt', null, _('From'));
             $source_name = _($this->notice->source);
             switch ($this->notice->source) {
             case 'web':
@@ -358,18 +380,22 @@ class NoticeListItem
             case 'mail':
             case 'omb':
             case 'api':
-                common_element('span', 'noticesource', $source_name);
+                $this->out->element('dd', 'noticesource', $source_name);
                 break;
             default:
                 $ns = Notice_source::staticGet($this->notice->source);
                 if ($ns) {
-                    common_element('a', array('href' => $ns->url),
+                    $this->out->elementStart('dd', null);
+                    $this->out->element('a', array('href' => $ns->url,
+                                              'rel' => 'external'),
                                    $ns->name);
+                    $this->out->elementEnd('dd');
                 } else {
-                    common_element('span', 'noticesource', $source_name);
+                    $this->out->element('dd', 'noticesource', $source_name);
                 }
                 break;
             }
+            $this->out->elementEnd('dl');
         }
     }
 
@@ -387,11 +413,14 @@ class NoticeListItem
         if ($this->notice->reply_to) {
             $replyurl = common_local_url('shownotice',
                                          array('notice' => $this->notice->reply_to));
-            common_text(' (');
-            common_element('a', array('class' => 'inreplyto',
-                                      'href' => $replyurl),
-                           _('in reply to...'));
-            common_text(')');
+            $this->out->elementStart('dl', 'response');
+            $this->out->element('dt', null, _('To'));
+            $this->out->elementStart('dd');
+            $this->out->element('a', array('href' => $replyurl,
+                                      'rel' => 'in-reply-to'),
+                           _('in reply to'));
+            $this->out->elementEnd('dd');
+            $this->out->elementEnd('dl');
         }
     }
 
@@ -409,16 +438,13 @@ class NoticeListItem
         $reply_url = common_local_url('newnotice',
                                       array('replyto' => $this->profile->nickname));
 
-        $reply_js =
-          'return doreply("'.$this->profile->nickname.'",'.$this->notice->id.');';
-
-        common_element_start('a',
-                             array('href' => $reply_url,
-                                   'onclick' => $reply_js,
-                                   'title' => _('reply'),
-                                   'class' => 'replybutton'));
-        common_raw(' &#8594;');
-        common_element_end('a');
+        $this->out->elementStart('dl', 'notice_reply');
+        $this->out->element('dt', null, _('Reply to this notice'));
+        $this->out->elementStart('dd');
+        $this->out->element('a', array('href' => $reply_url,
+                                       'title' => _('Reply to this notice')), _('Reply'));
+        $this->out->elementEnd('dd');
+        $this->out->elementEnd('dl');
     }
 
     /**
@@ -433,25 +459,16 @@ class NoticeListItem
         if ($user && $this->notice->profile_id == $user->id) {
             $deleteurl = common_local_url('deletenotice',
                                           array('notice' => $this->notice->id));
-            common_element_start('a', array('class' => 'deletenotice',
-                                            'href' => $deleteurl,
-                                            'title' => _('delete')));
-            common_raw(' &#215;');
-            common_element_end('a');
+            $this->out->elementStart('dl', 'notice_delete');
+            $this->out->element('dt', null, _('Delete this notice'));
+            $this->out->elementStart('dd');
+            $this->out->element('a', array('href' => $deleteurl,
+                                           'title' => _('Delete this notice')), _('Delete'));
+            $this->out->elementEnd('dd');
+            $this->out->elementEnd('dl');
         }
     }
 
-    /**
-     * end the time section
-     *
-     * @return void
-     */
-
-    function endTimeSection()
-    {
-        common_element_end('p');
-    }
-
     /**
      * finish the notice
      *
@@ -462,6 +479,6 @@ class NoticeListItem
 
     function showEnd()
     {
-        common_element_end('li');
+        $this->out->elementEnd('li');
     }
 }
diff --git a/lib/nudgeform.php b/lib/nudgeform.php
new file mode 100644 (file)
index 0000000..7d04e11
--- /dev/null
@@ -0,0 +1,105 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Form for nudging a user
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Form
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/form.php';
+
+/**
+ * Form for nudging a user
+ *
+ * @category Form
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Sarven Capadisli <csarven@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      DisfavorForm
+ */
+
+class NudgeForm extends Form
+{
+    /**
+     * Profile of user to nudge
+     */
+
+    var $profile = null;
+
+    /**
+     * Constructor
+     *
+     * @param HTMLOutputter $out     output channel
+     * @param Profile       $profile profile of user to nudge
+     */
+
+    function __construct($out=null, $profile=null)
+    {
+        parent::__construct($out);
+
+        $this->profile = $profile;
+    }
+
+    /**
+     * ID of the form
+     *
+     * @return int ID of the form
+     */
+
+    function id()
+    {
+        return 'nudge';
+    }
+
+    /**
+     * Action of the form
+     *
+     * @return string URL of the action
+     */
+
+    function action()
+    {
+        return common_local_url('nudge',
+                                array('nickname' => $this->profile->nickname));
+    }
+
+    /**
+     * Action elements
+     *
+     * @return void
+     */
+
+    function formActions()
+    {
+        $this->out->submit('submit', _('Send a nudge'));
+    }
+}
\ No newline at end of file
index 02b01fece448213c199834457d801297d79acef2..46f9ff6be7a15c7b1eba1afdc67053b26addb4de 100644 (file)
@@ -21,193 +21,10 @@ if (!defined('LACONICA')) { exit(1); }
 
 class PersonalAction extends Action
 {
-    
-    function is_readonly()
-    {
-        return true;
-    }
-    
     function handle($args)
     {
         parent::handle($args);
         common_set_returnto($this->self_url());
     }
 
-    function views_menu()
-    {
-
-        $user = null;
-        $action = $this->trimmed('action');
-        $nickname = $this->trimmed('nickname');
-
-        if ($nickname) {
-            $user = User::staticGet('nickname', $nickname);
-            $user_profile = $user->getProfile();
-        } else {
-            $user_profile = false;
-        }
-
-        common_element_start('ul', array('id' => 'nav_views'));
-
-        common_menu_item(common_local_url('all', array('nickname' =>
-                                                       $nickname)),
-                         _('Personal'),
-                         sprintf(_('%s and friends'), (($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
-                         $action == 'all');
-        common_menu_item(common_local_url('replies', array('nickname' =>
-                                                              $nickname)),
-                         _('Replies'),
-                         sprintf(_('Replies to %s'), (($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
-                         $action == 'replies');
-        common_menu_item(common_local_url('showstream', array('nickname' =>
-                                                              $nickname)),
-                         _('Profile'),
-                         ($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname,
-                         $action == 'showstream');
-        common_menu_item(common_local_url('showfavorites', array('nickname' =>
-                                                              $nickname)),
-                         _('Favorites'),
-                         sprintf(_('%s\'s favorite notices'), ($user_profile) ? $user_profile->getBestName() : _('User')),
-                         $action == 'showfavorites');
-        
-        $cur = common_current_user();
-        
-        if ($cur && $cur->id == $user->id) {
-            
-            common_menu_item(common_local_url('inbox', array('nickname' =>
-                                                                     $nickname)),
-                             _('Inbox'),
-                             _('Your incoming messages'),
-                             $action == 'inbox');
-            common_menu_item(common_local_url('outbox', array('nickname' =>
-                                                                     $nickname)),
-                             _('Outbox'),
-                             _('Your sent messages'),
-                             $action == 'outbox');
-        }
-        
-        common_element_end('ul');
-    }
-
-    function show_feeds_list($feeds)
-    {
-        common_element_start('div', array('class' => 'feeds'));
-        common_element('p', null, 'Feeds:');
-        common_element_start('ul', array('class' => 'xoxo'));
-
-        foreach ($feeds as $key => $value) {
-            $this->common_feed_item($feeds[$key]);
-        }
-        common_element_end('ul');
-        common_element_end('div');
-    }
-
-    function common_feed_item($feed)
-    {
-        $nickname = $this->trimmed('nickname');
-
-        switch($feed['item']) {
-            case 'notices': default:
-                $feed_classname = $feed['type'];
-                $feed_mimetype = "application/".$feed['type']."+xml";
-                $feed_title = "$nickname's ".$feed['version']." notice feed";
-                $feed['textContent'] = "RSS";
-                break;
-
-            case 'allrss':
-                $feed_classname = $feed['type'];
-                $feed_mimetype = "application/".$feed['type']."+xml";
-                $feed_title = $feed['version']." feed for $nickname and friends";
-                $feed['textContent'] = "RSS";
-                break;
-
-            case 'repliesrss':
-                $feed_classname = $feed['type'];
-                $feed_mimetype = "application/".$feed['type']."+xml";
-                $feed_title = $feed['version']." feed for replies to $nickname";
-                $feed['textContent'] = "RSS";
-                break;
-
-            case 'publicrss':
-                $feed_classname = $feed['type'];
-                $feed_mimetype = "application/".$feed['type']."+xml";
-                $feed_title = "Public timeline ".$feed['version']." feed";
-                $feed['textContent'] = "RSS";
-                break;
-
-            case 'publicatom':
-                $feed_classname = "atom";
-                $feed_mimetype = "application/".$feed['type']."+xml";
-                $feed_title = "Public timeline ".$feed['version']." feed";
-                $feed['textContent'] = "Atom";
-                break;
-
-            case 'tagrss':
-                $feed_classname = $feed['type'];
-                $feed_mimetype = "application/".$feed['type']."+xml";
-                $feed_title = $feed['version']." feed for this tag";
-                $feed['textContent'] = "RSS";
-                break;
-
-            case 'favoritedrss':
-                $feed_classname = $feed['type'];
-                $feed_mimetype = "application/".$feed['type']."+xml";
-                $feed_title = "Favorited ".$feed['version']." feed";
-                $feed['textContent'] = "RSS";
-                break;
-
-            case 'foaf':
-                $feed_classname = "foaf";
-                $feed_mimetype = "application/".$feed['type']."+xml";
-                $feed_title = "$nickname's FOAF file";
-                $feed['textContent'] = "FOAF";
-                break;
-
-            case 'favoritesrss':
-                $feed_classname = "favorites";
-                $feed_mimetype = "application/".$feed['type']."+xml";
-                $feed_title = "Feed for favorites of $nickname";
-                $feed['textContent'] = "RSS";
-                break;
-
-            case 'usertimeline':
-                $feed_classname = "atom";
-                $feed_mimetype = "application/".$feed['type']."+xml";
-                $feed_title = "$nickname's ".$feed['version']." notice feed";
-                $feed['textContent'] = "Atom";
-                break;
-        }
-        common_element_start('li');
-        common_element('a', array('href' => $feed['href'],
-                                  'class' => $feed_classname,
-                                  'type' => $feed_mimetype,
-                                  'title' => $feed_title),
-                            $feed['textContent']);
-        common_element_end('li');
-    }
-
-    
-    function source_link($source)
-    {
-        $source_name = _($source);
-        switch ($source) {
-         case 'web':
-         case 'xmpp':
-         case 'mail':
-         case 'omb':
-         case 'api':
-            common_element('span', 'noticesource', $source_name);
-            break;
-         default:
-            $ns = Notice_source::staticGet($source);
-            if ($ns) {
-                common_element('a', array('href' => $ns->url),
-                               $ns->name);
-            } else {
-                common_element('span', 'noticesource', $source_name);
-            }
-            break;
-        }
-        return;
-    }
 }
diff --git a/lib/personalgroupnav.php b/lib/personalgroupnav.php
new file mode 100644 (file)
index 0000000..63e6138
--- /dev/null
@@ -0,0 +1,135 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Base class for all actions (~views)
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Action
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2008 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/widget.php';
+
+/**
+ * Base class for all actions
+ *
+ * This is the base class for all actions in the package. An action is
+ * more or less a "view" in an MVC framework.
+ *
+ * Actions are responsible for extracting and validating parameters; using
+ * model classes to read and write to the database; and doing ouput.
+ *
+ * @category Output
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Sarven Capadisli <csarven@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      HTMLOutputter
+ */
+
+class PersonalGroupNav extends Widget
+{
+    var $action = null;
+
+    /**
+     * Construction
+     *
+     * @param Action $action current action, used for output
+     */
+
+    function __construct($action=null)
+    {
+        parent::__construct($action);
+        $this->action = $action;
+    }
+
+    /**
+     * Show the menu
+     *
+     * @return void
+     */
+
+    function show()
+    {
+        $user = null;
+       
+       // FIXME: we should probably pass this in
+       
+        $action = $this->action->trimmed('action');
+        $nickname = $this->action->trimmed('nickname');
+
+        if ($nickname) {
+            $user = User::staticGet('nickname', $nickname);
+            $user_profile = $user->getProfile();
+        } else {
+            $user_profile = false;
+        }
+
+        $this->out->elementStart('ul', array('class' => 'nav'));
+
+        $this->out->menuItem(common_local_url('all', array('nickname' =>
+                                                       $nickname)),
+                         _('Personal'),
+                         sprintf(_('%s and friends'), (($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
+                         $action == 'all', 'nav_timeline_personal');
+        $this->out->menuItem(common_local_url('replies', array('nickname' =>
+                                                              $nickname)),
+                         _('Replies'),
+                         sprintf(_('Replies to %s'), (($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
+                         $action == 'replies', 'nav_timeline_replies');
+        $this->out->menuItem(common_local_url('showstream', array('nickname' =>
+                                                              $nickname)),
+                         _('Profile'),
+                         ($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname,
+                         $action == 'showstream', 'nav_profile');
+        $this->out->menuItem(common_local_url('showfavorites', array('nickname' =>
+                                                              $nickname)),
+                         _('Favorites'),
+                         sprintf(_('%s\'s favorite notices'), ($user_profile) ? $user_profile->getBestName() : _('User')),
+                         $action == 'showfavorites', 'nav_timeline_favorites');
+
+        $cur = common_current_user();
+
+        if ($cur && $cur->id == $user->id) {
+
+            $this->out->menuItem(common_local_url('inbox', array('nickname' =>
+                                                                     $nickname)),
+                             _('Inbox'),
+                             _('Your incoming messages'),
+                             $action == 'inbox');
+            $this->out->menuItem(common_local_url('outbox', array('nickname' =>
+                                                                     $nickname)),
+                             _('Outbox'),
+                             _('Your sent messages'),
+                             $action == 'outbox');
+        }
+
+        $this->out->elementEnd('ul');
+    }
+}
diff --git a/lib/publicgroupnav.php b/lib/publicgroupnav.php
new file mode 100644 (file)
index 0000000..97b57ec
--- /dev/null
@@ -0,0 +1,92 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Menu for public group of actions
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Menu
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/widget.php';
+
+/**
+ * Menu for public group of actions
+ *
+ * @category Output
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      Widget
+ */
+
+class PublicGroupNav extends Widget
+{
+    var $action = null;
+
+    /**
+     * Construction
+     *
+     * @param Action $action current action, used for output
+     */
+
+    function __construct($action=null)
+    {
+        parent::__construct($action);
+        $this->action = $action;
+    }
+
+    /**
+     * Show the menu
+     *
+     * @return void
+     */
+
+    function show()
+    {
+        $action_name = $this->action->trimmed('action');
+
+        $this->action->elementStart('ul', array('class' => 'nav'));
+
+        $this->out->menuItem(common_local_url('public'), _('Public'),
+            _('Public timeline'), $action_name == 'public', 'nav_timeline_public');
+
+        $this->out->menuItem(common_local_url('tag'), _('Recent tags'),
+            _('Recent tags'), $action_name == 'tag', 'nav_recent-tags');
+
+        if (count(common_config('nickname', 'featured')) > 0) {
+            $this->out->menuItem(common_local_url('featured'), _('Featured'),
+                _('Featured users'), $action_name == 'featured', 'nav_featured');
+        }
+
+        $this->out->menuItem(common_local_url('favorited'), _('Popular'),
+            _("Popular notices"), $action_name == 'favorited', 'nav_timeline_favorited');
+
+        $this->action->elementEnd('ul');
+    }
+}
index 9564cfb4605ad198eacaa048f58c3fb98782e11a..2c532912b4d31da718f59f5e8647a05452053a9b 100644 (file)
@@ -1,9 +1,12 @@
 <?php
-/*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+/**
+ * Laconica, the distributed open-source microblogging tool
  *
- * This program is free software: you can redistribute it and/or modify
+ * Base class for RSS 1.0 feed actions
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Mail
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Earle Martin <earle@downlode.org>
+ * @copyright 2008-9 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
  */
 
 if (!defined('LACONICA')) { exit(1); }
@@ -23,35 +34,84 @@ define('DEFAULT_RSS_LIMIT', 48);
 
 class Rss10Action extends Action
 {
-
     # This will contain the details of each feed item's author and be used to generate SIOC data.
+    
     var $creators = array();
+    var $limit = DEFAULT_RSS_LIMIT;
+    
+    /**
+     * Constructor
+     *
+     * Just wraps the Action constructor.
+     *
+     * @param string  $output URI to output to, default = stdout
+     * @param boolean $indent Whether to indent output, default true
+     *
+     * @see Action::__construct
+     */
 
-    function is_readonly()
+    function __construct($output='php://output', $indent=true)
+    {
+        parent::__construct($output, $indent);
+    }
+
+    /**
+     * Do we need to write to the database?
+     * 
+     * @return boolean true
+     */
+    
+    function isReadonly()
     {
         return true;
     }
 
+    /**
+     * Read arguments and initialize members
+     * 
+     * @param array $args Arguments from $_REQUEST
+     * @return boolean success
+     */
+    
+    function prepare($args)
+    {
+       $this->limit = (int) $this->trimmed('limit');
+       if ($this->limit == 0) {
+           $this->limit = DEFAULT_RSS_LIMIT;
+       }
+       return true;
+    }
+       
+    /**
+     * Handle a request
+     * 
+     * @param array $args Arguments from $_REQUEST
+     * 
+     * @return void
+     */
+    
     function handle($args)
     {
         parent::handle($args);
-        $limit = (int) $this->trimmed('limit');
-        if ($limit == 0) {
-            $limit = DEFAULT_RSS_LIMIT;
-        }
         $this->show_rss($limit);
     }
 
-    function init()
-    {
-        return true;
-    }
-
-    function get_notices()
+    /**
+     * Get the notices to output in this stream
+     * 
+     * @return array an array of Notice objects sorted in reverse chron
+     */
+    
+    function getNotices()
     {
         return array();
     }
 
+    /**
+     * Get a description of the channel
+     * 
+     * Returns an array with the following 
+     * @return array 
     function get_channel()
     {
         return array('url' => '',
@@ -67,11 +127,6 @@ class Rss10Action extends Action
 
     function show_rss($limit=0)
     {
-
-        if (!$this->init()) {
-            return;
-        }
-
         $notices = $this->get_notices($limit);
 
         $this->init_rss();
index 03bac3a93b0173f9ffcf1a6dc5fbc78162bd809a..dfe1f114b21e1b73dc10b36692a1b144e4db27e8 100644 (file)
@@ -1,9 +1,12 @@
 <?php
-/*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+/**
+ * Laconica, the distributed open-source microblogging tool
  *
- * This program is free software: you can redistribute it and/or modify
+ * Base class for settings actions
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Settings
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008-2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+/**
+ * Base class for settings group of actions
+ *
+ * @category Settings
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      Widget
+ */
 
 class SettingsAction extends Action
 {
+    /**
+     * A message for the user.
+     */
+
+    var $msg = null;
+
+    /**
+     * Whether the message is a good one or a bad one.
+     */
+
+    var $success = false;
+
+    /**
+     * Handle input and output a page
+     *
+     * @param array $args $_REQUEST arguments
+     *
+     * @return void
+     */
 
     function handle($args)
     {
         parent::handle($args);
         if (!common_logged_in()) {
-            common_user_error(_('Not logged in.'));
+            $this->clientError(_('Not logged in.'));
             return;
         } else if (!common_is_real_login()) {
-            # Cookie theft means that automatic logins can't
-            # change important settings or see private info, and
-            # _all_ our settings are important
-            common_set_returnto($this->self_url());
+            // Cookie theft means that automatic logins can't
+            // change important settings or see private info, and
+            // _all_ our settings are important
+            common_set_returnto($this->selfUrl());
             common_redirect(common_local_url('login'));
         } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-            $this->handle_post();
+            $this->handlePost();
         } else {
-            $this->show_form();
+            $this->showForm();
         }
     }
 
-    # override!
-    function handle_post()
-    {
-        return false;
-    }
+    /**
+     * Handle a POST request
+     *
+     * @return boolean success flag
+     */
 
-    function show_form($msg=null, $success=false)
+    function handlePost()
     {
         return false;
     }
 
-    function message($msg, $success)
-    {
-        if ($msg) {
-            common_element('div', ($success) ? 'success' : 'error',
-                           $msg);
-        }
-    }
+    /**
+     * show the settings form
+     *
+     * @param string $msg     an extra message for the user
+     * @param string $success good message or bad message?
+     *
+     * @return void
+     */
 
-    function form_header($title, $msg=NULL, $success=false) 
+    function showForm($msg=null, $success=false)
     {
-        common_show_header($title,
-                           array($this, 'show_header'),
-                           array($msg, $success),
-                           array($this, 'show_top'));
-    }
+        $this->msg     = $msg;
+        $this->success = $success;
 
-    function show_header() 
-    {
-        common_element('link', array('rel' => 'stylesheet',
-                                     'type' => 'text/css',
-                                     'href' => common_path('js/jcrop/jquery.Jcrop.css?version='.LACONICA_VERSION),
-                                     'media' => 'screen, projection, tv'));
-        common_element('script', array('type' => 'text/javascript',
-                                       'src' => common_path('js/jcrop/jquery.Jcrop.pack.js')));
-        common_element('script', array('type' => 'text/javascript',
-                                       'src' => common_path('js/jcrop/jquery.Jcrop.go.js')));
+        $this->showPage();
     }
 
-    function show_top($arr)
+    /**
+     * show human-readable instructions for the page
+     *
+     * @return void
+     */
+
+    function showPageNotice()
     {
-        $msg = $arr[0];
-        $success = $arr[1];
-        if ($msg) {
-            $this->message($msg, $success);
+        if ($this->msg) {
+            $this->element('div', ($this->success) ? 'success' : 'error',
+                           $this->msg);
         } else {
-            $inst = $this->get_instructions();
+            $inst   = $this->getInstructions();
             $output = common_markup_to_html($inst);
-            common_element_start('div', 'instructions');
-            common_raw($output);
-            common_element_end('div');
+
+            $this->elementStart('div', 'instructions');
+            $this->raw($output);
+            $this->elementEnd('div');
         }
-        $this->settings_menu();
     }
 
-    function settings_menu()
+    /**
+     * instructions recipe for sub-classes
+     *
+     * Subclasses should override this to return readable instructions. They'll
+     * be processed by common_markup_to_html().
+     *
+     * @return string instructions text
+     */
+
+    function getInstructions()
     {
-        # action => array('prompt', 'title')
-        $menu =
-          array('profilesettings' =>
-                array(_('Profile'),
-                      _('Change your profile settings')),
-                'emailsettings' =>
-                array(_('Email'),
-                      _('Change email handling')),
-                'openidsettings' =>
-                array(_('OpenID'),
-                      _('Add or remove OpenIDs')),
-                'smssettings' =>
-                array(_('SMS'),
-                      _('Updates by SMS')),
-                'imsettings' =>
-                array(_('IM'),
-                      _('Updates by instant messenger (IM)')),
-                'twittersettings' =>
-                array(_('Twitter'),
-                      _('Twitter integration options')),
-                'othersettings' =>
-                array(_('Other'),
-                      _('Other options')));
-        
-        $action = $this->trimmed('action');
-        common_element_start('ul', array('id' => 'nav_views'));
-        foreach ($menu as $menuaction => $menudesc) {
-            if ($menuaction == 'imsettings' &&
-                !common_config('xmpp', 'enabled')) {
-                continue;
-            }
-            common_menu_item(common_local_url($menuaction),
-                    $menudesc[0],
-                    $menudesc[1],
-                    $action == $menuaction);
-        }
-        common_element_end('ul');
+        return '';
     }
+
 }
index 73758adee637a7b9e58b25f00b3ad189851aaed9..0cb9e0bf4f749002ca8e8003ee50ec7980f90168 100644 (file)
@@ -24,32 +24,6 @@ require_once(INSTALLDIR.'/lib/noticelist.php');
 
 class StreamAction extends PersonalAction
 {
-
-    function public_views_menu()
-    {
-
-        $action = $this->trimmed('action');
-
-        common_element_start('ul', array('id' => 'nav_views'));
-
-        common_menu_item(common_local_url('public'), _('Public'),
-            _('Public timeline'), $action == 'public');
-
-        common_menu_item(common_local_url('tag'), _('Recent tags'),
-            _('Recent tags'), $action == 'tag');
-
-        if (count(common_config('nickname', 'featured')) > 0) {
-            common_menu_item(common_local_url('featured'), _('Featured'),
-                _('Featured users'), $action == 'featured');
-        }
-
-        common_menu_item(common_local_url('favorited'), _('Popular'),
-            _("Popular notices"), $action == 'favorited');
-
-        common_element_end('ul');
-
-    }
-
     function show_notice_list($notice)
     {
         $nl = new NoticeList($notice);
diff --git a/lib/subscribeform.php b/lib/subscribeform.php
new file mode 100644 (file)
index 0000000..996729a
--- /dev/null
@@ -0,0 +1,117 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Form for subscribing to a user
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Form
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/form.php';
+
+/**
+ * Form for subscribing to a user
+ *
+ * @category Form
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Sarven Capadisli <csarven@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      UnsubscribeForm
+ */
+
+class SubscribeForm extends Form
+{
+    /**
+     * Profile of user to subscribe to
+     */
+
+    var $profile = null;
+
+    /**
+     * Constructor
+     *
+     * @param HTMLOutputter $out     output channel
+     * @param Profile       $profile profile of user to subscribe to
+     */
+
+    function __construct($out=null, $profile=null)
+    {
+        parent::__construct($out);
+
+        $this->profile = $profile;
+    }
+
+    /**
+     * ID of the form
+     *
+     * @return int ID of the form
+     */
+
+    function id()
+    {
+        return 'subscribe-' . $this->profile->id;
+    }
+
+    /**
+     * Action of the form
+     *
+     * @return string URL of the action
+     */
+
+    function action()
+    {
+        return common_local_url('subscribe');
+    }
+
+    /**
+     * Data elements of the form
+     *
+     * @return void
+     */
+
+    function formData()
+    {
+        $this->out->hidden('subscribeto-' . $this->profile->id,
+                           $this->profile->id,
+                           'subscribeto');
+    }
+
+    /**
+     * Action elements
+     *
+     * @return void
+     */
+
+    function formActions()
+    {
+        $this->out->submit('submit', _('Subscribe'));
+    }
+}
\ No newline at end of file
index 6f365bd9925c2db0d06dd0e987bf14c6214d7d35..95030affed66a424de6f529c4bcdcf92990f3cfd 100644 (file)
@@ -1,9 +1,12 @@
 <?php
-/*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+/**
+ * Laconica, the distributed open-source microblogging tool
  *
- * This program is free software: you can redistribute it and/or modify
+ * Utilities for theme files and paths
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Paths
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2008 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+/**
+ * Gets the full path of a file in a theme dir based on its relative name
+ *
+ * @param string $relative relative path within the theme directory
+ * @param string $theme    name of the theme; defaults to current theme
+ *
+ * @return string File path to the theme file
+ */
 
-function theme_file($relative)
+function theme_file($relative, $theme=null)
 {
-    $theme = common_config('site', 'theme');
+    if (!$theme) {
+        $theme = common_config('site', 'theme');
+    }
     return INSTALLDIR.'/theme/'.$theme.'/'.$relative;
 }
 
-function theme_path($relative)
+/**
+ * Gets the full URL of a file in a theme dir based on its relative name
+ *
+ * @param string $relative relative path within the theme directory
+ * @param string $theme    name of the theme; defaults to current theme
+ *
+ * @return string URL of the file
+ */
+
+function theme_path($relative, $theme=null)
 {
-    $theme = common_config('site', 'theme');
+    if (!$theme) {
+        $theme = common_config('site', 'theme');
+    }
     $server = common_config('theme', 'server');
     if ($server) {
         return 'http://'.$server.'/'.$theme.'/'.$relative;
diff --git a/lib/unblockform.php b/lib/unblockform.php
new file mode 100644 (file)
index 0000000..4cb9ae4
--- /dev/null
@@ -0,0 +1,130 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Form for unblocking a user
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Form
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/form.php';
+
+/**
+ * Form for unblocking a user
+ *
+ * @category Form
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Sarven Capadisli <csarven@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      BlockForm
+ */
+
+class UnblockForm extends Form
+{
+    /**
+     * Profile of user to unblock
+     */
+
+    var $profile = null;
+
+    /**
+     * Return-to args
+     */
+
+    var $args = null;
+
+    /**
+     * Constructor
+     *
+     * @param HTMLOutputter $out     output channel
+     * @param Profile       $profile profile of user to unblock
+     * @param array         $args    return-to args
+     */
+
+    function __construct($out=null, $profile=null, $args=null)
+    {
+        parent::__construct($out);
+
+        $this->profile = $profile;
+        $this->args    = $args;
+    }
+
+    /**
+     * ID of the form
+     *
+     * @return int ID of the form
+     */
+
+    function id()
+    {
+        return 'unblock-' . $this->profile->id;
+    }
+
+    /**
+     * Action of the form
+     *
+     * @return string URL of the action
+     */
+
+    function action()
+    {
+        return common_local_url('unblock');
+    }
+
+    /**
+     * Data elements of the form
+     *
+     * @return void
+     */
+
+    function formData()
+    {
+        $this->out->hidden('unblockto-' . $this->profile->id,
+                           $this->profile->id,
+                           'unblockto');
+        if ($this->args) {
+            foreach ($this->args as $k => $v) {
+                $this->out->hidden('returnto-' . $k, $v);
+            }
+        }
+    }
+
+    /**
+     * Action elements
+     *
+     * @return void
+     */
+
+    function formActions()
+    {
+        $this->out->submit('submit', _('Unblock'));
+    }
+}
\ No newline at end of file
diff --git a/lib/unsubscribeform.php b/lib/unsubscribeform.php
new file mode 100644 (file)
index 0000000..a724bb3
--- /dev/null
@@ -0,0 +1,117 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Form for unsubscribing from a user
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Form
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+require_once INSTALLDIR.'/lib/form.php';
+
+/**
+ * Form for unsubscribing from a user
+ *
+ * @category Form
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Sarven Capadisli <csarven@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      SubscribeForm
+ */
+
+class UnsubscribeForm extends Form
+{
+    /**
+     * Profile of user to unsubscribe from
+     */
+
+    var $profile = null;
+
+    /**
+     * Constructor
+     *
+     * @param HTMLOutputter $out     output channel
+     * @param Profile       $profile profile of user to unsub from
+     */
+
+    function __construct($out=null, $profile=null)
+    {
+        parent::__construct($out);
+
+        $this->profile = $profile;
+    }
+
+    /**
+     * ID of the form
+     *
+     * @return int ID of the form
+     */
+
+    function id()
+    {
+        return 'unsubscribe-' . $this->profile->id;
+    }
+
+    /**
+     * Action of the form
+     *
+     * @return string URL of the action
+     */
+
+    function action()
+    {
+        return common_local_url('unsubscribe');
+    }
+
+    /**
+     * Data elements of the form
+     *
+     * @return void
+     */
+
+    function formData()
+    {
+        $this->out->hidden('unsubscribeto-' . $this->profile->id,
+                           $this->profile->id,
+                           'unsubscribeto');
+    }
+
+    /**
+     * Action elements
+     *
+     * @return void
+     */
+
+    function formActions()
+    {
+        $this->out->submit('submit', _('Unsubscribe'));
+    }
+}
\ No newline at end of file
index fbe04c6c4aebb2b0b33781685138c08ffc858272..d67c649728aeaed91937ca49d75c85e419c211f1 100644 (file)
@@ -17,7 +17,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-/* XXX: break up into separate modules (HTTP, HTML, user, files) */
+/* XXX: break up into separate modules (HTTP, user, files) */
 
 // Show a server error
 
@@ -79,65 +79,6 @@ function common_user_error($msg, $code=400)
     common_show_footer();
 }
 
-$xw = null;
-
-// Start an HTML element
-function common_element_start($tag, $attrs=null)
-{
-    global $xw;
-    $xw->startElement($tag);
-    if (is_array($attrs)) {
-        foreach ($attrs as $name => $value) {
-            $xw->writeAttribute($name, $value);
-        }
-    } else if (is_string($attrs)) {
-        $xw->writeAttribute('class', $attrs);
-    }
-}
-
-function common_element_end($tag)
-{
-    static $empty_tag = array('base', 'meta', 'link', 'hr',
-                              'br', 'param', 'img', 'area',
-                              'input', 'col');
-    global $xw;
-    // XXX: check namespace
-    if (in_array($tag, $empty_tag)) {
-        $xw->endElement();
-    } else {
-        $xw->fullEndElement();
-    }
-}
-
-function common_element($tag, $attrs=null, $content=null)
-{
-    common_element_start($tag, $attrs);
-    global $xw;
-    if (!is_null($content)) {
-        $xw->text($content);
-    }
-    common_element_end($tag);
-}
-
-function common_start_xml($doc=null, $public=null, $system=null, $indent=true)
-{
-    global $xw;
-    $xw = new XMLWriter();
-    $xw->openURI('php://output');
-    $xw->setIndent($indent);
-    $xw->startDocument('1.0', 'UTF-8');
-    if ($doc) {
-        $xw->writeDTD($doc, $public, $system);
-    }
-}
-
-function common_end_xml()
-{
-    global $xw;
-    $xw->endDocument();
-    $xw->flush();
-}
-
 function common_init_locale($language=null)
 {
     if(!$language) {
@@ -167,346 +108,6 @@ function common_init_language()
     }
 }
 
-define('PAGE_TYPE_PREFS', 'text/html,application/xhtml+xml,application/xml;q=0.3,text/xml;q=0.2');
-
-function common_show_header($pagetitle, $callable=null, $data=null, $headercall=null)
-{
-
-    global $config, $xw;
-    global $action; /* XXX: kind of cheating here. */
-
-    common_start_html();
-
-    common_element_start('head');
-    common_element('title', null,
-                   $pagetitle . " - " . $config['site']['name']);
-    common_element('link', array('rel' => 'stylesheet',
-                                 'type' => 'text/css',
-                                 'href' => theme_path('display.css') . '?version=' . LACONICA_VERSION,
-                                 'media' => 'screen, projection, tv'));
-    foreach (array(6,7) as $ver) {
-        if (file_exists(theme_file('ie'.$ver.'.css'))) {
-            // Yes, IE people should be put in jail.
-            $xw->writeComment('[if lte IE '.$ver.']><link rel="stylesheet" type="text/css" '.
-                              'href="'.theme_path('ie'.$ver.'.css').'?version='.LACONICA_VERSION.'" /><![endif]');
-        }
-    }
-
-    common_element('script', array('type' => 'text/javascript',
-                                   'src' => common_path('js/jquery.min.js')),
-                   ' ');
-    common_element('script', array('type' => 'text/javascript',
-                                   'src' => common_path('js/jquery.form.js')),
-                   ' ');
-    common_element('script', array('type' => 'text/javascript',
-                                   'src' => common_path('js/xbImportNode.js')),
-                   ' ');
-    common_element('script', array('type' => 'text/javascript',
-                                   'src' => common_path('js/util.js?version='.LACONICA_VERSION)),
-                   ' ');
-    common_element('link', array('rel' => 'search', 'type' => 'application/opensearchdescription+xml',
-                                 'href' =>  common_local_url('opensearch', array('type' => 'people')),
-                                 'title' => common_config('site', 'name').' People Search'));
-
-    common_element('link', array('rel' => 'search', 'type' => 'application/opensearchdescription+xml',
-                                 'href' =>  common_local_url('opensearch', array('type' => 'notice')),
-                                 'title' => common_config('site', 'name').' Notice Search'));
-
-    if ($callable) {
-        if ($data) {
-            call_user_func($callable, $data);
-        } else {
-            call_user_func($callable);
-        }
-    }
-    common_element_end('head');
-    common_element_start('body', $action);
-    common_element_start('div', array('id' => 'wrap'));
-    common_element_start('div', array('id' => 'header'));
-    common_nav_menu();
-    if ((isset($config['site']['logo']) && is_string($config['site']['logo']) && (strlen($config['site']['logo']) > 0))
-        || file_exists(theme_file('logo.png')))
-    {
-        common_element_start('a', array('href' => common_local_url('public')));
-        common_element('img', array('src' => isset($config['site']['logo']) ?
-                                    ($config['site']['logo']) : theme_path('logo.png'),
-                                    'alt' => $config['site']['name'],
-                                    'id' => 'logo'));
-        common_element_end('a');
-    } else {
-        common_element_start('p', array('id' => 'branding'));
-        common_element('a', array('href' => common_local_url('public')),
-                       $config['site']['name']);
-        common_element_end('p');
-    }
-
-    common_element('h1', 'pagetitle', $pagetitle);
-
-    if ($headercall) {
-        if ($data) {
-            call_user_func($headercall, $data);
-        } else {
-            call_user_func($headercall);
-        }
-    }
-    common_element_end('div');
-    common_element_start('div', array('id' => 'content'));
-}
-
-function common_start_html($type=null, $indent=true)
-{
-
-    if (!$type) {
-        $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : null;
-
-        // XXX: allow content negotiation for RDF, RSS, or XRDS
-
-        $type = common_negotiate_type(common_accept_to_prefs($httpaccept),
-                                      common_accept_to_prefs(PAGE_TYPE_PREFS));
-
-        if (!$type) {
-            common_user_error(_('This page is not available in a media type you accept'), 406);
-            exit(0);
-        }
-    }
-
-    header('Content-Type: '.$type);
-
-    common_start_xml('html',
-                     '-//W3C//DTD XHTML 1.0 Strict//EN',
-                     'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd', $indent);
-
-    // FIXME: correct language for interface
-
-    $language = common_language();
-
-    common_element_start('html', array('xmlns' => 'http://www.w3.org/1999/xhtml',
-                                       'xml:lang' => $language,
-                                       'lang' => $language));
-}
-
-function common_show_footer()
-{
-    global $xw, $config;
-    common_element_end('div'); // content div
-    common_foot_menu();
-    common_element_start('div', array('id' => 'footer'));
-    common_element_start('div', 'laconica');
-    if (common_config('site', 'broughtby')) {
-        $instr = _('**%%site.name%%** is a microblogging service brought to you by [%%site.broughtby%%](%%site.broughtbyurl%%). ');
-    } else {
-        $instr = _('**%%site.name%%** is a microblogging service. ');
-    }
-    $instr .= sprintf(_('It runs the [Laconica](http://laconi.ca/) microblogging software, version %s, available under the [GNU Affero General Public License](http://www.fsf.org/licensing/licenses/agpl-3.0.html).'), LACONICA_VERSION);
-    $output = common_markup_to_html($instr);
-    common_raw($output);
-    common_element_end('div');
-    common_element('img', array('id' => 'cc',
-                                'src' => $config['license']['image'],
-                                'alt' => $config['license']['title']));
-    common_element_start('p');
-    common_text(_('Unless otherwise specified, contents of this site are copyright by the contributors and available under the '));
-    common_element('a', array('class' => 'license',
-                              'rel' => 'license',
-                              'href' => $config['license']['url']),
-                   $config['license']['title']);
-    common_text(_('. Contributors should be attributed by full name or nickname.'));
-    common_element_end('p');
-    common_element_end('div');
-    common_element_end('div');
-    common_element_end('body');
-    common_element_end('html');
-    common_end_xml();
-}
-
-function common_text($txt)
-{
-    global $xw;
-    $xw->text($txt);
-}
-
-function common_raw($xml)
-{
-    global $xw;
-    $xw->writeRaw($xml);
-}
-
-function common_nav_menu()
-{
-    $user = common_current_user();
-    common_element_start('ul', array('id' => 'nav'));
-    if ($user) {
-        common_menu_item(common_local_url('all', array('nickname' => $user->nickname)),
-                         _('Home'));
-    }
-    common_menu_item(common_local_url('peoplesearch'), _('Search'));
-    if ($user) {
-        common_menu_item(common_local_url('profilesettings'),
-                         _('Settings'));
-        common_menu_item(common_local_url('invite'),
-                         _('Invite'));
-        common_menu_item(common_local_url('logout'),
-                         _('Logout'));
-    } else {
-        common_menu_item(common_local_url('login'), _('Login'));
-        if (!common_config('site', 'closed')) {
-            common_menu_item(common_local_url('register'), _('Register'));
-        }
-        common_menu_item(common_local_url('openidlogin'), _('OpenID'));
-    }
-    common_menu_item(common_local_url('doc', array('title' => 'help')),
-                     _('Help'));
-    common_element_end('ul');
-}
-
-function common_foot_menu()
-{
-    common_element_start('ul', array('id' => 'nav_sub'));
-    common_menu_item(common_local_url('doc', array('title' => 'help')),
-                     _('Help'));
-    common_menu_item(common_local_url('doc', array('title' => 'about')),
-                     _('About'));
-    common_menu_item(common_local_url('doc', array('title' => 'faq')),
-                     _('FAQ'));
-    common_menu_item(common_local_url('doc', array('title' => 'privacy')),
-                     _('Privacy'));
-    common_menu_item(common_local_url('doc', array('title' => 'source')),
-                     _('Source'));
-    common_menu_item(common_local_url('doc', array('title' => 'contact')),
-                     _('Contact'));
-    common_element_end('ul');
-}
-
-function common_menu_item($url, $text, $title=null, $is_selected=false)
-{
-    $lattrs = array();
-    if ($is_selected) {
-        $lattrs['class'] = 'current';
-    }
-    common_element_start('li', $lattrs);
-    $attrs['href'] = $url;
-    if ($title) {
-        $attrs['title'] = $title;
-    }
-    common_element('a', $attrs, $text);
-    common_element_end('li');
-}
-
-function common_input($id, $label, $value=null,$instructions=null)
-{
-    common_element_start('p');
-    common_element('label', array('for' => $id), $label);
-    $attrs = array('name' => $id,
-                   'type' => 'text',
-                   'class' => 'input_text',
-                   'id' => $id);
-    if ($value) {
-        $attrs['value'] = htmlspecialchars($value);
-    }
-    common_element('input', $attrs);
-    if ($instructions) {
-        common_element('span', 'input_instructions', $instructions);
-    }
-    common_element_end('p');
-}
-
-function common_checkbox($id, $label, $checked=false, $instructions=null, $value='true', $disabled=false)
-{
-    common_element_start('p');
-    $attrs = array('name' => $id,
-                   'type' => 'checkbox',
-                   'class' => 'checkbox',
-                   'id' => $id);
-    if ($value) {
-        $attrs['value'] = htmlspecialchars($value);
-    }
-    if ($checked) {
-        $attrs['checked'] = 'checked';
-    }
-    if ($disabled) {
-        $attrs['disabled'] = 'true';
-    }
-    common_element('input', $attrs);
-    common_text(' ');
-    common_element('label', array('class' => 'checkbox_label', 'for' => $id), $label);
-    common_text(' ');
-    if ($instructions) {
-        common_element('span', 'input_instructions', $instructions);
-    }
-    common_element_end('p');
-}
-
-function common_dropdown($id, $label, $content, $instructions=null, $blank_select=false, $selected=null)
-{
-    common_element_start('p');
-    common_element('label', array('for' => $id), $label);
-    common_element_start('select', array('id' => $id, 'name' => $id));
-    if ($blank_select) {
-        common_element('option', array('value' => ''));
-    }
-    foreach ($content as $value => $option) {
-        if ($value == $selected) {
-            common_element('option', array('value' => $value, 'selected' => $value), $option);
-        } else {
-            common_element('option', array('value' => $value), $option);
-        }
-    }
-    common_element_end('select');
-    if ($instructions) {
-        common_element('span', 'input_instructions', $instructions);
-    }
-    common_element_end('p');
-}
-function common_hidden($id, $value)
-{
-    common_element('input', array('name' => $id,
-                                  'type' => 'hidden',
-                                  'id' => $id,
-                                  'value' => $value));
-}
-
-function common_password($id, $label, $instructions=null)
-{
-    common_element_start('p');
-    common_element('label', array('for' => $id), $label);
-    $attrs = array('name' => $id,
-                   'type' => 'password',
-                   'class' => 'password',
-                   'id' => $id);
-    common_element('input', $attrs);
-    if ($instructions) {
-        common_element('span', 'input_instructions', $instructions);
-    }
-    common_element_end('p');
-}
-
-function common_submit($id, $label, $cls='submit')
-{
-    global $xw;
-    common_element_start('p');
-    common_element('input', array('type' => 'submit',
-                                  'id' => $id,
-                                  'name' => $id,
-                                  'class' => $cls,
-                                  'value' => $label));
-    common_element_end('p');
-}
-
-function common_textarea($id, $label, $content=null, $instructions=null)
-{
-    common_element_start('p');
-    common_element('label', array('for' => $id), $label);
-    common_element('textarea', array('rows' => 3,
-                                     'cols' => 40,
-                                     'name' => $id,
-                                     'id' => $id),
-                   ($content) ? $content : '');
-    if ($instructions) {
-        common_element('span', 'input_instructions', $instructions);
-    }
-    common_element_end('p');
-}
-
 function common_timezone()
 {
     if (common_logged_in()) {
@@ -970,7 +571,7 @@ function common_tag_link($tag)
 {
     $canonical = common_canonical_tag($tag);
     $url = common_local_url('tag', array('tag' => $canonical));
-    return '<a href="' . htmlspecialchars($url) . '" rel="tag" class="hashlink">' . htmlspecialchars($tag) . '</a>';
+    return '<span class="tag"><a href="' . htmlspecialchars($url) . '" rel="tag">' . htmlspecialchars($tag) . '</a></span>';
 }
 
 function common_canonical_tag($tag)
@@ -988,7 +589,7 @@ function common_at_link($sender_id, $nickname)
     $sender = Profile::staticGet($sender_id);
     $recipient = common_relative_profile($sender, common_canonical_nickname($nickname));
     if ($recipient) {
-        return '<a href="'.htmlspecialchars($recipient->profileurl).'" class="atlink">'.$nickname.'</a>';
+        return '<span class="vcard"><a href="'.htmlspecialchars($recipient->profileurl).'" class="url"><span class="fn nickname">'.$nickname.'</span></a></span>';
     } else {
         return $nickname;
     }
@@ -1005,7 +606,7 @@ function common_at_hash_link($sender_id, $tag)
         $url = common_local_url('subscriptions',
                                 array('nickname' => $user->nickname,
                                       'tag' => $tag));
-        return '<a href="'.htmlspecialchars($url).'" class="atlink">'.$tag.'</a>';
+        return '<span class="tag"><a href="'.htmlspecialchars($url).'" rel="tag">'.$tag.'</a></span>';
     } else {
         return $tag;
     }
@@ -1169,6 +770,8 @@ function common_fancy_url($action, $args=null)
         return common_path('main/openid');
      case 'profilesettings':
         return common_path('settings/profile');
+     case 'passwordsettings':
+        return common_path('settings/password');
      case 'emailsettings':
         return common_path('settings/email');
      case 'openidsettings':
@@ -1251,6 +854,8 @@ function common_fancy_url($action, $args=null)
         return common_path($path);
      case 'imsettings':
         return common_path('settings/im');
+     case 'avatarsettings':
+        return common_path('settings/avatar');
      case 'peoplesearch':
         return common_path('search/people' . (($args) ? ('?' . http_build_query($args)) : ''));
      case 'noticesearch':
@@ -1694,39 +1299,6 @@ function common_profile_url($nickname)
     return common_local_url('showstream', array('nickname' => $nickname));
 }
 
-// Don't call if nobody's logged in
-
-function common_notice_form($action=null, $content=null)
-{
-    $user = common_current_user();
-    assert(!is_null($user));
-    common_element_start('form', array('id' => 'status_form',
-                                       'method' => 'post',
-                                       'action' => common_local_url('newnotice')));
-    common_element_start('p');
-    common_element('label', array('for' => 'status_textarea',
-                                  'id' => 'status_label'),
-                   sprintf(_('What\'s up, %s?'), $user->nickname));
-    common_element('span', array('id' => 'counter', 'class' => 'counter'), '140');
-    common_element('textarea', array('id' => 'status_textarea',
-                                     'cols' => 60,
-                                     'rows' => 3,
-                                     'name' => 'status_textarea'),
-                   ($content) ? $content : '');
-    common_hidden('token', common_session_token());
-    if ($action) {
-        common_hidden('returnto', $action);
-    }
-    // set by JavaScript
-    common_hidden('inreplyto', 'false');
-    common_element('input', array('id' => 'status_submit',
-                                  'name' => 'status_submit',
-                                  'type' => 'submit',
-                                  'value' => _('Send')));
-    common_element_end('p');
-    common_element_end('form');
-}
-
 // Should make up a reasonable root URL
 
 function common_root_url()
@@ -1858,41 +1430,6 @@ function common_valid_tag($tag)
     return false;
 }
 
-// Does a little before-after block for next/prev page
-
-function common_pagination($have_before, $have_after, $page, $action, $args=null)
-{
-
-    if ($have_before || $have_after) {
-        common_element_start('div', array('id' => 'pagination'));
-        common_element_start('ul', array('id' => 'nav_pagination'));
-    }
-
-    if ($have_before) {
-        $pargs = array('page' => $page-1);
-        $newargs = ($args) ? array_merge($args,$pargs) : $pargs;
-
-        common_element_start('li', 'before');
-        common_element('a', array('href' => common_local_url($action, $newargs), 'rel' => 'prev'),
-                       _('« After'));
-        common_element_end('li');
-    }
-
-    if ($have_after) {
-        $pargs = array('page' => $page+1);
-        $newargs = ($args) ? array_merge($args,$pargs) : $pargs;
-        common_element_start('li', 'after');
-        common_element('a', array('href' => common_local_url($action, $newargs), 'rel' => 'next'),
-                       _('Before Â»'));
-        common_element_end('li');
-    }
-
-    if ($have_before || $have_after) {
-        common_element_end('ul');
-        common_element_end('div');
-    }
-}
-
 /* Following functions are copied from MediaWiki GlobalFunctions.php
  * and written by Evan Prodromou. */
 
@@ -2105,111 +1642,11 @@ function common_session_token()
     return $_SESSION['token'];
 }
 
-function common_disfavor_form($notice)
-{
-    common_element_start('form', array('id' => 'disfavor-' . $notice->id,
-                                       'method' => 'post',
-                                       'class' => 'disfavor',
-                                       'action' => common_local_url('disfavor')));
-
-    common_element('input', array('type' => 'hidden',
-                                  'name' => 'token-'. $notice->id,
-                                  'id' => 'token-'. $notice->id,
-                                  'class' => 'token',
-                                  'value' => common_session_token()));
-
-    common_element('input', array('type' => 'hidden',
-                                  'name' => 'notice',
-                                  'id' => 'notice-n'. $notice->id,
-                                  'class' => 'notice',
-                                  'value' => $notice->id));
-
-    common_element('input', array('type' => 'submit',
-                                  'id' => 'disfavor-submit-' . $notice->id,
-                                  'name' => 'disfavor-submit-' . $notice->id,
-                                  'class' => 'disfavor',
-                                  'value' => 'Disfavor favorite',
-                                  'title' => 'Remove this message from favorites'));
-    common_element_end('form');
-}
-
-function common_favor_form($notice)
-{
-    common_element_start('form', array('id' => 'favor-' . $notice->id,
-                                       'method' => 'post',
-                                       'class' => 'favor',
-                                       'action' => common_local_url('favor')));
-
-    common_element('input', array('type' => 'hidden',
-                                  'name' => 'token-'. $notice->id,
-                                  'id' => 'token-'. $notice->id,
-                                  'class' => 'token',
-                                  'value' => common_session_token()));
-
-    common_element('input', array('type' => 'hidden',
-                                  'name' => 'notice',
-                                  'id' => 'notice-n'. $notice->id,
-                                  'class' => 'notice',
-                                  'value' => $notice->id));
-
-    common_element('input', array('type' => 'submit',
-                                  'id' => 'favor-submit-' . $notice->id,
-                                  'name' => 'favor-submit-' . $notice->id,
-                                  'class' => 'favor',
-                                  'value' => 'Add to favorites',
-                                  'title' => 'Add this message to favorites'));
-    common_element_end('form');
-}
-
-function common_nudge_form($profile)
-{
-    common_element_start('form', array('id' => 'nudge', 'method' => 'post',
-                                       'action' => common_local_url('nudge', array('nickname' => $profile->nickname))));
-    common_hidden('token', common_session_token());
-    common_element('input', array('type' => 'submit',
-                                  'class' => 'submit',
-                                  'value' => _('Send a nudge')));
-    common_element_end('form');
-}
 function common_nudge_response()
 {
     common_element('p', array('id' => 'nudge_response'), _('Nudge sent!'));
 }
 
-function common_subscribe_form($profile)
-{
-    common_element_start('form', array('id' => 'subscribe-' . $profile->id,
-                                       'method' => 'post',
-                                       'class' => 'subscribe',
-                                       'action' => common_local_url('subscribe')));
-    common_hidden('token', common_session_token());
-    common_element('input', array('id' => 'subscribeto-' . $profile->id,
-                                  'name' => 'subscribeto',
-                                  'type' => 'hidden',
-                                  'value' => $profile->id));
-    common_element('input', array('type' => 'submit',
-                                  'class' => 'submit',
-                                  'value' => _('Subscribe')));
-    common_element_end('form');
-}
-
-function common_unsubscribe_form($profile)
-{
-    common_element_start('form', array('id' => 'unsubscribe-' . $profile->id,
-                                       'method' => 'post',
-                                       'class' => 'unsubscribe',
-                                       'action' => common_local_url('unsubscribe')));
-    common_hidden('token', common_session_token());
-    common_element('input', array('id' => 'unsubscribeto-' . $profile->id,
-                                  'name' => 'unsubscribeto',
-                                  'type' => 'hidden',
-                                  'value' => $profile->id));
-    common_element('input', array('type' => 'submit',
-                                  'class' => 'submit',
-                                  'value' => _('Unsubscribe')));
-    common_element_end('form');
-}
-
 // XXX: Refactor this code
 function common_profile_new_message_nudge ($cur, $profile)
 {
@@ -2241,47 +1678,6 @@ function common_keyize($str)
     return $str;
 }
 
-function common_message_form($content, $user, $to)
-{
-
-    common_element_start('form', array('id' => 'message_form',
-                                       'method' => 'post',
-                                       'action' => common_local_url('newmessage')));
-
-    $mutual_users = $user->mutuallySubscribedUsers();
-
-    $mutual = array();
-
-    while ($mutual_users->fetch()) {
-        if ($mutual_users->id != $user->id) {
-            $mutual[$mutual_users->id] = $mutual_users->nickname;
-        }
-    }
-
-    $mutual_users->free();
-    unset($mutual_users);
-
-    common_dropdown('to', _('To'), $mutual, null, false, $to->id);
-
-    common_element_start('p');
-
-    common_element('textarea', array('id' => 'message_content',
-                                     'cols' => 60,
-                                     'rows' => 3,
-                                     'name' => 'content'),
-                   ($content) ? $content : '');
-
-    common_element('input', array('id' => 'message_send',
-                                  'name' => 'message_send',
-                                  'type' => 'submit',
-                                  'value' => _('Send')));
-
-    common_hidden('token', common_session_token());
-
-    common_element_end('p');
-    common_element_end('form');
-}
-
 function common_memcache()
 {
     static $cache = null;
@@ -2308,39 +1704,3 @@ function common_compatible_license($from, $to)
     // XXX: better compatibility check needed here!
     return ($from == $to);
 }
-
-/* These are almost identical, so we use a helper function */
-
-function common_block_form($profile, $args=null)
-{
-    common_blocking_form('block', _('Block'), $profile, $args);
-}
-
-function common_unblock_form($profile, $args=null)
-{
-    common_blocking_form('unblock', _('Unblock'), $profile, $args);
-}
-
-function common_blocking_form($type, $label, $profile, $args=null)
-{
-    common_element_start('form', array('id' => $type . '-' . $profile->id,
-                                       'method' => 'post',
-                                       'class' => $type,
-                                       'action' => common_local_url($type)));
-    common_hidden('token', common_session_token());
-    common_element('input', array('id' => $type . 'to-' . $profile->id,
-                                  'name' => $type . 'to',
-                                  'type' => 'hidden',
-                                  'value' => $profile->id));
-    common_element('input', array('type' => 'submit',
-                                  'class' => 'submit',
-                                  'name' => $type,
-                                  'value' => $label));
-    if ($args) {
-        foreach ($args as $k => $v) {
-            common_hidden('returnto-' . $k, $v);
-        }
-    }
-    common_element_end('form');
-    return;
-}
diff --git a/lib/widget.php b/lib/widget.php
new file mode 100644 (file)
index 0000000..c70505c
--- /dev/null
@@ -0,0 +1,82 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Base class for UI widgets
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Widget
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+/**
+ * Base class for UI widgets
+ *
+ * A widget is a cluster of HTML elements that provide some functionality
+ * that's used on different parts of the site. Examples would be profile
+ * lists, notice lists, navigation menus (tabsets) and common forms.
+ *
+ * @category Widget
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Sarven Capadisli <csarven@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ *
+ * @see      HTMLOutputter
+ */
+
+class Widget
+{
+    /**
+     * HTMLOutputter to use for output
+     */
+
+    var $out = null;
+
+    /**
+     * Prepare the widget for use
+     *
+     * @param HTMLOutputter $out output helper, defaults to null
+     */
+
+    function __construct($out=null)
+    {
+        $this->out = $out;
+    }
+
+    /**
+     * Show the widget
+     *
+     * Emit the HTML for the widget, using the configured outputter.
+     *
+     * @return void
+     */
+
+    function show()
+    {
+    }
+}
diff --git a/lib/xmloutputter.php b/lib/xmloutputter.php
new file mode 100644 (file)
index 0000000..64935da
--- /dev/null
@@ -0,0 +1,242 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Low-level generator for XML
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Output
+ * @package   Laconica
+ * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Sarven Capadisli <csarven@controlyourself.ca>
+ * @copyright 2008 Control Yourself, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+    exit(1);
+}
+
+/**
+ * Low-level generator for XML
+ *
+ * This is a thin wrapper around PHP's XMLWriter. The main
+ * advantage is the element() method, which simplifies outputting
+ * an element.
+ *
+ * @category Output
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Sarven Capadisli <csarven@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link     http://laconi.ca/
+ * @see      Action
+ * @see      HTMLOutputter
+ */
+
+class XMLOutputter
+{
+    /**
+     * Wrapped XMLWriter object, which does most of the heavy lifting
+     * for output.
+     */
+
+    var $xw = null;
+
+    /**
+     * Constructor
+     *
+     * Initializes the wrapped XMLWriter.
+     *
+     * @param string  $output URL for outputting, defaults to stdout
+     * @param boolean $indent Whether to indent output, default true
+     */
+
+    function __construct($output='php://output', $indent=true)
+    {
+        $this->xw = new XMLWriter();
+        $this->xw->openURI($output);
+        $this->xw->setIndent($indent);
+    }
+
+    /**
+     * Start a new XML document
+     *
+     * @param string $doc    document element
+     * @param string $public public identifier
+     * @param string $system system identifier
+     *
+     * @return void
+     */
+
+    function startXML($doc=null, $public=null, $system=null)
+    {
+        $this->xw->startDocument('1.0', 'UTF-8');
+        if ($doc) {
+            $this->xw->writeDTD($doc, $public, $system);
+        }
+    }
+
+    /**
+     * finish an XML document
+     *
+     * It's probably a bad idea to continue to use this object
+     * after calling endXML().
+     *
+     * @return void
+     */
+
+    function endXML()
+    {
+        $this->xw->endDocument();
+        $this->xw->flush();
+    }
+
+    /**
+     * output an XML element
+     *
+     * Utility for outputting an XML element. A convenient wrapper
+     * for a bunch of longer XMLWriter calls. This is best for
+     * when an element doesn't have any sub-elements; if that's the
+     * case, use elementStart() and elementEnd() instead.
+     *
+     * The $content element will be escaped for XML. If you need
+     * raw output, use elementStart() and elementEnd() with a call
+     * to raw() in the middle.
+     *
+     * If $attrs is a string instead of an array, it will be treated
+     * as the class attribute of the element.
+     *
+     * @param string $tag     Element type or tagname
+     * @param array  $attrs   Array of element attributes, as
+     *                        key-value pairs
+     * @param string $content string content of the element
+     *
+     * @return void
+     */
+
+    function element($tag, $attrs=null, $content=null)
+    {
+        $this->elementStart($tag, $attrs);
+        if (!is_null($content)) {
+            $this->xw->text($content);
+        }
+        $this->elementEnd($tag);
+    }
+
+    /**
+     * output a start tag for an element
+     *
+     * Mostly used for when an element has content that's
+     * not a simple string.
+     *
+     * If $attrs is a string instead of an array, it will be treated
+     * as the class attribute of the element.
+     *
+     * @param string $tag   Element type or tagname
+     * @param array  $attrs Array of element attributes
+     *
+     * @return void
+     */
+
+    function elementStart($tag, $attrs=null)
+    {
+        $this->xw->startElement($tag);
+        if (is_array($attrs)) {
+            foreach ($attrs as $name => $value) {
+                $this->xw->writeAttribute($name, $value);
+            }
+        } else if (is_string($attrs)) {
+            $this->xw->writeAttribute('class', $attrs);
+        }
+    }
+
+    /**
+     * output an end tag for an element
+     *
+     * Used in conjunction with elementStart(). $tag param
+     * should match the elementStart() param.
+     *
+     * For HTML 4 compatibility, this method will force
+     * a full end element (</tag>) even if the element is
+     * empty, except for a handful of exception tagnames.
+     * This is a hack.
+     *
+     * @param string $tag Element type or tagname.
+     *
+     * @return void
+     */
+
+    function elementEnd($tag)
+    {
+        static $empty_tag = array('base', 'meta', 'link', 'hr',
+                                  'br', 'param', 'img', 'area',
+                                  'input', 'col');
+        // XXX: check namespace
+        if (in_array($tag, $empty_tag)) {
+            $this->xw->endElement();
+        } else {
+            $this->xw->fullEndElement();
+        }
+    }
+
+    /**
+     * output plain text
+     *
+     * Text will be escaped. If you need it not to be,
+     * use raw() instead.
+     *
+     * @param string $txt Text to output.
+     *
+     * @return void
+     */
+
+    function text($txt)
+    {
+        $this->xw->text($txt);
+    }
+
+    /**
+     * output raw xml
+     *
+     * This will spit out its argument verbatim -- no escaping is
+     * done.
+     *
+     * @param string $xml XML to output.
+     *
+     * @return void
+     */
+
+    function raw($xml)
+    {
+        $this->xw->writeRaw($xml);
+    }
+
+    /**
+     * output a comment
+     *
+     * @param string $txt text of the comment
+     *
+     * @return void
+     */
+
+    function comment($txt)
+    {
+        $this->xw->writeComment($txt);
+    }
+}
diff --git a/theme/base/css/display.css b/theme/base/css/display.css
new file mode 100644 (file)
index 0000000..e337f1c
--- /dev/null
@@ -0,0 +1,1178 @@
+/* theme: base */
+* { margin:0; padding:0; }
+img { display:block; border:0; }
+a abbr { cursor: pointer; border-bottom:0; }
+table { border-collapse:collapse; }
+ol { list-style-position:inside; }
+html { font-size: 87.5%; background-color:#fff; height:100%; }
+body {
+background-color:#fff;
+color:#000;
+font-family:sans-serif;
+font-size:1em;
+line-height:1.65;
+position:relative;
+margin:0 auto;
+width:1004px;
+width:71.714em;
+}
+h1,h2,h3,h4,h5,h6 {
+       text-transform:uppercase;
+       margin-bottom:7px;
+}
+h1 {
+font-size:1.4em;
+line-height:1;
+margin-bottom:18px;
+}
+h2 { font-size:1.3em; }
+h3 { font-size:1.2em; }
+h4 { font-size:1.1em; }
+h5 { font-size:1em; }
+h6 { font-size:0.9em; }
+
+caption {
+font-weight:bold;
+}
+.opened { display: block !important;}
+.closed { display: none !important;}
+
+legend {
+font-weight:bold; 
+font-size:1.3em;
+text-transform:uppercase;
+}
+form {
+}
+input, textarea, select, option {
+padding:4px;
+font-family:sans-serif;
+font-size:1em;
+}
+input, textarea, select {
+border-width:2px;
+border-style: solid;
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+}
+input.submit {
+font-weight:bold;
+}
+textarea {
+overflow:auto;
+}
+select, option {
+padding-bottom:0;
+}
+fieldset {
+padding:0;
+border:0;
+}
+form ul li {
+list-style-type:none;
+margin:0 0 18px 0;
+}
+form label {
+font-weight:bold;
+/*margin:0 0 11px 0;*/
+}
+form ul li input {
+}
+
+input.checkbox {
+position:relative;
+top:2px;
+left:0;
+border:0;
+}
+
+#page_notice .error,
+#page_notice .success {
+padding:4px 7px;
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+}
+form label.submit {
+display:none;
+}
+.form_settings input.remove {
+margin-left:11px;
+}
+
+
+
+
+/* FORM SETTINGS */
+.form_settings fieldset {
+margin-bottom:29px;
+}
+
+.form_guide {
+font-style:italic;
+}
+
+
+.form_settings .form_data li {
+width:100%;
+float:left;
+}
+
+.form_settings .form_data label {
+float:left;
+}
+.form_settings .form_data textarea,
+.form_settings .form_data select,
+.form_settings .form_data input {
+margin-left:11px;
+float:left;
+}
+
+.form_settings label {
+margin-top:2px;
+width:152px;
+}
+
+.form_actions label {
+display:none;
+}
+
+.form_settings #settings_autosubscribe label {
+display:inline;
+font-weight:bold;
+}
+
+#form_settings_profile legend,
+#form_login legend,
+#form_register legend {
+display:none;
+}
+
+.form_settings .form_data p.form_guide {
+clear:both;
+margin-left:163px;
+margin-bottom:0;
+}
+
+.form_settings p {
+margin-bottom:11px;
+}
+
+.form_settings input.checkbox {
+margin-top:3px;
+margin-left:0;
+}
+.form_settings label.checkbox {
+font-weight:normal;
+margin-top:0;
+margin-right:0;
+margin-left:11px;
+float:left;
+width:90%;
+}
+
+#form_login p.form_guide,
+#form_register #settings_rememberme p.form_guide {
+margin-left:0;
+}
+
+
+.form_settings .form_note {
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+padding:0 7px;
+}
+
+/* FORM SETTINGS */
+
+
+
+
+address {
+float:left;
+margin-bottom:18px;
+margin-left:18px;
+}
+address.vcard img.logo {
+margin-right:0;
+}
+
+
+#header {
+width:100%;
+position:relative;
+float:left;
+padding-top:18px;
+margin-bottom:29px;
+}
+
+#site_nav_global_primary {
+float:right;
+margin-right:18px;
+margin-bottom:11px;
+}
+#site_nav_global_primary ul li {
+display:inline;
+margin-left:11px;
+}
+
+
+.system_notice dt {
+font-weight:bold;
+text-transform:uppercase;
+display:none;
+}
+
+#site_notice {
+position:absolute;
+right:0;
+top:49px;
+float:right;
+width:322px;
+}
+#page_notice {
+clear:both;
+margin-bottom:18px;
+}
+
+
+
+
+#footer {
+float:left;
+width:64%;
+padding:18px;
+}
+
+
+
+#site_nav_local_views {
+width:100%;
+float:left;
+}
+#site_nav_local_views dt {
+display:none;
+}
+#site_nav_local_views li {
+float:left;
+margin-right:18px;
+list-style-type:none;
+}
+#site_nav_local_views a {
+float:left;
+text-decoration:none;
+padding:4px 11px;
+-moz-border-radius-topleft:4px;
+-moz-border-radius-topright:4px;
+-webkit-border-top-left-radius:4px;
+-webkit-border-top-right-radius:4px;
+border-width:1px;
+border-style:solid;
+border-bottom:0;
+text-shadow: 4px 4px 4px #ddd;
+font-weight:bold;
+}
+#site_nav_local_views .nav {
+float:left;
+width:100%;
+}
+
+
+#site_nav_global_primary dt,
+#site_nav_global_secondary dt {
+display:none;
+}
+/*
+#site_nav_global_primary .current a {
+font-weight:bold;
+border-style:solid;
+}
+*/
+#site_nav_global_secondary {
+margin-bottom:11px;
+}
+
+#site_nav_global_secondary ul li {
+display:inline;
+margin-right:11px;
+}
+#export_data li a {
+padding-left:20px;
+}
+#export_data li a.foaf {
+padding-left:30px;
+}
+#export_data li a.export_vcard {
+padding-left:28px;
+}
+
+
+
+#export_data ul {
+display:inline;
+}
+#export_data li {
+list-style-type:none;
+display:inline;
+margin-left:11px;
+}
+#export_data li:first-child {
+margin-left:0;
+}
+
+
+
+#licenses {
+font-size:0.9em;
+}
+
+#licenses dt {
+font-weight:bold;
+display:none;
+}
+#licenses dd {
+margin-bottom:11px;
+line-height:1.5;
+}
+
+#site_content_license_cc {
+margin-bottom:0;
+}
+#site_content_license_cc img {
+display:inline;
+vertical-align:top;
+margin-right:4px;
+}
+
+
+#wrap {
+       float:left;
+       margin:0 auto;
+    width:1004px;
+    width:71.714em;
+}
+
+
+#core {
+position:relative;
+width:100%;
+float:left;
+margin-bottom:1em;
+}
+
+#content {
+width:644px;
+padding:18px;
+float:left;
+border-radius:7px;
+-moz-border-radius:7px;
+-moz-border-radius-topleft:0;
+-webkit-border-radius:7px;
+-webkit-border-top-left-radius:0;
+}
+
+#content_inner {
+position:relative;
+width:100%;
+float;left;
+}
+
+#aside_primary {
+width:300px;
+float:left;
+margin-left:2px;
+padding:18px 4px 18px 18px;
+border-radius:7px;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+}
+
+
+
+
+/*Start: FORM NOTICE*/
+#form_notice {
+width:384px;
+width:458px;
+float:left;
+position:relative;
+line-height:1;
+}
+#form_notice fieldset {
+border:0;
+padding:0;
+}
+#form_notice legend {
+display:none;
+}
+#form_notice textarea {
+border-radius:7px;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+width:377px;
+width:370px;
+height:86px;
+line-height:1.5;
+padding:7px 7px 16px 7px;
+}
+#form_notice label {
+display:block;
+font-size:1.3em;
+margin-bottom:7px;
+}
+#form_notice .form_data li {
+float:left;
+}
+
+#form_notice #notice_attach_file label,
+#form_notice #notice_submit label {
+display:none;
+}
+
+#form_notice #notice_attachment {
+margin-top:25px;
+margin-left:4px;
+}
+
+#form_notice .form_note {
+position:absolute;
+top:120px;
+right:98px;
+z-index:9;
+}
+
+#form_notice .form_note dt {
+font-weight:bold;
+display:none;
+}
+#notice_text-count {
+font-weight:bold;
+line-height:1.15;
+}
+
+#form_notice #notice_data-attach_view {
+/*position:absolute;*/
+top:25px;
+right:30px;
+margin-left:4px;
+padding:0;
+cursor:pointer;
+width:16px;
+height:16px;
+border:0;
+text-indent:-9999px;
+}
+#form_notice .form_actions {
+position:absolute;
+bottom:0;
+right:0;
+}
+#form_notice .form_actions input.submit {
+width:60px;
+padding:8px;
+}
+
+#form_notice li {
+margin-bottom:0;
+}
+/*end FORM NOTICE*/
+
+
+
+
+
+/* user_profile */
+#user_profile {
+position:relative;
+width:633px;
+min-height:123px;
+float:left;
+margin-bottom:17px;
+margin-left:0;
+}
+#user_profile dt,
+#user_statistics dt {
+font-weight:bold;
+}
+#user_profile .user_depiction {
+float:left;
+position:absolute;
+top:0;
+left:0;
+width:96px;
+}
+#user_profile .user_fn,
+#user_profile .user_nickname,
+#user_profile .user_location,
+#user_profile .user_url,
+#user_profile .user_note,
+#user_profile .user_tags {
+float:left;
+clear:left;
+margin-left:125px;
+width:322px;
+margin-bottom:4px;
+}
+
+#user_profile .user_fn,
+#user_profile .user_nickname {
+width:auto;
+clear:none;
+}
+#user_profile .user_nickname {
+margin-left:11px;
+}
+#user_profile .user_nickname .nickname {
+font-style:italic;
+font-weight:bold;
+margin-left:4px;
+margin-right:4px;
+}
+
+#user_profile .user_nickname dd:before {
+content: "(";
+}
+#user_profile .user_nickname dd:after {
+content: ")";
+}
+
+#user_profile dt {
+display:none;
+}
+#user_profile h2 {
+display:none;
+}
+/* user_profile */
+
+/*user_actions*/
+#user_actions {
+clear:left;
+float:left;
+position:absolute;
+top:0;
+right:0;
+}
+#user_actions h2 {
+display:none;
+}
+#user_actions ul {
+list-style-type:none;
+}
+#user_actions li {
+border-top-width:1px;
+border-top-style:dotted;
+}
+#user_actions li:first-child {
+border-top:0;
+}
+#user_actions fieldset {
+border:0;
+padding:0;
+}
+#user_actions legend {
+display:none;
+}
+
+#user_actions a,
+#user_actions input.submit {
+display:block;
+text-align:left;
+padding:4px 0 4px 19px;
+}
+#user_actions a {
+text-decoration:none;
+}
+#user_subscribe a,
+#TB_window input.submit,
+#user_actions input.submit {
+border:0;
+cursor:pointer;
+padding-left:16px;
+width:100%;
+font-size:0.9em;
+}
+
+#user_subscribe a {
+width:auto;
+padding-left:20px;
+}
+
+#user_subscribe a,
+#TB_window input.submit,
+.form_user_subscribe input.submit {
+font-weight:bold;
+}
+
+
+
+#user_send-a-message form {
+clear:left;
+width:322px;
+margin-top:18px;
+}
+
+#user_send-a-message textarea {
+width:96%;
+}
+
+.user_tags ul {
+list-style-type:none;
+}
+.user_tags li {
+display:inline;
+margin-right:1em;
+float:left;
+}
+
+
+
+.aside .section {
+margin-bottom:29px;
+clear:both;
+}
+.aside .section h2 {
+text-transform:uppercase;
+font-size:1em;
+}
+
+#user_statistics dt,
+#user_statistics dd {
+display:inline;
+}
+#user_statistics dt:after {
+content: ":";
+}
+
+
+#user_subscriptions,
+#user_subscriptions-common {
+float:left;
+}
+#user_subscriptions ul.users {
+width:220px;
+float:left;
+}
+#user_subscriptions .users li {
+list-style-type:none;
+float:left;
+margin-right:7px;
+margin-bottom:7px;
+}
+#user_subscriptions .users li .photo {
+width:24px;
+height:24px;
+margin-right:0;
+}
+#user_subscriptions .users li .fn {
+display:none;
+}
+.aside .section .more {
+clear:both;
+}
+
+
+
+
+
+/* NOTICE */
+.notice {
+position:relative;
+padding-top:18px;
+padding-bottom:18px;
+clear:both;
+float:left;
+width:644px;
+width:96.699%;
+width:100%;
+border-top:1px dashed #D1D9E4;
+/*-moz-border-radius:7px;*/
+}
+.notices li {
+list-style-type:none;
+/*margin-bottom:11px;*/
+}
+.notices li.hover {
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+}
+
+
+/* NOTICES */
+#notices_primary {
+float:left;
+width:644px;
+border-radius:7px;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+}
+#notices_primary h2 {
+display:none;
+}
+.notice-data a span {
+display:block;
+padding-left:28px;
+}
+
+
+.notice .author {
+margin-right:11px;
+}
+.notice .author a {
+}
+.notice .author:after {
+/*content:":";*/
+}
+
+.vcard .photo {
+display:inline;
+margin-right:7px;
+margin-bottom:7px;
+float:left;
+}
+.vcard .url {
+text-decoration:none;
+}
+.vcard .url:hover {
+text-decoration:underline;
+}
+.vcard .fn {
+font-style:italic;
+}
+.vcard .fn:hover {
+
+}
+
+
+.notice .entry-title {
+float:left;
+width:100%;
+}
+.notice p.entry-content {
+display:inline;
+}
+
+.notice_video p.entry-content,
+.notice_audio p.entry-content,
+.notice_image p.entry-content,
+.notice_location p.entry-content,
+.notice_event p.entry-content,
+.notice_document p.entry-content {
+}
+#laconicat .notice p.entry-content {
+/*margin-left:199px;*/
+}
+.notice p.entry-content a:visited {
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+}
+.notice p.entry-content .vcard a {
+border-radius:4px;
+-moz-border-radius:4px;
+-webkit-border-radius:4px;
+}
+
+.notice div.entry-content {
+/*border:1px solid blue;*/
+clear:left;
+float:left;
+width:48%;
+font-size:0.95em;
+}
+.notice div.entry-content a,
+.notice .notice-options a,
+.notice .notice-options input {
+
+}
+.notice .notice-options a,
+.notice .notice-options input {
+float:left;
+font-size:1.025em;
+}
+
+#laconicat .notice div.entry-content {
+/*margin-left:0;*/
+}
+
+.notice div.entry-content dl,
+.notice div.entry-content dt,
+.notice div.entry-content dd {
+display:inline;
+}
+.notice div.entry-content .timestamp dt,
+.notice div.entry-content .response dt {
+display:none;
+}
+.notice div.entry-content .timestamp a {
+display:inline-block;
+}
+.notice div.entry-content .device dt {
+text-transform:lowercase;
+}
+.notice div.entry-content a {
+
+}
+.notice div.entry-content a:hover {
+}
+
+
+
+.notice-data {
+position:absolute;
+top:18px;
+right:0;
+min-height:50px;
+margin-bottom:4px;
+}
+.notice .entry-content .notice-data dt {
+display:none;
+}
+
+.notice-data a {
+display:block;
+outline:none;
+}
+
+.notice-options {
+padding-left:2%;
+float:left;
+width:50%;
+position:relative;
+font-size:0.95em;
+}
+
+.notice-options a {
+float:left;
+}
+.notice-options .notice_delete,
+.notice-options .notice_reply,
+.notice-options .form_favor,
+.notice-options .form_disfavor {
+position:absolute;
+top:0;
+}
+.notice-options .form_favor,
+.notice-options .form_disfavor {
+left:0;
+}
+.notice-options .notice_reply {
+left:29px;
+}
+.notice-options .notice_delete {
+left:76px;
+}
+.notice-options .notice_reply dt {
+display:none;
+}
+
+.notice-options input,
+.notice-options a {
+text-indent:-9999px;
+outline:none;
+}
+
+.notice-options .notice_reply a,
+.notice-options form input.submit {
+display:block;
+border:0;
+}
+.notice-options .notice_reply a,
+.notice-options .notice_delete a {
+text-decoration:none;
+padding-left:16px;
+}
+
+.notice-options .notice_delete {
+
+}
+
+.notice-options form input.submit {
+cursor:pointer;
+width:16px;
+padding:2px 0;
+}
+
+.notice-options .notice_delete dt,
+.notice-options .form_favor legend,
+.notice-options .form_disfavor legend {
+display:none;
+}
+.notice-options .notice_delete fieldset,
+.notice-options .form_favor fieldset,
+.notice-options .form_disfavor fieldset {
+border:0;
+padding:0;
+}
+
+/*END: NOTICES */
+
+
+
+
+
+.pagination dt {
+font-weight:bold;
+display:none;
+}
+
+.pagination .nav {
+float:left;
+width:100%;
+list-style-type:none;
+}
+
+.pagination .nav_prev {
+float:left;
+}
+.pagination .nav_next {
+float:right;
+}
+
+.pagination a {
+display:block;
+text-decoration:none;
+font-weight:bold;
+padding:7px;
+border:1px dotted #D1D9E4;
+border-bottom:0;
+}
+
+.pagination .nav_prev a {
+-moz-border-radius-topright:7px;
+-webkit-border-top-right-radius:7px;
+padding-left:20px;
+border-left:0;
+}
+.pagination .nav_next a {
+-moz-border-radius-topleft:7px;
+-webkit-border-top-left-radius:7px;
+padding-right:20px;
+border-right:0;
+}
+
+
+/* END: NOTICE */
+
+
+
+
+
+
+
+/*START: LOAD ALONG WITH JS*/
+.notice .in-reply-to {
+       width:98%;
+       margin-left:2%;
+}
+.notice .in-reply-to li {
+background-color:#F7F9FB;
+}
+.notice .in-reply-to li .in-reply-to li {
+background-color:#E4E9F0;
+}
+.notice .in-reply-to li .in-reply-to li .in-reply-to li {
+background-color:#D1D9E4;
+}
+
+
+
+#user_actions #user_subscribe .form_note,
+#user_actions #user_subscribe .form_data,
+#user_actions #user_subscribe .form_actions label {
+display:none;
+}
+#form_user-relationship .form_note,
+#form_user-relationship .form_data,
+#form_user-relationship .form_actions label {
+display:block;
+}
+
+#user_actions #user-relationship_submit {
+margin-bottom:0;
+}
+#form_user-relationship .form_data li label {
+margin-right:11px;
+}
+
+#user_relationship_xfn {
+/*z-index:1000;
+position:absolute;
+width:521px;
+height:322px;*/
+display:none;
+}
+#user_relationship_xfn fieldset {
+background-color:#fff;
+}
+
+/*END: LOAD ALONG WITH JS*/
+
+
+
+/* TOP_POSTERS */
+#top-posters caption {
+text-align:left;
+text-transform:uppercase;
+}
+
+#top-posters thead {
+display:none;
+}
+#top-poster_user {
+width:199px;
+}
+#top-poster_number-of-notices {
+width:123px;
+}
+#top-posters tbody td {
+padding-right:11px;
+padding-bottom:4px;
+}
+#top-posters img {
+margin-right:7px;
+height:24px;
+width:24px;
+}
+
+
+
+/* tagcloud */
+#tagcloud ul {
+list-style-type:none;
+}
+#tagcloud ul li {
+display:inline;
+margin-right:7px;
+line-height:1.4;
+}
+
+#tagcloud.section dt {
+text-transform:uppercase;
+font-weight:bold;
+}
+#tagcloud .weight_1 {
+font-size:1em;
+}
+#tagcloud .weight_2 {
+font-size:1.3em;
+}
+#tagcloud .weight_3 {
+font-size:1.6em;
+}
+#tagcloud .weight_4 {
+font-size:1.9em;
+}
+#tagcloud .weight_5 {
+font-size:2.2em;
+}
+
+
+
+#form_settings_photo .form_data {
+clear:both;
+}
+
+
+
+
+#photo_original,
+#photo_preview {
+float:left;
+}
+#photo_preview,
+#settings_photo_action-crop {
+margin-left:29px;
+}
+#photo_preview_view {
+height:96px;
+width:96px;
+overflow:hidden;
+}
+
+
+
+
+.section .groups,
+#users_featured ul {
+list-style-type:none;
+}
+.section .groups li,
+#users_featured li {
+margin-top:11px;
+float:left;
+width:100%;
+}
+.section .groups li:first-child,
+#users_featured li:first-child {
+margin-top:0;
+}
+
+.section .groups .vcard,
+#users_featured .vcard {
+float:left;
+margin-bottom:-23px;
+}
+
+.section .groups dl,
+#users_featured dl {
+float:left;
+margin-left:63px;
+clear:left;
+}
+.section .groups dt,
+#users_featured dt {
+display:none;
+font-weight:bold;
+}
+
+
+
+#home.logged_out h1 {
+display:none;
+}
+
+#home #intro {
+margin-bottom:29px;
+float:left;
+width:100%;
+}
+
+#home #intro p {
+margin-bottom:18px;
+font-size:1.8em;
+}
+
+#home #intro #guide_steps {
+list-style-type:none;
+}
+#home #intro #guide_steps li {
+float:left;
+margin-left:18px;
+}
+#home #intro #guide_steps li:first-child {
+margin-left:0;
+}
+#home #intro #guide_steps li a {
+display:block;
+float:left;
+width:185px;
+height:109px;
+border-width:1px;
+border-style:dotted;
+text-decoration:none;
+border-radius:7px;
+-moz-border-radius:7px;
+-webkit-border-radius:7px;
+padding:7px;
+font-size:1.6em;
+font-weight:bold;
+text-align:center;
+}
+
+
+#testimonials {
+clear:both;
+}
diff --git a/theme/base/css/ie.css b/theme/base/css/ie.css
new file mode 100644 (file)
index 0000000..9baa953
--- /dev/null
@@ -0,0 +1,26 @@
+/* IE specific styles */
+
+#aside_primary {
+padding-left:11px;
+}
+.notice-options form input.submit {
+font-size:0;
+margin-top:3px;
+height:16px;
+text-align:right;
+text-indent:0;
+color:#fff;
+width:24px;
+}
+
+input.checkbox {
+top:0;
+}
+
+legend {
+margin-left:-7px;
+}
+
+.notice div.entry-content .timestamp a {
+margin-right:4px;
+}
\ No newline at end of file
diff --git a/theme/base/css/ie7.css b/theme/base/css/ie7.css
new file mode 100644 (file)
index 0000000..a6e2548
--- /dev/null
@@ -0,0 +1,5 @@
+/* IE7 specific styles */
+
+#form_notice textarea {
+width:370px;
+} 
\ No newline at end of file
diff --git a/theme/base/css/initial_states.css b/theme/base/css/initial_states.css
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/theme/base/css/jquery.Jcrop.css b/theme/base/css/jquery.Jcrop.css
new file mode 100644 (file)
index 0000000..6c6dfb5
--- /dev/null
@@ -0,0 +1,45 @@
+/* Fixes issue here http://code.google.com/p/jcrop/issues/detail?id=1 */
+.jcrop-holder
+{
+       text-align: left;
+}
+
+.jcrop-vline, .jcrop-hline
+{
+       font-size: 0;
+       position: absolute;
+       background: #fff url(../images/illustrations/illu_jcrop.gif) top left repeat;
+       /*
+       opacity: .5;
+       *filter:alpha(opacity=50);
+       */
+}
+.jcrop-vline { height: 100%; width: 1px !important; }
+.jcrop-hline { width: 100%; height: 1px !important; }
+.jcrop-handle {
+       font-size: 1px;
+       width: 7px !important;
+       height: 7px !important;
+       border: 1px #eee solid;
+       background-color: #333;
+       /*width: 9px;
+       height: 9px;*/
+}
+
+.jcrop-tracker {
+       /*background-color: gray;*/
+       width: 100%; height: 100%;
+}
+
+.custom .jcrop-vline,
+.custom .jcrop-hline
+{
+       background: yellow;
+}
+.custom .jcrop-handle
+{
+       border-color: black;
+       background-color: #C7BB00;
+       -moz-border-radius: 3px;
+       -webkit-border-radius: 3px;
+}
diff --git a/theme/base/css/thickbox.css b/theme/base/css/thickbox.css
new file mode 100644 (file)
index 0000000..d24b9be
--- /dev/null
@@ -0,0 +1,163 @@
+/* ----------------------------------------------------------------------------------------------------------------*/
+/* ---------->>> global settings needed for thickbox <<<-----------------------------------------------------------*/
+/* ----------------------------------------------------------------------------------------------------------------*/
+*{padding: 0; margin: 0;}
+
+/* ----------------------------------------------------------------------------------------------------------------*/
+/* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/
+/* ----------------------------------------------------------------------------------------------------------------*/
+#TB_window {
+       font: 12px Arial, Helvetica, sans-serif;
+       color: #333333;
+}
+
+#TB_secondLine {
+       font: 10px Arial, Helvetica, sans-serif;
+       color:#666666;
+}
+
+#TB_window a:link {color: #666666;}
+#TB_window a:visited {color: #666666;}
+#TB_window a:hover {color: #000;}
+#TB_window a:active {color: #666666;}
+#TB_window a:focus{color: #666666;}
+
+/* ----------------------------------------------------------------------------------------------------------------*/
+/* ---------->>> thickbox settings <<<-----------------------------------------------------------------------------*/
+/* ----------------------------------------------------------------------------------------------------------------*/
+#TB_overlay {
+       position: fixed;
+       z-index:100;
+       top: 0px;
+       left: 0px;
+       height:100%;
+       width:100%;
+}
+
+.TB_overlayMacFFBGHack {background: url(macFFBgHack.png) repeat;}
+.TB_overlayBG {
+       background-color:#000;
+       filter:alpha(opacity=75);
+       -moz-opacity: 0.75;
+       opacity: 0.75;
+}
+
+* html #TB_overlay { /* ie6 hack */
+     position: absolute;
+     height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
+}
+
+#TB_window {
+       position: fixed;
+       background: #ffffff;
+       z-index: 102;
+       color:#000000;
+       display:none;
+       border: 4px solid #525252;
+       text-align:left;
+       top:50%;
+       left:50%;
+}
+
+* html #TB_window { /* ie6 hack */
+position: absolute;
+margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
+}
+
+#TB_window img#TB_Image {
+       display:block;
+       margin: 15px 0 0 15px;
+       border-right: 1px solid #ccc;
+       border-bottom: 1px solid #ccc;
+       border-top: 1px solid #666;
+       border-left: 1px solid #666;
+}
+
+#TB_caption{
+       height:25px;
+       padding:7px 30px 10px 25px;
+       float:left;
+}
+
+#TB_closeWindow{
+       height:25px;
+       padding:11px 25px 10px 0;
+       float:right;
+}
+
+#TB_closeAjaxWindow{
+       padding:7px 10px 5px 0;
+       margin-bottom:1px;
+       text-align:right;
+       float:right;
+}
+
+#TB_ajaxWindowTitle{
+       float:left;
+       padding:7px 0 5px 10px;
+       margin-bottom:1px;
+}
+
+#TB_title{
+       background-color:#e8e8e8;
+       height:27px;
+}
+
+#TB_ajaxContent{
+       clear:both;
+       padding:2px 15px 15px 15px;
+       overflow:auto;
+       text-align:left;
+       line-height:1.4em;
+}
+
+#TB_ajaxContent.TB_modal{
+       padding:15px;
+}
+
+#TB_ajaxContent p{
+       padding:5px 0px 5px 0px;
+}
+
+#TB_load{
+       position: fixed;
+       display:none;
+       height:13px;
+       width:208px;
+       z-index:103;
+       top: 50%;
+       left: 50%;
+       margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */
+}
+
+* html #TB_load { /* ie6 hack */
+position: absolute;
+margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
+}
+
+#TB_HideSelect{
+       z-index:99;
+       position:fixed;
+       top: 0;
+       left: 0;
+       background-color:#fff;
+       border:none;
+       filter:alpha(opacity=0);
+       -moz-opacity: 0;
+       opacity: 0;
+       height:100%;
+       width:100%;
+}
+
+* html #TB_HideSelect { /* ie6 hack */
+     position: absolute;
+     height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
+}
+
+#TB_iframeContent{
+       clear:both;
+       border:none;
+       margin-bottom:-1px;
+       margin-top:1px;
+       _margin-bottom:1px;
+}
diff --git a/theme/base/images/icons/icon_atom.jpg b/theme/base/images/icons/icon_atom.jpg
new file mode 100644 (file)
index 0000000..22853ed
Binary files /dev/null and b/theme/base/images/icons/icon_atom.jpg differ
diff --git a/theme/base/images/icons/icon_foaf.gif b/theme/base/images/icons/icon_foaf.gif
new file mode 100644 (file)
index 0000000..f8f7844
Binary files /dev/null and b/theme/base/images/icons/icon_foaf.gif differ
diff --git a/theme/base/images/icons/icon_rss.jpg b/theme/base/images/icons/icon_rss.jpg
new file mode 100644 (file)
index 0000000..da23422
Binary files /dev/null and b/theme/base/images/icons/icon_rss.jpg differ
diff --git a/theme/base/images/icons/icon_vcard.gif b/theme/base/images/icons/icon_vcard.gif
new file mode 100644 (file)
index 0000000..6d52947
Binary files /dev/null and b/theme/base/images/icons/icon_vcard.gif differ
diff --git a/theme/base/images/illustrations/illu_jcrop.gif b/theme/base/images/illustrations/illu_jcrop.gif
new file mode 100644 (file)
index 0000000..72ea7cc
Binary files /dev/null and b/theme/base/images/illustrations/illu_jcrop.gif differ
diff --git a/theme/base/images/illustrations/illu_progress_loading-01.gif b/theme/base/images/illustrations/illu_progress_loading-01.gif
new file mode 100644 (file)
index 0000000..82290f4
Binary files /dev/null and b/theme/base/images/illustrations/illu_progress_loading-01.gif differ
diff --git a/theme/default/css/display.css b/theme/default/css/display.css
new file mode 100644 (file)
index 0000000..2b71b07
--- /dev/null
@@ -0,0 +1,245 @@
+/* theme: identica */
+html,
+body,
+a:active {
+background-color:#CEE1E9;
+}
+body {
+font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
+font-size:1em;
+}
+address {
+margin-right:71px;
+}
+address .fn {
+display:none;
+}
+
+input, textarea, select, option {
+font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
+}
+input, textarea, select {
+border-color:#aaa;
+}
+
+input.submit,
+#form_notice.warning #notice_text-count,
+#nav_register a,
+.form_settings .form_note {
+background-color:#A9BF4F;
+}
+
+input:focus, textarea:focus, select:focus,
+#form_notice.warning #notice_data-text {
+border-color:#A9BF4F;
+}
+input.submit,
+#nav_register a {
+color:#F5FDFD;
+}
+
+a,
+div.notice-options input {
+color:#002E6E;
+}
+
+.notice p.entry-content a:visited {
+background-color:#fcfcfc;
+}
+.notice p.entry-content .vcard a {
+background-color:#fcfffc;
+}
+
+#aside_primary,
+#user_subscribe a,
+#TB_window input.submit,
+.form_user_subscribe input.submit {
+background-color:#fff;
+}
+
+
+#notice_text-count {
+color:#333;
+}
+#form_notice.warning #notice_text-count,
+#user_actions a {
+color:#000;
+}
+
+#form_notice #notice_data-attach_view {
+background-image:url(../images/icons/twotone/green/paper-clip.gif);
+background-repeat:no-repeat;
+background-position:0 45%;
+background-color:transparent;
+}
+
+#nav_register a {
+text-decoration:none;
+font-weight:bold;
+padding:2px 4px;
+}
+
+#content,
+#site_nav_local_views a {
+border-color:#F5FDFD;
+}
+#content,
+#site_nav_local_views .current a {
+background-color:#F5FDFD;
+}
+
+#site_nav_local_views a {
+background-color:rgba(255, 255, 255, 0.2);
+}
+#site_nav_local_views a:hover {
+background-color:rgba(255, 255, 255, 0.7);
+}
+
+
+
+
+#page_notice .error {
+background-color:#F7E8E8;
+}
+#page_notice .success {
+background-color:#EFF3DC;
+}
+
+#export_data li a {
+background-repeat:no-repeat;
+background-position:0 45%;
+}
+#export_data li a.rss {
+background-image:url(../../base/images/icons/icon_rss.jpg);
+}
+#export_data li a.atom {
+background-image:url(../../base/images/icons/icon_atom.jpg);
+}
+#export_data li a.foaf {
+background-image:url(../../base/images/icons/icon_foaf.gif);
+}
+#export_data li a.export_vcard {
+background-image:url(../../base/images/icons/icon_vcard.gif);
+}
+
+
+/*user_actions*/
+#user_actions li {
+border-top-color:#eee;
+}
+#user_subscribe a,
+#TB_window input.submit,
+.form_user_subscribe input.submit {
+background-image: url(../images/icons/twotone/green/shield.gif);
+background-position: 0 45%;
+background-repeat: no-repeat;
+}
+.form_user_unsubscribe input.submit {
+background-color:#647819;
+color:#F5FDFD;
+}
+#user_send-a-message a {
+background:url(../images/icons/twotone/green/quote.gif) 0 45% no-repeat;
+}
+.form_user_nudge input.submit {
+background:url(../images/icons/twotone/green/mail.gif) 0 45% no-repeat;
+}
+.form_user_block input.submit {
+background:url(../images/icons/twotone/green/against.gif) 0 45% no-repeat;
+}
+
+
+/* NOTICES */
+.notices li.over {
+background-color:#fcfcfc;
+}
+
+.notice-data a span {
+background-color:transparent;
+background-repeat:no-repeat;
+background-position:0 45%;
+}
+.notice_video .notice-data a span {
+background-image:url(../images/icons/twotone/green/camera.gif);
+}
+.notice_audio .notice-data a span {
+background-image:url(../images/icons/twotone/green/music.gif);
+}
+.notice_image .notice-data a span {
+background-image:url(../images/icons/twotone/green/search.gif);
+}
+.notice_event .notice-data a span {
+background-image:url(../images/icons/twotone/green/calendar.gif);
+}
+.notice_location .notice-data a span {
+background-image:url(../images/icons/twotone/green/flag.gif);
+}
+.notice_document .notice-data a span {
+background-image:url(../images/icons/twotone/green/document.gif);
+}
+
+.notice-options .notice_reply a,
+.notice-options form input.submit {
+background-color:transparent;
+}
+.notice-options .notice_reply a {
+background:transparent url(../images/icons/twotone/green/reply.gif) no-repeat 0 45%;
+}
+.notice-options form.form_favor input.submit {
+background:transparent url(../images/icons/twotone/green/favourite.gif) no-repeat 0 45%;
+}
+.notice-options form.form_disfavor input.submit {
+background:transparent url(../images/icons/twotone/green/disfavourite.gif) no-repeat 0 45%;
+}
+.notice-options .notice_delete a {
+background:transparent url(../images/icons/twotone/green/trash.gif) no-repeat 0 45%;
+}
+
+div.notice-options {
+opacity:0.3;
+}
+.notices li.hover div.notice-options {
+opacity:1;
+}
+div.entry-content {
+color:#333;
+}
+div.notice-options a,
+div.notice-options input {
+font-family:sans-serif;
+}
+.notices li.hover {
+background-color:#fcfcfc;
+}
+/*END: NOTICES */
+
+
+
+.pagination .nav_prev a,
+.pagination .nav_next a {
+background-repeat:no-repeat;
+}
+.pagination .nav_prev a {
+background-image:url(../images/icons/twotone/green/arrow-left.gif);
+background-position:0 45%;
+}
+.pagination .nav_next a {
+background-image:url(../images/icons/twotone/green/arrow-right.gif);
+background-position:100% 45%;
+}
+
+
+
+#home #intro #guide_steps li a {
+border-color:#ccc;
+color:#F5FDFD;
+}
+#home #intro #step_join-now a {
+background-color:#f00;
+}
+#home #intro #step_start-a-group a {
+background-color:#0f0;
+}
+#home #intro #step_create-a-community a {
+background-color:#00f;
+}
\ No newline at end of file
diff --git a/theme/default/images/icons/icon_atom.jpg b/theme/default/images/icons/icon_atom.jpg
new file mode 100644 (file)
index 0000000..22853ed
Binary files /dev/null and b/theme/default/images/icons/icon_atom.jpg differ
diff --git a/theme/default/images/icons/icon_foaf.gif b/theme/default/images/icons/icon_foaf.gif
new file mode 100644 (file)
index 0000000..f8f7844
Binary files /dev/null and b/theme/default/images/icons/icon_foaf.gif differ
diff --git a/theme/default/images/icons/icon_rss.jpg b/theme/default/images/icons/icon_rss.jpg
new file mode 100644 (file)
index 0000000..da23422
Binary files /dev/null and b/theme/default/images/icons/icon_rss.jpg differ
diff --git a/theme/default/images/icons/icon_vcard.gif b/theme/default/images/icons/icon_vcard.gif
new file mode 100644 (file)
index 0000000..6d52947
Binary files /dev/null and b/theme/default/images/icons/icon_vcard.gif differ
diff --git a/theme/default/images/icons/twotone/green/against.gif b/theme/default/images/icons/twotone/green/against.gif
new file mode 100644 (file)
index 0000000..ca796c8
Binary files /dev/null and b/theme/default/images/icons/twotone/green/against.gif differ
diff --git a/theme/default/images/icons/twotone/green/arrow-down.gif b/theme/default/images/icons/twotone/green/arrow-down.gif
new file mode 100644 (file)
index 0000000..c709e58
Binary files /dev/null and b/theme/default/images/icons/twotone/green/arrow-down.gif differ
diff --git a/theme/default/images/icons/twotone/green/arrow-downleft.gif b/theme/default/images/icons/twotone/green/arrow-downleft.gif
new file mode 100644 (file)
index 0000000..a4a9803
Binary files /dev/null and b/theme/default/images/icons/twotone/green/arrow-downleft.gif differ
diff --git a/theme/default/images/icons/twotone/green/arrow-downright.gif b/theme/default/images/icons/twotone/green/arrow-downright.gif
new file mode 100644 (file)
index 0000000..3e6001a
Binary files /dev/null and b/theme/default/images/icons/twotone/green/arrow-downright.gif differ
diff --git a/theme/default/images/icons/twotone/green/arrow-left.gif b/theme/default/images/icons/twotone/green/arrow-left.gif
new file mode 100644 (file)
index 0000000..afed190
Binary files /dev/null and b/theme/default/images/icons/twotone/green/arrow-left.gif differ
diff --git a/theme/default/images/icons/twotone/green/arrow-right.gif b/theme/default/images/icons/twotone/green/arrow-right.gif
new file mode 100644 (file)
index 0000000..ee1707e
Binary files /dev/null and b/theme/default/images/icons/twotone/green/arrow-right.gif differ
diff --git a/theme/default/images/icons/twotone/green/arrow-up.gif b/theme/default/images/icons/twotone/green/arrow-up.gif
new file mode 100644 (file)
index 0000000..d0f5fbe
Binary files /dev/null and b/theme/default/images/icons/twotone/green/arrow-up.gif differ
diff --git a/theme/default/images/icons/twotone/green/arrow-upleft.gif b/theme/default/images/icons/twotone/green/arrow-upleft.gif
new file mode 100644 (file)
index 0000000..1e9e693
Binary files /dev/null and b/theme/default/images/icons/twotone/green/arrow-upleft.gif differ
diff --git a/theme/default/images/icons/twotone/green/arrow-upright.gif b/theme/default/images/icons/twotone/green/arrow-upright.gif
new file mode 100644 (file)
index 0000000..c7fecc8
Binary files /dev/null and b/theme/default/images/icons/twotone/green/arrow-upright.gif differ
diff --git a/theme/default/images/icons/twotone/green/back-forth.gif b/theme/default/images/icons/twotone/green/back-forth.gif
new file mode 100644 (file)
index 0000000..33a9540
Binary files /dev/null and b/theme/default/images/icons/twotone/green/back-forth.gif differ
diff --git a/theme/default/images/icons/twotone/green/bookmark.gif b/theme/default/images/icons/twotone/green/bookmark.gif
new file mode 100644 (file)
index 0000000..23f318e
Binary files /dev/null and b/theme/default/images/icons/twotone/green/bookmark.gif differ
diff --git a/theme/default/images/icons/twotone/green/bulb.gif b/theme/default/images/icons/twotone/green/bulb.gif
new file mode 100644 (file)
index 0000000..f70652c
Binary files /dev/null and b/theme/default/images/icons/twotone/green/bulb.gif differ
diff --git a/theme/default/images/icons/twotone/green/calendar.gif b/theme/default/images/icons/twotone/green/calendar.gif
new file mode 100644 (file)
index 0000000..a09b65a
Binary files /dev/null and b/theme/default/images/icons/twotone/green/calendar.gif differ
diff --git a/theme/default/images/icons/twotone/green/calendar2.gif b/theme/default/images/icons/twotone/green/calendar2.gif
new file mode 100644 (file)
index 0000000..7884b02
Binary files /dev/null and b/theme/default/images/icons/twotone/green/calendar2.gif differ
diff --git a/theme/default/images/icons/twotone/green/camera.gif b/theme/default/images/icons/twotone/green/camera.gif
new file mode 100644 (file)
index 0000000..1a85fba
Binary files /dev/null and b/theme/default/images/icons/twotone/green/camera.gif differ
diff --git a/theme/default/images/icons/twotone/green/cart.gif b/theme/default/images/icons/twotone/green/cart.gif
new file mode 100644 (file)
index 0000000..47eaa0a
Binary files /dev/null and b/theme/default/images/icons/twotone/green/cart.gif differ
diff --git a/theme/default/images/icons/twotone/green/caution.gif b/theme/default/images/icons/twotone/green/caution.gif
new file mode 100644 (file)
index 0000000..3ad2c32
Binary files /dev/null and b/theme/default/images/icons/twotone/green/caution.gif differ
diff --git a/theme/default/images/icons/twotone/green/chart.gif b/theme/default/images/icons/twotone/green/chart.gif
new file mode 100644 (file)
index 0000000..136d745
Binary files /dev/null and b/theme/default/images/icons/twotone/green/chart.gif differ
diff --git a/theme/default/images/icons/twotone/green/checkmark.gif b/theme/default/images/icons/twotone/green/checkmark.gif
new file mode 100644 (file)
index 0000000..892429d
Binary files /dev/null and b/theme/default/images/icons/twotone/green/checkmark.gif differ
diff --git a/theme/default/images/icons/twotone/green/clipboard.gif b/theme/default/images/icons/twotone/green/clipboard.gif
new file mode 100644 (file)
index 0000000..9317bdc
Binary files /dev/null and b/theme/default/images/icons/twotone/green/clipboard.gif differ
diff --git a/theme/default/images/icons/twotone/green/clock.gif b/theme/default/images/icons/twotone/green/clock.gif
new file mode 100644 (file)
index 0000000..d1410f9
Binary files /dev/null and b/theme/default/images/icons/twotone/green/clock.gif differ
diff --git a/theme/default/images/icons/twotone/green/closed-folder.gif b/theme/default/images/icons/twotone/green/closed-folder.gif
new file mode 100644 (file)
index 0000000..0410fc6
Binary files /dev/null and b/theme/default/images/icons/twotone/green/closed-folder.gif differ
diff --git a/theme/default/images/icons/twotone/green/database.gif b/theme/default/images/icons/twotone/green/database.gif
new file mode 100644 (file)
index 0000000..29ce024
Binary files /dev/null and b/theme/default/images/icons/twotone/green/database.gif differ
diff --git a/theme/default/images/icons/twotone/green/disfavourite.gif b/theme/default/images/icons/twotone/green/disfavourite.gif
new file mode 100644 (file)
index 0000000..3946869
Binary files /dev/null and b/theme/default/images/icons/twotone/green/disfavourite.gif differ
diff --git a/theme/default/images/icons/twotone/green/diskette.gif b/theme/default/images/icons/twotone/green/diskette.gif
new file mode 100644 (file)
index 0000000..e970b0a
Binary files /dev/null and b/theme/default/images/icons/twotone/green/diskette.gif differ
diff --git a/theme/default/images/icons/twotone/green/document.gif b/theme/default/images/icons/twotone/green/document.gif
new file mode 100644 (file)
index 0000000..9c08f4a
Binary files /dev/null and b/theme/default/images/icons/twotone/green/document.gif differ
diff --git a/theme/default/images/icons/twotone/green/double-arrow.gif b/theme/default/images/icons/twotone/green/double-arrow.gif
new file mode 100644 (file)
index 0000000..2e86482
Binary files /dev/null and b/theme/default/images/icons/twotone/green/double-arrow.gif differ
diff --git a/theme/default/images/icons/twotone/green/edit.gif b/theme/default/images/icons/twotone/green/edit.gif
new file mode 100644 (file)
index 0000000..c746aca
Binary files /dev/null and b/theme/default/images/icons/twotone/green/edit.gif differ
diff --git a/theme/default/images/icons/twotone/green/eject.gif b/theme/default/images/icons/twotone/green/eject.gif
new file mode 100644 (file)
index 0000000..7e0906c
Binary files /dev/null and b/theme/default/images/icons/twotone/green/eject.gif differ
diff --git a/theme/default/images/icons/twotone/green/exclaim.gif b/theme/default/images/icons/twotone/green/exclaim.gif
new file mode 100644 (file)
index 0000000..588e28c
Binary files /dev/null and b/theme/default/images/icons/twotone/green/exclaim.gif differ
diff --git a/theme/default/images/icons/twotone/green/fastforward.gif b/theme/default/images/icons/twotone/green/fastforward.gif
new file mode 100644 (file)
index 0000000..28e4951
Binary files /dev/null and b/theme/default/images/icons/twotone/green/fastforward.gif differ
diff --git a/theme/default/images/icons/twotone/green/favourite.gif b/theme/default/images/icons/twotone/green/favourite.gif
new file mode 100644 (file)
index 0000000..d93515e
Binary files /dev/null and b/theme/default/images/icons/twotone/green/favourite.gif differ
diff --git a/theme/default/images/icons/twotone/green/flag.gif b/theme/default/images/icons/twotone/green/flag.gif
new file mode 100644 (file)
index 0000000..68c8aee
Binary files /dev/null and b/theme/default/images/icons/twotone/green/flag.gif differ
diff --git a/theme/default/images/icons/twotone/green/graph.gif b/theme/default/images/icons/twotone/green/graph.gif
new file mode 100644 (file)
index 0000000..0c1794b
Binary files /dev/null and b/theme/default/images/icons/twotone/green/graph.gif differ
diff --git a/theme/default/images/icons/twotone/green/grow.gif b/theme/default/images/icons/twotone/green/grow.gif
new file mode 100644 (file)
index 0000000..c4118d5
Binary files /dev/null and b/theme/default/images/icons/twotone/green/grow.gif differ
diff --git a/theme/default/images/icons/twotone/green/headphones.gif b/theme/default/images/icons/twotone/green/headphones.gif
new file mode 100644 (file)
index 0000000..5be6c67
Binary files /dev/null and b/theme/default/images/icons/twotone/green/headphones.gif differ
diff --git a/theme/default/images/icons/twotone/green/home.gif b/theme/default/images/icons/twotone/green/home.gif
new file mode 100644 (file)
index 0000000..d2a3421
Binary files /dev/null and b/theme/default/images/icons/twotone/green/home.gif differ
diff --git a/theme/default/images/icons/twotone/green/hourglass.gif b/theme/default/images/icons/twotone/green/hourglass.gif
new file mode 100644 (file)
index 0000000..b62b948
Binary files /dev/null and b/theme/default/images/icons/twotone/green/hourglass.gif differ
diff --git a/theme/default/images/icons/twotone/green/info.gif b/theme/default/images/icons/twotone/green/info.gif
new file mode 100644 (file)
index 0000000..86ef1f8
Binary files /dev/null and b/theme/default/images/icons/twotone/green/info.gif differ
diff --git a/theme/default/images/icons/twotone/green/key.gif b/theme/default/images/icons/twotone/green/key.gif
new file mode 100644 (file)
index 0000000..ccf357a
Binary files /dev/null and b/theme/default/images/icons/twotone/green/key.gif differ
diff --git a/theme/default/images/icons/twotone/green/lock.gif b/theme/default/images/icons/twotone/green/lock.gif
new file mode 100644 (file)
index 0000000..db00706
Binary files /dev/null and b/theme/default/images/icons/twotone/green/lock.gif differ
diff --git a/theme/default/images/icons/twotone/green/mail.gif b/theme/default/images/icons/twotone/green/mail.gif
new file mode 100644 (file)
index 0000000..1084c86
Binary files /dev/null and b/theme/default/images/icons/twotone/green/mail.gif differ
diff --git a/theme/default/images/icons/twotone/green/move.gif b/theme/default/images/icons/twotone/green/move.gif
new file mode 100644 (file)
index 0000000..d2c30b1
Binary files /dev/null and b/theme/default/images/icons/twotone/green/move.gif differ
diff --git a/theme/default/images/icons/twotone/green/music.gif b/theme/default/images/icons/twotone/green/music.gif
new file mode 100644 (file)
index 0000000..64b51d4
Binary files /dev/null and b/theme/default/images/icons/twotone/green/music.gif differ
diff --git a/theme/default/images/icons/twotone/green/news.gif b/theme/default/images/icons/twotone/green/news.gif
new file mode 100644 (file)
index 0000000..712c685
Binary files /dev/null and b/theme/default/images/icons/twotone/green/news.gif differ
diff --git a/theme/default/images/icons/twotone/green/note.gif b/theme/default/images/icons/twotone/green/note.gif
new file mode 100644 (file)
index 0000000..bcc0b14
Binary files /dev/null and b/theme/default/images/icons/twotone/green/note.gif differ
diff --git a/theme/default/images/icons/twotone/green/open-folder.gif b/theme/default/images/icons/twotone/green/open-folder.gif
new file mode 100644 (file)
index 0000000..d41300a
Binary files /dev/null and b/theme/default/images/icons/twotone/green/open-folder.gif differ
diff --git a/theme/default/images/icons/twotone/green/paper-clip.gif b/theme/default/images/icons/twotone/green/paper-clip.gif
new file mode 100644 (file)
index 0000000..1d45f1d
Binary files /dev/null and b/theme/default/images/icons/twotone/green/paper-clip.gif differ
diff --git a/theme/default/images/icons/twotone/green/paper-clip2.gif b/theme/default/images/icons/twotone/green/paper-clip2.gif
new file mode 100644 (file)
index 0000000..a8c7805
Binary files /dev/null and b/theme/default/images/icons/twotone/green/paper-clip2.gif differ
diff --git a/theme/default/images/icons/twotone/green/pause.gif b/theme/default/images/icons/twotone/green/pause.gif
new file mode 100644 (file)
index 0000000..ced0b64
Binary files /dev/null and b/theme/default/images/icons/twotone/green/pause.gif differ
diff --git a/theme/default/images/icons/twotone/green/phone.gif b/theme/default/images/icons/twotone/green/phone.gif
new file mode 100644 (file)
index 0000000..69359f7
Binary files /dev/null and b/theme/default/images/icons/twotone/green/phone.gif differ
diff --git a/theme/default/images/icons/twotone/green/play.gif b/theme/default/images/icons/twotone/green/play.gif
new file mode 100644 (file)
index 0000000..794ec85
Binary files /dev/null and b/theme/default/images/icons/twotone/green/play.gif differ
diff --git a/theme/default/images/icons/twotone/green/plus.gif b/theme/default/images/icons/twotone/green/plus.gif
new file mode 100644 (file)
index 0000000..4407d0b
Binary files /dev/null and b/theme/default/images/icons/twotone/green/plus.gif differ
diff --git a/theme/default/images/icons/twotone/green/print.gif b/theme/default/images/icons/twotone/green/print.gif
new file mode 100644 (file)
index 0000000..17727d5
Binary files /dev/null and b/theme/default/images/icons/twotone/green/print.gif differ
diff --git a/theme/default/images/icons/twotone/green/question-mark.gif b/theme/default/images/icons/twotone/green/question-mark.gif
new file mode 100644 (file)
index 0000000..1689efc
Binary files /dev/null and b/theme/default/images/icons/twotone/green/question-mark.gif differ
diff --git a/theme/default/images/icons/twotone/green/quote.gif b/theme/default/images/icons/twotone/green/quote.gif
new file mode 100644 (file)
index 0000000..4ba1f0c
Binary files /dev/null and b/theme/default/images/icons/twotone/green/quote.gif differ
diff --git a/theme/default/images/icons/twotone/green/refresh.gif b/theme/default/images/icons/twotone/green/refresh.gif
new file mode 100644 (file)
index 0000000..8a8b814
Binary files /dev/null and b/theme/default/images/icons/twotone/green/refresh.gif differ
diff --git a/theme/default/images/icons/twotone/green/reply.gif b/theme/default/images/icons/twotone/green/reply.gif
new file mode 100644 (file)
index 0000000..6ff01bb
Binary files /dev/null and b/theme/default/images/icons/twotone/green/reply.gif differ
diff --git a/theme/default/images/icons/twotone/green/rewind.gif b/theme/default/images/icons/twotone/green/rewind.gif
new file mode 100644 (file)
index 0000000..aca3ee3
Binary files /dev/null and b/theme/default/images/icons/twotone/green/rewind.gif differ
diff --git a/theme/default/images/icons/twotone/green/search.gif b/theme/default/images/icons/twotone/green/search.gif
new file mode 100644 (file)
index 0000000..c36463d
Binary files /dev/null and b/theme/default/images/icons/twotone/green/search.gif differ
diff --git a/theme/default/images/icons/twotone/green/shield.gif b/theme/default/images/icons/twotone/green/shield.gif
new file mode 100644 (file)
index 0000000..419d5ee
Binary files /dev/null and b/theme/default/images/icons/twotone/green/shield.gif differ
diff --git a/theme/default/images/icons/twotone/green/skip-back.gif b/theme/default/images/icons/twotone/green/skip-back.gif
new file mode 100644 (file)
index 0000000..adca7aa
Binary files /dev/null and b/theme/default/images/icons/twotone/green/skip-back.gif differ
diff --git a/theme/default/images/icons/twotone/green/skip.gif b/theme/default/images/icons/twotone/green/skip.gif
new file mode 100644 (file)
index 0000000..ae5417f
Binary files /dev/null and b/theme/default/images/icons/twotone/green/skip.gif differ
diff --git a/theme/default/images/icons/twotone/green/skull.gif b/theme/default/images/icons/twotone/green/skull.gif
new file mode 100644 (file)
index 0000000..0335067
Binary files /dev/null and b/theme/default/images/icons/twotone/green/skull.gif differ
diff --git a/theme/default/images/icons/twotone/green/statusbar.gif b/theme/default/images/icons/twotone/green/statusbar.gif
new file mode 100644 (file)
index 0000000..47d61b1
Binary files /dev/null and b/theme/default/images/icons/twotone/green/statusbar.gif differ
diff --git a/theme/default/images/icons/twotone/green/stop.gif b/theme/default/images/icons/twotone/green/stop.gif
new file mode 100644 (file)
index 0000000..e0b108d
Binary files /dev/null and b/theme/default/images/icons/twotone/green/stop.gif differ
diff --git a/theme/default/images/icons/twotone/green/template.gif b/theme/default/images/icons/twotone/green/template.gif
new file mode 100644 (file)
index 0000000..65c0c4a
Binary files /dev/null and b/theme/default/images/icons/twotone/green/template.gif differ
diff --git a/theme/default/images/icons/twotone/green/text-bigger.gif b/theme/default/images/icons/twotone/green/text-bigger.gif
new file mode 100644 (file)
index 0000000..45e143b
Binary files /dev/null and b/theme/default/images/icons/twotone/green/text-bigger.gif differ
diff --git a/theme/default/images/icons/twotone/green/text-smaller.gif b/theme/default/images/icons/twotone/green/text-smaller.gif
new file mode 100644 (file)
index 0000000..a54d0c1
Binary files /dev/null and b/theme/default/images/icons/twotone/green/text-smaller.gif differ
diff --git a/theme/default/images/icons/twotone/green/trash.gif b/theme/default/images/icons/twotone/green/trash.gif
new file mode 100644 (file)
index 0000000..78dd64a
Binary files /dev/null and b/theme/default/images/icons/twotone/green/trash.gif differ
diff --git a/theme/default/images/icons/twotone/green/two-docs.gif b/theme/default/images/icons/twotone/green/two-docs.gif
new file mode 100644 (file)
index 0000000..97e54b9
Binary files /dev/null and b/theme/default/images/icons/twotone/green/two-docs.gif differ
diff --git a/theme/default/images/icons/twotone/green/twotone.gif b/theme/default/images/icons/twotone/green/twotone.gif
new file mode 100644 (file)
index 0000000..45aad25
Binary files /dev/null and b/theme/default/images/icons/twotone/green/twotone.gif differ
diff --git a/theme/default/images/icons/twotone/green/undo.gif b/theme/default/images/icons/twotone/green/undo.gif
new file mode 100644 (file)
index 0000000..6869b30
Binary files /dev/null and b/theme/default/images/icons/twotone/green/undo.gif differ
diff --git a/theme/default/images/icons/twotone/green/user.gif b/theme/default/images/icons/twotone/green/user.gif
new file mode 100644 (file)
index 0000000..c85460f
Binary files /dev/null and b/theme/default/images/icons/twotone/green/user.gif differ
diff --git a/theme/default/images/icons/twotone/green/vegetable.gif b/theme/default/images/icons/twotone/green/vegetable.gif
new file mode 100644 (file)
index 0000000..4d421c1
Binary files /dev/null and b/theme/default/images/icons/twotone/green/vegetable.gif differ
diff --git a/theme/default/images/icons/twotone/green/x.gif b/theme/default/images/icons/twotone/green/x.gif
new file mode 100644 (file)
index 0000000..ffb2efe
Binary files /dev/null and b/theme/default/images/icons/twotone/green/x.gif differ
diff --git a/theme/default/images/icons/twotone/green/zoom-in.gif b/theme/default/images/icons/twotone/green/zoom-in.gif
new file mode 100644 (file)
index 0000000..a59a5bb
Binary files /dev/null and b/theme/default/images/icons/twotone/green/zoom-in.gif differ
diff --git a/theme/default/images/icons/twotone/green/zoom-out.gif b/theme/default/images/icons/twotone/green/zoom-out.gif
new file mode 100644 (file)
index 0000000..c61f999
Binary files /dev/null and b/theme/default/images/icons/twotone/green/zoom-out.gif differ
diff --git a/theme/identica/css/display.css b/theme/identica/css/display.css
new file mode 100644 (file)
index 0000000..d5a5ce9
--- /dev/null
@@ -0,0 +1,245 @@
+/* theme: identica */
+html,
+body,
+a:active {
+background-color:#ddd;
+}
+body {
+font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
+font-size:1em;
+}
+address {
+margin-right:71px;
+}
+address .fn {
+display:none;
+}
+
+input, textarea, select, option {
+font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
+}
+input, textarea, select {
+border-color:#aaa;
+}
+
+input.submit,
+#form_notice.warning #notice_text-count,
+#nav_register a,
+.form_settings .form_note {
+background-color:#A9BF4F;
+}
+
+input:focus, textarea:focus, select:focus,
+#form_notice.warning #notice_data-text {
+border-color:#A9BF4F;
+}
+input.submit,
+#nav_register a {
+color:#fff;
+}
+
+a,
+div.notice-options input {
+color:#002E6E;
+}
+
+.notice p.entry-content a:visited {
+background-color:#fcfcfc;
+}
+.notice p.entry-content .vcard a {
+background-color:#fcfffc;
+}
+
+#aside_primary,
+#user_subscribe a,
+#TB_window input.submit,
+.form_user_subscribe input.submit {
+background-color:#CEE1E9;
+}
+
+
+#notice_text-count {
+color:#333;
+}
+#form_notice.warning #notice_text-count,
+#user_actions a {
+color:#000;
+}
+
+#form_notice #notice_data-attach_view {
+background-image:url(../images/icons/twotone/green/paper-clip.gif);
+background-repeat:no-repeat;
+background-position:0 45%;
+background-color:transparent;
+}
+
+#nav_register a {
+text-decoration:none;
+font-weight:bold;
+padding:2px 4px;
+}
+
+#content,
+#site_nav_local_views a {
+border-color:#fff;
+}
+#content,
+#site_nav_local_views .current a {
+background-color:#fff;
+}
+
+#site_nav_local_views a {
+background-color:rgba(255, 255, 255, 0.2);
+}
+#site_nav_local_views a:hover {
+background-color:rgba(255, 255, 255, 0.7);
+}
+
+
+
+
+#page_notice .error {
+background-color:#F7E8E8;
+}
+#page_notice .success {
+background-color:#EFF3DC;
+}
+
+#export_data li a {
+background-repeat:no-repeat;
+background-position:0 45%;
+}
+#export_data li a.rss {
+background-image:url(../../base/images/icons/icon_rss.jpg);
+}
+#export_data li a.atom {
+background-image:url(../../base/images/icons/icon_atom.jpg);
+}
+#export_data li a.foaf {
+background-image:url(../../base/images/icons/icon_foaf.gif);
+}
+#export_data li a.export_vcard {
+background-image:url(../../base/images/icons/icon_vcard.gif);
+}
+
+
+/*user_actions*/
+#user_actions li {
+border-top-color:#eee;
+}
+#user_subscribe a,
+#TB_window input.submit,
+.form_user_subscribe input.submit {
+background-image: url(../images/icons/twotone/green/shield.gif);
+background-position: 0 45%;
+background-repeat: no-repeat;
+}
+.form_user_unsubscribe input.submit {
+background-color:#647819;
+color:#fff;
+}
+#user_send-a-message a {
+background:url(../images/icons/twotone/green/quote.gif) 0 45% no-repeat;
+}
+.form_user_nudge input.submit {
+background:url(../images/icons/twotone/green/mail.gif) 0 45% no-repeat;
+}
+.form_user_block input.submit {
+background:url(../images/icons/twotone/green/against.gif) 0 45% no-repeat;
+}
+
+
+/* NOTICES */
+.notices li.over {
+background-color:#fcfcfc;
+}
+
+.notice-data a span {
+background-color:transparent;
+background-repeat:no-repeat;
+background-position:0 45%;
+}
+.notice_video .notice-data a span {
+background-image:url(../images/icons/twotone/green/camera.gif);
+}
+.notice_audio .notice-data a span {
+background-image:url(../images/icons/twotone/green/music.gif);
+}
+.notice_image .notice-data a span {
+background-image:url(../images/icons/twotone/green/search.gif);
+}
+.notice_event .notice-data a span {
+background-image:url(../images/icons/twotone/green/calendar.gif);
+}
+.notice_location .notice-data a span {
+background-image:url(../images/icons/twotone/green/flag.gif);
+}
+.notice_document .notice-data a span {
+background-image:url(../images/icons/twotone/green/document.gif);
+}
+
+.notice-options .notice_reply a,
+.notice-options form input.submit {
+background-color:transparent;
+}
+.notice-options .notice_reply a {
+background:transparent url(../images/icons/twotone/green/reply.gif) no-repeat 0 45%;
+}
+.notice-options form.form_favor input.submit {
+background:transparent url(../images/icons/twotone/green/favourite.gif) no-repeat 0 45%;
+}
+.notice-options form.form_disfavor input.submit {
+background:transparent url(../images/icons/twotone/green/disfavourite.gif) no-repeat 0 45%;
+}
+.notice-options .notice_delete a {
+background:transparent url(../images/icons/twotone/green/trash.gif) no-repeat 0 45%;
+}
+
+div.notice-options {
+opacity:0.3;
+}
+.notices li.hover div.notice-options {
+opacity:1;
+}
+div.entry-content {
+color:#333;
+}
+div.notice-options a,
+div.notice-options input {
+font-family:sans-serif;
+}
+.notices li.hover {
+background-color:#fcfcfc;
+}
+/*END: NOTICES */
+
+
+
+.pagination .nav_prev a,
+.pagination .nav_next a {
+background-repeat:no-repeat;
+}
+.pagination .nav_prev a {
+background-image:url(../images/icons/twotone/green/arrow-left.gif);
+background-position:0 45%;
+}
+.pagination .nav_next a {
+background-image:url(../images/icons/twotone/green/arrow-right.gif);
+background-position:100% 45%;
+}
+
+
+
+#home #intro #guide_steps li a {
+border-color:#ccc;
+color:#fff;
+}
+#home #intro #step_join-now a {
+background-color:#f00;
+}
+#home #intro #step_start-a-group a {
+background-color:#0f0;
+}
+#home #intro #step_create-a-community a {
+background-color:#00f;
+}
\ No newline at end of file
diff --git a/theme/identica/images/icons/icon_atom.jpg b/theme/identica/images/icons/icon_atom.jpg
new file mode 100644 (file)
index 0000000..22853ed
Binary files /dev/null and b/theme/identica/images/icons/icon_atom.jpg differ
diff --git a/theme/identica/images/icons/icon_foaf.gif b/theme/identica/images/icons/icon_foaf.gif
new file mode 100644 (file)
index 0000000..f8f7844
Binary files /dev/null and b/theme/identica/images/icons/icon_foaf.gif differ
diff --git a/theme/identica/images/icons/icon_rss.jpg b/theme/identica/images/icons/icon_rss.jpg
new file mode 100644 (file)
index 0000000..da23422
Binary files /dev/null and b/theme/identica/images/icons/icon_rss.jpg differ
diff --git a/theme/identica/images/icons/icon_vcard.gif b/theme/identica/images/icons/icon_vcard.gif
new file mode 100644 (file)
index 0000000..6d52947
Binary files /dev/null and b/theme/identica/images/icons/icon_vcard.gif differ
diff --git a/theme/identica/images/icons/twotone/green/against.gif b/theme/identica/images/icons/twotone/green/against.gif
new file mode 100644 (file)
index 0000000..ca796c8
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/against.gif differ
diff --git a/theme/identica/images/icons/twotone/green/arrow-down.gif b/theme/identica/images/icons/twotone/green/arrow-down.gif
new file mode 100644 (file)
index 0000000..c709e58
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/arrow-down.gif differ
diff --git a/theme/identica/images/icons/twotone/green/arrow-downleft.gif b/theme/identica/images/icons/twotone/green/arrow-downleft.gif
new file mode 100644 (file)
index 0000000..a4a9803
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/arrow-downleft.gif differ
diff --git a/theme/identica/images/icons/twotone/green/arrow-downright.gif b/theme/identica/images/icons/twotone/green/arrow-downright.gif
new file mode 100644 (file)
index 0000000..3e6001a
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/arrow-downright.gif differ
diff --git a/theme/identica/images/icons/twotone/green/arrow-left.gif b/theme/identica/images/icons/twotone/green/arrow-left.gif
new file mode 100644 (file)
index 0000000..afed190
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/arrow-left.gif differ
diff --git a/theme/identica/images/icons/twotone/green/arrow-right.gif b/theme/identica/images/icons/twotone/green/arrow-right.gif
new file mode 100644 (file)
index 0000000..ee1707e
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/arrow-right.gif differ
diff --git a/theme/identica/images/icons/twotone/green/arrow-up.gif b/theme/identica/images/icons/twotone/green/arrow-up.gif
new file mode 100644 (file)
index 0000000..d0f5fbe
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/arrow-up.gif differ
diff --git a/theme/identica/images/icons/twotone/green/arrow-upleft.gif b/theme/identica/images/icons/twotone/green/arrow-upleft.gif
new file mode 100644 (file)
index 0000000..1e9e693
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/arrow-upleft.gif differ
diff --git a/theme/identica/images/icons/twotone/green/arrow-upright.gif b/theme/identica/images/icons/twotone/green/arrow-upright.gif
new file mode 100644 (file)
index 0000000..c7fecc8
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/arrow-upright.gif differ
diff --git a/theme/identica/images/icons/twotone/green/back-forth.gif b/theme/identica/images/icons/twotone/green/back-forth.gif
new file mode 100644 (file)
index 0000000..33a9540
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/back-forth.gif differ
diff --git a/theme/identica/images/icons/twotone/green/bookmark.gif b/theme/identica/images/icons/twotone/green/bookmark.gif
new file mode 100644 (file)
index 0000000..23f318e
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/bookmark.gif differ
diff --git a/theme/identica/images/icons/twotone/green/bulb.gif b/theme/identica/images/icons/twotone/green/bulb.gif
new file mode 100644 (file)
index 0000000..f70652c
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/bulb.gif differ
diff --git a/theme/identica/images/icons/twotone/green/calendar.gif b/theme/identica/images/icons/twotone/green/calendar.gif
new file mode 100644 (file)
index 0000000..a09b65a
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/calendar.gif differ
diff --git a/theme/identica/images/icons/twotone/green/calendar2.gif b/theme/identica/images/icons/twotone/green/calendar2.gif
new file mode 100644 (file)
index 0000000..7884b02
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/calendar2.gif differ
diff --git a/theme/identica/images/icons/twotone/green/camera.gif b/theme/identica/images/icons/twotone/green/camera.gif
new file mode 100644 (file)
index 0000000..1a85fba
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/camera.gif differ
diff --git a/theme/identica/images/icons/twotone/green/cart.gif b/theme/identica/images/icons/twotone/green/cart.gif
new file mode 100644 (file)
index 0000000..47eaa0a
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/cart.gif differ
diff --git a/theme/identica/images/icons/twotone/green/caution.gif b/theme/identica/images/icons/twotone/green/caution.gif
new file mode 100644 (file)
index 0000000..3ad2c32
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/caution.gif differ
diff --git a/theme/identica/images/icons/twotone/green/chart.gif b/theme/identica/images/icons/twotone/green/chart.gif
new file mode 100644 (file)
index 0000000..136d745
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/chart.gif differ
diff --git a/theme/identica/images/icons/twotone/green/checkmark.gif b/theme/identica/images/icons/twotone/green/checkmark.gif
new file mode 100644 (file)
index 0000000..892429d
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/checkmark.gif differ
diff --git a/theme/identica/images/icons/twotone/green/clipboard.gif b/theme/identica/images/icons/twotone/green/clipboard.gif
new file mode 100644 (file)
index 0000000..9317bdc
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/clipboard.gif differ
diff --git a/theme/identica/images/icons/twotone/green/clock.gif b/theme/identica/images/icons/twotone/green/clock.gif
new file mode 100644 (file)
index 0000000..d1410f9
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/clock.gif differ
diff --git a/theme/identica/images/icons/twotone/green/closed-folder.gif b/theme/identica/images/icons/twotone/green/closed-folder.gif
new file mode 100644 (file)
index 0000000..0410fc6
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/closed-folder.gif differ
diff --git a/theme/identica/images/icons/twotone/green/database.gif b/theme/identica/images/icons/twotone/green/database.gif
new file mode 100644 (file)
index 0000000..29ce024
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/database.gif differ
diff --git a/theme/identica/images/icons/twotone/green/disfavourite.gif b/theme/identica/images/icons/twotone/green/disfavourite.gif
new file mode 100644 (file)
index 0000000..3946869
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/disfavourite.gif differ
diff --git a/theme/identica/images/icons/twotone/green/diskette.gif b/theme/identica/images/icons/twotone/green/diskette.gif
new file mode 100644 (file)
index 0000000..e970b0a
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/diskette.gif differ
diff --git a/theme/identica/images/icons/twotone/green/document.gif b/theme/identica/images/icons/twotone/green/document.gif
new file mode 100644 (file)
index 0000000..9c08f4a
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/document.gif differ
diff --git a/theme/identica/images/icons/twotone/green/double-arrow.gif b/theme/identica/images/icons/twotone/green/double-arrow.gif
new file mode 100644 (file)
index 0000000..2e86482
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/double-arrow.gif differ
diff --git a/theme/identica/images/icons/twotone/green/edit.gif b/theme/identica/images/icons/twotone/green/edit.gif
new file mode 100644 (file)
index 0000000..c746aca
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/edit.gif differ
diff --git a/theme/identica/images/icons/twotone/green/eject.gif b/theme/identica/images/icons/twotone/green/eject.gif
new file mode 100644 (file)
index 0000000..7e0906c
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/eject.gif differ
diff --git a/theme/identica/images/icons/twotone/green/exclaim.gif b/theme/identica/images/icons/twotone/green/exclaim.gif
new file mode 100644 (file)
index 0000000..588e28c
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/exclaim.gif differ
diff --git a/theme/identica/images/icons/twotone/green/fastforward.gif b/theme/identica/images/icons/twotone/green/fastforward.gif
new file mode 100644 (file)
index 0000000..28e4951
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/fastforward.gif differ
diff --git a/theme/identica/images/icons/twotone/green/favourite.gif b/theme/identica/images/icons/twotone/green/favourite.gif
new file mode 100644 (file)
index 0000000..d93515e
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/favourite.gif differ
diff --git a/theme/identica/images/icons/twotone/green/flag.gif b/theme/identica/images/icons/twotone/green/flag.gif
new file mode 100644 (file)
index 0000000..68c8aee
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/flag.gif differ
diff --git a/theme/identica/images/icons/twotone/green/graph.gif b/theme/identica/images/icons/twotone/green/graph.gif
new file mode 100644 (file)
index 0000000..0c1794b
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/graph.gif differ
diff --git a/theme/identica/images/icons/twotone/green/grow.gif b/theme/identica/images/icons/twotone/green/grow.gif
new file mode 100644 (file)
index 0000000..c4118d5
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/grow.gif differ
diff --git a/theme/identica/images/icons/twotone/green/headphones.gif b/theme/identica/images/icons/twotone/green/headphones.gif
new file mode 100644 (file)
index 0000000..5be6c67
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/headphones.gif differ
diff --git a/theme/identica/images/icons/twotone/green/home.gif b/theme/identica/images/icons/twotone/green/home.gif
new file mode 100644 (file)
index 0000000..d2a3421
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/home.gif differ
diff --git a/theme/identica/images/icons/twotone/green/hourglass.gif b/theme/identica/images/icons/twotone/green/hourglass.gif
new file mode 100644 (file)
index 0000000..b62b948
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/hourglass.gif differ
diff --git a/theme/identica/images/icons/twotone/green/info.gif b/theme/identica/images/icons/twotone/green/info.gif
new file mode 100644 (file)
index 0000000..86ef1f8
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/info.gif differ
diff --git a/theme/identica/images/icons/twotone/green/key.gif b/theme/identica/images/icons/twotone/green/key.gif
new file mode 100644 (file)
index 0000000..ccf357a
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/key.gif differ
diff --git a/theme/identica/images/icons/twotone/green/lock.gif b/theme/identica/images/icons/twotone/green/lock.gif
new file mode 100644 (file)
index 0000000..db00706
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/lock.gif differ
diff --git a/theme/identica/images/icons/twotone/green/mail.gif b/theme/identica/images/icons/twotone/green/mail.gif
new file mode 100644 (file)
index 0000000..1084c86
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/mail.gif differ
diff --git a/theme/identica/images/icons/twotone/green/move.gif b/theme/identica/images/icons/twotone/green/move.gif
new file mode 100644 (file)
index 0000000..d2c30b1
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/move.gif differ
diff --git a/theme/identica/images/icons/twotone/green/music.gif b/theme/identica/images/icons/twotone/green/music.gif
new file mode 100644 (file)
index 0000000..64b51d4
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/music.gif differ
diff --git a/theme/identica/images/icons/twotone/green/news.gif b/theme/identica/images/icons/twotone/green/news.gif
new file mode 100644 (file)
index 0000000..712c685
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/news.gif differ
diff --git a/theme/identica/images/icons/twotone/green/note.gif b/theme/identica/images/icons/twotone/green/note.gif
new file mode 100644 (file)
index 0000000..bcc0b14
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/note.gif differ
diff --git a/theme/identica/images/icons/twotone/green/open-folder.gif b/theme/identica/images/icons/twotone/green/open-folder.gif
new file mode 100644 (file)
index 0000000..d41300a
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/open-folder.gif differ
diff --git a/theme/identica/images/icons/twotone/green/paper-clip.gif b/theme/identica/images/icons/twotone/green/paper-clip.gif
new file mode 100644 (file)
index 0000000..1d45f1d
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/paper-clip.gif differ
diff --git a/theme/identica/images/icons/twotone/green/paper-clip2.gif b/theme/identica/images/icons/twotone/green/paper-clip2.gif
new file mode 100644 (file)
index 0000000..a8c7805
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/paper-clip2.gif differ
diff --git a/theme/identica/images/icons/twotone/green/pause.gif b/theme/identica/images/icons/twotone/green/pause.gif
new file mode 100644 (file)
index 0000000..ced0b64
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/pause.gif differ
diff --git a/theme/identica/images/icons/twotone/green/phone.gif b/theme/identica/images/icons/twotone/green/phone.gif
new file mode 100644 (file)
index 0000000..69359f7
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/phone.gif differ
diff --git a/theme/identica/images/icons/twotone/green/play.gif b/theme/identica/images/icons/twotone/green/play.gif
new file mode 100644 (file)
index 0000000..794ec85
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/play.gif differ
diff --git a/theme/identica/images/icons/twotone/green/plus.gif b/theme/identica/images/icons/twotone/green/plus.gif
new file mode 100644 (file)
index 0000000..4407d0b
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/plus.gif differ
diff --git a/theme/identica/images/icons/twotone/green/print.gif b/theme/identica/images/icons/twotone/green/print.gif
new file mode 100644 (file)
index 0000000..17727d5
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/print.gif differ
diff --git a/theme/identica/images/icons/twotone/green/question-mark.gif b/theme/identica/images/icons/twotone/green/question-mark.gif
new file mode 100644 (file)
index 0000000..1689efc
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/question-mark.gif differ
diff --git a/theme/identica/images/icons/twotone/green/quote.gif b/theme/identica/images/icons/twotone/green/quote.gif
new file mode 100644 (file)
index 0000000..4ba1f0c
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/quote.gif differ
diff --git a/theme/identica/images/icons/twotone/green/refresh.gif b/theme/identica/images/icons/twotone/green/refresh.gif
new file mode 100644 (file)
index 0000000..8a8b814
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/refresh.gif differ
diff --git a/theme/identica/images/icons/twotone/green/reply.gif b/theme/identica/images/icons/twotone/green/reply.gif
new file mode 100644 (file)
index 0000000..6ff01bb
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/reply.gif differ
diff --git a/theme/identica/images/icons/twotone/green/rewind.gif b/theme/identica/images/icons/twotone/green/rewind.gif
new file mode 100644 (file)
index 0000000..aca3ee3
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/rewind.gif differ
diff --git a/theme/identica/images/icons/twotone/green/search.gif b/theme/identica/images/icons/twotone/green/search.gif
new file mode 100644 (file)
index 0000000..c36463d
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/search.gif differ
diff --git a/theme/identica/images/icons/twotone/green/shield.gif b/theme/identica/images/icons/twotone/green/shield.gif
new file mode 100644 (file)
index 0000000..419d5ee
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/shield.gif differ
diff --git a/theme/identica/images/icons/twotone/green/skip-back.gif b/theme/identica/images/icons/twotone/green/skip-back.gif
new file mode 100644 (file)
index 0000000..adca7aa
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/skip-back.gif differ
diff --git a/theme/identica/images/icons/twotone/green/skip.gif b/theme/identica/images/icons/twotone/green/skip.gif
new file mode 100644 (file)
index 0000000..ae5417f
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/skip.gif differ
diff --git a/theme/identica/images/icons/twotone/green/skull.gif b/theme/identica/images/icons/twotone/green/skull.gif
new file mode 100644 (file)
index 0000000..0335067
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/skull.gif differ
diff --git a/theme/identica/images/icons/twotone/green/statusbar.gif b/theme/identica/images/icons/twotone/green/statusbar.gif
new file mode 100644 (file)
index 0000000..47d61b1
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/statusbar.gif differ
diff --git a/theme/identica/images/icons/twotone/green/stop.gif b/theme/identica/images/icons/twotone/green/stop.gif
new file mode 100644 (file)
index 0000000..e0b108d
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/stop.gif differ
diff --git a/theme/identica/images/icons/twotone/green/template.gif b/theme/identica/images/icons/twotone/green/template.gif
new file mode 100644 (file)
index 0000000..65c0c4a
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/template.gif differ
diff --git a/theme/identica/images/icons/twotone/green/text-bigger.gif b/theme/identica/images/icons/twotone/green/text-bigger.gif
new file mode 100644 (file)
index 0000000..45e143b
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/text-bigger.gif differ
diff --git a/theme/identica/images/icons/twotone/green/text-smaller.gif b/theme/identica/images/icons/twotone/green/text-smaller.gif
new file mode 100644 (file)
index 0000000..a54d0c1
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/text-smaller.gif differ
diff --git a/theme/identica/images/icons/twotone/green/trash.gif b/theme/identica/images/icons/twotone/green/trash.gif
new file mode 100644 (file)
index 0000000..78dd64a
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/trash.gif differ
diff --git a/theme/identica/images/icons/twotone/green/two-docs.gif b/theme/identica/images/icons/twotone/green/two-docs.gif
new file mode 100644 (file)
index 0000000..97e54b9
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/two-docs.gif differ
diff --git a/theme/identica/images/icons/twotone/green/twotone.gif b/theme/identica/images/icons/twotone/green/twotone.gif
new file mode 100644 (file)
index 0000000..45aad25
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/twotone.gif differ
diff --git a/theme/identica/images/icons/twotone/green/undo.gif b/theme/identica/images/icons/twotone/green/undo.gif
new file mode 100644 (file)
index 0000000..6869b30
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/undo.gif differ
diff --git a/theme/identica/images/icons/twotone/green/user.gif b/theme/identica/images/icons/twotone/green/user.gif
new file mode 100644 (file)
index 0000000..c85460f
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/user.gif differ
diff --git a/theme/identica/images/icons/twotone/green/vegetable.gif b/theme/identica/images/icons/twotone/green/vegetable.gif
new file mode 100644 (file)
index 0000000..4d421c1
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/vegetable.gif differ
diff --git a/theme/identica/images/icons/twotone/green/x.gif b/theme/identica/images/icons/twotone/green/x.gif
new file mode 100644 (file)
index 0000000..ffb2efe
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/x.gif differ
diff --git a/theme/identica/images/icons/twotone/green/zoom-in.gif b/theme/identica/images/icons/twotone/green/zoom-in.gif
new file mode 100644 (file)
index 0000000..a59a5bb
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/zoom-in.gif differ
diff --git a/theme/identica/images/icons/twotone/green/zoom-out.gif b/theme/identica/images/icons/twotone/green/zoom-out.gif
new file mode 100644 (file)
index 0000000..c61f999
Binary files /dev/null and b/theme/identica/images/icons/twotone/green/zoom-out.gif differ
index 3b271814d6efb8359231648b514ca87799fff178..cee36799e165697d2e03f72ffcf87e90abeed51e 100644 (file)
Binary files a/theme/identica/logo.png and b/theme/identica/logo.png differ