diff options
56 files changed, 648 insertions, 418 deletions
diff --git a/core/Menu/MenuAdmin.php b/core/Menu/MenuAdmin.php index 13e8480596..5335091285 100644 --- a/core/Menu/MenuAdmin.php +++ b/core/Menu/MenuAdmin.php @@ -117,7 +117,7 @@ class MenuAdmin extends MenuAbstract */ public function addManageItem($menuName, $url, $order = 50, $tooltip = false) { - $this->addItem('CoreAdminHome_MenuManage', $menuName, $url, $order, $tooltip); + $this->addItem('CoreAdminHome_Administration', $menuName, $url, $order, $tooltip); } /** @@ -144,29 +144,6 @@ class MenuAdmin extends MenuAbstract } /** - * Returns the current AdminMenu name - * - * @return boolean - */ - public function getCurrentAdminMenuName() - { - $menu = MenuAdmin::getInstance()->getMenu(); - $currentModule = Piwik::getModule(); - $currentAction = Piwik::getAction(); - foreach ($menu as $submenu) { - foreach ($submenu as $subMenuName => $parameters) { - if (strpos($subMenuName, '_') !== 0 && - $parameters['_url']['module'] == $currentModule - && $parameters['_url']['action'] == $currentAction - ) { - return $subMenuName; - } - } - } - return false; - } - - /** * @deprecated since version 2.4.0. See {@link Piwik\Plugin\Menu} for new implementation. */ public static function removeEntry($menuName, $subMenuName = false) diff --git a/core/Menu/MenuUser.php b/core/Menu/MenuUser.php index 758ac3d578..ac3bc295ab 100755 --- a/core/Menu/MenuUser.php +++ b/core/Menu/MenuUser.php @@ -40,6 +40,20 @@ class MenuUser extends MenuAbstract * @api * @since 2.5.0 */ + public function addPersonalItem($menuName, $url, $order = 50, $tooltip = false) + { + $this->addItem('UsersManager_MenuPersonal', $menuName, $url, $order, $tooltip); + } + + /** + * See {@link add()}. Adds a new menu item to the manage section of the user menu. + * @param string $menuName + * @param array $url + * @param int $order + * @param bool|string $tooltip + * @api + * @since 2.5.0 + */ public function addManageItem($menuName, $url, $order = 50, $tooltip = false) { $this->addItem('CoreAdminHome_MenuManage', $menuName, $url, $order, $tooltip); diff --git a/core/Plugin/ControllerAdmin.php b/core/Plugin/ControllerAdmin.php index 23184caa8f..b0c86a6b1a 100644 --- a/core/Plugin/ControllerAdmin.php +++ b/core/Plugin/ControllerAdmin.php @@ -148,7 +148,6 @@ abstract class ControllerAdmin extends Controller * - **statisticsNotRecorded** - Set to true if the `[Tracker] record_statistics` INI * config is `0`. If not `0`, this variable will not be defined. * - **topMenu** - The result of `MenuTop::getInstance()->getMenu()`. - * - **currentAdminMenuName** - The currently selected admin menu name. * - **enableFrames** - The value of the `[General] enable_framed_pages` INI config option. If * true, {@link Piwik\View::setXFrameOptions()} is called on the view. * - **isSuperUser** - Whether the current user is a superuser or not. @@ -170,7 +169,6 @@ abstract class ControllerAdmin extends Controller $view->topMenu = MenuTop::getInstance()->getMenu(); $view->userMenu = MenuUser::getInstance()->getMenu(); - $view->currentAdminMenuName = MenuAdmin::getInstance()->getCurrentAdminMenuName(); $view->isDataPurgeSettingsEnabled = self::isDataPurgeSettingsEnabled(); $enableFrames = PiwikConfig::getInstance()->General['enable_framed_settings']; diff --git a/core/Settings/Manager.php b/core/Settings/Manager.php index bbe696792b..9c75945330 100644 --- a/core/Settings/Manager.php +++ b/core/Settings/Manager.php @@ -102,22 +102,57 @@ class Manager return $settingsForUser; } - public static function hasPluginSettingsForCurrentUser($pluginName) + public static function hasSystemPluginSettingsForCurrentUser($pluginName) { - $pluginNames = array_keys(static::getPluginSettingsForCurrentUser()); + $pluginNames = static::getPluginNamesHavingSystemSettings(); return in_array($pluginName, $pluginNames); } /** - * Detects whether there are settings for activated plugins available that the current user can change. + * Detects whether there are user settings for activated plugins available that the current user can change. * * @return bool */ - public static function hasPluginsSettingsForCurrentUser() + public static function hasUserPluginsSettingsForCurrentUser() { $settings = static::getPluginSettingsForCurrentUser(); + foreach ($settings as $setting) { + foreach ($setting->getSettingsForCurrentUser() as $set) { + if ($set instanceof UserSetting) { + return true; + } + } + } + + return false; + } + + private static function getPluginNamesHavingSystemSettings() + { + $settings = static::getPluginSettingsForCurrentUser(); + $plugins = array(); + + foreach ($settings as $pluginName => $setting) { + foreach ($setting->getSettingsForCurrentUser() as $set) { + if ($set instanceof SystemSetting) { + $plugins[] = $pluginName; + } + } + } + + return array_unique($plugins); + } + /** + * Detects whether there are system settings for activated plugins available that the current user can change. + * + * @return bool + */ + public static function hasSystemPluginsSettingsForCurrentUser() + { + $settings = static::getPluginNamesHavingSystemSettings(); + return !empty($settings); } diff --git a/plugins/API/templates/listAllAPI.twig b/plugins/API/templates/listAllAPI.twig index e4cf96174c..8bd6e1d865 100644 --- a/plugins/API/templates/listAllAPI.twig +++ b/plugins/API/templates/listAllAPI.twig @@ -1,18 +1,17 @@ -{% extends 'dashboard.twig' %} -{% set showMenu=false %} +{% extends 'user.twig' %} {% block content %} -{% include "@CoreHome/_siteSelectHeader.twig" %} +<div> -<div class="page_api pageWrap"> + <h2>{{ 'API_QuickDocumentationTitle'|translate }}</h2> + + {% include "@CoreHome/_siteSelectHeader.twig" %} <div class="top_controls"> {% include "@CoreHome/_periodSelect.twig" %} </div> - <h2>{{ 'API_QuickDocumentationTitle'|translate }}</h2> - <p>{{ 'API_PluginDescription'|translate }}</p> <p> diff --git a/plugins/CoreAdminHome/Controller.php b/plugins/CoreAdminHome/Controller.php index c03577e5e5..53a8500dd0 100644 --- a/plugins/CoreAdminHome/Controller.php +++ b/plugins/CoreAdminHome/Controller.php @@ -25,6 +25,8 @@ use Piwik\Plugins\LanguagesManager\LanguagesManager; use Piwik\Plugins\PrivacyManager\DoNotTrackHeaderChecker; use Piwik\Plugins\SitesManager\API as APISitesManager; use Piwik\Settings\Manager as SettingsManager; +use Piwik\Settings\SystemSetting; +use Piwik\Settings\UserSetting; use Piwik\Site; use Piwik\Tracker\IgnoreCookie; use Piwik\Url; @@ -69,7 +71,53 @@ class Controller extends \Piwik\Plugin\ControllerAdmin return $view->render(); } - public function pluginSettings() + public function adminPluginSettings() + { + Piwik::checkUserHasSuperUserAccess(); + + $settings = $this->getPluginSettings(); + + $vars = array( + 'nonce' => Nonce::getNonce(static::SET_PLUGIN_SETTINGS_NONCE), + 'pluginsSettings' => $this->getSettingsByType($settings, 'admin'), + 'firstSuperUserSettingNames' => $this->getFirstSuperUserSettingNames($settings), + 'mode' => 'admin' + ); + + return $this->renderTemplate('pluginSettings', $vars); + } + + /** + * @param \Piwik\Plugin\Settings[] $pluginsSettings + * @return array array([pluginName] => []) + */ + private function getSettingsByType($pluginsSettings, $mode) + { + $byType = array(); + + foreach ($pluginsSettings as $pluginName => $pluginSettings) { + $settings = array(); + + foreach ($pluginSettings->getSettingsForCurrentUser() as $setting) { + if ('admin' === $mode && $setting instanceof SystemSetting) { + $settings[] = $setting; + } elseif ('user' === $mode && $setting instanceof UserSetting) { + $settings[] = $setting; + } + } + + if (!empty($settings)) { + $byType[$pluginName] = array( + 'introduction' => $pluginSettings->getIntroduction(), + 'settings' => $settings + ); + } + } + + return $byType; + } + + public function userPluginSettings() { Piwik::checkUserIsNotAnonymous(); @@ -77,8 +125,9 @@ class Controller extends \Piwik\Plugin\ControllerAdmin $vars = array( 'nonce' => Nonce::getNonce(static::SET_PLUGIN_SETTINGS_NONCE), - 'pluginSettings' => $settings, - 'firstSuperUserSettingNames' => $this->getFirstSuperUserSettingNames($settings) + 'pluginsSettings' => $this->getSettingsByType($settings, 'user'), + 'firstSuperUserSettingNames' => $this->getFirstSuperUserSettingNames($settings), + 'mode' => 'user' ); return $this->renderTemplate('pluginSettings', $vars); diff --git a/plugins/CoreAdminHome/Menu.php b/plugins/CoreAdminHome/Menu.php index 17be9db0e0..3d99ba6a4b 100644 --- a/plugins/CoreAdminHome/Menu.php +++ b/plugins/CoreAdminHome/Menu.php @@ -31,14 +31,11 @@ class Menu extends \Piwik\Plugin\Menu $menu->addSettingsItem('General_General', $this->urlForAction('generalSettings'), $order = 6); - $menu->addManageItem('CoreAdminHome_TrackingCode', - $this->urlForAction('trackingCodeGenerator'), - $order = 10); } - if (SettingsManager::hasPluginsSettingsForCurrentUser()) { + if (Piwik::hasUserSuperUserAccess() && SettingsManager::hasSystemPluginsSettingsForCurrentUser()) { $menu->addSettingsItem('General_Plugins', - $this->urlForAction('pluginSettings'), + $this->urlForAction('adminPluginSettings'), $order = 7); } } @@ -50,4 +47,17 @@ class Menu extends \Piwik\Plugin\Menu } } + public function configureUserMenu(MenuUser $menu) + { + $menu->addManageItem('CoreAdminHome_TrackingCode', + $this->urlForAction('trackingCodeGenerator'), + $order = 10); + + if (SettingsManager::hasUserPluginsSettingsForCurrentUser()) { + $menu->addPersonalItem('CoreAdminHome_PluginSettings', + $this->urlForAction('userPluginSettings'), + $order = 15); + } + } + } diff --git a/plugins/CoreAdminHome/stylesheets/generalSettings.less b/plugins/CoreAdminHome/stylesheets/generalSettings.less index 4e7dbec7cb..1711f75f34 100644 --- a/plugins/CoreAdminHome/stylesheets/generalSettings.less +++ b/plugins/CoreAdminHome/stylesheets/generalSettings.less @@ -7,6 +7,11 @@ text-decoration: underline; } +.admin h2 + .top_bar_sites_selector { + margin-top: -62px; + margin-right: 0px !important; +} + #content.admin { margin: 0 0 0 260px; padding: 0 0 40px; @@ -138,6 +143,10 @@ table.admin tbody td:hover, table.admin tbody th:hover { margin-left: 50px; } +.adminTable .columnHelp .ui-inline-help { + margin-left: 0px; +} + /* other styles */ .form-description { color: @theme-color-text-lighter; diff --git a/plugins/CoreAdminHome/templates/_menu.twig b/plugins/CoreAdminHome/templates/_menu.twig index 5ec9b95cbd..080f36e93c 100644 --- a/plugins/CoreAdminHome/templates/_menu.twig +++ b/plugins/CoreAdminHome/templates/_menu.twig @@ -1,23 +1,3 @@ -{% if adminMenu|length > 1 %} - <div class="Menu Menu--admin"> - <ul class="Menu-tabList"> - {% for name,submenu in adminMenu %} - {% if submenu._hasSubmenu %} - <li> - <span>{{ name|translate }}</span> - <ul> - {% for sname,url in submenu %} - {% if sname|slice(0,1) != '_' %} - <li> - <a href='index.php{{ url._url|urlRewriteWithParameters }}' - {% if currentAdminMenuName is defined and sname==currentAdminMenuName %}class='active'{% endif %}>{{ sname|translate }}</a> - </li> - {% endif %} - {% endfor %} - </ul> - </li> - {% endif %} - {% endfor %} - </ul> - </div> -{% endif %} +{% import '@CoreHome/macros.twig' as corehome %} + +{{ corehome.sidebarMenu(adminMenu, currentModule, currentAction) }}
\ No newline at end of file diff --git a/plugins/CoreAdminHome/templates/pluginSettings.twig b/plugins/CoreAdminHome/templates/pluginSettings.twig index fa1e032ea8..1d5bdfd2ad 100644 --- a/plugins/CoreAdminHome/templates/pluginSettings.twig +++ b/plugins/CoreAdminHome/templates/pluginSettings.twig @@ -1,4 +1,4 @@ -{% extends 'admin.twig' %} +{% extends mode == 'user' ? "user.twig" : "admin.twig" %} {% block content %} @@ -8,36 +8,28 @@ <p> {{ 'CoreAdminHome_PluginSettingsIntro'|translate }} - {% for pluginName, settings in pluginSettings %} + {% for pluginName, settings in pluginsSettings %} <a href="#{{ pluginName|e('html_attr') }}">{{ pluginName }}</a>{% if not loop.last %}, {% endif %} {% endfor %} </p> <input type="hidden" name="setpluginsettingsnonce" value="{{ nonce }}"> - {% for pluginName, settings in pluginSettings %} + {% for pluginName, pluginSettings in pluginsSettings %} <h2 id="{{ pluginName|e('html_attr') }}">{{ pluginName }}</h2> - {% if settings.getIntroduction %} + {% if pluginSettings.introduction %} <p class="pluginIntroduction"> - {{ settings.getIntroduction }} + {{ pluginSettings.introduction }} </p> {% endif %} <table class="adminTable" id="pluginSettings" data-pluginname="{{ pluginName|e('html_attr') }}"> - {% for name, setting in settings.getSettingsForCurrentUser %} + {% for name, setting in pluginSettings.settings %} {% set settingValue = setting.getValue %} - {% if pluginName in firstSuperUserSettingNames|keys and name == firstSuperUserSettingNames[pluginName] %} - <tr> - <td colspan="3"> - <h3 class="superUserSettings">{{ 'MobileMessaging_Settings_SuperAdmin'|translate }}</h3> - </td> - </tr> - {% endif %} - {% if setting.introduction %} <tr> <td colspan="3"> diff --git a/plugins/CoreAdminHome/templates/trackingCodeGenerator.twig b/plugins/CoreAdminHome/templates/trackingCodeGenerator.twig index bd54182b76..fb97cdc65e 100644 --- a/plugins/CoreAdminHome/templates/trackingCodeGenerator.twig +++ b/plugins/CoreAdminHome/templates/trackingCodeGenerator.twig @@ -1,4 +1,4 @@ -{% extends 'admin.twig' %} +{% extends 'user.twig' %} {% block head %} {{ parent() }} diff --git a/plugins/CoreHome/CoreHome.php b/plugins/CoreHome/CoreHome.php index 23e1fe093b..fb0debb6ea 100644 --- a/plugins/CoreHome/CoreHome.php +++ b/plugins/CoreHome/CoreHome.php @@ -107,6 +107,7 @@ class CoreHome extends \Piwik\Plugin $jsFiles[] = "plugins/CoreHome/javascripts/broadcast.js"; $jsFiles[] = "plugins/CoreHome/javascripts/menu.js"; $jsFiles[] = "plugins/CoreHome/javascripts/menu_init.js"; + $jsFiles[] = "plugins/CoreHome/javascripts/user_layout.js"; $jsFiles[] = "plugins/CoreHome/javascripts/calendar.js"; $jsFiles[] = "plugins/CoreHome/javascripts/sparkline.js"; $jsFiles[] = "plugins/CoreHome/javascripts/corehome.js"; diff --git a/plugins/CoreHome/Menu.php b/plugins/CoreHome/Menu.php index 08426cf796..6881b689da 100644 --- a/plugins/CoreHome/Menu.php +++ b/plugins/CoreHome/Menu.php @@ -12,25 +12,36 @@ use Piwik\Db; use Piwik\Menu\MenuTop; use Piwik\Menu\MenuUser; use Piwik\Piwik; +use Piwik\Plugins\UsersManager\API as APIUsersManager; class Menu extends \Piwik\Plugin\Menu { - public function configureUserMenu(MenuUser $menu) + public function configureTopMenu(MenuTop $menu) { - if (!Piwik::isUserIsAnonymous()) { - $module = $this->getLoginModule(); - $menu->addItem('General_Logout', null, array('module' => $module, 'action' => 'logout', 'idSite' => null), 999); + $login = Piwik::getCurrentUserLogin(); + $user = APIUsersManager::getInstance()->getUser($login); + + if (!empty($user['alias'])) { + $login = $user['alias']; } - } - public function configureTopMenu(MenuTop $menu) - { + $menu->addItem($login, null, array('module' => 'UsersManager', 'action' => 'userSettings'), 998); + + $module = $this->getLoginModule(); if (Piwik::isUserIsAnonymous()) { - $module = $this->getLoginModule(); $menu->addItem('Login_LogIn', null, array('module' => $module), 999); + } else { + $menu->addItem('General_Logout', null, array('module' => $module, 'action' => 'logout', 'idSite' => null), 999); } } + public function configureUserMenu(MenuUser $menu) + { + $menu->addPersonalItem(null, array(), 1, false); + $menu->addManageItem(null, array(), 2, false); + $menu->addPlatformItem(null, array(), 3, false); + } + private function getLoginModule() { return Piwik::getLoginPluginName(); diff --git a/plugins/CoreHome/angularjs/siteselector/siteselector.directive.less b/plugins/CoreHome/angularjs/siteselector/siteselector.directive.less index 5787d058a7..7c7ea20294 100644 --- a/plugins/CoreHome/angularjs/siteselector/siteselector.directive.less +++ b/plugins/CoreHome/angularjs/siteselector/siteselector.directive.less @@ -7,6 +7,10 @@ height: 30px; /* Hack to not push the dashboard widget below */ } +table.dataTable tr td .sites_autocomplete a { + width: auto; +} + .sites_selector_in_dashboard { margin-top:10px; } diff --git a/plugins/CoreHome/javascripts/user_layout.js b/plugins/CoreHome/javascripts/user_layout.js new file mode 100644 index 0000000000..cc29e0be90 --- /dev/null +++ b/plugins/CoreHome/javascripts/user_layout.js @@ -0,0 +1,17 @@ +/*! + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + + +$(function () { + var content = $('#content.user'); + if (!content.length) { + return; + } + + var width = $('body').width() - content.offset().left - 10; + content.css('width', width + 'px'); +}); diff --git a/plugins/CoreHome/templates/_topBarTopMenu.twig b/plugins/CoreHome/templates/_topBarTopMenu.twig index 00e75d9813..459ccb611e 100644 --- a/plugins/CoreHome/templates/_topBarTopMenu.twig +++ b/plugins/CoreHome/templates/_topBarTopMenu.twig @@ -1,15 +1,6 @@ <div id="topRightBar"> - {% set helloAlias %} - {% if userAlias is not empty %} - {{ userAlias|raw }} - {% else %} - {{ userLogin|raw }} - {% 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)) %} @@ -31,41 +22,16 @@ {% 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 }}" - menu-title="{{ helloAlias|trim }}" - piwik-menudropdown> - - {% for lev1UserLabel,lev1UserMenu in userMenu if lev1UserLabel|slice(0,1) != '_' %} - {% if not loop.first %} - <hr class="item separator"/> - {% endif %} - - {% if lev1UserMenu._hasSubmenu is defined and lev1UserMenu._hasSubmenu %} - {% if lev1UserLabel %} - <a class="item disabled category">{{ lev1UserLabel|translate }}</a> - {% endif %} - - {% for lev2Label,lev2Menu in lev1UserMenu if lev2Label|slice(0,1) != '_' %} - {{ _self.userMenuItem(lev2Label, lev2Menu, currentModule, currentAction) }} - {% endfor %} - {% else %} - {{ _self.userMenuItem(lev1UserLabel, lev1UserMenu, currentModule, currentAction) }} - {% endif %} - - {% endfor %} - </div> - </span> + {% if topMenuModule is not defined %} + {% set topMenuModule = currentModule %} + {% set topMenuAction = currentAction %} + {% endif %} - {% for label,menu in topMenu if menu._order >= 501 %} - | - {{ _self.topMenuItem(label, menu, currentModule, currentAction) }} + {% for label,menu in topMenu %} + {% if not loop.first %} + | + {% endif %} + {{ _self.topMenuItem(label, menu, topMenuModule, topMenuAction) }} {% endfor %} </div> diff --git a/plugins/CoreHome/templates/_userMenu.twig b/plugins/CoreHome/templates/_userMenu.twig new file mode 100644 index 0000000000..67076af755 --- /dev/null +++ b/plugins/CoreHome/templates/_userMenu.twig @@ -0,0 +1,3 @@ +{% import '@CoreHome/macros.twig' as corehome %} + +{{ corehome.sidebarMenu(userMenu, currentModule, currentAction) }}
\ No newline at end of file diff --git a/plugins/CoreHome/templates/macros.twig b/plugins/CoreHome/templates/macros.twig new file mode 100644 index 0000000000..a1d3d8a27b --- /dev/null +++ b/plugins/CoreHome/templates/macros.twig @@ -0,0 +1,25 @@ +{% macro sidebarMenu(sidebarMenu, currentModule, currentAction) %} + {% if sidebarMenu|length > 1 %} + <div class="Menu Menu--admin"> + <ul class="Menu-tabList"> + {% for name,submenu in sidebarMenu %} + {% if submenu._hasSubmenu %} + <li> + <span>{{ name|translate }}</span> + <ul> + {% for sname,url in submenu %} + {% if sname|slice(0,1) != '_' %} + <li> + <a href='index.php{{ url._url|urlRewriteWithParameters }}' + {% if url._url.module == currentModule and (url._url.action is empty or url._url.action == currentAction) %}class='active'{% endif %}>{{ sname|translate }}</a> + </li> + {% endif %} + {% endfor %} + </ul> + </li> + {% endif %} + {% endfor %} + </ul> + </div> + {% endif %} +{% endmacro %} diff --git a/plugins/CorePluginsAdmin/Controller.php b/plugins/CorePluginsAdmin/Controller.php index 71d95730b9..3e968e2124 100644 --- a/plugins/CorePluginsAdmin/Controller.php +++ b/plugins/CorePluginsAdmin/Controller.php @@ -205,6 +205,13 @@ class Controller extends Plugin\ControllerAdmin return $view->render(); } + public function userBrowsePlugins() + { + $view = $this->createBrowsePluginsOrThemesView('browsePlugins', $themesOnly = false); + $view->mode = 'user'; + return $view->render(); + } + private function createPluginsOrThemesView($template, $themesOnly) { Piwik::checkUserHasSuperUserAccess(); @@ -395,7 +402,7 @@ class Controller extends Plugin\ControllerAdmin } $message = Piwik::translate('CorePluginsAdmin_SuccessfullyActicated', array($pluginName)); - if (SettingsManager::hasPluginSettingsForCurrentUser($pluginName)) { + if (SettingsManager::hasSystemPluginSettingsForCurrentUser($pluginName)) { $target = sprintf('<a href="index.php%s#%s">', Url::getCurrentQueryStringWithParametersModified(array('module' => 'CoreAdminHome', 'action' => 'pluginSettings')), $pluginName); diff --git a/plugins/CorePluginsAdmin/Menu.php b/plugins/CorePluginsAdmin/Menu.php index 3133bed3e5..4d5707fefb 100644 --- a/plugins/CorePluginsAdmin/Menu.php +++ b/plugins/CorePluginsAdmin/Menu.php @@ -53,11 +53,11 @@ class Menu extends \Piwik\Plugin\Menu $order = 5); } - if (Piwik::hasUserSuperUserAccess() && CorePluginsAdmin::isMarketplaceEnabled()) { - $menu->addPlatformItem('CorePluginsAdmin_Marketplace', - $this->urlForAction('browsePlugins', array('activated' => '')), - $order = 5); + if (Piwik::hasUserSuperUserAccess() && CorePluginsAdmin::isMarketplaceEnabled()) { + $menu->addManageItem('CorePluginsAdmin_Marketplace', + $this->urlForAction('browsePlugins', array('activated' => '')), + $order = 12); } } @@ -73,7 +73,7 @@ class Menu extends \Piwik\Plugin\Menu { if ($this->isAllowedToSeeMarketPlace()) { $menu->addPlatformItem('CorePluginsAdmin_Marketplace', - $this->urlForAction('browsePlugins', array('activated' => '')), + $this->urlForAction('userBrowsePlugins', array('activated' => '')), $order = 5); } } diff --git a/plugins/CorePluginsAdmin/lang/en.json b/plugins/CorePluginsAdmin/lang/en.json index 6ce90f0e0f..578ded4e20 100644 --- a/plugins/CorePluginsAdmin/lang/en.json +++ b/plugins/CorePluginsAdmin/lang/en.json @@ -24,6 +24,7 @@ "DoMoreContactPiwikAdmins": "To install a new plugin or a new theme, please get in touch with your Piwik admins.", "EmailToEnquireUpdatedVersion": "Please email %1$s and enquire an updated version of %2$s.", "FeaturedPlugin": "Featured plugin", + "FindMorePluginsViaMarketplace": "Find more plugins in the %sMarketplace%s.", "GetEarlyAccessForPaidPlugins": "Note: all plugins are available for free at present; in the future we will enable Paid Plugins in the Marketplace (%scontact us%s for early access).", "History": "History", "Inactive": "Inactive", diff --git a/plugins/CorePluginsAdmin/templates/browsePlugins.twig b/plugins/CorePluginsAdmin/templates/browsePlugins.twig index 9259081a0c..068d9e80ab 100644 --- a/plugins/CorePluginsAdmin/templates/browsePlugins.twig +++ b/plugins/CorePluginsAdmin/templates/browsePlugins.twig @@ -1,4 +1,4 @@ -{% extends 'admin.twig' %} +{% extends mode is defined and mode == 'user' ? "user.twig" : "admin.twig" %} {% import '@CorePluginsAdmin/macros.twig' as pluginsMacro %} {% block content %} diff --git a/plugins/CorePluginsAdmin/templates/macros.twig b/plugins/CorePluginsAdmin/templates/macros.twig index 3f6ad112c0..6eda0a2d31 100644 --- a/plugins/CorePluginsAdmin/templates/macros.twig +++ b/plugins/CorePluginsAdmin/templates/macros.twig @@ -166,7 +166,7 @@ {% if name in pluginNamesHavingSettings %} <br /><br /> - <a href="{{ linkTo({'module':'CoreAdminHome', 'action': 'pluginSettings'}) }}#{{ name|e('html_attr') }}" class="settingsLink">{{ 'General_Settings'|translate }}</a> + <a href="{{ linkTo({'module':'CoreAdminHome', 'action': 'adminPluginSettings'}) }}#{{ name|e('html_attr') }}" class="settingsLink">{{ 'General_Settings'|translate }}</a> {% endif %} </td> <td class="desc"> diff --git a/plugins/CorePluginsAdmin/templates/plugins.twig b/plugins/CorePluginsAdmin/templates/plugins.twig index 4c4b6b1192..fd265aeda5 100644 --- a/plugins/CorePluginsAdmin/templates/plugins.twig +++ b/plugins/CorePluginsAdmin/templates/plugins.twig @@ -22,6 +22,11 @@ <br/>{{ 'CorePluginsAdmin_DoMoreContactPiwikAdmins'|translate }} {% endif %} + + {% if isMarketplaceEnabled %} + <br /> + {{ 'CorePluginsAdmin_FindMorePluginsViaMarketplace'|translate('<a href="' ~ linkTo({'action': 'browsePlugins'}) ~'">', '</a>')|raw }} + {% endif %} </p> {{ plugins.pluginsFilter(false, isMarketplaceEnabled) }} diff --git a/plugins/Feedback/Menu.php b/plugins/Feedback/Menu.php index acfd55dab1..19d3f62db5 100644 --- a/plugins/Feedback/Menu.php +++ b/plugins/Feedback/Menu.php @@ -15,9 +15,8 @@ class Menu extends \Piwik\Plugin\Menu { public function configureUserMenu(MenuUser $menu) { - $menu->addItem( + $menu->addPlatformItem( 'General_Help', - null, $this->urlForAction('index', array('segment' => false)), $order = 99, $tooltip = Piwik::translate('Feedback_TopLinkTooltip') diff --git a/plugins/Feedback/stylesheets/feedback.less b/plugins/Feedback/stylesheets/feedback.less index 8ac50e8c0b..c18dc3d820 100644 --- a/plugins/Feedback/stylesheets/feedback.less +++ b/plugins/Feedback/stylesheets/feedback.less @@ -1,11 +1,4 @@ #feedback-faq { - color: #5e5e5c; - width: 675px; - font-size: 14px; - - strong { - color: #5e5e5c; - } ul { list-style: none; diff --git a/plugins/Feedback/templates/index.twig b/plugins/Feedback/templates/index.twig index 97a90ee2a3..7cba7e5b26 100644 --- a/plugins/Feedback/templates/index.twig +++ b/plugins/Feedback/templates/index.twig @@ -1,11 +1,11 @@ -{% extends 'dashboard.twig' %} +{% extends 'user.twig' %} {% set test_piwikUrl='http://demo.piwik.org/' %} {% set isPiwikDemo %}{{ piwikUrl == 'http://demo.piwik.org/' or piwikUrl == 'https://demo.piwik.org/'}}{% endset %} {% block content %} - <div id="feedback-faq" class="admin centerLargeDiv"> + <div id="feedback-faq" class="admin"> <h2 piwik-enriched-headline feature-name="{{ 'General_Help'|translate }}" >{{ 'General_AboutPiwikX'|translate(piwikVersion) }}</h2> diff --git a/plugins/Goals/javascripts/goalsForm.js b/plugins/Goals/javascripts/goalsForm.js index e7de62d168..01f4540b58 100644 --- a/plugins/Goals/javascripts/goalsForm.js +++ b/plugins/Goals/javascripts/goalsForm.js @@ -37,11 +37,11 @@ function showCancel() { } function showCreateGoal() { - $("a[name=linkAddNewGoal]").show(); + $("div[name=linkAddNewGoal]").show(); } function hideCreateGoal() { - $("a[name=linkAddNewGoal]").hide(); + $("div[name=linkAddNewGoal]").hide(); } function onMatchAttributeChange(matchAttribute) @@ -128,7 +128,7 @@ function bindGoalForm() { return false; }); - $('a[name=linkAddNewGoal]').click(function () { + $('div[name=linkAddNewGoal]').click(function () { initAndShowAddGoalForm(); piwikHelper.lazyScrollTo('#goal_name'); }); diff --git a/plugins/Goals/stylesheets/goals.css b/plugins/Goals/stylesheets/goals.css index 52602215bb..16f594781a 100644 --- a/plugins/Goals/stylesheets/goals.css +++ b/plugins/Goals/stylesheets/goals.css @@ -9,6 +9,14 @@ width: 614px; } +.managegoals .addrow:hover { + text-decoration: underline; +} + +.managegoals .addrow { + margin-top: 0px; +} + /* dimension selector */ #titleGoalsByDimension { padding-top: 30px; diff --git a/plugins/Goals/templates/_formAddGoal.twig b/plugins/Goals/templates/_formAddGoal.twig index 573d86dc29..5e0366fdb8 100644 --- a/plugins/Goals/templates/_formAddGoal.twig +++ b/plugins/Goals/templates/_formAddGoal.twig @@ -1,11 +1,4 @@ <div class='entityAddContainer' style="display:none;"> - {% if onlyShowAddNewGoal is not defined %} - <div class='entityCancel'> - {{ 'Goals_CancelAndReturnToGoals'|translate("<a class='entityCancelLink'>","</a>")|raw }} - </div> - <div class='clear'></div> - {% endif %} - <form> <table class="dataTable entityTable"> <thead> diff --git a/plugins/Goals/templates/_listGoalEdit.twig b/plugins/Goals/templates/_listGoalEdit.twig index 325bfd4d3e..291dd5d0bd 100644 --- a/plugins/Goals/templates/_listGoalEdit.twig +++ b/plugins/Goals/templates/_listGoalEdit.twig @@ -1,4 +1,4 @@ -<div id='entityEditContainer' style="display:none;"> +<div id='entityEditContainer' class="managegoals" style="display:none;"> <table class="dataTable entityTable"> <thead> <tr> @@ -49,7 +49,7 @@ {% if onlyShowAddNewGoal is not defined %} <br/> - <a onclick='' name='linkAddNewGoal'>› {{ 'Goals_CreateNewGOal'|translate }}</a> + <div name="linkAddNewGoal" class="addrow"><img src='plugins/Morpheus/images/add.png'/> {{ 'Goals_CreateNewGOal'|translate }}</div> <br/> <br/> diff --git a/plugins/Goals/templates/manageGoals.twig b/plugins/Goals/templates/manageGoals.twig index 65dc6a615d..f71cd38300 100644 --- a/plugins/Goals/templates/manageGoals.twig +++ b/plugins/Goals/templates/manageGoals.twig @@ -1,30 +1,26 @@ -{% extends 'dashboard.twig' %} +{% extends 'user.twig' %} {% block content %} - {% include "@CoreHome/_siteSelectHeader.twig" %} - - <div class="centerLargeDiv"> - - <h2 piwik-enriched-headline> - <div class="inlineHelp">{{ 'Goals_LearnMoreAboutGoalTrackingDocumentation'|translate("<a href='?module=Proxy&action=redirect&url=http://piwik.org/docs/tracking-goals-web-analytics/' target='_blank'>","</a>")|raw }} + <h2 piwik-enriched-headline> + <div class="inlineHelp">{{ 'Goals_LearnMoreAboutGoalTrackingDocumentation'|translate("<a href='?module=Proxy&action=redirect&url=http://piwik.org/docs/tracking-goals-web-analytics/' target='_blank'>","</a>")|raw }} + + {% if not ecommerceEnabled %} + <br /><br/> + {% set websiteManageText %} + <a href='{{ linkTo({'module':'SitesManager','action':'index' }) }}'>{{ 'SitesManager_WebsitesManagement'|translate }}</a> + {% endset %} + {% set ecommerceReportText %} + <a href="http://piwik.org/docs/ecommerce-analytics/" rel="noreferrer" target="_blank">{{ 'Goals_EcommerceReports'|translate }}</a> + {% endset %} + {{ 'Goals_Optional'|translate }} {{ 'Goals_Ecommerce'|translate }}: {{ 'Goals_YouCanEnableEcommerceReports'|translate(ecommerceReportText,websiteManageText)|raw }} + {% endif %}</div> + {{ 'Goals_ManageGoals'|translate }} + </h2> - {% if not ecommerceEnabled %} - <br /><br/> - {% set websiteManageText %} - <a href='{{ linkTo({'module':'SitesManager','action':'index' }) }}'>{{ 'SitesManager_WebsitesManagement'|translate }}</a> - {% endset %} - {% set ecommerceReportText %} - <a href="http://piwik.org/docs/ecommerce-analytics/" rel="noreferrer" target="_blank">{{ 'Goals_EcommerceReports'|translate }}</a> - {% endset %} - {{ 'Goals_Optional'|translate }} {{ 'Goals_Ecommerce'|translate }}: {{ 'Goals_YouCanEnableEcommerceReports'|translate(ecommerceReportText,websiteManageText)|raw }} - {% endif %}</div> - {{ 'Goals_ManageGoals'|translate }} - </h2> - - {% include "@Goals/_addEditGoal.twig" %} + {% include "@CoreHome/_siteSelectHeader.twig" %} - </div> + {% include "@Goals/_addEditGoal.twig" %} <style type="text/css"> .entityAddContainer { diff --git a/plugins/MobileMessaging/Controller.php b/plugins/MobileMessaging/Controller.php index e19b7684b1..92661ed87d 100644 --- a/plugins/MobileMessaging/Controller.php +++ b/plugins/MobileMessaging/Controller.php @@ -32,10 +32,33 @@ class Controller extends \Piwik\Plugin\ControllerAdmin */ public function index() { - Piwik::checkUserIsNotAnonymous(); + Piwik::checkUserHasSuperUserAccess(); $view = new View('@MobileMessaging/index'); + $this->setManageVariables($view); + + return $view->render(); + } + /* + * Mobile Messaging Settings tab : + * - set delegated management + * - provide & validate SMS API credential + * - add & activate phone numbers + * - check remaining credits + */ + public function userSettings() + { + Piwik::checkUserIsNotAnonymous(); + + $view = new View('@MobileMessaging/userSettings'); + $this->setManageVariables($view); + + return $view->render(); + } + + private function setManageVariables(View $view) + { $view->isSuperUser = Piwik::hasUserSuperUserAccess(); $mobileMessagingAPI = API::getInstance(); @@ -43,6 +66,8 @@ class Controller extends \Piwik\Plugin\ControllerAdmin $view->credentialSupplied = $mobileMessagingAPI->areSMSAPICredentialProvided(); $view->accountManagedByCurrentUser = $view->isSuperUser || $view->delegatedManagement; $view->strHelpAddPhone = Piwik::translate('MobileMessaging_Settings_PhoneNumbers_HelpAdd', array(Piwik::translate('General_Settings'), Piwik::translate('MobileMessaging_SettingsMenu'))); + $view->creditLeft = 0; + $view->provider = ''; if ($view->credentialSupplied && $view->accountManagedByCurrentUser) { $view->provider = $mobileMessagingAPI->getSMSProvider(); $view->creditLeft = $mobileMessagingAPI->getCreditLeft(); @@ -72,7 +97,5 @@ class Controller extends \Piwik\Plugin\ControllerAdmin $view->phoneNumbers = $mobileMessagingAPI->getPhoneNumbers(); $this->setBasicVariablesView($view); - - return $view->render(); } } diff --git a/plugins/MobileMessaging/Menu.php b/plugins/MobileMessaging/Menu.php index e810e99744..4612c79d21 100644 --- a/plugins/MobileMessaging/Menu.php +++ b/plugins/MobileMessaging/Menu.php @@ -9,11 +9,20 @@ namespace Piwik\Plugins\MobileMessaging; use Piwik\Menu\MenuAdmin; +use Piwik\Menu\MenuUser; +use Piwik\Piwik; class Menu extends \Piwik\Plugin\Menu { public function configureAdminMenu(MenuAdmin $menu) { - $menu->addSettingsItem('MobileMessaging_SettingsMenu', $this->urlForAction('index'), $order = 12); + if (Piwik::hasUserSuperUserAccess()) { + $menu->addSettingsItem('MobileMessaging_SettingsMenu', $this->urlForAction('index'), $order = 12); + } + } + + public function configureUserMenu(MenuUser $menu) + { + $menu->addPersonalItem('MobileMessaging_SettingsMenu', $this->urlForAction('userSettings'), $order = 12); } } diff --git a/plugins/MobileMessaging/lang/en.json b/plugins/MobileMessaging/lang/en.json index 4c46237286..63df29ceef 100644 --- a/plugins/MobileMessaging/lang/en.json +++ b/plugins/MobileMessaging/lang/en.json @@ -14,7 +14,7 @@ "Settings_CredentialProvided": "Your %s SMS API account is correctly configured!", "Settings_DeleteAccountConfirm": "Are you sure you want to delete this SMS account?", "Settings_InvalidActivationCode": "Code entered was not valid, please try again.", - "Settings_LetUsersManageAPICredential": "Allow users to manage their own SMS API credentials", + "Settings_LetUsersManageAPICredential": "Allow users to manage their own SMS provider", "Settings_LetUsersManageAPICredential_No_Help": "All users are able to receive SMS Reports and will use your account's credits.", "Settings_LetUsersManageAPICredential_Yes_Help": "Each user will be able to setup their own SMS API Account and will not use your credit.", "Settings_ManagePhoneNumbers": "Manage Phone Numbers", diff --git a/plugins/MobileMessaging/templates/index.twig b/plugins/MobileMessaging/templates/index.twig index 17b5bbb435..c75c00f583 100644 --- a/plugins/MobileMessaging/templates/index.twig +++ b/plugins/MobileMessaging/templates/index.twig @@ -1,160 +1,11 @@ {% extends 'admin.twig' %} -{% block content %} - {% if accountManagedByCurrentUser %} - <h2 piwik-enriched-headline - feature-name="{{ 'MobileMessaging_SettingsMenu'|translate }}" - >{{ 'MobileMessaging_Settings_SMSAPIAccount'|translate }}</h2> - {% if credentialSupplied %} - {{ 'MobileMessaging_Settings_CredentialProvided'|translate(provider) }} - {{ creditLeft }} - <br/> - {{ 'MobileMessaging_Settings_UpdateOrDeleteAccount'|translate("<a id='displayAccountForm'>","</a>","<a id='deleteAccount'>","</a>")|raw }} - {% else %} - {{ 'MobileMessaging_Settings_PleaseSignUp'|translate }} - {% endif %} - <div id='accountForm' {% if credentialSupplied %}style='display: none;'{% endif %}> - <br/> - {{ 'MobileMessaging_Settings_SMSProvider'|translate }} - <select id='smsProviders'> - {% for smsProvider, description in smsProviders %} - <option value='{{ smsProvider }}'> - {{ smsProvider }} - </option> - {% endfor %} - </select> - - {{ 'MobileMessaging_Settings_APIKey'|translate }} - <input size='25' id='apiKey'/> - - <input type='submit' value='{{ 'General_Save'|translate }}' id='apiAccountSubmit' class='submit'/> - - {% for smsProvider, description in smsProviders %} - <div class='providerDescription' id='{{ smsProvider }}'> - {{ description|raw }} - </div> - {% endfor %} - - </div> - {% endif %} +{% import '@MobileMessaging/macros.twig' as macro %} - {% import 'ajaxMacros.twig' as ajax %} - - <div style="margin-top:10px"> - {{ ajax.errorDiv('ajaxErrorMobileMessagingSettings') }} - </div> - - <h2>{{ 'MobileMessaging_PhoneNumbers'|translate }}</h2> - {% if not credentialSupplied %} - {% if accountManagedByCurrentUser %} - {{ 'MobileMessaging_Settings_CredentialNotProvided'|translate }} - {% else %} - {{ 'MobileMessaging_Settings_CredentialNotProvidedByAdmin'|translate }} - {% endif %} - {% else %} - {{ 'MobileMessaging_Settings_PhoneNumbers_Help'|translate }} - <br/> - <br/> - <table style="width:900px;" class="adminTable"> - <tbody> - <tr> - <td style="width:480px;"> - <strong>{{ 'MobileMessaging_Settings_PhoneNumbers_Add'|translate }}</strong> - <br/><br/> - - <span id="suspiciousPhoneNumber" style="display:none;"> - {{ 'MobileMessaging_Settings_SuspiciousPhoneNumber'|translate('54184032') }} - <br/><br/> - </span> - - + <input id="countryCallingCode" size="4" maxlength="4"/> - <input id="newPhoneNumber"/> - <input type="submit" value='{{ 'General_Add'|translate }}' - id="addPhoneNumberSubmit"/> - <br/> - - <span style=' font-size: 11px;'><span - class="form-description">{{ 'MobileMessaging_Settings_CountryCode'|translate }}</span> - <span class="form-description" - style="margin-left:50px;">{{ 'MobileMessaging_Settings_PhoneNumber'|translate }}</span></span> - <br/><br/> - - {{ 'MobileMessaging_Settings_PhoneNumbers_CountryCode_Help'|translate }} - - <select id="countries"> - {# this is a trick to avoid selecting the first country when no default could be found #} - <option value=""> </option> - {% for countryCode, country in countries %} - <option value='{{ country.countryCallingCode }}' - {% if defaultCountry==countryCode %} selected="selected" {% endif %} - > - {{ country.countryName }} - </option> - {% endfor %} - </select> - - </td> - <td style="width:220px;"> - {% import 'macros.twig' as piwik %} - {{ piwik.inlineHelp(strHelpAddPhone) }} - </td> - </tr> - <tr> - <td colspan="2"> - - {% if phoneNumbers|length > 0 %} - <br/> - <br/> - <strong>{{ 'MobileMessaging_Settings_ManagePhoneNumbers'|translate }}</strong> - <br/> - <br/> - {% endif %} - - {{ ajax.errorDiv('invalidVerificationCodeAjaxError') }} - - <div id='phoneNumberActivated' style="display:none;"> - {{ 'MobileMessaging_Settings_PhoneActivated'|translate }} - </div> - - <div id='invalidActivationCode' style="display:none;"> - {{ 'MobileMessaging_Settings_InvalidActivationCode'|translate }} - </div> - - <ul> - {% for phoneNumber, validated in phoneNumbers %} - <li> - <span class='phoneNumber'>{{ phoneNumber }}</span> - {% if not validated %} - <input class='verificationCode'/> - <input - type='submit' - value='{{ 'MobileMessaging_Settings_ValidatePhoneNumber'|translate }}' - class='validatePhoneNumberSubmit' - /> - {% endif %} - <input - type='submit' - value='{{ 'General_Remove'|translate }}' - class='removePhoneNumberSubmit' - /> - {% if not validated %} - <br/> - <span class='form-description'>{{ 'MobileMessaging_Settings_VerificationCodeJustSent'|translate }}</span> - {% endif %} - <br/> - <br/> - </li> - {% endfor %} - </ul> - - </td> - </tr> - </tbody> - </table> - {% endif %} +{% block content %} {% if isSuperUser %} - <h2>{{ 'MobileMessaging_Settings_SuperAdmin'|translate }}</h2> + <h2>{{ 'General_Settings'|translate }}</h2> <table class='adminTable' style='width:650px;'> <tr> <td style="width:400px;">{{ 'MobileMessaging_Settings_LetUsersManageAPICredential'|translate }}</td> @@ -183,6 +34,29 @@ </table> {% endif %} + {% if accountManagedByCurrentUser and delegatedManagement %} + + <h2 piwik-enriched-headline + >{{ 'MobileMessaging_Settings_SMSProvider'|translate }}</h2> + To manage your SMS provider go to your <a href="{{ linkTo({'action':'userSettings'}) }}">personal mobile messaging settings</a>. + + {% elseif accountManagedByCurrentUser %} + + <h2 piwik-enriched-headline + >{{ 'MobileMessaging_Settings_SMSProvider'|translate }}</h2> + + {{ macro.manageSmsApi(credentialSupplied, creditLeft, smsProviders, provider) }} + {% endif %} + + {% import 'ajaxMacros.twig' as ajax %} + + <div style="margin-top:10px"> + {{ ajax.errorDiv('ajaxErrorMobileMessagingSettings') }} + </div> + + <h2>{{ 'MobileMessaging_PhoneNumbers'|translate }}</h2> + To manage your phone numbers go to your <a href="{{ linkTo({'action':'userSettings'}) }}">personal mobile messaging settings</a>. + {{ ajax.loadingDiv('ajaxLoadingMobileMessagingSettings') }} <div class='ui-confirm' id='confirmDeleteAccount'> diff --git a/plugins/MobileMessaging/templates/macros.twig b/plugins/MobileMessaging/templates/macros.twig new file mode 100644 index 0000000000..e0c1d499c6 --- /dev/null +++ b/plugins/MobileMessaging/templates/macros.twig @@ -0,0 +1,33 @@ +{% macro manageSmsApi(credentialSupplied, creditLeft, smsProviders, provider) %} + {% if credentialSupplied %} + {{ 'MobileMessaging_Settings_CredentialProvided'|translate(provider) }} + {{ creditLeft }} + <br/> + {{ 'MobileMessaging_Settings_UpdateOrDeleteAccount'|translate("<a id='displayAccountForm'>","</a>","<a id='deleteAccount'>","</a>")|raw }} + {% else %} + {{ 'MobileMessaging_Settings_PleaseSignUp'|translate }} + {% endif %} + <div id='accountForm' {% if credentialSupplied %}style='display: none;'{% endif %}> + <br/> + {{ 'MobileMessaging_Settings_SMSProvider'|translate }} + <select id='smsProviders'> + {% for smsProvider, description in smsProviders %} + <option value='{{ smsProvider }}'> + {{ smsProvider }} + </option> + {% endfor %} + </select> + + {{ 'MobileMessaging_Settings_APIKey'|translate }} + <input size='25' id='apiKey'/> + + <input type='submit' value='{{ 'General_Save'|translate }}' id='apiAccountSubmit' class='submit'/> + + {% for smsProvider, description in smsProviders %} + <div class='providerDescription' id='{{ smsProvider }}'> + {{ description|raw }} + </div> + {% endfor %} + + </div> +{% endmacro %}
\ No newline at end of file diff --git a/plugins/MobileMessaging/templates/userSettings.twig b/plugins/MobileMessaging/templates/userSettings.twig new file mode 100644 index 0000000000..987683e739 --- /dev/null +++ b/plugins/MobileMessaging/templates/userSettings.twig @@ -0,0 +1,139 @@ +{% extends 'user.twig' %} + +{% block content %} + + {% import 'ajaxMacros.twig' as ajax %} + + <div style="margin-top:10px"> + {{ ajax.errorDiv('ajaxErrorMobileMessagingSettings') }} + </div> + + {% import '@MobileMessaging/macros.twig' as macro %} + + {% if accountManagedByCurrentUser and delegatedManagement %} + <h2 piwik-enriched-headline + >{{ 'MobileMessaging_Settings_SMSProvider'|translate }}</h2> + + {{ macro.manageSmsApi(credentialSupplied, creditLeft, smsProviders, provider) }} + {% endif %} + + <h2>{{ 'MobileMessaging_PhoneNumbers'|translate }}</h2> + {% if not credentialSupplied %} + {% if accountManagedByCurrentUser and delegatedManagement %} + {{ 'MobileMessaging_Settings_CredentialNotProvided'|translate }} + {% elseif accountManagedByCurrentUser %} + Before you can create and manage phone numbers, please setup an SMS provider in <a href="{{ linkTo({'action': 'index'}) }}">admin mobile messaging settings</a>. + {% else %} + {{ 'MobileMessaging_Settings_CredentialNotProvidedByAdmin'|translate }} + {% endif %} + {% else %} + {{ 'MobileMessaging_Settings_PhoneNumbers_Help'|translate }} + <br/> + <br/> + <table style="width:900px;" class="adminTable"> + <tbody> + <tr> + <td style="width:480px;"> + <strong>{{ 'MobileMessaging_Settings_PhoneNumbers_Add'|translate }}</strong> + <br/><br/> + + <span id="suspiciousPhoneNumber" style="display:none;"> + {{ 'MobileMessaging_Settings_SuspiciousPhoneNumber'|translate('54184032') }} + <br/><br/> + </span> + + + <input id="countryCallingCode" size="4" maxlength="4"/> + <input id="newPhoneNumber"/> + <input type="submit" value='{{ 'General_Add'|translate }}' + id="addPhoneNumberSubmit"/> + <br/> + + <span style=' font-size: 11px;'><span + class="form-description">{{ 'MobileMessaging_Settings_CountryCode'|translate }}</span> + <span class="form-description" + style="margin-left:50px;">{{ 'MobileMessaging_Settings_PhoneNumber'|translate }}</span></span> + <br/><br/> + + {{ 'MobileMessaging_Settings_PhoneNumbers_CountryCode_Help'|translate }} + + <select id="countries"> + {# this is a trick to avoid selecting the first country when no default could be found #} + <option value=""> </option> + {% for countryCode, country in countries %} + <option value='{{ country.countryCallingCode }}' + {% if defaultCountry==countryCode %} selected="selected" {% endif %} + > + {{ country.countryName }} + </option> + {% endfor %} + </select> + + </td> + <td style="width:220px;"> + {% import 'macros.twig' as piwik %} + {{ piwik.inlineHelp(strHelpAddPhone) }} + </td> + </tr> + <tr> + <td colspan="2"> + + {% if phoneNumbers|length > 0 %} + <br/> + <br/> + <strong>{{ 'MobileMessaging_Settings_ManagePhoneNumbers'|translate }}</strong> + <br/> + <br/> + {% endif %} + + {{ ajax.errorDiv('invalidVerificationCodeAjaxError') }} + + <div id='phoneNumberActivated' style="display:none;"> + {{ 'MobileMessaging_Settings_PhoneActivated'|translate }} + </div> + + <div id='invalidActivationCode' style="display:none;"> + {{ 'MobileMessaging_Settings_InvalidActivationCode'|translate }} + </div> + + <ul> + {% for phoneNumber, validated in phoneNumbers %} + <li> + <span class='phoneNumber'>{{ phoneNumber }}</span> + {% if not validated %} + <input class='verificationCode'/> + <input + type='submit' + value='{{ 'MobileMessaging_Settings_ValidatePhoneNumber'|translate }}' + class='validatePhoneNumberSubmit' + /> + {% endif %} + <input + type='submit' + value='{{ 'General_Remove'|translate }}' + class='removePhoneNumberSubmit' + /> + {% if not validated %} + <br/> + <span class='form-description'>{{ 'MobileMessaging_Settings_VerificationCodeJustSent'|translate }}</span> + {% endif %} + <br/> + <br/> + </li> + {% endfor %} + </ul> + + </td> + </tr> + </tbody> + </table> + {% endif %} + + {{ ajax.loadingDiv('ajaxLoadingMobileMessagingSettings') }} + + <div class='ui-confirm' id='confirmDeleteAccount'> + <h2>{{ 'MobileMessaging_Settings_DeleteAccountConfirm'|translate }}</h2> + <input role='yes' type='button' value='{{ 'General_Yes'|translate }}'/> + <input role='no' type='button' value='{{ 'General_No'|translate }}'/> + </div> + +{% endblock %} diff --git a/plugins/Morpheus/stylesheets/general/_admin.less b/plugins/Morpheus/stylesheets/general/_admin.less index 0a3b21cd88..ff4ab174b6 100644 --- a/plugins/Morpheus/stylesheets/general/_admin.less +++ b/plugins/Morpheus/stylesheets/general/_admin.less @@ -5,6 +5,9 @@ background-image: none; padding-left: 0; border-top: 0; + > li:first-child span { + border-bottom: 3px solid @theme-color-brand; + } > li { padding-bottom: 0px; > span { @@ -15,10 +18,12 @@ padding: 12px 15px; } ul { + background-color: @theme-color-menu-contrast-background; + li { a { color: @theme-color-text-lighter !important; - padding: 0.6em 1.1em; + padding: 0.8em 1.1em; &:hover { color: @theme-color-text; text-decoration: none; diff --git a/plugins/Morpheus/stylesheets/general/_form.less b/plugins/Morpheus/stylesheets/general/_form.less index 81238a747f..f4b2acbdae 100644 --- a/plugins/Morpheus/stylesheets/general/_form.less +++ b/plugins/Morpheus/stylesheets/general/_form.less @@ -9,12 +9,14 @@ /* on admin screen, Save button aligned on the left */ .admin .submit { - margin-left: 50px; + margin-left: 0px; + margin-top: 20px; float: none; } .admin .entityContainer .submit { margin: 0; + margin-top: 20px; } .entityContainer .link_but { @@ -88,8 +90,6 @@ table.entityTable tr td a { /* cancel button below Forms */ .entityCancel { - float: right; - clear: both; padding: 10px 0; font-size: 12px; } diff --git a/plugins/Morpheus/templates/admin.twig b/plugins/Morpheus/templates/admin.twig index cf93077218..6d37a6c290 100644 --- a/plugins/Morpheus/templates/admin.twig +++ b/plugins/Morpheus/templates/admin.twig @@ -23,7 +23,10 @@ <![endif]--> <!--[if (gte IE 9)|!(IE)]><!--> <body ng-app="app" class="{{ postEvent('Template.bodyClass', 'admin') }}"><!--<![endif]--> - {% set isAdminLayout = true %} + + {% set topMenuModule = 'CoreAdminHome' %} + {% set topMenuAction = 'generalSettings' %} + {% include "_iframeBuster.twig" %} {% include "@CoreHome/_javaScriptDisabled.twig" %} diff --git a/plugins/Morpheus/templates/user.twig b/plugins/Morpheus/templates/user.twig new file mode 100644 index 0000000000..35524397aa --- /dev/null +++ b/plugins/Morpheus/templates/user.twig @@ -0,0 +1,62 @@ +<!DOCTYPE html> +<html id="ng-app" ng-app="piwikApp"> + <head> +{% block head %} + <meta charset="utf-8"> + <meta http-equiv="x-ua-compatible" content="IE=EDGE,chrome=1" > + <title>{% if not isCustomLogo %}Piwik › {% endif %}{{ 'CoreAdminHome_Administration'|translate }}</title> + <meta name="generator" content="Piwik - free/libre analytics platform"/> + <link rel="shortcut icon" href="{{ customFavicon|default('plugins/CoreHome/images/favicon.ico') }}"/> + +{% include "@CoreHome/_favicon.twig" %} +{% include "_jsGlobalVariables.twig" %} +{% include "_piwikTag.twig" %} +{% include "_jsCssIncludes.twig" %} + + <!--[if IE]> + <link rel="stylesheet" type="text/css" href="plugins/Morpheus/stylesheets/ieonly.css"/> + <![endif]--> + {% endblock %} + </head> + <!--[if lt IE 9 ]> + <body ng-app="app" class="old-ie {{ postEvent('Template.bodyClass', 'admin') }}"> + <![endif]--> + <!--[if (gte IE 9)|!(IE)]><!--> + <body ng-app="app" class="{{ postEvent('Template.bodyClass', 'admin') }}"><!--<![endif]--> + + {% set topMenuModule = 'UsersManager' %} + {% set topMenuAction = 'userSettings' %} + + {% include "_iframeBuster.twig" %} + {% include "@CoreHome/_javaScriptDisabled.twig" %} + + <div id="root"> + {% include "@CoreHome/_topScreen.twig" %} + + {% import 'ajaxMacros.twig' as ajax %} + {{ ajax.requestErrorDiv(emailSuperUser|default('')) }} + {{ postEvent("Template.beforeContent", "user", currentModule) }} + + <div id="container"> + + {% if showMenu is not defined or showMenu %} + {% include "@CoreHome/_userMenu.twig" %} + {% endif %} + + <div id="content" class="admin user"> + + {% include "@CoreHome/_notifications.twig" %} + + <div class="ui-confirm" id="alert"> + <h2></h2> + <input role="no" type="button" value="{{ 'General_Ok'|translate }}"/> + </div> + + {% block content %} + {% endblock %} + + </div> + </div> + </div> + </body> +</html> diff --git a/plugins/Provider/Menu.php b/plugins/Provider/Menu.php deleted file mode 100644 index 2d34f5b229..0000000000 --- a/plugins/Provider/Menu.php +++ /dev/null @@ -1,20 +0,0 @@ -<?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\Provider; - -use Piwik\Menu\MenuReporting; - -class Menu extends \Piwik\Plugin\Menu -{ - public function configureReportingMenu(MenuReporting $menu) - { - $menu->rename('General_Visitors', 'UserCountry_SubmenuLocations', - 'General_Visitors', 'Provider_SubmenuLocationsProvider'); - } -} diff --git a/plugins/Provider/lang/en.json b/plugins/Provider/lang/en.json index f634e2eda7..4252d9bc15 100644 --- a/plugins/Provider/lang/en.json +++ b/plugins/Provider/lang/en.json @@ -3,7 +3,6 @@ "ColumnProvider": "Provider", "PluginDescription": "Reports the Provider of the visitors.", "ProviderReportDocumentation": "This report shows which Internet Service Providers your visitors used to access the website. You can click on a provider name for more details. %s If Piwik can't determine a visitor's provider, it is listed as IP.", - "SubmenuLocationsProvider": "Locations & Provider", "WidgetProviders": "Providers", "ProviderReportFooter": "Unknown provider means the IP address could not be looked up." } diff --git a/plugins/ScheduledReports/Menu.php b/plugins/ScheduledReports/Menu.php index 6c0111ff23..ea02b98b60 100644 --- a/plugins/ScheduledReports/Menu.php +++ b/plugins/ScheduledReports/Menu.php @@ -24,11 +24,10 @@ class Menu extends \Piwik\Plugin\Menu \Piwik\Plugin\Manager::getInstance()->isPluginActivated('MobileMessaging') ? 'MobileMessaging_TopLinkTooltip' : 'ScheduledReports_TopLinkTooltip'); - $menu->addManageItem(null, $this->urlForDefaultAction(array('segment' => false)), 10); - $menu->addManageItem( + $menu->addPersonalItem( $this->getTopMenuTranslationKey(), $this->urlForAction('index', array('segment' => false)), - 13, + 7, $tooltip ); } diff --git a/plugins/ScheduledReports/javascripts/pdf.js b/plugins/ScheduledReports/javascripts/pdf.js index da23deb4fd..c34de6f9ca 100644 --- a/plugins/ScheduledReports/javascripts/pdf.js +++ b/plugins/ScheduledReports/javascripts/pdf.js @@ -66,7 +66,7 @@ function formSetEditReport(idReport) { function getReportAjaxRequest(idReport, defaultApiMethod) { var parameters = {}; - piwikHelper.lazyScrollTo(".centerLargeDiv>h2", 400); + piwikHelper.lazyScrollTo(".emailReports>h2", 400); parameters.module = 'API'; parameters.method = defaultApiMethod; if (idReport == 0) { diff --git a/plugins/ScheduledReports/lang/en.json b/plugins/ScheduledReports/lang/en.json index 7b5b14d495..fdb394699c 100644 --- a/plugins/ScheduledReports/lang/en.json +++ b/plugins/ScheduledReports/lang/en.json @@ -17,7 +17,7 @@ "EmailSchedule": "Email Schedule", "EvolutionGraph": "Show Historical Graphs for the top %s values", "FrontPage": "Front Page", - "ManageEmailReports": "Manage Email Reports", + "PersonalEmailReports": "Personal Email Reports", "MonthlyScheduleHelp": "Monthly schedule: report will be sent the first day of each month.", "MustBeLoggedIn": "You must be logged in to create and schedule custom reports.", "NoRecipients": "This report has no recipients", diff --git a/plugins/ScheduledReports/templates/_addReport.twig b/plugins/ScheduledReports/templates/_addReport.twig index 3fbc21b98b..84aa7f2f87 100644 --- a/plugins/ScheduledReports/templates/_addReport.twig +++ b/plugins/ScheduledReports/templates/_addReport.twig @@ -1,7 +1,4 @@ <div class="entityAddContainer" style="display:none;"> - <div class='entityCancel'> - {{ 'ScheduledReports_CancelAndReturnToReports'|translate("<a class='entityCancelLink'>","</a>")|raw }} - </div> <div class='clear'></div> <form id='addEditReport'> <table class="dataTable entityTable"> @@ -171,6 +168,7 @@ </tbody> </table> + <br /> <input type="hidden" id="report_idreport" value=""> <input type="submit" id="report_submit" name="submit" class="submit"/> diff --git a/plugins/ScheduledReports/templates/_listReports.twig b/plugins/ScheduledReports/templates/_listReports.twig index b9359f21a0..f59c1cf526 100644 --- a/plugins/ScheduledReports/templates/_listReports.twig +++ b/plugins/ScheduledReports/templates/_listReports.twig @@ -12,7 +12,7 @@ </tr> </thead> - {% if userLogin == 'anonymous' %} + {% if userLogin == 'anonymous' %} <tr> <td colspan='7'> <br/> @@ -21,18 +21,14 @@ <br/><br/> </td> </tr> - </table> {% elseif reports is empty %} - <tr> - <td colspan='7'> - <br/> - {{ 'ScheduledReports_ThereIsNoReportToManage'|translate(siteName)|raw }}. - <br/><br/> - <a onclick='' id='linkAddReport'>› {{ 'ScheduledReports_CreateAndScheduleReport'|translate }}</a> - <br/><br/> - </td> - </tr> - </table> + <tr> + <td colspan='7'> + <br/> + {{ 'ScheduledReports_ThereIsNoReportToManage'|translate(siteName)|raw }}. + <br/><br/> + </td> + </tr> {% else %} {% for report in reports %} <tr> @@ -96,12 +92,14 @@ </td> </tr> {% endfor %} + {% endif %} + </table> {% if userLogin != 'anonymous' %} <br/> - <a onclick='' id='linkAddReport'>› {{ 'ScheduledReports_CreateAndScheduleReport'|translate }}</a> + <div id='linkAddReport' class="addrow"><img src='plugins/Morpheus/images/add.png'/> {{ 'ScheduledReports_CreateAndScheduleReport'|translate }}</div> <br/> <br/> {% endif %} - {% endif %} + </div> diff --git a/plugins/ScheduledReports/templates/index.twig b/plugins/ScheduledReports/templates/index.twig index b8ccecf53a..89065c5d90 100644 --- a/plugins/ScheduledReports/templates/index.twig +++ b/plugins/ScheduledReports/templates/index.twig @@ -1,16 +1,17 @@ -{% extends 'dashboard.twig' %} +{% extends 'user.twig' %} {% block content %} -{% include "@CoreHome/_siteSelectHeader.twig" %} +<div class="emailReports"> + <h2 piwik-enriched-headline + help-url="http://piwik.org/docs/email-reports/">{{ 'ScheduledReports_PersonalEmailReports'|translate }}</h2> -<div class="top_controls"> - {% include "@CoreHome/_periodSelect.twig" %} -</div> + {% include "@CoreHome/_siteSelectHeader.twig" %} + + <div class="top_controls"> + {% include "@CoreHome/_periodSelect.twig" %} + </div> -<div class="centerLargeDiv"> - <h2 piwik-enriched-headline - help-url="http://piwik.org/docs/email-reports/">{{ 'ScheduledReports_ManageEmailReports'|translate }}</h2> <span id="reportSentSuccess"></span> <span id="reportUpdatedSuccess"></span> @@ -53,10 +54,17 @@ position:relative; } - .entityAddContainer > .entityCancel:first-child { - position: absolute; - right:0; - bottom:100%; + #linkAddReport { + margin-top: 0px; } + + #linkAddReport:hover { + text-decoration: underline; + } + + .emailReports .top_controls { + padding-bottom: 18px; + } + </style> {% endblock %} diff --git a/plugins/UsersManager/Menu.php b/plugins/UsersManager/Menu.php index 67d9811aad..9f3175a3ef 100644 --- a/plugins/UsersManager/Menu.php +++ b/plugins/UsersManager/Menu.php @@ -18,7 +18,6 @@ class Menu extends \Piwik\Plugin\Menu { if (Piwik::isUserHasSomeAdminAccess()) { $menu->addManageItem('UsersManager_MenuUsers', $this->urlForAction('index'), $order = 2); - $menu->addSettingsItem('UsersManager_MenuPersonal', $this->urlForAction('userSettings'), $order = 1); } if (Piwik::hasUserSuperUserAccess() && API::getInstance()->getSitesAccessFromUser('anonymous')) { @@ -29,7 +28,7 @@ class Menu extends \Piwik\Plugin\Menu public function configureUserMenu(MenuUser $menu) { if (!Piwik::isUserIsAnonymous()) { - $menu->addItem('', 'General_Settings', $this->urlForAction('userSettings'), 0); + $menu->addItem('UsersManager_MenuPersonal', 'General_Settings', $this->urlForAction('userSettings'), 0); } } } diff --git a/plugins/UsersManager/javascripts/usersManager.js b/plugins/UsersManager/javascripts/usersManager.js index 51be3f8063..b9475c29fc 100644 --- a/plugins/UsersManager/javascripts/usersManager.js +++ b/plugins/UsersManager/javascripts/usersManager.js @@ -263,7 +263,7 @@ $(document).ready(function () { } ); - $('.addrow').click(function () { + $('.user .addrow').click(function () { piwikHelper.hideAjaxError(); $(this).toggle(); diff --git a/plugins/UsersManager/templates/index.twig b/plugins/UsersManager/templates/index.twig index f102bce7e1..2a29c9f851 100644 --- a/plugins/UsersManager/templates/index.twig +++ b/plugins/UsersManager/templates/index.twig @@ -110,7 +110,7 @@ {% import 'ajaxMacros.twig' as ajax %} {{ ajax.errorDiv('ajaxErrorUsersManagement') }} {{ ajax.loadingDiv('ajaxLoadingUsersManagement') }} - <div class="entityContainer" style="margin-bottom:50px;"> + <div class="user entityContainer" style="margin-bottom:50px;"> <table class="entityTable dataTable" id="users"> <thead> <tr> diff --git a/plugins/UsersManager/templates/userSettings.twig b/plugins/UsersManager/templates/userSettings.twig index cc60903080..769a682a43 100644 --- a/plugins/UsersManager/templates/userSettings.twig +++ b/plugins/UsersManager/templates/userSettings.twig @@ -1,9 +1,8 @@ -{% extends 'admin.twig' %} +{% extends 'user.twig' %} {% block content %} <h2 piwik-enriched-headline>{{ 'UsersManager_PersonalSettings'|translate }}</h2> -<br/> <div class="ui-confirm" id="confirmPasswordChange"> <h2>{{ 'UsersManager_ChangePasswordConfirm'|translate }}</h2> <input role="yes" type="button" value="{{ 'General_Yes'|translate }}"/> diff --git a/plugins/Widgetize/stylesheets/widgetize.less b/plugins/Widgetize/stylesheets/widgetize.less index 47b49ba39a..dafad78d90 100644 --- a/plugins/Widgetize/stylesheets/widgetize.less +++ b/plugins/Widgetize/stylesheets/widgetize.less @@ -1,7 +1,10 @@ .widgetize { width: 100%; - padding: 15px 15px 0 15px; font-size: 13px; + + .top_controls { + padding-bottom: 16px; + } } .widgetize p { diff --git a/plugins/Widgetize/templates/index.twig b/plugins/Widgetize/templates/index.twig index 4763473a62..15df75bc2a 100644 --- a/plugins/Widgetize/templates/index.twig +++ b/plugins/Widgetize/templates/index.twig @@ -1,12 +1,8 @@ -{% extends 'dashboard.twig' %} +{% extends 'user.twig' %} {% block content %} -<div class="pageWrap"> - <div class="top_controls"> - {% include "@CoreHome/_siteSelectHeader.twig" %} - {% include "@CoreHome/_periodSelect.twig" %} - </div> +<div> <script type="text/javascript"> $(function () { @@ -30,18 +26,24 @@ }); </script> +<h2 piwik-enriched-headline>{{ 'General_Widgets'|translate }}</h2> + +{% include "@CoreHome/_siteSelectHeader.twig" %} + <div class="widgetize"> <p>With Piwik, you can export your Web Analytics reports on your blog, website, or intranet dashboard... in one click. + <h2>Authentication</h2> <p> - <strong>› Widget authentication:</strong> If you want your widgets to be viewable by everybody, you first have to set the 'view' permissions + If you want your widgets to be viewable by everybody, you first have to set the 'view' permissions to the anonymous user in the <a href='index.php?module=UsersManager' rel='noreferrer' target='_blank'>Users Management section</a>. <br/>Alternatively, if you are publishing widgets on a password protected or private page, you don't necessarily have to allow 'anonymous' to view your reports. In this case, you can add the secret token_auth parameter (found in the <a href='{{ linkTo({'module':'API','action':'listAllAPI'}) }}' rel='noreferrer' target='_blank'>API page</a>) in the widget URL. </p> - <p><strong>› Widgetize the full dashboard:</strong> You can also display the full Piwik dashboard in your application or website in an IFRAME + <h2>Widgetize the all websites dashboard</h2> + <p>You can also display the full Piwik dashboard in your application or website in an IFRAME (<a href='' rel='noreferrer' target='_blank' id='linkDashboardUrl'>see example</a>). The date parameter can be set to a specific calendar date, "today", or "yesterday". The period parameter can be set to "day", "week", "month", or "year". @@ -54,8 +56,13 @@ <span id='exportAllWebsitesDashboard'></span> </p> + <h2>Widgetize a report</h2> <p><strong>› Select a report, and copy paste in your page the embed code below the widget:</strong> + <div class="top_controls"> + {% include "@CoreHome/_periodSelect.twig" %} + </div> + <div id="widgetPreview"></div> <div id='iframeDivToExport' style='display:none;'></div> |