3 * StatusNet, the distributed open-source microblogging tool
7 * LICENCE: This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 * @author Brion Vibber <brion@status.net>
23 * @copyright 2010 StatusNet, Inc.
24 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
25 * @link http://status.net/
28 if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); }
30 class MirrorSettingsAction extends SettingsAction
35 * @return string Page title
40 return _m('Feed mirror settings');
44 * Instructions for use
46 * @return string Instructions for use
49 function getInstructions()
51 // TRANS: Page instructions.
52 return _m('You can mirror updates from many RSS and Atom feeds ' .
53 'into your GNU social timeline!');
57 * Show the form for OpenID management
59 * We have one form with a few different submit buttons to do different things.
63 function showContent()
65 $user = common_current_user();
66 $provider = $this->trimmed('provider');
68 $this->showAddFeedForm($provider);
70 $this->elementStart('div', array('id' => 'add-mirror'));
71 $this->showAddWizard();
72 $this->elementEnd('div');
74 $mirror = new SubMirror();
75 $mirror->subscriber = $user->id;
76 if ($mirror->find()) {
77 while ($mirror->fetch()) {
78 $this->showFeedForm($mirror);
84 function showAddWizard()
86 $form = new AddMirrorWizard($this);
90 function showFeedForm($mirror)
92 $profile = Profile::getKV('id', $mirror->subscribed);
94 $form = new EditMirrorForm($this, $profile);
99 function showAddFeedForm()
101 switch ($this->arg('provider')) {
110 $form = new AddMirrorForm($this);
119 * @todo move the ajax display handling to common code
121 function handle($args)
123 if ($this->boolean('ajax')) {
124 $this->startHTML('text/xml;charset=utf-8');
125 $this->elementStart('head');
126 // TRANS: Title for page with form to add a mirror feed provider on.
127 $this->element('title', null, _m('Provider add'));
128 $this->elementEnd('head');
129 $this->elementStart('body');
131 $this->showAddFeedForm();
133 $this->elementEnd('body');
136 return parent::handle($args);
140 * Handle a POST request
142 * Muxes to different sub-functions based on which button was pushed
146 function handlePost()
151 * Show the local navigation menu
153 * This is the same for all settings, so we show it here.
157 function showLocalNav()
159 $menu = new SettingsNav($this);
163 function showScripts()
165 parent::showScripts();
166 $this->script('plugins/SubMirror/js/mirrorsettings.js');
169 function showStylesheets()
171 parent::showStylesheets();
172 $this->cssLink('plugins/SubMirror/css/mirrorsettings.css');