Browse Source

New config parameter: buttons_position: top | bottom | both

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1436 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 14 năm trước cách đây
mục cha
commit
b0188512a1
3 tập tin đã thay đổi với 20 bổ sung18 xóa
  1. 5 3
      application/cmdbabstract.class.inc.php
  2. 5 5
      core/config.class.inc.php
  3. 10 10
      pages/UI.php

+ 5 - 3
application/cmdbabstract.class.inc.php

@@ -1737,14 +1737,15 @@ EOF
 			}
 		}
 				
-		$bDisplayActionsAtTop = MetaModel::GetConfig()->Get('display_actions_at_top');
+		$sButtonsPosition = MetaModel::GetConfig()->Get('buttons_position');
 		$iTransactionId = utils::GetNewTransactionId();
 		$oPage->SetTransactionId($iTransactionId);
 		$oPage->add("<form action=\"$sFormAction\" id=\"form_{$this->m_iFormId}\" enctype=\"multipart/form-data\" method=\"post\" onSubmit=\"return OnSubmit('form_{$this->m_iFormId}');\">\n");
 		$oPage->add_ready_script("$(window).unload(function() { OnUnload('$iTransactionId') } );\n");
 
-		if ($bDisplayActionsAtTop)
+		if ($sButtonsPosition != 'bottom')
 		{
+			// top or both, display the buttons here
 			$oPage->add($sButtons);
 		}
 
@@ -1767,8 +1768,9 @@ EOF
 			$oPage->add("<input type=\"hidden\" name=\"$sName\" value=\"$value\">\n");
 		}
 		$oPage->add($oAppContext->GetForForm());
-		if ($bDisplayActionsAtTop)
+		if ($sButtonsPosition != 'top')
 		{
+			// bottom or both: display the buttons here
 			$oPage->add($sButtons);
 		}
 

+ 5 - 5
core/config.class.inc.php

@@ -401,12 +401,12 @@ class Config
 			'source_of_value' => '',
 			'show_in_conf_sample' => true,
 		),
-		'display_actions_at_top' => array(
-			'type' => 'bool',
-			'description' => 'Whether or not the actions/buttons should be displayed at the top of the screen',
+		'buttons_position' => array(
+			'type' => 'string',
+			'description' => 'Position of the forms buttons: bottom | top | both',
 			// examples... not used
-			'default' => true,
-			'value' => false,
+			'default' => 'both',
+			'value' => 'both',
 			'source_of_value' => '',
 			'show_in_conf_sample' => true,
 		),

+ 10 - 10
pages/UI.php

@@ -1577,10 +1577,10 @@ EOF
 					$iFieldIndex++;
 				}
 			}
-			$bDisplayFormAtTop = MetaModel::GetConfig()->Get('display_actions_at_top');
-			if (!$bDisplayFormAtTop)
+			$sButtonsPosition = MetaModel::GetConfig()->Get('buttons_position');
+			if ($sButtonsPosition != 'bottom')
 			{
-				// Displays the ticket details BEFORE the actions
+				// top or both: Displays the ticket details BEFORE the actions
 				$oP->add('<div class="ui-widget-content">');
 				$oObj->DisplayBareProperties($oP);
 				$oP->add('</div>');
@@ -1604,9 +1604,9 @@ EOF
 			$oP->add("<button type=\"submit\" class=\"action\"><span>$sActionLabel</span></button>\n");
 			$oP->add("</form>\n");
 			$oP->add("</div>\n");
-			if ($bDisplayFormAtTop)
+			if ($sButtonsPosition == 'bottom')
 			{
-				// Displays the ticket details BEFORE the actions
+				// bottom or both: Displays the ticket details AFTER the actions
 				$oP->add('<div class="ui-widget-content">');
 				$oObj->DisplayBareProperties($oP);
 				$oP->add('</div>');
@@ -1800,10 +1800,10 @@ EOF
 			$aTargetState = $aTargetStates[$sTargetState];
 			$aExpectedAttributes = $aTargetState['attribute_list'];
 			$oP->add("<h1>$sActionDetails</h1>\n");
-			$bDisplayFormAtTop = MetaModel::GetConfig()->Get('display_actions_at_top');
-			if (!$bDisplayFormAtTop)
+			$sButtonsPosition = MetaModel::GetConfig()->Get('buttons_position');
+			if ($sButtonsPosition == 'bottom')
 			{
-				// Displays the ticket details BEFORE the actions
+				// bottom: Displays the ticket details BEFORE the actions
 				$oP->add('<div class="ui-widget-content">');
 				$oObj->DisplayBareProperties($oP);
 				$oP->add('</div>');
@@ -1882,9 +1882,9 @@ EOF
 			$oP->add("<button type=\"submit\" class=\"action\"><span>$sActionLabel</span></button>\n");
 			$oP->add("</form>\n");
 			$oP->add("</div>\n");
-			if ($bDisplayFormAtTop)
+			if ($sButtonsPosition != 'top')
 			{
-				// Displays the ticket details AFTER the actions
+				// bottom or both: Displays the ticket details AFTER the actions
 				$oP->add('<div class="ui-widget-content">');
 				$oObj->DisplayBareProperties($oP);
 				$oP->add('</div>');