]> 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 92469d20f89a1af6046a09b6ff27e6a2eed02902..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);
 }
 
@@ -40,10 +40,10 @@ 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 AccountSettingsAction
@@ -67,11 +67,17 @@ class OpenidsettingsAction extends AccountSettingsAction
 
     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 AccountSettingsAction
 
     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',