Skip to content

Commit

Permalink
Merge pull request #8936 from piwik/left_menu_2
Browse files Browse the repository at this point in the history
Left menu
  • Loading branch information
Matthieu Aubry committed Oct 7, 2015
2 parents 4f452da + 6f465eb commit 12e3708
Show file tree
Hide file tree
Showing 182 changed files with 2,184 additions and 2,804 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -26,10 +26,10 @@ This is a changelog for Piwik platform developers. All changes for our HTTP API'
### Internal change
* In `piwik.js` we replaced [JSON2](https://github.com/douglascrockford/JSON-js) with [JSON3](https://bestiejs.github.io/json3/) to implement CSP (Content Security Policy) as JSON3 does not use `eval()`. JSON3 will be used if a browser does not provide a native JSON API. We are using `JSON3` in a way that it will not conflict if your website is using `JSON3` as well.


### New APIs
* The JavaScript Tracker `piwik.js` got a new method `logAllContentBlocksOnPage` to log all found content blocks within a page to the console. This is useful to debug / test content tracking. It can be triggered via `_paq.push(['logAllContentBlocksOnPage'])`
* The Class `Piwik\Plugins\Login\Controller` is now considered a public API.
* The new method `Piwik\Menu\MenuAbstract::registerMenuIcon()` can be used to define an icon for a menu category to replace the default arrow icon.

### Internal Change
* The option `branch` of the console command `development:sync-system-test-processed` was removed as it is no longer needed.
Expand Down
2 changes: 0 additions & 2 deletions config/global.ini.php
Expand Up @@ -780,8 +780,6 @@
Plugins[] = Overlay
Plugins[] = SegmentEditor
Plugins[] = Insights
Plugins[] = ZenMode
Plugins[] = LeftMenu
Plugins[] = Morpheus
Plugins[] = Contents
Plugins[] = TestRunner
Expand Down
17 changes: 17 additions & 0 deletions core/Menu/MenuAbstract.php
Expand Up @@ -30,6 +30,7 @@ abstract class MenuAbstract extends Singleton
protected $edits = array();
protected $renames = array();
protected $orderingApplied = false;
protected $menuIcons = array();
protected static $menus = array();

/**
Expand All @@ -48,6 +49,17 @@ public function getMenu()
return $this->menu;
}

/**
* Let's you register a menu icon for a certain menu category to replace the default arrow icon.
*
* @param string $menuName The translation key of a main menu category, eg 'Dashboard_Dashboard'
* @param string $iconCssClass The css class name of an icon, eg 'icon-user'
*/
public function registerMenuIcon($menuName, $iconCssClass)
{
$this->menuIcons[$menuName] = $iconCssClass;
}

/**
* Returns a list of available plugin menu instances.
*
Expand Down Expand Up @@ -164,6 +176,11 @@ private function buildMenuItem($menuName, $subMenuName, $url, $order = 50, $tool
$this->menu[$menuName]['_order'] = $order;
$this->menu[$menuName]['_name'] = $menuName;
$this->menu[$menuName]['_tooltip'] = $tooltip;
if (!empty($this->menuIcons[$menuName])) {
$this->menu[$menuName]['_icon'] = $this->menuIcons[$menuName];
} else {
$this->menu[$menuName]['_icon'] = '';
}
}
if (!empty($subMenuName)) {
$this->menu[$menuName][$subMenuName]['_url'] = $url;
Expand Down
1 change: 1 addition & 0 deletions core/Period.php
Expand Up @@ -104,6 +104,7 @@ public static function checkDateFormat($dateString)
if (self::isMultiplePeriod($dateString, 'day')) {
return;
}

Date::factory($dateString);
}

Expand Down
1 change: 0 additions & 1 deletion core/Plugin/Controller.php
Expand Up @@ -15,7 +15,6 @@
use Piwik\Common;
use Piwik\Config as PiwikConfig;
use Piwik\Config;
use Piwik\Container\StaticContainer;
use Piwik\DataTable\Filter\CalculateEvolutionFilter;
use Piwik\Date;
use Piwik\Exception\NoPrivilegesException;
Expand Down
45 changes: 45 additions & 0 deletions core/Updates/2.15.0-b16.php
@@ -0,0 +1,45 @@
<?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\Updates;

use Piwik\Plugin\Manager;
use Piwik\Updater;
use Piwik\Updates;

class Updates_2_15_0_b16 extends Updates
{

public function doUpdate(Updater $updater)
{
$this->uninstallPlugin('LeftMenu');
$this->uninstallPlugin('ZenMode');
}

private function uninstallPlugin($plugin)
{
$pluginManager = Manager::getInstance();

if ($pluginManager->isPluginInstalled($plugin)) {
if ($pluginManager->isPluginActivated($plugin)) {
$pluginManager->deactivatePlugin($plugin);
}

$pluginManager->unloadPlugin($plugin);
$pluginManager->uninstallPlugin($plugin);
} else {
$this->makeSurePluginIsRemovedFromFilesystem($plugin);
}
}

private function makeSurePluginIsRemovedFromFilesystem($plugin)
{
Manager::deletePluginFromFilesystem($plugin);
}
}
2 changes: 1 addition & 1 deletion core/Version.php
Expand Up @@ -20,7 +20,7 @@ final class Version
* The current Piwik version.
* @var string
*/
const VERSION = '2.15.0-b15';
const VERSION = '2.15.0-b16';

public function isStableVersion($version)
{
Expand Down
2 changes: 1 addition & 1 deletion lang/en.json
Expand Up @@ -402,7 +402,7 @@
"YearsDays": "%1$s years %2$s days",
"Yes": "Yes",
"YouAreCurrentlyUsing": "You are currently using Piwik %s.",
"YouAreViewingDemoShortMessage": "You are currently viewing the demo of Piwik",
"YouAreViewingDemoShortMessage": "You are viewing the demo of Piwik",
"YouMustBeLoggedIn": "You must be logged in to access this functionality.",
"YourChangesHaveBeenSaved": "Your changes have been saved."
},
Expand Down
11 changes: 5 additions & 6 deletions plugins/API/templates/listAllAPI.twig
Expand Up @@ -2,18 +2,17 @@

{% set title %}{{ 'API_ReportingApiReference'|translate }}{% endset %}

{% block topcontrols %}
{% include "@CoreHome/_siteSelectHeader.twig" %}
{% include "@CoreHome/_periodSelect.twig" %}
{% endblock %}

{% block content %}

<div class="api-list">

<h2>{{ title }}</h2>

{% include "@CoreHome/_siteSelectHeader.twig" %}

<div class="top_controls">
{% include "@CoreHome/_periodSelect.twig" %}
</div>

<p>{{ 'API_PluginDescription'|translate }}</p>

<p>
Expand Down
1 change: 0 additions & 1 deletion plugins/CoreAdminHome/CoreAdminHome.php
Expand Up @@ -38,7 +38,6 @@ public function cleanupUser($userLogin)
public function getStylesheetFiles(&$stylesheets)
{
$stylesheets[] = "libs/jquery/themes/base/jquery-ui.min.css";
$stylesheets[] = "plugins/CoreAdminHome/stylesheets/menu.less";
$stylesheets[] = "plugins/Morpheus/stylesheets/base.less";
$stylesheets[] = "plugins/Morpheus/stylesheets/main.less";
$stylesheets[] = "plugins/CoreAdminHome/stylesheets/generalSettings.less";
Expand Down
11 changes: 6 additions & 5 deletions plugins/CoreAdminHome/Menu.php
Expand Up @@ -23,10 +23,10 @@ public function configureAdminMenu(MenuAdmin $menu)
$hasAdminAccess = Piwik::isUserHasSomeAdminAccess();

if ($hasAdminAccess) {
$menu->addManageItem(null, "", $order = 1);
$menu->addSettingsItem(null, "", $order = 5);
$menu->addDiagnosticItem(null, "", $order = 10);
$menu->addDevelopmentItem(null, "", $order = 15);
$menu->addManageItem(null, array(), $order = 1);
$menu->addSettingsItem(null, array(), $order = 5);
$menu->addDiagnosticItem(null, array(), $order = 10);
$menu->addDevelopmentItem(null, array(), $order = 15);

if (Piwik::hasUserSuperUserAccess()) {
$menu->addSettingsItem('General_General',
Expand All @@ -51,7 +51,8 @@ public function configureTopMenu(MenuTop $menu)
$url = $this->urlForAction('generalSettings');
}

$menu->addItem('CoreAdminHome_Administration', null, $url, 10);
$menu->registerMenuIcon('CoreAdminHome_Administration', 'icon-configure');
$menu->addItem('CoreAdminHome_Administration', null, $url, 980, Piwik::translate('CoreAdminHome_Administration'));
}
}

Expand Down
16 changes: 4 additions & 12 deletions plugins/CoreAdminHome/stylesheets/generalSettings.less
Expand Up @@ -13,9 +13,6 @@
}

#content.admin {
margin: 0 0 0 260px;
padding: 0 0 40px;
display: table;
font-size: 13px;

// Fix the <pre> blocks because of the display: table
Expand All @@ -25,8 +22,8 @@
}

