]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - lib/facebookaction.php
Add a menuItem method to Action
[quix0rs-gnu-social.git] / lib / facebookaction.php
1 <?php
2 /*
3  * Laconica - a distributed open-source microblogging tool
4  * Copyright (C) 2008, Controlez-Vous, Inc.
5  *
6  * 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.
10  *
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.
15  *
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/>.
18  */
19
20 if (!defined('LACONICA')) { exit(1); }
21
22 require_once(INSTALLDIR.'/lib/facebookutil.php');
23
24 class FacebookAction extends Action
25 {
26
27     function handle($args)
28     {
29         parent::handle($args);
30     }
31
32     function show_header($selected = 'Home', $msg = null, $success = false)
33     {
34
35         start_fbml();
36
37         # Add a timestamp to the CSS file so Facebook cache wont ignore our changes
38         $ts = filemtime(theme_file('facebookapp.css'));
39         $cssurl = theme_path('facebookapp.css') . "?ts=$ts";
40
41         common_element('link', array('rel' => 'stylesheet',
42                                      'type' => 'text/css',
43                                      'href' => $cssurl));
44
45         common_element('fb:dashboard');
46
47         common_element_start('fb:tabs');
48         common_element('fb:tab-item', array('title' => 'Home',
49                                             'href' => 'index.php',
50                                             'selected' => ($selected == 'Home')));
51         common_element('fb:tab-item', array('title' => 'Invite',
52                                             'href' => 'invite.php',
53                                             'selected' => ($selected == 'Invite')));
54         common_element('fb:tab-item', array('title' => 'Settings',
55                                             'href' => 'settings.php',
56                                             'selected' => ($selected == 'Settings')));
57         common_element_end('fb:tabs');
58
59
60         if ($msg) {
61             if ($success) {
62                 common_element('fb:success', array('message' => $msg));
63             } else {
64                 // XXX do an error message here
65             }
66         }
67
68         common_element_start('div', 'main_body');
69
70     }
71
72     function show_footer()
73     {
74         common_element_end('div');
75         common_end_xml();
76     }
77
78     function showLoginForm($msg = null)
79     {
80         start_fbml();
81
82         common_element_start('a', array('href' => 'http://identi.ca'));
83         common_element('img', array('src' => 'http://theme.identi.ca/identica/logo.png',
84                                     'alt' => 'Identi.ca',
85                                     'id' => 'logo'));
86         common_element_end('a');
87
88         if ($msg) {
89              common_element('fb:error', array('message' => $msg));
90         }
91
92         common_element("h2", null,
93             _('To add the Identi.ca application, you need to log into your Identi.ca account.'));
94
95
96         common_element_start('div', array('class' => 'instructions'));
97         common_element_start('p');
98         common_raw('Login with your username and password. Don\'t have a username yet?'
99         .' <a href="http://identi.ca/main/register">Register</a> a new account.');
100         common_element_end('p');
101         common_element_end('div');
102
103         common_element_start('div', array('id' => 'content'));
104         common_element_start('form', array('method' => 'post',
105                                                'id' => 'login',
106                                                'action' => 'index.php'));
107         common_input('nickname', _('Nickname'));
108         common_password('password', _('Password'));
109
110         common_submit('submit', _('Login'));
111         common_element_end('form');
112
113         common_element_start('p');
114         common_element('a', array('href' => common_local_url('recoverpassword')),
115                        _('Lost or forgotten password?'));
116         common_element_end('p');
117         common_element_end('div');
118
119         common_end_xml();
120
121     }
122
123
124 }