Add callback before edit form (bug #759)

This commit is contained in:
Jakub Vrana 2021-02-08 09:23:57 +01:00
parent 2dd3bd0e1a
commit a8c218f192
4 changed files with 21 additions and 4 deletions

View file

@ -480,7 +480,7 @@ class Adminer {
echo "</script>\n"; echo "</script>\n";
echo "</div></fieldset>\n"; echo "</div></fieldset>\n";
} }
/** Print command box in select /** Print command box in select
* @return bool whether to print default commands * @return bool whether to print default commands
*/ */
@ -659,6 +659,16 @@ class Adminer {
; ;
} }
/** Print before edit form
* @param string
* @param array
* @param mixed
* @param bool
* @return null
*/
function editRowPrint($table, $fields, $row, $update) {
}
/** Functions displayed in edit form /** Functions displayed in edit form
* @param array single field from fields() * @param array single field from fields()
* @return array * @return array

View file

@ -1411,15 +1411,16 @@ function on_help($command, $side = 0) {
* @param bool * @param bool
* @return null * @return null
*/ */
function edit_form($TABLE, $fields, $row, $update) { function edit_form($table, $fields, $row, $update) {
global $adminer, $jush, $token, $error; global $adminer, $jush, $token, $error;
$table_name = $adminer->tableName(table_status1($TABLE, true)); $table_name = $adminer->tableName(table_status1($table, true));
page_header( page_header(
($update ? lang('Edit') : lang('Insert')), ($update ? lang('Edit') : lang('Insert')),
$error, $error,
array("select" => array($TABLE, $table_name)), array("select" => array($table, $table_name)),
$table_name $table_name
); );
$adminer->editRowPrint($table, $fields, $row, $update);
if ($row === false) { if ($row === false) {
echo "<p class='error'>" . lang('No rows.') . "\n"; echo "<p class='error'>" . lang('No rows.') . "\n";
} }

View file

@ -452,6 +452,9 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
return " <span class='time'>" . @date("H:i:s") . "</span><!--\n" . str_replace("--", "--><!-- ", $query) . "\n" . ($time ? "($time)\n" : "") . "-->"; return " <span class='time'>" . @date("H:i:s") . "</span><!--\n" . str_replace("--", "--><!-- ", $query) . "\n" . ($time ? "($time)\n" : "") . "-->";
} }
function editRowPrint($table, $fields, $row, $update) {
}
function editFunctions($field) { function editFunctions($field) {
$return = array(); $return = array();
if ($field["null"] && preg_match('~blob~', $field["type"])) { if ($field["null"] && preg_match('~blob~', $field["type"])) {

View file

@ -83,6 +83,9 @@ class AdminerPlugin extends Adminer {
return $this->_appendPlugin(__FUNCTION__, $args); return $this->_appendPlugin(__FUNCTION__, $args);
} }
function editRowPrint($table, $fields, $row, $update) {
}
function editFunctions($field) { function editFunctions($field) {
$args = func_get_args(); $args = func_get_args();
return $this->_appendPlugin(__FUNCTION__, $args); return $this->_appendPlugin(__FUNCTION__, $args);