Kaynağa Gözat

Customers portal : Fixed a bug in BrowseBrick APIs. Calls to static functions were made as $this->

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4263 a333f486-631f-4898-b8df-5754b55c2be0
glajarige 9 yıl önce
ebeveyn
işleme
01f748e8b6

+ 12 - 12
datamodels/2.x/itop-portal-base/portal/src/controllers/browsebrickcontroller.class.inc.php

@@ -63,8 +63,8 @@ class BrowseBrickController extends BrickController
 		$aData = array();
 		$aLevelsProperties = array();
 		$aLevelsClasses = array();
-		$this->TreeToFlatLevelsProperties($oApp, $oBrick->GetLevels(), $aLevelsProperties);
-		
+		static::TreeToFlatLevelsProperties($oApp, $oBrick->GetLevels(), $aLevelsProperties);
+
 		// Concistency checks
 		if (!in_array($sBrowseMode, array_keys($aBrowseModes)))
 		{
@@ -267,12 +267,12 @@ class BrowseBrickController extends BrickController
 			switch ($sBrowseMode)
 			{
 				case BrowseBrick::ENUM_BROWSE_MODE_TREE:
-					$this->AddToTreeItems($aItems, $aCurrentRow, $aLevelsProperties);
+					static::AddToTreeItems($aItems, $aCurrentRow, $aLevelsProperties);
 					break;
 
 				case BrowseBrick::ENUM_BROWSE_MODE_LIST:
 				default:
-					$aItems[] = $this->AddToFlatItems($aCurrentRow, $aLevelsProperties);
+					$aItems[] = static::AddToFlatItems($aCurrentRow, $aLevelsProperties);
 					break;
 			}
 		}
@@ -332,7 +332,7 @@ class BrowseBrickController extends BrickController
 	 * @param array $aLevelsProperties Reference to an array that will contain the flattened levels
 	 * @param string $sLevelAliasPrefix String that will be prefixed to the level ID as an unique path identifier
 	 */
-	protected function TreeToFlatLevelsProperties(Application $oApp, array $aLevels, array &$aLevelsProperties, $sLevelAliasPrefix = 'L')
+	public static function TreeToFlatLevelsProperties(Application $oApp, array $aLevels, array &$aLevelsProperties, $sLevelAliasPrefix = 'L')
 	{
 		foreach ($aLevels as $aLevel)
 		{
@@ -394,7 +394,7 @@ class BrowseBrickController extends BrickController
 						}
 						unset($oChildSearch);
 					}
-					$this->TreeToFlatLevelsProperties($oApp, $aLevel['levels'], $aLevelsProperties, $sCurrentLevelAlias);
+					static::TreeToFlatLevelsProperties($oApp, $aLevel['levels'], $aLevelsProperties, $sCurrentLevelAlias);
 				}
 
 				// Adding actions to the level
@@ -502,7 +502,7 @@ class BrowseBrickController extends BrickController
 	 * @param array $aLevelsProperties
 	 * @return array
 	 */
-	protected function PrepareActionRulesForItem(DBObject $oItem, $sLevelsAlias, array &$aLevelsProperties)
+	public static function PrepareActionRulesForItem(DBObject $oItem, $sLevelsAlias, array &$aLevelsProperties)
 	{
 		$aActionRules = array();
 
@@ -536,7 +536,7 @@ class BrowseBrickController extends BrickController
 	 * @param array $aLevelsProperties
 	 * @return array
 	 */
-	protected function AddToFlatItems(array $aCurrentRow, array &$aLevelsProperties)
+	public static function AddToFlatItems(array $aCurrentRow, array &$aLevelsProperties)
 	{
 		$aRow = array();
 
@@ -547,7 +547,7 @@ class BrowseBrickController extends BrickController
 				'id' => $value->GetKey(),
 				'name' => $value->Get($aLevelsProperties[$key]['name_att']),
 				'class' => get_class($value),
-				'action_rules_token' => $this->PrepareActionRulesForItem($value, $key, $aLevelsProperties)
+				'action_rules_token' => static::PrepareActionRulesForItem($value, $key, $aLevelsProperties)
 			);
 
 			// Adding tooltip attribute if necessary
@@ -599,7 +599,7 @@ class BrowseBrickController extends BrickController
 	 * @param array $aCurrentRow
 	 * @param array $aLevelsProperties
 	 */
-	protected function AddToTreeItems(array &$aItems, array $aCurrentRow, array &$aLevelsProperties)
+	public static function AddToTreeItems(array &$aItems, array $aCurrentRow, array &$aLevelsProperties)
 	{
 		$aCurrentRowKeys = array_keys($aCurrentRow);
 		$aCurrentRowValues = array_values($aCurrentRow);
@@ -613,7 +613,7 @@ class BrowseBrickController extends BrickController
 				'name' => $aCurrentRowValues[0]->Get($aLevelsProperties[$aCurrentRowKeys[0]]['name_att']),
 				'class' => get_class($aCurrentRowValues[0]),
 				'subitems' => array(),
-				'action_rules_token' => $this->PrepareActionRulesForItem($aCurrentRowValues[0], $aCurrentRowKeys[0], $aLevelsProperties)
+				'action_rules_token' => static::PrepareActionRulesForItem($aCurrentRowValues[0], $aCurrentRowKeys[0], $aLevelsProperties)
 			);
 
 			if ($aLevelsProperties[$aCurrentRowKeys[0]]['tooltip_att'] !== null)
@@ -625,7 +625,7 @@ class BrowseBrickController extends BrickController
 		$aCurrentRowSliced = array_slice($aCurrentRow, 1);
 		if (!empty($aCurrentRowSliced))
 		{
-			$this->AddToTreeItems($aItems[$sCurrentIndex]['subitems'], $aCurrentRowSliced, $aLevelsProperties);
+			static::AddToTreeItems($aItems[$sCurrentIndex]['subitems'], $aCurrentRowSliced, $aLevelsProperties);
 		}
 	}
 

