mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
N.481: Portal: Impossible to submit a form with a duration attribute. Also fixed the displayed value in tables (ManageBrick and BrowseBrick)
SVN:trunk[4504]
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
use \Combodo\iTop\Form\Field\Field;
|
||||
use \Str;
|
||||
use \AttributeDuration;
|
||||
|
||||
/**
|
||||
* Description of StringField
|
||||
@@ -27,4 +29,14 @@ use \Combodo\iTop\Form\Field\Field;
|
||||
class DurationField extends Field
|
||||
{
|
||||
|
||||
/**
|
||||
* Note: This is inspired by AttributeDuration::GetAsHTML()
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function GetDisplayValue()
|
||||
{
|
||||
return Str::pure2html(AttributeDuration::FormatDuration($this->currentValue));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ class BsFormRenderer extends FormRenderer
|
||||
$this->AddSupportedField('SelectObjectField', 'BsSelectObjectFieldRenderer');
|
||||
$this->AddSupportedField('LinkedSetField', 'BsLinkedSetFieldRenderer');
|
||||
$this->AddSupportedField('DateTimeField', 'BsSimpleFieldRenderer');
|
||||
$this->AddSupportedField('DurationField', 'BsSimpleFieldRenderer');
|
||||
$this->AddSupportedField('FileUploadField', 'BsFileUploadFieldRenderer');
|
||||
}
|
||||
|
||||
|
||||
@@ -269,6 +269,21 @@ EOF
|
||||
$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\\RadioField':
|
||||
case 'Combodo\\iTop\\Form\\Field\\SelectField':
|
||||
case 'Combodo\\iTop\\Form\\Field\\MultipleSelectField':
|
||||
|
||||
Reference in New Issue
Block a user