summaryrefslogtreecommitdiff
path: root/plugins/YammerImport/lib
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-09-27 16:56:48 -0700
committerBrion Vibber <brion@pobox.com>2010-09-28 07:44:25 -0700
commit61fde6c8fff5201393db4496918fe193fe960c01 (patch)
treec811b9c4e9a17380259c979f77e16d5b61e5a555 /plugins/YammerImport/lib
parent7d51cda25d7a056ffdf8e7928b4dfa958597067f (diff)
Yammer import API keys can now be overridden by the admin.
Diffstat (limited to 'plugins/YammerImport/lib')
-rw-r--r--plugins/YammerImport/lib/yammerapikeyform.php112
-rw-r--r--plugins/YammerImport/lib/yammerauthinitform.php10
-rw-r--r--plugins/YammerImport/lib/yammerauthverifyform.php33
3 files changed, 141 insertions, 14 deletions
diff --git a/plugins/YammerImport/lib/yammerapikeyform.php b/plugins/YammerImport/lib/yammerapikeyform.php
new file mode 100644
index 000000000..b2acec4ed
--- /dev/null
+++ b/plugins/YammerImport/lib/yammerapikeyform.php
@@ -0,0 +1,112 @@
+<?php
+
+class YammerApikeyForm extends Form
+{
+ private $runner;
+
+ function __construct($out)
+ {
+ parent::__construct($out);
+ $this->runner = $runner;
+ }
+
+ /**
+ * ID of the form
+ *
+ * @return int ID of the form
+ */
+
+ function id()
+ {
+ return 'yammer-apikey-form';
+ }
+
+
+ /**
+ * class of the form
+ *
+ * @return string of the form class
+ */
+
+ function formClass()
+ {
+ return 'form_yammer_apikey form_settings';
+ }
+
+
+ /**
+ * Action of the form
+ *
+ * @return string URL of the action
+ */
+
+ function action()
+ {
+ return common_local_url('yammeradminpanel');
+ }
+
+
+ /**
+ * Legend of the Form
+ *
+ * @return void
+ */
+ function formLegend()
+ {
+ $this->out->element('legend', null, _m('Yammer API registration'));
+ }
+
+ /**
+ * Data elements of the form
+ *
+ * @return void
+ */
+
+ function formData()
+ {
+ $this->out->hidden('subaction', 'apikey');
+
+ $this->out->elementStart('fieldset');
+
+ $this->out->elementStart('p');
+ $this->out->text(_m('Before we can connect to your Yammer network, ' .
+ 'you will need to register the importer as an ' .
+ 'application authorized to pull data on your behalf. ' .
+ 'This registration will work only for your own network. ' .
+ 'Follow this link to register the app at Yammer; ' .
+ 'you will be prompted to log in if necessary:'));
+ $this->out->elementEnd('p');
+
+ $this->out->elementStart('p', array('class' => 'magiclink'));
+ $this->out->element('a',
+ array('href' => 'https://www.yammer.com/client_applications/new',
+ 'target' => '_blank'),
+ _m('Open Yammer application registration form'));
+ $this->out->elementEnd('p');
+
+ $this->out->element('p', array(), _m('Copy the consumer key and secret you are given into the form below:'));
+
+ $this->out->elementStart('ul', array('class' => 'form_data'));
+ $this->out->elementStart('li');
+ $this->out->input('consumer_key', _m('Consumer key:'), common_config('yammer', 'consumer_key'));
+ $this->out->elementEnd('li');
+ $this->out->elementStart('li');
+ $this->out->input('consumer_secret', _m('Consumer secret:'), common_config('yammer', 'consumer_secret'));
+ $this->out->elementEnd('li');
+ $this->out->elementEnd('ul');
+
+ $this->out->submit('submit', _m('Save'), 'submit', null, _m('Save these consumer keys'));
+
+ $this->out->elementEnd('fieldset');
+ }
+
+ /**
+ * Action elements
+ *
+ * @return void
+ */
+
+ function formActions()
+ {
+ }
+}
diff --git a/plugins/YammerImport/lib/yammerauthinitform.php b/plugins/YammerImport/lib/yammerauthinitform.php
index 5a83a06c2..9f48fd82a 100644
--- a/plugins/YammerImport/lib/yammerauthinitform.php
+++ b/plugins/YammerImport/lib/yammerauthinitform.php
@@ -22,7 +22,7 @@ class YammerAuthInitForm extends Form
function formClass()
{
- return 'form_yammer_auth_init';
+ return 'form_yammer_auth_init form_settings';
}
@@ -56,7 +56,12 @@ class YammerAuthInitForm extends Form
function formData()
{
- $this->out->hidden('init_auth', '1');
+ $this->out->hidden('subaction', 'authinit');
+
+ $this->out->elementStart('fieldset');
+ $this->out->submit('submit', _m('Start authentication'), 'submit', null, _m('Request authorization to connect to Yammer account'));
+ $this->out->submit('change-apikey', _m('Change API key'));
+ $this->out->elementEnd('fieldset');
}
/**
@@ -67,6 +72,5 @@ class YammerAuthInitForm extends Form
function formActions()
{
- $this->out->submit('submit', _m('Connect to Yammer'), 'submit', null, _m('Request authorization to connect to Yammer account'));
}
}
diff --git a/plugins/YammerImport/lib/yammerauthverifyform.php b/plugins/YammerImport/lib/yammerauthverifyform.php
index 2b3efbcb1..e119be96f 100644
--- a/plugins/YammerImport/lib/yammerauthverifyform.php
+++ b/plugins/YammerImport/lib/yammerauthverifyform.php
@@ -30,7 +30,7 @@ class YammerAuthVerifyForm extends Form
function formClass()
{
- return 'form_yammer_auth_verify';
+ return 'form_yammer_auth_verify form_settings';
}
@@ -64,27 +64,39 @@ class YammerAuthVerifyForm extends Form
function formData()
{
+ $this->out->hidden('subaction', 'authverify');
+
+ $this->out->elementStart('fieldset');
+
$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');
+ // iframe would be nice to avoid leaving -- since they don't seem to have callback url O_O
+ /*
+ $this->out->element('iframe', array('id' => 'yammer-oauth',
+ 'src' => $this->runner->getAuthUrl()));
+ */
+ // yeah, it ignores the callback_url
+ // soo... crappy link. :(
+
+ $this->out->elementStart('p', array('class' => 'magiclink'));
$this->out->element('a',
array('href' => $this->runner->getAuthUrl(),
'target' => '_blank'),
_m('Open Yammer authentication window'));
- $this->out->elementEnd('blockquote');
+ $this->out->elementEnd('p');
- $this->out->element('p', array(), _m('Copy the verification code you are given into the form below:'));
+ $this->out->element('p', array(), _m('Copy the verification code you are given below:'));
+ $this->out->elementStart('ul', array('class' => 'form_data'));
+ $this->out->elementStart('li');
$this->out->input('verify_token', _m('Verification code:'));
+ $this->out->elementEnd('li');
+ $this->out->elementEnd('ul');
- // iframe would be nice to avoid leaving -- since they don't seem to have callback url O_O
- /*
- $this->out->element('iframe', array('id' => 'yammer-oauth',
- 'src' => $this->runner->getAuthUrl()));
- */
- // yeah, it ignores the callback_url
+ $this->out->submit('submit', _m('Continue'), 'submit', null, _m('Save code and begin import'));
+ $this->out->elementEnd('fieldset');
}
/**
@@ -95,6 +107,5 @@ class YammerAuthVerifyForm extends Form
function formActions()
{
- $this->out->submit('submit', _m('Verify code'), 'submit', null, _m('Verification code'));
}
}