Update facebook stuff to use new methods

change facebook stuff to use new methods for XML and HTML.
This commit is contained in:
Evan Prodromou 2009-01-19 13:44:10 +00:00
parent 12c475c101
commit 9145794400
3 changed files with 123 additions and 127 deletions

View File

@ -184,7 +184,7 @@ class FacebookhomeAction extends FacebookAction
$this->showLogo(); $this->showLogo();
common_element_start('div', array('class' => 'content')); $this->elementStart('div', array('class' => 'content'));
// Figure what the URL of our app is. // Figure what the URL of our app is.
$app_props = $facebook->api_client->Admin_getAppProperties( $app_props = $facebook->api_client->Admin_getAppProperties(
@ -196,30 +196,30 @@ class FacebookhomeAction extends FacebookAction
'your Facebook status with your latest notice, you need ' . 'your Facebook status with your latest notice, you need ' .
'to give it permission.'), $app_name); 'to give it permission.'), $app_name);
common_element_start('p'); $this->elementStart('p');
common_element('span', array('id' => 'permissions_notice'), $instructions); $this->element('span', array('id' => 'permissions_notice'), $instructions);
common_element_end('p'); $this->elementEnd('p');
common_element_start('form', array('method' => 'post', $this->elementStart('form', array('method' => 'post',
'action' => $app_url, 'action' => $app_url,
'id' => 'facebook-skip-permissions')); 'id' => 'facebook-skip-permissions'));
common_element_start('ul', array('id' => 'fb-permissions-list')); $this->elementStart('ul', array('id' => 'fb-permissions-list'));
common_element_start('li', array('id' => 'fb-permissions-item')); $this->elementStart('li', array('id' => 'fb-permissions-item'));
common_element_start('fb:prompt-permission', array('perms' => 'status_update', $this->elementStart('fb:prompt-permission', array('perms' => 'status_update',
'next_fbjs' => 'document.setLocation(\'' . $app_url . '\')')); 'next_fbjs' => 'document.setLocation(\'' . $app_url . '\')'));
common_element('span', array('class' => 'facebook-button'), $this->element('span', array('class' => 'facebook-button'),
_('Allow Identi.ca to update my Facebook status')); _('Allow Identi.ca to update my Facebook status'));
common_element_end('fb:prompt-permission'); $this->elementEnd('fb:prompt-permission');
common_element_end('li'); $this->elementEnd('li');
common_element_start('li', array('id' => 'fb-permissions-item')); $this->elementStart('li', array('id' => 'fb-permissions-item'));
common_submit('skip', _('Skip')); common_submit('skip', _('Skip'));
common_element_end('li'); $this->elementEnd('li');
common_element_end('ul'); $this->elementEnd('ul');
common_element_end('form'); $this->elementEnd('form');
common_element_end('div'); $this->elementEnd('div');
common_end_xml(); common_end_xml();

View File

@ -104,19 +104,19 @@ class FacebooksettingsAction extends FacebookAction
'your Facebook status with your latest notice, you need ' . 'your Facebook status with your latest notice, you need ' .
'to give it permission.'), $app_name); 'to give it permission.'), $app_name);
common_element_start('p'); $this->elementStart('p');
common_element('span', array('id' => 'permissions_notice'), $instructions); $this->element('span', array('id' => 'permissions_notice'), $instructions);
common_element_end('p'); $this->elementEnd('p');
common_element_start('ul', array('id' => 'fb-permissions-list')); $this->elementStart('ul', array('id' => 'fb-permissions-list'));
common_element_start('li', array('id' => 'fb-permissions-item')); $this->elementStart('li', array('id' => 'fb-permissions-item'));
common_element_start('fb:prompt-permission', array('perms' => 'status_update', $this->elementStart('fb:prompt-permission', array('perms' => 'status_update',
'next_fbjs' => 'document.setLocation(\'' . $app_url . '\')')); 'next_fbjs' => 'document.setLocation(\'' . $app_url . '\')'));
common_element('span', array('class' => 'facebook-button'), $this->element('span', array('class' => 'facebook-button'),
_('Allow Identi.ca to update my Facebook status')); _('Allow Identi.ca to update my Facebook status'));
common_element_end('fb:prompt-permission'); $this->elementEnd('fb:prompt-permission');
common_element_end('li'); $this->elementEnd('li');
common_element_end('ul'); $this->elementEnd('ul');
} }
$this->showFooter(); $this->showFooter();

