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-2011 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 AddMirrorWizard extends Widget
34 * Sub-classes should overload this with the name of their form.
43 * Visible or invisible data elements
45 * Display the form fields that make up the data of the form.
46 * Sub-classes should overload this to show their data.
52 $this->out->elementStart('div', array('id' => 'add-mirror-wizard'));
54 $providers = $this->providers();
55 $this->showProviders($providers);
57 $this->out->elementEnd('div');
64 // We could accept hostname & username combos here, or
65 // webfingery combinations as for remote users.
68 'name' => _m('GNU social'),
72 // WordPress was on our list some whiles ago, but not sure
73 // what we can actually do here. Search on Wordpress.com hosted
77 'name' => _m('WordPress'),
82 // TRANS: Name for possible feed provider.
83 'name' => _m('RSS or Atom feed'),
88 function showProviders(array $providers)
92 $out->elementStart('div', 'provider-list');
93 // TRANS: Heading for feed mirroring selection form.
94 $out->element('h2', null, _m('Select a feed provider'));
95 $out->elementStart('table');
96 foreach ($providers as $provider) {
97 $icon = common_path('plugins/SubMirror/images/providers/' . $provider['id'] . '.png');
98 $targetUrl = common_local_url('mirrorsettings', array('provider' => $provider['id']));
100 $out->elementStart('tr', array('class' => 'provider'));
101 $out->elementStart('td');
103 $out->elementStart('div', 'provider-heading');
104 $out->element('img', array('src' => $icon));
105 $out->element('a', array('href' => $targetUrl), $provider['name']);
106 $out->elementEnd('div');
108 $out->elementEnd('td');
109 $out->elementEnd('tr');
111 $out->elementEnd('table');
112 $out->elementEnd('div');
116 * Buttons for form actions
118 * Submit and cancel buttons (or whatever)
119 * Sub-classes should overload this to show their own buttons.
123 function formActions()
130 * Should be unique on the page. Sub-classes should overload this
131 * to show their own IDs.
133 * @return string ID of the form
137 return 'add-mirror-wizard';
141 * Action of the form.
143 * URL to post to. Should be overloaded by subclasses to give
144 * somewhere to post to.
146 * @return string URL to post to
150 return common_local_url('addmirror');
156 * @return string the form's class
160 return 'form_settings';