|
@@ -204,9 +204,9 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay
|
|
|
$oBlock->Display($oPage, -1);
|
|
|
}
|
|
|
|
|
|
- function DisplayBareProperties(WebPage $oPage, $bEditMode = false)
|
|
|
+ function DisplayBareProperties(WebPage $oPage, $bEditMode = false, $sPrefix = '')
|
|
|
{
|
|
|
- $oPage->add($this->GetBareProperties($oPage, $bEditMode));
|
|
|
+ $aFieldsMap = $this->GetBareProperties($oPage, $bEditMode, $sPrefix);
|
|
|
|
|
|
// Special case to display the case log, if any...
|
|
|
// WARNING: if you modify the loop below, also check the corresponding code in UpdateObject and DisplayModifyForm
|
|
@@ -214,7 +214,7 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay
|
|
|
{
|
|
|
if ($oAttDef instanceof AttributeCaseLog)
|
|
|
{
|
|
|
- $this->DisplayCaseLog($oPage, $sAttCode, '', '', false);
|
|
|
+ $this->DisplayCaseLog($oPage, $sAttCode, '', '', $bEditMode);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -222,6 +222,8 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay
|
|
|
{
|
|
|
$oExtensionInstance->OnDisplayProperties($this, $oPage, $bEditMode);
|
|
|
}
|
|
|
+
|
|
|
+ return $aFieldsMap;
|
|
|
}
|
|
|
|
|
|
function DisplayBareRelations(WebPage $oPage, $bEditMode = false)
|
|
@@ -382,7 +384,7 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- function GetBareProperties(WebPage $oPage, $bEditMode = false)
|
|
|
+ function GetBareProperties(WebPage $oPage, $bEditMode = false, $sPrefix)
|
|
|
{
|
|
|
$sHtml = '';
|
|
|
$oAppContext = new ApplicationContext();
|
|
@@ -396,6 +398,7 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay
|
|
|
$sHtml = '';
|
|
|
$aDetails = array();
|
|
|
$iInputId = 0;
|
|
|
+ $aFieldsMap = array();
|
|
|
foreach($aDetailsStruct as $sTab => $aCols )
|
|
|
{
|
|
|
$aDetails[$sTab] = array();
|
|
@@ -436,28 +439,94 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay
|
|
|
}
|
|
|
foreach($aFields as $sAttCode)
|
|
|
{
|
|
|
- $val = $this->GetFieldAsHtml($sClass, $sAttCode, $sStateAttCode);
|
|
|
- if ($val != null)
|
|
|
+ if ($bEditMode)
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ $sComments = isset($aFieldsComments[$sAttCode]) ? $aFieldsComments[$sAttCode] : ' ';
|
|
|
+ $sInfos = ' ';
|
|
|
+ $iFlags = $this->GetAttributeFlags($sAttCode);
|
|
|
+ $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
|
|
|
+ if ( (!$oAttDef->IsLinkSet()) && (($iFlags & OPT_ATT_HIDDEN) == 0))
|
|
|
{
|
|
|
- /*
|
|
|
- * Removed for now...
|
|
|
- // Check if the attribute is not mastered by a synchro...
|
|
|
- $aReasons = array();
|
|
|
- $iSynchroFlags = $this->GetSynchroReplicaFlags($sAttCode, $aReasons);
|
|
|
- $sSynchroIcon = '';
|
|
|
- if ($iSynchroFlags & OPT_ATT_SLAVE)
|
|
|
+ if ($oAttDef->IsWritable())
|
|
|
{
|
|
|
- $sSynchroIcon = " <img id=\"synchro_$iInputId\" src=\"../images/transp-lock.png\" style=\"vertical-align:middle\"/>";
|
|
|
- $sTip = '';
|
|
|
- foreach($aReasons as $aRow)
|
|
|
+ if ($sStateAttCode == $sAttCode)
|
|
|
{
|
|
|
- $sTip .= "<p>Synchronized with {$aRow['name']} - {$aRow['description']}</p>";
|
|
|
+ // State attribute is always read-only from the UI
|
|
|
+ $sHTMLValue = $this->GetStateLabel();
|
|
|
+ $val = array('label' => '<span>'.$oAttDef->GetLabel().'</span>', 'value' => $sHTMLValue, 'comments' => $sComments, 'infos' => $sInfos);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $sInputId = $this->m_iFormId.'_'.$sAttCode;
|
|
|
+ if ($iFlags & OPT_ATT_HIDDEN)
|
|
|
+ {
|
|
|
+ // Attribute is hidden, add a hidden input
|
|
|
+ $oPage->add('<input type="hidden" id="'.$sInputId.'" name="attr_'.$sPrefix.$sAttCode.'" value="'.htmlentities($this->Get($sAttCode), ENT_QUOTES, 'UTF-8').'"/>');
|
|
|
+ $aFieldsMap[$sAttCode] = $sInputId;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if ($iFlags & (OPT_ATT_READONLY|OPT_ATT_SLAVE))
|
|
|
+ {
|
|
|
+
|
|
|
+ // Check if the attribute is not read-only because of a synchro...
|
|
|
+ $aReasons = array();
|
|
|
+ $sSynchroIcon = '';
|
|
|
+ if ($iFlags & OPT_ATT_SLAVE)
|
|
|
+ {
|
|
|
+ $iSynchroFlags = $this->GetSynchroReplicaFlags($sAttCode, $aReasons);
|
|
|
+ $sSynchroIcon = " <img id=\"synchro_$sInputId\" src=\"../images/transp-lock.png\" style=\"vertical-align:middle\"/>";
|
|
|
+ $sTip = '';
|
|
|
+ foreach($aReasons as $aRow)
|
|
|
+ {
|
|
|
+ $sTip .= "<p>Synchronized with {$aRow['name']} - {$aRow['description']}</p>";
|
|
|
+ }
|
|
|
+ $oPage->add_ready_script("$('#synchro_$sInputId').qtip( { content: '$sTip', show: 'mouseover', hide: 'mouseout', style: { name: 'dark', tip: 'leftTop' }, position: { corner: { target: 'rightMiddle', tooltip: 'leftTop' }} } );");
|
|
|
+ }
|
|
|
+
|
|
|
+ // Attribute is read-only
|
|
|
+ $sHTMLValue = $this->GetAsHTML($sAttCode);
|
|
|
+ $sHTMLValue .= '<input type="hidden" id="'.$sInputId.'" name="attr_'.$sPrefix.$sAttCode.'" value="'.htmlentities($this->Get($sAttCode), ENT_QUOTES, 'UTF-8').'"/>';
|
|
|
+ $aFieldsMap[$sAttCode] = $sInputId;
|
|
|
+ $sComments = $sSynchroIcon;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $sValue = $this->Get($sAttCode);
|
|
|
+ $sDisplayValue = $this->GetEditValue($sAttCode);
|
|
|
+ $aArgs = array('this' => $this, 'formPrefix' => $sPrefix);
|
|
|
+ $sHTMLValue = "<span id=\"field_{$sInputId}\">".self::GetFormElementForField($oPage, $sClass, $sAttCode, $oAttDef, $sValue, $sDisplayValue, $sInputId, '', $iFlags, $aArgs).'</span>';
|
|
|
+ $aFieldsMap[$sAttCode] = $sInputId;
|
|
|
+
|
|
|
+ }
|
|
|
+ $val = array('label' => '<span title="'.$oAttDef->GetDescription().'">'.$oAttDef->GetLabel().'</span>', 'value' => $sHTMLValue, 'comments' => $sComments, 'infos' => $sInfos);
|
|
|
+ }
|
|
|
}
|
|
|
- $oPage->add_ready_script("$('#synchro_$iInputId').qtip( { content: '$sTip', show: 'mouseover', hide: 'mouseout', style: { name: 'dark', tip: 'leftTop' }, position: { corner: { target: 'rightMiddle', tooltip: 'leftTop' }} } );");
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $val = array('label' => '<span title="'.$oAttDef->GetDescription().'">'.$oAttDef->GetLabel().'</span>', 'value' => $this->GetAsHTML($sAttCode), 'comments' => $sComments, 'infos' => $sInfos);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $val = null; // Skip this field
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
- $val['comments'] = $sSynchroIcon;
|
|
|
- */
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // !bEditMode
|
|
|
+ $val = $this->GetFieldAsHtml($sClass, $sAttCode, $sStateAttCode);
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($val != null)
|
|
|
+ {
|
|
|
// The field is visible, add it to the current column
|
|
|
$aDetails[$sTab][$sColIndex][] = $val;
|
|
|
$iInputId++;
|
|
@@ -478,7 +547,7 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay
|
|
|
}
|
|
|
$oPage->add('</tr></table>');
|
|
|
}
|
|
|
- return $sHtml;
|
|
|
+ return $aFieldsMap;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1606,188 +1675,19 @@ EOF
|
|
|
{
|
|
|
$sFormAction = $aExtraParams['action'];
|
|
|
}
|
|
|
- $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");
|
|
|
-
|
|
|
- $oPage->AddTabContainer(OBJECT_PROPERTIES_TAB, $sPrefix);
|
|
|
- $oPage->SetCurrentTabContainer(OBJECT_PROPERTIES_TAB);
|
|
|
- $oPage->SetCurrentTab(Dict::S('UI:PropertiesTab'));
|
|
|
-// $aDetailsList = $this->FLattenZList(MetaModel::GetZListItems($sClass, 'details'));
|
|
|
- //$aFullList = MetaModel::ListAttributeDefs($sClass);
|
|
|
- $aList = array();
|
|
|
- // Compute the list of properties to display, first the attributes in the 'details' list, then
|
|
|
- // all the remaining attributes that are not external fields
|
|
|
-// foreach($aDetailsList as $sAttCode)
|
|
|
-// {
|
|
|
-// $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
|
|
|
-// if (!$oAttDef->IsExternalField())
|
|
|
-// {
|
|
|
-// $aList[] = $sAttCode;
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
- $aDetailsList = MetaModel::GetZListItems($sClass, 'details');
|
|
|
- $aDetailsStruct = self::ProcessZlist($aDetailsList, array('UI:PropertiesTab' => array()), 'UI:PropertiesTab', 'col1', '');
|
|
|
- $sHtml = '';
|
|
|
- $aDetails = array();
|
|
|
- foreach($aDetailsStruct as $sTab => $aCols )
|
|
|
- {
|
|
|
- $aDetails[$sTab] = array();
|
|
|
- ksort($aCols);
|
|
|
- $oPage->SetCurrentTab(Dict::S($sTab));
|
|
|
- $oPage->add('<table style="vertical-align:top"><tr>');
|
|
|
- foreach($aCols as $sColIndex => $aFieldsets)
|
|
|
- {
|
|
|
- $sLabel = '';
|
|
|
- $sPreviousLabel = '';
|
|
|
- $aDetails[$sTab][$sColIndex] = array();
|
|
|
- $oPage->add('<td style="vertical-align:top">');
|
|
|
- //$aDetails[$sTab][$sColIndex] = array();
|
|
|
- foreach($aFieldsets as $sFieldsetName => $aFields)
|
|
|
- {
|
|
|
- if (!empty($sFieldsetName) && ($sFieldsetName[0]!='_'))
|
|
|
- {
|
|
|
- $sLabel = $sFieldsetName;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $sLabel = '';
|
|
|
- }
|
|
|
- if ($sLabel != $sPreviousLabel)
|
|
|
- {
|
|
|
- if (!empty($sPreviousLabel))
|
|
|
- {
|
|
|
- $oPage->add('<fieldset>');
|
|
|
- $oPage->add('<legend>'.Dict::S($sPreviousLabel).'</legend>');
|
|
|
- }
|
|
|
- $oPage->Details($aDetails[$sTab][$sColIndex]);
|
|
|
- if (!empty($sPreviousLabel))
|
|
|
- {
|
|
|
- $oPage->add('</fieldset>');
|
|
|
- }
|
|
|
- $aDetails[$sTab][$sColIndex] = array();
|
|
|
- $sPreviousLabel = $sLabel;
|
|
|
- }
|
|
|
- foreach($aFields as $sAttCode)
|
|
|
- {
|
|
|
- $aVal = null;
|
|
|
- $sComments = isset($aFieldsComments[$sAttCode]) ? $aFieldsComments[$sAttCode] : ' ';
|
|
|
- $sInfos = ' ';
|
|
|
- $iFlags = $this->GetAttributeFlags($sAttCode);
|
|
|
- $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
|
|
|
- if ( (!$oAttDef->IsLinkSet()) && (($iFlags & OPT_ATT_HIDDEN) == 0))
|
|
|
- {
|
|
|
- if ($oAttDef->IsWritable())
|
|
|
- {
|
|
|
- if ($sStateAttCode == $sAttCode)
|
|
|
- {
|
|
|
- // State attribute is always read-only from the UI
|
|
|
- $sHTMLValue = $this->GetStateLabel();
|
|
|
- $aVal = array('label' => '<span>'.$oAttDef->GetLabel().'</span>', 'value' => $sHTMLValue, 'comments' => $sComments, 'infos' => $sInfos);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $sInputId = $this->m_iFormId.'_'.$sAttCode;
|
|
|
- if ($iFlags & OPT_ATT_HIDDEN)
|
|
|
- {
|
|
|
- // Attribute is hidden, add a hidden input
|
|
|
- $oPage->add('<input type="hidden" id="'.$sInputId.'" name="attr_'.$sPrefix.$sAttCode.'" value="'.htmlentities($this->Get($sAttCode), ENT_QUOTES, 'UTF-8').'"/>');
|
|
|
- $aFieldsMap[$sAttCode] = $sInputId;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if ($iFlags & (OPT_ATT_READONLY|OPT_ATT_SLAVE))
|
|
|
- {
|
|
|
-
|
|
|
- // Check if the attribute is not read-only because of a synchro...
|
|
|
- $aReasons = array();
|
|
|
- $sSynchroIcon = '';
|
|
|
- if ($iFlags & OPT_ATT_SLAVE)
|
|
|
- {
|
|
|
- $iSynchroFlags = $this->GetSynchroReplicaFlags($sAttCode, $aReasons);
|
|
|
- $sSynchroIcon = " <img id=\"synchro_$sInputId\" src=\"../images/transp-lock.png\" style=\"vertical-align:middle\"/>";
|
|
|
- $sTip = '';
|
|
|
- foreach($aReasons as $aRow)
|
|
|
- {
|
|
|
- $sTip .= "<p>Synchronized with {$aRow['name']} - {$aRow['description']}</p>";
|
|
|
- }
|
|
|
- $oPage->add_ready_script("$('#synchro_$sInputId').qtip( { content: '$sTip', show: 'mouseover', hide: 'mouseout', style: { name: 'dark', tip: 'leftTop' }, position: { corner: { target: 'rightMiddle', tooltip: 'leftTop' }} } );");
|
|
|
- }
|
|
|
-
|
|
|
- // Attribute is read-only
|
|
|
- $sHTMLValue = $this->GetAsHTML($sAttCode);
|
|
|
- $sHTMLValue .= '<input type="hidden" id="'.$sInputId.'" name="attr_'.$sPrefix.$sAttCode.'" value="'.htmlentities($this->Get($sAttCode), ENT_QUOTES, 'UTF-8').'"/>';
|
|
|
- $aFieldsMap[$sAttCode] = $sInputId;
|
|
|
- $sComments = $sSynchroIcon;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $sValue = $this->Get($sAttCode);
|
|
|
- $sDisplayValue = $this->GetEditValue($sAttCode);
|
|
|
- $aArgs = array('this' => $this, 'formPrefix' => $sPrefix);
|
|
|
- $sHTMLValue = "<span id=\"field_{$sInputId}\">".self::GetFormElementForField($oPage, $sClass, $sAttCode, $oAttDef, $sValue, $sDisplayValue, $sInputId, '', $iFlags, $aArgs).'</span>';
|
|
|
- $aFieldsMap[$sAttCode] = $sInputId;
|
|
|
-
|
|
|
- }
|
|
|
- $aVal = array('label' => '<span title="'.$oAttDef->GetDescription().'">'.$oAttDef->GetLabel().'</span>', 'value' => $sHTMLValue, 'comments' => $sComments, 'infos' => $sInfos);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $aVal = array('label' => '<span title="'.$oAttDef->GetDescription().'">'.$oAttDef->GetLabel().'</span>', 'value' => $this->GetAsHTML($sAttCode), 'comments' => $sComments, 'infos' => $sInfos);
|
|
|
- }
|
|
|
- }
|
|
|
- if ($aVal != null)
|
|
|
- {
|
|
|
- // The field is visible, add it to the current column
|
|
|
- $aDetails[$sTab][$sColIndex][] = $aVal;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (!empty($sPreviousLabel))
|
|
|
- {
|
|
|
- $oPage->add('<fieldset>');
|
|
|
- $oPage->add('<legend>'.Dict::S($sPreviousLabel).'</legend>');
|
|
|
- }
|
|
|
- $oPage->Details($aDetails[$sTab][$sColIndex]);
|
|
|
- if (!empty($sPreviousLabel))
|
|
|
- {
|
|
|
- $oPage->add('</fieldset>');
|
|
|
- }
|
|
|
- $oPage->add('</td>');
|
|
|
- }
|
|
|
- $oPage->add('</tr></table>');
|
|
|
- }
|
|
|
-
|
|
|
- // Special case to display the case log, if any...
|
|
|
- // WARNING: if you modify the loop below, also check the corresponding code in UpdateObject and DisplayDetails
|
|
|
- foreach(MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef)
|
|
|
+ // Custom label for the apply button ?
|
|
|
+ if (isset($aExtraParams['custom_button']))
|
|
|
{
|
|
|
- if ($oAttDef instanceof AttributeCaseLog)
|
|
|
- {
|
|
|
- $sComments = isset($aFieldsComments[$sAttCode]) ? $aFieldsComments[$sAttCode] : ' ';
|
|
|
- $this->DisplayCaseLog($oPage, $sAttCode, $sComments, $sPrefix, true);
|
|
|
- $sInputId = $this->m_iFormId.'_'.$sAttCode;
|
|
|
- $aFieldsMap[$sAttCode] = $sInputId;
|
|
|
- }
|
|
|
+ $sApplyButton = $aExtraParams['custom_button'];
|
|
|
}
|
|
|
- // Now display the relations, one tab per relation
|
|
|
- if (!isset($aExtraParams['noRelations']))
|
|
|
+ else if ($iKey > 0)
|
|
|
{
|
|
|
- $this->DisplayBareRelations($oPage, true); // Edit mode
|
|
|
+ $sApplyButton = Dict::S('UI:Button:Apply');
|
|
|
}
|
|
|
-
|
|
|
- $oPage->SetCurrentTab('');
|
|
|
- $oPage->add("<input type=\"hidden\" name=\"class\" value=\"$sClass\">\n");
|
|
|
- $oPage->add("<input type=\"hidden\" name=\"transaction_id\" value=\"$iTransactionId\">\n");
|
|
|
- foreach($aExtraParams as $sName => $value)
|
|
|
+ else
|
|
|
{
|
|
|
- $oPage->add("<input type=\"hidden\" name=\"$sName\" value=\"$value\">\n");
|
|
|
+ $sApplyButton = Dict::S('UI:Button:Create');
|
|
|
}
|
|
|
- $oPage->add($oAppContext->GetForForm());
|
|
|
// Custom operation for the form ?
|
|
|
if (isset($aExtraParams['custom_operation']))
|
|
|
{
|
|
@@ -1801,36 +1701,58 @@ EOF
|
|
|
{
|
|
|
$sOperation = 'apply_new';
|
|
|
}
|
|
|
-
|
|
|
- // Custom label for the apply button ?
|
|
|
- if (isset($aExtraParams['custom_button']))
|
|
|
+ if ($iKey > 0)
|
|
|
{
|
|
|
- $sApplyButton = $aExtraParams['custom_button'];
|
|
|
+ // The object already exists in the database, it's a modification
|
|
|
+ $sButtons = "<input type=\"hidden\" name=\"id\" value=\"$iKey\">\n";
|
|
|
+ $sButtons .= "<input type=\"hidden\" name=\"operation\" value=\"{$sOperation}\">\n";
|
|
|
+ $sButtons .= "<button type=\"button\" class=\"action cancel\"><span>".Dict::S('UI:Button:Cancel')."</span></button> \n";
|
|
|
+ $sButtons .= "<button type=\"submit\" class=\"action\"><span>{$sApplyButton}</span></button>\n";
|
|
|
}
|
|
|
- else if ($iKey > 0)
|
|
|
+ else
|
|
|
{
|
|
|
- $sApplyButton = Dict::S('UI:Button:Apply');
|
|
|
+ // The object does not exist in the database it's a creation
|
|
|
+ $sButtons = "<input type=\"hidden\" name=\"operation\" value=\"$sOperation\">\n";
|
|
|
+ $sButtons .= "<button type=\"button\" class=\"action cancel\">".Dict::S('UI:Button:Cancel')."</button> \n";
|
|
|
+ $sButtons .= "<button type=\"submit\" class=\"action\"><span>{$sApplyButton}</span></button>\n";
|
|
|
}
|
|
|
- else
|
|
|
+
|
|
|
+
|
|
|
+ $bDisplayActionsAtTop = MetaModel::GetConfig()->Get('display_actions_at_top');
|
|
|
+ $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)
|
|
|
{
|
|
|
- $sApplyButton = Dict::S('UI:Button:Create');
|
|
|
+ $oPage->add($sButtons);
|
|
|
}
|
|
|
|
|
|
- if ($iKey > 0)
|
|
|
+ $oPage->AddTabContainer(OBJECT_PROPERTIES_TAB, $sPrefix);
|
|
|
+ $oPage->SetCurrentTabContainer(OBJECT_PROPERTIES_TAB);
|
|
|
+ $oPage->SetCurrentTab(Dict::S('UI:PropertiesTab'));
|
|
|
+
|
|
|
+ $aFieldsMap = $this->DisplayBareProperties($oPage, true, $sPrefix);
|
|
|
+ // Now display the relations, one tab per relation
|
|
|
+ if (!isset($aExtraParams['noRelations']))
|
|
|
{
|
|
|
- // The object already exists in the database, it's a modification
|
|
|
- $oPage->add("<input type=\"hidden\" name=\"id\" value=\"$iKey\">\n");
|
|
|
- $oPage->add("<input type=\"hidden\" name=\"operation\" value=\"{$sOperation}\">\n");
|
|
|
- $oPage->add("<button type=\"button\" class=\"action cancel\"><span>".Dict::S('UI:Button:Cancel')."</span></button> \n");
|
|
|
- $oPage->add("<button type=\"submit\" class=\"action\"><span>{$sApplyButton}</span></button>\n");
|
|
|
+ $this->DisplayBareRelations($oPage, true); // Edit mode
|
|
|
}
|
|
|
- else
|
|
|
+
|
|
|
+ $oPage->SetCurrentTab('');
|
|
|
+ $oPage->add("<input type=\"hidden\" name=\"class\" value=\"$sClass\">\n");
|
|
|
+ $oPage->add("<input type=\"hidden\" name=\"transaction_id\" value=\"$iTransactionId\">\n");
|
|
|
+ foreach($aExtraParams as $sName => $value)
|
|
|
{
|
|
|
- // The object does not exist in the database it's a creation
|
|
|
- $oPage->add("<input type=\"hidden\" name=\"operation\" value=\"$sOperation\">\n");
|
|
|
- $oPage->add("<button type=\"button\" class=\"action cancel\">".Dict::S('UI:Button:Cancel')."</button> \n");
|
|
|
- $oPage->add("<button type=\"submit\" class=\"action\"><span>{$sApplyButton}</span></button>\n");
|
|
|
+ $oPage->add("<input type=\"hidden\" name=\"$sName\" value=\"$value\">\n");
|
|
|
}
|
|
|
+ $oPage->add($oAppContext->GetForForm());
|
|
|
+ if ($bDisplayActionsAtTop)
|
|
|
+ {
|
|
|
+ $oPage->add($sButtons);
|
|
|
+ }
|
|
|
+
|
|
|
// Hook the cancel button via jQuery so that it can be unhooked easily as well if needed
|
|
|
$sDefaultUrl = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?operation=cancel&'.$oAppContext->GetForLink();
|
|
|
$oPage->add_ready_script("$('#form_{$this->m_iFormId} button.cancel').click( function() { BackToDetails('$sClass', $iKey, '$sDefaultUrl')} );");
|