| version 1.108, 2004/01/02 11:37:18 |
version 1.109, 2004/01/02 18:51:36 |
|
|
| * http://platon.sk/projects/phpMyEdit/ |
* http://platon.sk/projects/phpMyEdit/ |
| */ |
*/ |
| |
|
| /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.107 2003/12/30 21:38:27 nepto Exp $ */ |
/* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.108 2004/01/02 11:37:18 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. |
|
|
| $fdd['fieldname']['validate']['php_regex']='something'; |
$fdd['fieldname']['validate']['php_regex']='something'; |
| */ |
*/ |
| $page_name = htmlspecialchars($this->page_name); |
$page_name = htmlspecialchars($this->page_name); |
| $form_atts = ''; |
|
| |
|
| if ($this->add_operation() || $this->change_operation() || $this->copy_operation() |
if ($this->add_operation() || $this->change_operation() || $this->copy_operation() |
| || $this->view_operation() || $this->delete_operation()) { |
|| $this->view_operation() || $this->delete_operation()) { |
| Line 824 function phpMyEdit_form_control(theForm) |
|
| Line 823 function phpMyEdit_form_control(theForm) |
|
| return true; |
return true; |
| }',"\n\n"; |
}',"\n\n"; |
| echo '// --></script>', "\n"; |
echo '// --></script>', "\n"; |
| $form_atts .= ' onSubmit="return phpMyEdit_form_control(this);"'; |
|
| } |
} |
| } |
} |
| |
|
| if ($this->display['form']) { |
if ($this->display['form']) { |
| echo '<form class="',$this->getCSSclass('form'); |
echo '<form class="',$this->getCSSclass('form'),'" method="POST"'; |
| echo '" action="',$page_name,'" method="POST"',$form_atts,'>',"\n"; |
echo ' action="',$page_name,'" name="phpMyEdit_form">',"\n"; |
| } |
} |
| return true; |
return true; |
| } /* }}} */ |
} /* }}} */ |
| Line 1263 function phpMyEdit_form_control(theForm) |
|
| Line 1261 function phpMyEdit_form_control(theForm) |
|
| /** |
/** |
| * Creates HTML hidden input element |
* Creates HTML hidden input element |
| * |
* |
| |
* @param name element name |
| |
* @param label key in the language hash used as label |
| |
* @param css_class_name CSS class name |
| |
* @param js_validation if add JavaScript validation subroutine to button |
| |
*/ |
| |
function htmlSubmit($name, $label, $css_class_name, $js_validation = true) /* {{{ */ |
| |
{ |
| |
$ret = '<input type="submit" class="'.$css_class_name |
| |
.'" name="'.$name.'" value="'.$this->labels[$label]; |
| |
if ($js_validation) { |
| |
$ret .= '" onClick="return phpMyEdit_form_control(this.form);'; |
| |
} |
| |
$ret .= '">'; |
| |
return $ret; |
| |
} /* }}} */ |
| |
|
| |
/** |
| |
* Creates HTML hidden input element |
| |
* |
| * @param name element name |
* @param name element name |
| * @param value value |
* @param value value |
| */ |
*/ |
| Line 1599 function phpMyEdit_form_control(theForm) |
|
| Line 1616 function phpMyEdit_form_control(theForm) |
|
| /* |
/* |
| * Display buttons at top and bottom of page |
* Display buttons at top and bottom of page |
| */ |
*/ |
| function display_record_buttons() /* {{{ */ |
function display_record_buttons($position) /* {{{ */ |
| { |
{ |
| echo '<table class="',$this->getCSSclass('navigation', $position),'">',"\n"; |
echo '<table class="',$this->getCSSclass('navigation', $position),'">',"\n"; |
| echo '<tr class="',$this->getCSSclass('navigation', $position),'">',"\n"; |
echo '<tr class="',$this->getCSSclass('navigation', $position),'">',"\n"; |
| echo '<td class="',$this->getCSSclass('buttons', $position),'">',"\n"; |
echo '<td class="',$this->getCSSclass('buttons', $position),'">',"\n"; |
| if ($this->change_operation()) { |
if ($this->change_operation()) { |
| echo '<input class="',$this->getCSSclass('save', $position); |
echo $this->htmlSubmit('savechange', 'Save', $this->getCSSclass('save', $position), true), ' '; |
| echo '" type="submit" name="savechange" value="',$this->labels['Save'],'"> '; |
echo $this->htmlSubmit('morechange', 'Apply', $this->getCSSclass('more', $position), true), ' '; |
| echo '<input class="',$this->getCSSclass('more', $position); |
echo $this->htmlSubmit('cancelchange', 'Cancel', $this->getCSSclass('cancel', $position), false); |
| echo '" type="submit" name="morechange" value="',$this->labels['Apply'],'"> '; |
|
| echo '<input class="',$this->getCSSclass('cancel', $position); |
|
| echo '" type="button" name="cancel" value="',$this->labels['Cancel']; |
|
| echo '" onClick="form.submit();">',"\n"; |
|
| } elseif ($this->add_operation()) { |
} elseif ($this->add_operation()) { |
| echo '<input class="',$this->getCSSclass('save', $position); |
echo $this->htmlSubmit('saveadd', 'Save', $this->getCSSclass('save', $position), true), ' '; |
| echo '" type="submit" name="saveadd" value="',$this->labels['Save'],'"> '; |
echo $this->htmlSubmit('moreadd', 'More', $this->getCSSclass('more', $position), true), ' '; |
| echo '<input class="',$this->getCSSclass('more', $position); |
echo $this->htmlSubmit('canceladd', 'Cancel', $this->getCSSclass('cancel', $position), false); |
| echo '" type="submit" name="moreadd" value="',$this->labels['More'],'"> '; |
|
| echo '<input class="',$this->getCSSclass('cancel', $position); |
|
| echo '" type="button" name="cancel" value="',$this->labels['Cancel']; |
|
| echo '" onClick="form.submit();">',"\n"; |
|
| } elseif ($this->copy_operation()) { |
} elseif ($this->copy_operation()) { |
| echo '<input class="',$this->getCSSclass('save', $position); |
echo $this->htmlSubmit('saveadd', 'Save', $this->getCSSclass('save', $position), true), ' '; |
| echo '" type="submit" name="saveadd" value="',$this->labels['Save'],'"> '; |
echo $this->htmlSubmit('canceladd', 'Cancel', $this->getCSSclass('cancel', $position), false); |
| echo '<input class="',$this->getCSSclass('cancel', $position); |
|
| echo '" type="button" name="cancel" value="',$this->labels['Cancel']; |
|
| echo '" onClick="form.submit();">',"\n"; |
|
| } elseif ($this->delete_operation()) { |
} elseif ($this->delete_operation()) { |
| echo '<input class="',$this->getCSSclass('save', $position); |
echo $this->htmlSubmit('savedelete', 'Delete', $this->getCSSclass('save', $position), true), ' '; |
| echo '" type="submit" name="savedelete" value="',$this->labels['Delete'],'"> '; |
echo $this->htmlSubmit('canceldelete', 'Cancel', $this->getCSSclass('cancel', $position), false); |
| echo '<input class="',$this->getCSSclass('cancel', $position); |
|
| echo '" type="button" name="cancel" value="',$this->labels['Cancel']; |
|
| echo '" onClick="form.submit();">',"\n"; |
|
| } elseif ($this->view_operation()) { |
} elseif ($this->view_operation()) { |
| if ($this->change_enabled()) { |
if ($this->change_enabled()) { |
| echo '<input class="',$this->getCSSclass('save', $position); |
echo $this->htmlSubmit('operation', 'Change', $this->getCSSclass('save', $position), true), ' '; |
| echo '" type="submit" name="operation" value="',$this->labels['Change'],'"> '; |
|
| } |
} |
| echo '<input class="',$this->getCSSclass('cancel', $position); |
echo $this->htmlSubmit('cancelview', 'Cancel', $this->getCSSclass('cancel', $position), false); |
| echo '" type="submit" name="cancel" value="',$this->labels['Cancel'],'">',"\n"; |
|
| } |
} |
| // Message is now written here |
// Message is now written here |
| echo '</td>',"\n"; |
echo '</td>',"\n"; |
| Line 1648 function phpMyEdit_form_control(theForm) |
|
| Line 1649 function phpMyEdit_form_control(theForm) |
|
| echo '</tr></table>',"\n"; |
echo '</tr></table>',"\n"; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| |
|
| /* |
/* |
| * Table Page Listing |
* Table Page Listing |
| */ |
*/ |
| Line 2167 function phpMyEdit_form_control(theForm) |
|
| Line 2167 function phpMyEdit_form_control(theForm) |
|
| echo '<input type="hidden" name="fm" value="',$this->fm,'">',"\n"; |
echo '<input type="hidden" name="fm" value="',$this->fm,'">',"\n"; |
| echo '<input type="hidden" name="fl" value="',$this->fl,'">',"\n"; |
echo '<input type="hidden" name="fl" value="',$this->fl,'">',"\n"; |
| if ($this->nav_up()) { |
if ($this->nav_up()) { |
| $this->display_record_buttons(); |
$this->display_record_buttons('up'); |
| echo '<hr class="',$this->getCSSclass('hr', 'up'),'">',"\n"; |
echo '<hr class="',$this->getCSSclass('hr', 'up'),'">',"\n"; |
| if ($this->tabs_enabled()) { |
if ($this->tabs_enabled()) { |
| $this->display_tab_labels('up'); |
$this->display_tab_labels('up'); |
| Line 2189 function phpMyEdit_form_control(theForm) |
|
| Line 2189 function phpMyEdit_form_control(theForm) |
|
| $this->display_tab_labels('down'); |
$this->display_tab_labels('down'); |
| } |
} |
| echo '<hr class="',$this->getCSSclass('hr', 'down'),'">',"\n"; |
echo '<hr class="',$this->getCSSclass('hr', 'down'),'">',"\n"; |
| $this->display_record_buttons(); |
$this->display_record_buttons('down'); |
| } |
} |
| $this->form_end(); |
$this->form_end(); |
| } /* }}} */ |
} /* }}} */ |