]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/SubMirror/lib/addmirrorform.php
Merge branch 'master' of gitorious.org:statusnet/mainline
[quix0rs-gnu-social.git] / plugins / SubMirror / lib / addmirrorform.php
1 <?php
2 /**
3  * StatusNet, the distributed open-source microblogging tool
4  * PHP version 5
5  *
6  * LICENCE: This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Affero General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU Affero General Public License for more details.
15  *
16  * You should have received a copy of the GNU Affero General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  * @package   StatusNet
20  * @copyright 2010 StatusNet, Inc.
21  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
22  * @link      http://status.net/
23  */
24
25 if (!defined('STATUSNET') && !defined('LACONICA')) {
26     exit(1);
27 }
28
29 class AddMirrorForm extends Form
30 {
31
32     /**
33      * Name of the form
34      *
35      * Sub-classes should overload this with the name of their form.
36      *
37      * @return void
38      */
39
40     function formLegend()
41     {
42     }
43
44     /**
45      * Visible or invisible data elements
46      *
47      * Display the form fields that make up the data of the form.
48      * Sub-classes should overload this to show their data.
49      *
50      * @return void
51      */
52
53     function formData()
54     {
55         $this->out->elementStart('fieldset');
56
57         $this->out->elementStart('ul');
58
59         $this->li();
60         $this->doInput('addmirror-feedurl',
61                        'feedurl',
62                        _m('Web page or feed URL:'),
63                        $this->out->trimmed('feedurl'));
64         $this->unli();
65
66         $this->li();
67         $this->out->submit('addmirror-save', _m('Add feed'));
68         $this->unli();
69         $this->out->elementEnd('ul');
70         $this->out->elementEnd('fieldset');
71     }
72
73     private function doInput($id, $name, $label, $value=null, $instructions=null)
74     {
75         $this->out->element('label', array('for' => $id), $label);
76         $attrs = array('name' => $name,
77                        'type' => 'text',
78                        'id' => $id,
79                        'style' => 'width: 80%');
80         if ($value) {
81             $attrs['value'] = $value;
82         }
83         $this->out->element('input', $attrs);
84         if ($instructions) {
85             $this->out->element('p', 'form_guide', $instructions);
86         }
87     }
88
89     /**
90      * Buttons for form actions
91      *
92      * Submit and cancel buttons (or whatever)
93      * Sub-classes should overload this to show their own buttons.
94      *
95      * @return void
96      */
97
98     function formActions()
99     {
100     }
101
102     /**
103      * ID of the form
104      *
105      * Should be unique on the page. Sub-classes should overload this
106      * to show their own IDs.
107      *
108      * @return string ID of the form
109      */
110
111     function id()
112     {
113         return 'add-mirror-form';
114     }
115
116     /**
117      * Action of the form.
118      *
119      * URL to post to. Should be overloaded by subclasses to give
120      * somewhere to post to.
121      *
122      * @return string URL to post to
123      */
124
125     function action()
126     {
127         return common_local_url('addmirror');
128     }
129
130     /**
131      * Class of the form.
132      *
133      * @return string the form's class
134      */
135
136     function formClass()
137     {
138         return 'form_settings';
139     }
140
141 }