infoaction.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <?php
  2. /**
  3. * Information action
  4. *
  5. * PHP version 5
  6. *
  7. * @category Action
  8. * @package StatusNet
  9. * @author Zach Copley <zach@status.net>
  10. * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
  11. * @link http://status.net/
  12. *
  13. * StatusNet - the distributed open-source microblogging tool
  14. * Copyright (C) 2010, StatusNet, Inc.
  15. *
  16. * This program is free software: you can redistribute it and/or modify
  17. * it under the terms of the GNU Affero General Public License as published by
  18. * the Free Software Foundation, either version 3 of the License, or
  19. * (at your option) any later version.
  20. *
  21. * This program is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. * GNU Affero General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU Affero General Public License
  27. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  28. */
  29. if (!defined('STATUSNET') && !defined('LACONICA')) {
  30. exit(1);
  31. }
  32. /**
  33. * Base class for displaying dialog box like messages to the user
  34. *
  35. * @category Action
  36. * @package StatusNet
  37. * @author Zach Copley <zach@status.net>
  38. * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
  39. * @link http://status.net/
  40. *
  41. * @see ErrorAction
  42. */
  43. class InfoAction extends ManagedAction
  44. {
  45. var $message = null;
  46. function __construct($title, $message, $output='php://output', $indent=null)
  47. {
  48. parent::__construct($output, $indent);
  49. $this->message = $message;
  50. $this->title = $title;
  51. // XXX: hack alert: usually we aren't going to
  52. // call this page directly, but because it's
  53. // an action it needs an args array anyway
  54. $this->prepare($_REQUEST);
  55. }
  56. /**
  57. * Page title.
  58. *
  59. * @return string page title
  60. */
  61. function title()
  62. {
  63. return empty($this->title) ? '' : $this->title;
  64. }
  65. function isReadOnly($args)
  66. {
  67. return true;
  68. }
  69. // Overload a bunch of stuff so the page isn't too bloated
  70. function showBody()
  71. {
  72. $this->elementStart('body', ['id' => 'error']);
  73. $this->elementStart('div', ['id' => 'wrap']);
  74. $this->showHeader();
  75. $this->showCore();
  76. $this->showFooter();
  77. $this->elementEnd('div');
  78. $this->elementEnd('body');
  79. }
  80. function showCore()
  81. {
  82. $this->elementStart('div', ['id' => 'core']);
  83. $this->elementStart('div', ['id' => 'aside_primary_wrapper']);
  84. $this->elementStart('div', ['id' => 'content_wrapper']);
  85. $this->elementStart('div', ['id' => 'site_nav_local_views_wrapper']);
  86. $this->showContentBlock();
  87. $this->elementEnd('div');
  88. $this->elementEnd('div');
  89. $this->elementEnd('div');
  90. $this->elementEnd('div');
  91. }
  92. function showHeader()
  93. {
  94. $this->elementStart('div', ['id' => 'header']);
  95. $this->showLogo();
  96. $this->showPrimaryNav();
  97. $this->elementEnd('div');
  98. }
  99. /**
  100. * Display content.
  101. *
  102. * @return void
  103. */
  104. function showContent()
  105. {
  106. $this->element('div', ['class' => 'info'], $this->message);
  107. }
  108. }