Переглянути джерело

Dashboard: transformed a few overviews into customizable dashboards

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@2014 a333f486-631f-4898-b8df-5754b55c2be0
romainq 13 роки тому
батько
коміт
dc5ffd2d1c

+ 1 - 1
application/dashboard.class.inc.php

@@ -145,7 +145,7 @@ abstract class Dashboard
 	
 	public function Render($oPage, $bEditMode = false, $aExtraParams = array())
 	{
-		$oPage->add('<h1>'.$this->sTitle.'</h1>');
+		$oPage->add('<h1>'.Dict::S($this->sTitle).'</h1>');
 		$oLayout = new $this->sLayoutClass;
 		$oLayout->Render($oPage, $this->aDashlets, $bEditMode, $aExtraParams);
 		if (!$bEditMode)

+ 1 - 1
application/dashlet.class.inc.php

@@ -379,7 +379,7 @@ class DashletGroupBy extends Dashlet
 				break;
 			case 'table':
 			default:
-				$sHtmlTitle = htmlentities($sTitle, ENT_QUOTES, 'UTF-8'); // done in the itop block
+				$sHtmlTitle = htmlentities(Dict::S($sTitle), ENT_QUOTES, 'UTF-8'); // done in the itop block
 				$sXML = '<itopblock BlockClass="DisplayBlock" type="count" parameters="group_by:'.$sGroupBy.'" asynchronous="false" encoding="text/oql">'.$sQuery.'</itopblock>';
 				break;
 			}

+ 25 - 0
datamodel/itop-config-mgmt-1.0.0/config-dashboard.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<dashboard xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<title>UI:ConfigMgmtMenuOverview:Title</title>
+<layout>DashboardLayoutTwoCols</layout>
+<dashlets>
+ <dashlet id="1" xsi:type="DashletGroupBy">
+  <title>UI-ConfigMgmtMenuOverview-FunctionalCIbyStatus</title>
+  <query>SELECT FunctionalCI</query>
+  <group_by>status</group_by>
+  <style>pie</style>
+ </dashlet>
+ <dashlet id="2" xsi:type="DashletGroupBy">
+  <title>UI-ConfigMgmtMenuOverview-FunctionalCIByType</title>
+  <query>SELECT FunctionalCI</query>
+  <group_by>finalclass</group_by>
+  <style>bars</style>
+ </dashlet>
+ <dashlet id="3" xsi:type="DashletGroupBy">
+  <title>UI-ConfigMgmtMenuOverview-FunctionalCIByType</title>
+  <query>SELECT FunctionalCI</query>
+  <group_by>finalclass</group_by>
+  <style>table</style>
+ </dashlet>
+</dashlets>
+</dashboard>

+ 2 - 2
datamodel/itop-config-mgmt-1.0.0/datamodel.itop-config-mgmt.xml

@@ -4195,10 +4195,10 @@
     <menu id="ConfigManagement" xsi:type="MenuGroup" _delta="define">
       <rank>20</rank>
     </menu>
-    <menu id="ConfigManagementOverview" xsi:type="TemplateMenuNode" _delta="define">
+    <menu id="ConfigManagementOverview" xsi:type="DashboardMenuNode" _delta="define">
       <rank>0</rank>
       <parent>ConfigManagement</parent>
-      <template_file>overview.html</template_file>
+      <definition_file>config-dashboard.xml</definition_file>
     </menu>
     <menu id="Contact" xsi:type="TemplateMenuNode" _delta="define">
       <rank>1</rank>

+ 0 - 21
datamodel/itop-config-mgmt-1.0.0/overview.html

@@ -1,21 +0,0 @@
-<h1><itopstring>UI:ConfigMgmtMenuOverview:Title</itopstring></h1>
-<table border="0" padding="5" class="layout" width="100%">
-<tr>
-<td class="dashboard">
-<itopblock BlockClass="DisplayBlock"  type="open_flash_chart" parameters="chart_type:pie;group_by:status;chart_title:UI-ConfigMgmtMenuOverview-FunctionalCIbyStatus" asynchronous="false" encoding="text/oql">SELECT FunctionalCI</itopblock>
-</td>
-<td class="dashboard">
-<itopblock BlockClass="DisplayBlock"  type="open_flash_chart" parameters="chart_type:bars;group_by:finalclass;chart_title:UI-ConfigMgmtMenuOverview-FunctionalCIByType" asynchronous="false" encoding="text/oql">SELECT FunctionalCI</itopblock>
-</td>
-</tr><tr>
-<td class="dashboard">
-<h1><itopstring>UI-ConfigMgmtMenuOverview-FunctionalCIByType</itopstring></h1>
-<itopblock BlockClass="DisplayBlock" type="count" parameters="group_by:finalclass" asynchronous="false" encoding="text/oql">SELECT FunctionalCI</itopblock>
-</td>
-<td>
-&nbsp;
-</td>
-</tr>
-</table>
-
-

