show the repeat form in notice lists
This commit is contained in:
parent
c9649f9321
commit
81843f2acd
|
@ -716,4 +716,15 @@ class Profile extends Memcached_DataObject
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hasRepeated($notice_id)
|
||||||
|
{
|
||||||
|
// XXX: not really a pkey, but should work
|
||||||
|
|
||||||
|
$notice = Memcached_DataObject::pkeyGet('Notice',
|
||||||
|
array('profile_id' => $this->id,
|
||||||
|
'repeat_of' => $notice_id));
|
||||||
|
|
||||||
|
return !empty($notice);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,6 +212,7 @@ class NoticeListItem extends Widget
|
||||||
$this->out->elementStart('div', 'notice-options');
|
$this->out->elementStart('div', 'notice-options');
|
||||||
$this->showFaveForm();
|
$this->showFaveForm();
|
||||||
$this->showReplyLink();
|
$this->showReplyLink();
|
||||||
|
$this->showRepeatForm();
|
||||||
$this->showDeleteLink();
|
$this->showDeleteLink();
|
||||||
$this->out->elementEnd('div');
|
$this->out->elementEnd('div');
|
||||||
}
|
}
|
||||||
|
@ -551,6 +552,26 @@ class NoticeListItem extends Widget
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* show the form to repeat a notice
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
function showRepeatForm()
|
||||||
|
{
|
||||||
|
$user = common_current_user();
|
||||||
|
if ($user && $user->id != $this->notice->profile_id) {
|
||||||
|
$profile = $user->getProfile();
|
||||||
|
if ($profile->hasRepeated($this->notice->id)) {
|
||||||
|
$this->out->text(_('Repeated'));
|
||||||
|
} else {
|
||||||
|
$rf = new RepeatForm($this->out, $this->notice);
|
||||||
|
$rf->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* finish the notice
|
* finish the notice
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* StatusNet, the distributed open-source microblogging tool
|
* StatusNet, the distributed open-source microblogging tool
|
||||||
*
|
*
|
||||||
* Form for forwarding a notice
|
* Form for repeating a notice
|
||||||
*
|
*
|
||||||
* PHP version 5
|
* PHP version 5
|
||||||
*
|
*
|
||||||
|
@ -27,14 +27,12 @@
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET') && !defined('LACONICA')) {
|
if (!defined('STATUSNET')) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once INSTALLDIR.'/lib/form.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form for forwarding a notice
|
* Form for repeating a notice
|
||||||
*
|
*
|
||||||
* @category Form
|
* @category Form
|
||||||
* @package StatusNet
|
* @package StatusNet
|
||||||
|
@ -43,10 +41,10 @@ require_once INSTALLDIR.'/lib/form.php';
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ForwardForm extends Form
|
class RepeatForm extends Form
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Notice to forward
|
* Notice to repeat
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var $notice = null;
|
var $notice = null;
|
||||||
|
@ -55,7 +53,7 @@ class ForwardForm extends Form
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param HTMLOutputter $out output channel
|
* @param HTMLOutputter $out output channel
|
||||||
* @param Notice $notice notice to forward
|
* @param Notice $notice notice to repeat
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function __construct($out=null, $notice=null)
|
function __construct($out=null, $notice=null)
|
||||||
|
@ -73,7 +71,7 @@ class ForwardForm extends Form
|
||||||
|
|
||||||
function id()
|
function id()
|
||||||
{
|
{
|
||||||
return 'forward-' . $this->notice->id;
|
return 'repeat-' . $this->notice->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,7 +82,7 @@ class ForwardForm extends Form
|
||||||
|
|
||||||
function action()
|
function action()
|
||||||
{
|
{
|
||||||
return common_local_url('forward');
|
return common_local_url('repeat');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -106,7 +104,7 @@ class ForwardForm extends Form
|
||||||
*/
|
*/
|
||||||
function formLegend()
|
function formLegend()
|
||||||
{
|
{
|
||||||
$this->out->element('legend', null, _('Forward this notice'));
|
$this->out->element('legend', null, _('Repeat this notice'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -130,8 +128,8 @@ class ForwardForm extends Form
|
||||||
|
|
||||||
function formActions()
|
function formActions()
|
||||||
{
|
{
|
||||||
$this->out->submit('forward-submit-' . $this->notice->id,
|
$this->out->submit('repeat-submit-' . $this->notice->id,
|
||||||
_('Forward'), 'submit', null, _('Forward this notice'));
|
_('Repeat'), 'submit', null, _('Repeat this notice'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -142,6 +140,6 @@ class ForwardForm extends Form
|
||||||
|
|
||||||
function formClass()
|
function formClass()
|
||||||
{
|
{
|
||||||
return 'form_forward';
|
return 'form_repeat';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user