Merge branch 'master' into groups

This commit is contained in:
Evan Prodromou 2009-01-21 11:52:06 -05:00
commit 0824bb2e1d
18 changed files with 350 additions and 153 deletions

View File

@ -1,9 +1,12 @@
<?php <?php
/* /**
* Laconica - a distributed open-source microblogging tool * Laconica, the distributed open-source microblogging tool
* Copyright (C) 2008, Controlez-Vous, Inc.
* *
* This program is free software: you can redistribute it and/or modify * Class for deleting a notice
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by * it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
@ -15,49 +18,99 @@
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Personal
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @author Sarven Capadisli <csarven@controlyourself.ca>
* @copyright 2008 Control Yourself, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
*/ */
if (!defined('LACONICA')) { exit(1); } if (!defined('LACONICA')) {
exit(1);
}
require_once(INSTALLDIR.'/lib/deleteaction.php'); require_once INSTALLDIR.'/lib/deleteaction.php';
class DeletenoticeAction extends DeleteAction class DeletenoticeAction extends DeleteAction
{ {
var $error = null;
function handle($args) function handle($args)
{ {
parent::handle($args); parent::handle($args);
# XXX: Ajax! // XXX: Ajax!
if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$this->delete_notice(); $this->deleteNotice();
} else if ($_SERVER['REQUEST_METHOD'] == 'GET') { } else if ($_SERVER['REQUEST_METHOD'] == 'GET') {
$this->show_form(); $this->showForm();
} }
} }
function get_instructions() /**
* Show the page notice
*
* Shows instructions for the page
*
* @return void
*/
function showPageNotice()
{ {
return _('You are about to permanently delete a notice. Once this is done, it cannot be undone.'); $instr = $this->getInstructions();
$output = common_markup_to_html($instr);
$this->elementStart('div', 'instructions');
$this->raw($output);
$this->elementEnd('div');
} }
function get_title() function getInstructions()
{
return _('You are about to permanently delete a notice. ' .
'Once this is done, it cannot be undone.');
}
function title()
{ {
return _('Delete notice'); return _('Delete notice');
} }
function show_form($error=null) /**
{ * Wrapper for showing a page
$user = common_current_user(); *
* Stores an error and shows the page
*
* @param string $error Error, if any
*
* @return void
*/
common_show_header($this->get_title(), array($this, 'show_header'), $error, function showForm($error = null)
array($this, 'show_top')); {
$this->error = $error;
$this->showPage();
}
/**
* Insert delete notice form into the content
*
* @return void
*/
function showContent()
{
$this->elementStart('form', array('id' => 'notice_delete_form', $this->elementStart('form', array('id' => 'notice_delete_form',
'method' => 'post', 'method' => 'post',
'action' => common_local_url('deletenotice'))); 'action' => common_local_url('deletenotice')));
$this->hidden('token', common_session_token()); $this->hidden('token', common_session_token());
$this->hidden('notice', $this->trimmed('notice')); $this->hidden('notice', $this->trimmed('notice'));
$this->elementStart('p'); $this->elementStart('p');
$this->element('span', array('id' => 'confirmation_text'), _('Are you sure you want to delete this notice?')); $this->element('span', array('id' => 'confirmation_text'),
_('Are you sure you want to delete this notice?'));
$this->element('input', array('id' => 'submit_no', $this->element('input', array('id' => 'submit_no',
'name' => 'submit', 'name' => 'submit',
@ -69,33 +122,38 @@ class DeletenoticeAction extends DeleteAction
'value' => _('Yes'))); 'value' => _('Yes')));
$this->elementEnd('p'); $this->elementEnd('p');
$this->elementEnd('form'); $this->elementEnd('form');
common_show_footer();
} }
function delete_notice() function deleteNotice()
{ {
# CSRF protection // CSRF protection
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
$this->show_form(_('There was a problem with your session token. Try again, please.')); $this->showForm(_('There was a problem with your session token. ' .
' Try again, please.'));
return; return;
} }
$url = common_get_returnto();
$confirmed = $this->trimmed('submit');
if ($confirmed == _('Yes')) {
$user = common_current_user();
$notice_id = $this->trimmed('notice');
$notice = Notice::staticGet($notice_id);
$replies = new Reply;
$replies->get('notice_id', $notice_id);
common_dequeue_notice($notice); $url = common_get_returnto();
$confirmed = $this->trimmed('submit');
if ($confirmed == _('Yes')) {
$replies = new Reply;
$replies->get('notice_id', $this->notice->id);
common_dequeue_notice($this->notice);
if (common_config('memcached', 'enabled')) { if (common_config('memcached', 'enabled')) {
$notice->blowSubsCache(); $notice->blowSubsCache();
} }
$replies->delete(); $replies->delete();
$notice->delete(); $this->notice->delete();
} else { } else {
if ($url) { if ($url) {
common_set_returnto(null); common_set_returnto(null);
} else { } else {

View File

@ -88,7 +88,7 @@ class NudgeAction extends Action
$this->notify($user, $other); $this->notify($user, $other);
if ($this->boolean('ajax')) { if ($this->boolean('ajax')) {
common_start_html('text/xml;charset=utf-8', true); $this->startHTML('text/xml;charset=utf-8', true);
$this->elementStart('head'); $this->elementStart('head');
$this->element('title', null, _('Nudge sent')); $this->element('title', null, _('Nudge sent'));
$this->elementEnd('head'); $this->elementEnd('head');

View File

@ -326,7 +326,25 @@ class ShowstreamAction extends Action
} }
$this->elementEnd('li'); $this->elementEnd('li');
common_profile_new_message_nudge($cur, $this->user, $this->profile); // common_profile_new_message_nudge($cur, $this->user, $this->profile);
$user = User::staticGet('id', $this->profile->id);
if ($cur && $cur->id != $user->id && $cur->mutuallySubscribed($user)) {
$this->elementStart('li', array('id' => 'user_send-a-message'));
$this->element('a', array('href' => common_local_url('newmessage', array('to' => $user->id)),
'title' => _('Send a direct message to this user')),
_('Message'));
$this->elementEnd('li');
if ($user->email && $user->emailnotifynudge) {
$this->elementStart('li', array('id' => 'user_nudge'));
$nf = new NudgeForm($this, $user);
$nf->show();
$this->elementEnd('li');
}
}
if ($cur && $cur->id != $this->profile->id) { if ($cur && $cur->id != $this->profile->id) {
$blocked = $cur->hasBlocked($this->profile); $blocked = $cur->hasBlocked($this->profile);
@ -349,7 +367,7 @@ class ShowstreamAction extends Action
$url = common_local_url('remotesubscribe', $url = common_local_url('remotesubscribe',
array('nickname' => $this->profile->nickname)); array('nickname' => $this->profile->nickname));
$this->element('a', array('href' => $url, $this->element('a', array('href' => $url,
'id' => 'remotesubscribe'), 'id' => 'user_subscribe_remote'),
_('Subscribe')); _('Subscribe'));
} }

View File

@ -64,12 +64,13 @@ class SubscribeAction extends Action
} }
if ($this->boolean('ajax')) { if ($this->boolean('ajax')) {
common_start_html('text/xml;charset=utf-8', true); $this->startHTML('text/xml;charset=utf-8', true);
$this->elementStart('head'); $this->elementStart('head');
$this->element('title', null, _('Subscribed')); $this->element('title', null, _('Subscribed'));
$this->elementEnd('head'); $this->elementEnd('head');
$this->elementStart('body'); $this->elementStart('body');
common_unsubscribe_form($other->getProfile()); $unsubscribe = new UnsubscribeForm($this, $other->getProfile());
$unsubscribe->show();
$this->elementEnd('body'); $this->elementEnd('body');
$this->elementEnd('html'); $this->elementEnd('html');
} else { } else {

View File

@ -66,12 +66,13 @@ class UnsubscribeAction extends Action
} }
if ($this->boolean('ajax')) { if ($this->boolean('ajax')) {
common_start_html('text/xml;charset=utf-8', true); $this->startHTML('text/xml;charset=utf-8', true);
$this->elementStart('head'); $this->elementStart('head');
$this->element('title', null, _('Unsubscribed')); $this->element('title', null, _('Unsubscribed'));
$this->elementEnd('head'); $this->elementEnd('head');
$this->elementStart('body'); $this->elementStart('body');
common_subscribe_form($other); $subscribe = new SubscribeForm($this, $other);
$subscribe->show();
$this->elementEnd('body'); $this->elementEnd('body');
$this->elementEnd('html'); $this->elementEnd('html');
} else { } else {

View File

@ -120,8 +120,8 @@ $(document).ready(function(){
$("#nudge").each(addAjaxHidden); $("#nudge").each(addAjaxHidden);
var Subscribe = { dataType: 'xml', var Subscribe = { dataType: 'xml',
beforeSubmit: function(formData, jqForm, options) { $("form.subscribe input[type=submit]").attr("disabled", "disabled"); beforeSubmit: function(formData, jqForm, options) { $(".form_user_subscribe input[type=submit]").attr("disabled", "disabled");
$("form.subscribe input[type=submit]").addClass("disabled"); $(".form_user_subscribe input[type=submit]").addClass("disabled");
}, },
success: function(xml) { var form_unsubscribe = document._importNode($('form', xml).get(0), true); success: function(xml) { var form_unsubscribe = document._importNode($('form', xml).get(0), true);
var form_unsubscribe_id = form_unsubscribe.id; var form_unsubscribe_id = form_unsubscribe.id;
@ -129,14 +129,14 @@ $(document).ready(function(){
$("form#"+form_subscribe_id).replaceWith(form_unsubscribe); $("form#"+form_subscribe_id).replaceWith(form_unsubscribe);
$("form#"+form_unsubscribe_id).ajaxForm(UnSubscribe).each(addAjaxHidden); $("form#"+form_unsubscribe_id).ajaxForm(UnSubscribe).each(addAjaxHidden);
$("dd.subscribers").text(parseInt($("dd.subscribers").text())+1); $("dd.subscribers").text(parseInt($("dd.subscribers").text())+1);
$("form.subscribe input[type=submit]").removeAttr("disabled"); $(".form_user_subscribe input[type=submit]").removeAttr("disabled");
$("form.subscribe input[type=submit]").removeClass("disabled"); $(".form_user_subscribe input[type=submit]").removeClass("disabled");
} }
}; };
var UnSubscribe = { dataType: 'xml', var UnSubscribe = { dataType: 'xml',
beforeSubmit: function(formData, jqForm, options) { $("form.unsubscribe input[type=submit]").attr("disabled", "disabled"); beforeSubmit: function(formData, jqForm, options) { $(".form_user_unsubscribe input[type=submit]").attr("disabled", "disabled");
$("form.unsubscribe input[type=submit]").addClass("disabled"); $(".form_user_unsubscribe input[type=submit]").addClass("disabled");
}, },
success: function(xml) { var form_subscribe = document._importNode($('form', xml).get(0), true); success: function(xml) { var form_subscribe = document._importNode($('form', xml).get(0), true);
var form_subscribe_id = form_subscribe.id; var form_subscribe_id = form_subscribe.id;
@ -146,15 +146,15 @@ $(document).ready(function(){
$("#profile_send_a_new_message").remove(); $("#profile_send_a_new_message").remove();
$("#profile_nudge").remove(); $("#profile_nudge").remove();
$("dd.subscribers").text(parseInt($("dd.subscribers").text())-1); $("dd.subscribers").text(parseInt($("dd.subscribers").text())-1);
$("form.unsubscribe input[type=submit]").removeAttr("disabled"); $(".form_user_unsubscribe input[type=submit]").removeAttr("disabled");
$("form.unsubscribe input[type=submit]").removeClass("disabled"); $(".form_user_unsubscribe input[type=submit]").removeClass("disabled");
} }
}; };
$("form.subscribe").ajaxForm(Subscribe); $(".form_user_subscribe").ajaxForm(Subscribe);
$("form.unsubscribe").ajaxForm(UnSubscribe); $(".form_user_unsubscribe").ajaxForm(UnSubscribe);
$("form.subscribe").each(addAjaxHidden); $(".form_user_subscribe").each(addAjaxHidden);
$("form.unsubscribe").each(addAjaxHidden); $(".form_user_unsubscribe").each(addAjaxHidden);
var PostNotice = { dataType: 'xml', var PostNotice = { dataType: 'xml',
beforeSubmit: function(formData, jqForm, options) { if ($("#notice_data-text").get(0).value.length == 0) { beforeSubmit: function(formData, jqForm, options) { if ($("#notice_data-text").get(0).value.length == 0) {

View File

@ -112,6 +112,18 @@ class BlockForm extends Form
return common_local_url('block'); return common_local_url('block');
} }
/**
* Legend of the Form
*
* @return void
*/
function formLegend()
{
$this->out->element('legend', null, _('Block this user'));
}
/** /**
* Data elements of the form * Data elements of the form
* *
@ -138,6 +150,6 @@ class BlockForm extends Form
function formActions() function formActions()
{ {
$this->out->submit('submit', _('Block')); $this->out->submit('submit', _('block'), 'submit', null, _('Block this user'));
} }
} }

View File

@ -1,9 +1,12 @@
<?php <?php
/* /**
* Laconica - a distributed open-source microblogging tool * Laconica, the distributed open-source microblogging tool
* Copyright (C) 2008, Controlez-Vous, Inc.
* *
* This program is free software: you can redistribute it and/or modify * Base class for deleting things
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by * it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
@ -15,52 +18,57 @@
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Personal
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @author Sarven Capadisli <csarven@controlyourself.ca>
* @copyright 2008 Control Yourself, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
*/ */
if (!defined('LACONICA')) { exit(1); } if (!defined('LACONICA')) {
exit(1);
}
class DeleteAction extends Action class DeleteAction extends Action
{ {
var $user = null;
var $notice = null;
var $profile = null;
var $user_profile = null;
function handle($args) function prepare($args)
{ {
parent::handle($args); parent::prepare($args);
$user = common_current_user();
$notice_id = $this->trimmed('notice'); $this->user = common_current_user();
$notice = Notice::staticGet($notice_id); $notice_id = $this->trimmed('notice');
if (!$notice) { $this->notice = Notice::staticGet($notice_id);
if (!$this->notice) {
common_user_error(_('No such notice.')); common_user_error(_('No such notice.'));
exit; exit;
} }
$profile = $notice->getProfile(); $this->profile = $this->notice->getProfile();
$user_profile = $user->getProfile(); $this->user_profile = $this->user->getProfile();
return true;
}
function handle($args)
{
parent::handle($args);
if (!common_logged_in()) { if (!common_logged_in()) {
common_user_error(_('Not logged in.')); common_user_error(_('Not logged in.'));
exit; exit;
} else if ($notice->profile_id != $user_profile->id) { } else if ($this->notice->profile_id != $this->user_profile->id) {
common_user_error(_('Can\'t delete this notice.')); common_user_error(_('Can\'t delete this notice.'));
exit; exit;
} }
} }
function show_top($arr=null)
{
$instr = $this->get_instructions();
$output = common_markup_to_html($instr);
common_element_start('div', 'instructions');
common_raw($output);
common_element_end('div');
}
function get_title()
{
return null;
}
function show_header()
{
return;
}
} }

View File

@ -111,9 +111,10 @@ class MailboxAction extends PersonalAction
$message = $this->getMessages(); $message = $this->getMessages();
if ($message) { if ($message) {
$cnt = 0; $cnt = 0;
$this->elementStart('ul', array('id' => 'messages')); $this->elementStart('div', array('id' =>'notices_primary'));
$this->element('h2', null, _('Notices'));
$this->elementStart('ul', 'notices');
while ($message->fetch() && $cnt <= MESSAGES_PER_PAGE) { while ($message->fetch() && $cnt <= MESSAGES_PER_PAGE) {
$cnt++; $cnt++;
@ -130,7 +131,7 @@ class MailboxAction extends PersonalAction
$this->pagination($this->page > 1, $cnt > MESSAGES_PER_PAGE, $this->pagination($this->page > 1, $cnt > MESSAGES_PER_PAGE,
$this->page, $this->trimmed('action'), $this->page, $this->trimmed('action'),
array('nickname' => $this->user->nickname)); array('nickname' => $this->user->nickname));
$this->elementEnd('div');
$message->free(); $message->free();
unset($message); unset($message);
} }
@ -169,30 +170,35 @@ class MailboxAction extends PersonalAction
function showMessage($message) function showMessage($message)
{ {
$this->elementStart('li', array('class' => 'message_single', $this->elementStart('li', array('class' => 'hentry notice',
'id' => 'message-' . $message->id)); 'id' => 'message-' . $message->id));
$profile = $this->getMessageProfile($message); $profile = $this->getMessageProfile($message);
$this->elementStart('div', 'entry-title');
$this->elementStart('span', 'vcard author');
$this->elementStart('a', array('href' => $profile->profileurl,
'class' => 'url'));
$avatar = $profile->getAvatar(AVATAR_STREAM_SIZE); $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
$this->elementStart('a', array('href' => $profile->profileurl));
$this->element('img', array('src' => ($avatar) ? $this->element('img', array('src' => ($avatar) ?
common_avatar_display_url($avatar) : common_avatar_display_url($avatar) :
common_default_avatar(AVATAR_STREAM_SIZE), common_default_avatar(AVATAR_STREAM_SIZE),
'class' => 'avatar stream', 'class' => 'photo avatar',
'width' => AVATAR_STREAM_SIZE, 'width' => AVATAR_STREAM_SIZE,
'height' => AVATAR_STREAM_SIZE, 'height' => AVATAR_STREAM_SIZE,
'alt' => 'alt' =>
($profile->fullname) ? $profile->fullname : ($profile->fullname) ? $profile->fullname :
$profile->nickname)); $profile->nickname));
$this->element('span', array('class' => 'nickname fn'),
$profile->nickname);
$this->elementEnd('a'); $this->elementEnd('a');
$this->element('a', array('href' => $profile->profileurl, $this->elementEnd('span');
'class' => 'nickname'),
$profile->nickname);
// FIXME: URL, image, video, audio // FIXME: URL, image, video, audio
$this->elementStart('p', array('class' => 'content')); $this->elementStart('p', array('class' => 'entry-content'));
$this->raw($message->rendered); $this->raw($message->rendered);
$this->elementEnd('p'); $this->elementEnd('p');
$this->elementEnd('div');
$messageurl = common_local_url('showmessage', $messageurl = common_local_url('showmessage',
array('message' => $message->id)); array('message' => $message->id));
@ -202,17 +208,30 @@ class MailboxAction extends PersonalAction
preg_match('/^http/', $message->uri)) { preg_match('/^http/', $message->uri)) {
$messageurl = $message->uri; $messageurl = $message->uri;
} }
$this->elementStart('p', 'time');
$this->element('a', array('class' => 'permalink',
'href' => $messageurl,
'title' => common_exact_date($message->created)),
common_date_string($message->created));
if ($message->source) {
$this->text(_(' from '));
$this->showSource($message->source);
}
$this->elementEnd('p'); $this->elementStart('div', 'entry-content');
$this->elementStart('dl', 'timestamp');
$this->element('dt', null, _('Published'));
$this->elementStart('dd', null);
$dt = common_date_iso8601($message->created);
$this->elementStart('a', array('rel' => 'bookmark',
'href' => $messageurl));
$this->element('abbr', array('class' => 'published',
'title' => $dt),
common_date_string($message->created));
$this->elementEnd('a');
$this->elementEnd('dd');
$this->elementEnd('dl');
if ($message->source) {
$this->elementStart('dl', 'device');
$this->elementStart('dt');
$this->text(_('From'));
$this->elementEnd('dt');
$this->showSource($message->source);
$this->elementEnd('dl');
}
$this->elementEnd('div');
$this->elementEnd('li'); $this->elementEnd('li');
} }
@ -255,15 +274,18 @@ class MailboxAction extends PersonalAction
case 'mail': case 'mail':
case 'omb': case 'omb':
case 'api': case 'api':
$this->element('span', 'noticesource', $source_name); $this->element('dd', null, $source_name);
break; break;
default: default:
$ns = Notice_source::staticGet($source); $ns = Notice_source::staticGet($source);
if ($ns) { if ($ns) {
$this->element('a', array('href' => $ns->url), $this->elementStart('dd', null);
$this->element('a', array('href' => $ns->url,
'rel' => 'external'),
$ns->name); $ns->name);
$this->elementEnd('dd');
} else { } else {
$this->element('span', 'noticesource', $source_name); $this->element('dd', null, $source_name);
} }
break; break;
} }

View File

@ -85,7 +85,7 @@ class MessageForm extends Form
function id() function id()
{ {
return 'message_form'; return 'form_notice';
} }
/** /**
@ -99,6 +99,18 @@ class MessageForm extends Form
return common_local_url('newmessage'); return common_local_url('newmessage');
} }
/**
* Legend of the Form
*
* @return void
*/
function formLegend()
{
$this->out->element('legend', null, _('Send a direct notice'));
}
/** /**
* Data elements * Data elements
* *
@ -122,18 +134,20 @@ class MessageForm extends Form
$mutual_users->free(); $mutual_users->free();
unset($mutual_users); unset($mutual_users);
$this->out->elementStart('ul', 'form_data');
$this->out->elementStart('li', array('id' => 'notice_to'));
$this->out->dropdown('to', _('To'), $mutual, null, false, $this->out->dropdown('to', _('To'), $mutual, null, false,
$this->to->id); $this->to->id);
$this->out->elementEnd('li');
$this->out->elementStart('p'); $this->out->elementStart('li', array('id' => 'notice_text'));
$this->out->element('textarea', array('id' => 'notice_data-text',
$this->out->element('textarea', array('id' => 'message_content', 'cols' => 35,
'cols' => 60, 'rows' => 4,
'rows' => 3,
'name' => 'content'), 'name' => 'content'),
($this->content) ? $this->content : ''); ($this->content) ? $this->content : '');
$this->out->elementEnd('li');
$this->out->elementEnd('p'); $this->out->elementEnd('ul');
} }
/** /**
@ -144,9 +158,14 @@ class MessageForm extends Form
function formActions() function formActions()
{ {
$this->out->element('input', array('id' => 'message_send', $this->out->elementStart('ul', 'form_actions');
$this->out->elementStart('li', array('id' => 'notice_submit'));
$this->out->element('input', array('id' => 'notice_action-submit',
'class' => 'submit',
'name' => 'message_send', 'name' => 'message_send',
'type' => 'submit', 'type' => 'submit',
'value' => _('Send'))); 'value' => _('Send')));
$this->out->elementEnd('li');
$this->out->elementEnd('ul');
} }
} }

View File

@ -379,7 +379,7 @@ class NoticeListItem extends Widget
case 'mail': case 'mail':
case 'omb': case 'omb':
case 'api': case 'api':
$this->out->element('dd', 'noticesource', $source_name); $this->out->element('dd', null, $source_name);
break; break;
default: default:
$ns = Notice_source::staticGet($this->notice->source); $ns = Notice_source::staticGet($this->notice->source);
@ -390,7 +390,7 @@ class NoticeListItem extends Widget
$ns->name); $ns->name);
$this->out->elementEnd('dd'); $this->out->elementEnd('dd');
} else { } else {
$this->out->element('dd', 'noticesource', $source_name); $this->out->element('dd', null, $source_name);
} }
break; break;
} }

View File

@ -77,9 +77,22 @@ class NudgeForm extends Form
function id() function id()
{ {
return 'nudge'; return 'form_user_nudge';
} }
/**
* class of the form
*
* @return string of the form class
*/
function formClass()
{
return 'form_user_nudge';
}
/** /**
* Action of the form * Action of the form
* *
@ -92,6 +105,18 @@ class NudgeForm extends Form
array('nickname' => $this->profile->nickname)); array('nickname' => $this->profile->nickname));
} }
/**
* Legend of the Form
*
* @return void
*/
function formLegend()
{
$this->out->element('legend', null, _('Nudge this user'));
}
/** /**
* Action elements * Action elements
* *
@ -100,6 +125,6 @@ class NudgeForm extends Form
function formActions() function formActions()
{ {
$this->out->submit('submit', _('Send a nudge')); $this->out->submit('submit', _('Nudge'), 'submit', null, _('Send a nudge to this user'));
} }
} }

View File

@ -104,6 +104,17 @@ class SubscribeForm extends Form
return common_local_url('subscribe'); return common_local_url('subscribe');
} }
/**
* Legend of the Form
*
* @return void
*/
function formLegend()
{
$this->out->element('legend', null, _('Subscribe to this user'));
}
/** /**
* Data elements of the form * Data elements of the form
* *
@ -125,6 +136,6 @@ class SubscribeForm extends Form
function formActions() function formActions()
{ {
$this->out->submit('submit', _('Subscribe')); $this->out->submit('submit', _('Subscribe'), 'submit', null, _('Subscribe to this user'));
} }
} }

View File

@ -110,6 +110,17 @@ class UnblockForm extends Form
return common_local_url('unblock'); return common_local_url('unblock');
} }
/**
* Legend of the Form
*
* @return void
*/
function formLegend()
{
$this->out->element('legend', null, _('Unblock this user'));
}
/** /**
* Data elements of the form * Data elements of the form
* *
@ -136,6 +147,6 @@ class UnblockForm extends Form
function formActions() function formActions()
{ {
$this->out->submit('submit', _('Unblock')); $this->out->submit('submit', _('Unblock'), 'submit', null, _('Unblock this user'));
} }
} }

View File

@ -103,6 +103,16 @@ class UnsubscribeForm extends Form
return common_local_url('unsubscribe'); return common_local_url('unsubscribe');
} }
/**
* Legend of the Form
*
* @return void
*/
function formLegend()
{
$this->out->element('legend', null, _('Unsubscribe from this user'));
}
/** /**
* Data elements of the form * Data elements of the form
* *
@ -124,6 +134,6 @@ class UnsubscribeForm extends Form
function formActions() function formActions()
{ {
$this->out->submit('submit', _('Unsubscribe')); $this->out->submit('submit', _('Unsubscribe'), 'submit', null, _('Unsubscribe from this user'));
} }
} }

View File

@ -1665,25 +1665,6 @@ function common_nudge_response()
common_element('p', array('id' => 'nudge_response'), _('Nudge sent!')); common_element('p', array('id' => 'nudge_response'), _('Nudge sent!'));
} }
// XXX: Refactor this code
function common_profile_new_message_nudge ($cur, $profile)
{
$user = User::staticGet('id', $profile->id);
if ($cur && $cur->id != $user->id && $cur->mutuallySubscribed($user)) {
common_element_start('li', array('id' => 'profile_send_a_new_message'));
common_element('a', array('href' => common_local_url('newmessage', array('to' => $user->id))),
_('Send a message'));
common_element_end('li');
if ($user->email && $user->emailnotifynudge) {
common_element_start('li', array('id' => 'profile_nudge'));
common_nudge_form($user);
common_element_end('li');
}
}
}
function common_cache_key($extra) function common_cache_key($extra)
{ {
return 'laconica:' . common_keyize(common_config('site', 'name')) . ':' . $extra; return 'laconica:' . common_keyize(common_config('site', 'name')) . ':' . $extra;

View File

@ -482,6 +482,20 @@ padding:8px;
#form_notice li { #form_notice li {
margin-bottom:0; margin-bottom:0;
} }
#form_notice #notice_to {
margin-bottom:7px;
}
#notice_to label {
float:left;
margin-right:18px;
margin-top:11px;
}
#notice_to select {
float:left;
}
/*end FORM NOTICE*/ /*end FORM NOTICE*/
@ -597,16 +611,25 @@ width:100%;
} }
#user_actions a { #user_actions a {
text-decoration:none; text-decoration:none;
font-weight:bold;
width:100%;
display:block;
} }
.form_user_block input.submit, .form_user_block input.submit,
.form_user_unblock input.submit { .form_user_unblock input.submit,
#user_send-a-message a,
.form_user_nudge input.submit {
border:0; border:0;
padding-left:20px; padding-left:20px;
} }
#user_send-a-message a {
padding:4px 4px 4px 23px;
}
#user_subscribe input.submit, #user_subscribe input.submit,
@ -617,13 +640,9 @@ padding-left:20px;
#user_send-a-message form { #user_send-a-message form {
clear:left;
width:322px;
margin-top:18px;
} }
#user_send-a-message textarea { #user_send-a-message textarea {
width:96%;
} }
.user_tags ul { .user_tags ul {

View File

@ -41,7 +41,9 @@ color:#fff;
a, a,
div.notice-options input, div.notice-options input,
.form_user_block input.submit, .form_user_block input.submit,
.form_user_unblock input.submit { .form_user_unblock input.submit,
#user_send-a-message a,
.form_user_nudge input.submit {
color:#002E6E; color:#002E6E;
} }
@ -63,8 +65,7 @@ background-color:#CEE1E9;
#notice_text-count { #notice_text-count {
color:#333; color:#333;
} }
#form_notice.warning #notice_text-count, #form_notice.warning #notice_text-count {
#user_actions a {
color:#000; color:#000;
} }
@ -131,7 +132,7 @@ background-image:url(../../base/images/icons/icon_vcard.gif);
} }
.form_user_send-a-message input.submit, #user_send-a-message a,
.form_user_nudge input.submit, .form_user_nudge input.submit,
.form_user_block input.submit, .form_user_block input.submit,
.form_user_unblock input.submit { .form_user_unblock input.submit {