N°635 Portal: Forms now have 2 differents layout (display_mode), see online documentation (when released) for more information.

Note: This is a first step, some refactoring could be done soon.

SVN:trunk[4735]
This commit is contained in:
Guillaume Lajarige
2017-05-15 12:50:09 +00:00
parent 17fbc504e2
commit 50970810d2
15 changed files with 427 additions and 230 deletions

View File

@@ -50,6 +50,7 @@ class BsSelectObjectFieldRenderer extends FieldRenderer
$oOutput = new RenderingOutput();
$sFieldValueClass = $this->oField->GetSearch()->GetClass();
$sFieldMandatoryClass = ($this->oField->GetMandatory()) ? 'form_mandatory' : '';
$sFieldContainerClass = ($this->oField->IsHorizontalDisplayMode() && !$this->oField->GetHidden()) ? 'row' : '';
$iFieldControlType = $this->oField->GetControlType();
// TODO : Remove this when hierarchical search supported
@@ -59,11 +60,19 @@ class BsSelectObjectFieldRenderer extends FieldRenderer
if (!$this->oField->GetReadOnly() && !$this->oField->GetHidden())
{
// Rendering field
$oOutput->AddHtml('<div class="form-group ' . $sFieldMandatoryClass . '">');
// - Opening container
$oOutput->AddHtml('<div class="form-group form_group_small ' . $sFieldMandatoryClass . ' ' . $sFieldContainerClass . '">');
// Label
if($this->oField->IsHorizontalDisplayMode()){ $oOutput->AddHtml('<div class="col-sm-3">'); }
if ($this->oField->GetLabel() !== '')
{
$oOutput->AddHtml('<label for="' . $this->oField->GetGlobalId() . '" class="control-label">')->AddHtml($this->oField->GetLabel(), true)->AddHtml('</label>');
}
if($this->oField->IsHorizontalDisplayMode()){ $oOutput->AddHtml('</div>'); }
// Value
if($this->oField->IsHorizontalDisplayMode()){ $oOutput->AddHtml('<div class="col-sm-9">'); }
$oOutput->AddHtml('<div class="help-block"></div>');
// - As a select
// TODO : This should be changed when we do the radio button display. For now we display everything with select
@@ -77,7 +86,7 @@ class BsSelectObjectFieldRenderer extends FieldRenderer
// Note : Autocomplete/Search is disabled for template fields as they are not external keys, thus they will just be displayed as regular select.
$bRegularSelect = ( ($iSetCount <= $this->oField->GetMaximumComboLength()) || ($this->oField->GetSearchEndpoint() === null) || ($this->oField->GetSearchEndpoint() === '') );
unset($oCountSet);
$bRegularSelect=false;
// - For regular select
if ($bRegularSelect)
{
@@ -158,24 +167,18 @@ EOF
}
// HTML for autocomplete part
// - Opening row
$oOutput->AddHtml('<div class="row">');
// - Rendering autocomplete search
$oOutput->AddHtml('<div class="col-xs-' . ( $this->oField->GetHierarchical() ? 9 : 10 ) . ' col-sm-' . ( $this->oField->GetHierarchical() ? 8 : 9 ) . ' col-md-' . ( $this->oField->GetHierarchical() ? 8 : 10 ) . ' col-lg-' . ( $this->oField->GetHierarchical() ? 9 : 10 ) . '">');
$oOutput->AddHtml('<input type="text" id="' . $sAutocompleteFieldId . '" name="' . $sAutocompleteFieldId . '" value="')->AddHtml($sFieldValue)->AddHtml('" data-target-id="' . $this->oField->GetGlobalId() . ' "class="form-control" />');
$oOutput->AddHtml('<input type="hidden" id="' . $this->oField->GetGlobalId() . '" name="' . $this->oField->GetId() . '" value="' . $this->oField->GetCurrentValue() . '" />');
$oOutput->AddHtml('</div>');
// - Rendering buttons
$oOutput->AddHtml('<div class="col-xs-' . ( $this->oField->GetHierarchical() ? 3 : 2 ) . ' col-sm-' . ( $this->oField->GetHierarchical() ? 4 : 3 ) . ' col-md-' . ( $this->oField->GetHierarchical() ? 4 : 2 ) . ' col-lg-' . ( $this->oField->GetHierarchical() ? 3 : 2 ) . ' text-right">');
$oOutput->AddHtml('<div class="btn-group" role="group">');
// - Rendering hierarchy button
$this->RenderHierarchicalSearch($oOutput);
// - Rendering regular search
$this->RenderRegularSearch($oOutput);
$oOutput->AddHtml('</div>');
$oOutput->AddHtml('</div>');
// - Closing row
$oOutput->AddHtml('</div>');
// - Opening input group
$oOutput->AddHtml('<div class="input-group selectobject">');
// - Rendering autocomplete search
$oOutput->AddHtml('<input type="text" id="' . $sAutocompleteFieldId . '" name="' . $sAutocompleteFieldId . '" value="')->AddHtml($sFieldValue)->AddHtml('" data-target-id="' . $this->oField->GetGlobalId() . ' "class="form-control" />');
$oOutput->AddHtml('<input type="hidden" id="' . $this->oField->GetGlobalId() . '" name="' . $this->oField->GetId() . '" value="' . $this->oField->GetCurrentValue() . '" />');
// - Rendering buttons
// - Rendering hierarchy button
$this->RenderHierarchicalSearch($oOutput);
// - Rendering regular search
$this->RenderRegularSearch($oOutput);
// - Closing input group
$oOutput->AddHtml('</div>');
// JS FieldChange trigger (:input are not always at the same depth)
// Note : Not used for that field type
@@ -296,6 +299,9 @@ EOF
);
}
}
if($this->oField->IsHorizontalDisplayMode()){ $oOutput->AddHtml('</div>'); }
// - Closing container
$oOutput->AddHtml('</div>');
}
// ... and in read-only mode (or hidden)
@@ -313,19 +319,31 @@ EOF
$sFieldValue = Dict::S('UI:UndefinedObject');
}
$oOutput->AddHtml('<div class="form-group">');
// Opening container
$oOutput->AddHtml('<div class="form-group form_group_small ' . $sFieldContainerClass . '">');
// Showing label / value only if read-only but not hidden
if (!$this->oField->GetHidden())
{
// Label
if($this->oField->IsHorizontalDisplayMode()){ $oOutput->AddHtml('<div class="col-sm-3">'); }
if ($this->oField->GetLabel() !== '')
{
$oOutput->AddHtml('<label for="' . $this->oField->GetGlobalId() . '" class="control-label">')->AddHtml($this->oField->GetLabel(), true)->AddHtml('</label>');
}
$oOutput->AddHtml('<div class="form-control-static">' . $sFieldValue . '</div>');
}
$oOutput->AddHtml('<input type="hidden" id="' . $this->oField->GetGlobalId() . '" name="' . $this->oField->GetId() . '" value="' . $this->oField->GetCurrentValue() . '" class="form-control" />');
$oOutput->AddHtml('</div>');
if($this->oField->IsHorizontalDisplayMode()){ $oOutput->AddHtml('</div>'); }
// Value
if($this->oField->IsHorizontalDisplayMode()){ $oOutput->AddHtml('<div class="col-sm-9">'); }
$oOutput->AddHtml('<div class="form-control-static">' . $sFieldValue . '</div>');
if($this->oField->IsHorizontalDisplayMode()){ $oOutput->AddHtml('</div>'); }
}
// Adding hidden value
$oOutput->AddHtml('<input type="hidden" id="' . $this->oField->GetGlobalId() . '" name="' . $this->oField->GetId() . '" value="' . $this->oField->GetCurrentValue() . '" class="form-control" />');
// Closing container
$oOutput->AddHtml('</div>');
// JS FieldChange trigger (:input are not always at the same depth)
$oOutput->AddJs(
@@ -362,12 +380,12 @@ EOF
*/
protected function RenderHierarchicalSearch(RenderingOutput &$oOutput)
{
if ($this->oField->GetHierarchical())
{
if ($this->oField->GetHierarchical())
{
$sHierarchicalButtonId = 's_hi_' . $this->oField->GetGlobalId();
$sEndpoint = str_replace('-sMode-', 'hierarchy', $this->oField->GetSearchEndpoint());
$oOutput->AddHtml('<button type="button" class="btn btn-default" id="' . $sHierarchicalButtonId . '"><span class="glyphicon glyphicon-ext-hierarchy"></span></button>');
$oOutput->AddHtml('<div class="input-group-addon" id="' . $sHierarchicalButtonId . '"><span class="fa fa-sitemap"></span></div>');
$oOutput->AddJs(
<<<EOF
@@ -411,8 +429,8 @@ EOF
$sSearchButtonId = 's_rg_' . $this->oField->GetGlobalId();
$sEndpoint = str_replace('-sMode-', 'from-attribute', $this->oField->GetSearchEndpoint());
$oOutput->AddHtml('<button type="button" class="btn btn-default" id="' . $sSearchButtonId . '"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button>');
$oOutput->AddHtml('<div class="input-group-addon" id="' . $sSearchButtonId . '"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></div>');
$oOutput->AddJs(
<<<EOF
$('#{$sSearchButtonId}').off('click').on('click', function(){

View File

@@ -1,6 +1,6 @@
<?php
// Copyright (C) 2010-2016 Combodo SARL
// Copyright (C) 2010-2017 Combodo SARL
//
// This file is part of iTop.
//
@@ -47,58 +47,81 @@ class BsSimpleFieldRenderer extends FieldRenderer
$oOutput = new RenderingOutput();
$sFieldClass = get_class($this->oField);
$sFieldMandatoryClass = ($this->oField->GetMandatory()) ? 'form_mandatory' : '';
$sFieldContainerClass = ($this->oField->IsHorizontalDisplayMode() && !$this->oField->GetHidden()) ? 'row' : '';
// Rendering field in edition mode
if (!$this->oField->GetReadOnly() && !$this->oField->GetHidden())
{
switch ($sFieldClass)
{
case 'Combodo\\iTop\\Form\\Field\\DateTimeField':
$oOutput->AddHtml('<div class="form-group ' . $sFieldMandatoryClass . '">');
if ($this->oField->GetLabel() !== '')
{
$oOutput->AddHtml('<label for="' . $this->oField->GetGlobalId() . '" class="control-label">')->AddHtml($this->oField->GetLabel(), true)->AddHtml('</label>');
}
$oOutput->AddHtml('<div class="help-block"></div>');
$oOutput->AddHtml('<div class="input-group date" id="datepicker_' . $this->oField->GetGlobalId() . '">');
$oOutput->AddHtml('<input type="text" id="' . $this->oField->GetGlobalId() . '" name="' . $this->oField->GetId() . '" value="')->AddHtml($this->oField->GetDisplayValue(), true)->AddHtml('" class="form-control" maxlength="255" />');
$oOutput->AddHtml('<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>');
$oOutput->AddHtml('</div>');
$oOutput->AddHtml('</div>');
$sJSFormat = json_encode($this->oField->GetJSDateTimeFormat());
$oOutput->AddJs(
<<<EOF
$('#datepicker_{$this->oField->GetGlobalId()}').datetimepicker({format: $sJSFormat});
EOF
);
break;
case 'Combodo\\iTop\\Form\\Field\\PasswordField':
$oOutput->AddHtml('<div class="form-group ' . $sFieldMandatoryClass . '">');
if ($this->oField->GetLabel() !== '')
{
$oOutput->AddHtml('<label for="' . $this->oField->GetGlobalId() . '" class="control-label">')->AddHtml($this->oField->GetLabel(), true)->AddHtml('</label>');
}
$oOutput->AddHtml('<div class="help-block"></div>');
$oOutput->AddHtml('<input type="password" id="' . $this->oField->GetGlobalId() . '" name="' . $this->oField->GetId() . '" value="')->AddHtml($this->oField->GetCurrentValue(), true)->AddHtml('" class="form-control" maxlength="255" autocomplete="off" />');
$oOutput->AddHtml('</div>');
break;
case 'Combodo\\iTop\\Form\\Field\\StringField':
case 'Combodo\\iTop\\Form\\Field\\DateTimeField':
case 'Combodo\\iTop\\Form\\Field\\PasswordField':
case 'Combodo\\iTop\\Form\\Field\\StringField':
case 'Combodo\\iTop\\Form\\Field\\UrlField':
$oOutput->AddHtml('<div class="form-group ' . $sFieldMandatoryClass . '">');
if ($this->oField->GetLabel() !== '')
{
$oOutput->AddHtml('<label for="' . $this->oField->GetGlobalId() . '" class="control-label">')->AddHtml($this->oField->GetLabel(), true)->AddHtml('</label>');
}
$oOutput->AddHtml('<div class="help-block"></div>');
$oOutput->AddHtml('<input type="text" id="' . $this->oField->GetGlobalId() . '" name="' . $this->oField->GetId() . '" value="')->AddHtml($this->oField->GetCurrentValue(), true)->AddHtml('" class="form-control" maxlength="255" />');
$oOutput->AddHtml('</div>');
break;
case 'Combodo\\iTop\\Form\\Field\\SelectField':
case 'Combodo\\iTop\\Form\\Field\\MultipleSelectField':
// Opening container
$oOutput->AddHtml('<div class="form-group form_group_small ' . $sFieldMandatoryClass . ' ' . $sFieldContainerClass . '">');
// Label
if($this->oField->IsHorizontalDisplayMode()){ $oOutput->AddHtml('<div class="col-sm-3">'); }
if ($this->oField->GetLabel() !== '')
{
$oOutput->AddHtml('<label for="' . $this->oField->GetGlobalId() . '" class="control-label">')->AddHtml($this->oField->GetLabel(), true)->AddHtml('</label>');
}
if($this->oField->IsHorizontalDisplayMode()){ $oOutput->AddHtml('</div>'); }
// Value
if($this->oField->IsHorizontalDisplayMode()){ $oOutput->AddHtml('<div class="col-sm-9">'); }
// - Help block
$oOutput->AddHtml('<div class="help-block"></div>');
// - Value regarding the field type
switch($sFieldClass)
{
case 'Combodo\\iTop\\Form\\Field\\DateTimeField':
$oOutput->AddHtml('<div class="input-group date" id="datepicker_' . $this->oField->GetGlobalId() . '">');
$oOutput->AddHtml('<input type="text" id="' . $this->oField->GetGlobalId() . '" name="' . $this->oField->GetId() . '" value="')->AddHtml($this->oField->GetDisplayValue(), true)->AddHtml('" class="form-control" maxlength="255" />');
$oOutput->AddHtml('<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>');
$oOutput->AddHtml('</div>');
$sJSFormat = json_encode($this->oField->GetJSDateTimeFormat());
$oOutput->AddJs(
<<<EOF
$('#datepicker_{$this->oField->GetGlobalId()}').datetimepicker({format: $sJSFormat});
EOF
);
break;
case 'Combodo\\iTop\\Form\\Field\\PasswordField':
$oOutput->AddHtml('<input type="password" id="' . $this->oField->GetGlobalId() . '" name="' . $this->oField->GetId() . '" value="')->AddHtml($this->oField->GetCurrentValue(), true)->AddHtml('" class="form-control" maxlength="255" autocomplete="off" />');
break;
case 'Combodo\\iTop\\Form\\Field\\StringField':
case 'Combodo\\iTop\\Form\\Field\\UrlField':
$oOutput->AddHtml('<input type="text" id="' . $this->oField->GetGlobalId() . '" name="' . $this->oField->GetId() . '" value="')->AddHtml($this->oField->GetCurrentValue(), true)->AddHtml('" class="form-control" maxlength="255" />');
break;
case 'Combodo\\iTop\\Form\\Field\\SelectField':
case 'Combodo\\iTop\\Form\\Field\\MultipleSelectField':
$oOutput->AddHtml('<select id="' . $this->oField->GetGlobalId() . '" name="' . $this->oField->GetId() . '" ' . ( ($this->oField->GetMultipleValuesEnabled()) ? 'multiple' : '' ) . ' class="form-control">');
foreach ($this->oField->GetChoices() as $sChoice => $sLabel)
{
// Note : The test is a double equal on purpose as the type of the value received from the XHR is not always the same as the type of the allowed values. (eg : string vs int)
$sSelectedAtt = ($this->oField->GetCurrentValue() == $sChoice) ? 'selected' : '';
$oOutput->AddHtml('<option value="' . $sChoice . '" ' . $sSelectedAtt . ' >')->AddHtml($sLabel)->AddHtml('</option>');
}
$oOutput->AddHtml('</select>');
break;
}
if($this->oField->IsHorizontalDisplayMode()){ $oOutput->AddHtml('</div>'); }
// Closing container
$oOutput->AddHtml('</div>');
break;
case 'Combodo\\iTop\\Form\\Field\\TextAreaField':
case 'Combodo\\iTop\\Form\\Field\\CaseLogField':
$bRichEditor = ($this->oField->GetFormat() === TextAreaField::ENUM_FORMAT_HTML);
$oOutput->AddHtml('<div class="form-group ' . $sFieldMandatoryClass . '">');
if ($this->oField->GetLabel() !== '')
{
@@ -133,25 +156,6 @@ EOF
}
break;
case 'Combodo\\iTop\\Form\\Field\\SelectField':
case 'Combodo\\iTop\\Form\\Field\\MultipleSelectField':
$oOutput->AddHtml('<div class="form-group ' . $sFieldMandatoryClass . '">');
if ($this->oField->GetLabel() !== '')
{
$oOutput->AddHtml('<label for="' . $this->oField->GetGlobalId() . '" class="control-label">')->AddHtml($this->oField->GetLabel(), true)->AddHtml('</label>');
}
$oOutput->AddHtml('<div class="help-block"></div>');
$oOutput->AddHtml('<select id="' . $this->oField->GetGlobalId() . '" name="' . $this->oField->GetId() . '" ' . ( ($this->oField->GetMultipleValuesEnabled()) ? 'multiple' : '' ) . ' class="form-control">');
foreach ($this->oField->GetChoices() as $sChoice => $sLabel)
{
// Note : The test is a double equal on purpose as the type of the value received from the XHR is not always the same as the type of the allowed values. (eg : string vs int)
$sSelectedAtt = ($this->oField->GetCurrentValue() == $sChoice) ? 'selected' : '';
$oOutput->AddHtml('<option value="' . $sChoice . '" ' . $sSelectedAtt . ' >')->AddHtml($sLabel)->AddHtml('</option>');
}
$oOutput->AddHtml('</select>');
$oOutput->AddHtml('</div>');
break;
case 'Combodo\\iTop\\Form\\Field\\RadioField':
case 'Combodo\\iTop\\Form\\Field\\CheckboxField':
$sFieldType = ($sFieldClass === 'Combodo\\iTop\\Form\\Field\\RadioField') ? 'radio' : 'checkbox';
@@ -198,21 +202,42 @@ EOF
switch ($sFieldClass)
{
case 'Combodo\\iTop\\Form\\Field\\LabelField':
$oOutput->AddHtml('<div class="form-group">');
case 'Combodo\\iTop\\Form\\Field\\StringField':
case 'Combodo\\iTop\\Form\\Field\\UrlField':
case 'Combodo\\iTop\\Form\\Field\\DateTimeField':
case 'Combodo\\iTop\\Form\\Field\\DurationField':
// Opening container
$oOutput->AddHtml('<div class="form-group form_group_small ' . $sFieldContainerClass . '">');
// Showing label / value only if read-only but not hidden
if (!$this->oField->GetHidden())
{
// Label
if($this->oField->IsHorizontalDisplayMode()){ $oOutput->AddHtml('<div class="col-sm-3">'); }
if ($this->oField->GetLabel() !== '')
{
$oOutput->AddHtml('<label for="' . $this->oField->GetGlobalId() . '" class="control-label">')->AddHtml($this->oField->GetLabel(), true)->AddHtml('</label>');
}
$oOutput->AddHtml('<div class="form-control-static">')->AddHtml($this->oField->GetCurrentValue(), true)->AddHtml('</div>');
if($this->oField->IsHorizontalDisplayMode()){ $oOutput->AddHtml('</div>'); }
// Value
$bEncodeHtmlEntities = ($sFieldClass === 'Combodo\\iTop\\Form\\Field\\UrlField') ? false : true;
if($this->oField->IsHorizontalDisplayMode()){ $oOutput->AddHtml('<div class="col-sm-9">'); }
$oOutput->AddHtml('<div class="form-control-static">')->AddHtml($this->oField->GetDisplayValue(), $bEncodeHtmlEntities)->AddHtml('</div>');
if($this->oField->IsHorizontalDisplayMode()){ $oOutput->AddHtml('</div>'); }
}
// Adding hidden input if not a label
if($sFieldClass !== 'Combodo\\iTop\\Form\\Field\\LabelField')
{
$sValueForInput = ($sFieldClass === 'Combodo\\iTop\\Form\\Field\\DateTimeField') ? $this->oField->GetDisplayValue() : $this->oField->GetCurrentValue();
$oOutput->AddHtml('<input type="hidden" id="' . $this->oField->GetGlobalId() . '" name="' . $this->oField->GetId() . '" value="')->AddHtml($sValueForInput, true)->AddHtml('" class="form-control" />');
}
// Closing container
$oOutput->AddHtml('</div>');
break;
case 'Combodo\\iTop\\Form\\Field\\StringField':
case 'Combodo\\iTop\\Form\\Field\\UrlField':
case 'Combodo\\iTop\\Form\\Field\\TextAreaField':
$oOutput->AddHtml('<div class="form-group">');
// Showing label / value only if read-only but not hidden
@@ -223,18 +248,10 @@ EOF
$oOutput->AddHtml('<label for="' . $this->oField->GetGlobalId() . '" class="control-label">')->AddHtml($this->oField->GetLabel(), true)->AddHtml('</label>');
}
if($sFieldClass === 'Combodo\\iTop\\Form\\Field\\UrlField' || $sFieldClass === 'Combodo\\iTop\\Form\\Field\\TextAreaField')
{
$bEncodeHtmlEntities = false;
$sDisplayValue = $this->oField->GetDisplayValue();
}
else
{
$bEncodeHtmlEntities = true;
$sDisplayValue = $this->oField->GetCurrentValue();
}
$oOutput->AddHtml('<div class="form-control-static">')->AddHtml($sDisplayValue, $bEncodeHtmlEntities)->AddHtml('</div>');
$oOutput->AddHtml('<div class="form-control-static">')->AddHtml($this->oField->GetDisplayValue(), false)->AddHtml('</div>');
}
// Adding hidden input
$oOutput->AddHtml('<input type="hidden" id="' . $this->oField->GetGlobalId() . '" name="' . $this->oField->GetId() . '" value="')->AddHtml($this->oField->GetCurrentValue(), true)->AddHtml('" class="form-control" />');
$oOutput->AddHtml('</div>');
break;
@@ -250,37 +267,7 @@ EOF
$oOutput->AddHtml('</div>');
break;
case 'Combodo\\iTop\\Form\\Field\\DateTimeField':
$oOutput->AddHtml('<div class="form-group">');
// Showing label / value only if read-only but not hidden
if (!$this->oField->GetHidden())
{
if ($this->oField->GetLabel() !== '')
{
$oOutput->AddHtml('<label for="' . $this->oField->GetGlobalId() . '" class="control-label">')->AddHtml($this->oField->GetLabel(), true)->AddHtml('</label>');
}
$oOutput->AddHtml('<div class="form-control-static">')->AddHtml($this->oField->GetDisplayValue(), true)->AddHtml('</div>');
}
$oOutput->AddHtml('<input type="hidden" id="' . $this->oField->GetGlobalId() . '" name="' . $this->oField->GetId() . '" value="')->AddHtml($this->oField->GetDisplayValue(), true)->AddHtml('" class="form-control" />');
$oOutput->AddHtml('</div>');
break;
case 'Combodo\\iTop\\Form\\Field\\DurationField':
$oOutput->AddHtml('<div class="form-group">');
// Showing label / value only if read-only but not hidden
if (!$this->oField->GetHidden())
{
if ($this->oField->GetLabel() !== '')
{
$oOutput->AddHtml('<label for="' . $this->oField->GetGlobalId() . '" class="control-label">')->AddHtml($this->oField->GetLabel(), true)->AddHtml('</label>');
}
$oOutput->AddHtml('<div class="form-control-static">')->AddHtml($this->oField->GetDisplayValue(), true)->AddHtml('</div>');
}
$oOutput->AddHtml('<input type="hidden" id="' . $this->oField->GetGlobalId() . '" name="' . $this->oField->GetId() . '" value="')->AddHtml($this->oField->GetCurrentValue(), true)->AddHtml('" class="form-control" />');
$oOutput->AddHtml('</div>');
break;
case 'Combodo\\iTop\\Form\\Field\\BlobField':
case 'Combodo\\iTop\\Form\\Field\\BlobField':
case 'Combodo\\iTop\\Form\\Field\\ImageField':
$oOutput->AddHtml('<div class="form-group">');
// Showing label / value only if read-only but not hidden
@@ -311,17 +298,30 @@ EOF
$aFieldChoices = $this->oField->GetChoices();
$sFieldValue = (isset($aFieldChoices[$this->oField->GetCurrentValue()])) ? $aFieldChoices[$this->oField->GetCurrentValue()] : Dict::S('UI:UndefinedObject');
$oOutput->AddHtml('<div class="form-group">');
// Opening container
$oOutput->AddHtml('<div class="form-group form_group_small ' . $sFieldContainerClass . '">');
// Showing label / value only if read-only but not hidden
if (!$this->oField->GetHidden())
{
// Label
if($this->oField->IsHorizontalDisplayMode()){ $oOutput->AddHtml('<div class="col-sm-3">'); }
if ($this->oField->GetLabel() !== '')
{
$oOutput->AddHtml('<label for="' . $this->oField->GetGlobalId() . '" class="control-label">')->AddHtml($this->oField->GetLabel(), true)->AddHtml('</label>');
}
if($this->oField->IsHorizontalDisplayMode()){ $oOutput->AddHtml('</div>'); }
// Value
if($this->oField->IsHorizontalDisplayMode()){ $oOutput->AddHtml('<div class="col-sm-9">'); }
$oOutput->AddHtml('<div class="form-control-static">' . $sFieldValue . '</div>');
if($this->oField->IsHorizontalDisplayMode()){ $oOutput->AddHtml('</div>'); }
}
// Adding hidden value
$oOutput->AddHtml('<input type="hidden" id="' . $this->oField->GetGlobalId() . '" name="' . $this->oField->GetId() . '" value="' . $this->oField->GetCurrentValue() . '" class="form-control" />');
// Closing container
$oOutput->AddHtml('</div>');
break;