summaryrefslogtreecommitdiff
path: root/lib/facebookaction.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/facebookaction.php')
-rw-r--r--lib/facebookaction.php252
1 files changed, 197 insertions, 55 deletions
diff --git a/lib/facebookaction.php b/lib/facebookaction.php
index 3a00c71dd..6d42596e8 100644
--- a/lib/facebookaction.php
+++ b/lib/facebookaction.php
@@ -17,9 +17,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+ exit(1);
+}
-require_once(INSTALLDIR.'/lib/facebookutil.php');
+require_once INSTALLDIR.'/lib/facebookutil.php';
class FacebookAction extends Action
{
@@ -29,96 +31,236 @@ class FacebookAction extends Action
parent::handle($args);
}
- function show_header($selected = 'Home', $msg = null, $success = false)
- {
+ function showLogo(){
- start_fbml();
+ global $xw;
- # Add a timestamp to the CSS file so Facebook cache wont ignore our changes
- $ts = filemtime(theme_file('facebookapp.css'));
- $cssurl = theme_path('facebookapp.css') . "?ts=$ts";
+ $this->showStylesheets();
+ $this->showScripts();
- common_element('link', array('rel' => 'stylesheet',
- 'type' => 'text/css',
- 'href' => $cssurl));
+ $this->elementStart('a', array('class' => 'url home bookmark',
+ 'href' => common_local_url('public')));
+ if (common_config('site', 'logo') || file_exists(theme_file('logo.png'))) {
+ $this->element('img', array('class' => 'logo photo',
+ 'src' => (common_config('site', 'logo')) ?
+ common_config('site', 'logo') : theme_path('logo.png'),
+ 'alt' => common_config('site', 'name')));
+ }
+
+ $this->element('span', array('class' => 'fn org'), common_config('site', 'name'));
+ $this->elementEnd('a');
+
+ }
- common_element('fb:dashboard');
+ function showHeader($msg = null, $success = false)
+ {
+ startFBML();
- common_element_start('fb:tabs');
- common_element('fb:tab-item', array('title' => 'Home',
- 'href' => 'index.php',
- 'selected' => ($selected == 'Home')));
- common_element('fb:tab-item', array('title' => 'Invite',
- 'href' => 'invite.php',
- 'selected' => ($selected == 'Invite')));
- common_element('fb:tab-item', array('title' => 'Settings',
- 'href' => 'settings.php',
- 'selected' => ($selected == 'Settings')));
- common_element_end('fb:tabs');
+ $this->elementStart('fb:if-section-not-added', array('section' => 'profile'));
+ $this->elementStart('span', array('id' => 'add_to_profile'));
+ $this->element('fb:add-section-button', array('section' => 'profile'));
+ $this->elementEnd('span');
+ $this->elementEnd('fb:if-section-not-added');
+ $this->showLogo();
if ($msg) {
if ($success) {
- common_element('fb:success', array('message' => $msg));
+ $this->element('fb:success', array('message' => $msg));
} else {
// XXX do an error message here
}
}
- common_element_start('div', 'main_body');
+ $this->elementStart('div', 'main_body');
+
+ }
+
+ function showNav($selected = 'Home')
+ {
+
+ $this->elementStart('dl', array("id" => 'site_nav_local_views'));
+ $this->element('dt', null, _('Local Views'));
+ $this->elementStart('dd');
+
+ $this->elementStart('ul', array('class' => 'nav'));
+
+ $this->elementStart('li', array('class' =>
+ ($selected == 'Home') ? 'current' : 'facebook_home'));
+ $this->element('a',
+ array('href' => 'index.php', 'title' => _('Home')), _('Home'));
+ $this->elementEnd('li');
+
+ $this->elementStart('li',
+ array('class' =>
+ ($selected == 'Invite') ? 'current' : 'facebook_invite'));
+ $this->element('a',
+ array('href' => 'invite.php', 'title' => _('Invite')), _('Invite'));
+ $this->elementEnd('li');
+
+ $this->elementStart('li',
+ array('class' =>
+ ($selected == 'Settings') ? 'current' : 'facebook_settings'));
+ $this->element('a',
+ array('href' => 'settings.php',
+ 'title' => _('Settings')), _('Settings'));
+ $this->elementEnd('li');
+
+ $this->elementEnd('ul');
+
+ $this->elementEnd('dd');
+ $this->elementEnd('dl');
+
+ }
+
+ function showFooter()
+ {
+ $this->elementEnd('div');
+ $this->endXml();
+ }
+
+ function showInstructions()
+ {
+ global $xw;
+
+ $this->elementStart('dl', array('class' => 'system_notice'));
+ $this->element('dt', null, 'Page Notice');
+
+ $loginmsg_part1 = _('To use the %s Facebook Application you need to login ' .
+ 'with your username and password. Don\'t have a username yet? ');
+ $loginmsg_part2 = _(' a new account.');
+
+ $this->elementStart('dd');
+ $this->elementStart('p');
+ $this->text(sprintf($loginmsg_part1, common_config('site', 'name')));
+ $this->element('a',
+ array('href' => common_local_url('register')), _('Register'));
+ $this->text($loginmsg_part2);
+ $this->elementEnd('dd');
+ $this->elementEnd('dl');
+ }
+
+ function showStylesheets()
+ {
+ global $xw;
+
+ $this->element('link', array('rel' => 'stylesheet',
+ 'type' => 'text/css',
+ 'href' => getFacebookBaseCSS()));
+
+ $this->element('link', array('rel' => 'stylesheet',
+ 'type' => 'text/css',
+ 'href' => getFacebookThemeCSS()));
}
- function show_footer()
+ function showScripts()
{
- common_element_end('div');
- common_end_xml();
+ global $xw;
+
+ $this->element('script', array('type' => 'text/javascript',
+ 'src' => getFacebookJS()));
+
}
function showLoginForm($msg = null)
{
- start_fbml();
+ startFBML();
+
+ $this->showStylesheets();
+ $this->showScripts();
- common_element_start('a', array('href' => 'http://identi.ca'));
- common_element('img', array('src' => 'http://theme.identi.ca/identica/logo.png',
- 'alt' => 'Identi.ca',
- 'id' => 'logo'));
- common_element_end('a');
+ $this->showLogo();
+
+ $this->elementStart('div', array('class' => 'content'));
+ $this->element('h1', null, _('Login'));
if ($msg) {
- common_element('fb:error', array('message' => $msg));
+ $this->element('fb:error', array('message' => $msg));
}
- common_element("h2", null,
- _('To add the Identi.ca application, you need to log into your Identi.ca account.'));
-
+ $this->showInstructions();
- common_element_start('div', array('class' => 'instructions'));
- common_element_start('p');
- common_raw('Login with your username and password. Don\'t have a username yet?'
- .' <a href="http://identi.ca/main/register">Register</a> a new account.');
- common_element_end('p');
- common_element_end('div');
+ $this->elementStart('div', array('id' => 'content_inner'));
- common_element_start('div', array('id' => 'content'));
- common_element_start('form', array('method' => 'post',
+ $this->elementStart('form', array('method' => 'post',
+ 'class' => 'form_settings',
'id' => 'login',
'action' => 'index.php'));
- common_input('nickname', _('Nickname'));
- common_password('password', _('Password'));
- common_submit('submit', _('Login'));
- common_element_end('form');
+ $this->elementStart('fieldset');
+ $this->element('legend', null, _('Login to site'));
+
+ $this->elementStart('ul', array('class' => 'form_datas'));
+ $this->elementStart('li');
+ $this->input('nickname', _('Nickname'));
+ $this->elementEnd('li');
+ $this->elementStart('li');
+ $this->password('password', _('Password'));
+ $this->elementEnd('li');
+ $this->elementEnd('ul');
- common_element_start('p');
- common_element('a', array('href' => common_local_url('recoverpassword')),
+ $this->submit('submit', _('Login'));
+ $this->elementEnd('form');
+
+ $this->elementStart('p');
+ $this->element('a', array('href' => common_local_url('recoverpassword')),
_('Lost or forgotten password?'));
- common_element_end('p');
- common_element_end('div');
+ $this->elementEnd('p');
+
+ $this->elementEnd('div');
- common_end_xml();
+ $this->endXml();
}
+ function showNoticeForm($user)
+ {
+
+ global $xw;
+
+ $this->elementStart('form', array('id' => 'form_notice',
+ 'method' => 'post',
+ 'action' => 'index.php'));
+
+ $this->elementStart('fieldset');
+ $this->element('legend', null, 'Send a notice');
+
+ $this->elementStart('ul', 'form_datas');
+ $this->elementStart('li', array('id' => 'noticcommon_elemente_text'));
+ $this->element('label', array('for' => 'notice_data-text'),
+ sprintf(_('What\'s up, %s?'), $user->nickname));
+
+ $this->element('textarea', array('id' => 'notice_data-text',
+ 'cols' => 35,
+ 'rows' => 4,
+ 'name' => 'status_textarea'));
+ $this->elementEnd('li');
+ $this->elementEnd('ul');
+
+ $this->elementStart('dl', 'form_note');
+ $this->element('dt', null, _('Available characters'));
+ $this->element('dd', array('id' => 'notice_text-count'),
+ '140');
+ $this->elementEnd('dl');
+
+ $this->elementStart('ul', array('class' => 'form_actions'));
+
+ $this->elementStart('li', array('id' => 'notice_submit'));
+
+ $this->submit('submit', _('Send'));
+
+ /*
+ $this->element('input', array('id' => 'notice_action-submit',
+ 'class' => 'submit',
+ 'name' => 'status_submit',
+ 'type' => 'submit',
+ 'value' => _('Send')));
+ */
+ $this->elementEnd('li');
+ $this->elementEnd('ul');
+ $this->elementEnd('fieldset');
+ $this->elementEnd('form');
+ }
}