Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2009-11-17 20:40:35 +0300
committermatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2009-11-17 20:40:35 +0300
commitc3c5c479abce0d55c4baca2e88b11ed8f0352d82 (patch)
treec3483d5ed8c661ff1c22feeb90e80bcb512d18a4 /plugins/Dashboard
parentc4b36700b1cc9b968335ba3a386345dee6f550b7 (diff)
Fixes #677 disabled plugins will now not show in the dashboard as "Widget not found"
Diffstat (limited to 'plugins/Dashboard')
-rw-r--r--plugins/Dashboard/Controller.php49
1 files changed, 35 insertions, 14 deletions
diff --git a/plugins/Dashboard/Controller.php b/plugins/Dashboard/Controller.php
index 863883f6be..c778dab567 100644
--- a/plugins/Dashboard/Controller.php
+++ b/plugins/Dashboard/Controller.php
@@ -21,15 +21,7 @@ class Piwik_Dashboard_Controller extends Piwik_Controller
$view = Piwik_View::factory($template);
$this->setGeneralVariablesView($view);
- // layout was JSON.stringified
- $layout = html_entity_decode($this->getLayout());
- $layout = str_replace("\\\"", "\"", $layout);
-
- if(!empty($layout)
- && strstr($layout, '[[') == false) {
- $layout = "'$layout'";
- }
- $view->layout = $layout;
+ $view->layout = $this->getLayout();
$view->availableWidgets = json_encode(Piwik_GetWidgetsList());
return $view;
}
@@ -97,7 +89,7 @@ class Piwik_Dashboard_Controller extends Piwik_Controller
if($currentUser == 'anonymous')
{
$session = new Zend_Session_Namespace("Piwik_Dashboard");
- $session->idDashboard = $layout;
+ $session->dashboardLayout = $layout;
}
else
{
@@ -119,16 +111,45 @@ class Piwik_Dashboard_Controller extends Piwik_Controller
{
$session = new Zend_Session_Namespace("Piwik_Dashboard");
- if(!isset($session->idDashboard))
+ if(!isset($session->dashboardLayout))
{
return false;
}
- return $session->idDashboard;
+ $layout = $session->dashboardLayout;
}
else
{
- return $this->getLayoutForUser($currentUser,$idDashboard);
- }
+ $layout = $this->getLayoutForUser($currentUser,$idDashboard);
+ }
+
+ // layout was JSON.stringified
+ $layout = html_entity_decode($layout);
+ $layout = str_replace("\\\"", "\"", $layout);
+
+ // compatibility with the old layout format
+ if(!empty($layout)
+ && strstr($layout, '[[') == false) {
+ $layout = "'$layout'";
+ }
+
+ // if the json decoding works (ie. new Json format)
+ // we will only return the widgets that are from enabled plugins
+ if($layoutObject = json_decode($layout, $assoc = true))
+ {
+ foreach($layoutObject as &$row)
+ {
+ foreach($row as $widgetId => $widget)
+ {
+ $pluginName = $widget['parameters']['module'];
+ if(!Piwik_PluginsManager::getInstance()->isPluginActivated($pluginName))
+ {
+ unset($row[$widgetId]);
+ }
+ }
+ }
+ $layout = json_encode($layoutObject);
+ }
+ return $layout;
}
}