mirrorsettings.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <?php
  2. /**
  3. * StatusNet, the distributed open-source microblogging tool
  4. *
  5. * PHP version 5
  6. *
  7. * LICENCE: This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU Affero General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU Affero General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Affero General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. *
  20. * @category Plugins
  21. * @package StatusNet
  22. * @author Brion Vibber <brion@status.net>
  23. * @copyright 2010 StatusNet, Inc.
  24. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  25. * @link http://status.net/
  26. */
  27. if (!defined('GNUSOCIAL')) { exit(1); }
  28. class MirrorSettingsAction extends SettingsAction
  29. {
  30. /**
  31. * Title of the page
  32. *
  33. * @return string Page title
  34. */
  35. function title()
  36. {
  37. // TRANS: Page title.
  38. return _m('Feed mirror settings');
  39. }
  40. /**
  41. * Instructions for use
  42. *
  43. * @return string Instructions for use
  44. */
  45. function getInstructions()
  46. {
  47. // TRANS: Page instructions.
  48. return _m('You can mirror updates from many RSS and Atom feeds ' .
  49. 'into your GNU social timeline!');
  50. }
  51. /**
  52. * Show the form for OpenID management
  53. *
  54. * We have one form with a few different submit buttons to do different things.
  55. *
  56. * @return void
  57. */
  58. function showContent()
  59. {
  60. $provider = $this->trimmed('provider');
  61. if (!empty($provider) || GNUsocial::isAjax()) {
  62. $this->showAddFeedForm($provider);
  63. } else {
  64. $this->elementStart('div', array('id' => 'add-mirror'));
  65. $this->showAddWizard();
  66. $this->elementEnd('div');
  67. $mirror = new SubMirror();
  68. $mirror->subscriber = $this->scoped->getID();
  69. if ($mirror->find()) {
  70. while ($mirror->fetch()) {
  71. $this->showFeedForm($mirror);
  72. }
  73. }
  74. }
  75. }
  76. function showAddWizard()
  77. {
  78. $form = new AddMirrorWizard($this);
  79. $form->show();
  80. }
  81. function showFeedForm(SubMirror $mirror)
  82. {
  83. $profile = Profile::getByID($mirror->subscribed);
  84. $form = new EditMirrorForm($this, $profile);
  85. $form->show();
  86. }
  87. function showAddFeedForm()
  88. {
  89. switch ($this->arg('provider')) {
  90. case 'statusnet':
  91. break;
  92. case 'wordpress':
  93. break;
  94. case 'linkedin':
  95. break;
  96. case 'feed':
  97. default:
  98. $form = new AddMirrorForm($this);
  99. }
  100. $form->show();
  101. }
  102. /**
  103. * Show the local navigation menu
  104. *
  105. * This is the same for all settings, so we show it here.
  106. *
  107. * @return void
  108. */
  109. function showLocalNav()
  110. {
  111. $menu = new SettingsNav($this);
  112. $menu->show();
  113. }
  114. function showScripts()
  115. {
  116. parent::showScripts();
  117. $this->script('plugins/SubMirror/js/mirrorsettings.js');
  118. }
  119. function showStylesheets()
  120. {
  121. parent::showStylesheets();
  122. $this->cssLink('plugins/SubMirror/css/mirrorsettings.css');
  123. }
  124. }