From 689be142158dae5af1516cb38b947f0364d725dd Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sun, 11 Jan 2009 07:03:59 +0000 Subject: trac750 - Facebook app now uses XMLWriter for output (much cleaner!) --- lib/facebookaction.php | 234 +++++++++++++------------------------------------ lib/facebookutil.php | 11 +++ 2 files changed, 73 insertions(+), 172 deletions(-) (limited to 'lib') diff --git a/lib/facebookaction.php b/lib/facebookaction.php index 9230bad59..04bbd67ba 100644 --- a/lib/facebookaction.php +++ b/lib/facebookaction.php @@ -21,7 +21,6 @@ if (!defined('LACONICA')) { exit(1); } require_once(INSTALLDIR.'/lib/facebookutil.php'); - class FacebookAction extends Action { @@ -74,7 +73,7 @@ class FacebookAction extends Action $html = Facebookaction::render_notice($notice); - + $fbml = "$style $html"; $fbml .= "$style $html"; @@ -85,205 +84,96 @@ class FacebookAction extends Action # Display methods - function show_header($selected ='Home') + function show_header($selected = 'Home', $msg = null, $success = false) { + start_fbml(); + # 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"; - $header = ''; - # $header .=''; - $header .= ''; - - $header .= - '' - .'' - .'' - .'' - .''; - $header .= '
'; - - echo $header; - - } - - function show_footer() - { - $footer = '
'; - echo $footer; - } + common_element('link', array('rel' => 'stylesheet', + 'type' => 'text/css', + 'href' => $cssurl)); - function show_login_form() - { + common_element('fb:dashboard'); - $loginform = - '

To add the Identi.ca application, you need to log into your Identi.ca account.

' - .'' - .' ' - .'' - .'

Login

' - .'
' - .'

Login with your username and password. Don\'t have a username yet?' - .' Register a new account.' - .'

' - .'
' - .'
' - .'
' - .'

' - .' ' - .' ' - .'

' - .'

' - .' ' - .' ' - .'

' - .'

' - .' ' - .'

' - .'
' - .'

' - .' Lost or forgotten password?' - .'

' - .'getProfile(); - $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE); - - $noticeurl = common_local_url('shownotice', array('notice' => $notice->id)); - - # XXX: we need to figure this out better. Is this right? - if (strcmp($notice->uri, $noticeurl) != 0 && preg_match('/^http/', $notice->uri)) { - $noticeurl = $notice->uri; - } - - $html = - '
  • ' - .'' - .'';
 
-        if ($profile->fullname) {
-            $html .= $profile->fullname;
-        } else {
-            $html .= $profile->nickname;
-        }
-
-        $html .=
-        '' - .'' . $profile->nickname . '' - .'

    ' . $notice->rendered . '

    ' - .'

    ' - .''; - - if ($notice->source) { - $html .= _(' from '); - $html .= $this->source_link($notice->source); - } - - if ($notice->reply_to) { - $replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to)); - $html .= - ' (' . _('in reply to...') . ')'; + if ($msg) { + if ($success) { + common_element('fb:success', array('message' => $msg)); + } else { + // XXX do an error message here + } } - $html .= '

  • '; + common_element_start('div', 'main_body'); - return $html; } - function source_link($source) + function show_footer() { - $source_name = _($source); - - $html = ''; - - switch ($source) { - case 'web': - case 'xmpp': - case 'mail': - case 'omb': - case 'api': - $html .= $source_name; - break; - default: - $ns = Notice_source::staticGet($source); - if ($ns) { - $html .= '' . $ns->name . ''; - } else { - $html .= $source_name; - } - break; - } - - $html .= ''; - - return $html; + common_element_end('div'); + common_end_xml(); } - function pagination($have_before, $have_after, $page, $fbaction, $args=null) + function showLoginForm($msg = null) { + start_fbml(); - $html = ''; + 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'); - if ($have_before || $have_after) { - $html = '