]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Remove the 'Enable Twitter import' checkbox from Twitter admin panel by default;...
authorBrion Vibber <brion@pobox.com>
Mon, 2 Aug 2010 20:00:50 +0000 (13:00 -0700)
committerBrion Vibber <brion@pobox.com>
Mon, 2 Aug 2010 20:00:50 +0000 (13:00 -0700)
  addPlugin('TwitterBridge', array('adminImportControl' => true, ....));

Added a note on the label that it requires manual daemon setup. (Note that by default the admin panel won't be shown, so it's no biggie to be hiding this for now.)

plugins/TwitterBridge/TwitterBridgePlugin.php
plugins/TwitterBridge/twitteradminpanel.php

index 65b3a6b38ece6fea543887e8717160f1a0c0a0e1..0505a328fb815f37cde82d37a9670984f3cbf99a 100644 (file)
@@ -50,6 +50,7 @@ class TwitterBridgePlugin extends Plugin
 {
 
     const VERSION = STATUSNET_VERSION;
+    public $adminImportControl = false; // Should the 'import' checkbox be exposed in the admin panel?
 
     /**
      * Initializer for the plugin.
@@ -322,5 +323,17 @@ class TwitterBridgePlugin extends Plugin
         return true;
     }
 
+    /**
+     * Expose the adminImportControl setting to the administration panel code.
+     * This allows us to disable the import bridge enabling checkbox for administrators,
+     * since on a bulk farm site we can't yet automate the import daemon setup.
+     *
+     * @return boolean hook value;
+     */
+    function onTwitterBridgeAdminImportControl()
+    {
+        return (bool)$this->adminImportControl;
+    }
+
 }
 
index a78a92c66732ad6ed790e11d96a0a970c5374c83..69f8da078a194b8aea3ec08768747dc7c40b26ec 100644 (file)
@@ -92,9 +92,11 @@ class TwitteradminpanelAction extends AdminPanelAction
         );
 
         static $booleans = array(
-            'twitter'       => array('signin'),
-            'twitterimport' => array('enabled')
+            'twitter'       => array('signin')
         );
+        if (Event::handle('TwitterBridgeAdminImportControl')) {
+            $booleans['twitterimport'] = array('enabled');
+        }
 
         $values = array();
 
@@ -155,6 +157,13 @@ class TwitteradminpanelAction extends AdminPanelAction
             );
         }
     }
+
+    function isImportEnabled()
+    {
+        // Since daemon setup isn't automated yet...
+        // @todo: if merged into main queues, detect presence of daemon config
+        return true;
+    }
 }
 
 class TwitterAdminPanelForm extends AdminForm
@@ -263,13 +272,15 @@ class TwitterAdminPanelForm extends AdminForm
         );
         $this->unli();
 
-        $this->li();
-        $this->out->checkbox(
-            'enabled', _m('Enable Twitter import'),
-            (bool) $this->value('enabled', 'twitterimport'),
-            _m('Allow users to import their Twitter friends\' timelines')
-        );
-        $this->unli();
+        if (Event::handle('TwitterBridgeAdminImportControl')) {
+            $this->li();
+            $this->out->checkbox(
+                'enabled', _m('Enable Twitter import'),
+                (bool) $this->value('enabled', 'twitterimport'),
+                _m('Allow users to import their Twitter friends\' timelines. Requires daemons to be manually configured.')
+            );
+            $this->unli();
+        }
 
         $this->out->elementEnd('ul');