Alpha 2.3.0 fixes :

- Multiple request templates on portal
- SelectField interface stabilization
- UI fixes on portal
- Forms updates on lifecycle

SVN:trunk[3970]
This commit is contained in:
Guillaume Lajarige
2016-03-29 12:33:08 +00:00
parent 2ab12d9d11
commit 2a5ca467fd
8 changed files with 73 additions and 7 deletions

View File

@@ -6036,7 +6036,7 @@ class AttributeFriendlyName extends AttributeComputedFieldVoid
return '\\Combodo\\iTop\\Form\\Field\\StringField';
}
public function GetFormField(DBObject $oObject, $oFormField = null)
public function MakeFormField(DBObject $oObject, $oFormField = null)
{
if ($oFormField === null)
{
@@ -6044,7 +6044,7 @@ class AttributeFriendlyName extends AttributeComputedFieldVoid
$oFormField = new $sFormFieldClass($this->GetCode());
}
$oFormField->SetReadOnly(true);
parent::GetFormField($oObject, $oFormField);
parent::MakeFormField($oObject, $oFormField);
return $oFormField;
}

View File

@@ -84,10 +84,17 @@ $(function()
}
else if($(oElem).is('select'))
{
value = [];
$(oElem).find('option:selected').each(function(){
value.push($(this).val());
});
if($(oElem).is('select[multiple]'))
{
value = [];
$(oElem).find('option:selected').each(function(){
value.push($(this).val());
});
}
else
{
value = $(oElem).val();
}
}
else if($(oElem).is(':checkbox') || $(oElem).is(':radio'))
{

View File

@@ -31,6 +31,7 @@ require_once APPROOT . 'sources/form/field/stringfield.class.inc.php';
require_once APPROOT . 'sources/form/field/textareafield.class.inc.php';
require_once APPROOT . 'sources/form/field/multiplechoicesfield.class.inc.php';
require_once APPROOT . 'sources/form/field/selectfield.class.inc.php';
require_once APPROOT . 'sources/form/field/multipleselectfield.class.inc.php';
require_once APPROOT . 'sources/form/field/selectobjectfield.class.inc.php';
require_once APPROOT . 'sources/form/field/checkboxfield.class.inc.php';
require_once APPROOT . 'sources/form/field/radiofield.class.inc.php';

View File

@@ -0,0 +1,35 @@
<?php
// Copyright (C) 2010-2016 Combodo SARL
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// iTop is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
namespace Combodo\iTop\Form\Field;
use \Closure;
use \Dict;
use \Combodo\iTop\Form\Field\SelectField;
/**
* Description of MultipleSelectField
*
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
*/
class MultipleSelectField extends SelectField
{
const DEFAULT_MULTIPLE_VALUES_ENABLED = true;
}

View File

@@ -30,6 +30,7 @@ use \Combodo\iTop\Form\Field\MultipleChoicesField;
*/
class SelectField extends MultipleChoicesField
{
const DEFAULT_MULTIPLE_VALUES_ENABLED = false;
const DEFAULT_NULL_CHOICE_LABEL = 'UI:SelectOne';
const DEFAULT_STARTS_WITH_NULL_CHOICE = true;
@@ -75,4 +76,16 @@ class SelectField extends MultipleChoicesField
return $aChoices;
}
/**
* Overloads the method to prevent changing this property.
*
* @param boolean $bMultipleValuesEnabled
* @return \Combodo\iTop\Form\Field\SelectField
*/
public function SetMultipleValuesEnabled($bMultipleValuesEnabled)
{
// We don't allow changing this value
return $this;
}
}

View File

@@ -44,9 +44,11 @@ class BsFormRenderer extends FormRenderer
$this->AddSupportedField('StringField', 'BsSimpleFieldRenderer');
$this->AddSupportedField('TextAreaField', 'BsSimpleFieldRenderer');
$this->AddSupportedField('SelectField', 'BsSimpleFieldRenderer');
$this->AddSupportedField('MultipleSelectField', 'BsSimpleFieldRenderer');
$this->AddSupportedField('RadioField', 'BsSimpleFieldRenderer');
$this->AddSupportedField('CheckboxField', 'BsSimpleFieldRenderer');
$this->AddSupportedField('SubFormField', 'BsSubFormFieldRenderer');
$this->AddSupportedField('SelectObjectField', 'BsSimpleFieldRenderer');
}
}

View File

@@ -92,6 +92,7 @@ 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() !== '')
{
@@ -187,7 +188,9 @@ EOF
break;
case 'Combodo\\iTop\\Form\\Field\\RadioField':
case 'Combodo\\iTop\\Form\\Field\\SelectField': // TODO : This should be check for external key, as we would display it differently
case 'Combodo\\iTop\\Form\\Field\\SelectField':
case 'Combodo\\iTop\\Form\\Field\\MultipleSelectField':
case 'Combodo\\iTop\\Form\\Field\\SelectObjectField': // TODO : This should be check for external key, as we would display it differently
$aFieldChoices = $this->oField->GetChoices();
$sFieldValue = (isset($aFieldChoices[$this->oField->GetCurrentValue()])) ? $aFieldChoices[$this->oField->GetCurrentValue()] : Dict::S('UI:UndefinedObject');
@@ -214,6 +217,8 @@ EOF
case 'Combodo\\iTop\\Form\\Field\\StringField':
case 'Combodo\\iTop\\Form\\Field\\TextAreaField':
case 'Combodo\\iTop\\Form\\Field\\SelectField':
case 'Combodo\\iTop\\Form\\Field\\MultipleSelectField':
case 'Combodo\\iTop\\Form\\Field\\SelectObjectField':
case 'Combodo\\iTop\\Form\\Field\\HiddenField':
$oOutput->AddJs(
<<<EOF
@@ -266,6 +271,8 @@ EOF
{
case 'Combodo\\iTop\\Form\\Field\\StringField':
case 'Combodo\\iTop\\Form\\Field\\SelectField':
case 'Combodo\\iTop\\Form\\Field\\MultipleSelectField':
case 'Combodo\\iTop\\Form\\Field\\SelectObjectField':
case 'Combodo\\iTop\\Form\\Field\\HiddenField':
case 'Combodo\\iTop\\Form\\Field\\RadioField':
case 'Combodo\\iTop\\Form\\Field\\CheckboxField':

View File

@@ -48,6 +48,7 @@ class BsSubFormFieldRenderer extends FieldRenderer
'fields_impacts' => $this->oField->GetForm()->GetFieldsImpacts(),
'form_path' => $this->oField->GetForm()->GetId()
);
$sFieldSetOptions = json_encode($aFieldSetOptions);
$oOutput->AddJs(
<<<EOF