summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/avatarsettings.php2
-rw-r--r--actions/editgroup.php6
-rw-r--r--actions/emailsettings.php6
-rw-r--r--actions/grouplogo.php2
-rw-r--r--actions/groupsearch.php6
-rw-r--r--actions/invite.php6
-rw-r--r--actions/login.php8
-rw-r--r--actions/noticesearch.php6
-rw-r--r--actions/openidlogin.php6
-rw-r--r--actions/openidsettings.php6
-rw-r--r--actions/othersettings.php6
-rw-r--r--actions/passwordsettings.php6
-rw-r--r--actions/peoplesearch.php6
-rw-r--r--actions/profilesettings.php8
-rw-r--r--actions/register.php6
-rw-r--r--actions/smssettings.php6
-rw-r--r--actions/subscriptions.php6
-rw-r--r--lib/designsettings.php2
-rw-r--r--lib/htmloutputter.php25
19 files changed, 125 insertions, 0 deletions
diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php
index 0bc439ff1..02a684b38 100644
--- a/actions/avatarsettings.php
+++ b/actions/avatarsettings.php
@@ -399,5 +399,7 @@ class AvatarsettingsAction extends AccountSettingsAction
$this->script('js/jcrop/jquery.Jcrop.min.js');
$this->script('js/jcrop/jquery.Jcrop.go.js');
}
+
+ $this->autofocus('avatarfile');
}
}
diff --git a/actions/editgroup.php b/actions/editgroup.php
index cac910e9b..e7ba836a0 100644
--- a/actions/editgroup.php
+++ b/actions/editgroup.php
@@ -160,6 +160,12 @@ class EditgroupAction extends GroupDesignAction
}
}
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('nickname');
+ }
+
function trySave()
{
$cur = common_current_user();
diff --git a/actions/emailsettings.php b/actions/emailsettings.php
index af528a892..6eff06c0d 100644
--- a/actions/emailsettings.php
+++ b/actions/emailsettings.php
@@ -71,6 +71,12 @@ class EmailsettingsAction extends AccountSettingsAction
return _('Manage how you get email from %%site.name%%.');
}
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('email');
+ }
+
/**
* Content area of the page
*
diff --git a/actions/grouplogo.php b/actions/grouplogo.php
index c6f376915..63ba769c7 100644
--- a/actions/grouplogo.php
+++ b/actions/grouplogo.php
@@ -445,6 +445,8 @@ class GrouplogoAction extends GroupDesignAction
$this->script('js/jcrop/jquery.Jcrop.min.js');
$this->script('js/jcrop/jquery.Jcrop.go.js');
}
+
+ $this->autofocus('avatarfile');
}
function showLocalNav()
diff --git a/actions/groupsearch.php b/actions/groupsearch.php
index bbd4c3a74..be15efc47 100644
--- a/actions/groupsearch.php
+++ b/actions/groupsearch.php
@@ -91,6 +91,12 @@ class GroupsearchAction extends SearchAction
$user_group->free();
}
}
+
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('q');
+ }
}
class GroupSearchResults extends GroupList
diff --git a/actions/invite.php b/actions/invite.php
index ab43a2491..9fa6a76f6 100644
--- a/actions/invite.php
+++ b/actions/invite.php
@@ -98,6 +98,12 @@ class InviteAction extends CurrentUserDesignAction
$this->showPage();
}
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('addresses');
+ }
+
function title()
{
if ($this->mode == 'sent') {
diff --git a/actions/login.php b/actions/login.php
index 37f3c54ff..ac8c40c3e 100644
--- a/actions/login.php
+++ b/actions/login.php
@@ -22,6 +22,7 @@
* @category Login
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
+ * @author Sarven Capadisli <csarven@status.net>
* @copyright 2008-2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
@@ -37,6 +38,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
* @category Personal
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
+ * @author Sarven Capadisli <csarven@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
@@ -162,6 +164,12 @@ class LoginAction extends Action
$this->showPage();
}
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('nickname');
+ }
+
/**
* Title of the page
*
diff --git a/actions/noticesearch.php b/actions/noticesearch.php
index 1188e7e10..1cd987df3 100644
--- a/actions/noticesearch.php
+++ b/actions/noticesearch.php
@@ -137,6 +137,12 @@ class NoticesearchAction extends SearchAction
$this->pagination($page > 1, $cnt > NOTICES_PER_PAGE,
$page, 'noticesearch', array('q' => $q));
}
+
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('q');
+ }
}
class SearchNoticeList extends NoticeList {
diff --git a/actions/openidlogin.php b/actions/openidlogin.php
index 4b5338694..9b7deefb6 100644
--- a/actions/openidlogin.php
+++ b/actions/openidlogin.php
@@ -86,6 +86,12 @@ class OpenidloginAction extends Action
}
}
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('openid_url');
+ }
+
function title()
{
return _('OpenID Login');
diff --git a/actions/openidsettings.php b/actions/openidsettings.php
index 13da64a4f..30725fc1b 100644
--- a/actions/openidsettings.php
+++ b/actions/openidsettings.php
@@ -72,6 +72,12 @@ class OpenidsettingsAction extends AccountSettingsAction
' Manage your associated OpenIDs from here.');
}
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('openid_url');
+ }
+
/**
* Show the form for OpenID management
*
diff --git a/actions/othersettings.php b/actions/othersettings.php
index 8b674161a..f898e2207 100644
--- a/actions/othersettings.php
+++ b/actions/othersettings.php
@@ -71,6 +71,12 @@ class OthersettingsAction extends AccountSettingsAction
return _('Manage various other options.');
}
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('urlshorteningservice');
+ }
+
/**
* Content area of the page
*
diff --git a/actions/passwordsettings.php b/actions/passwordsettings.php
index ec842600f..cd4beac3f 100644
--- a/actions/passwordsettings.php
+++ b/actions/passwordsettings.php
@@ -69,6 +69,12 @@ class PasswordsettingsAction extends AccountSettingsAction
return _('Change your password.');
}
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('oldpassword');
+ }
+
/**
* Content area of the page
*
diff --git a/actions/peoplesearch.php b/actions/peoplesearch.php
index ba0f71e39..38135ecbd 100644
--- a/actions/peoplesearch.php
+++ b/actions/peoplesearch.php
@@ -85,6 +85,12 @@ class PeoplesearchAction extends SearchAction
$profile->free();
}
}
+
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('q');
+ }
}
/**
diff --git a/actions/profilesettings.php b/actions/profilesettings.php
index f9c16351d..2d66e9946 100644
--- a/actions/profilesettings.php
+++ b/actions/profilesettings.php
@@ -23,6 +23,7 @@
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Zach Copley <zach@status.net>
+ * @author Sarven Capadisli <csarven@status.net>
* @copyright 2008-2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
@@ -41,6 +42,7 @@ require_once INSTALLDIR.'/lib/accountsettingsaction.php';
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Zach Copley <zach@status.net>
+ * @author Sarven Capadisli <csarven@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
@@ -70,6 +72,12 @@ class ProfilesettingsAction extends AccountSettingsAction
'so people know more about you.');
}
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('nickname');
+ }
+
/**
* Content area of the page
*
diff --git a/actions/register.php b/actions/register.php
index c431aeee3..eefbc340a 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -140,6 +140,12 @@ class RegisterAction extends Action
}
}
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('nickname');
+ }
+
/**
* Try to register a user
*
diff --git a/actions/smssettings.php b/actions/smssettings.php
index b956cceba..672abcef8 100644
--- a/actions/smssettings.php
+++ b/actions/smssettings.php
@@ -69,6 +69,12 @@ class SmssettingsAction extends ConnectSettingsAction
return _('You can receive SMS messages through email from %%site.name%%.');
}
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('sms');
+ }
+
/**
* Content area of the page
*
diff --git a/actions/subscriptions.php b/actions/subscriptions.php
index b1c668228..cc7b38ee4 100644
--- a/actions/subscriptions.php
+++ b/actions/subscriptions.php
@@ -107,6 +107,12 @@ class SubscriptionsAction extends GalleryAction
array('nickname' => $this->user->nickname));
}
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('tag');
+ }
+
function showEmptyListMessage()
{
if (common_logged_in()) {
diff --git a/lib/designsettings.php b/lib/designsettings.php
index fe4222597..fdc05562e 100644
--- a/lib/designsettings.php
+++ b/lib/designsettings.php
@@ -327,6 +327,8 @@ class DesignSettingsAction extends AccountSettingsAction
$this->script('js/farbtastic/farbtastic.js');
$this->script('js/farbtastic/farbtastic.go.js');
$this->script('js/userdesign.go.js');
+
+ $this->autofocus('design_background-image_file');
}
/**
diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php
index 8ad7dc20f..aa01f6b1d 100644
--- a/lib/htmloutputter.php
+++ b/lib/htmloutputter.php
@@ -412,4 +412,29 @@ class HTMLOutputter extends XMLOutputter
$this->element('p', 'form_guide', $instructions);
}
}
+
+
+ /**
+ * Internal script to autofocus the given element on page onload.
+ *
+ * @param string $id element ID, must refer to an existing element
+ *
+ * @return void
+ *
+ */
+ function autofocus($id)
+ {
+ $this->elementStart('script', array('type' => 'text/javascript'));
+ $this->raw('
+ <!--
+ $(document).ready(function() {
+ var el = $("#' . $id . '");
+ if (el.length) {
+ el.focus();
+ }
+ });
+ -->
+ ');
+ $this->elementEnd('script');
+ }
}