';
+ $this->element('link', array('rel' => 'stylesheet',
+ 'type' => 'text/css',
+ 'href' => theme_path('css/display.css', null) . '?ts=' . $ts));
- echo $header;
+ $ts = filemtime(INSTALLDIR.'/theme/base/css/facebookapp.css');
+ $this->element('link', array('rel' => 'stylesheet',
+ 'type' => 'text/css',
+ 'href' => theme_path('css/facebookapp.css', 'base') . '?ts=' . $ts));
}
- function show_footer()
+ function showScripts()
{
- $footer = '
';
- echo $footer;
+ // Add a timestamp to the file so Facebook cache wont ignore our changes
+ $ts = filemtime(INSTALLDIR.'/js/facebookapp.js');
+
+ $this->element('script', array('src' => common_path('js/facebookapp.js') . '?ts=' . $ts));
}
- function show_login_form()
+ /**
+ * Start an Facebook ready HTML document
+ *
+ * For Facebook we don't want to actually output any headers,
+ * DTD info, etc. Just Stylesheet and JavaScript links.
+ *
+ * If $type isn't specified, will attempt to do content negotiation.
+ *
+ * @param string $type MIME type to use; default is to do negotation.
+ *
+ * @return void
+ */
+
+ function startHTML($type=null)
{
+ $this->showStylesheets();
+ $this->showScripts();
- $loginform =
- ' '
- .'
'
- .'
'
- .' Lost or forgotten password?'
- .'
'
- .'
elementStart('div', array('class' => 'facebook-page'));
}
- function render_notice($notice)
+ /**
+ * Ends a Facebook ready HTML document
+ *
+ * @return void
+ */
+ function endHTML()
{
+ $this->elementEnd('div');
+ $this->endXML();
+ }
- global $config;
+ /**
+ * Show notice form.
+ *
+ * MAY overload if no notice form needed... or direct message box????
+ *
+ * @return nothing
+ */
+ function showNoticeForm()
+ {
+ // don't do it for most of the Facebook pages
+ }
- $profile = $notice->getProfile();
- $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
+ function showBody()
+ {
+ $this->elementStart('div', array('id' => 'wrap'));
+ $this->showHeader();
+ $this->showCore();
+ $this->showFooter();
+ $this->elementEnd('div');
+ }
+
+ function showAside()
+ {
+ }
- $noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
+ function showHead($error, $success)
+ {
- # 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;
+ if ($error) {
+ $this->element("h1", null, $error);
}
- $html =
- ''
- .''
- .'
'
- .'' . $profile->nickname . ''
- .'' . $notice->rendered . '
'
- .''
- .'' . common_date_string($notice->created) . '';
- if ($notice->source) {
- $html .= _(' from ');
- $html .= $this->source_link($notice->source);
- }
+ // Make this into a widget later
+ function showLocalNav()
+ {
+ $this->elementStart('ul', array('class' => 'nav'));
+
+ $this->elementStart('li', array('class' =>
+ ($this->action == 'facebookhome') ? 'current' : 'facebook_home'));
+ $this->element('a',
+ array('href' => 'index.php', 'title' => _('Home')), _('Home'));
+ $this->elementEnd('li');
+
+ $this->elementStart('li',
+ array('class' =>
+ ($this->action == 'facebookinvite') ? 'current' : 'facebook_invite'));
+ $this->element('a',
+ array('href' => 'invite.php', 'title' => _('Invite')), _('Invite'));
+ $this->elementEnd('li');
+
+ $this->elementStart('li',
+ array('class' =>
+ ($this->action == 'facebooksettings') ? 'current' : 'facebook_settings'));
+ $this->element('a',
+ array('href' => 'settings.php',
+ 'title' => _('Settings')), _('Settings'));
+ $this->elementEnd('li');
+
+ $this->elementEnd('ul');
+ }
- if ($notice->reply_to) {
- $replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to));
- $html .=
- ' (' . _('in reply to...') . ')';
- }
+ /**
+ * Show header of the page.
+ *
+ * Calls template methods
+ *
+ * @return nothing
+ */
+ function showHeader()
+ {
+ $this->elementStart('div', array('id' => 'header'));
+ $this->showLogo();
+ $this->showNoticeForm();
+ $this->elementEnd('div');
+ }
- $html .= '
';
+ /**
+ * Show page, a template method.
+ *
+ * @return nothing
+ */
+ function showPage($error = null, $success = null)
+ {
+ $this->startHTML();
+ $this->showHead($error, $success);
+ $this->showBody();
+ $this->endHTML();
+ }
+
+
+ function showInstructions()
+ {
- return $html;
+ $this->elementStart('div', array('class' => 'facebook_guide'));
+
+ $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('p');
+ $this->elementEnd('dd');
+
+ $this->elementEnd('dl');
+ $this->elementEnd('div');
}
- function source_link($source)
+
+ function showLoginForm($msg = null)
{
- $source_name = _($source);
-
- $html = '