* @category Action
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
+ * @author Mikael Nordfeldth <mmn@hethane.se>
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('STATUSNET') && !defined('LACONICA')) {
- exit(1);
-}
-
-// XXX: not sure how to do paging yet,
-// so set a 60-notice limit
-
-require_once INSTALLDIR.'/lib/noticelist.php';
+if (!defined('GNUSOCIAL')) { exit(1); }
/**
* Conversation tree in the browser
*
+ * Will always try to show the entire conversation, since that's how our
+ * ConversationNoticeStream works.
+ *
* @category Action
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
+ * @author Mikael Nordfeldth <mmn@hethane.se>
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*/
-class ConversationAction extends Action
+class ConversationAction extends ManagedAction
{
- var $id = null;
+ var $conv = null;
var $page = null;
var $notices = null;
- var $userProfile = null;
- const MAX_NOTICES = 500;
-
- /**
- * Initialization.
- *
- * @param array $args Web and URL arguments
- *
- * @return boolean false if id not passed in
- */
- function prepare($args)
+ protected function doPreparation()
{
- parent::prepare($args);
- $this->id = $this->trimmed('id');
- if (empty($this->id)) {
- return false;
- }
- $this->id = $this->id+0;
- $this->page = $this->trimmed('page');
- if (empty($this->page)) {
- $this->page = 1;
- }
-
- $cur = common_current_user();
-
- if (empty($cur)) {
- $this->userProfile = null;
- } else {
- $this->userProfile = $cur->getProfile();
- }
-
- $stream = new ConversationNoticeStream($this->id, $this->userProfile);
-
- $this->notices = $stream->getNotices(0, self::MAX_NOTICES);
-
- return true;
- }
-
- /**
- * Handle the action
- *
- * @param array $args Web and URL arguments
- *
- * @return void
- */
- function handle($args)
- {
- parent::handle($args);
- $this->showPage();
+ $this->conv = Conversation::getByID($this->int('id'));
}
/**
/**
* Show content.
*
- * Display a hierarchical unordered list in the content area.
- * Uses ConversationTree to do most of the heavy lifting.
+ * NoticeList extended classes do most heavy lifting. Plugins can override.
*
* @return void
*/
function showContent()
{
- $tnl = new ThreadedNoticeList($this->notices, $this, $this->userProfile);
-
- $cnt = $tnl->show();
+ if (Event::handle('StartShowConversation', array($this, $this->conv, $this->scoped))) {
+ $notices = $this->conv->getNotices($this->scoped);
+ $nl = new FullThreadedNoticeList($notices, $this, $this->scoped);
+ $cnt = $nl->show();
+ }
+ Event::handle('EndShowConversation', array($this, $this->conv, $this->scoped));
}
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
+
+ function getFeeds()
+ {
+
+ return array(new Feed(Feed::JSON,
+ common_local_url('apiconversation',
+ array(
+ 'id' => $this->conv->getID(),
+ 'format' => 'as')),
+ // TRANS: Title for link to notice feed.
+ // TRANS: %s is a user nickname.
+ _('Conversation feed (Activity Streams JSON)')),
+ new Feed(Feed::RSS2,
+ common_local_url('apiconversation',
+ array(
+ 'id' => $this->conv->getID(),
+ 'format' => 'rss')),
+ // TRANS: Title for link to notice feed.
+ // TRANS: %s is a user nickname.
+ _('Conversation feed (RSS 2.0)')),
+ new Feed(Feed::ATOM,
+ common_local_url('apiconversation',
+ array(
+ 'id' => $this->conv->getID(),
+ 'format' => 'atom')),
+ // TRANS: Title for link to notice feed.
+ // TRANS: %s is a user nickname.
+ _('Conversation feed (Atom)')));
+ }
}
+