summaryrefslogtreecommitdiff
path: root/plugins/YammerImport/lib/yammerapikeyform.php
blob: b2acec4ededd121cdd2f6185382570578465d077 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
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()
    {
    }
}