/** * @deprecated */ function aColInfoFromDDColumns(&$table, &$retval) { $perm_upd = DDUserPerm($table['table_id'], 'upd'); // ---------------------------------------------- // BIG DEAL A: Loop through each row // ---------------------------------------------- foreach ($table['flat'] as $colname => $colinfo) { if (!isset($colinfo['uino'])) { # KFD 6/2/08, this line is required for some older programs # that SDS wrote that still use this family of routines. # Table constraints appear to be showing up as empty columns! if ($colname == '') { continue; } hprint_r("ERROR IN BUILD, PLEASE CONTACT SECURE DATA SOFTWARE"); echo "Column {$colname}"; hprint_r($colinfo); exit; } // Early return, if there is no UI, don't generate at all if ($colinfo['uino'] == 'Y') { continue; } // Clear out array $c = array(); // Initialize a new array for the column, with some // basic info that is useful in all modes $c['base'] = array('type_id' => $colinfo['type_id'], 'formshort' => $colinfo['formshort'], 'column_id' => $colname, 'colprec' => $colinfo['colprec'], 'colscale' => $colinfo['colscale'], 'description' => $colinfo['description'], 'tooltip' => arraySafe($colinfo, 'tooltip'), 'pk_change' => ArraySafe($colinfo, 'pk_change', 'N')); $c['ins']['sequence'] = 0; $c['upd']['sequence'] = 0; // Load in any default snippets. As of this writing, 6/22/07, these // are not generated at build time, but can be added by // custom classes. $c['ins']['snippets'] = isset($colinfo['ins']['snippets']) ? $colinfo['ins']['snippets'] : array(); $c['upd']['snippets'] = isset($colinfo['upd']['snippets']) ? $colinfo['upd']['snippets'] : array(); // First property, writable. Work this out for all // three modes. $c['search']['writable'] = true; $c['ins']['writable'] = true; $c['upd']['writable'] = $perm_upd; if ($colinfo['uiro'] == 'Y') { $c['ins']['writable'] = false; $c['upd']['writable'] = false; } else { $autos = array('seqdefault', 'fetchdef', 'default', 'blank', 'none', 'synch', '', 'queuepos', 'dominant'); $auto = strtolower(trim($colinfo['automation_id'])); //echo "the auto for $colname is -".$auto."-<br/>"; if (!in_array($auto, $autos)) { $c['ins']['writable'] = false; $c['upd']['writable'] = false; } // override for primary key if ($colinfo['primary_key'] == 'Y') { $c['upd']['writable'] = false; } } // This is the default size and maxlength. Notice that // we don't seet a maxlength in search mode. // $size = $colinfo['dispsize'] + 1; $maxl = $colinfo['dispsize']; if (ArraySafe($colinfo, 'colscale', 0) != 0) { $maxl += 1; } $c['search']['size'] = $size; $c['ins']['size'] = $size; $c['ins']['maxlength'] = $maxl; $c['upd']['size'] = $size; $c['upd']['maxlength'] = $maxl; // This is a feature that the column should be all // caps, currently done only for primary keys if ($table['capspk'] == 'Y' && $colinfo['primary_key'] == 'Y') { $snippet = 'javascript:this.value=this.value.toUpperCase()'; $c['ins']['snippets']['onkeyup'][] = $snippet; $c['upd']['snippets']['onkeyup'][] = $snippet; } // set up foreign keys $c['search']['table_id_fko'] = ''; $c['search']['fkdisplay'] = ''; $c['ins']['table_id_fko'] = $colinfo['table_id_fko']; $c['upd']['table_id_fko'] = $colinfo['table_id_fko']; $c['ins']['fkdisplay'] = $colinfo['fkdisplay']; $c['upd']['fkdisplay'] = $colinfo['fkdisplay']; // If the foreign key is compound, give us the whole thing if (trim($colinfo['table_id_fko']) != '') { $tabfk = dd_TableRef(trim($colinfo['table_id_fko'])); $c['upd']['fk_pks'] = $tabfk['pks']; $c['ins']['fk_pks'] = $tabfk['pks']; } // If this column forces calculations, set a flag $c['upd']['calcs'] = in_array($colname, $table['calcs']); $c['ins']['calcs'] = $c['upd']['calcs']; $c['search']['calcs'] = false; // Give the guy his chain information $c['upd']['chaincalc'] = ArraySafe($colinfo, 'chaincalc', array()); $c['ins']['chaincalc'] = $c['upd']['chaincalc']; $c['search']['chaincalc'] = array(); // Value min and max $c['search']['value_min'] = $colinfo['value_min']; $c['search']['value_max'] = $colinfo['value_max']; $c['upd']['value_min'] = $colinfo['value_min']; $c['upd']['value_max'] = $colinfo['value_max']; $c['ins']['value_min'] = $colinfo['value_min']; $c['ins']['value_max'] = $colinfo['value_max']; // uirows and uicols $c['upd']['uicols'] = $colinfo['uicols']; $c['upd']['uirows'] = $colinfo['uirows']; $c['ins']['uicols'] = $colinfo['uicols']; $c['ins']['uirows'] = $colinfo['uirows']; $c['search']['uicols'] = $colinfo['uicols']; $c['search']['uirows'] = $colinfo['uirows']; // defaults $c['upd']['default'] = null; $c['search']['default'] = null; $c['ins']['default'] = $colinfo['automation_id'] == 'DEFAULT' && $colinfo['auto_formula'] != '' ? $colinfo['auto_formula'] : null; // Add results into final array $retval['base'][$colname] = $c['base']; $retval['ins'][$colname] = $c['ins']; $retval['upd'][$colname] = $c['upd']; $retval['search'][$colname] = $c['search']; } //hprint_r($retval); return $retval; }
function hDisplayOnscreen($filters = array(), &$parent_row) { $parent_pks = $filters; // capture for later reference //hprint_r($filters); // Pull the rows so we know how many we have if (count($filters) != 0) { //$filters=ConSet('table',$this->table_id,'search',$filters); processPost_TableSearchResultsClear($this->table_id); } $rows = rowsFromUserSearch($this->table, $this->projections['_uisearch'], $filters, true); $early_return = $this->hDisplayOnscreenOverride($rows, $filters, $parent_row); if ($early_return != '') { return $early_return; } // Pull the nav bar. Do this after pulling rows so we // know how many rows there are, what page we're on, etc. $hNavBar = $this->hBrowse_NavBar(); // Generate the table header $cols1 = asliceValsFromKeys($this->table['flat'], 'description', $this->projections['_uisearch']); $cols2 = array('Edit'); if (DDUserPerm($this->table_id, 'del')) { $cols2[] = 'Delete'; } $cols = array_merge($cols1, $cols2); if (count($rows) == 0) { $hContent = "<tr><td colspan=99 class=\"dlite\">" . "<b>There are no records to display</b>" . "</td></tr>\n"; } else { // Convert last column to hyperlink to that page/row foreach ($rows as $index => $row) { $slipin1 = hLinkPostFromArray('', 'Edit', array('gp_dd_page' => $this->table_id, 'gp_skey' => $row['skey'], 'gp_mode' => 'upd')); //$slipin1=array('_edit'=>$slipin); $slipin2 = ''; if (DDUserPerm($this->table_id, 'del')) { $slipin2 = hLinkPostFromArray('', 'Delete', array('gp_delskey_' . $this->table_id => $row['skey'], 'gp_mode' => 'upd', 'gp_skey' => gp('gp_skey'))); } //$slipin=array('_del'=>$slipin); // Get the formatted value foreach ($row as $colname => $colvalue) { $value = hFormat($this->table['flat'][$colname]['type_id'], $colvalue); $rows[$index][$colname] = $value; } if (isset($row['skey'])) { unset($rows[$index]['skey']); } $rows[$index][] = $slipin1; $rows[$index][] = $slipin2; //$rows[$index]=array_merge($rows[$index],$slipin); } $hContent = hTBodyFromRows('', $rows); } // Add an empty row for inserting $empty_row = ''; $table_id = $this->table['table_id']; /* foreach($cols1 as $column=>$description){ $value = ''; $name_id = 'gp_onscreen_'.$table_id.'_'.$column.''; $iname = 'name="'.$name_id.'" '.'id="'.$name_id.'"'; $value = '<input type="text" '.$iname.'></input>'; $empty_row .= hTD('',$value,''); } */ $empty_row = ''; $parent_skey = $parent_row['skey']; $pkcols = explode(',', $this->table['pks']); // KFD 1/11/07, unconditionally copied in all values supplied // from parent. foreach ($pkcols as $pkcol) { if (!isset($parent_row[$pkcol])) { continue; } $prefilled[$pkcol] = $parent_row[$pkcol]; } $prefilled = $parent_pks; //hprint_r($prefilled); $opts = array('drilldownmatches' => $prefilled, 'name_prefix' => 'gp_onscreen_' . $table_id . '_', 'hpsize' => 12); // KFD 5/29/07, refactoring code to use new widget generation // routines, no more ahInputsComprehensive. //$inputs = ahInputsComprehensive($this->table,'ins',$prefilled,'_uisearch',$opts); //foreach($inputs as $column=>$details){ // $empty_row .= hTD('',$details['html'],''); //} $acols = aColsModeProj($this->table, 'ins', '_uisearch'); $ahcols = aHColsfromACols($acols, $prefilled); $name_prefix = 'gp_onscreen_' . $table_id . '_'; $xh = hDetailFromAHCols($ahcols, $name_prefix, 500, 'tds'); $xh = jsValues($ahcols, $name_prefix, $prefilled, $xh); $empty_row .= $xh; // END OF CHANGES 5/29/07 code refactoring //hprint_r(htmlentities($empty_row)); // Add a save link hidden('gp_child_onscreen', ''); $name_id = 'onscreen_save'; $iname = 'name="' . $name_id . '" ' . 'id="' . $name_id . '"'; $value = '<a tabindex="' . hpTabIndexNext(500) . '" href="' . "javascript:SetAction('gp_skey',{$parent_skey},'gp_child_onscreen','{$table_id}')" . '">Save</a>'; $empty_row .= hTD('', $value, ''); // Add a <tr></tr> $empty_row = '<tr>' . $empty_row . '</tr>'; // Attatch the empty row $hContent .= $empty_row; $hNew = hLinkPostFromArray('', $this->table['description'], array('gp_dd_page' => $this->table_id)); //$hDsc="<span class=\"x2menubar_text\">" // .$this->table['description'] // .'</span>'; ob_start(); ?> <br> <br> <div class="x2menubar" style="text-align: left"> <?php echo $hNew; ?> </div> <div class="andro_space2"></div> <fieldset> <?php echo hTRFromArray('dhead', $cols); ?> <?php echo $hContent; ?> <tr> <td colspan=99 class='dhead'> </td> </tr> </fieldset> <?php return ob_get_clean(); }