From 739baf0396b2e6796f07616cdb9d52d09cf6ed2f Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Mon, 19 Jan 2009 07:24:12 +0000 Subject: trac750 Add notice input box to FB app and ability to post notices --- lib/facebookaction.php | 124 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 91 insertions(+), 33 deletions(-) (limited to 'lib/facebookaction.php') diff --git a/lib/facebookaction.php b/lib/facebookaction.php index 263248f67..cd43a2ccb 100644 --- a/lib/facebookaction.php +++ b/lib/facebookaction.php @@ -35,17 +35,8 @@ class FacebookAction extends Action global $xw; - common_element('link', array('rel' => 'stylesheet', - 'type' => 'text/css', - 'href' => getFacebookBaseCSS())); - - common_element('link', array('rel' => 'stylesheet', - 'type' => 'text/css', - 'href' => getFacebookThemeCSS())); - - common_element('script', array('type' => 'text/javascript', - 'src' => getFacebookJS()), - ' '); + $this->showStylesheets(); + $this->showScripts(); common_element_start('a', array('class' => 'url home bookmark', 'href' => common_local_url('public'))); @@ -61,19 +52,34 @@ class FacebookAction extends Action } - function showHeader($selected = 'Home', $msg = null, $success = false) - { - start_fbml(); + function showHeader($msg = null, $success = false) + { + startFBML(); common_element_start('fb:if-section-not-added', array('section' => 'profile')); common_element_start('span', array('id' => 'add_to_profile')); common_element('fb:add-section-button', array('section' => 'profile')); common_element_end('span'); common_element_end('fb:if-section-not-added'); - + $this->showLogo(); + if ($msg) { + if ($success) { + common_element('fb:success', array('message' => $msg)); + } else { + // XXX do an error message here + } + } + + common_element_start('div', 'main_body'); + + } + + function showNav($selected = 'Home') + { + common_element_start('dl', array("id" => 'site_nav_local_views')); common_element('dt', null, _('Local Views')); common_element_start('dd'); @@ -86,7 +92,6 @@ class FacebookAction extends Action array('href' => 'index.php', 'title' => _('Home')), _('Home')); common_element_end('li'); - common_element_start('li', array('class' => ($selected == 'Invite') ? 'current' : 'facebook_invite')); @@ -107,17 +112,6 @@ class FacebookAction extends Action common_element_end('dd'); common_element_end('dl'); - - if ($msg) { - if ($success) { - common_element('fb:success', array('message' => $msg)); - } else { - // XXX do an error message here - } - } - - common_element_start('div', 'main_body'); - } function showFooter() @@ -149,10 +143,11 @@ class FacebookAction extends Action common_element_end('dl'); } - function showLoginForm($msg = null) - { - start_fbml(); + function showStylesheets() + { + global $xw; + common_element('link', array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => getFacebookBaseCSS())); @@ -160,10 +155,23 @@ class FacebookAction extends Action common_element('link', array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => getFacebookThemeCSS())); - + } + + function showScripts() + { + global $xw; + common_element('script', array('type' => 'text/javascript', - 'src' => getFacebookJS()), - ' '); + 'src' => getFacebookJS())); + + } + + function showLoginForm($msg = null) + { + startFBML(); + + $this->showStylesheets(); + $this->showScripts(); $this->showLogo(); @@ -179,6 +187,7 @@ class FacebookAction extends Action common_element_start('div', array('id' => 'content_inner')); common_element_start('form', array('method' => 'post', + 'class' => 'form_settings', 'id' => 'login', 'action' => 'index.php')); @@ -209,4 +218,53 @@ class FacebookAction extends Action } + function showNoticeForm($user) + { + + global $xw; + + common_element_start('form', array('id' => 'form_notice', + 'method' => 'post', + 'action' => 'index.php')); + + common_element_start('fieldset'); + common_element('legend', null, 'Send a notice'); + + common_element_start('ul', 'form_datas'); + common_element_start('li', array('id' => 'noticcommon_elemente_text')); + common_element('label', array('for' => 'notice_data-text'), + sprintf(_('What\'s up, %s?'), $user->nickname)); + + common_element('textarea', array('id' => 'notice_data-text', + 'cols' => 35, + 'rows' => 4, + 'name' => 'status_textarea')); + common_element_end('li'); + common_element_end('ul'); + + common_element_start('dl', 'form_note'); + common_element('dt', null, _('Available characters')); + common_element('dd', array('id' => 'notice_text-count'), + '140'); + common_element_end('dl'); + + common_element_start('ul', array('class' => 'form_actions')); + + common_element_start('li', array('id' => 'notice_submit')); + + common_submit('submit', _('Send')); + + /* + common_element('input', array('id' => 'notice_action-submit', + 'class' => 'submit', + 'name' => 'status_submit', + 'type' => 'submit', + 'value' => _('Send'))); + */ + common_element_end('li'); + common_element_end('ul'); + common_element_end('fieldset'); + common_element_end('form'); + } + } -- cgit v1.2.3-54-g00ecf