mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-20 15:52:24 +02:00
Portal : Finished integration of Date & DateTime attributes in forms
SVN:trunk[4029]
This commit is contained in:
@@ -3646,6 +3646,7 @@ class AttributeDateTime extends AttributeDBField
|
||||
$oFormField = parent::MakeFormField($oObject, $oFormField);
|
||||
$oFormField->SetPHPDateTimeFormat((string) $this->GetFormat());
|
||||
$oFormField->SetJSDateTimeFormat($this->GetFormat()->ToMomentJS());
|
||||
$oFormField->SetCurrentValue($this->GetFormat()->Format($oObject->Get($this->GetCode())));
|
||||
|
||||
return $oFormField;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ class DateTimeField extends StringField
|
||||
|
||||
public function GetDisplayValue()
|
||||
{
|
||||
return AttributeDatetime::GetFormat()->Format($this->currentValue);
|
||||
return $this->currentValue;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,4 +103,5 @@ class DateTimeField extends StringField
|
||||
{
|
||||
return $this->bDateOnly;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ EOF
|
||||
}
|
||||
$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('<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;
|
||||
|
||||
@@ -310,6 +310,22 @@ EOF
|
||||
EOF
|
||||
);
|
||||
break;
|
||||
case 'Combodo\\iTop\\Form\\Field\\DateTimeField':
|
||||
// We need the focusout event has the datepicker widget seems to override the change event
|
||||
$oOutput->AddJs(
|
||||
<<<EOF
|
||||
$("#{$this->oField->GetGlobalId()}").off("change keyup focusout").on("change keyup focusout", function(){
|
||||
var me = this;
|
||||
|
||||
$(this).closest(".field_set").trigger("field_change", {
|
||||
id: $(me).attr("id"),
|
||||
name: $(me).closest(".form_field").attr("data-field-id"),
|
||||
value: $(me).val()
|
||||
});
|
||||
});
|
||||
EOF
|
||||
);
|
||||
break;
|
||||
|
||||
case 'Combodo\\iTop\\Form\\Field\\RadioField':
|
||||
case 'Combodo\\iTop\\Form\\Field\\CheckboxField':
|
||||
|
||||
Reference in New Issue
Block a user