diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index af4c631af..49073cfb1 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -2251,17 +2251,9 @@ HTML; break; case 'CustomFields': - $sHTMLValue = '
| ';
$sHTMLValue .= ' ';
$sHTMLValue .= ' ';
- $sHTMLValue .= '';
- $sHTMLValue .= ' ';
- $sHTMLValue .= ' | ';
- $sHTMLValue .= ''.$sReloadSpan.' | '; // No validation span for this one: it does handle its own validation! - $sHTMLValue .= '
| '); - } - $oOutput->AddHtml(' | ');
+ $oBlock = FieldUIBlockFactory::MakeStandard($this->oField->GetLabel());
+ $oBlock->SetValueId($this->oField->GetGlobalId());
+ $oBlock->AddDataAttribute("input-id",$this->oField->GetGlobalId());
+
$sEditType = 'none';
if ($this->oField->GetReadOnly())
{
+ $oBlock->AddDataAttribute("input-type","Combodo\\iTop\\Form\\Field\\SelectObjectField\readonly");
$oSearch = $this->oField->GetSearch()->DeepClone();
$oSearch->AddCondition('id', $this->oField->GetCurrentValue());
$oSet = new DBObjectSet($oSearch);
@@ -61,15 +68,17 @@ class ConsoleSelectObjectFieldRenderer extends FieldRenderer
{
$sCurrentLabel = '';
}
- $oOutput->AddHtml('');
- $oOutput->AddHtml(''.htmlentities($sCurrentLabel, ENT_QUOTES, 'UTF-8').'');
+ $oValue = UIContentBlockUIBlockFactory::MakeStandard();
+ $oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden("",$this->oField->GetCurrentValue(),$this->oField->GetGlobalId()));
+ $oValue->AddSubBlock(new Html($sCurrentLabel));
+ $oBlock->SetValue($oValue);
}
else
{
$oSearch = $this->oField->GetSearch()->DeepClone();
$oSearch->SetModifierProperty('UserRightsGetSelectFilter', 'bSearchMode', true);
- $oSet = new \DBObjectSet($oSearch);
+ $oSet = new DBObjectSet($oSearch);
$oSet->ApplyParameters();
$oSet->OptimizeColumnLoad(array($oSearch->GetClassAlias() => array('friendlyname')));
@@ -82,6 +91,7 @@ class ConsoleSelectObjectFieldRenderer extends FieldRenderer
{
// Auto-complete
//
+ $oBlock->AddDataAttribute("input-type","Combodo\\iTop\\Form\\Field\\SelectObjectField\\Autocomplete");
$sEditType = 'autocomplete';
$aExtKeyParams = array();
$aExtKeyParams['iFieldSize'] = 10;
@@ -89,14 +99,17 @@ class ConsoleSelectObjectFieldRenderer extends FieldRenderer
$sFieldName = $this->oField->GetGlobalId();
$sFieldId = $sFieldName;
$sFormPrefix = '';
- $oWidget = new \UIExtKeyWidget($sTargetClass, $sFieldId, '', true);
+ $oWidget = new UIExtKeyWidget($sTargetClass, $sFieldId, '', true);
$aArgs = array();
$sTitle = $this->oField->GetLabel();
- require_once(APPROOT.'application/capturewebpage.class.inc.php');
- $oPage = new \CaptureWebPage();
+
+ $oPage = new CaptureWebPage();
$sHTMLValue = $oWidget->DisplaySelect($oPage, $iMaxComboLength, false /* $bAllowTargetCreation */, $sTitle, $oSet, $this->oField->GetCurrentValue(), $this->oField->GetMandatory(), $sFieldName, $sFormPrefix, $aArgs);
- $oOutput->AddHtml($sHTMLValue);
- $oOutput->AddHtml($oPage->GetHtml());
+ $oValue = UIContentBlockUIBlockFactory::MakeStandard();
+ $oValue->AddSubBlock(new Html($sHTMLValue));
+ $oValue->AddSubBlock(new Html($oPage->GetHtml()));
+ $oBlock->AddSubBlock($oValue);
+
$oOutput->AddJs($oPage->GetJS());
$oOutput->AddJs($oPage->GetReadyJS());
foreach ($oPage->GetCSS() as $sCss)
@@ -114,6 +127,7 @@ class ConsoleSelectObjectFieldRenderer extends FieldRenderer
}
elseif($this->oField->GetControlType() == SelectObjectField::CONTROL_RADIO_VERTICAL)
{
+ $oBlock->AddDataAttribute("input-type","Combodo\\iTop\\Form\\Field\\SelectObjectField\\Radio");
// Radio buttons (vertical)
//
$sEditType = 'radio';
@@ -122,6 +136,10 @@ class ConsoleSelectObjectFieldRenderer extends FieldRenderer
$bMandatory = $this->oField->GetMandatory();
$value = $this->oField->GetCurrentValue();
$sId = $this->oField->GetGlobalId();
+
+ $oValue = UIContentBlockUIBlockFactory::MakeStandard();
+ $oBlock->SetValue($oValue);
+
$oOutput->AddHtml(' ');
while ($oObject = $oSet->Fetch())
{
@@ -137,32 +155,42 @@ class ConsoleSelectObjectFieldRenderer extends FieldRenderer
{
$sSelected = ($value == $iObject) ? 'checked' : '';
}
- $oOutput->AddHtml(" ");
+ $oRadioCustom = InputUIBlockFactory::MakeForInputWithLabel($sLabel, "radio_$sId", $iObject, "{$sId}_{$iObject}", "radio");
+ $oRadioCustom->GetInput()->SetIsChecked($sSelected);
+ $oRadioCustom->SetBeforeInput(false);
+ $oRadioCustom->GetInput()->AddCSSClass('ibo-input-checkbox');
+ $oValue->AddSubBlock($oRadioCustom);
+ $oOutput->AddJs(
+ << ');
- $oOutput->AddHtml("");
+ $oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden($sId,$value,$sId));
}
else
{
// Drop-down select
//
+ $oBlock->AddDataAttribute("input-type","Combodo\\iTop\\Form\\Field\\SelectObjectField\\Select");
$sEditType = 'select';
- $oOutput->AddHtml('');
}
$oOutput->AddJs(
<<\n"); + $oValue->AddSubBlock(new Html(" ")); } $idx++; } - $oOutput->AddHtml(' | ');
-
- $oOutput->AddHtml('
| '); - } + $oBlock = FieldUIBlockFactory::MakeStandard($this->oField->GetLabel()); + $oBlock->AddDataAttribute("input-id",$this->oField->GetGlobalId()); + $oBlock->AddDataAttribute("input-type",$sFieldClass); switch ($sFieldClass) { case 'Combodo\\iTop\\Form\\Field\\DateTimeField': + $oValue = UIContentBlockUIBlockFactory::MakeStandard("",["form-field-content"]); + $sDateTimeFormat = $this->oField->GetPHPDateTimeFormat(); $oFormat = new DateTimeFormat($sDateTimeFormat); $sPlaceHolder = $oFormat->ToPlaceholder(); - $oOutput->AddHtml(' | '); if ($this->oField->GetReadOnly()) { - $oOutput->AddHtml(''); - $oOutput->AddHtml(''.htmlentities($this->oField->GetCurrentValue(), ENT_QUOTES, 'UTF-8').''); - } else { - $oOutput->AddHtml(''); + $oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden("",$this->oField->GetCurrentValue(),$this->oField->GetGlobalId())); + $oValue->AddSubBlock(new Html($this->oField->GetCurrentValue())); } - $oOutput->AddHtml(''); - $oOutput->AddHtml(' | '); - break; + else + { + $oField = UIContentBlockUIBlockFactory::MakeStandard("",["field_input_zone", "field_input_datetime", "ibo-input-wrapper", "ibo-input-datetime-wrapper"]); + $oValue->AddSubBlock($oField); + $oField->AddSubBlock(new Html('')); + $oField->AddSubBlock(new Html('')); + } + $oBlock->AddSubBlock($oValue); + break; case 'Combodo\\iTop\\Form\\Field\\LabelField': - $oOutput->AddHtml(''); - $oOutput->AddHtml(''.htmlentities($this->oField->GetCurrentValue(), ENT_QUOTES, 'UTF-8').''); - $oOutput->AddHtml(''); - $oOutput->AddHtml(' | '); + $oValue = UIContentBlockUIBlockFactory::MakeStandard("",[""]); + $oBlock->AddSubBlock($oValue); + $oValue->AddSubBlock(new Text($this->oField->GetCurrentValue())); + $oValue->AddSubBlock(new Html('')); break; case 'Combodo\\iTop\\Form\\Field\\StringField': - $oOutput->AddHtml(''); - if ($this->oField->GetReadOnly()) { - $oOutput->AddHtml(''); - $oOutput->AddHtml(''.htmlentities($this->oField->GetCurrentValue(), ENT_QUOTES, 'UTF-8').''); - } else { - $oOutput->AddHtml(''); + $oValue = UIContentBlockUIBlockFactory::MakeStandard("",[""]); + + if ($this->oField->GetReadOnly()) + { + $oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden("",$this->oField->GetCurrentValue(),$this->oField->GetGlobalId())); + $oValue->AddSubBlock(new Html($this->oField->GetCurrentValue())); } - $oOutput->AddHtml(''); - $oOutput->AddHtml(' | '); + else + { + $oValue->AddSubBlock(InputUIBlockFactory::MakeStandard("text","", $this->oField->GetCurrentValue(),$this->oField->GetGlobalId())); + $oValue->AddSubBlock(new Html('')); + } + $oBlock->AddSubBlock($oValue); break; case 'Combodo\\iTop\\Form\\Field\\TextAreaField': + $oValue = UIContentBlockUIBlockFactory::MakeStandard("",["form-field-content"]); + $bRichEditor = ($this->oField->GetFormat() === TextAreaField::ENUM_FORMAT_HTML); - $oOutput->AddHtml('');
- if ($this->oField->GetReadOnly()) {
- $oOutput->AddHtml('');
- } else
+ $oText = new TextArea("",$this->oField->GetCurrentValue(),$this->oField->GetGlobalId(),40,8);
+ $oValue->AddSubBlock($oText);
+ if ($this->oField->GetReadOnly())
+ {
+ $oText->SetIsDisabled(true);
+ }
+ else
{
- $oOutput->AddHtml('');
// Some additional stuff if we are displaying it with a rich editor
if ($bRichEditor)
{
@@ -110,7 +128,7 @@ class ConsoleSimpleFieldRenderer extends FieldRenderer
$oOutput->AddJs(
<< | ');
+ $oBlock->AddSubBlock($oValue);
break;
case 'Combodo\\iTop\\Form\\Field\\SelectField':
- $oOutput->AddHtml(''); + $oValue = UIContentBlockUIBlockFactory::MakeStandard("",["form-field-content"]); if ($this->oField->GetReadOnly()) { $aChoices = $this->oField->GetChoices(); $sCurrentLabel = isset($aChoices[$this->oField->GetCurrentValue()]) ? $aChoices[$this->oField->GetCurrentValue()] : '' ; - $oOutput->AddHtml(''); - $oOutput->AddHtml(''.htmlentities($sCurrentLabel, ENT_QUOTES, 'UTF-8').''); + $oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden("",$this->oField->GetCurrentValue(),$this->oField->GetGlobalId())); + $oValue->AddSubBlock(new Html($sCurrentLabel)); } else { - $oOutput->AddHtml(''); + $oValue->AddSubBlock($oSelect); + $oValue->AddSubBlock(new Html('')); } - $oOutput->AddHtml(''); - $oOutput->AddHtml(' | '); + $oBlock->AddSubBlock($oValue); break; case 'Combodo\\iTop\\Form\\Field\\RadioField': - $oOutput->AddHtml('');
+ $oValue = UIContentBlockUIBlockFactory::MakeStandard("",["form-field-content"]);
if ($this->oField->GetReadOnly())
{
$aChoices = $this->oField->GetChoices();
$sCurrentLabel = isset($aChoices[$this->oField->GetCurrentValue()]) ? $aChoices[$this->oField->GetCurrentValue()] : '' ;
- $oOutput->AddHtml('');
- $oOutput->AddHtml(''.htmlentities($sCurrentLabel, ENT_QUOTES, 'UTF-8').'');
+ $oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden("",$this->oField->GetCurrentValue(),$this->oField->GetGlobalId()));
+ $oValue->AddSubBlock(new Html($sCurrentLabel));
}
else
{
@@ -163,7 +183,6 @@ EOF
$bMandatory = $this->oField->GetMandatory();
$value = $this->oField->GetCurrentValue();
$sId = $this->oField->GetGlobalId();
- $oOutput->AddHtml(' ');
$aChoices = $this->oField->GetChoices();
foreach ($aChoices as $sChoice => $sLabel)
{
@@ -177,30 +196,32 @@ EOF
{
$sSelected = ($value == $sChoice) ? 'checked' : '';
}
- $oOutput->AddHtml(" ");
+ $oRadio=InputUIBlockFactory::MakeForInputWithLabel($sLabel,"radio_".$sId, $sChoice,"{$sId}_{$idx}","radio" );;
+ $oRadio->GetInput()->SetIsChecked($sSelected);
+ $oRadio->SetBeforeInput(false);
+ $oRadio->GetInput()->AddCSSClass('ibo-input-checkbox');
+ $oValue->AddSubBlock($oRadio);
if ($bVertical)
{
- $oOutput->AddHtml(" ');
- $oOutput->AddHtml("");
+ $oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden("",$value,$sId));
+ $oValue->AddSubBlock(new Html(''));
}
- $oOutput->AddHtml('');
- $oOutput->AddHtml('\n"); + $oValue->AddSubBlock(new Html(" ")); } $idx++; } - $oOutput->AddHtml(' | ');
+ $oBlock->AddSubBlock($oValue);
break;
case 'Combodo\\iTop\\Form\\Field\\DurationField':
- $oOutput->AddHtml(''); + $oValue = UIContentBlockUIBlockFactory::MakeStandard("",["form-field-content"]); $value = $this->oField->GetCurrentValue(); if ($this->oField->GetReadOnly()) { - $oOutput->AddHtml(''); - $oOutput->AddHtml(''.htmlentities(\AttributeDuration::FormatDuration($value), ENT_QUOTES, 'UTF-8').''); + $oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden("",$value,$this->oField->GetGlobalId())); + $oValue->AddSubBlock(new Html(AttributeDuration::FormatDuration($value))); } - else - { + else { $sId = $this->oField->GetGlobalId(); $aVal = AttributeDuration::SplitDuration($value); @@ -208,21 +229,22 @@ EOF $sHours = ""; $sMinutes = ""; $sSeconds = ""; - $oOutput->AddHtml(Dict::Format('UI:DurationForm_Days_Hours_Minutes_Seconds', $sDays, $sHours, $sMinutes, $sSeconds)); - $oOutput->AddHtml(""); + $oTime = UIContentBlockUIBlockFactory::MakeStandard("",["pt-2"]); + $oTime->AddSubBlock(new Html(Dict::Format('UI:DurationForm_Days_Hours_Minutes_Seconds', $sDays, $sHours, $sMinutes, $sSeconds))); + $oValue->AddSubBlock($oTime); + $oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden("",$value,$sId)); $oOutput->AddJs("$('#{$sId}_d').on('keyup change', function(evt, sFormId) { return UpdateDuration('$sId'); });"); $oOutput->AddJs("$('#{$sId}_h').on('keyup change', function(evt, sFormId) { return UpdateDuration('$sId'); });"); $oOutput->AddJs("$('#{$sId}_m').on('keyup change', function(evt, sFormId) { return UpdateDuration('$sId'); });"); $oOutput->AddJs("$('#{$sId}_s').on('keyup change', function(evt, sFormId) { return UpdateDuration('$sId'); });"); $oOutput->AddJs("$('#{$sId}').on('update', function(evt, sFormId) { return ToggleDurationField('$sId'); });"); + $oValue->AddSubBlock(new Html('')); } - $oOutput->AddHtml(''); - $oOutput->AddHtml(' | '); + $oBlock->AddSubBlock($oValue); break; } - $oOutput->AddHtml('