]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Yammer import (work run via background queues) now can be started from the admin...
authorBrion Vibber <brion@pobox.com>
Mon, 27 Sep 2010 20:34:35 +0000 (13:34 -0700)
committerBrion Vibber <brion@pobox.com>
Mon, 27 Sep 2010 20:34:35 +0000 (13:34 -0700)
plugins/YammerImport/YammerImportPlugin.php
plugins/YammerImport/actions/yammeradminpanel.php
plugins/YammerImport/lib/yammerauthverifyform.php
plugins/YammerImport/lib/yammerqueuehandler.php
plugins/YammerImport/lib/yammerrunner.php

index bb1e976186a93a7b08cb0e86e9e438c06491618b..547870936b7d776200b0e71145f1990c1dfc9d9e 100644 (file)
@@ -48,7 +48,7 @@ class YammerImportPlugin extends Plugin
      */
     function onEndInitializeQueueManager(QueueManager $qm)
     {
-        $qm->connect('importym', 'ImportYmQueueHandler');
+        $qm->connect('yammer', 'YammerQueueHandler');
 
         return true;
     }
@@ -122,6 +122,7 @@ class YammerImportPlugin extends Plugin
         case 'yammerauthinitform':
         case 'yammerauthverifyform':
         case 'yammerprogressform':
+        case 'yammerqueuehandler':
             require_once "$base/lib/$lower.php";
             return false;
         case 'yammeradminpanelaction':
index fdf7a084f4db0397a1b317e1426e7633b7e92f52..04ef26d512f86cee3c6f1a35a50de4269951c87a 100644 (file)
@@ -76,6 +76,10 @@ class YammeradminpanelAction extends AdminPanelAction
                 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 {
index 96decea1027a53440b0dc680fa5d8271a4f25730..2b3efbcb1a0bfc404c546086e7ad9212d3f7fdf4 100644 (file)
@@ -64,7 +64,20 @@ class YammerAuthVerifyForm extends Form
 
     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
         /*
@@ -72,10 +85,6 @@ class YammerAuthVerifyForm extends Form
                                             'src' => $this->runner->getAuthUrl()));
         */
         // yeah, it ignores the callback_url
-        $this->out->element('a',
-            array('href' => $this->runner->getAuthUrl(),
-                  'target' => '_blank'),
-            'clicky click');
     }
 
     /**
index 5fc37778355f951f906d8edf1b40fb833324966c..acc807311566ee8c0ff0eb4c496d190b4868bdd7 100644 (file)
@@ -41,8 +41,7 @@ class YammerQueueHandler extends QueueHandler
             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 {
index aee6b17e153a84ef32169b087e03ffecb35f27ed..e0aec0d1666080e07a4285305d2ffc264aa90137 100644 (file)
@@ -386,4 +386,13 @@ class YammerRunner
         return $map->count();
     }
 
+    /**
+     * Start running import work in the background queues...
+     */
+    public function startBackgroundImport()
+    {
+        $qm = QueueManager::get();
+        $qm->enqueue('YammerImport', 'yammer');
+    }
+
 }