mirror of
https://github.com/Combodo/iTop.git
synced 2026-03-04 00:24:14 +01:00
N°1986 Portal: Forms with only transition buttons are now read-only
This commit is contained in:
@@ -82,7 +82,9 @@ class ObjectFormManager extends FormManager
|
|||||||
protected $aFormProperties;
|
protected $aFormProperties;
|
||||||
/** @var array $aCallbackUrls */
|
/** @var array $aCallbackUrls */
|
||||||
protected $aCallbackUrls = array();
|
protected $aCallbackUrls = array();
|
||||||
|
/** @var boolean $bIsSubmittable */
|
||||||
|
protected $bIsSubmittable = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an instance of \Combodo\iTop\Portal\Form\ObjectFormManager from JSON data that must contain at least :
|
* Creates an instance of \Combodo\iTop\Portal\Form\ObjectFormManager from JSON data that must contain at least :
|
||||||
* - formobject_class : The class of the object that is being edited/viewed
|
* - formobject_class : The class of the object that is being edited/viewed
|
||||||
@@ -227,7 +229,29 @@ class ObjectFormManager extends FormManager
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function GetIsSubmittable()
|
||||||
|
{
|
||||||
|
return $this->bIsSubmittable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param boolean $bIsSubmittable
|
||||||
|
*
|
||||||
|
* @return \Combodo\iTop\Portal\Form\ObjectFormManager
|
||||||
|
*/
|
||||||
|
public function SetIsSubmittable($bIsSubmittable)
|
||||||
|
{
|
||||||
|
$this->bIsSubmittable = $bIsSubmittable;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
@@ -461,6 +485,12 @@ class ObjectFormManager extends FormManager
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If a form can't be submitted to update an object, we have no reason to allow fields to be editable
|
||||||
|
if (!$this->GetIsSubmittable())
|
||||||
|
{
|
||||||
|
$sFieldFlags .= ' read_only';
|
||||||
|
}
|
||||||
|
|
||||||
// Otherwise we proceed as usual
|
// Otherwise we proceed as usual
|
||||||
foreach (explode(' ', $sFieldFlags) as $sFieldFlag)
|
foreach (explode(' ', $sFieldFlags) as $sFieldFlag)
|
||||||
|
|||||||
@@ -246,7 +246,8 @@ class ObjectFormHandlerHelper
|
|||||||
->SetMode($sMode)
|
->SetMode($sMode)
|
||||||
->SetActionRulesToken($sActionRulesToken)
|
->SetActionRulesToken($sActionRulesToken)
|
||||||
->SetRenderer($oFormRenderer)
|
->SetRenderer($oFormRenderer)
|
||||||
->SetFormProperties($aFormProperties);
|
->SetFormProperties($aFormProperties)
|
||||||
|
->SetIsSubmittable(isset($aFormData['buttons']['submit']));
|
||||||
|
|
||||||
$oFormManager->Build();
|
$oFormManager->Build();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user