diff --git a/lang/en.json b/lang/en.json index b68df794c2475bab58a6eb7704549d643e684168..f0bbc0e32e89f6f569c592430cc76ea47b607488 100644 --- a/lang/en.json +++ b/lang/en.json @@ -188,7 +188,7 @@ "Forums": "Forums", "FromReferrer": "from", "GeneralInformation": "General Information", - "GeneralSettings": "General Settings", + "General": "General", "GetStarted": "Get started", "GiveUsYourFeedback": "Give us Feedback!", "Goal": "Goal", diff --git a/plugins/CoreAdminHome/Menu.php b/plugins/CoreAdminHome/Menu.php index 7926ff9cf58dd1e91639153126d857c3d2f1209b..0bcc6648988bc3936c8e78ffde7865675d8d7d82 100644 --- a/plugins/CoreAdminHome/Menu.php +++ b/plugins/CoreAdminHome/Menu.php @@ -10,6 +10,8 @@ namespace Piwik\Plugins\CoreAdminHome; use Piwik\Db; use Piwik\Menu\MenuAdmin; +use Piwik\Menu\MenuTop; +use Piwik\Menu\MenuUser; use Piwik\Piwik; use Piwik\Settings\Manager as SettingsManager; @@ -26,7 +28,7 @@ class Menu extends \Piwik\Plugin\Menu $menu->addDiagnosticItem(null, "", $order = 10); $menu->addDevelopmentItem(null, "", $order = 15); - $menu->addSettingsItem('CoreAdminHome_MenuGeneralSettings', + $menu->addSettingsItem('General_General', $this->urlForAction('generalSettings'), $order = 6); $menu->addManageItem('CoreAdminHome_TrackingCode', @@ -35,10 +37,17 @@ class Menu extends \Piwik\Plugin\Menu } if (SettingsManager::hasPluginsSettingsForCurrentUser()) { - $menu->addSettingsItem('CoreAdminHome_PluginSettings', + $menu->addSettingsItem('General_Plugins', $this->urlForAction('pluginSettings'), $order = 7); } } + public function configureTopMenu(MenuTop $menu) + { + if (Piwik::isUserHasSomeAdminAccess()) { + $menu->addItem('CoreAdminHome_Administration', null, $this->urlForAction('generalSettings'), 10); + } + } + } diff --git a/plugins/CoreHome/Menu.php b/plugins/CoreHome/Menu.php new file mode 100644 index 0000000000000000000000000000000000000000..3351d2b5a168c3ff92db6c1d8a70ce9ba8b2e958 --- /dev/null +++ b/plugins/CoreHome/Menu.php @@ -0,0 +1,39 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ +namespace Piwik\Plugins\CoreHome; + +use Piwik\Db; +use Piwik\Menu\MenuTop; +use Piwik\Menu\MenuUser; +use Piwik\Piwik; + +class Menu extends \Piwik\Plugin\Menu +{ + public function configureUserMenu(MenuUser $menu) + { + if (!Piwik::isUserIsAnonymous()) { + $module = $this->getLoginModule(); + $menu->addItem('General_Logout', null, array('module' => $module, 'action' => 'logout'), 999); + } + } + + public function configureTopMenu(MenuTop $menu) + { + if (Piwik::isUserIsAnonymous()) { + $module = $this->getLoginModule(); + $menu->addItem('Login_LogIn', null, array('module' => $module), 999); + } + } + + private function getLoginModule() + { + return Piwik::getLoginPluginName(); + } + +} diff --git a/plugins/CoreHome/stylesheets/coreHome.less b/plugins/CoreHome/stylesheets/coreHome.less index e17b56cc94c2b07c6d9a23b1492586c49d151dde..0b2cc94d94a642eac891c1da764fc21dcdecc9e3 100644 --- a/plugins/CoreHome/stylesheets/coreHome.less +++ b/plugins/CoreHome/stylesheets/coreHome.less @@ -218,7 +218,7 @@ a.Piwik_Popover_Error_Back { } #userMenu .items { - margin-left: -50px; + margin-left: -117px; width: 160px; } diff --git a/plugins/CoreHome/templates/_topBarTopMenu.twig b/plugins/CoreHome/templates/_topBarTopMenu.twig index fc09b62f78f9f1f3ca99d66fcff275cbdbe1b542..00e75d9813c3e44764f8c23db1c880f1c8ba4712 100644 --- a/plugins/CoreHome/templates/_topBarTopMenu.twig +++ b/plugins/CoreHome/templates/_topBarTopMenu.twig @@ -1,16 +1,4 @@ <div id="topRightBar"> - {% for label,menu in topMenu %} - {% if menu._html is defined %} - {{ menu._html|raw }} - {% elseif (menu._url.module == currentModule and (menu._url.action is empty or menu._url.action == currentAction)) %} - <span class="topBarElem topBarElemActive"><strong>{{ label|translate }}</strong></span> - {% else %} - <span class="topBarElem" {% if menu._tooltip is defined %}title="{{ menu._tooltip }}"{% endif %}> - <a id="topmenu-{{ menu._url.module|lower }}" href="index.php{{ menu._url|urlRewriteWithParameters }}">{{ label|translate }}</a> - </span> - {% endif %} - | - {% endfor %} {% set helloAlias %} {% if userAlias is not empty %} @@ -20,6 +8,19 @@ {% endif %} {% endset %} + {% macro topMenuItem(label, menu, currentModule, currentAction) %} + + {% if menu._html is defined %} + {{ menu._html|raw }} + {% elseif (menu._url.module == currentModule and (menu._url.action is empty or menu._url.action == currentAction)) %} + <span class="topBarElem topBarElemActive"><strong>{{ label|translate }}</strong></span> + {% else %} + <span class="topBarElem" {% if menu._tooltip is defined %}title="{{ menu._tooltip }}"{% endif %}> + <a id="topmenu-{{ menu._url.module|lower }}" href="index.php{{ menu._url|urlRewriteWithParameters }}">{{ label|translate }}</a> + </span> + {% endif %} + {% endmacro %} + {% macro userMenuItem(label, menu, currentModule, currentAction) %} <a class="item {% if (menu._url.module == currentModule and (menu._url.action is empty or menu._url.action == currentAction)) %}active{% endif %}" @@ -30,6 +31,11 @@ {% endmacro %} + {% for label,menu in topMenu if menu._order >= 0 and menu._order <= 500 %} + {{ _self.topMenuItem(label, menu, currentModule, currentAction) }} + | + {% endfor %} + <span class="topBarElem"> <div id="userMenu" tooltip="{{ 'General_HelloUser'|translate(helloAlias|trim)|rawSafeDecoded }}" @@ -57,11 +63,9 @@ </div> </span> - | <span class="topBarElem"> - {% if userLogin == 'anonymous' %} - <a href='index.php?module={{ loginModule }}'>{{ 'Login_LogIn'|translate }}</a> - {% else %} - <a href='index.php?module={{ loginModule }}&action=logout'>{{ 'General_Logout'|translate }}</a> - {% endif %} - </span> + {% for label,menu in topMenu if menu._order >= 501 %} + | + {{ _self.topMenuItem(label, menu, currentModule, currentAction) }} + {% endfor %} + </div> diff --git a/plugins/UsersManager/Menu.php b/plugins/UsersManager/Menu.php index 959d8ec3c6de4fb130d645e94053c8c6f76b23f9..8894de1097dab3fcc7c64d797bf5ab61eefea977 100644 --- a/plugins/UsersManager/Menu.php +++ b/plugins/UsersManager/Menu.php @@ -18,11 +18,11 @@ class Menu extends \Piwik\Plugin\Menu { if (Piwik::isUserHasSomeAdminAccess()) { $menu->addManageItem('UsersManager_MenuUsers', $this->urlForAction('index'), $order = 2); - $menu->addSettingsItem('UsersManager_PersonalSettings', $this->urlForAction('userSettings'), $order = 1); + $menu->addSettingsItem('UsersManager_MenuPersonal', $this->urlForAction('userSettings'), $order = 1); } if (Piwik::hasUserSuperUserAccess() && API::getInstance()->getSitesAccessFromUser('anonymous')) { - $menu->addSettingsItem('UsersManager_MenuAnonymousUserSettings', $this->urlForAction('anonymousSettings'), $order = 8); + $menu->addSettingsItem('UsersManager_AnonymousUser', $this->urlForAction('anonymousSettings'), $order = 8); } } diff --git a/plugins/UsersManager/lang/en.json b/plugins/UsersManager/lang/en.json index bd4a65e93ec4f7edcd5dbf8fede7749adff519b9..77f803824cb1d783497ba53d8cf871491ea213ca 100644 --- a/plugins/UsersManager/lang/en.json +++ b/plugins/UsersManager/lang/en.json @@ -3,6 +3,7 @@ "AddUser": "Add a new user", "Alias": "Alias", "AllWebsites": "All websites", + "AnonymousUser": "Anonymous user", "AnonymousUserHasViewAccess": "Note: the %1$s user has %2$s access to this website.", "AnonymousUserHasViewAccess2": "Your analytics reports and your visitors information are publicly viewable.", "ApplyToAllWebsites": "Apply to all websites", @@ -41,6 +42,7 @@ "MenuAnonymousUserSettings": "Anonymous user settings", "MenuUsers": "Users", "MenuUserSettings": "User settings", + "MenuPersonal": "Personal", "PersonalSettings": "Personal settings", "NoteNoAnonymousUserAccessSettingsWontBeUsed2": "Note: You cannot change the settings in this section, because you do not have any website that can be accessed by the anonymous user.", "NoUsersExist": "There are no users yet.",