+ 0 - 50
datamodels/2.x/itop-portal-base/portal/src/views/bricks/browse/mode_tree.html.twig

@@ -304,56 +304,6 @@
 							actionsElem.append(actionElem);
 						}
 					}
-					
-					
-					////////////////////////////////////////////////
-					
-					/*
-					var actionsElem = $('<div></div>').addClass('list-group-item-actions');
-					liElem.append(actionsElem);
-					
-					// Preparing secondary actions for small screens
-					var actionsSSTogglerElem = $('<a class="glyphicon glyphicon-menu-hamburger visible-xs" data-toggle="collapse" data-target="#item-actions-menu-'+levelAltId+'"></a>');
-					var actionsSSMenuElem = $('<div id="item-actions-menu-'+levelAltId+'" class="item-action-wrapper panel panel-default"></div>');
-					var actionsSSMenuContainerElem = $('<div class="panel-body"></div>');
-					actionsSSMenuElem.append(actionsSSMenuContainerElem);
-					actionsElem.append(actionsSSTogglerElem);
-					actionsElem.append(actionsSSMenuElem);
-					
-					
-					var actionsButtons = {};
-					// Fill actionsButtons with all actions but the primary
-					for(j = 1; j < levelActionsKeys.length; j++)
-					{
-						actionsButtons[levelActionsKeys[j]] = levelActions[levelActionsKeys[j]];
-					}
-					for(j in actionsButtons)
-					{
-						var action = actionsButtons[j];
-						var actionElem = $('<a></a>');
-						
-						switch(action.type)
-						{
-							case '{{ constant('Combodo\\iTop\\Portal\\Brick\\BrowseBrick::ENUM_ACTION_VIEW') }}':
-								url = '{{ app.url_generator.generate('p_object_view', {'sObjectClass': '-objectClass-', 'sObjectId': '-objectId-'})|raw }}'.replace(/-objectClass-/, item.class).replace(/-objectId-/, item.id);
-								actionElem.attr('data-toggle', 'modal').attr('data-target', '#modal-for-all').attr('href', url).text(action.title);
-								break;
-							case '{{ constant('Combodo\\iTop\\Portal\\Brick\\BrowseBrick::ENUM_ACTION_EDIT') }}':
-								url = '{{ app.url_generator.generate('p_object_edit', {'sObjectClass': '-objectClass-', 'sObjectId': '-objectId-'})|raw }}'.replace(/-objectClass-/, item.class).replace(/-objectId-/, item.id);
-								actionElem.attr('data-toggle', 'modal').attr('data-target', '#modal-for-all').attr('href', url).text(action.title);
-								break;
-							case '{{ constant('Combodo\\iTop\\Portal\\Brick\\BrowseBrick::ENUM_ACTION_CREATE_FROM_THIS') }}':
-								url = action.url.replace(/-objectClass-/, item.class).replace(/-objectId-/, item.id);
-								url = addParameterToUrl(url, 'ar_token', item.action_rules_token[action.type]);
-								actionElem.attr('data-toggle', 'modal').attr('data-target', '#modal-for-all').attr('href', url).text(action.title);
-								break;
-							default:
-								console.log('Action "'+action.type+'" not implemented for secondary action');
-								break;
-						}
-						actionsSSMenuContainerElem.append( $('<p></p>').append(actionElem.clone()) );
-						actionsElem.append(actionElem.addClass('hidden-xs'));   // We don't want to display it on small screens
-					}*/
 				}
 				
 				// Building subnodes if necessary