* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class TwitteradminpanelAction extends AdminPanelAction
{
/**
*
* @return string page title
*/
-
function title()
{
return _m('Twitter');
*
* @return string instructions
*/
-
function getInstructions()
{
return _m('Twitter bridge settings');
*
* @return void
*/
-
function showForm()
{
$form = new TwitterAdminPanelForm($this);
*
* @return void
*/
-
function saveSettings()
{
static $settings = array(
);
static $booleans = array(
- 'twitter' => array('signin'),
- 'twitterimport' => array('enabled')
+ 'twitter' => array('signin')
);
+ if (Event::handle('TwitterBridgeAdminImportControl')) {
+ $booleans['twitterimport'] = array('enabled');
+ }
$values = array();
$config->query('COMMIT');
+ // Flush the router cache: we may have enabled/disabled bridging,
+ // which will add or remove some actions.
+ $cache = Cache::instance();
+ $cache->delete(Router::cacheKey());
+
return;
}
);
}
}
+
+ 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
*
* @return int ID of the form
*/
-
function id()
{
return 'twitteradminpanel';
*
* @return string class of the form
*/
-
function formClass()
{
return 'form_settings';
*
* @return string URL of the action
*/
-
function action()
{
return common_local_url('twitteradminpanel');
*
* @return void
*/
-
function formData()
{
$this->out->elementStart(
);
$this->unli();
+ $globalConsumerKey = common_config('twitter', 'global_consumer_key');
+ $globalConsumerSec = common_config('twitter', 'global_consumer_secret');
+
+ if (!empty($globalConsumerKey) && !empty($globalConsumerSec)) {
+ $this->li();
+ $this->out->element('p', 'form_guide', _m('Note: a global consumer key and secret are set.'));
+ $this->unli();
+ }
+
$this->li();
$this->input(
'source',
);
$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');
*
* @return void
*/
-
function formActions()
{
- $this->out->submit('submit', _('Save'), 'submit', null, _('Save Twitter settings'));
+ $this->out->submit('submit', _m('Save'), 'submit', null, _m('Save Twitter settings'));
}
}