+ 2 - 2
datamodel/itop-incident-mgmt-1.0.0/datamodel.itop-incident-mgmt.xml

@@ -991,10 +991,10 @@
     <menu id="IncidentManagement" xsi:type="MenuGroup" _delta="define">
       <rank>40</rank>
     </menu>
-    <menu id="Incident:Overview" xsi:type="TemplateMenuNode" _delta="define">
+    <menu id="Incident:Overview" xsi:type="DashboardMenuNode" _delta="define">
       <rank>0</rank>
       <parent>IncidentManagement</parent>
-      <template_file>overview.html</template_file>
+      <definition_file>incident-dashboard.xml</definition_file>
     </menu>
     <menu id="NewIncident" xsi:type="NewObjectMenuNode" _delta="define">
       <rank>1</rank>

+ 23 - 0
datamodel/itop-incident-mgmt-1.0.0/incident-dashboard.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<dashboard xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<title>UI:IncidentMgmtMenuOverview:Title</title>
+<layout>DashboardLayoutTwoCols</layout>
+<dashlets>
+ <dashlet id="1" xsi:type="DashletGroupBy">
+  <title>UI-IncidentManagementOverview-IncidentByService</title>
+  <query>SELECT Incident</query>
+  <group_by>service_name</group_by>
+  <style>bars</style>
+ </dashlet>
+ <dashlet id="2" xsi:type="DashletGroupBy">
+  <title>UI-IncidentManagementOverview-IncidentByPriority</title>
+  <query>SELECT Incident</query>
+  <group_by>priority</group_by>
+  <style>pie</style>
+ </dashlet>
+ <dashlet id="3" xsi:type="DashletObjectList">
+  <title>UI-IncidentManagementOverview-IncidentUnassigned</title>
+  <query>SELECT Incident WHERE status IN ("new", "escalated_tto")</query>
+ </dashlet>
+</dashlets>
+</dashboard>

+ 0 - 20
datamodel/itop-incident-mgmt-1.0.0/overview.html

@@ -1,20 +0,0 @@
-<h1><itopstring>UI:IncidentMgmtMenuOverview:Title</itopstring></h1>
-<table border="0" padding="5" class="layout" width="100%">
-<tr>
-<td class="dashboard">
-<itopblock BlockClass="DisplayBlock" type="open_flash_chart" parameters="chart_type:bars;group_by:service_name;chart_title:UI-IncidentManagementOverview-IncidentByService" asynchronous="false" encoding="text/oql">SELECT Incident</itopblock>
-</td>
-<td class="dashboard">
-<itopblock BlockClass="DisplayBlock" type="open_flash_chart" parameters="chart_type:pie;group_by:priority;chart_title:UI-IncidentManagementOverview-IncidentByPriority" asynchronous="false" encoding="text/oql">SELECT Incident</itopblock>
-</td>
-</tr>
-<tr>
-<td class="dashboard">
-<h2><itopstring>UI-IncidentManagementOverview-IncidentUnassigned</itopstring></h2>
-<itopblock BlockClass="DisplayBlock" type="list" parameters="dashboard:true" asynchronous="false" encoding="text/oql">SELECT Incident WHERE status IN ("new", "escalated_tto")</itopblock>
-</td>
-<td class="dashboard">
-</td>
-</tr>
-</table>
-

+ 2 - 2
datamodel/itop-request-mgmt-1.0.0/datamodel.itop-request-mgmt.xml

@@ -961,10 +961,10 @@
     <menu id="RequestManagement" xsi:type="MenuGroup" _delta="define">
       <rank>30</rank>
     </menu>
-    <menu id="UserRequest:Overview" xsi:type="TemplateMenuNode" _delta="define">
+    <menu id="UserRequest:Overview" xsi:type="DashboardMenuNode" _delta="define">
       <rank>0</rank>
       <parent>RequestManagement</parent>
-      <template_file>overview.html</template_file>
+      <definition_file>request-dashboard.xml</definition_file>
     </menu>
     <menu id="NewUserRequest" xsi:type="NewObjectMenuNode" _delta="define">
       <rank>1</rank>

+ 0 - 21
datamodel/itop-request-mgmt-1.0.0/overview.html

