*/
function onEndInitializeQueueManager(QueueManager $qm)
{
- $qm->connect('importym', 'ImportYmQueueHandler');
+ $qm->connect('yammer', 'YammerQueueHandler');
return true;
}
case 'yammerauthinitform':
case 'yammerauthverifyform':
case 'yammerprogressform':
+ case 'yammerqueuehandler':
require_once "$base/lib/$lower.php";
return false;
case 'yammeradminpanelaction':
return $this->showAjaxForm($form);
} else if ($this->verify_token) {
$this->runner->saveAuthToken($this->verify_token);
+
+ // Haho! Now we can make THE FUN HAPPEN
+ $this->runner->startBackgroundImport();
+
$form = new YammerProgressForm($this, $this->runner);
return $this->showAjaxForm($form);
} else {
function formData()
{
- $this->out->input('verify_token', _m('Verification code:'), '', _m("Click through and paste the code it gives you below..."));
+ $this->out->elementStart('p');
+ $this->out->text(_m('Follow this link to confirm authorization at Yammer; you will be prompted to log in if necessary:'));
+ $this->out->elementEnd('p');
+
+ $this->out->elementStart('blockquote');
+ $this->out->element('a',
+ array('href' => $this->runner->getAuthUrl(),
+ 'target' => '_blank'),
+ _m('Open Yammer authentication window'));
+ $this->out->elementEnd('blockquote');
+
+ $this->out->element('p', array(), _m('Copy the verification code you are given into the form below:'));
+
+ $this->out->input('verify_token', _m('Verification code:'));
// iframe would be nice to avoid leaving -- since they don't seem to have callback url O_O
/*
'src' => $this->runner->getAuthUrl()));
*/
// yeah, it ignores the callback_url
- $this->out->element('a',
- array('href' => $this->runner->getAuthUrl(),
- 'target' => '_blank'),
- 'clicky click');
}
/**
if ($runner->iterate()) {
if ($runner->hasWork()) {
// More to do? Shove us back on the queue...
- $qm = QueueManager::get();
- $qm->enqueue('YammerImport', 'yammer');
+ $runner->startBackgroundImport();
}
return true;
} else {
return $map->count();
}
+ /**
+ * Start running import work in the background queues...
+ */
+ public function startBackgroundImport()
+ {
+ $qm = QueueManager::get();
+ $qm->enqueue('YammerImport', 'yammer');
+ }
+
}