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' => getFacebookBaseCSS()));
42 common_element('link', array('rel' => 'stylesheet',
44 'href' => getFacebookThemeCSS()));
46 common_element('script', array('type' => 'text/javascript',
47 'src' => getFacebookJS()),
50 common_element_start('a', array('class' => 'url home bookmark',
51 'href' => common_local_url('public')));
52 if (common_config('site', 'logo') || file_exists(theme_file('logo.png'))) {
53 common_element('img', array('class' => 'logo photo',
54 'src' => (common_config('site', 'logo')) ?
55 common_config('site', 'logo') : theme_path('logo.png'),
56 'alt' => common_config('site', 'name')));
59 common_element('span', array('class' => 'fn org'), common_config('site', 'name'));
60 common_element_end('a');
64 function showHeader($selected = 'Home', $msg = null, $success = false)
69 common_element_start('fb:if-section-not-added', array('section' => 'profile'));
70 common_element_start('span', array('id' => 'add_to_profile'));
71 common_element('fb:add-section-button', array('section' => 'profile'));
72 common_element_end('span');
73 common_element_end('fb:if-section-not-added');
77 common_element_start('dl', array("id" => 'site_nav_local_views'));
78 common_element('dt', null, _('Local Views'));
79 common_element_start('dd');
81 common_element_start('ul', array('class' => 'nav'));
83 common_element_start('li', array('class' =>
84 ($selected == 'Home') ? 'current' : 'facebook_home'));
86 array('href' => 'index.php', 'title' => _('Home')), _('Home'));
87 common_element_end('li');
90 common_element_start('li',
92 ($selected == 'Invite') ? 'current' : 'facebook_invite'));
94 array('href' => 'invite.php', 'title' => _('Invite')), _('Invite'));
95 common_element_end('li');
97 common_element_start('li',
99 ($selected == 'Settings') ? 'current' : 'facebook_settings'));
101 array('href' => 'settings.php',
102 'title' => _('Settings')), _('Settings'));
103 common_element_end('li');
105 common_element_end('ul');
107 common_element_end('dd');
108 common_element_end('dl');
113 common_element('fb:success', array('message' => $msg));
115 // XXX do an error message here
119 common_element_start('div', 'main_body');
123 function showFooter()
125 common_element_end('div');
130 function showInstructions()
134 common_element_start('dl', array('class' => 'system_notice'));
135 common_element('dt', null, 'Page Notice');
137 $loginmsg_part1 = _('To use the %s Facebook Application you need to login ' .
138 'with your username and password. Don\'t have a username yet? ');
140 $loginmsg_part2 = _(' a new account.');
142 common_element_start('dd');
143 common_element_start('p');
144 common_text(sprintf($loginmsg_part1, common_config('site', 'name')));
146 array('href' => common_local_url('register')), _('Register'));
147 common_text($loginmsg_part2);
148 common_element_end('dd');
149 common_element_end('dl');
152 function showLoginForm($msg = null)
156 common_element('link', array('rel' => 'stylesheet',
157 'type' => 'text/css',
158 'href' => getFacebookCSS()));
162 common_element_start('div', array('class' => 'content'));
163 common_element('h1', null, _('Login'));
166 common_element('fb:error', array('message' => $msg));
169 $this->showInstructions();
171 common_element_start('div', array('id' => 'content_inner'));
173 common_element_start('form', array('method' => 'post',
175 'action' => 'index.php'));
177 common_element_start('fieldset');
178 common_element('legend', null, _('Login to site'));
180 common_element_start('ul', array('class' => 'form_datas'));
181 common_element_start('li');
182 common_input('nickname', _('Nickname'));
183 common_element_end('li');
184 common_element_start('li');
185 common_password('password', _('Password'));
186 common_element_end('li');
187 common_element_end('ul');
189 common_submit('submit', _('Login'));
190 common_element_end('form');
192 common_element_start('p');
193 common_element('a', array('href' => common_local_url('recoverpassword')),
194 _('Lost or forgotten password?'));
195 common_element_end('p');
197 common_element_end('div');