version 1.4, 2002/08/07 22:13:30 |
version 1.5, 2002/08/08 21:36:33 |
Line 153 class phpMyEdit { |
|
Line 153 class phpMyEdit { |
|
return $ret; |
return $ret; |
} /* }}} */ |
} /* }}} */ |
|
|
function htmldisplay($field,$str,$usemask=true,$usecodec=true) /* {{{ */ |
function htmlDisplay($field,$str,$usemask=true,$usecodec=true) /* {{{ */ |
{ |
{ |
// undo the add slashes |
// undo the add slashes |
$str = stripslashes($str); |
$str = stripslashes($str); |
Line 211 class phpMyEdit { |
|
Line 211 class phpMyEdit { |
|
return $ret; |
return $ret; |
} /* }}} */ |
} /* }}} */ |
|
|
function set_values_from_table($field_num,$prepend='') /* {{{ */ |
function set_values_from_table($field_num, $prepend = '') /* {{{ */ |
{ |
{ |
|
//echo $field_num; |
|
//echo '<pre>'; |
|
//var_dump($this->fdd); |
|
//echo '</pre>'; |
if($this->fdd[$field_num]['values']['db']) { |
if($this->fdd[$field_num]['values']['db']) { |
$db = $this->fdd[$field_num]['values']['db']; |
$db = $this->fdd[$field_num]['values']['db']; |
} else { |
} else { |
Line 221 class phpMyEdit { |
|
Line 225 class phpMyEdit { |
|
$table = $this->fdd[$field_num]['values']['table']; |
$table = $this->fdd[$field_num]['values']['table']; |
$key = $this->fdd[$field_num]['values']['column']; |
$key = $this->fdd[$field_num]['values']['column']; |
$desc = $this->fdd[$field_num]['values']['description']; |
$desc = $this->fdd[$field_num]['values']['description']; |
$qparts['type'] = 'select'; |
$qparts['type'] = 'select'; |
$qparts['select'] = 'DISTINCT '.$key; |
$qparts['select'] = 'DISTINCT '.$key; |
if ($desc) { |
if ($desc) { |
$qparts['select'] .= ','.$desc; |
$qparts['select'] .= ','.$desc; |
Line 232 class phpMyEdit { |
|
Line 236 class phpMyEdit { |
|
//$qparts['from'] = "$db.$table.$sel; |
//$qparts['from'] = "$db.$table.$sel; |
$qparts['from'] = "$db.$table"; |
$qparts['from'] = "$db.$table"; |
$qparts['where'] = $this->fdd[$field_num]['values']['filters']; |
$qparts['where'] = $this->fdd[$field_num]['values']['filters']; |
if ($this->fdd[$field_num]['values']['orderby']) |
if ($this->fdd[$field_num]['values']['orderby']) { |
$qparts['orderby'] = $this->fdd[$field_num]['values']['orderby']; |
$qparts['orderby'] = $this->fdd[$field_num]['values']['orderby']; |
|
} |
$res = $this->myquery($this->query_make($qparts),__LINE__); |
$res = $this->myquery($this->query_make($qparts),__LINE__); |
$values = array(); |
$values = array(); |
if ($prepend != '') |
if ($prepend != '') { |
$values[$prepend[0]] = $prepend[1]; |
$values[$prepend[0]] = $prepend[1]; |
|
} |
while ($row = mysql_fetch_row($res)) { |
while ($row = mysql_fetch_row($res)) { |
if ($desc) { |
if ($desc) { |
$values[$row[0]] = $row[1]; |
$values[$row[0]] = $row[1]; |
Line 248 class phpMyEdit { |
|
Line 254 class phpMyEdit { |
|
return $values; |
return $values; |
} /* }}} */ |
} /* }}} */ |
|
|
|
/* |
|
* get the table/field name |
|
*/ |
function fqn($field, $use_qfx=false) /* {{{ */ |
function fqn($field, $use_qfx=false) /* {{{ */ |
{ |
{ |
if (is_string($field)) |
if (is_string($field)) { |
$field = array_search($field,$this->fds); |
$field = array_search($field,$this->fds); |
// get the table/field name |
} |
if (isset($this->fdd[$field]['expression'])) { |
|
$ret = $this->fdd[$field]['expression']; |
// on copy/change always use simple key retrieving |
} elseif ($this->fdd[$this->fds[$field]]['values']['description']) { |
if ($this->copy_operation() || $this->change_operation()) { |
$ret = 'JoinTable'.$field.'.'.$this->fdd[$this->fds[$field]]['values']['description']; |
$ret = 'Table0.'.$this->fds[$field]; |
} elseif ($this->fdd[$this->fds[$field]]['values']['column']) { |
|
$ret = 'JoinTable'.$field.'.'.$this->fdd[$this->fds[$field]]['values']['column']; |
|
} else { |
} else { |
$ret = 'Table0.'.$this->fds[$field]; |
if (isset($this->fdd[$field]['expression'])) { |
|
$ret = $this->fdd[$field]['expression']; |
|
} elseif ($this->fdd[$this->fds[$field]]['values']['description']) { |
|
$ret = 'JoinTable'.$field.'.'.$this->fdd[$this->fds[$field]]['values']['description']; |
|
} elseif ($this->fdd[$this->fds[$field]]['values']['column']) { |
|
$ret = 'JoinTable'.$field.'.'.$this->fdd[$this->fds[$field]]['values']['column']; |
|
} else { |
|
$ret = 'Table0.'.$this->fds[$field]; |
|
} |
} |
} |
|
|
// what to do with $format XXX |
// what to do with $format XXX |
Line 279 class phpMyEdit { |
|
Line 294 class phpMyEdit { |
|
$fields[] = $this->fqn($k).' AS qf'.$k; |
$fields[] = $this->fqn($k).' AS qf'.$k; |
} else { |
} else { |
$fields[] = $this->fqn($k).' AS qf'.$k; |
$fields[] = $this->fqn($k).' AS qf'.$k; |
|
//echo '[['.$this->fqn($k).' AS qf'.$k.']]<br>'; |
} |
} |
} |
} |
return join(',',$fields); |
return join(',',$fields); |
Line 286 class phpMyEdit { |
|
Line 302 class phpMyEdit { |
|
|
|
function query_make($parts) /* {{{ */ |
function query_make($parts) /* {{{ */ |
{ |
{ |
foreach ($parts as $k => $v) |
foreach ($parts as $k => $v) { |
$parts[$k] = trim($parts[$k]); |
$parts[$k] = trim($parts[$k]); |
if ($parts['type'] == 'select') { |
} |
$ret = 'SELECT '; |
|
if ($parts['DISTINCT']) |
switch ($parts['type']) { |
$ret .= 'DISTINCT '; |
case 'select': |
$ret .= $parts['select']; |
$ret = 'SELECT '; |
$ret .= ' FROM '.$parts['from']; |
if ($parts['DISTINCT']) |
if ($parts['where'] != '') |
$ret .= 'DISTINCT '; |
$ret .= ' WHERE '.$parts['where']; |
$ret .= $parts['select']; |
if ($parts['groupby'] != '') |
$ret .= ' FROM '.$parts['from']; |
$ret .= ' GROUP BY '.$parts['groupby']; |
if ($parts['where'] != '') |
if ($parts['having'] != '') |
$ret .= ' WHERE '.$parts['where']; |
$ret .= ' HAVING '.$parts['having']; |
if ($parts['groupby'] != '') |
if ($parts['orderby'] != '') |
$ret .= ' GROUP BY '.$parts['groupby']; |
$ret .= ' ORDER BY '.$parts['orderby']; |
if ($parts['having'] != '') |
if ($parts['limit'] != '') |
$ret .= ' HAVING '.$parts['having']; |
$ret .= ' LIMIT '.$parts['limit']; |
if ($parts['orderby'] != '') |
if ($parts['procedure'] != '') |
$ret .= ' ORDER BY '.$parts['orderby']; |
$ret .= ' PROCEDURE '.$parts['procedure']; |
if ($parts['limit'] != '') |
} elseif ($parts['type'] == 'update') { |
$ret .= ' LIMIT '.$parts['limit']; |
$ret = 'UPDATE '.$parts['table']; |
if ($parts['procedure'] != '') |
$ret .= ' SET '.$parts['fields']; |
$ret .= ' PROCEDURE '.$parts['procedure']; |
if ($parts['where'] != '') |
break; |
$ret .= ' WHERE '.$parts['where']; |
case 'update': |
} elseif ($parts['type'] == 'insert') { |
$ret = 'UPDATE '.$parts['table']; |
$ret = 'INSERT INTO '.$parts['table']; |
$ret .= ' SET '.$parts['fields']; |
$ret .= ' VALUES '.$parts['values']; |
if ($parts['where'] != '') |
} elseif ($parts['type'] == 'delete') { |
$ret .= ' WHERE '.$parts['where']; |
$ret = 'DELETE FROM '.$parts['table']; |
break; |
if ($parts['where'] != '') |
case 'insert': |
$ret .= ' WHERE '.$parts['where']; |
$ret = 'INSERT INTO '.$parts['table']; |
|
$ret .= ' VALUES '.$parts['values']; |
|
break; |
|
case 'delete': |
|
$ret = 'DELETE FROM '.$parts['table']; |
|
if ($parts['where'] != '') |
|
$ret .= ' WHERE '.$parts['where']; |
|
break; |
|
default: |
|
die('unknown query type'); |
|
break; |
} |
} |
return $ret; |
return $ret; |
} /* }}} */ |
} /* }}} */ |
Line 432 class phpMyEdit { |
|
Line 458 class phpMyEdit { |
|
$qo = array(); |
$qo = array(); |
|
|
for ($k = 0; $k < $this->num_fds; $k++) { |
for ($k = 0; $k < $this->num_fds; $k++) { |
// get the field name and value |
$l = 'qf'.$k; |
$l = 'qf'.$k; |
$lc = 'qf'.$k.'_comp'; |
$lc = 'qf'.$k.'_comp'; |
$$l = $this->get_cgi_var($l); |
// TODO: REMOVE ME |
$$lc = $this->get_cgi_var($lc); |
//global $$l,$$lc; |
$m = $this->web2plain($$l); // get the field name and value |
$$l = $this->get_cgi_var($l); |
$mc = $this->web2plain($$lc); // get the comparison operator for numeric/date types |
$$lc = $this->get_cgi_var($lc); |
|
$m = $this->web2plain($$l); |
|
// get the comparison operator for numeric/date types |
|
$mc = $this->web2plain($$lc); |
|
|
|
$type = $this->fdd[$k]['type']; |
$type = $this->fdd[$k]['type']; |
|
|
if ($m != '') { |
if ($m != '') { |
Line 558 class phpMyEdit { |
|
Line 579 class phpMyEdit { |
|
function col_is_date($k) { return in_array($this->fdd[$k]['type'], $this->dateTypes ); } |
function col_is_date($k) { return in_array($this->fdd[$k]['type'], $this->dateTypes ); } |
function col_is_number($k) { return in_array($this->fdd[$k]['type'], $this->numberTypes); } |
function col_is_number($k) { return in_array($this->fdd[$k]['type'], $this->numberTypes); } |
function col_is_string($k) { return in_array($this->fdd[$k]['type'], $this->stringTypes); } |
function col_is_string($k) { return in_array($this->fdd[$k]['type'], $this->stringTypes); } |
function col_is_set($k) { return ($this->fdd[$k]['type'] == 'set'); } |
function col_is_set($k) { return $this->fdd[$k]['type'] == 'set'; } |
|
|
/* |
/* |
* functions for indicating whether operations are enabled |
* functions for indicating whether operations are enabled |
Line 578 class phpMyEdit { |
|
Line 599 class phpMyEdit { |
|
|
|
function add_operation() { |
function add_operation() { |
return ( $this->operation == $this->labels['Add'] |
return ( $this->operation == $this->labels['Add'] |
or $this->saveadd == $this->labels['Save']) |
/* or $this->saveadd == $this->labels['Save'] */) |
and $this->add_enabled(); |
and $this->add_enabled(); |
} |
} |
|
|
function more_operation() { |
function more_operation() { |
return ($this->moreadd == $this->labels['More']) |
return (0/* $this->moreadd == $this->labels['More'] */) |
and $this->add_enabled(); |
and $this->add_enabled(); |
} |
} |
|
|
function display_operation() { |
function display_operation() { |
return ($this->operation == $this->labels['Delete'] |
return ($this->operation == $this->labels['Delete'] |
or $this->savedelete == $this->labels['Save']) |
/* or $this->savedelete == $this->labels['Save'] */) |
and $this->delete_enabled(); |
and $this->delete_enabled(); |
} |
} |
|
|
function change_operation() { |
function change_operation() { |
return ($this->operation == $this->labels['Change'] |
return ($this->operation == $this->labels['Change'] |
or $this->savechange == $this->labels['Save']) |
/* or $this->savechange == $this->labels['Save'] */) |
and $this->change_enabled(); |
and $this->change_enabled(); |
} |
} |
|
|
function copy_operation() { |
function copy_operation() { |
return ($this->operation == $this->labels['Copy'] |
return ($this->operation == $this->labels['Copy'] |
or $this->savechange == $this->labels['Save']) |
/* or $this->savechange == $this->labels['Save'] */) |
and $this->add_enabled(); |
and $this->add_enabled(); |
} |
} |
|
|
function delete_operation() { |
function delete_operation() { |
return ($this->operation == $this->labels['Delete'] |
return ($this->operation == $this->labels['Delete'] |
or $this->savedelete == $this->labels['Save']) |
/* or $this->savedelete == $this->labels['Save'] */) |
and $this->delete_enabled(); |
and $this->delete_enabled(); |
} |
} |
|
|
Line 621 class phpMyEdit { |
|
Line 642 class phpMyEdit { |
|
|
|
function displayed($k) /* {{{ */ |
function displayed($k) /* {{{ */ |
{ |
{ |
//echo "<pre>"; |
if (is_numeric($k)) { |
//var_dump($this->fdd); |
$k = $this->fds[$k]; |
//echo "</pre><hr>"; |
} |
return ( |
//echo $k.': '.$this->fdd[$k]['options'].'<hr>'; |
! $this->hidden($k) && ( |
|
empty($this->fdd[$k]['options']) || |
return empty($this->fdd[$k]['options']) || |
|
( ! $this->hidden($k) && ( |
( $this->add_operation() and stristr($this->fdd[$k]['options'],'A')) || |
( $this->add_operation() and stristr($this->fdd[$k]['options'],'A')) || |
( $this->more_operation() and stristr($this->fdd[$k]['options'],'A')) || |
( $this->more_operation() and stristr($this->fdd[$k]['options'],'A')) || |
( $this->display_operation() and stristr($this->fdd[$k]['options'],'V')) || |
( $this->display_operation() and stristr($this->fdd[$k]['options'],'V')) || |
( $this->change_operation() and stristr($this->fdd[$k]['options'],'C')) || |
( $this->change_operation() and stristr($this->fdd[$k]['options'],'C')) || |
( $this->delete_operation() and stristr($this->fdd[$k]['options'],'D')) || |
( $this->delete_operation() and stristr($this->fdd[$k]['options'],'D')) || |
( $this->filter_operation() and stristr($this->fdd[$k]['options'],'F')) || |
( $this->filter_operation() and stristr($this->fdd[$k]['options'],'F')) || |
( stristr($this->fdd[$k]['options'],'L') and |
( stristr($this->fdd[$k]['options'],'L') and |
! $this->add_operation() && |
! $this->add_operation() && |
! $this->more_operation() && |
! $this->more_operation() && |
! $this->display_operation() && |
! $this->display_operation() && |
|
|
echo 'cols="'.$this->fdd[$k]['textarea']['cols'].'" '; |
echo 'cols="'.$this->fdd[$k]['textarea']['cols'].'" '; |
} |
} |
echo 'name="'.$this->fds[$k].'" wrap="virtual">'; |
echo 'name="'.$this->fds[$k].'" wrap="virtual">'; |
echo $this->htmldisplay( |
echo $this->htmlDisplay( |
$this->fdd[$k], |
$this->fdd[$k], |
$this->fdd[$k]['default'], |
$this->fdd[$k]['default'], |
false, false); |
false, false); |
|
|
echo ' '; |
echo ' '; |
echo '<td>'; |
echo '<td>'; |
if ($this->readonly($k)) { |
if ($this->readonly($k)) { |
echo $this->htmldisplay($this->fdd[$k],'',false,false) |
echo $this->htmlDisplay($this->fdd[$k],'',false,false) |
.'<input type="hidden" name="' |
.'<input type="hidden" name="' |
.$this->fds[$k] |
.$this->fds[$k] |
.'" value="' |
.'" value="' |
.$this->htmldisplay($this->fdd[$k],$this->fdd[$k]['default'],false,false) |
.$this->htmlDisplay($this->fdd[$k],$this->fdd[$k]['default'],false,false) |
.'" />'; |
.'" />'; |
} else { |
} else { |
if ($this->col_is_string($k) || $this->col_is_number($k)) { |
if ($this->col_is_string($k) || $this->col_is_number($k)) { |
|
|
$maxwidth = intval($this->fdd[$k]['maxlen']); |
$maxwidth = intval($this->fdd[$k]['maxlen']); |
$size = min(60,$maxwidth); |
$size = min(60,$maxwidth); |
echo '<input type="text" name="'.$this->fds[$k].'" size="'.$size.'" maxwidth="'.$maxwidth.'" value="' |
echo '<input type="text" name="'.$this->fds[$k].'" size="'.$size.'" maxwidth="'.$maxwidth.'" value="' |
.$this->htmldisplay($this->fdd[$k],$this->fdd[$k]['default'],false,false) |
.$this->htmlDisplay($this->fdd[$k],$this->fdd[$k]['default'],false,false) |
.'" />'; |
.'" />'; |
} elseif ($this->col_is_date($k)) { |
} elseif ($this->col_is_date($k)) { |
// date type, get date components |
// date type, get date components |
|
|
$maxwidth = intval($this->fdd[$k]['maxlen']); |
$maxwidth = intval($this->fdd[$k]['maxlen']); |
$size = min(60,$maxwidth); |
$size = min(60,$maxwidth); |
echo '<input type="text" name="'.$this->fds[$k].'" size="'.$size.'" maxwidth="'.$maxwidth.'" value="' |
echo '<input type="text" name="'.$this->fds[$k].'" size="'.$size.'" maxwidth="'.$maxwidth.'" value="' |
.$this->htmldisplay($this->fdd[$k],$this->fdd[$k]['default'],false,false) |
.$this->htmlDisplay($this->fdd[$k],$this->fdd[$k]['default'],false,false) |
.'" />'; |
.'" />'; |
} else { |
} else { |
// unknown type |
// unknown type |
echo '<input type="text" name="'.$this->fds[$k].'" value="' |
echo '<input type="text" name="'.$this->fds[$k].'" value="' |
.$this->htmldisplay($this->fdd[$k],$this->fdd[$k]['default'],false,false) |
.$this->htmlDisplay($this->fdd[$k],$this->fdd[$k]['default'],false,false) |
.'" />'; |
.'" />'; |
} |
} |
} |
} |
|
|
.$this->key_delim.$this->rec.$this->key_delim.')'; |
.$this->key_delim.$this->rec.$this->key_delim.')'; |
|
|
$res = $this->myquery($this->query_make($qparts),__LINE__); |
$res = $this->myquery($this->query_make($qparts),__LINE__); |
if ($row = mysql_fetch_array ($res)) { |
if ($row = mysql_fetch_array($res)) { |
for ($k = 0; $k < $this->num_fds; $k++) { |
for ($k = 0; $k < $this->num_fds; $k++) { |
if ($this->copy_operation()) { |
if ($this->copy_operation()) { |
if ($this->displayed($k)) { |
if ($this->displayed($k)) { |
|
|
echo $this->display_delete_field($row, $k); |
echo $this->display_delete_field($row, $k); |
} elseif ($this->password($k)) { |
} elseif ($this->password($k)) { |
echo ' <td><input type="password" name="'.$this->fds[$k] |
echo ' <td><input type="password" name="'.$this->fds[$k] |
.'" value="'.$this->htmldisplay($this->fdd[$k],$row[$k],false) |
.'" value="'.$this->htmlDisplay($this->fdd[$k],$row[$k],false) |
.'" /></td>'; |
.'" /></td>'; |
} else { |
} else { |
echo $this->display_change_field($row, $k); |
echo $this->display_change_field($row, $k); |
|
|
elseif ($this->hidden($k)) { |
elseif ($this->hidden($k)) { |
if ($k != $this->key_num) { |
if ($k != $this->key_num) { |
echo '<input type="hidden" name="'.$this->fds[$k] |
echo '<input type="hidden" name="'.$this->fds[$k] |
.'" value="'.$this->htmldisplay($this->fdd[$k],$row[$k],false) |
.'" value="'.$this->htmlDisplay($this->fdd[$k],$row[$k],false) |
.'" />'."\n"; |
.'" />'."\n"; |
} |
} |
} |
} |
} elseif ($this->change_operation()) { |
} elseif ($this->change_operation()) { |
if ( $this->hidden($k) ) { |
if ( $this->hidden($k) ) { |
echo '<input type="hidden" name="'.$this->fds[$k] |
echo '<input type="hidden" name="'.$this->fds[$k] |
.'" value="'.$this->htmldisplay($this->fdd[$k],$row[$k],false) |
.'" value="'.$this->htmlDisplay($this->fdd[$k],$row[$k],false) |
.'" />'."\n"; |
.'" />'."\n"; |
} elseif ( $this->displayed($k)) { |
} elseif ( $this->displayed($k)) { |
echo ' <tr>'."\n"; |
echo ' <tr>'."\n"; |
echo ' <td>'.$this->fdd[$k]['name'].'</td>'."\n"; |
echo ' <td>'.$this->fdd[$k]['name'].'</td>'."\n"; |
$this->display_change_field ($row, $k); |
$this->display_change_field($row, $k); |
if ($this->guidance) { |
if ($this->guidance) { |
if ($this->fdd[$k]['help']) |
if ($this->fdd[$k]['help']) |
echo ' <td>'.$this->fdd[$k]['help'].'</td>'."\n"; |
echo ' <td>'.$this->fdd[$k]['help'].'</td>'."\n"; |
|
|
echo ' </tr>'."\n"; |
echo ' </tr>'."\n"; |
} |
} |
} elseif ($this->delete_operation() || $this->view_operation()) { |
} elseif ($this->delete_operation() || $this->view_operation()) { |
if ( $this->displayed($k) ) { |
if ($this->displayed($k)) { |
echo ' <tr>'."\n"; |
echo ' <tr>'."\n"; |
echo ' <td>'.$this->fdd[$k]['name'].'</td>'."\n"; |
echo ' <td>'.$this->fdd[$k]['name'].'</td>'."\n"; |
$this->display_delete_field($row, $k); |
$this->display_delete_field($row, $k); |
|
|
|
|
function display_change_field($row, $k) /* {{{ */ |
function display_change_field($row, $k) /* {{{ */ |
{ |
{ |
$type = $this->fdd[$k]['type']; |
echo '<td>'."\n"; |
echo ' <td>'."\n"; |
|
$found = false; |
|
|
|
if ($this->col_is_set($k)) |
|
{ $a = ' multiple size="'.$this->multiple.'"'; } else { $a=''; } |
|
if (isset($this->fdd[$k]['values'])) { |
if (isset($this->fdd[$k]['values'])) { |
if (isset($this->fdd[$k]['values']['table'])) { |
if (isset($this->fdd[$k]['values']['table'])) { |
$vals = $this->set_values_from_table($k); |
$vals = $this->set_values_from_table($k); |
} else { |
} else { |
$vals = $this->fdd[$k]['values']; |
$vals = $this->fdd[$k]['values']; |
} |
} |
echo $this->htmlSelect($this->fds[$k],$vals,$row[$k]); |
echo $this->htmlSelect($this->fds[$k], $vals, $row[$k], $this->col_is_set($k)); |
} elseif (isset ($this->fdd[$k]['textarea'])) { |
} elseif (isset($this->fdd[$k]['textarea'])) { |
echo ' <textarea name="'.$this->fds[$k].'"'; |
echo '<textarea name="'.$this->fds[$k].'"'; |
// rows attr |
// rows attr |
if (isset ($this->fdd[$k]['textarea']['rows'])) { |
if (isset($this->fdd[$k]['textarea']['rows'])) { |
echo ' rows="'.$this->fdd[$k]['textarea']['rows'].'"'; |
echo ' rows="'.$this->fdd[$k]['textarea']['rows'].'"'; |
} |
} |
// cols attr |
// cols attr |
if (isset ($this->fdd[$k]['textarea']['cols'])) { |
if (isset($this->fdd[$k]['textarea']['cols'])) { |
echo ' cols="'.$this->fdd[$k]['textarea']['cols'].'"'; |
echo ' cols="'.$this->fdd[$k]['textarea']['cols'].'"'; |
} |
} |
// wrap attr |
// wrap attr |
if (isset($this->fdd[$k]['textarea']['wrap'])) |
if (isset($this->fdd[$k]['textarea']['wrap'])) { |
echo ' wrap="'.$this->fdd[$k]['textarea']['wrap'].'"'; |
echo ' wrap="'.$this->fdd[$k]['textarea']['wrap'].'"'; |
else |
} else { |
echo ' wrap="virtual"'; |
echo ' wrap="virtual"'; |
|
} |
echo '>'; |
echo '>'; |
echo $this->htmldisplay($this->fdd[$k],$row[$k],false); |
echo $this->htmlDisplay($this->fdd[$k], $row[$k], false); |
echo $row[$this->fds[$k]]; |
echo $row[$this->fds[$k]]; |
echo '</textarea>'."\n"; |
echo '</textarea>'."\n"; |
$found = true; |
|
} else { |
} else { |
echo ' '; |
|
if ($this->col_is_string($k) || $this->col_is_number($k)) { |
if ($this->col_is_string($k) || $this->col_is_number($k)) { |
// string type |
// string type |
$displaylen = 50; |
$displaylen = 50; |
|
|
} |
} |
echo '<input type="text" '.($this->readonly($k)?'disabled ':'') |
echo '<input type="text" '.($this->readonly($k)?'disabled ':'') |
.'name="'.$this->fds[$k].'" value="' |
.'name="'.$this->fds[$k].'" value="' |
.$this->htmldisplay($this->fdd[$k],$row[$k],false) |
.$this->htmlDisplay($this->fdd[$k],$row[$k],false) |
.'" size="'.$displaylen.'"/>'; |
.'" size="'.$displaylen.'"/>'; |
} elseif ($this->col_is_date($k)) { |
} elseif ($this->col_is_date($k)) { |
# date type, get date components |
# date type, get date components |
|
|
} |
} |
echo '<input type="text" '.($this->readonly($k)?'disabled ':'') |
echo '<input type="text" '.($this->readonly($k)?'disabled ':'') |
.'name="'.$this->fds[$k].'" value="' |
.'name="'.$this->fds[$k].'" value="' |
.$this->htmldisplay($this->fdd[$k],$row[$k],false) |
.$this->htmlDisplay($this->fdd[$k],$row[$k],false) |
.'" size="'.$displaylen.'"/>'; |
.'" size="'.$displaylen.'"/>'; |
} else { |
} else { |
// unknown type |
// unknown type |
echo '<input type="text" '.($this->readonly($k)?'disabled ':'') |
echo '<input type="text" '.($this->readonly($k)?'disabled ':'') |
.'name="'.$this->fds[$k].'" value="' |
.'name="'.$this->fds[$k].'" value="' |
.$this->htmldisplay($this->fdd[$k],$row[$k],false).'" />'; |
.$this->htmlDisplay($this->fdd[$k],$row[$k],false).'" />'; |
} |
} |
echo "\n"; |
echo "\n"; |
$found = true; |
|
} // if elseif else |
} // if elseif else |
echo ' </td>'."\n"; |
echo '</td>'."\n"; |
} // display_change_field($row, $k) /* }}} */ |
} // display_change_field($row, $k) /* }}} */ |
|
|
function htmlHidden($name,$value) /* {{{ */ |
function htmlHidden($name,$value) /* {{{ */ |
|
|
.'" value="'.htmlspecialchars($value).'">'."\n"; |
.'" value="'.htmlspecialchars($value).'">'."\n"; |
} /* }}} */ |
} /* }}} */ |
|
|
function htmlSelect($var,$kv_array,$selected,$multiple=false,$nat_sort=false) /* {{{ */ |
function htmlSelect($var, $kv_array, $selected, $multiple = false, $nat_sort = false) /* {{{ */ |
{ |
{ |
if ($nat_sort) |
|
uasort($kv_array,"strnatcasecmp"); |
|
if (! is_array($selected)) |
|
$selected = array($selected); |
|
$ret = '<select name="'.htmlspecialchars($var); |
$ret = '<select name="'.htmlspecialchars($var); |
if ($multiple != '') |
if ($multiple) { |
$ret .= '[]" multiple size="'.$this->multiple; |
$ret .= '[]" multiple size="'.$this->multiple; |
|
$selected = explode(',', $selected); |
|
} |
$ret .= '">'."\n"; |
$ret .= '">'."\n"; |
|
|
//$keys = array_keys($kv_array); |
if ($nat_sort) { |
|
uasort($kv_array,'strnatcasecmp'); |
|
} |
|
if (! is_array($selected)) { |
|
$selected = array($selected); |
|
} |
|
|
|
//$keys = array_keys($kv_array); |
//debug_var('selected',$selected); |
//debug_var('selected',$selected); |
|
|
$found = false; |
$found = false; |
foreach ($kv_array as $key=>$value) { |
foreach ($kv_array as $key => $value) { |
$ret .= '<option value="'.htmlspecialchars($key).'"'; |
$ret .= '<option value="'.htmlspecialchars($key).'"'; |
if ( ( ! $found || $multiple) && is_numeric(array_search($key,$selected))) |
if ((! $found || $multiple) && is_numeric(array_search($key, $selected))) { |
{ |
|
$ret .= ' selected'; |
$ret .= ' selected'; |
$found = true; |
$found = true; |
} |
} |
|
|
if ($row[$k] == '') { |
if ($row[$k] == '') { |
echo ' <td> </td>'."\n"; |
echo ' <td> </td>'."\n"; |
} else { |
} else { |
echo ' <td>'.nl2br($this->htmldisplay($this->fdd[$k],$row[$k])).'</td>'."\n"; |
echo ' <td>'.nl2br($this->htmlDisplay($this->fdd[$k],$row[$k])).'</td>'."\n"; |
} |
} |
} /* }}} */ |
} /* }}} */ |
|
|
|
|
// if the filter input boxes are not displayed, we need to preserve the filter |
// if the filter input boxes are not displayed, we need to preserve the filter |
if (!$this->fl) { |
if (!$this->fl) { |
for ($k = 0; $k < $this->num_fds; $k++) { |
for ($k = 0; $k < $this->num_fds; $k++) { |
$l = 'qf'.$k; |
$l = 'qf'.$k; |
global $$l; |
$lc = 'qf'.$k.'_comp'; |
$m = $this->web2plain($$l); |
$$l = $this->get_cgi_var($l); |
$lc = 'qf'.$k.'_comp'; |
$$lc = $this->get_cgi_var($lc); |
global $$lc; |
$m = $this->web2plain($$l); // get the field name and value |
$mc = $this->web2plain($$lc); |
$mc = $this->web2plain($$lc); // get the comparison operator for numeric/date types |
|
|
if (isset ($m)) { |
if (isset ($m)) { |
if (is_array($m)) { // multiple selection has been used |
if (is_array($m)) { // multiple selection has been used |
if (!in_array('*',$m)) {// one '*' in a multiple selection is all you need |
if (!in_array('*',$m)) {// one '*' in a multiple selection is all you need |
|
|
$prev_qfn = $this->qfn; |
$prev_qfn = $this->qfn; |
$this->qfn = ''; |
$this->qfn = ''; |
for ($k = 0; $k < $this->num_fds; $k++) { |
for ($k = 0; $k < $this->num_fds; $k++) { |
$l = 'qf'.$k; |
$l = 'qf'.$k; |
global $$l; |
$lc = 'qf'.$k.'_comp'; |
$m = $this->web2plain($$l); |
$$l = $this->get_cgi_var($l); |
$lc = 'qf'.$k.'_comp'; |
$$lc = $this->get_cgi_var($lc); |
global $$lc; |
$m = $this->web2plain($$l); // get the field name and value |
$mc = $this->web2plain($$lc); |
$mc = $this->web2plain($$lc); // get the comparison operator for numeric/date types |
|
|
if (isset ($m)) { |
if (isset ($m)) { |
if (is_array($m)) { // multiple selection has been used |
if (is_array($m)) { // multiple selection has been used |
if (!in_array('*',$m)) { // one '*' in a multiple selection is all you need |
if (!in_array('*',$m)) { // one '*' in a multiple selection is all you need |
|
|
} // if |
} // if |
|
|
// if we have any aggregates going on, then we have to list all results |
// if we have any aggregates going on, then we have to list all results |
$var_to_total = 'qf'.$k.'_aggr'; |
$var_to_total = 'qf'.$k.'_aggr'; |
global $$var_to_total; |
$$var_to_total = $this->get_cgi_var($var_to_total); |
if ($$var_to_total != '') { |
if ($$var_to_total != '') { |
$listall = true; |
$listall = true; |
} |
} |
|
|
} |
} |
|
|
while ($row = mysql_fetch_array ($res)) { |
while ($row = mysql_fetch_array ($res)) { |
$key_rec = $row[$this->key_num]; |
$key_rec = $row[$this->key_num]; |
$qviewStr = $qpviewStr .'&rec='.$key_rec; |
$qviewStr = $qpviewStr .'&rec='.$key_rec; |
$qcopyStr = $qpcopyStr .'&rec='.$key_rec; |
$qcopyStr = $qpcopyStr .'&rec='.$key_rec; |
$qchangeStr = $qpchangeStr.'&rec='.$key_rec; |
$qchangeStr = $qpchangeStr.'&rec='.$key_rec; |
$qdelStr = $qpdelStr .'&rec='.$key_rec; |
$qdeleteStr = $qpdeleteStr.'&rec='.$key_rec; |
echo ' <tr class="'.(($rowCount++%2)?'pme_tr_o':'pme_tr_e')."\">\n"; |
echo ' <tr class="'.(($rowCount++%2)?'pme_tr_o':'pme_tr_e')."\">\n"; |
echo ' <td NOWRAP align=center>'; |
echo ' <td NOWRAP align=center>'; |
if ($select_recs) { |
if ($select_recs) { |
|
|
) { |
) { |
*/ |
*/ |
} elseif ($this->displayed($k)) { |
} elseif ($this->displayed($k)) { |
|
// XXX: echo 'displayed: '.$k.'-'.$fd; |
if ((trim ($row[$k]) == '') or ($row[$k] == 'NULL')) { |
if ((trim ($row[$k]) == '') or ($row[$k] == 'NULL')) { |
echo ' <td> </td>'."\n"; |
echo ' <td> </td>'."\n"; |
} else { |
} else { |
|
|
$shortdisp = $row[$k]; |
$shortdisp = $row[$k]; |
} |
} |
echo nl2br( |
echo nl2br( |
$this->htmldisplay ( |
$this->htmlDisplay ( |
$this->fdd[$k], |
$this->fdd[$k], |
$shortdisp |
$shortdisp |
) |
) |
); |
); |
} else { |
} else { |
echo nl2br($this->htmldisplay($this->fdd[$k],$row[$k])); |
echo nl2br($this->htmlDisplay($this->fdd[$k],$row[$k])); |
} |
} |
} else { |
} else { |
// it's a normal field |
// it's a normal field |
|
|
$shortdisp = $row[$k]; |
$shortdisp = $row[$k]; |
} |
} |
echo nl2br( |
echo nl2br( |
$this->htmldisplay ( |
$this->htmlDisplay ( |
$this->fdd[$k], |
$this->fdd[$k], |
$shortdisp |
$shortdisp |
) |
) |
); |
); |
} else { |
} else { |
echo nl2br($this->htmldisplay($this->fdd[$k],$row[$k])); |
echo nl2br($this->htmlDisplay($this->fdd[$k],$row[$k])); |
} |
} |
} |
} |
} else { |
} else { |
|
|
} // for |
} // for |
|
|
echo ' </tr>'."\n"; |
echo ' </tr>'."\n"; |
--$eot; |
$eot--; |
} // while |
} // while |
|
|
|
|
|
|
} |
} |
|
|
if ($this->actionStyle == 'button') { |
if ($this->actionStyle == 'button') { |
if ($this->view_enabled ()) { |
if ($this->view_enabled()) { |
echo ' <td><input'; |
echo ' <td><input'; |
if ($first) { echo ' disabled'; } |
if ($first) { echo ' disabled'; } |
echo ' type="submit" name="operation" value="'.$this->labels['Display'].'" /></td>'."\n"; |
echo ' type="submit" name="operation" value="'.$this->labels['Display'].'" /></td>'."\n"; |
} |
} |
if ($this->change_enabled ()) { |
if ($this->change_enabled()) { |
echo ' <td><input'; |
echo ' <td><input'; |
if ($first) { echo ' disabled'; } |
if ($first) { echo ' disabled'; } |
echo ' type="submit" name="operation" value="'.$this->labels['Change'].'" /></td>'."\n"; |
echo ' type="submit" name="operation" value="'.$this->labels['Change'].'" /></td>'."\n"; |
} |
} |
if ($this->copy_enabled ()) { |
if ($this->copy_enabled()) { |
echo ' <td><input'; |
echo ' <td><input'; |
if ($first) { echo ' disabled'; } |
if ($first) { echo ' disabled'; } |
echo ' type="submit" name="operation" value="'.$this->labels['Copy'].'" /></td>'."\n"; |
echo ' type="submit" name="operation" value="'.$this->labels['Copy'].'" /></td>'."\n"; |
} |
} |
if ($this->delete_enabled ()) { |
if ($this->delete_enabled()) { |
echo ' <td><input'; |
echo ' <td><input'; |
if ($first) { echo ' disabled'; } |
if ($first) { echo ' disabled'; } |
echo ' type="submit" name="operation" value="'.$this->labels['Delete'].'" /></td>'."\n"; |
echo ' type="submit" name="operation" value="'.$this->labels['Delete'].'" /></td>'."\n"; |
Line 2525 echo '<h5>'.mysql_affected_rows ().' '.$ |
|
Line 2547 echo '<h5>'.mysql_affected_rows ().' '.$ |
|
$this->key_type = $opts['key_type']; |
$this->key_type = $opts['key_type']; |
$this->inc = $opts['inc']; |
$this->inc = $opts['inc']; |
$this->options = $opts['options']; |
$this->options = $opts['options']; |
$this->multiple = $opts['multiple']; |
|
$this->fdd = $opts['fdd']; |
$this->fdd = $opts['fdd']; |
if (!isset($this->multiple)) |
$this->multiple = intval($opts['multiple']); |
$this->multiple=2; |
if ($this->multiple <= 0) { |
|
$this->multiple = 2; |
|
} |
$this->display_sort = $opts['display_sort']; |
$this->display_sort = $opts['display_sort']; |
$this->display_query = $opts['display_query']; |
$this->display_query = $opts['display_query']; |
if ($opts['language']) { |
if ($opts['language']) { |