]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/openidsettings.php
Created autofocus method to give focus to an element (primarily a form
[quix0rs-gnu-social.git] / actions / openidsettings.php
index 6f17f154caaaa27626d37d84682c11a4fcae71da..30725fc1bff7b6fa847d4619a893816f2de8854c 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Laconica, the distributed open-source microblogging tool
+ * StatusNet, the distributed open-source microblogging tool
  *
  * Settings for OpenID
  *
  * 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.
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@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://laconi.ca/
+ * @link      http://status.net/
  */
 
-if (!defined('LACONICA')) {
+if (!defined('STATUSNET') && !defined('LACONICA')) {
     exit(1);
 }
 
-require_once INSTALLDIR.'/lib/settingsaction.php';
+require_once INSTALLDIR.'/lib/accountsettingsaction.php';
 require_once INSTALLDIR.'/lib/openid.php';
 
 /**
@@ -40,13 +40,13 @@ require_once INSTALLDIR.'/lib/openid.php';
  * Lets users add, edit and delete OpenIDs from their account
  *
  * @category Settings
- * @package  Laconica
- * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @package  StatusNet
+ * @author   Evan Prodromou <evan@status.net>
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link     http://laconi.ca/
+ * @link     http://status.net/
  */
 
-class OpenidsettingsAction extends SettingsAction
+class OpenidsettingsAction extends AccountSettingsAction
 {
     /**
      * Title of the page
@@ -67,11 +67,17 @@ class OpenidsettingsAction extends SettingsAction
 
     function getInstructions()
     {
-        return _('[OpenID](%%doc.openid%%) lets you log into many sites ' .
-                 ' with the same user account. '.
+        return _('[OpenID](%%doc.openid%%) lets you log into many sites' .
+                 ' with the same user account.'.
                  ' Manage your associated OpenIDs from here.');
     }
 
+    function showScripts()
+    {
+        parent::showScripts();
+        $this->autofocus('openid_url');
+    }
+
     /**
      * Show the form for OpenID management
      *
@@ -82,6 +88,12 @@ class OpenidsettingsAction extends SettingsAction
 
     function showContent()
     {
+        if (!common_config('openid', 'enabled')) {
+            $this->element('div', array('class' => 'error'),
+                           _('OpenID is not available.'));
+            return;
+        }
+
         $user = common_current_user();
 
         $this->elementStart('form', array('method' => 'post',
@@ -95,7 +107,7 @@ class OpenidsettingsAction extends SettingsAction
         $this->element('p', 'form_guide',
                        _('If you want to add an OpenID to your account, ' .
                          'enter it in the box below and click "Add".'));
-        $this->elementStart('ul', 'form_datas');
+        $this->elementStart('ul', 'form_data');
         $this->elementStart('li');
         $this->element('label', array('for' => 'openid_url'),
                        _('OpenID URL'));
@@ -124,7 +136,7 @@ class OpenidsettingsAction extends SettingsAction
 
             if ($cnt == 1 && !$user->password) {
 
-                $this->element('p', null,
+                $this->element('p', 'form_guide',
                                _('Removing your only OpenID '.
                                  'would make it impossible to log in! ' .
                                  'If you need to remove it, '.
@@ -162,7 +174,7 @@ class OpenidsettingsAction extends SettingsAction
                     $this->element('input', array('type' => 'submit',
                                                   'id' => 'remove'.$idx,
                                                   'name' => 'remove',
-                                                  'class' => 'submit',
+                                                  'class' => 'submit remove',
                                                   'value' => _('Remove')));
                     $this->elementEnd('fieldset');
                     $this->elementEnd('form');