version 1.131, 2004/04/12 12:02:04 |
version 1.132, 2004/04/12 20:38:07 |
|
|
* http://platon.sk/projects/phpMyEdit/ |
* http://platon.sk/projects/phpMyEdit/ |
*/ |
*/ |
|
|
/* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.130 2004/04/04 21:02:57 nepto Exp $ */ |
/* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.131 2004/04/12 12:02:04 nepto 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. |
|
|
function view_enabled() { return stristr($this->options, 'V'); } |
function view_enabled() { return stristr($this->options, 'V'); } |
function copy_enabled() { return stristr($this->options, 'P') && $this->add_enabled(); } |
function copy_enabled() { return stristr($this->options, 'P') && $this->add_enabled(); } |
function tabs_enabled() { return $this->display['tabs'] && count($this->tabs) > 0; } |
function tabs_enabled() { return $this->display['tabs'] && count($this->tabs) > 0; } |
function hidden($k) { return stristr($this->fdd[$k]['input'],'H') || stristr($this->fdd[$k]['options'],'H'); } |
function hidden($k) { return stristr($this->fdd[$k]['input'],'H'); } |
function password($k) { return stristr($this->fdd[$k]['input'],'W') || stristr($this->fdd[$k]['options'],'W'); } |
function password($k) { return stristr($this->fdd[$k]['input'],'W'); } |
function readonly($k) { return stristr($this->fdd[$k]['input'],'R') || stristr($this->fdd[$k]['options'],'R') || $this->virtual($k); } |
function readonly($k) { return stristr($this->fdd[$k]['input'],'R') || $this->virtual($k); } |
function virtual($k) { return stristr($this->fdd[$k]['input'],'V') && $this->col_has_sql($k); } |
function virtual($k) { return stristr($this->fdd[$k]['input'],'V') && $this->col_has_sql($k); } |
|
|
function add_operation() { return $this->operation == $this->labels['Add'] && $this->add_enabled(); } |
function add_operation() { return $this->operation == $this->labels['Add'] && $this->add_enabled(); } |
Line 753 function phpMyEdit_show_tab(tab_name) |
|
Line 753 function phpMyEdit_show_tab(tab_name) |
|
$first_required = true; |
$first_required = true; |
for ($k = 0; $k < $this->num_fds; $k++) { |
for ($k = 0; $k < $this->num_fds; $k++) { |
if ($this->displayed[$k] && ! $this->readonly($k) && ! $this->hidden($k) |
if ($this->displayed[$k] && ! $this->readonly($k) && ! $this->hidden($k) |
&& ($this->fdd[$k]['required'] || isset($this->fdd[$k]['js']['regexp']))) { |
&& ($this->fdd[$k]['js']['required'] || isset($this->fdd[$k]['js']['regexp']))) { |
if ($first_required) { |
if ($first_required) { |
$first_required = false; |
$first_required = false; |
echo '<script type="text/javascript"><!--',"\n"; |
echo '<script type="text/javascript"><!--',"\n"; |
Line 784 function phpMyEdit_form_control(theForm) |
|
Line 784 function phpMyEdit_form_control(theForm) |
|
} else { |
} else { |
$condition = ''; |
$condition = ''; |
$multiple = false; |
$multiple = false; |
if ($this->fdd[$k]['required']) { |
if ($this->fdd[$k]['js']['required']) { |
$condition = 'phpMyEdit_trim(theForm.'.$this->fds[$k].'.value) == ""'; |
$condition = 'phpMyEdit_trim(theForm.'.$this->fds[$k].'.value) == ""'; |
} |
} |
if (isset($this->fdd[$k]['js']['regexp'])) { |
if (isset($this->fdd[$k]['js']['regexp'])) { |
Line 2688 function phpMyEdit_filter_handler(theFor |
|
Line 2688 function phpMyEdit_filter_handler(theFor |
|
return true; |
return true; |
} /* }}} */ |
} /* }}} */ |
|
|
|
function backward_compatibility() /* {{{ */ |
|
{ |
|
foreach (array_keys($this->fdd) as $column) { |
|
// move ['required'] to ['js']['required'] |
|
if (! isset($this->fdd[$column]['js']['required']) && isset($this->fdd[$column]['required'])) { |
|
$this->fdd[$column]['js']['required'] = $this->fdd[$column]['required']; |
|
} |
|
// move 'HWR' flags from ['options'] into ['input'] |
|
if (isset($this->fdd[$column]['options'])) { |
|
stristr($this->fdd[$column]['options'], 'H') && $this->fdd[$column]['input'] .= 'H'; |
|
stristr($this->fdd[$column]['options'], 'W') && $this->fdd[$column]['input'] .= 'W'; |
|
stristr($this->fdd[$column]['options'], 'R') && $this->fdd[$column]['input'] .= 'R'; |
|
} |
|
} |
|
} /* }}} */ |
|
|
/* |
/* |
* Error handling function |
* Error handling function |
*/ |
*/ |
Line 2775 function phpMyEdit_filter_handler(theFor |
|
Line 2791 function phpMyEdit_filter_handler(theFor |
|
$this->operation = $this->labels['Add']; // to force add operation |
$this->operation = $this->labels['Add']; // to force add operation |
$this->recreate_fdd(); |
$this->recreate_fdd(); |
$this->recreate_displayed(); |
$this->recreate_displayed(); |
|
$this->backward_compatibility(); |
} |
} |
elseif ($this->savechange == $this->labels['Save']) { |
elseif ($this->savechange == $this->labels['Save']) { |
$this->change_enabled() && $this->do_change_record(); |
$this->change_enabled() && $this->do_change_record(); |
Line 2784 function phpMyEdit_filter_handler(theFor |
|
Line 2801 function phpMyEdit_filter_handler(theFor |
|
$this->operation = $this->labels['Change']; // to force change operation |
$this->operation = $this->labels['Change']; // to force change operation |
$this->recreate_fdd(); |
$this->recreate_fdd(); |
$this->recreate_displayed(); |
$this->recreate_displayed(); |
|
$this->backward_compatibility(); |
} |
} |
elseif ($this->savedelete == $this->labels['Delete']) { |
elseif ($this->savedelete == $this->labels['Delete']) { |
$this->delete_enabled() && $this->do_delete_record(); |
$this->delete_enabled() && $this->do_delete_record(); |
Line 2946 function phpMyEdit_filter_handler(theFor |
|
Line 2964 function phpMyEdit_filter_handler(theFor |
|
$this->recreate_fdd(); |
$this->recreate_fdd(); |
// Extract SQL Field Names and number of fields |
// Extract SQL Field Names and number of fields |
$this->recreate_displayed(); |
$this->recreate_displayed(); |
|
// Issue backward compatibility |
|
$this->backward_compatibility(); |
// Gathering query options |
// Gathering query options |
$this->gather_query_opts(); |
$this->gather_query_opts(); |
// Call to action |
// Call to action |