Work in progress for integration of "allowed values"

SVN:trunk[144]
This commit is contained in:
Romain Quetiez
2009-09-11 15:33:06 +00:00
parent 9756ed026f
commit cc7ea74159
2 changed files with 12 additions and 5 deletions

View File

@@ -191,9 +191,6 @@ class CMDBSource
$result = self::Query($sSQL);
$aRow = mysql_fetch_assoc($result);
$iNextInsertId = $aRow['Auto_increment'];
echo "<pre>\n";
print_r($aRow);
echo "</pre>\n";
return $iNextInsertId;
}

View File

@@ -84,9 +84,19 @@ switch($operation)
}
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?
$oWizardHelper->SetAllowedValuesHtml($sAttCode, "Possible values ($sAttCode)");
$oWizardHelper->SetAllowedValuesHtml($sAttCode, $sHTMLValue);
}
$oPage->add($oWizardHelper->ToJSON());
break;