* Copyright (c) 2006 Platon Group, http://platon.sk/ * All rights reserved. * * See README file for more information about this software. * See COPYING file for license information. * * Download the latest version from * http://platon.sk/projects/phpMyEdit/ */ /* $Platon: phpMyEdit/extensions/phpMyEdit-xstandard.class.php,v 1.4 2007-01-26 11:24:26 nepto Exp $ */ require_once dirname(__FILE__).'/../phpMyEdit.class.php'; class phpMyEdit_xstandard extends phpMyEdit { function form_begin() /* {{{ */ { $page_name = htmlspecialchars($this->page_name); if ($this->add_operation() || $this->change_operation() || $this->copy_operation() || $this->view_operation() || $this->delete_operation()) { $field_to_tab = array(); for ($tab = $k = $this->cur_tab = 0; $k < $this->num_fds; $k++) { if (isset($this->fdd[$k]['tab'])) { if ($tab == 0 && $k > 0) { $this->tabs[0] = 'PMEtab0'; $this->cur_tab = 1; $tab++; } if (is_array($this->fdd[$k]['tab'])) { $this->tabs[$tab] = @$this->fdd[$k]['tab']['name']; $this->fdd[$k]['tab']['default'] && $this->cur_tab = $tab; } else { $this->tabs[$tab] = @$this->fdd[$k]['tab']; } $tab++; } $field_to_tab[$k] = max(0, $tab - 1); } if (preg_match('/^'.$this->dhtml['prefix'].'tab(\d+)$/', $this->get_sys_cgi_var('cur_tab'), $parts)) { $this->cur_tab = $parts[1]; } if ($this->tabs_enabled()) { // initial TAB styles echo '',"\n"; // TAB javascripts echo '', "\n"; } } if ($this->add_operation() || $this->change_operation() || $this->copy_operation()) { $first_required = true; for ($k = 0; $k < $this->num_fds; $k++) { if ($this->displayed[$k] && ! $this->readonly($k) && ! $this->hidden($k) && ($this->fdd[$k]['js']['required'] || isset($this->fdd[$k]['js']['regexp']) /* */ || isset($this->fdd[$k]['textarea']['xstandard']) /* */ )) { if ($first_required) { $first_required = false; echo '', "\n"; } } if ($this->filter_operation()) { echo '', "\n"; } if ($this->display['form']) { echo '
',"\n"; } return true; } /* }}} */ function display_add_record() /* {{{ */ { for ($tab = 0, $k = 0; $k < $this->num_fds; $k++) { if (isset($this->fdd[$k]['tab']) && $this->tabs_enabled() && $k > 0) { $tab++; echo '',"\n"; echo '',"\n"; echo '
',"\n"; echo '',"\n"; } if (! $this->displayed[$k]) { continue; } if ($this->hidden($k)) { echo $this->htmlHiddenData($this->fds[$k], $this->fdd[$k]['default']); continue; } $css_postfix = @$this->fdd[$k]['css']['postfix']; $css_class_name = $this->getCSSclass('input', null, 'next', $css_postfix); $escape = isset($this->fdd[$k]['escape']) ? $this->fdd[$k]['escape'] : true; echo '',"\n"; echo '',"\n"; echo '',"\n"; if ($this->guidance) { $css_class_name = $this->getCSSclass('help', null, true, $css_postfix); $cell_value = $this->fdd[$k]['help'] ? $this->fdd[$k]['help'] : ' '; echo '',"\n"; } echo '',"\n"; } } /* }}} */ function display_change_field($row, $k) /* {{{ */ { $css_postfix = @$this->fdd[$k]['css']['postfix']; $css_class_name = $this->getCSSclass('input', null, true, $css_postfix); $escape = isset($this->fdd[$k]['escape']) ? $this->fdd[$k]['escape'] : true; echo '',"\n"; } /* }}} */ } /* Modeline for ViM {{{ * vim: set ts=4: * vim600: fdm=marker fdl=0 fdc=0: * }}} */ ?>
'; echo $this->fdd[$k]['name'],'getColAttributes($k),">\n"; if ($this->col_has_values($k)) { $vals = $this->set_values($k); $selected = @$this->fdd[$k]['default']; $multiple = $this->col_has_multiple($k); $readonly = $this->readonly($k); $strip_tags = true; //$escape = true; if ($this->col_has_checkboxes($k) || $this->col_has_radio_buttons($k)) { echo $this->htmlRadioCheck($this->cgi['prefix']['data'].$this->fds[$k], $css_class_name, $vals, $selected, $multiple, $readonly, $strip_tags, $escape); } else { echo $this->htmlSelect($this->cgi['prefix']['data'].$this->fds[$k], $css_class_name, $vals, $selected, $multiple, $readonly, $strip_tags, $escape); } /* */ } elseif (isset ($this->fdd[$k]['textarea']) && isset ($this->fdd[$k]['textarea']['xstandard'])) { $name = $this->cgi['prefix']['data'].$this->fds[$k]; echo '',"\n"; echo 'fdd[$k]['textarea']['xstandard'])) { foreach ($this->fdd[$k]['textarea']['xstandard'] as $key => $val) { if (! strcasecmp($key, 'height')) { $height = $val; } else if (! strcasecmp($key, 'width')) { $width = $val; } else { $params .= ''."\n"; } } } echo " width=\"$width\" height=\"$height\" />\n$params"; echo '',"\n"; /* */ } elseif (isset ($this->fdd[$k]['textarea'])) { echo '',"\n"; } elseif ($this->col_has_php($k)) { echo include($this->fdd[$k]['php']); } else { // Simple edit box required $size_ml_props = ''; $maxlen = intval($this->fdd[$k]['maxlen']); $size = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size'] : min($maxlen, 60); $size && $size_ml_props .= ' size="'.$size.'"'; $maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"'; echo 'password($k) ? 'type="password"' : 'type="text"'); echo ($this->readonly($k) ? ' disabled="disabled"' : ''); echo ' name="',$this->cgi['prefix']['data'].$this->fds[$k],'"'; echo $size_ml_props,' value="'; if($escape) echo htmlspecialchars($this->fdd[$k]['default']); else echo $this->fdd[$k]['default']; echo '" />'; } echo '',$cell_value,'
getColAttributes($k),">\n"; if ($this->col_has_values($k)) { $vals = $this->set_values($k); $multiple = $this->col_has_multiple($k); $readonly = $this->readonly($k); $strip_tags = true; //$escape = true; if ($this->col_has_checkboxes($k) || $this->col_has_radio_buttons($k)) { echo $this->htmlRadioCheck($this->cgi['prefix']['data'].$this->fds[$k], $css_class_name, $vals, $row["qf$k"], $multiple, $readonly, $strip_tags, $escape); } else { echo $this->htmlSelect($this->cgi['prefix']['data'].$this->fds[$k], $css_class_name, $vals, $row["qf$k"], $multiple, $readonly, $strip_tags, $escape); } /* */ } elseif (isset ($this->fdd[$k]['textarea']) && isset ($this->fdd[$k]['textarea']['xstandard'])) { $name = $this->cgi['prefix']['data'].$this->fds[$k]; echo '',"\n"; echo 'fdd[$k]['textarea']['xstandard'])) { foreach ($this->fdd[$k]['textarea']['xstandard'] as $key => $val) { if (! strcasecmp($key, 'height')) { $height = $val; } else if (! strcasecmp($key, 'width')) { $width = $val; } else { $params .= ''."\n"; } } } echo " width=\"$width\" height=\"$height\" />\n$params"; echo '',"\n"; echo '',"\n"; /* */ } elseif (isset($this->fdd[$k]['textarea'])) { echo '',"\n"; } elseif ($this->col_has_php($k)) { echo include($this->fdd[$k]['php']); } else { $size_ml_props = ''; $maxlen = intval($this->fdd[$k]['maxlen']); $size = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size'] : min($maxlen, 60); $size && $size_ml_props .= ' size="'.$size.'"'; $maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"'; echo 'readonly($k) ? 'disabled="disabled" ' : ''); echo 'name="',$this->cgi['prefix']['data'].$this->fds[$k],'" value="'; if($escape) echo htmlspecialchars($row["qf$k"]); else echo $row["qf$k"]; echo '" />',"\n"; } echo '