.admin #header_message {
margin-top: 10px;
margin-right: 10px;
margin-top: 8px;
margin-right: 8px;
}

table.admin {
Expand Down Expand Up @@ -92,9 +89,9 @@ table.admin tbody td:hover, table.admin tbody th:hover {
width: 100%;

&:first-of-type:not(.secondary) {
margin-top: 17px;
margin-top: 7px;
margin-bottom: 16px;
border-bottom: 1px solid #DADADA;
border-bottom: 1px solid @theme-color-background-tinyContrast;
}
}

Expand Down Expand Up @@ -162,11 +159,6 @@ table.admin tbody td:hover, table.admin tbody th:hover {
margin-left: 0px;
}

/* to override .admin a */
.admin .sites_autocomplete a {
color: #255792;
}

/* trusted host styles */
#trustedHostSettings input {
width: 238px;
Expand Down
71 changes: 0 additions & 71 deletions plugins/CoreAdminHome/stylesheets/menu.less

This file was deleted.

3 changes: 0 additions & 3 deletions plugins/CoreAdminHome/templates/_menu.twig

This file was deleted.

17 changes: 15 additions & 2 deletions plugins/CoreHome/CoreHome.php
Expand Up @@ -61,7 +61,6 @@ public function getStylesheetFiles(&$stylesheets)
$stylesheets[] = "plugins/Morpheus/stylesheets/base.less";
$stylesheets[] = "plugins/Morpheus/stylesheets/main.less";
$stylesheets[] = "plugins/CoreHome/stylesheets/coreHome.less";
$stylesheets[] = "plugins/CoreHome/stylesheets/menu.less";
$stylesheets[] = "plugins/CoreHome/stylesheets/dataTable.less";
$stylesheets[] = "plugins/CoreHome/stylesheets/cloud.less";
$stylesheets[] = "plugins/CoreHome/stylesheets/jquery.ui.autocomplete.css";
Expand All @@ -72,9 +71,12 @@ public function getStylesheetFiles(&$stylesheets)
$stylesheets[] = "plugins/CoreHome/stylesheets/sparklineColors.less";
$stylesheets[] = "plugins/CoreHome/stylesheets/notification.less";
$stylesheets[] = "plugins/CoreHome/stylesheets/zen-mode.less";
$stylesheets[] = "plugins/CoreHome/stylesheets/layout.less";
$stylesheets[] = "plugins/CoreHome/angularjs/enrichedheadline/enrichedheadline.directive.less";
$stylesheets[] = "plugins/CoreHome/angularjs/dialogtoggler/ngdialog.less";
$stylesheets[] = "plugins/CoreHome/angularjs/notification/notification.directive.less";
$stylesheets[] = "plugins/CoreHome/angularjs/quick-access/quick-access.directive.less";
$stylesheets[] = "plugins/CoreHome/angularjs/selector/selector.directive.less";
}

