function showNotices()
{
- $pnl = null;
- if (Event::handle('ShowStreamNoticeList', array($this->notice, $this, &$pnl))) {
- $pnl = new ProfileNoticeList($this->notice, $this);
- }
+ $pnl = new NoticeList($this->notice, $this);
$cnt = $pnl->show();
if (0 == $cnt) {
$this->showEmptyListMessage();
'AuthCrypt' => array(),
'Cronish' => array(),
'Favorite' => array(),
+ 'Share' => array(),
'LRDD' => array(),
'StrictTransportSecurity' => array(),
),
$this->out->elementStart('div', 'notice-options');
if (Event::handle('StartShowNoticeOptionItems', array($this))) {
$this->showReplyLink();
- $this->showRepeatForm();
$this->showDeleteLink();
Event::handle('EndShowNoticeOptionItems', array($this));
}
}
}
- /**
- * show the form to repeat a notice
- *
- * @return void
- */
- function showRepeatForm()
- {
- if ($this->notice->scope == Notice::PUBLIC_SCOPE ||
- $this->notice->scope == Notice::SITE_SCOPE) {
- $user = common_current_user();
- if (!empty($user) &&
- $user->id != $this->notice->profile_id) {
- $this->out->text(' ');
- $profile = $user->getProfile();
- if ($profile->hasRepeated($this->notice)) {
- $this->out->element('span', array('class' => 'repeated',
- // TRANS: Title for repeat form status in notice list when a notice has been repeated.
- 'title' => _('Notice repeated.')),
- // TRANS: Repeat form status in notice list when a notice has been repeated.
- _('Repeated'));
- } else {
- $rf = new RepeatForm($this->out, $this->notice);
- $rf->show();
- }
- }
- }
- }
-
/**
* finish the notice
*
+++ /dev/null
-<?php
-
-if (!defined('GNUSOCIAL')) { exit(1); }
-
-class ProfileNoticeList extends NoticeList
-{
- function newListItem($notice)
- {
- return new ProfileNoticeListItem($notice, $this->out);
- }
-}
+++ /dev/null
-<?php
-
-if (!defined('GNUSOCIAL')) { exit(1); }
-
-// We don't show the author for a profile, since we already know who it is!
-
-/**
- * Slightly modified from standard list; the author & avatar are hidden
- * in CSS. We used to remove them here too, but as it turns out that
- * confuses the inline reply code... and we hide them in CSS anyway
- * since realtime updates come through in original form.
- *
- * Remaining customization right now is for the repeat marker, where
- * it'll list who the original poster was instead of who did the repeat
- * (since the repeater is you, and the repeatee isn't shown!)
- * This will remain inconsistent if realtime updates come through,
- * since those'll get rendered as a regular NoticeListItem.
- */
-class ProfileNoticeListItem extends DoFollowListItem
-{
- /**
- * show a link to the author of repeat
- *
- * @return void
- */
- function showRepeat()
- {
- if (!empty($this->repeat)) {
-
- // FIXME: this code is almost identical to default; need to refactor
-
- $attrs = array('href' => $this->profile->profileurl,
- 'class' => 'url');
-
- if (!empty($this->profile->fullname)) {
- $attrs['title'] = $this->profile->getFancyName();
- }
-
- $this->out->elementStart('span', 'repeat');
-
- $text_link = XMLStringer::estring('a', $attrs, $this->profile->nickname);
-
- // TRANS: Link to the author of a repeated notice. %s is a linked nickname.
- $this->out->raw(sprintf(_('Repeat of %s'), $text_link));
-
- $this->out->elementEnd('span');
- }
- }
-}
+++ /dev/null
-<?php
-/**
- * StatusNet, the distributed open-source microblogging tool
- *
- * Form for repeating 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
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * 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/>.
- *
- * @category Form
- * @package StatusNet
- * @author Evan Prodromou <evan@status.net>
- * @copyright 2009 StatusNet, Inc.
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link http://status.net/
- */
-
-if (!defined('STATUSNET')) {
- exit(1);
-}
-
-/**
- * Form for repeating a notice
- *
- * @category Form
- * @package StatusNet
- * @author Evan Prodromou <evan@status.net>
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link http://status.net/
- */
-class RepeatForm extends Form
-{
- /**
- * Notice to repeat
- */
- var $notice = null;
-
- /**
- * Constructor
- *
- * @param HTMLOutputter $out output channel
- * @param Notice $notice notice to repeat
- */
- function __construct($out=null, $notice=null)
- {
- parent::__construct($out);
-
- $this->notice = $notice;
- }
-
- /**
- * ID of the form
- *
- * @return int ID of the form
- */
- function id()
- {
- return 'repeat-' . $this->notice->id;
- }
-
- /**
- * Action of the form
- *
- * @return string URL of the action
- */
- function action()
- {
- return common_local_url('repeat');
- }
-
- /**
- * Legend of the Form
- *
- * @return void
- */
- function formLegend()
- {
- // TRANS: For legend for notice repeat form.
- $this->out->element('legend', null, _('Repeat this notice?'));
- }
-
- /**
- * Data elements
- *
- * @return void
- */
- function formData()
- {
- $this->out->hidden('notice-n'.$this->notice->id,
- $this->notice->id,
- 'notice');
- }
-
- /**
- * Action elements
- *
- * @return void
- */
- function formActions()
- {
- $this->out->submit('repeat-submit-' . $this->notice->id,
- // TRANS: Button text to repeat a notice on notice repeat form.
- _m('BUTTON','Yes'), 'submit', null,
- // TRANS: Button title to repeat a notice on notice repeat form.
- _('Repeat this notice.'));
- }
-
- /**
- * Class of the form.
- *
- * @return string the form's class
- */
- function formClass()
- {
- return 'form_repeat';
- }
-}
array('nickname' => $nav->action->trimmed('nickname'))), _('Bio'),
_('The user\'s extended profile'), $nav->action->trimmed('action') == 'bio', 'nav_bio');
}
-
- //Why the heck is this shoved into this plugin!?!? It deserves its own!
- function onShowStreamNoticeList($notice, $action, &$pnl)
- {
- //TODO: This function is called after the notices in $notice are superfluously retrieved in showstream.php
- $newnotice = new Notice();
- $newnotice->profile_id = $action->user->id;
- $newnotice->orderBy('modified DESC');
- $newnotice->whereAdd('reply_to IS NULL');
- $newnotice->limit(($action->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
- $newnotice->find();
-
- $pnl = new NoticeTree($newnotice, $action);
- return false;
- }
-
}
-
$this->raw(common_markup_to_html($markdown));
}else{
- $pnl = null;
- if (Event::handle('ShowStreamNoticeList', array($this->notice, $this, &$pnl))) {
- $pnl = new ProfileNoticeList($this->notice, $this);
- }
+ $pnl = new NoticeList($this->notice, $this);
$cnt = $pnl->show();
if (0 == $cnt) {
$this->showEmptyListMessage();
// ActivityObject is instead turned into an Activity
$object = new Activity();
$object->verb = ActivityVerb::SHARE;
- $object->type = $notice->object_type;
- $object->title = sprintf(_('%1$s repeated a notice by %2$s'),
- $object->getProfile()->getNickname(),
- $target->getProfile()->getNickname());
$object->content = $notice->rendered;
+ $this->extendActivity($stored, $act);
+
return $object;
}
public function deleteRelated(Notice $notice)
{
- try {
- $fave = Fave::fromStored($notice);
- $fave->delete();
- } catch (NoResultException $e) {
- // Cool, no problem. We wanted to get rid of it anyway.
- }
+ // No action needed as we don't have a separate table for share objects.
+ return true;
}
// API stuff
*
* @return void
*/
- public function onStartShowNoticeOptionItems($nli)
+ public function onEndShowNoticeOptionItems($nli)
{
- if (Event::handle('StartShowFaveForm', array($nli))) {
+ // FIXME: Use bitmasks (but be aware that PUBLIC_SCOPE is 0!)
+ if ($nli->notice->scope == Notice::PUBLIC_SCOPE ||
+ $nli->notice->scope == Notice::SITE_SCOPE) {
$scoped = Profile::current();
- if ($scoped instanceof Profile) {
- if (Fave::existsForProfile($nli->notice, $scoped)) {
- $disfavor = new DisfavorForm($nli->out, $nli->notice);
- $disfavor->show();
+ if ($scoped instanceof Profile &&
+ $scoped->getID() !== $nli->notice->getProfile()->getID()) {
+
+ if ($scoped->hasRepeated($nli->notice)) {
+ $nli->out->element('span', array('class' => 'repeated',
+ // TRANS: Title for repeat form status in notice list when a notice has been repeated.
+ 'title' => _('Notice repeated.')),
+ // TRANS: Repeat form status in notice list when a notice has been repeated.
+ _('Repeated'));
} else {
- $favor = new FavorForm($nli->out, $nli->notice);
- $favor->show();
+ $repeat = new RepeatForm($nli->out, $nli->notice);
+ $repeat->show();
}
}
- Event::handle('EndShowFaveForm', array($nli));
}
}
--- /dev/null
+<?php
+/**
+ * StatusNet, the distributed open-source microblogging tool
+ *
+ * Form for repeating 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * 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/>.
+ *
+ * @category Form
+ * @package StatusNet
+ * @author Evan Prodromou <evan@status.net>
+ * @copyright 2009 StatusNet, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://status.net/
+ */
+
+if (!defined('STATUSNET')) {
+ exit(1);
+}
+
+/**
+ * Form for repeating a notice
+ *
+ * @category Form
+ * @package StatusNet
+ * @author Evan Prodromou <evan@status.net>
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://status.net/
+ */
+class RepeatForm extends Form
+{
+ /**
+ * Notice to repeat
+ */
+ var $notice = null;
+
+ /**
+ * Constructor
+ *
+ * @param HTMLOutputter $out output channel
+ * @param Notice $notice notice to repeat
+ */
+ function __construct($out=null, $notice=null)
+ {
+ parent::__construct($out);
+
+ $this->notice = $notice;
+ }
+
+ /**
+ * ID of the form
+ *
+ * @return int ID of the form
+ */
+ function id()
+ {
+ return 'repeat-' . $this->notice->id;
+ }
+
+ /**
+ * Action of the form
+ *
+ * @return string URL of the action
+ */
+ function action()
+ {
+ return common_local_url('repeat');
+ }
+
+ /**
+ * Legend of the Form
+ *
+ * @return void
+ */
+ function formLegend()
+ {
+ // TRANS: For legend for notice repeat form.
+ $this->out->element('legend', null, _('Repeat this notice?'));
+ }
+
+ /**
+ * Data elements
+ *
+ * @return void
+ */
+ function formData()
+ {
+ $this->out->hidden('notice-n'.$this->notice->id,
+ $this->notice->id,
+ 'notice');
+ }
+
+ /**
+ * Action elements
+ *
+ * @return void
+ */
+ function formActions()
+ {
+ $this->out->submit('repeat-submit-' . $this->notice->id,
+ // TRANS: Button text to repeat a notice on notice repeat form.
+ _m('BUTTON','Yes'), 'submit', null,
+ // TRANS: Button title to repeat a notice on notice repeat form.
+ _('Repeat this notice.'));
+ }
+
+ /**
+ * Class of the form.
+ *
+ * @return string the form's class
+ */
+ function formClass()
+ {
+ return 'form_repeat';
+ }
+}