Datamodel: draft for the tickets (integration of StimulusInternal)

SVN:trunk[534]
This commit is contained in:
Romain Quetiez
2010-07-02 13:37:20 +00:00
parent 40913af0f6
commit bd2f35e286
9 changed files with 684 additions and 18 deletions

View File

@@ -632,6 +632,7 @@ class AttributeString extends AttributeDBField
public function MakeRealValue($proposedValue)
{
if (is_null($proposedValue)) return null;
return (string)$proposedValue;
// if (!settype($proposedValue, "string"))
// {

View File

@@ -48,6 +48,12 @@ define('ENUM_CHILD_CLASSES_EXCLUDETOP', 1);
*/
define('ENUM_CHILD_CLASSES_ALL', 2);
/**
* Specifies that this attribute is visible/editable.... normal (default config)
*
* @package iTopORM
*/
define('OPT_ATT_NORMAL', 0);
/**
* Specifies that this attribute is hidden in that state
*
@@ -774,8 +780,8 @@ abstract class MetaModel
//
// Object lifecycle model
//
private static $m_aStates = array(); // array of ("classname" => array of "statecode"=>array('label'=>..., 'description'=>..., attribute_inherit=> attribute_list=>...))
private static $m_aStimuli = array(); // array of ("classname" => array of ("stimuluscode"=>array('label'=>..., 'description'=>...)))
private static $m_aStates = array(); // array of ("classname" => array of "statecode"=>array('label'=>..., attribute_inherit=> attribute_list=>...))
private static $m_aStimuli = array(); // array of ("classname" => array of ("stimuluscode"=>array('label'=>...)))
private static $m_aTransitions = array(); // array of ("classname" => array of ("statcode_from"=>array of ("stimuluscode" => array('target_state'=>..., 'actions'=>array of handlers procs, 'user_restriction'=>TBD)))
public static function EnumStates($sClass)
@@ -1223,9 +1229,20 @@ abstract class MetaModel
if (!empty($sParentState))
{
// Inherit from the given state (must be defined !)
//
$aToInherit = self::$m_aStates[$sTargetClass][$sParentState];
// Reset the constraint when it was mandatory to set the value at the previous state
//
foreach ($aToInherit['attribute_list'] as $sState => $iFlags)
{
$iFlags = $iFlags & ~OPT_ATT_MUSTPROMPT;
$iFlags = $iFlags & ~OPT_ATT_MUSTCHANGE;
$aToInherit['attribute_list'][$sState] = $iFlags;
}
// The inherited configuration could be overriden
$aStateDef['attribute_list'] = array_merge($aToInherit, $aStateDef['attribute_list']);
$aStateDef['attribute_list'] = array_merge($aToInherit['attribute_list'], $aStateDef['attribute_list']);
}
self::$m_aStates[$sTargetClass][$sStateCode] = $aStateDef;

View File

@@ -126,6 +126,12 @@ class ObjectStimulus
class StimulusUserAction extends ObjectStimulus
{
// Entry in the menus
}
class StimulusInternal extends ObjectStimulus
{
// Applied from page xxxx
}
?>