]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/SubMirror/actions/mirrorsettings.php
1bfc848ebbbbda41686d1d7a2f10ab23ea103b99
[quix0rs-gnu-social.git] / plugins / SubMirror / actions / mirrorsettings.php
1 <?php
2 /**
3  * StatusNet, the distributed open-source microblogging tool
4  *
5  * PHP version 5
6  *
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.
11  *
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.
16  *
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/>.
19  *
20  * @category  Plugins
21  * @package   StatusNet
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/
26  */
27
28 if (!defined('GNUSOCIAL')) { exit(1); }
29
30 class MirrorSettingsAction extends SettingsAction
31 {
32     /**
33      * Title of the page
34      *
35      * @return string Page title
36      */
37     function title()
38     {
39         // TRANS: Page title.
40         return _m('Feed mirror settings');
41     }
42
43     /**
44      * Instructions for use
45      *
46      * @return string Instructions for use
47      */
48
49     function getInstructions()
50     {
51         // TRANS: Page instructions.
52         return _m('You can mirror updates from many RSS and Atom feeds ' .
53                   'into your GNU social timeline!');
54     }
55
56     /**
57      * Show the form for OpenID management
58      *
59      * We have one form with a few different submit buttons to do different things.
60      *
61      * @return void
62      */
63     function showContent()
64     {
65         $provider = $this->trimmed('provider');
66         if (!empty($provider) || GNUsocial::isAjax()) {
67             $this->showAddFeedForm($provider);
68         } else {
69             $this->elementStart('div', array('id' => 'add-mirror'));
70             $this->showAddWizard();
71             $this->elementEnd('div');
72
73             $mirror = new SubMirror();
74             $mirror->subscriber = $this->scoped->getID();
75             if ($mirror->find()) {
76                 while ($mirror->fetch()) {
77                     $this->showFeedForm($mirror);
78                 }
79             }
80         }
81     }
82
83     function showAddWizard()
84     {
85         $form = new AddMirrorWizard($this);
86         $form->show();
87     }
88
89     function showFeedForm(SubMirror $mirror)
90     {
91         $profile = Profile::getByID($mirror->subscribed);
92         $form = new EditMirrorForm($this, $profile);
93         $form->show();
94     }
95
96     function showAddFeedForm()
97     {
98         switch ($this->arg('provider')) {
99         case 'statusnet':
100             break;
101         case 'wordpress':
102             break;
103         case 'linkedin':
104             break;
105         case 'feed':
106         default:
107             $form = new AddMirrorForm($this);
108         }
109         $form->show();
110     }
111
112     /**
113      * Show the local navigation menu
114      *
115      * This is the same for all settings, so we show it here.
116      *
117      * @return void
118      */
119     function showLocalNav()
120     {
121         $menu = new SettingsNav($this);
122         $menu->show();
123     }
124
125     function showScripts()
126     {
127         parent::showScripts();
128         $this->script('plugins/SubMirror/js/mirrorsettings.js');
129     }
130
131     function showStylesheets()
132     {
133         parent::showStylesheets();
134         $this->cssLink('plugins/SubMirror/css/mirrorsettings.css');
135     }
136 }