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 $this->showStylesheets();
41 common_element_start('a', array('class' => 'url home bookmark',
42 'href' => common_local_url('public')));
43 if (common_config('site', 'logo') || file_exists(theme_file('logo.png'))) {
44 common_element('img', array('class' => 'logo photo',
45 'src' => (common_config('site', 'logo')) ?
46 common_config('site', 'logo') : theme_path('logo.png'),
47 'alt' => common_config('site', 'name')));
50 common_element('span', array('class' => 'fn org'), common_config('site', 'name'));
51 common_element_end('a');
56 function showHeader($msg = null, $success = false)
60 common_element_start('fb:if-section-not-added', array('section' => 'profile'));
61 common_element_start('span', array('id' => 'add_to_profile'));
62 common_element('fb:add-section-button', array('section' => 'profile'));
63 common_element_end('span');
64 common_element_end('fb:if-section-not-added');
70 common_element('fb:success', array('message' => $msg));
72 // XXX do an error message here
76 common_element_start('div', 'main_body');
80 function showNav($selected = 'Home')
83 common_element_start('dl', array("id" => 'site_nav_local_views'));
84 common_element('dt', null, _('Local Views'));
85 common_element_start('dd');
87 common_element_start('ul', array('class' => 'nav'));
89 common_element_start('li', array('class' =>
90 ($selected == 'Home') ? 'current' : 'facebook_home'));
92 array('href' => 'index.php', 'title' => _('Home')), _('Home'));
93 common_element_end('li');
95 common_element_start('li',
97 ($selected == 'Invite') ? 'current' : 'facebook_invite'));
99 array('href' => 'invite.php', 'title' => _('Invite')), _('Invite'));
100 common_element_end('li');
102 common_element_start('li',
104 ($selected == 'Settings') ? 'current' : 'facebook_settings'));
106 array('href' => 'settings.php',
107 'title' => _('Settings')), _('Settings'));
108 common_element_end('li');
110 common_element_end('ul');
112 common_element_end('dd');
113 common_element_end('dl');
117 function showFooter()
119 common_element_end('div');
124 function showInstructions()
128 common_element_start('dl', array('class' => 'system_notice'));
129 common_element('dt', null, 'Page Notice');
131 $loginmsg_part1 = _('To use the %s Facebook Application you need to login ' .
132 'with your username and password. Don\'t have a username yet? ');
134 $loginmsg_part2 = _(' a new account.');
136 common_element_start('dd');
137 common_element_start('p');
138 common_text(sprintf($loginmsg_part1, common_config('site', 'name')));
140 array('href' => common_local_url('register')), _('Register'));
141 common_text($loginmsg_part2);
142 common_element_end('dd');
143 common_element_end('dl');
147 function showStylesheets()
151 common_element('link', array('rel' => 'stylesheet',
152 'type' => 'text/css',
153 'href' => getFacebookBaseCSS()));
155 common_element('link', array('rel' => 'stylesheet',
156 'type' => 'text/css',
157 'href' => getFacebookThemeCSS()));
160 function showScripts()
164 common_element('script', array('type' => 'text/javascript',
165 'src' => getFacebookJS()));
169 function showLoginForm($msg = null)
173 $this->showStylesheets();
174 $this->showScripts();
178 common_element_start('div', array('class' => 'content'));
179 common_element('h1', null, _('Login'));
182 common_element('fb:error', array('message' => $msg));
185 $this->showInstructions();
187 common_element_start('div', array('id' => 'content_inner'));
189 common_element_start('form', array('method' => 'post',
190 'class' => 'form_settings',
192 'action' => 'index.php'));
194 common_element_start('fieldset');
195 common_element('legend', null, _('Login to site'));
197 common_element_start('ul', array('class' => 'form_datas'));
198 common_element_start('li');
199 common_input('nickname', _('Nickname'));
200 common_element_end('li');
201 common_element_start('li');
202 common_password('password', _('Password'));
203 common_element_end('li');
204 common_element_end('ul');
206 common_submit('submit', _('Login'));
207 common_element_end('form');
209 common_element_start('p');
210 common_element('a', array('href' => common_local_url('recoverpassword')),
211 _('Lost or forgotten password?'));
212 common_element_end('p');
214 common_element_end('div');
221 function showNoticeForm($user)
226 common_element_start('form', array('id' => 'form_notice',
228 'action' => 'index.php'));
230 common_element_start('fieldset');
231 common_element('legend', null, 'Send a notice');
233 common_element_start('ul', 'form_datas');
234 common_element_start('li', array('id' => 'noticcommon_elemente_text'));
235 common_element('label', array('for' => 'notice_data-text'),
236 sprintf(_('What\'s up, %s?'), $user->nickname));
238 common_element('textarea', array('id' => 'notice_data-text',
241 'name' => 'status_textarea'));
242 common_element_end('li');
243 common_element_end('ul');
245 common_element_start('dl', 'form_note');
246 common_element('dt', null, _('Available characters'));
247 common_element('dd', array('id' => 'notice_text-count'),
249 common_element_end('dl');
251 common_element_start('ul', array('class' => 'form_actions'));
253 common_element_start('li', array('id' => 'notice_submit'));
255 common_submit('submit', _('Send'));
258 common_element('input', array('id' => 'notice_action-submit',
260 'name' => 'status_submit',
262 'value' => _('Send')));
264 common_element_end('li');
265 common_element_end('ul');
266 common_element_end('fieldset');
267 common_element_end('form');