getIndexDropdown($tableName, 'name'); } public function getIndexDropdownforFieldByTyp($tableName,$fieldName,$matchFName,$matchVal,$dropDownName=NULL) { // Gets dropdown of values subsetting table on particular field match // todo: devprod - MAJOR hack... only used by devprod, created just to support the two servers - reengineer? if ($dropDownName == NULL) $dropDownName = $tableName; list($tableData,$fieldNames) = $this->getTableAsArray($tableName); $retVal = ""; return $retVal; } public function getIndexDropdown($tableName, $fieldName=NULL) { if (!isset($fieldName)) { $fieldName = $tableName; $tableName .= '_typ'; } list($tableData,$fieldNames) = $this->getTableAsArray($tableName); $retVal = ""; return $retVal; } private function getDefaultInputField($fName) { return ""; } private function getRealmTypesForDropdown() { // todo: devprod - this code is called only in 'dev/prod' mode. // should probably reengineer or drop out when "links" on fields are working. list($realm_types,$field_names) = $this->getTableAsArray('realm_typ'); $realm_types_i = array (); foreach ($realm_types as $rId=>$rTyp) $realm_types_i[$rTyp['realm'].'server'] = $rTyp['index']; return $realm_types_i; } public function getInputForDbField ($tableName, $fName) { $retVal = false; if (strcmp($tableName,preg_replace('/_typ$/','', $tableName))) { // If tableName ends with '_typ' then ti will be a dropdown $retVal = $this->getDefaultInputField($fName); } else { // todo: This 'switch' is becoming a cludge, better to have a smarter way to 'sniff' the dropdown types switch ($fName) { case 'realm' : case 'status' : case 'arch' : case 'os' : $retVal = $this->getIndexDropdown($fName); break; case 'app' : case 'server' : $retVal = $this->getIndexDropdownByName($fName); break; // todo: devprod - the code below is called only in 'dev/prod' mode. Should be finalized once we choose // which we want, either these two lines or the single 'server' line above will remian. case 'devserver' : case 'prodserver' : $realm_typs = $this->getRealmTypesForDropdown(); $retVal = $this->getIndexDropdownforFieldByTyp( 'server','name', 'realm_typ', $realm_typs[$fName], $fName); break; default : $retVal = $this->getDefaultInputField($fName); break; } } return $retVal; } } ?>