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 $this->elementStart('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 $this->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 $this->element('span', array('class' => 'fn org'), common_config('site', 'name'));
51 $this->elementEnd('a');
55 function showHeader($msg = null, $success = false)
59 $this->elementStart('fb:if-section-not-added', array('section' => 'profile'));
60 $this->elementStart('span', array('id' => 'add_to_profile'));
61 $this->element('fb:add-section-button', array('section' => 'profile'));
62 $this->elementEnd('span');
63 $this->elementEnd('fb:if-section-not-added');
69 $this->element('fb:success', array('message' => $msg));
71 // XXX do an error message here
75 $this->elementStart('div', 'main_body');
79 function showNav($selected = 'Home')
82 $this->elementStart('dl', array("id" => 'site_nav_local_views'));
83 $this->element('dt', null, _('Local Views'));
84 $this->elementStart('dd');
86 $this->elementStart('ul', array('class' => 'nav'));
88 $this->elementStart('li', array('class' =>
89 ($selected == 'Home') ? 'current' : 'facebook_home'));
91 array('href' => 'index.php', 'title' => _('Home')), _('Home'));
92 $this->elementEnd('li');
94 $this->elementStart('li',
96 ($selected == 'Invite') ? 'current' : 'facebook_invite'));
98 array('href' => 'invite.php', 'title' => _('Invite')), _('Invite'));
99 $this->elementEnd('li');
101 $this->elementStart('li',
103 ($selected == 'Settings') ? 'current' : 'facebook_settings'));
105 array('href' => 'settings.php',
106 'title' => _('Settings')), _('Settings'));
107 $this->elementEnd('li');
109 $this->elementEnd('ul');
111 $this->elementEnd('dd');
112 $this->elementEnd('dl');
116 function showFooter()
118 $this->elementEnd('div');
122 function showInstructions()
126 $this->elementStart('dl', array('class' => 'system_notice'));
127 $this->element('dt', null, 'Page Notice');
129 $loginmsg_part1 = _('To use the %s Facebook Application you need to login ' .
130 'with your username and password. Don\'t have a username yet? ');
132 $loginmsg_part2 = _(' a new account.');
134 $this->elementStart('dd');
135 $this->elementStart('p');
136 $this->text(sprintf($loginmsg_part1, common_config('site', 'name')));
138 array('href' => common_local_url('register')), _('Register'));
139 $this->text($loginmsg_part2);
140 $this->elementEnd('dd');
141 $this->elementEnd('dl');
144 function showStylesheets()
148 $this->element('link', array('rel' => 'stylesheet',
149 'type' => 'text/css',
150 'href' => getFacebookBaseCSS()));
152 $this->element('link', array('rel' => 'stylesheet',
153 'type' => 'text/css',
154 'href' => getFacebookThemeCSS()));
157 function showScripts()
161 $this->element('script', array('type' => 'text/javascript',
162 'src' => getFacebookJS()));
166 function showLoginForm($msg = null)
170 $this->showStylesheets();
171 $this->showScripts();
175 $this->elementStart('div', array('class' => 'content'));
176 $this->element('h1', null, _('Login'));
179 $this->element('fb:error', array('message' => $msg));
182 $this->showInstructions();
184 $this->elementStart('div', array('id' => 'content_inner'));
186 $this->elementStart('form', array('method' => 'post',
187 'class' => 'form_settings',
189 'action' => 'index.php'));
191 $this->elementStart('fieldset');
192 $this->element('legend', null, _('Login to site'));
194 $this->elementStart('ul', array('class' => 'form_datas'));
195 $this->elementStart('li');
196 $this->input('nickname', _('Nickname'));
197 $this->elementEnd('li');
198 $this->elementStart('li');
199 $this->password('password', _('Password'));
200 $this->elementEnd('li');
201 $this->elementEnd('ul');
203 $this->submit('submit', _('Login'));
204 $this->elementEnd('form');
206 $this->elementStart('p');
207 $this->element('a', array('href' => common_local_url('recoverpassword')),
208 _('Lost or forgotten password?'));
209 $this->elementEnd('p');
211 $this->elementEnd('div');
217 function showNoticeForm($user)
222 $this->elementStart('form', array('id' => 'form_notice',
224 'action' => 'index.php'));
226 $this->elementStart('fieldset');
227 $this->element('legend', null, 'Send a notice');
229 $this->elementStart('ul', 'form_datas');
230 $this->elementStart('li', array('id' => 'noticcommon_elemente_text'));
231 $this->element('label', array('for' => 'notice_data-text'),
232 sprintf(_('What\'s up, %s?'), $user->nickname));
234 $this->element('textarea', array('id' => 'notice_data-text',
237 'name' => 'status_textarea'));
238 $this->elementEnd('li');
239 $this->elementEnd('ul');
241 $this->elementStart('dl', 'form_note');
242 $this->element('dt', null, _('Available characters'));
243 $this->element('dd', array('id' => 'notice_text-count'),
245 $this->elementEnd('dl');
247 $this->elementStart('ul', array('class' => 'form_actions'));
249 $this->elementStart('li', array('id' => 'notice_submit'));
251 $this->submit('submit', _('Send'));
254 $this->element('input', array('id' => 'notice_action-submit',
256 'name' => 'status_submit',
258 'value' => _('Send')));
260 $this->elementEnd('li');
261 $this->elementEnd('ul');
262 $this->elementEnd('fieldset');
263 $this->elementEnd('form');