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('StatusNet'),
71 // Accepts a Twitter username and pulls their user timeline as a
72 // public Atom feed. Requires a working alternate hub which, one
73 // hopes, is getting timely updates.
76 'name' => _m('Twitter'),
79 // WordPress was on our list some whiles ago, but not sure
80 // what we can actually do here. Search on Wordpress.com hosted
84 'name' => _m('WordPress'),
88 // In theory, Facebook lets you pull public updates over RSS,
89 // but the URLs for your own update feed that I can find from
90 // 2009-era websites no longer seem to work and there's no
91 // good current documentation. May not still be available...
92 // Mirroring from an FB account is probably better done with
93 // the dedicated plugin. (As of March 2011)
96 'name' => _m('Facebook'),
100 // LinkedIn doesn't currently seem to have public feeds
101 // for users or groups (March 2011)
104 'name' => _m('LinkedIn'),
109 'name' => _m('RSS or Atom feed'),
114 function showProviders(array $providers)
118 $out->elementStart('div', 'provider-list');
119 $out->element('h2', null, _m('Select a feed provider'));
120 $out->elementStart('table');
121 foreach ($providers as $provider) {
122 $icon = common_path('plugins/SubMirror/images/providers/' . $provider['id'] . '.png');
123 $targetUrl = common_local_url('mirrorsettings', array('provider' => $provider['id']));
125 $out->elementStart('tr', array('class' => 'provider'));
126 $out->elementStart('td');
128 $out->elementStart('div', 'provider-heading');
129 $out->element('img', array('src' => $icon));
130 $out->element('a', array('href' => $targetUrl), $provider['name']);
131 $out->elementEnd('div');
133 $out->elementEnd('td');
134 $out->elementEnd('tr');
136 $out->elementEnd('table');
137 $out->elementEnd('div');
141 * Buttons for form actions
143 * Submit and cancel buttons (or whatever)
144 * Sub-classes should overload this to show their own buttons.
148 function formActions()
155 * Should be unique on the page. Sub-classes should overload this
156 * to show their own IDs.
158 * @return string ID of the form
162 return 'add-mirror-wizard';
166 * Action of the form.
168 * URL to post to. Should be overloaded by subclasses to give
169 * somewhere to post to.
171 * @return string URL to post to
175 return common_local_url('addmirror');
181 * @return string the form's class
185 return 'form_settings';