version 1.187, 2006/09/08 16:18:03 |
version 1.188, 2006/09/08 16:30:31 |
|
|
* http://platon.sk/projects/phpMyEdit/ |
* http://platon.sk/projects/phpMyEdit/ |
*/ |
*/ |
|
|
/* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.186 2006-09-08 14:25:48 michal Exp $ */ |
/* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.187 2006-09-08 16:18:03 michal Exp $ */ |
|
|
/* This is a generic table editing program. The table and fields to be |
/* This is a generic table editing program. The table and fields to be |
edited are defined in the calling program. |
edited are defined in the calling program. |
Line 980 function '.$this->js['prefix'].'filter_h |
|
Line 980 function '.$this->js['prefix'].'filter_h |
|
} |
} |
} elseif (isset ($this->fdd[$k]['textarea'])) { |
} elseif (isset ($this->fdd[$k]['textarea'])) { |
echo '<textarea class="',$css_class_name,'" name="',$this->cgi['prefix']['data'].$this->fds[$k],'"'; |
echo '<textarea class="',$css_class_name,'" name="',$this->cgi['prefix']['data'].$this->fds[$k],'"'; |
echo ($this->readonly($k) ? ' disabled' : ''); |
echo ($this->readonly($k) ? ' disabled="disabled"' : ''); |
if (intval($this->fdd[$k]['textarea']['rows']) > 0) { |
if (intval($this->fdd[$k]['textarea']['rows']) > 0) { |
echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"'; |
echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"'; |
} |
} |
Line 1007 function '.$this->js['prefix'].'filter_h |
|
Line 1007 function '.$this->js['prefix'].'filter_h |
|
$maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"'; |
$maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"'; |
echo '<input class="',$css_class_name,'" '; |
echo '<input class="',$css_class_name,'" '; |
echo ($this->password($k) ? 'type="password"' : 'type="text"'); |
echo ($this->password($k) ? 'type="password"' : 'type="text"'); |
echo ($this->readonly($k) ? ' disabled' : ''); |
echo ($this->readonly($k) ? ' disabled="disabled"' : ''); |
echo ' name="',$this->cgi['prefix']['data'].$this->fds[$k],'"'; |
echo ' name="',$this->cgi['prefix']['data'].$this->fds[$k],'"'; |
echo $size_ml_props,' value="'; |
echo $size_ml_props,' value="'; |
if($escape) echo htmlspecialchars($this->fdd[$k]['default']); |
if($escape) echo htmlspecialchars($this->fdd[$k]['default']); |
Line 1124 function '.$this->js['prefix'].'filter_h |
|
Line 1124 function '.$this->js['prefix'].'filter_h |
|
} |
} |
} elseif (isset($this->fdd[$k]['textarea'])) { |
} elseif (isset($this->fdd[$k]['textarea'])) { |
echo '<textarea class="',$css_class_name,'" name="',$this->cgi['prefix']['data'].$this->fds[$k],'"'; |
echo '<textarea class="',$css_class_name,'" name="',$this->cgi['prefix']['data'].$this->fds[$k],'"'; |
echo ($this->readonly($k) ? ' disabled' : ''); |
echo ($this->readonly($k) ? ' disabled="disabled"' : ''); |
if (intval($this->fdd[$k]['textarea']['rows']) > 0) { |
if (intval($this->fdd[$k]['textarea']['rows']) > 0) { |
echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"'; |
echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"'; |
} |
} |
Line 1149 function '.$this->js['prefix'].'filter_h |
|
Line 1149 function '.$this->js['prefix'].'filter_h |
|
$size && $size_ml_props .= ' size="'.$size.'"'; |
$size && $size_ml_props .= ' size="'.$size.'"'; |
$maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"'; |
$maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"'; |
echo '<input class="',$css_class_name,'" type="text" '; |
echo '<input class="',$css_class_name,'" type="text" '; |
echo ($this->readonly($k) ? 'disabled ' : ''); |
echo ($this->readonly($k) ? 'disabled="disabled" ' : ''); |
echo 'name="',$this->cgi['prefix']['data'].$this->fds[$k],'" value="'; |
echo 'name="',$this->cgi['prefix']['data'].$this->fds[$k],'" value="'; |
if($escape) echo htmlspecialchars($row["qf$k"]); |
if($escape) echo htmlspecialchars($row["qf$k"]); |
else echo $row["qf$k"]; |
else echo $row["qf$k"]; |
Line 1169 function '.$this->js['prefix'].'filter_h |
|
Line 1169 function '.$this->js['prefix'].'filter_h |
|
$size && $size_ml_props .= ' size="'.$size.'"'; |
$size && $size_ml_props .= ' size="'.$size.'"'; |
$maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"'; |
$maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"'; |
echo '<input class="',$this->getCSSclass('value', null, true, $css_postfix),'" type="password" '; |
echo '<input class="',$this->getCSSclass('value', null, true, $css_postfix),'" type="password" '; |
echo ($this->readonly($k) ? 'disabled ' : ''); |
echo ($this->readonly($k) ? 'disabled="disabled" ' : ''); |
echo 'name="',$this->cgi['prefix']['data'].$this->fds[$k],'" value="'; |
echo 'name="',$this->cgi['prefix']['data'].$this->fds[$k],'" value="'; |
echo htmlspecialchars($row["qf$k"]),'" ',$size_ml_props,' />',"\n"; |
echo htmlspecialchars($row["qf$k"]),'" ',$size_ml_props,' />',"\n"; |
echo '</td>',"\n"; |
echo '</td>',"\n"; |
Line 1395 function '.$this->js['prefix'].'filter_h |
|
Line 1395 function '.$this->js['prefix'].'filter_h |
|
{ |
{ |
// Note that <input disabled> isn't valid HTML, but most browsers support it |
// Note that <input disabled> isn't valid HTML, but most browsers support it |
if($disabled == -1) return; |
if($disabled == -1) return; |
$markdisabled = $disabled ? ' disabled' : ''; |
$markdisabled = $disabled ? ' disabled="disabled"' : ''; |
$ret = '<input'.$markdisabled.' type="submit" class="'.$css_class_name |
$ret = '<input'.$markdisabled.' type="submit" class="'.$css_class_name |
.'" name="'.$this->cgi['prefix']['sys'].ltrim($markdisabled).$name |
.'" name="'.$this->cgi['prefix']['sys'].ltrim($markdisabled).$name |
.'" value="'.(isset($this->labels[$label]) ? $this->labels[$label] : $label); |
.'" value="'.(isset($this->labels[$label]) ? $this->labels[$label] : $label); |
if ($js_validation) { |
if ($js_validation) { |
$ret .= '" onClick="return '.$this->js['prefix'].'form_control(this.form);'; |
$ret .= '" onclick="return '.$this->js['prefix'].'form_control(this.form);'; |
} |
} |
$ret .='"'; |
$ret .='"'; |
if(isset($js)) $ret .= ' '.$js; |
if(isset($js)) $ret .= ' '.$js; |
Line 1443 function '.$this->js['prefix'].'filter_h |
|
Line 1443 function '.$this->js['prefix'].'filter_h |
|
* @param readonly bool for readonly/disabled selection |
* @param readonly bool for readonly/disabled selection |
* @param strip_tags bool for stripping tags from values |
* @param strip_tags bool for stripping tags from values |
* @param escape bool for HTML escaping values |
* @param escape bool for HTML escaping values |
* @param js string to be in the <select >, ususally onChange='..'; |
* @param js string to be in the <select >, ususally onchange='..'; |
*/ |
*/ |
function htmlSelect($name, $css, $kv_array, $selected = null, /* ...) {{{ */ |
function htmlSelect($name, $css, $kv_array, $selected = null, /* ...) {{{ */ |
/* booleans: */ $multiple = false, $readonly = false, $strip_tags = false, $escape = true, $js = NULL) |
/* booleans: */ $multiple = false, $readonly = false, $strip_tags = false, $escape = true, $js = NULL) |
Line 1455 function '.$this->js['prefix'].'filter_h |
|
Line 1455 function '.$this->js['prefix'].'filter_h |
|
$selected = explode(',', $selected); |
$selected = explode(',', $selected); |
} |
} |
} |
} |
$ret .= '"'.($readonly ? ' disabled' : '').$js.'>'."\n"; |
$ret .= '"'.($readonly ? ' disabled="disabled"' : '').$js.'>'."\n"; |
if (! is_array($selected)) { |
if (! is_array($selected)) { |
$selected = $selected === null ? array() : array($selected); |
$selected = $selected === null ? array() : array($selected); |
} |
} |
Line 1464 function '.$this->js['prefix'].'filter_h |
|
Line 1464 function '.$this->js['prefix'].'filter_h |
|
$ret .= '<option value="'.htmlspecialchars($key).'"'; |
$ret .= '<option value="'.htmlspecialchars($key).'"'; |
if ((! $found || $multiple) && in_array((string) $key, $selected, 1) |
if ((! $found || $multiple) && in_array((string) $key, $selected, 1) |
|| (count($selected) == 0 && ! $found && ! $multiple)) { |
|| (count($selected) == 0 && ! $found && ! $multiple)) { |
$ret .= ' selected'; |
$ret .= ' selected="selected"'; |
$found = true; |
$found = true; |
} |
} |
$strip_tags && $value = strip_tags($value); |
$strip_tags && $value = strip_tags($value); |
Line 1487 function '.$this->js['prefix'].'filter_h |
|
Line 1487 function '.$this->js['prefix'].'filter_h |
|
* @param readonly bool for readonly/disabled selection |
* @param readonly bool for readonly/disabled selection |
* @param strip_tags bool for stripping tags from values |
* @param strip_tags bool for stripping tags from values |
* @param escape bool for HTML escaping values |
* @param escape bool for HTML escaping values |
* @param js string to be in the <select >, ususally onChange='..'; |
* @param js string to be in the <select >, ususally onchange='..'; |
*/ |
*/ |
function htmlRadioCheck($name, $css, $kv_array, $selected = null, /* ...) {{{ */ |
function htmlRadioCheck($name, $css, $kv_array, $selected = null, /* ...) {{{ */ |
/* booleans: */ $multiple = false, $readonly = false, $strip_tags = false, $escape = true, $js = NULL) |
/* booleans: */ $multiple = false, $readonly = false, $strip_tags = false, $escape = true, $js = NULL) |
Line 1511 function '.$this->js['prefix'].'filter_h |
|
Line 1511 function '.$this->js['prefix'].'filter_h |
|
$found = true; |
$found = true; |
} |
} |
if ($readonly) { |
if ($readonly) { |
$ret .= ' disabled'; |
$ret .= ' disabled="disabled"'; |
} |
} |
$strip_tags && $value = strip_tags($value); |
$strip_tags && $value = strip_tags($value); |
$escape && $value = htmlspecialchars($value); |
$escape && $value = htmlspecialchars($value); |
Line 1866 function '.$this->js['prefix'].'filter_h |
|
Line 1866 function '.$this->js['prefix'].'filter_h |
|
} |
} |
if ($name == 'savedelete') { |
if ($name == 'savedelete') { |
$enabled = $this->delete_enabled(); |
$enabled = $this->delete_enabled(); |
$js = 'onClick="return confirm(\''.$this->labels['Delete'].' ?\');"'; |
$js = 'onclick="return confirm(\''.$this->labels['Delete'].' ?\');"'; |
return $this->htmlSubmit('savedelete', 'Delete', |
return $this->htmlSubmit('savedelete', 'Delete', |
$this->getCSSclass('save', $position), false, $enabled ? 0 : $disabled, $js); |
$this->getCSSclass('save', $position), false, $enabled ? 0 : $disabled, $js); |
} |
} |
Line 1902 function '.$this->js['prefix'].'filter_h |
|
Line 1902 function '.$this->js['prefix'].'filter_h |
|
$ret .= ' name="'.$this->cgi['prefix']['sys'].'navpn'.$position.'" value="'.($current_page+1).'"'; |
$ret .= ' name="'.$this->cgi['prefix']['sys'].'navpn'.$position.'" value="'.($current_page+1).'"'; |
$ret .= ' size="'.(strlen($total_pages)+1).'" maxlength="'.(strlen($total_pages)+1).'"'; |
$ret .= ' size="'.(strlen($total_pages)+1).'" maxlength="'.(strlen($total_pages)+1).'"'; |
// TODO some js here.... on enter submit, on click erase ?... |
// TODO some js here.... on enter submit, on click erase ?... |
$ret .=' onKeyPress="return PE_filter_handler(this.form, event);" />'; |
$ret .=' oneypress="return PE_filter_handler(this.form, event);" />'; |
return $ret; |
return $ret; |
} |
} |
if ($name == 'goto_combo') { |
if ($name == 'goto_combo') { |
Line 1912 function '.$this->js['prefix'].'filter_h |
|
Line 1912 function '.$this->js['prefix'].'filter_h |
|
for ($i = 0; $i < $total_pages; $i++) { |
for ($i = 0; $i < $total_pages; $i++) { |
$kv_array[$this->inc * $i] = $i + 1; |
$kv_array[$this->inc * $i] = $i + 1; |
} |
} |
// TODO: add onChange="return this.form.submit();" DONE ??? |
// TODO: add onchange="return this.form.submit();" DONE ??? |
return $this->htmlSelect($this->cgi['prefix']['sys'].ltrim($disabledgoto).'navfm'.$position, |
return $this->htmlSelect($this->cgi['prefix']['sys'].ltrim($disabledgoto).'navfm'.$position, |
$this->getCSSclass('goto', $position), $kv_array, (string)$this->fm, false, $disabledgoto, |
$this->getCSSclass('goto', $position), $kv_array, (string)$this->fm, false, $disabledgoto, |
false, true, 'onChange="return this.form.submit();"'); |
false, true, 'onchange="return this.form.submit();"'); |
} |
} |
if ($name == 'goto') { |
if ($name == 'goto') { |
return $this->htmlSubmit('navop', 'Go to', $this->getCSSclass('goto', $position), |
return $this->htmlSubmit('navop', 'Go to', $this->getCSSclass('goto', $position), |
Line 2202 function '.$this->js['prefix'].'filter_h |
|
Line 2202 function '.$this->js['prefix'].'filter_h |
|
} |
} |
echo '<input class="',$css_class_name,'" value="',htmlspecialchars(@$m); |
echo '<input class="',$css_class_name,'" value="',htmlspecialchars(@$m); |
echo '" type="text" name="'.$this->cgi['prefix']['sys'].'qf'.$k.'"',$size_ml_props; |
echo '" type="text" name="'.$this->cgi['prefix']['sys'].'qf'.$k.'"',$size_ml_props; |
echo ' onKeyPress="return '.$this->js['prefix'].'filter_handler(this.form, event);" />'; |
echo ' onkeypress="return '.$this->js['prefix'].'filter_handler(this.form, event);" />'; |
} else { |
} else { |
echo ' '; |
echo ' '; |
} |
} |