public function getJsFiles(&$jsFiles)
Expand Down Expand Up @@ -163,6 +165,11 @@ public function getJsFiles(&$jsFiles)

$jsFiles[] = "plugins/CoreHome/angularjs/ajax-form/ajax-form.controller.js";
$jsFiles[] = "plugins/CoreHome/angularjs/ajax-form/ajax-form.directive.js";

$jsFiles[] = "plugins/CoreHome/angularjs/quick-access/quick-access.controller.js";
$jsFiles[] = "plugins/CoreHome/angularjs/quick-access/quick-access.directive.js";

$jsFiles[] = "plugins/CoreHome/angularjs/selector/selector.directive.js";
}

public function getClientSideTranslationKeys(&$translationKeys)
Expand All @@ -171,8 +178,11 @@ public function getClientSideTranslationKeys(&$translationKeys)
$translationKeys[] = 'General_Loading';
$translationKeys[] = 'General_Show';
$translationKeys[] = 'General_Hide';
$translationKeys[] = 'General_Website';
$translationKeys[] = 'General_ChooseWebsite';
$translationKeys[] = 'Intl_Year_Short';
$translationKeys[] = 'General_MultiSitesSummary';
$translationKeys[] = 'General_SearchNoResults';
$translationKeys[] = 'CoreHome_YouAreUsingTheLatestVersion';
$translationKeys[] = 'CoreHome_IncludeRowsWithLowPopulation';
$translationKeys[] = 'CoreHome_ExcludeRowsWithLowPopulation';
Expand All @@ -184,6 +194,7 @@ public function getClientSideTranslationKeys(&$translationKeys)
$translationKeys[] = 'CoreHome_UnFlattenDataTable';
$translationKeys[] = 'CoreHome_ExternalHelp';
$translationKeys[] = 'CoreHome_ClickToEditX';
$translationKeys[] = 'CoreHome_Menu';
$translationKeys[] = 'SitesManager_NotFound';
$translationKeys[] = 'Annotations_ViewAndAddAnnotations';
$translationKeys[] = 'General_RowEvolutionRowActionTooltipTitle';
Expand Down Expand Up @@ -255,8 +266,10 @@ public function getClientSideTranslationKeys(&$translationKeys)
$translationKeys[] = 'General_LoadingData';
$translationKeys[] = 'General_ErrorRequest';
$translationKeys[] = 'General_YourChangesHaveBeenSaved';
$translationKeys[] = 'General_LearnMore';
$translationKeys[] = 'CoreHome_UndoPivotBySubtable';
$translationKeys[] = 'CoreHome_PivotBySubtable';
$translationKeys[] = 'General_LearnMore';
$translationKeys[] = 'CoreHome_QuickAccessTitle';
$translationKeys[] = 'CoreHome_Segments';
}
}

0 comments on commit 12e3708

Please sign in to comment.