summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZach Copley <zach@controlyourself.ca>2009-01-19 07:24:12 +0000
committerZach Copley <zach@controlyourself.ca>2009-01-19 07:24:12 +0000
commit739baf0396b2e6796f07616cdb9d52d09cf6ed2f (patch)
tree50312fee736ad33aaf88e1e64c6a67f14ff6a758 /lib
parentcd6b9d6c4608cc5bb524031f8de97a3dc5cc3ea9 (diff)
trac750 Add notice input box to FB app and ability to post notices
Diffstat (limited to 'lib')
-rw-r--r--lib/facebookaction.php124
-rw-r--r--lib/facebookutil.php38
2 files changed, 128 insertions, 34 deletions
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');
+ }
+
}
diff --git a/lib/facebookutil.php b/lib/facebookutil.php
index cc4941bdc..a133ce8ba 100644
--- a/lib/facebookutil.php
+++ b/lib/facebookutil.php
@@ -44,7 +44,7 @@ function get_facebook()
return new Facebook($apikey, $secret);
}
-function start_fbml($indent = true)
+function startFBML($indent = true)
{
global $xw;
$xw = new XMLWriter();
@@ -132,6 +132,42 @@ function getFacebookJS() {
}
+// Does a little before-after block for next/prev page
+
+function facebookPagination($have_before, $have_after, $page, $action, $args=null)
+{
+
+ if ($have_before || $have_after) {
+ common_element_start('div', array('id' => 'pagination'));
+ common_element_start('ul', array('id' => 'nav_pagination'));
+ }
+
+ if ($have_before) {
+ $pargs = array('page' => $page-1);
+ $newargs = ($args) ? array_merge($args,$pargs) : $pargs;
+
+ common_element_start('li', 'before');
+ common_element('a', array('href' => "index.php?page=$newargs[page]", 'rel' => 'prev'),
+ _('« After'));
+ common_element_end('li');
+ }
+
+ if ($have_after) {
+ $pargs = array('page' => $page+1);
+ $newargs = ($args) ? array_merge($args,$pargs) : $pargs;
+ common_element_start('li', 'after');
+ common_element('a', array('href' => "index.php?page=$newargs[page]", 'rel' => 'next'),
+ _('Before »'));
+ common_element_end('li');
+ }
+
+ if ($have_before || $have_after) {
+ common_element_end('ul');
+ common_element_end('div');
+ }
+}
+
+
class FacebookNoticeList extends NoticeList
{
/**