3 * StatusNet, the distributed open-source microblogging tool
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.
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.
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/>.
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/
25 if (!defined('STATUSNET') && !defined('LACONICA')) {
29 class AddMirrorForm extends Form
35 * Sub-classes should overload this with the name of their form.
45 * Visible or invisible data elements
47 * Display the form fields that make up the data of the form.
48 * Sub-classes should overload this to show their data.
55 $this->out->elementStart('fieldset');
57 $this->out->elementStart('ul');
60 $this->out->element('label', array('for' => $this->id() . '-profile'),
61 _m("Mirror one of your existing subscriptions:"));
62 $this->out->elementStart('select', array('name' => 'profile'));
64 $user = common_current_user();
65 $profile = $user->getSubscriptions();
66 while ($profile->fetch()) {
67 $mirror = SubMirror::pkeyGet(array('subscriber' => $user->id,
68 'subscribed' => $profile->id));
70 $this->out->element('option',
71 array('value' => $profile->id),
72 $profile->getBestName());
75 $this->out->elementEnd('select');
76 $this->out->submit($this->id() . '-save', _m('Save'));
82 $this->out->elementStart('fieldset', array('style' => 'width: 360px; margin-left: auto; margin-right: auto'));
83 $this->out->element('p', false,
84 _m("Not already subscribed to the feed you want? " .
85 "Add a new remote subscription and paste in the URL!"));
87 $this->out->elementStart('div', 'entity_actions');
88 $this->out->elementStart('p', array('id' => 'entity_remote_subscribe',
89 'class' => 'entity_subscribe'));
90 $this->out->element('a', array('href' => common_local_url('ostatussub'),
91 'class' => 'entity_remote_subscribe')
93 $this->out->elementEnd('p');
94 $this->out->elementEnd('div');
96 $this->out->element('div', array('style' => 'clear: both'));
97 $this->out->elementEnd('fieldset');
100 $this->out->elementEnd('ul');
101 $this->out->elementEnd('fieldset');
104 private function doInput($id, $name, $label, $value=null, $instructions=null)
106 $this->out->element('label', array('for' => $id), $label);
107 $attrs = array('name' => $name,
111 $attrs['value'] = $value;
113 $this->out->element('input', $attrs);
115 $this->out->element('p', 'form_guide', $instructions);
120 * Buttons for form actions
122 * Submit and cancel buttons (or whatever)
123 * Sub-classes should overload this to show their own buttons.
128 function formActions()
135 * Should be unique on the page. Sub-classes should overload this
136 * to show their own IDs.
138 * @return string ID of the form
143 return 'add-mirror-form';
147 * Action of the form.
149 * URL to post to. Should be overloaded by subclasses to give
150 * somewhere to post to.
152 * @return string URL to post to
157 return common_local_url('addmirror');
163 * @return string the form's class
168 return 'form_settings';