@@ -1,21 +0,0 @@
-<h1><itopstring>UI:RequestMgmtMenuOverview:Title</itopstring></h1>
-<table border="0" padding="5" class="layout" width="100%">
-<tr>
-<td class="dashboard">
-<itopblock BlockClass="DisplayBlock" type="open_flash_chart" parameters="chart_type:bars;group_by:service_name;chart_title:UI-RequestManagementOverview-RequestByService" asynchronous="false" encoding="text/oql">SELECT UserRequest</itopblock>
-</td>
-<td class="dashboard">
-<itopblock BlockClass="DisplayBlock" type="open_flash_chart" parameters="chart_type:pie;group_by:priority;chart_title:UI-RequestManagementOverview-RequestByPriority" asynchronous="false" encoding="text/oql">SELECT UserRequest</itopblock>
-</td>
-</tr>
-<tr>
-<td class="dashboard">
-<h2><itopstring>UI-RequestManagementOverview-RequestUnassigned</itopstring></h2>
-<itopblock BlockClass="DisplayBlock" type="list" parameters="dashboard:true" asynchronous="false" encoding="text/oql">SELECT UserRequest WHERE status IN ("new", "escalated_tto")</itopblock>
-</td>
-<td>
-&nbsp;
-</td>
-</tr>
-</table>
-

+ 23 - 0
datamodel/itop-request-mgmt-1.0.0/request-dashboard.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<dashboard xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<title>UI:RequestMgmtMenuOverview:Title</title>
+<layout>DashboardLayoutTwoCols</layout>
+<dashlets>
+ <dashlet id="1" xsi:type="DashletGroupBy">
+  <title>UI-RequestManagementOverview-RequestByService</title>
+  <query>SELECT UserRequest</query>
+  <group_by>service_name</group_by>
+  <style>bars</style>
+ </dashlet>
+ <dashlet id="2" xsi:type="DashletGroupBy">
+  <title>UI-RequestManagementOverview-RequestByPriority</title>
+  <query>SELECT UserRequest</query>
+  <group_by>priority</group_by>
+  <style>pie</style>
+ </dashlet>
+ <dashlet id="3" xsi:type="DashletObjectList">
+  <title>UI-RequestManagementOverview-RequestUnassigned</title>
+  <query>SELECT UserRequest WHERE status IN ("new", "escalated_tto")</query>
+ </dashlet>
+</dashlets>
+</dashboard>

+ 3 - 3
pages/ajax.render.php

@@ -626,7 +626,7 @@ try
 		break;
 		
 		case 'dashboard_editor':
-		$sId = utils::ReadParam('id', '');
+		$sId = utils::ReadParam('id', '', false, 'raw_data');
 		$idx = ApplicationMenu::GetMenuIndexById($sId);
 		$oMenu = ApplicationMenu::GetMenuNode($idx);
 		$oMenu->RenderEditor($oPage);
@@ -682,7 +682,7 @@ try
 		break;
 		
 		case 'save_dashboard':
-		$sDashboardId = utils::ReadParam('dashboard_id', '');
+		$sDashboardId = utils::ReadParam('dashboard_id', '', false, 'raw_data');
 		$aParams = array();
 		$aParams['layout_class'] = utils::ReadParam('layout_class', '');
 		$aParams['title'] = utils::ReadParam('title', '', false, 'raw_data');
@@ -695,7 +695,7 @@ try
 		break;
 		
 		case 'render_dashboard':
-		$sDashboardId = utils::ReadParam('dashboard_id', '');
+		$sDashboardId = utils::ReadParam('dashboard_id', '', false, 'raw_data');
 		$aParams = array();
 		$aParams['layout_class'] = utils::ReadParam('layout_class', '');
 		$aParams['title'] = utils::ReadParam('title', '', false, 'raw_data');

+ 6 - 0
setup/compiler.class.inc.php

@@ -817,6 +817,12 @@ EOF;
 			$sNewMenu = "new WebPageMenuNode('$sMenuId', $sUrlSpec, $sParentSpec, $fRank);";
 			break;
 
+		case 'DashboardMenuNode':
+			$sTemplateFile = $oMenu->GetChildText('definition_file');
+			$sTemplateSpec = $this->PathToPHP($sTemplateFile, $sModuleRelativeDir);
+			$sNewMenu = "new DashboardMenuNode('$sMenuId', $sTemplateSpec, $sParentSpec, $fRank);";
+			break;
+
 		case 'TemplateMenuNode':
 			$sTemplateFile = $oMenu->GetChildText('template_file');
 			$sTemplateSpec = $this->PathToPHP($sTemplateFile, $sModuleRelativeDir);