]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/YammerImport/lib/yammerauthverifyform.php
Merge branch '1.0.x' into schema-x
[quix0rs-gnu-social.git] / plugins / YammerImport / lib / yammerauthverifyform.php
1 <?php
2
3 class YammerAuthVerifyForm extends Form
4 {
5     private $runner;
6
7     function __construct($out, YammerRunner $runner)
8     {
9         parent::__construct($out);
10         $this->runner = $runner;
11     }
12
13     /**
14      * ID of the form
15      *
16      * @return int ID of the form
17      */
18
19     function id()
20     {
21         return 'yammer-auth-verify-form';
22     }
23
24
25     /**
26      * class of the form
27      *
28      * @return string of the form class
29      */
30
31     function formClass()
32     {
33         return 'form_yammer_auth_verify form_settings';
34     }
35
36
37     /**
38      * Action of the form
39      *
40      * @return string URL of the action
41      */
42
43     function action()
44     {
45         return common_local_url('yammeradminpanel');
46     }
47
48
49     /**
50      * Legend of the Form
51      *
52      * @return void
53      */
54     function formLegend()
55     {
56         $this->out->element('legend', null, _m('Connect to Yammer'));
57     }
58
59     /**
60      * Data elements of the form
61      *
62      * @return void
63      */
64
65     function formData()
66     {
67         $this->out->hidden('subaction', 'authverify');
68
69         $this->out->elementStart('fieldset');
70
71         $this->out->elementStart('p');
72         $this->out->text(_m('Follow this link to confirm authorization at Yammer; you will be prompted to log in if necessary:'));
73         $this->out->elementEnd('p');
74
75         // iframe would be nice to avoid leaving -- since they don't seem to have callback url O_O
76         /*
77         $this->out->element('iframe', array('id' => 'yammer-oauth',
78                                             'src' => $this->runner->getAuthUrl()));
79         */
80         // yeah, it ignores the callback_url
81         // soo... crappy link. :(
82
83         $this->out->elementStart('p', array('class' => 'magiclink'));
84         $this->out->element('a',
85             array('href' => $this->runner->getAuthUrl(),
86                   'target' => '_blank'),
87             _m('Open Yammer authentication window'));
88         $this->out->elementEnd('p');
89         
90         $this->out->element('p', array(), _m('Copy the verification code you are given below:'));
91
92         $this->out->elementStart('ul', array('class' => 'form_data'));
93         $this->out->elementStart('li');
94         $this->out->input('verify_token', _m('Verification code:'));
95         $this->out->elementEnd('li');
96         $this->out->elementEnd('ul');
97         
98         $this->out->submit('submit', _m('Continue'), 'submit', null, _m('Save code and begin import'));
99         $this->out->elementEnd('fieldset');
100     }
101
102     /**
103      * Action elements
104      *
105      * @return void
106      */
107
108     function formActions()
109     {
110     }
111 }