Remove the 'Enable Twitter import' checkbox from Twitter admin panel by default; can be re-added with setting:

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.)
This commit is contained in:
Brion Vibber 2010-08-02 13:00:50 -07:00
parent 56294016a7
commit c56939d596
2 changed files with 33 additions and 9 deletions

View File

@ -50,6 +50,7 @@ class TwitterBridgePlugin extends Plugin
{ {
const VERSION = STATUSNET_VERSION; const VERSION = STATUSNET_VERSION;
public $adminImportControl = false; // Should the 'import' checkbox be exposed in the admin panel?
/** /**
* Initializer for the plugin. * Initializer for the plugin.
@ -322,5 +323,17 @@ class TwitterBridgePlugin extends Plugin
return true; 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;
}
} }

View File

@ -92,9 +92,11 @@ class TwitteradminpanelAction extends AdminPanelAction
); );
static $booleans = array( static $booleans = array(
'twitter' => array('signin'), 'twitter' => array('signin')
'twitterimport' => array('enabled')
); );
if (Event::handle('TwitterBridgeAdminImportControl')) {
$booleans['twitterimport'] = array('enabled');
}
$values = array(); $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 class TwitterAdminPanelForm extends AdminForm
@ -263,13 +272,15 @@ class TwitterAdminPanelForm extends AdminForm
); );
$this->unli(); $this->unli();
if (Event::handle('TwitterBridgeAdminImportControl')) {
$this->li(); $this->li();
$this->out->checkbox( $this->out->checkbox(
'enabled', _m('Enable Twitter import'), 'enabled', _m('Enable Twitter import'),
(bool) $this->value('enabled', 'twitterimport'), (bool) $this->value('enabled', 'twitterimport'),
_m('Allow users to import their Twitter friends\' timelines') _m('Allow users to import their Twitter friends\' timelines. Requires daemons to be manually configured.')
); );
$this->unli(); $this->unli();
}
$this->out->elementEnd('ul'); $this->out->elementEnd('ul');