git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit eaa81d25 authored by Evan Prodromou's avatar Evan Prodromou

Convert all actions to use new UI functions

I did a massive search-and-replace to get all the action subclasses to
use the new output function (common_element() -> $this->element(), etc.)

There's still a lot to do, but it's a first step
parent 2b2fb276
......@@ -57,7 +57,7 @@ class AllAction extends StreamAction
function show_header($user)
{
common_element('link', array('rel' => 'alternate',
$this->element('link', array('rel' => 'alternate',
'href' => common_local_url('allrss', array('nickname' =>
$user->nickname)),
'type' => 'application/rss+xml',
......
......@@ -159,10 +159,10 @@ class ApiAction extends Action
if ($this->content_type == 'xml') {
header('Content-Type: application/xml; charset=utf-8');
common_start_xml();
common_element_start('hash');
common_element('error', null, $msg);
common_element('request', null, $_SERVER['REQUEST_URI']);
common_element_end('hash');
$this->elementStart('hash');
$this->element('error', null, $msg);
$this->element('request', null, $_SERVER['REQUEST_URI']);
$this->elementEnd('hash');
common_end_xml();
} else if ($this->content_type == 'json') {
header('Content-Type: application/json; charset=utf-8');
......
......@@ -81,34 +81,34 @@ class BlockAction extends Action
common_show_header(_('Block user'));
common_element('p', null,
$this->element('p', null,
_('Are you sure you want to block this user? '.
'Afterwards, they will be unsubscribed from you, '.
'unable to subscribe to you in the future, and '.
'you will not be notified of any @-replies from them.'));
common_element_start('form', array('id' => 'block-' . $id,
$this->elementStart('form', array('id' => 'block-' . $id,
'method' => 'post',
'class' => 'block',
'action' => common_local_url('block')));
common_hidden('token', common_session_token());
$this->hidden('token', common_session_token());
common_element('input', array('id' => 'blockto-' . $id,
$this->element('input', array('id' => 'blockto-' . $id,
'name' => 'blockto',
'type' => 'hidden',
'value' => $id));
foreach ($this->args as $k => $v) {
if (substr($k, 0, 9) == 'returnto-') {
common_hidden($k, $v);
$this->hidden($k, $v);
}
}
common_submit('no', _('No'));
common_submit('yes', _('Yes'));
$this->submit('no', _('No'));
$this->submit('yes', _('Yes'));
common_element_end('form');
$this->elementEnd('form');
common_show_footer();
}
......
......@@ -90,7 +90,7 @@ class ConfirmaddressAction extends Action
$cur->query('COMMIT');
common_show_header(_('Confirm Address'));
common_element('p', null,
$this->element('p', null,
sprintf(_('The address "%s" has been confirmed for your account.'), $cur->$type));
common_show_footer();
}
......
......@@ -51,24 +51,24 @@ class DeletenoticeAction extends DeleteAction
common_show_header($this->get_title(), array($this, 'show_header'), $error,
array($this, 'show_top'));
common_element_start('form', array('id' => 'notice_delete_form',
$this->elementStart('form', array('id' => 'notice_delete_form',
'method' => 'post',
'action' => common_local_url('deletenotice')));
common_hidden('token', common_session_token());
common_hidden('notice', $this->trimmed('notice'));
common_element_start('p');
common_element('span', array('id' => 'confirmation_text'), _('Are you sure you want to delete this notice?'));
$this->hidden('token', common_session_token());
$this->hidden('notice', $this->trimmed('notice'));
$this->elementStart('p');
$this->element('span', array('id' => 'confirmation_text'), _('Are you sure you want to delete this notice?'));
common_element('input', array('id' => 'submit_no',
$this->element('input', array('id' => 'submit_no',
'name' => 'submit',
'type' => 'submit',
'value' => _('No')));
common_element('input', array('id' => 'submit_yes',
$this->element('input', array('id' => 'submit_yes',
'name' => 'submit',
'type' => 'submit',
'value' => _('Yes')));
common_element_end('p');
common_element_end('form');
$this->elementEnd('p');
$this->elementEnd('form');
common_show_footer();
}
......
......@@ -49,15 +49,15 @@ class DeleteprofileAction extends Action
function show_feeds_list($feeds)
{
common_element_start('div', array('class' => 'feedsdel'));
common_element('p', null, 'Feeds:');
common_element_start('ul', array('class' => 'xoxo'));
$this->elementStart('div', array('class' => 'feedsdel'));
$this->element('p', null, 'Feeds:');
$this->elementStart('ul', array('class' => 'xoxo'));
foreach ($feeds as $key => $value) {
$this->common_feed_item($feeds[$key]);
}
common_element_end('ul');
common_element_end('div');
$this->elementEnd('ul');
$this->elementEnd('div');
}
//TODO move to common.php (and retrace its origin)
......@@ -81,19 +81,19 @@ class DeleteprofileAction extends Action
$feed['textContent'] = "FOAF";
break;
}
common_element_start('li');
common_element('a', array('href' => $feed['href'],
$this->elementStart('li');
$this->element('a', array('href' => $feed['href'],
'class' => $feed_classname,
'type' => $feed_mimetype,
'title' => $feed_title),
$feed['textContent']);
common_element_end('li');
$this->elementEnd('li');
}
function show_form($msg=null, $success=false)
{
$this->form_header(_('Delete my account'), $msg, $success);
common_element('h2', null, _('Delete my account confirmation'));
$this->element('h2', null, _('Delete my account confirmation'));
$this->show_confirm_delete_form();
common_show_footer();
}
......@@ -105,13 +105,13 @@ class DeleteprofileAction extends Action
$notices->profile_id = $user->id;
$notice_count = (int) $notices->count();
common_element_start('form', array('method' => 'POST',
$this->elementStart('form', array('method' => 'POST',
'id' => 'delete',
'action' =>
common_local_url('deleteprofile')));
common_hidden('token', common_session_token());
common_element('p', null, "Last chance to copy your notices and contacts by saving the two links below before deleting your account. Be careful, this operation cannot be undone.");
$this->hidden('token', common_session_token());
$this->element('p', null, "Last chance to copy your notices and contacts by saving the two links below before deleting your account. Be careful, this operation cannot be undone.");
$this->show_feeds_list(array(0=>array('href'=>common_local_url('userrss', array('limit' => $notice_count, 'nickname' => $user->nickname)),
'type' => 'rss',
......@@ -122,10 +122,10 @@ class DeleteprofileAction extends Action
'version' => 'FOAF',
'item' => 'foaf')));
common_checkbox('confirmation', _('Check if you are sure you want to delete your account.'));
$this->checkbox('confirmation', _('Check if you are sure you want to delete your account.'));
common_submit('deleteaccount', _('Delete my account'));
common_element_end('form');
$this->submit('deleteaccount', _('Delete my account'));
$this->elementEnd('form');
}
function handle_post()
......@@ -238,9 +238,9 @@ class DeleteprofileAction extends Action
} else {
$inst = $this->get_instructions();
$output = common_markup_to_html($inst);
common_element_start('div', 'instructions');
common_raw($output);
common_element_end('div');
$this->elementStart('div', 'instructions');
$this->raw($output);
$this->elementEnd('div');
}
$this->settings_menu();
}
......@@ -272,7 +272,7 @@ class DeleteprofileAction extends Action
_('Other options')));
$action = $this->trimmed('action');
common_element_start('ul', array('id' => 'nav_views'));
$this->elementStart('ul', array('id' => 'nav_views'));
foreach ($menu as $menuaction => $menudesc) {
if ($menuaction == 'imsettings' &&
!common_config('xmpp', 'enabled')) {
......@@ -283,7 +283,7 @@ class DeleteprofileAction extends Action
$menudesc[1],
$action == $menuaction);
}
common_element_end('ul');
$this->elementEnd('ul');
}
}
......@@ -70,13 +70,13 @@ class DisfavorAction extends Action
if ($this->boolean('ajax')) {
common_start_html('text/xml;charset=utf-8', true);
common_element_start('head');
common_element('title', null, _('Add to favorites'));
common_element_end('head');
common_element_start('body');
$this->elementStart('head');
$this->element('title', null, _('Add to favorites'));
$this->elementEnd('head');
$this->elementStart('body');
common_favor_form($notice);
common_element_end('body');
common_element_end('html');
$this->elementEnd('body');
$this->elementEnd('html');
} else {
common_redirect(common_local_url('showfavorites',
array('nickname' => $user->nickname)));
......
......@@ -34,7 +34,7 @@ class DocAction extends Action
$c = file_get_contents($filename);
$output = common_markup_to_html($c);
common_show_header(_(ucfirst($title)));
common_raw($output);
$this->raw($output);
common_show_footer();
}
}
......@@ -33,83 +33,83 @@ class EmailsettingsAction extends SettingsAction
{
$user = common_current_user();
$this->form_header(_('Email Settings'), $msg, $success);
common_element_start('form', array('method' => 'post',
$this->elementStart('form', array('method' => 'post',
'id' => 'emailsettings',
'action' =>
common_local_url('emailsettings')));
common_hidden('token', common_session_token());
$this->hidden('token', common_session_token());
common_element('h2', null, _('Address'));
$this->element('h2', null, _('Address'));
if ($user->email) {
common_element_start('p');
common_element('span', 'address confirmed', $user->email);
common_element('span', 'input_instructions',
$this->elementStart('p');
$this->element('span', 'address confirmed', $user->email);
$this->element('span', 'input_instructions',
_('Current confirmed email address.'));
common_hidden('email', $user->email);
common_element_end('p');
common_submit('remove', _('Remove'));
$this->hidden('email', $user->email);
$this->elementEnd('p');
$this->submit('remove', _('Remove'));
} else {
$confirm = $this->get_confirmation();
if ($confirm) {
common_element_start('p');
common_element('span', 'address unconfirmed', $confirm->address);
common_element('span', 'input_instructions',
$this->elementStart('p');
$this->element('span', 'address unconfirmed', $confirm->address);
$this->element('span', 'input_instructions',
_('Awaiting confirmation on this address. Check your inbox (and spam box!) for a message with further instructions.'));
common_hidden('email', $confirm->address);
common_element_end('p');
common_submit('cancel', _('Cancel'));
$this->hidden('email', $confirm->address);
$this->elementEnd('p');
$this->submit('cancel', _('Cancel'));
} else {
common_input('email', _('Email Address'),
$this->input('email', _('Email Address'),
($this->arg('email')) ? $this->arg('email') : null,
_('Email address, like "UserName@example.org"'));
common_submit('add', _('Add'));
$this->submit('add', _('Add'));
}
}
if ($user->email) {
common_element('h2', null, _('Incoming email'));
$this->element('h2', null, _('Incoming email'));
if ($user->incomingemail) {
common_element_start('p');
common_element('span', 'address', $user->incomingemail);
common_element('span', 'input_instructions',
$this->elementStart('p');
$this->element('span', 'address', $user->incomingemail);
$this->element('span', 'input_instructions',
_('Send email to this address to post new notices.'));
common_element_end('p');
common_submit('removeincoming', _('Remove'));
$this->elementEnd('p');
$this->submit('removeincoming', _('Remove'));
}
common_element_start('p');
common_element('span', 'input_instructions',
$this->elementStart('p');
$this->element('span', 'input_instructions',
_('Make a new email address for posting to; cancels the old one.'));
common_element_end('p');
common_submit('newincoming', _('New'));
$this->elementEnd('p');
$this->submit('newincoming', _('New'));
}
common_element('h2', null, _('Preferences'));
$this->element('h2', null, _('Preferences'));
common_checkbox('emailnotifysub',
$this->checkbox('emailnotifysub',
_('Send me notices of new subscriptions through email.'),
$user->emailnotifysub);
common_checkbox('emailnotifyfav',
$this->checkbox('emailnotifyfav',
_('Send me email when someone adds my notice as a favorite.'),
$user->emailnotifyfav);
common_checkbox('emailnotifymsg',
$this->checkbox('emailnotifymsg',
_('Send me email when someone sends me a private message.'),
$user->emailnotifymsg);
common_checkbox('emailnotifynudge',
$this->checkbox('emailnotifynudge',
_('Allow friends to nudge me and send me an email.'),
$user->emailnotifynudge);
common_checkbox('emailpost',
$this->checkbox('emailpost',
_('I want to post notices by email.'),
$user->emailpost);
common_checkbox('emailmicroid',
$this->checkbox('emailmicroid',
_('Publish a MicroID for my email address.'),
$user->emailmicroid);
common_submit('save', _('Save'));
$this->submit('save', _('Save'));
common_element_end('form');
$this->elementEnd('form');
common_show_footer();
}
......
......@@ -105,7 +105,7 @@ class FacebookhomeAction extends FacebookAction
$this->show_header('Home');
if ($msg) {
common_element('fb:success', array('message' => $msg));
$this->element('fb:success', array('message' => $msg));
}
echo $this->show_notices($user);
......
......@@ -43,22 +43,22 @@ class FacebookinviteAction extends FacebookAction
$this->show_header('Invite');
common_element('h2', null, _('Thanks for inviting your friends to use Identi.ca!'));
common_element('p', null, _('Invitations have been sent to the following users:'));
$this->element('h2', null, _('Thanks for inviting your friends to use Identi.ca!'));
$this->element('p', null, _('Invitations have been sent to the following users:'));
$friend_ids = $_POST['ids']; // Hmm... $this->arg('ids') doesn't seem to work
common_element_start("ul");
$this->elementStart("ul");
foreach ($friend_ids as $friend) {
common_element_start('li');
common_element('fb:profile-pic', array('uid' => $friend));
common_element('fb:name', array('uid' => $friend,
$this->elementStart('li');
$this->element('fb:profile-pic', array('uid' => $friend));
$this->element('fb:name', array('uid' => $friend,
'capitalize' => 'true'));
common_element_end('li');
$this->elementEnd('li');
}
common_element_end("ul");
$this->elementEnd("ul");
$this->show_footer();
}
......@@ -77,32 +77,32 @@ class FacebookinviteAction extends FacebookAction
$content = _('You have been invited to Identi.ca!') .
htmlentities('<fb:req-choice url="http://apps.facebook.com/identica_app/" label="Add"/>');
common_element_start('fb:request-form', array('action' => 'invite.php',
$this->elementStart('fb:request-form', array('action' => 'invite.php',
'method' => 'post',
'invite' => 'true',
'type' => 'Identi.ca',
'content' => $content));
common_hidden('invite', 'true');
$this->hidden('invite', 'true');
$actiontext = 'Invite your friends to use Identi.ca.';
common_element('fb:multi-friend-selector', array('showborder' => 'false',
$this->element('fb:multi-friend-selector', array('showborder' => 'false',
'actiontext' => $actiontext,
'exclude_ids' => implode(',', $exclude_ids),
'bypass' => 'cancel'));
common_element_end('fb:request-form');
$this->elementEnd('fb:request-form');
common_element('h2', null, _('Friends already using Identi.ca:'));
common_element_start("ul");
$this->element('h2', null, _('Friends already using Identi.ca:'));
$this->elementStart("ul");
foreach ($exclude_ids as $friend) {
common_element_start('li');
common_element('fb:profile-pic', array('uid' => $friend));
common_element('fb:name', array('uid' => $friend,
$this->elementStart('li');
$this->element('fb:profile-pic', array('uid' => $friend));
$this->element('fb:name', array('uid' => $friend,
'capitalize' => 'true'));
common_element_end('li');
$this->elementEnd('li');
}
common_element_end("ul");
$this->elementEnd("ul");
$this->show_footer();
......
......@@ -68,43 +68,43 @@ class FacebooksettingsAction extends FacebookAction
$this->show_header('Settings', $msg, $success);
common_element_start('fb:if-section-not-added', array('section' => 'profile'));
common_element('h2', null, _('Add an Identi.ca box to my profile'));
common_element_start('p');
common_element('fb:add-section-button', array('section' => 'profile'));
common_element_end('p');
common_element_end('fb:if-section-not-added');
common_element_start('p');
common_element_start('fb:prompt-permission', array('perms' => 'status_update'));
common_element('h2', null, _('Allow Identi.ca to update my Facebook status'));
common_element_end('fb:prompt-permission');
common_element_end('p');
$this->elementStart('fb:if-section-not-added', array('section' => 'profile'));
$this->element('h2', null, _('Add an Identi.ca box to my profile'));
$this->elementStart('p');
$this->element('fb:add-section-button', array('section' => 'profile'));
$this->elementEnd('p');
$this->elementEnd('fb:if-section-not-added');
$this->elementStart('p');
$this->elementStart('fb:prompt-permission', array('perms' => 'status_update'));
$this->element('h2', null, _('Allow Identi.ca to update my Facebook status'));
$this->elementEnd('fb:prompt-permission');
$this->elementEnd('p');
if ($facebook->api_client->users_hasAppPermission('status_update')) {
common_element_start('form', array('method' => 'post',
$this->elementStart('form', array('method' => 'post',
'id' => 'facebook_settings'));
common_element('h2', null, _('Sync preferences'));
$this->element('h2', null, _('Sync preferences'));
common_checkbox('noticesync', _('Automatically update my Facebook status with my notices.'),
$this->checkbox('noticesync', _('Automatically update my Facebook status with my notices.'),
($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND) : true);
common_checkbox('replysync', _('Send local "@" replies to Facebook.'),
$this->checkbox('replysync', _('Send local "@" replies to Facebook.'),
($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : true);
// function common_input($id, $label, $value=null,$instructions=null)
// function $this->input($id, $label, $value=null,$instructions=null)
$prefix = $facebook->api_client->data_getUserPreference(1);
common_input('prefix', _('Prefix'),
$this->input('prefix', _('Prefix'),
($prefix) ? $prefix : null,
_('A string to prefix notices with.'));
common_submit('save', _('Save'));
$this->submit('save', _('Save'));
common_element_end('form');
$this->elementEnd('form');
}
......
......@@ -69,13 +69,13 @@ class FavorAction extends Action
if ($this->boolean('ajax')) {
common_start_html('text/xml;charset=utf-8', true);
common_element_start('head');
common_element('title', null, _('Disfavor favorite'));
common_element_end('head');
common_element_start('body');
$this->elementStart('head');
$this->element('title', null, _('Disfavor favorite'));
$this->elementEnd('head');
$this->elementStart('body');
common_disfavor_form($notice);
common_element_end('body');
common_element_end('html');
$this->elementEnd('body');
$this->elementEnd('html');
} else {
common_redirect(common_local_url('showfavorites',
array('nickname' => $user->nickname)));
......
......@@ -43,9 +43,9 @@ class FavoritedAction extends StreamAction
{
$instr = $this->get_instructions();
$output = common_markup_to_html($instr);
common_element_start('div', 'instructions');
common_raw($output);
common_element_end('div');
$this->elementStart('div', 'instructions');
$this->raw($output);
$this->elementEnd('div');
$this->public_views_menu();
}
......@@ -81,7 +81,7 @@ class FavoritedAction extends StreamAction
$notice = new Notice;
$notice->query(sprintf($qry, common_config('popular', 'dropoff')));
common_element_start('ul', array('id' => 'notices'));
$this->elementStart('ul', array('id' => 'notices'));
$cnt = 0;
......@@ -96,7 +96,7 @@ class FavoritedAction extends StreamAction
$item->show();
}
common_element_end('ul');
$this->elementEnd('ul');
common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
$page, 'favorited');
......
......@@ -44,9 +44,9 @@ class FeaturedAction extends StreamAction
{
$instr = $this->get_instructions();
$output = common_markup_to_html($instr);
common_element_start('div', 'instructions');
common_raw($output);
common_element_end('div');
$this->elementStart('div', 'instructions');
$this->raw($output);
$this->elementEnd('div');
$this->public_views_menu();
}
......
......@@ -101,7 +101,7 @@ class FinishaddopenidAction extends Action
function message($msg)
{
common_show_header(_('OpenID Login'));
common_element('p', null, $msg);
$this->element('p', null, $msg);
common_show_footer();
}
}
......@@ -57,10 +57,10 @@ class FinishopenidloginAction extends Action
function show_top($error=null)
{
if ($error) {
common_element('div', array('class' => 'error'), $error);
$this->element('div', array('class' => 'error'), $error);
} else {
global $config;
common_element('div', 'instructions',
$this->element('div', 'instructions',
sprintf(_('This is the first time you\'ve logged into %s so we must connect your OpenID to a local account. You can either create a new account, or connect with your existing account, if you have one.'), $config['site']['name']));
}
}
......@@ -70,36 +70,36 @@ class FinishopenidloginAction extends Action
common_show_header(_('OpenID Account Setup'), null, $error,
array($this, 'show_top'));
common_element_start('form', array('method' => 'post',
$this->elementStart('form', array('method' => 'post',
'id' => 'account_connect',
'action' => common_local_url('finishopenidlogin')));
common_hidden('token', common_session_token());
common_element('h2', null,
$this->hidden('token', common_session_token());
$this->element('h2', null,
_('Create new account'));
common_element('p', null,
$this->element('p', null,
_('Create a new user with this nickname.'));
common_input('newname', _('New nickname'),
$this->input('newname', _('New nickname'),
($username) ? $username : '',
_('1-64 lowercase letters or numbers, no punctuation or spaces'));
common_element_start('p');
common_element('input', array('type' => 'checkbox',
$this->elementStart('p');
$this->element('input', array('type' => 'checkbox',
'id' => 'license',
'name' => 'license',
'value' => 'true'));
common_text(_('My text and files are available under '));
common_element('a', array(href => common_config('license', 'url')),
$this->text(_('My text and files are available under '));
$this->element('a', array(href => common_config('license', 'url')),
common_config('license', 'title'));
common_text(_(' except this private data: password, email address, IM address, phone number.'));
common_element_end('p');
common_submit('create', _('Create'));
common_element('h2', null,
$this->text(_(' except this private data: password, email address, IM address, phone number.'));
$this->elementEnd('p');
$this->submit('create', _('Create'));
$this->element('h2', null,
_('Connect existing account'));
common_element('p', null,
$this->element('p', null,
_('If you already have an account, login with your username and password to connect it to your OpenID.'));
common_input('nickname', _('Existing nickname'));
common_password('password', _('Password'));
common_submit('connect', _('Connect'));
common_element_end('form');
$this->input('nickname', _('Existing nickname'));
$this->password('password', _('Password'));
$this->submit('connect', _('Connect'));
$this->elementEnd('form');
common_show_footer();
}
......@@ -154,7 +154,7 @@ class FinishopenidloginAction extends Action
function message($msg)
{
common_show_header(_('OpenID Login'));
common_element('p', null, $msg);
$this->element('p', null, $msg);
common_show_footer();
}
......
......@@ -54,7 +54,7 @@ class FoafAction extends Action
header('Content-Type: application/rdf+xml');
common_start_xml();
common_element_start('rdf:RDF', array('xmlns:rdf' =>
$this->elementStart('rdf:RDF', array('xmlns:rdf' =>
'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
'xmlns:rdfs' =>
'http://www.w3.org/2000/01/rdf-schema#',
......@@ -67,25 +67,25 @@ class FoafAction extends Action
$this->show_ppd('', $user->uri);
# XXX: might not be a person
common_element_start('Person', array('rdf:about' =>
$this->elementStart('Person', array('rdf:about' =>
$user->uri));
common_element('mbox_sha1sum', null, sha1('mailto:' . $user->email));