| version 1.31, 2002/11/22 12:48:46 |
version 1.32, 2002/11/24 17:01:11 |
|
|
| * http://www.platon.sk/projects/phpMyEdit/ |
* http://www.platon.sk/projects/phpMyEdit/ |
| */ |
*/ |
| |
|
| /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.30 2002/11/22 00:21:49 nepto Exp $ */ |
/* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.31 2002/11/22 12:48:46 nepto Exp $ */ |
| |
|
| /* phpMyEdit intro {{{ */ |
/* phpMyEdit intro {{{ */ |
| /* |
/* |
| Line 846 function form_control(theForm) |
|
| Line 846 function form_control(theForm) |
|
| .'" value="' |
.'" value="' |
| .$this->htmlDisplay($this->fdd[$k], $this->fdd[$k]['default'], |
.$this->htmlDisplay($this->fdd[$k], $this->fdd[$k]['default'], |
| false, false, false) |
false, false, false) |
| .'" />'; |
.'" /> '; |
| } else { |
} else { |
| |
$size_ml_props = ''; |
| |
if ($this->fdd[$k]['type'] != 'blob') { |
| |
$maxlen = intval($this->fdd[$k]['maxlen']); |
| |
$maxlen > 0 || $maxlen = 300; |
| |
$size = min($maxlen, 60); |
| |
$size && $size_ml_props .= ' size="'.$size.'"'; |
| |
$maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"'; |
| |
} |
| 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 |
| $maxwidth = intval($this->fdd[$k]['maxlen']); |
echo '<input type="text" name="'.$this->fds[$k].'"' |
| $size = min(60,$maxwidth); |
.$size_ml_props.' value="' |
| echo '<input type="text" name="'.$this->fds[$k] |
|
| .'" size="'.$size.'" maxlength="'.$maxwidth.'" value="' |
|
| .$this->htmlDisplay($this->fdd[$k],$this->fdd[$k]['default'], |
.$this->htmlDisplay($this->fdd[$k],$this->fdd[$k]['default'], |
| false, false, false) |
false, false, false) |
| .'" />'; |
.'">'; |
| } elseif ($this->col_is_date($k)) { |
} elseif ($this->col_is_date($k)) { |
| // date type, get date components |
// date type, get date components |
| //if ($this->fdd[$k]['default']) |
//if ($this->fdd[$k]['default']) |
| Line 864 function form_control(theForm) |
|
| Line 870 function form_control(theForm) |
|
| //$value = time(); |
//$value = time(); |
| //echo $this->mdate_disperse($k,$value,true); |
//echo $this->mdate_disperse($k,$value,true); |
| // string type |
// string type |
| $maxwidth = intval($this->fdd[$k]['maxlen']); |
echo '<input type="text" name="'.$this->fds[$k].'"' |
| $size = min(60, $maxwidth); |
.$size_ml_props.' value="' |
| echo '<input type="text" name="'.$this->fds[$k] |
|
| .'" size="'.$size.'" maxlength="'.$maxwidth.'" value="' |
|
| .$this->htmlDisplay($this->fdd[$k],$this->fdd[$k]['default'], |
.$this->htmlDisplay($this->fdd[$k],$this->fdd[$k]['default'], |
| false, false, false) |
false, 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="' |
| Line 884 function form_control(theForm) |
|
| Line 888 function form_control(theForm) |
|
| 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"; |
| } else { |
|
| echo "<td> </td>\n"; |
|
| } |
} |
| echo '</tr>'."\n"; |
echo '</tr>'."\n"; |
| } // for() |
} // for() |
| Line 1001 function form_control(theForm) |
|
| Line 1003 function form_control(theForm) |
|
| echo $row[$this->fds[$k]]; |
echo $row[$this->fds[$k]]; |
| echo '</textarea>'."\n"; |
echo '</textarea>'."\n"; |
| } else { |
} else { |
| |
$size_ml_props = ''; |
| |
if ($this->fdd[$k]['type'] != 'blob') { |
| |
$maxlen = intval($this->fdd[$k]['maxlen']); |
| |
$maxlen > 0 || $maxlen = 300; |
| |
$size = min($maxlen, 60); |
| |
$size && $size_ml_props .= ' size="'.$size.'"'; |
| |
$maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"'; |
| |
} |
| 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; |
|
| if (isset($this->fdd[$k]['maxlen'])) { |
|
| $displaylen = min($displaylen,$this->fdd[$k]['maxlen']); |
|
| } |
|
| 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["qf$k"], |
.$this->htmlDisplay($this->fdd[$k], $row["qf$k"], false, true, false) |
| false, true, false) |
.'" '.$size_ml_props.'>'; |
| .'" size="'.$displaylen.'"/>'; |
|
| } elseif ($this->col_is_date($k)) { |
} elseif ($this->col_is_date($k)) { |
| # date type, get date components |
# date type, get date components |
| #$value = $this->mdate_from_mysql($row[$k]); |
#$value = $this->mdate_from_mysql($row[$k]); |
| Line 1024 function form_control(theForm) |
|
| Line 1029 function form_control(theForm) |
|
| # echo $this->mdate_disperse($k,$value,true); |
# echo $this->mdate_disperse($k,$value,true); |
| #} |
#} |
| // string type |
// string type |
| $displaylen = 50; |
|
| if (isset($this->fdd[$k]['maxlen'])) { |
|
| $displaylen = min($displaylen,$this->fdd[$k]['maxlen']); |
|
| } |
|
| 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["qf$k"], |
.$this->htmlDisplay($this->fdd[$k], $row["qf$k"], false, true, false) |
| false, true, false) |
.'" '.$size_ml_props.'>'; |
| .'" size="'.$displaylen.'">'; |
|
| } else { |
} else { |
| // unknown type |
// unknown type |
| echo '<input type="text" '.($this->readonly($k)?'disabled ':'') |
echo '<input type="text" '.($this->readonly($k)?'disabled ':'') |
| Line 1754 function form_control(theForm) |
|
| Line 1754 function form_control(theForm) |
|
| } elseif ($this->fdd[$fd]['select'] == 'T') { |
} elseif ($this->fdd[$fd]['select'] == 'T') { |
| // this is where we put the comparison selects |
// this is where we put the comparison selects |
| if (! $this->password($k) && ! $this->hidden($k)) { |
if (! $this->password($k) && ! $this->hidden($k)) { |
| $maxlen = intval($this->fdd[$k]['maxlen']); |
$size_ml_props = ''; |
| !$maxlen && $maxlen = intval(@mysql_field_len($res, $kk /* "qf$k" */)); |
if ($type != 'blob') { |
| $size = $maxlen < 30 ? min(max(1, $maxlen), 8) : 12; |
$maxlen = intval($this->fdd[$k]['maxlen']); |
| |
$maxlen > 0 || $maxlen = intval(@mysql_field_len($res, $kk)); |
| |
$size = $maxlen < 30 ? min($maxlen, 8) : 12; |
| |
$size && $size_ml_props .= ' size="'.$size.'"'; |
| |
$maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"'; |
| |
} |
| if ($this->col_is_string($k)) { |
if ($this->col_is_string($k)) { |
| // it's treated as a string |
// it's treated as a string |
| echo '<input type="text" name="qf'.$k.'"'; |
echo '<input type="text" name="qf'.$k.'"'; |
| echo ' value="'.stripslashes($m).'"'; |
echo ' value="'.stripslashes($m).'"'.$size_ml_props.'>'; |
| if ($type != 'blob') { |
|
| echo ' size="'.$size.'" maxlength="'.$maxlen.'"'; |
|
| } |
|
| echo '/>'; |
|
| } elseif ($this->col_is_date($k)) { |
} elseif ($this->col_is_date($k)) { |
| // it's a date |
// it's a date |
| //echo $this->htmlSelect($l.'_comp',$comp_ops,$$lc); |
//echo $this->htmlSelect($l.'_comp',$comp_ops,$$lc); |
| Line 1782 function form_control(theForm) |
|
| Line 1783 function form_control(theForm) |
|
| //} |
//} |
| // it's treated as a string |
// it's treated as a string |
| echo '<input type="text" name="qf'.$k.'"'; |
echo '<input type="text" name="qf'.$k.'"'; |
| echo ' value="'.stripslashes($m).'"'; |
echo ' value="'.stripslashes($m).'"'.$size_ml_props.'>'; |
| if ($type != 'blob') { |
|
| echo ' size="'.$size.'" maxlength="'.$maxlen.'"'; |
|
| } |
|
| echo '/>'; |
|
| } elseif ($this->col_is_number($k)) { |
} elseif ($this->col_is_number($k)) { |
| // it's a number |
// it's a number |
| echo $this->htmlSelect($l.'_comp',$comp_ops,$$lc); |
echo $this->htmlSelect($l.'_comp',$comp_ops,$$lc); |
| // it's treated as a string |
// it's treated as a string |
| echo '<input type="text" name="qf'.$k.'"' |
echo '<input type="text" name="qf'.$k.'"' |
| .' value="'.$m.'"' |
.' value="'.$m.'"'.$size_ml_props.'>'; |
| .' size="'.$size.'" maxlength="'.$maxlen.'"' |
|
| .'/>'; |
|
| } else { |
} else { |
| // type is 'unknown' or not set, it's treated as a string |
// type is 'unknown' or not set, it's treated as a string |
| echo '<input type="text" name="qf'.$k.'"'; |
echo '<input type="text" name="qf'.$k.'"'; |
| echo ' value="'.stripslashes($m).'"'; |
echo ' value="'.stripslashes($m).'"'.$size_ml_props.'>'; |
| if ($type != 'blob') { |
|
| echo ' size="'.$size.'" maxlength="'.$maxlen.'"'; |
|
| } |
|
| echo '/>'; |
|
| } |
} |
| } else { |
} else { |
| echo " "; |
echo " "; |
| Line 2383 function form_control(theForm) |
|
| Line 2374 function form_control(theForm) |
|
| if ($this->processed($k) && ! $this->readonly($k)) { |
if ($this->processed($k) && ! $this->readonly($k)) { |
| $fd = $this->fds[$k]; |
$fd = $this->fds[$k]; |
| if ($fd == $this->key) { |
if ($fd == $this->key) { |
| // XXX: remove me! |
|
| //$key_col_val = addslashes($this->get_http_post_var_by_name($fd)); |
|
| $key_col_val = addslashes($this->get_cgi_var($fd)); |
$key_col_val = addslashes($this->get_cgi_var($fd)); |
| } |
} |
| // XXX: detto |
|
| //$fn = $this->get_http_post_var_by_name($fd); |
|
| $fn = $this->get_cgi_var($fd); |
$fn = $this->get_cgi_var($fd); |
| /* |
/* |
| if ($this->col_is_date($k)) |
if ($this->col_is_date($k)) |