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('STATUSNET') && !defined('LACONICA')) {
32 class MirrorSettingsAction extends SettingsAction
37 * @return string Page title
42 return _m('Feed mirror settings');
46 * Instructions for use
48 * @return string Instructions for use
51 function getInstructions()
53 // TRANS: Instructions.
54 return _m('You can mirror updates from many RSS and Atom feeds ' .
55 'into your StatusNet timeline!');
59 * Show the form for OpenID management
61 * We have one form with a few different submit buttons to do different things.
65 function showContent()
67 $user = common_current_user();
68 $provider = $this->trimmed('provider');
70 $this->showAddFeedForm($provider);
72 $this->elementStart('div', array('id' => 'add-mirror'));
73 $this->showAddWizard();
74 $this->elementEnd('div');
76 $mirror = new SubMirror();
77 $mirror->subscriber = $user->id;
78 if ($mirror->find()) {
79 while ($mirror->fetch()) {
80 $this->showFeedForm($mirror);
86 function showAddWizard()
88 $form = new AddMirrorWizard($this);
92 function showFeedForm($mirror)
94 $profile = Profile::staticGet('id', $mirror->subscribed);
96 $form = new EditMirrorForm($this, $profile);
101 function showAddFeedForm()
103 switch ($this->arg('provider')) {
107 $form = new AddTwitterMirrorForm($this);
115 $form = new AddMirrorForm($this);
124 * @todo move the ajax display handling to common code
126 function handle($args)
128 if ($this->boolean('ajax')) {
129 header('Content-Type: text/html;charset=utf-8');
130 $this->elementStart('html');
131 $this->elementStart('head');
132 $this->element('title', null, _('Provider add'));
133 $this->elementEnd('head');
134 $this->elementStart('body');
136 $this->showAddFeedForm();
138 $this->elementEnd('body');
139 $this->elementEnd('html');
141 return parent::handle($args);
145 * Handle a POST request
147 * Muxes to different sub-functions based on which button was pushed
151 function handlePost()
155 function showLocalNav()
157 $nav = new SubGroupNav($this, common_current_user());
161 function showScripts()
163 parent::showScripts();
164 $this->script('plugins/SubMirror/js/mirrorsettings.js');
167 function showStylesheets()
169 parent::showStylesheets();
170 $this->cssLink('plugins/SubMirror/css/mirrorsettings.css');