conversation.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. /**
  3. * Display a conversation in the browser
  4. *
  5. * PHP version 5
  6. *
  7. * @category Action
  8. * @package StatusNet
  9. * @author Evan Prodromou <evan@status.net>
  10. * @author Mikael Nordfeldth <mmn@hethane.se>
  11. * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
  12. * @link http://status.net/
  13. *
  14. * StatusNet - the distributed open-source microblogging tool
  15. * Copyright (C) 2009, StatusNet, Inc.
  16. *
  17. * This program is free software: you can redistribute it and/or modify
  18. * it under the terms of the GNU Affero General Public License as published by
  19. * the Free Software Foundation, either version 3 of the License, or
  20. * (at your option) any later version.
  21. *
  22. * This program is distributed in the hope that it will be useful,
  23. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  25. * GNU Affero General Public License for more details.
  26. *
  27. * You should have received a copy of the GNU Affero General Public License
  28. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  29. */
  30. if (!defined('GNUSOCIAL')) { exit(1); }
  31. /**
  32. * Conversation tree in the browser
  33. *
  34. * Will always try to show the entire conversation, since that's how our
  35. * ConversationNoticeStream works.
  36. *
  37. * @category Action
  38. * @package StatusNet
  39. * @author Evan Prodromou <evan@status.net>
  40. * @author Mikael Nordfeldth <mmn@hethane.se>
  41. * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
  42. * @link http://status.net/
  43. */
  44. class ConversationAction extends ManagedAction
  45. {
  46. var $conv = null;
  47. var $page = null;
  48. var $notices = null;
  49. protected function doPreparation()
  50. {
  51. $this->conv = Conversation::getByID($this->int('id'));
  52. }
  53. /**
  54. * Returns the page title
  55. *
  56. * @return string page title
  57. */
  58. function title()
  59. {
  60. // TRANS: Title for page with a conversion (multiple notices in context).
  61. return _('Conversation');
  62. }
  63. /**
  64. * Show content.
  65. *
  66. * NoticeList extended classes do most heavy lifting. Plugins can override.
  67. *
  68. * @return void
  69. */
  70. function showContent()
  71. {
  72. if (Event::handle('StartShowConversation', array($this, $this->conv, $this->scoped))) {
  73. $notices = $this->conv->getNotices($this->scoped);
  74. $nl = new FullThreadedNoticeList($notices, $this, $this->scoped);
  75. $cnt = $nl->show();
  76. }
  77. Event::handle('EndShowConversation', array($this, $this->conv, $this->scoped));
  78. }
  79. function isReadOnly($args)
  80. {
  81. return true;
  82. }
  83. function getFeeds()
  84. {
  85. return array(new Feed(Feed::JSON,
  86. common_local_url('apiconversation',
  87. array(
  88. 'id' => $this->conv->getID(),
  89. 'format' => 'as')),
  90. // TRANS: Title for link to notice feed.
  91. // TRANS: %s is a user nickname.
  92. _('Conversation feed (Activity Streams JSON)')),
  93. new Feed(Feed::RSS2,
  94. common_local_url('apiconversation',
  95. array(
  96. 'id' => $this->conv->getID(),
  97. 'format' => 'rss')),
  98. // TRANS: Title for link to notice feed.
  99. // TRANS: %s is a user nickname.
  100. _('Conversation feed (RSS 2.0)')),
  101. new Feed(Feed::ATOM,
  102. common_local_url('apiconversation',
  103. array(
  104. 'id' => $this->conv->getID(),
  105. 'format' => 'atom')),
  106. // TRANS: Title for link to notice feed.
  107. // TRANS: %s is a user nickname.
  108. _('Conversation feed (Atom)')));
  109. }
  110. }