Quellcode durchsuchen

- Fixed bug #243. OQLMenuNodes can now auto-refresh. I've enabled this by default for the "shortcuts" of Helpdesk, Incident Management and Change Management

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@764 a333f486-631f-4898-b8df-5754b55c2be0
dflaven vor 14 Jahren
Ursprung
Commit
02ba356ea2

+ 28 - 2
application/menunode.class.inc.php

@@ -449,6 +449,12 @@ class OQLMenuNode extends MenuNode
 	protected $bSearch;
 	
 	/**
+	 * Extra parameters to be passed to the display block to fine tune its appearence
+	 */
+	protected $m_aParams;
+	
+	
+	/**
 	 * Create a menu item based on an OQL query and inserts it into the application's main menu
 	 * @param string $sMenuId Unique identifier of the menu (used to identify the menu for bookmarking, and for getting the labels from the dictionary)
 	 * @param string $sOQL OQL query defining the set of objects to be displayed
@@ -466,12 +472,23 @@ class OQLMenuNode extends MenuNode
 		$this->sPageTitle = "Menu:$sMenuId+";
 		$this->sOQL = $sOQL;
 		$this->bSearch = $bSearch;
+		$this->m_aParams = array();
 		// Enhancement: we could set as the "enable" condition that the user has enough rights to "read" the objects
 		// of the class specified by the OQL...
 	}
 	
+	/**
+	 * Set some extra parameters to be passed to the display block to fine tune its appearence
+	 * @param Hash $aParams paramCode => value. See DisplayBlock::GetDisplay for the meaning of the parameters
+	 */
+	public function SetParameters($aParams)
+	{
+		$this->m_aParams = $aParams;
+	}
+	
 	public function RenderContent(WebPage $oPage, $aExtraParams = array())
 	{
+		$aExtraParams = array_merge($aExtraParams, $this->m_aParams);
 		try
 		{
 			$oSearch = DBObjectSearch::FromOQL($this->sOQL);
@@ -490,10 +507,19 @@ class OQLMenuNode extends MenuNode
 <itopblock BlockClass="DisplayBlock" type="search" asynchronous="false" encoding="text/oql">$this->sOQL</itopblock>
 EOF;
 		}
-		
+		$sParams = '';
+		if (!empty($this->m_aParams))
+		{
+			$sParams = 'parameters="';
+			foreach($this->m_aParams as $sName => $sValue)
+			{
+				$sParams .= $sName.':'.$sValue.';';
+			}
+			$sParams .= '"';
+		}
 		$sTemplate .= <<<EOF
 <p class="page-header">$sIcon<itopstring>$this->sPageTitle</itopstring></p>
-<itopblock BlockClass="DisplayBlock" type="list" asynchronous="false" encoding="text/oql">$this->sOQL</itopblock>
+<itopblock BlockClass="DisplayBlock" type="list" asynchronous="false" encoding="text/oql" $sParams>$this->sOQL</itopblock>
 EOF;
 		$oTemplate = new DisplayTemplate($sTemplate);
 		$oTemplate->Render($oPage, $aExtraParams);

+ 8 - 5
modules/itop-change-mgmt-1.0.0/model.itop-change-mgmt.php

@@ -538,9 +538,12 @@ new TemplateMenuNode('Change:Overview', '../modules/itop-change-mgmt-1.0.0/overv
 new NewObjectMenuNode('NewChange', 'Change', $oMyMenuGroup->GetIndex(), 1 /* fRank */);
 new SearchMenuNode('SearchChanges', 'Change', $oMyMenuGroup->GetIndex(), 2 /* fRank */);
 $oShortcutNode = new TemplateMenuNode('Change:Shortcuts', '', $oMyMenuGroup->GetIndex(), 3 /* fRank */);
-new OQLMenuNode('MyChanges', 'SELECT Change WHERE agent_id = :current_contact_id', $oShortcutNode->GetIndex(), 1 /* fRank */);
-new OQLMenuNode('Changes', 'SELECT Change WHERE status != "closed"', $oShortcutNode->GetIndex(), 2 /* fRank */);
-new OQLMenuNode('WaitingApproval', 'SELECT ApprovedChange WHERE status IN ("plannedscheduled")', $oShortcutNode->GetIndex(), 3 /* fRank */);
-new OQLMenuNode('WaitingAcceptance', 'SELECT NormalChange WHERE status IN ("new")', $oShortcutNode->GetIndex(), 4 /* fRank */);
-
+$oNode = new OQLMenuNode('MyChanges', 'SELECT Change WHERE agent_id = :current_contact_id', $oShortcutNode->GetIndex(), 1 /* fRank */);
+$oNode->SetParameters(array('auto_reload' => 'fast'));
+$oNode = new OQLMenuNode('Changes', 'SELECT Change WHERE status != "closed"', $oShortcutNode->GetIndex(), 2 /* fRank */);
+$oNode->SetParameters(array('auto_reload' => 'fast'));
+$oNode = new OQLMenuNode('WaitingApproval', 'SELECT ApprovedChange WHERE status IN ("plannedscheduled")', $oShortcutNode->GetIndex(), 3 /* fRank */);
+$oNode->SetParameters(array('auto_reload' => 'fast'));
+$oNode = new OQLMenuNode('WaitingAcceptance', 'SELECT NormalChange WHERE status IN ("new")', $oShortcutNode->GetIndex(), 4 /* fRank */);
+$oNode->SetParameters(array('auto_reload' => 'fast'));
 ?>

+ 6 - 3
modules/itop-incident-mgmt-1.0.0/model.itop-incident-mgmt.php

@@ -221,8 +221,11 @@ new TemplateMenuNode('Incident:Overview', '../modules/itop-incident-mgmt-1.0.0/o
 new NewObjectMenuNode('NewIncident', 'Incident', $oMyMenuGroup->GetIndex(), 1 /* fRank */);
 new SearchMenuNode('SearchIncidents', 'Incident', $oMyMenuGroup->GetIndex(), 2 /* fRank */);
 $oShortcutNode = new TemplateMenuNode('Incident:Shortcuts', '', $oMyMenuGroup->GetIndex(), 3 /* fRank */);
-new OQLMenuNode('Incident:MyIncidents', 'SELECT Incident WHERE agent_id = :current_contact_id', $oShortcutNode->GetIndex(), 1 /* fRank */);
-new OQLMenuNode('Incident:EscalatedIncidents', 'SELECT Incident WHERE status IN ("escalated_tto", "escalated_ttr")', $oShortcutNode->GetIndex(), 2 /* fRank */);
-new OQLMenuNode('Incident:OpenIncidents', 'SELECT Incident WHERE status IN ("new", "assigned", "escalated_tto", "escalated_ttr", "resolved")', $oShortcutNode->GetIndex(), 3 /* fRank */);
+$oNode = new OQLMenuNode('Incident:MyIncidents', 'SELECT Incident WHERE agent_id = :current_contact_id', $oShortcutNode->GetIndex(), 1 /* fRank */);
+$oNode->SetParameters(array('auto_reload' => 'fast'));
+$oNode = new OQLMenuNode('Incident:EscalatedIncidents', 'SELECT Incident WHERE status IN ("escalated_tto", "escalated_ttr")', $oShortcutNode->GetIndex(), 2 /* fRank */);
+$oNode->SetParameters(array('auto_reload' => 'fast'));
+$oNode = new OQLMenuNode('Incident:OpenIncidents', 'SELECT Incident WHERE status IN ("new", "assigned", "escalated_tto", "escalated_ttr", "resolved")', $oShortcutNode->GetIndex(), 3 /* fRank */);
+$oNode->SetParameters(array('auto_reload' => 'fast'));
 
 ?>

+ 6 - 3
modules/itop-request-mgmt-1.0.0/model.itop-request-mgmt.php

@@ -179,8 +179,11 @@ new TemplateMenuNode('UserRequest:Overview', '../modules/itop-request-mgmt-1.0.0
 new NewObjectMenuNode('NewUserRequest', 'UserRequest', $oMyMenuGroup->GetIndex(), 1 /* fRank */);
 new SearchMenuNode('SearchUserRequests', 'UserRequest', $oMyMenuGroup->GetIndex(), 2 /* fRank */);
 $oShortcutNode = new TemplateMenuNode('UserRequest:Shortcuts', '', $oMyMenuGroup->GetIndex(), 3 /* fRank */);
-new OQLMenuNode('UserRequest:MyRequests', 'SELECT UserRequest WHERE agent_id = :current_contact_id AND status NOT IN ("closed", "resolved")', $oShortcutNode->GetIndex(), 1 /* fRank */);
-new OQLMenuNode('UserRequest:EscalatedRequests', 'SELECT UserRequest WHERE status IN ("escalated_tto", "escalated_ttr")', $oShortcutNode->GetIndex(), 2 /* fRank */);
-new OQLMenuNode('UserRequest:OpenRequests', 'SELECT UserRequest WHERE status IN ("new", "assigned", "escalated_tto", "escalated_ttr", "frozen", "resolved")', $oShortcutNode->GetIndex(), 3 /* fRank */);
+$oNode = new OQLMenuNode('UserRequest:MyRequests', 'SELECT UserRequest WHERE agent_id = :current_contact_id AND status NOT IN ("closed", "resolved")', $oShortcutNode->GetIndex(), 1 /* fRank */);
+$oNode->SetParameters(array('auto_reload' => 'fast'));
+$oNode = new OQLMenuNode('UserRequest:EscalatedRequests', 'SELECT UserRequest WHERE status IN ("escalated_tto", "escalated_ttr")', $oShortcutNode->GetIndex(), 2 /* fRank */);
+$oNode->SetParameters(array('auto_reload' => 'fast'));
+$oNode = new OQLMenuNode('UserRequest:OpenRequests', 'SELECT UserRequest WHERE status IN ("new", "assigned", "escalated_tto", "escalated_ttr", "frozen", "resolved")', $oShortcutNode->GetIndex(), 3 /* fRank */);
+$oNode->SetParameters(array('auto_reload' => 'fast'));
 
 ?>