mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 15:22:17 +02:00
Work in progress for integration of "allowed values"
SVN:code[144]
This commit is contained in:
@@ -191,9 +191,6 @@ class CMDBSource
|
|||||||
$result = self::Query($sSQL);
|
$result = self::Query($sSQL);
|
||||||
$aRow = mysql_fetch_assoc($result);
|
$aRow = mysql_fetch_assoc($result);
|
||||||
$iNextInsertId = $aRow['Auto_increment'];
|
$iNextInsertId = $aRow['Auto_increment'];
|
||||||
echo "<pre>\n";
|
|
||||||
print_r($aRow);
|
|
||||||
echo "</pre>\n";
|
|
||||||
return $iNextInsertId;
|
return $iNextInsertId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,9 +84,19 @@ switch($operation)
|
|||||||
}
|
}
|
||||||
foreach($oWizardHelper->GetFieldsForAllowedValues() as $sAttCode)
|
foreach($oWizardHelper->GetFieldsForAllowedValues() as $sAttCode)
|
||||||
{
|
{
|
||||||
// MetaModel::GetAllowedValues_att() => array(id => value)
|
$aAllowedValues = MetaModel::GetAllowedValues_att(get_class($oObj), $sAttCode, array('this' => $oObj));
|
||||||
|
// Few choices, use a normal 'select'
|
||||||
|
$sHTMLValue = "<select name=\"attr_{$sAttCode}\"\n";
|
||||||
|
$sHTMLValue .= "<option value=\"0\">-- select one --</option>\n";
|
||||||
|
foreach($aAllowedValues as $key => $display_value)
|
||||||
|
{
|
||||||
|
$sSelected = ''; //($value == $key) ? ' selected' : '';
|
||||||
|
$sHTMLValue .= "<option value=\"$key\"$sSelected>$display_value</option>\n";
|
||||||
|
}
|
||||||
|
$sHTMLValue .= "</select>\n";
|
||||||
|
|
||||||
// Improvement: what if the list is too long?
|
// Improvement: what if the list is too long?
|
||||||
$oWizardHelper->SetAllowedValuesHtml($sAttCode, "Possible values ($sAttCode)");
|
$oWizardHelper->SetAllowedValuesHtml($sAttCode, $sHTMLValue);
|
||||||
}
|
}
|
||||||
$oPage->add($oWizardHelper->ToJSON());
|
$oPage->add($oWizardHelper->ToJSON());
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user