settingsnav.php 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <?php
  2. /**
  3. * StatusNet - the distributed open-source microblogging tool
  4. * Copyright (C) 2010,2011, StatusNet, Inc.
  5. *
  6. * Settings menu
  7. *
  8. * PHP version 5
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as published by
  12. * the Free Software Foundation, either version 3 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. * @category Widget
  24. * @package StatusNet
  25. * @author Evan Prodromou <evan@status.net>
  26. * @copyright 2010,2011 StatusNet, Inc.
  27. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
  28. * @link http://status.net/
  29. */
  30. if (!defined('STATUSNET')) {
  31. // This check helps protect against security problems;
  32. // your code file can't be executed directly from the web.
  33. exit(1);
  34. }
  35. /**
  36. * A widget for showing the settings group local nav menu
  37. *
  38. * @category Widget
  39. * @package StatusNet
  40. * @author Evan Prodromou <evan@status.net>
  41. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  42. * @link http://status.net/
  43. *
  44. * @see HTMLOutputter
  45. */
  46. class SettingsNav extends Menu
  47. {
  48. public $widgetOpts;
  49. public $scoped;
  50. /**
  51. * Show the menu
  52. *
  53. * @return void
  54. */
  55. function show()
  56. {
  57. $actionName = $this->action->trimmed('action');
  58. $user = common_current_user();
  59. $nickname = $user->nickname;
  60. $name = $user->getProfile()->getBestName();
  61. $stub = new HomeStubNav($this->action);
  62. $this->submenu(_m('MENU','Home'), $stub);
  63. $this->action->elementStart('ul');
  64. $this->action->elementStart('li');
  65. // TRANS: Header in settings navigation panel.
  66. $this->action->element('h3', null, _m('HEADER','Settings'));
  67. $this->action->elementStart('ul', array('class' => 'nav'));
  68. if (Event::handle('StartAccountSettingsNav', array(&$this->action))) {
  69. $this->action->menuItem(common_local_url('profilesettings'),
  70. // TRANS: Menu item in settings navigation panel.
  71. _m('MENU','Profile'),
  72. // TRANS: Menu item title in settings navigation panel.
  73. _('Change your profile settings'),
  74. $actionName == 'profilesettings');
  75. $this->action->menuItem(common_local_url('avatarsettings'),
  76. // TRANS: Menu item in settings navigation panel.
  77. _m('MENU','Avatar'),
  78. // TRANS: Menu item title in settings navigation panel.
  79. _('Upload an avatar'),
  80. $actionName == 'avatarsettings');
  81. $this->action->menuItem(common_local_url('passwordsettings'),
  82. // TRANS: Menu item in settings navigation panel.
  83. _m('MENU','Password'),
  84. // TRANS: Menu item title in settings navigation panel.
  85. _('Change your password'),
  86. $actionName == 'passwordsettings');
  87. $this->action->menuItem(common_local_url('emailsettings'),
  88. // TRANS: Menu item in settings navigation panel.
  89. _m('MENU','Email'),
  90. // TRANS: Menu item title in settings navigation panel.
  91. _('Change email handling'),
  92. $actionName == 'emailsettings');
  93. $this->action->menuItem(common_local_url('urlsettings'),
  94. // TRANS: Menu item in settings navigation panel.
  95. _m('MENU','URL'),
  96. // TRANS: Menu item title in settings navigation panel.
  97. _('URL shorteners'),
  98. $actionName == 'urlsettings');
  99. Event::handle('EndAccountSettingsNav', array(&$this->action));
  100. $haveImPlugin = false;
  101. Event::handle('HaveImPlugin', array(&$haveImPlugin));
  102. if ($haveImPlugin) {
  103. $this->action->menuItem(common_local_url('imsettings'),
  104. // TRANS: Menu item in settings navigation panel.
  105. _m('MENU','IM'),
  106. // TRANS: Menu item title in settings navigation panel.
  107. _('Updates by instant messenger (IM)'),
  108. $actionName == 'imsettings');
  109. }
  110. if (common_config('sms', 'enabled')) {
  111. $this->action->menuItem(common_local_url('smssettings'),
  112. // TRANS: Menu item in settings navigation panel.
  113. _m('MENU','SMS'),
  114. // TRANS: Menu item title in settings navigation panel.
  115. _('Updates by SMS'),
  116. $actionName == 'smssettings');
  117. }
  118. $this->action->menuItem(common_local_url('oauthconnectionssettings'),
  119. // TRANS: Menu item in settings navigation panel.
  120. _m('MENU','Connections'),
  121. // TRANS: Menu item title in settings navigation panel.
  122. _('Authorized connected applications'),
  123. $actionName == 'oauthconnectionsettings');
  124. if (common_config('oldschool', 'enabled')) {
  125. $this->action->menuItem(common_local_url('oldschoolsettings'),
  126. // TRANS: Menu item in settings navigation panel.
  127. _m('MENU','Old school'),
  128. // TRANS: Menu item title in settings navigation panel.
  129. _('UI tweaks for old-school users'),
  130. $actionName == 'oldschoolsettings');
  131. }
  132. Event::handle('EndConnectSettingsNav', array(&$this->action));
  133. }
  134. $this->action->elementEnd('ul');
  135. $this->action->elementEnd('li');
  136. $this->action->elementEnd('ul');
  137. }
  138. }