settingsnav.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. /**
  49. * Show the menu
  50. *
  51. * @return void
  52. */
  53. function show()
  54. {
  55. $actionName = $this->action->trimmed('action');
  56. $user = common_current_user();
  57. $nickname = $user->nickname;
  58. $name = $user->getProfile()->getBestName();
  59. $stub = new HomeStubNav($this->action);
  60. $this->submenu(_m('MENU','Home'), $stub);
  61. $this->action->elementStart('ul');
  62. $this->action->elementStart('li');
  63. // TRANS: Header in settings navigation panel.
  64. $this->action->element('h3', null, _m('HEADER','Settings'));
  65. $this->action->elementStart('ul', array('class' => 'nav'));
  66. if (Event::handle('StartAccountSettingsNav', array(&$this->action))) {
  67. $this->action->menuItem(common_local_url('profilesettings'),
  68. // TRANS: Menu item in settings navigation panel.
  69. _m('MENU','Profile'),
  70. // TRANS: Menu item title in settings navigation panel.
  71. _('Change your profile settings'),
  72. $actionName == 'profilesettings');
  73. $this->action->menuItem(common_local_url('avatarsettings'),
  74. // TRANS: Menu item in settings navigation panel.
  75. _m('MENU','Avatar'),
  76. // TRANS: Menu item title in settings navigation panel.
  77. _('Upload an avatar'),
  78. $actionName == 'avatarsettings');
  79. $this->action->menuItem(common_local_url('passwordsettings'),
  80. // TRANS: Menu item in settings navigation panel.
  81. _m('MENU','Password'),
  82. // TRANS: Menu item title in settings navigation panel.
  83. _('Change your password'),
  84. $actionName == 'passwordsettings');
  85. $this->action->menuItem(common_local_url('emailsettings'),
  86. // TRANS: Menu item in settings navigation panel.
  87. _m('MENU','Email'),
  88. // TRANS: Menu item title in settings navigation panel.
  89. _('Change email handling'),
  90. $actionName == 'emailsettings');
  91. $this->action->menuItem(common_local_url('urlsettings'),
  92. // TRANS: Menu item in settings navigation panel.
  93. _m('MENU','URL'),
  94. // TRANS: Menu item title in settings navigation panel.
  95. _('URL shorteners'),
  96. $actionName == 'urlsettings');
  97. Event::handle('EndAccountSettingsNav', array(&$this->action));
  98. $haveImPlugin = false;
  99. Event::handle('HaveImPlugin', array(&$haveImPlugin));
  100. if ($haveImPlugin) {
  101. $this->action->menuItem(common_local_url('imsettings'),
  102. // TRANS: Menu item in settings navigation panel.
  103. _m('MENU','IM'),
  104. // TRANS: Menu item title in settings navigation panel.
  105. _('Updates by instant messenger (IM)'),
  106. $actionName == 'imsettings');
  107. }
  108. if (common_config('sms', 'enabled')) {
  109. $this->action->menuItem(common_local_url('smssettings'),
  110. // TRANS: Menu item in settings navigation panel.
  111. _m('MENU','SMS'),
  112. // TRANS: Menu item title in settings navigation panel.
  113. _('Updates by SMS'),
  114. $actionName == 'smssettings');
  115. }
  116. $this->action->menuItem(common_local_url('oauthconnectionssettings'),
  117. // TRANS: Menu item in settings navigation panel.
  118. _m('MENU','Connections'),
  119. // TRANS: Menu item title in settings navigation panel.
  120. _('Authorized connected applications'),
  121. $actionName == 'oauthconnectionsettings');
  122. if (common_config('oldschool', 'enabled')) {
  123. $this->action->menuItem(common_local_url('oldschoolsettings'),
  124. // TRANS: Menu item in settings navigation panel.
  125. _m('MENU','Old school'),
  126. // TRANS: Menu item title in settings navigation panel.
  127. _('UI tweaks for old-school users'),
  128. $actionName == 'oldschoolsettings');
  129. }
  130. Event::handle('EndConnectSettingsNav', array(&$this->action));
  131. }
  132. $this->action->elementEnd('ul');
  133. $this->action->elementEnd('li');
  134. $this->action->elementEnd('ul');
  135. }
  136. }