View File

@ -38,132 +38,129 @@ class FacebookAction extends Action
$this->showStylesheets(); $this->showStylesheets();
$this->showScripts(); $this->showScripts();
common_element_start('a', array('class' => 'url home bookmark', $this->elementStart('a', array('class' => 'url home bookmark',
'href' => common_local_url('public'))); 'href' => common_local_url('public')));
if (common_config('site', 'logo') || file_exists(theme_file('logo.png'))) { if (common_config('site', 'logo') || file_exists(theme_file('logo.png'))) {
common_element('img', array('class' => 'logo photo', $this->element('img', array('class' => 'logo photo',
'src' => (common_config('site', 'logo')) ? 'src' => (common_config('site', 'logo')) ?
common_config('site', 'logo') : theme_path('logo.png'), common_config('site', 'logo') : theme_path('logo.png'),
'alt' => common_config('site', 'name'))); 'alt' => common_config('site', 'name')));
} }
common_element('span', array('class' => 'fn org'), common_config('site', 'name')); $this->element('span', array('class' => 'fn org'), common_config('site', 'name'));
common_element_end('a'); $this->elementEnd('a');
} }
function showHeader($msg = null, $success = false)
function showHeader($msg = null, $success = false)
{ {
startFBML(); startFBML();
common_element_start('fb:if-section-not-added', array('section' => 'profile')); $this->elementStart('fb:if-section-not-added', array('section' => 'profile'));
common_element_start('span', array('id' => 'add_to_profile')); $this->elementStart('span', array('id' => 'add_to_profile'));
common_element('fb:add-section-button', array('section' => 'profile')); $this->element('fb:add-section-button', array('section' => 'profile'));
common_element_end('span'); $this->elementEnd('span');
common_element_end('fb:if-section-not-added'); $this->elementEnd('fb:if-section-not-added');
$this->showLogo(); $this->showLogo();
if ($msg) { if ($msg) {
if ($success) { if ($success) {
common_element('fb:success', array('message' => $msg)); $this->element('fb:success', array('message' => $msg));
} else { } else {
// XXX do an error message here // XXX do an error message here
} }
} }
common_element_start('div', 'main_body'); $this->elementStart('div', 'main_body');
} }
function showNav($selected = 'Home') function showNav($selected = 'Home')
{ {
common_element_start('dl', array("id" => 'site_nav_local_views')); $this->elementStart('dl', array("id" => 'site_nav_local_views'));
common_element('dt', null, _('Local Views')); $this->element('dt', null, _('Local Views'));
common_element_start('dd'); $this->elementStart('dd');
common_element_start('ul', array('class' => 'nav')); $this->elementStart('ul', array('class' => 'nav'));
common_element_start('li', array('class' => $this->elementStart('li', array('class' =>
($selected == 'Home') ? 'current' : 'facebook_home')); ($selected == 'Home') ? 'current' : 'facebook_home'));
common_element('a', $this->element('a',
array('href' => 'index.php', 'title' => _('Home')), _('Home')); array('href' => 'index.php', 'title' => _('Home')), _('Home'));
common_element_end('li'); $this->elementEnd('li');
common_element_start('li', $this->elementStart('li',
array('class' => array('class' =>
($selected == 'Invite') ? 'current' : 'facebook_invite')); ($selected == 'Invite') ? 'current' : 'facebook_invite'));
common_element('a', $this->element('a',
array('href' => 'invite.php', 'title' => _('Invite')), _('Invite')); array('href' => 'invite.php', 'title' => _('Invite')), _('Invite'));
common_element_end('li'); $this->elementEnd('li');
common_element_start('li', $this->elementStart('li',
array('class' => array('class' =>
($selected == 'Settings') ? 'current' : 'facebook_settings')); ($selected == 'Settings') ? 'current' : 'facebook_settings'));
common_element('a', $this->element('a',
array('href' => 'settings.php', array('href' => 'settings.php',
'title' => _('Settings')), _('Settings')); 'title' => _('Settings')), _('Settings'));
common_element_end('li'); $this->elementEnd('li');
common_element_end('ul'); $this->elementEnd('ul');
common_element_end('dd'); $this->elementEnd('dd');
common_element_end('dl'); $this->elementEnd('dl');
} }
function showFooter() function showFooter()
{ {
common_element_end('div'); $this->elementEnd('div');
common_end_xml(); $this->endXml();
} }
function showInstructions() function showInstructions()
{ {
global $xw; global $xw;
common_element_start('dl', array('class' => 'system_notice')); $this->elementStart('dl', array('class' => 'system_notice'));
common_element('dt', null, 'Page Notice'); $this->element('dt', null, 'Page Notice');
$loginmsg_part1 = _('To use the %s Facebook Application you need to login ' . $loginmsg_part1 = _('To use the %s Facebook Application you need to login ' .
'with your username and password. Don\'t have a username yet? '); 'with your username and password. Don\'t have a username yet? ');
$loginmsg_part2 = _(' a new account.'); $loginmsg_part2 = _(' a new account.');
common_element_start('dd'); $this->elementStart('dd');
common_element_start('p'); $this->elementStart('p');
common_text(sprintf($loginmsg_part1, common_config('site', 'name'))); $this->text(sprintf($loginmsg_part1, common_config('site', 'name')));
common_element('a', $this->element('a',
array('href' => common_local_url('register')), _('Register')); array('href' => common_local_url('register')), _('Register'));
common_text($loginmsg_part2); $this->text($loginmsg_part2);
common_element_end('dd'); $this->elementEnd('dd');
common_element_end('dl'); $this->elementEnd('dl');
} }
function showStylesheets()
function showStylesheets()
{ {
global $xw; global $xw;
common_element('link', array('rel' => 'stylesheet', $this->element('link', array('rel' => 'stylesheet',
'type' => 'text/css', 'type' => 'text/css',
'href' => getFacebookBaseCSS())); 'href' => getFacebookBaseCSS()));
common_element('link', array('rel' => 'stylesheet', $this->element('link', array('rel' => 'stylesheet',
'type' => 'text/css', 'type' => 'text/css',
'href' => getFacebookThemeCSS())); 'href' => getFacebookThemeCSS()));
} }
function showScripts() function showScripts()
{ {
global $xw; global $xw;
common_element('script', array('type' => 'text/javascript', $this->element('script', array('type' => 'text/javascript',
'src' => getFacebookJS())); 'src' => getFacebookJS()));
} }
function showLoginForm($msg = null) function showLoginForm($msg = null)
@ -175,96 +172,95 @@ class FacebookAction extends Action
$this->showLogo(); $this->showLogo();
common_element_start('div', array('class' => 'content')); $this->elementStart('div', array('class' => 'content'));
common_element('h1', null, _('Login')); $this->element('h1', null, _('Login'));
if ($msg) { if ($msg) {
common_element('fb:error', array('message' => $msg)); $this->element('fb:error', array('message' => $msg));
} }
$this->showInstructions(); $this->showInstructions();
common_element_start('div', array('id' => 'content_inner')); $this->elementStart('div', array('id' => 'content_inner'));
common_element_start('form', array('method' => 'post', $this->elementStart('form', array('method' => 'post',
'class' => 'form_settings', 'class' => 'form_settings',
'id' => 'login', 'id' => 'login',
'action' => 'index.php')); 'action' => 'index.php'));
common_element_start('fieldset'); $this->elementStart('fieldset');
common_element('legend', null, _('Login to site')); $this->element('legend', null, _('Login to site'));
common_element_start('ul', array('class' => 'form_datas')); $this->elementStart('ul', array('class' => 'form_datas'));
common_element_start('li'); $this->elementStart('li');
common_input('nickname', _('Nickname')); $this->input('nickname', _('Nickname'));
common_element_end('li'); $this->elementEnd('li');
common_element_start('li'); $this->elementStart('li');
common_password('password', _('Password')); $this->password('password', _('Password'));
common_element_end('li'); $this->elementEnd('li');
common_element_end('ul'); $this->elementEnd('ul');
common_submit('submit', _('Login')); $this->submit('submit', _('Login'));
common_element_end('form'); $this->elementEnd('form');
common_element_start('p'); $this->elementStart('p');
common_element('a', array('href' => common_local_url('recoverpassword')), $this->element('a', array('href' => common_local_url('recoverpassword')),
_('Lost or forgotten password?')); _('Lost or forgotten password?'));
common_element_end('p'); $this->elementEnd('p');
common_element_end('div'); $this->elementEnd('div');
common_end_xml(); $this->endXml();
} }
function showNoticeForm($user)
function showNoticeForm($user)
{ {
global $xw; global $xw;
common_element_start('form', array('id' => 'form_notice', $this->elementStart('form', array('id' => 'form_notice',
'method' => 'post', 'method' => 'post',
'action' => 'index.php')); 'action' => 'index.php'));
common_element_start('fieldset'); $this->elementStart('fieldset');
common_element('legend', null, 'Send a notice'); $this->element('legend', null, 'Send a notice');
common_element_start('ul', 'form_datas'); $this->elementStart('ul', 'form_datas');
common_element_start('li', array('id' => 'noticcommon_elemente_text')); $this->elementStart('li', array('id' => 'noticcommon_elemente_text'));
common_element('label', array('for' => 'notice_data-text'), $this->element('label', array('for' => 'notice_data-text'),
sprintf(_('What\'s up, %s?'), $user->nickname)); sprintf(_('What\'s up, %s?'), $user->nickname));
common_element('textarea', array('id' => 'notice_data-text', $this->element('textarea', array('id' => 'notice_data-text',
'cols' => 35, 'cols' => 35,
'rows' => 4, 'rows' => 4,
'name' => 'status_textarea')); 'name' => 'status_textarea'));
common_element_end('li'); $this->elementEnd('li');
common_element_end('ul'); $this->elementEnd('ul');
common_element_start('dl', 'form_note'); $this->elementStart('dl', 'form_note');
common_element('dt', null, _('Available characters')); $this->element('dt', null, _('Available characters'));
common_element('dd', array('id' => 'notice_text-count'), $this->element('dd', array('id' => 'notice_text-count'),
'140'); '140');
common_element_end('dl'); $this->elementEnd('dl');
common_element_start('ul', array('class' => 'form_actions')); $this->elementStart('ul', array('class' => 'form_actions'));
$this->elementStart('li', array('id' => 'notice_submit'));
$this->submit('submit', _('Send'));
common_element_start('li', array('id' => 'notice_submit'));
common_submit('submit', _('Send'));
/* /*
common_element('input', array('id' => 'notice_action-submit', $this->element('input', array('id' => 'notice_action-submit',
'class' => 'submit', 'class' => 'submit',
'name' => 'status_submit', 'name' => 'status_submit',
'type' => 'submit', 'type' => 'submit',
'value' => _('Send'))); 'value' => _('Send')));
*/ */
common_element_end('li'); $this->elementEnd('li');
common_element_end('ul'); $this->elementEnd('ul');
common_element_end('fieldset'); $this->elementEnd('fieldset');
common_element_end('form'); $this->elementEnd('form');
} }
} }