3 * Laconica - a distributed open-source microblogging tool
4 * Copyright (C) 2008, Controlez-Vous, Inc.
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.
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 if (!defined('LACONICA')) {
24 require_once INSTALLDIR.'/lib/facebookutil.php';
26 class FacebookAction extends Action
29 function handle($args)
31 parent::handle($args);
38 common_element('link', array('rel' => 'stylesheet',
40 'href' => getFacebookCSS()));
42 common_element('script', array('type' => 'text/javascript',
43 'src' => getFacebookJS()),
46 common_element_start('a', array('class' => 'url home bookmark',
47 'href' => common_local_url('public')));
48 if (common_config('site', 'logo') || file_exists(theme_file('logo.png'))) {
49 common_element('img', array('class' => 'logo photo',
50 'src' => (common_config('site', 'logo')) ?
51 common_config('site', 'logo') : theme_path('logo.png'),
52 'alt' => common_config('site', 'name')));
55 common_element('span', array('class' => 'fn org'), common_config('site', 'name'));
56 common_element_end('a');
60 function showHeader($selected = 'Home', $msg = null, $success = false)
65 common_element_start('fb:if-section-not-added', array('section' => 'profile'));
66 common_element_start('span', array('id' => 'add_to_profile'));
67 common_element('fb:add-section-button', array('section' => 'profile'));
68 common_element_end('span');
69 common_element_end('fb:if-section-not-added');
73 common_element_start('dl', array("id" => 'site_nav_local_views'));
74 common_element('dt', null, _('Local Views'));
75 common_element_start('dd');
77 common_element_start('ul', array('class' => 'nav'));
79 common_element_start('li', array('class' =>
80 ($selected == 'Home') ? 'current' : 'facebook_home'));
82 array('href' => 'index.php', 'title' => _('Home')), _('Home'));
83 common_element_end('li');
86 common_element_start('li',
88 ($selected == 'Invite') ? 'current' : 'facebook_invite'));
90 array('href' => 'invite.php', 'title' => _('Invite')), _('Invite'));
91 common_element_end('li');
93 common_element_start('li',
95 ($selected == 'Settings') ? 'current' : 'facebook_settings'));
97 array('href' => 'settings.php',
98 'title' => _('Settings')), _('Settings'));
99 common_element_end('li');
101 common_element_end('ul');
103 common_element_end('dd');
104 common_element_end('dl');
109 common_element('fb:success', array('message' => $msg));
111 // XXX do an error message here
115 common_element_start('div', 'main_body');
119 function showFooter()
121 common_element_end('div');
126 function showInstructions()
130 common_element_start('dl', array('class' => 'system_notice'));
131 common_element('dt', null, 'Page Notice');
133 $loginmsg_part1 = _('To use the %s Facebook Application you need to login ' .
134 'with your username and password. Don\'t have a username yet? ');
136 $loginmsg_part2 = _(' a new account.');
138 common_element_start('dd');
139 common_element_start('p');
140 common_text(sprintf($loginmsg_part1, common_config('site', 'name')));
142 array('href' => common_local_url('register')), _('Register'));
143 common_text($loginmsg_part2);
144 common_element_end('dd');
145 common_element_end('dl');
148 function showLoginForm($msg = null)
152 common_element('link', array('rel' => 'stylesheet',
153 'type' => 'text/css',
154 'href' => getFacebookCSS()));
158 common_element_start('div', array('class' => 'content'));
159 common_element('h1', null, _('Login'));
162 common_element('fb:error', array('message' => $msg));
165 $this->showInstructions();
167 common_element_start('div', array('id' => 'content_inner'));
169 common_element_start('form', array('method' => 'post',
171 'action' => 'index.php'));
173 common_element_start('fieldset');
174 common_element('legend', null, _('Login to site'));
176 common_element_start('ul', array('class' => 'form_datas'));
177 common_element_start('li');
178 common_input('nickname', _('Nickname'));
179 common_element_end('li');
180 common_element_start('li');
181 common_password('password', _('Password'));
182 common_element_end('li');
183 common_element_end('ul');
185 common_submit('submit', _('Login'));
186 common_element_end('form');
188 common_element_start('p');
189 common_element('a', array('href' => common_local_url('recoverpassword')),
190 _('Lost or forgotten password?'));
191 common_element_end('p');
193 common_element_end('div');