]> git.joonet.de Git - adminer.git/commitdiff
Function results in edit
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Wed, 1 Oct 2008 11:39:13 +0000 (11:39 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Wed, 1 Oct 2008 11:39:13 +0000 (11:39 +0000)
Bulk edit
Remove <label for>
Simplify optionlist()
Only one button for each action in select

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@508 7c3ca157-0c34-0410-bff1-cbf682f78f5c

create.inc.php
edit.inc.php
editing.inc.php
functions.inc.php
index.php
lang/cs.inc.php
lang/en.inc.php
select.inc.php
sql.inc.php
todo.txt
user.inc.php

index bde10d55aa013f352b9d6e4e07c936a6a8024411..de801a209f53ec8a0fdc88a68dba06acac99b62e 100644 (file)
@@ -97,7 +97,7 @@ $collations = collations();
 <?php echo lang('Auto Increment'); ?>: <input name="Auto_increment" size="4" value="<?php echo intval($row["Auto_increment"]); ?>" />
 <?php echo lang('Comment'); ?>: <input name="Comment" value="<?php echo htmlspecialchars($row["Comment"]); ?>" maxlength="60" />
 <script type="text/javascript">// <![CDATA[
-document.write('<label for="column_comments"><input type="checkbox" id="column_comments"<?php if ($column_comments) { ?> checked="checked"<?php } ?> onclick="column_comments_click(this.checked);" /><?php echo lang('Show column comments'); ?></label>');
+document.write('<label><input type="checkbox"<?php if ($column_comments) { ?> checked="checked"<?php } ?> onclick="column_comments_click(this.checked);" /><?php echo lang('Show column comments'); ?></label>');
 function column_comments_click(checked) {
        var trs = document.getElementsByTagName('tr');
        for (var i=0; i < trs.length; i++) {
index 564b88a7025ebdc846e06063f9058598400a99de..bd62f46f9d58fe3353082853121b13376d7934a3 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-$where = where($_GET);
+$where = (isset($_GET["select"]) ? array() : where($_GET));
 $update = ($where && !$_GET["clone"]);
 $fields = fields($_GET["edit"]);
 foreach ($fields as $name => $field) {
@@ -7,7 +7,7 @@ foreach ($fields as $name => $field) {
                unset($fields[$name]);
        }
 }
-if ($_POST && !$error) {
+if ($_POST && !$error && !isset($_GET["select"])) {
        $location = ($_POST["insert"] ? $_SERVER["REQUEST_URI"] : $SELF . (isset($_GET["default"]) ? "table=" : "select=") . urlencode($_GET["edit"]));
        if (isset($_POST["delete"])) {
                query_redirect("DELETE FROM " . idf_escape($_GET["edit"]) . " WHERE " . implode(" AND ", $where) . " LIMIT 1", $location, lang('Item has been deleted.'));
@@ -37,14 +37,11 @@ if ($_POST && !$error) {
                }
        }
 }
-page_header((isset($_GET["default"]) ? lang('Default values') : ($_GET["where"] ? lang('Edit') : lang('Insert'))), $error, array((isset($_GET["default"]) ? "table" : "select") => $_GET["edit"]), $_GET["edit"]);
+page_header((isset($_GET["default"]) ? lang('Default values') : ($_GET["where"] || isset($_GET["select"]) ? lang('Edit') : lang('Insert'))), $error, array((isset($_GET["default"]) ? "table" : "select") => $_GET["edit"]), $_GET["edit"]);
 
 unset($row);
 if ($_POST) {
        $row = (array) $_POST["fields"];
-       foreach ((array) $_POST["null"] as $key => $val) {
-               $row[$key] = null;
-       }
 } elseif ($where) {
        $select = array();
        foreach ($fields as $name => $field) {
@@ -78,13 +75,12 @@ if ($fields) {
                }
                input($name, $field, $value);
                if (isset($_GET["default"]) && $field["type"] == "timestamp") {
-                       $id = htmlspecialchars("on_update-$name");
                        if (!isset($create) && !$_POST) {
                                //! disable sql_mode NO_FIELD_OPTIONS
                                $create = $mysql->result($mysql->query("SHOW CREATE TABLE " . idf_escape($_GET["edit"])), 1);
                        }
                        $checked = ($_POST ? $_POST["on_update"][bracket_escape($name)] : preg_match("~\n\\s*" . preg_quote(idf_escape($name), '~') . " timestamp.* on update CURRENT_TIMESTAMP~i", $create));
-                       echo '<label for="' . $id . '"><input type="checkbox" name="on_update[' . htmlspecialchars(bracket_escape($name)) . ']" id="' . $id . '" value="1"' . ($checked ? ' checked="checked"' : '') . ' />' . lang('ON UPDATE CURRENT_TIMESTAMP') . '</label>';
+                       echo '<label><input type="checkbox" name="on_update[' . htmlspecialchars(bracket_escape($name)) . ']" value="1"' . ($checked ? ' checked="checked"' : '') . ' />' . lang('ON UPDATE CURRENT_TIMESTAMP') . '</label>';
                }
                echo "</td></tr>\n";
        }
@@ -93,9 +89,17 @@ if ($fields) {
 ?>
 <p>
 <input type="hidden" name="token" value="<?php echo $token; ?>" />
-<?php if ($fields) { ?>
+<?php
+if (isset($_GET["select"])) {
+       foreach ((array) $_POST["check"] as $val) {
+               echo '<input type="hidden" name="check[]" value="' . htmlspecialchars($val) . '" />';
+       }
+       echo ($_POST["all"] ? "<input type='hidden' name='all' value='1' />\n" : "\n");
+}
+if ($fields) {
+       ?>
 <input type="submit" value="<?php echo lang('Save'); ?>" />
-<?php if (!isset($_GET["default"])) { ?><input type="submit" name="insert" value="<?php echo ($update ? lang('Save and continue edit') : lang('Save and insert next')); ?>" /><?php } ?>
+<?php if (!isset($_GET["default"]) && !isset($_GET["select"])) { ?><input type="submit" name="insert" value="<?php echo ($update ? lang('Save and continue edit') : lang('Save and insert next')); ?>" /><?php } ?>
 <?php } ?>
 <?php if ($update) { ?> <input type="submit" name="delete" value="<?php echo lang('Delete'); ?>" onclick="return confirm('<?php echo lang('Are you sure?'); ?>');" /><?php } ?>
 </p>
index 265e64b6450b667186fc0143cac6f53d3f2ab802..0eefaf91ba5b38827a63227e280528c697d0b1a7 100644 (file)
@@ -2,61 +2,73 @@
 function input($name, $field, $value) {
        global $types;
        $name = htmlspecialchars(bracket_escape($name));
-       $onchange = ($field["null"] ? ' onchange="this.form[\'null[' . addcslashes($name, "\r\n'\\") . ']\'].checked = false;"' : '');
        if ($field["type"] == "enum") {
+               if (isset($_GET["select"])) {
+                       echo ' <label><input type="radio" name="fields[' . $name . ']" value="-1" checked="checked" /><em>' . lang('original') . '</em></label>';
+               }
+               if ($field["null"]) {
+                       echo ' <label><input type="radio" name="fields[' . $name . ']" value=""' . (isset($value) || isset($_GET["select"]) ? '' : ' checked="checked"') . ' /><em>NULL</em></label>';
+               }
                if (!isset($_GET["default"])) {
                        echo '<input type="radio" name="fields[' . $name . ']" value="0"' . ($value === 0 ? ' checked="checked"' : '') . ' />';
                }
                preg_match_all("~'((?:[^']+|'')*)'~", $field["length"], $matches);
                foreach ($matches[1] as $i => $val) {
                        $val = stripcslashes(str_replace("''", "'", $val));
-                       $id = "field-$name-" . ($i+1);
                        $checked = (is_int($value) ? $value == $i+1 : $value === $val);
-                       echo ' <label for="' . $id . '"><input type="radio" name="fields[' . $name . ']" id="' . $id . '" value="' . (isset($_GET["default"]) ? (strlen($val) ? htmlspecialchars($val) : " ") : $i+1) . '"' . ($checked ? ' checked="checked"' : '') . ' />' . htmlspecialchars($val) . '</label>';
+                       echo ' <label><input type="radio" name="fields[' . $name . ']" value="' . (isset($_GET["default"]) ? (strlen($val) ? htmlspecialchars($val) : " ") : $i+1) . '"' . ($checked ? ' checked="checked"' : '') . ' />' . htmlspecialchars($val) . '</label>';
                }
+       } else {
+               $first = (isset($_GET["select"]) ? 2 : 1);
+               $onchange = ($field["null"] || isset($_GET["select"]) ? ' onchange="var f = this.form[\'function[' . addcslashes($name, "\r\n'\\") . ']\']; f.selectedIndex = Math.max(f.selectedIndex, ' . $first . ');"' : '');
+               $options = (preg_match('~char~', $field["type"]) ? array("", "md5", "sha1", "password", "uuid") : (preg_match('~date|time~', $field["type"]) ? array("", "now") : array("")));
                if ($field["null"]) {
-                       $id = "field-$name-";
-                       echo ' <label for="' . $id . '"><input type="radio" name="fields[' . $name . ']" id="' . $id . '" value=""' . (isset($value) ? '' : ' checked="checked"') . ' />' . lang('NULL') . '</label>';
+                       array_unshift($options, "NULL");
                }
-       } elseif ($field["type"] == "set") { //! 64 bits
-               preg_match_all("~'((?:[^']+|'')*)'~", $field["length"], $matches);
-               foreach ($matches[1] as $i => $val) {
-                       $val = stripcslashes(str_replace("''", "'", $val));
-                       $id = "field-$name-" . ($i+1);
-                       $checked = (is_int($value) ? ($value >> $i) & 1 : in_array($val, explode(",", $value), true));
-                       echo ' <input type="checkbox" name="fields[' . $name . '][' . $i . ']" id="' . $id . '" value="' . (isset($_GET["default"]) ? htmlspecialchars($val) : 1 << $i) . '"' . ($checked ? ' checked="checked"' : '') . $onchange . ' /><label for="' . $id . '">' . htmlspecialchars($val) . '</label>';
+               if (count($options) > 1 || isset($_GET["select"])) {
+                       echo '<select name="function[' . $name . ']">' . (isset($_GET["select"]) ? '<option value="orig">' . lang('original') . '</option>' : '') . optionlist($options, (isset($value) ? (string) $_POST["function"][$name] : null)) . '</select>';
+               }
+               if ($field["type"] == "set") { //! 64 bits
+                       preg_match_all("~'((?:[^']+|'')*)'~", $field["length"], $matches);
+                       foreach ($matches[1] as $i => $val) {
+                               $val = stripcslashes(str_replace("''", "'", $val));
+                               $checked = (is_int($value) ? ($value >> $i) & 1 : in_array($val, explode(",", $value), true));
+                               echo ' <label><input type="checkbox" name="fields[' . $name . '][' . $i . ']" value="' . (isset($_GET["default"]) ? htmlspecialchars($val) : 1 << $i) . '"' . ($checked ? ' checked="checked"' : '') . $onchange . ' />' . htmlspecialchars($val) . '</label>';
+                       }
+               } elseif (strpos($field["type"], "text") !== false) {
+                       echo '<textarea name="fields[' . $name . ']" cols="50" rows="12"' . $onchange . '>' . htmlspecialchars($value) . '</textarea>';
+               } elseif (preg_match('~binary|blob~', $field["type"])) {
+                       echo (ini_get("file_uploads") ? '<input type="file" name="' . $name . '"' . $onchange . ' />' : lang('File uploads are disabled.') . ' ');
+               } else {
+                       echo '<input name="fields[' . $name . ']" value="' . htmlspecialchars($value) . '"' . (preg_match('~^([0-9]+)(,([0-9]+))?$~', $field["length"], $match) ? " maxlength='" . ($match[1] + ($match[3] ? 1 : 0) + ($match[2] && !$field["unsigned"] ? 1 : 0)) . "'" : ($types[$field["type"]] ? " maxlength='" . $types[$field["type"]] . "'" : '')) . $onchange . ' />';
                }
-       } elseif (strpos($field["type"], "text") !== false) {
-               echo '<textarea name="fields[' . $name . ']" cols="50" rows="12"' . $onchange . '>' . htmlspecialchars($value) . '</textarea>';
-       } elseif (preg_match('~binary|blob~', $field["type"])) {
-               echo (ini_get("file_uploads") ? '<input type="file" name="' . $name . '"' . $onchange . ' />' : lang('File uploads are disabled.') . ' ');
-       } else {
-               echo '<input name="fields[' . $name . ']" value="' . htmlspecialchars($value) . '"' . (preg_match('~^([0-9]+)(,([0-9]+))?$~', $field["length"], $match) ? " maxlength='" . ($match[1] + ($match[3] ? 1 : 0) + ($match[2] && !$field["unsigned"] ? 1 : 0)) . "'" : ($types[$field["type"]] ? " maxlength='" . $types[$field["type"]] . "'" : '')) . $onchange . ' />';
-       }
-       if ($field["null"] && $field["type"] != "enum") {
-               $id = "null-$name";
-               echo '<label for="' . $id . '"><input type="checkbox" name="null[' . $name . ']" value="1" id="' . $id . '"' . (isset($value) ? '' : ' checked="checked"') . ' />' . lang('NULL') . '</label>';
        }
 }
 
 function process_input($name, $field) {
        global $mysql;
-       $name = bracket_escape($name);
-       $value = $_POST["fields"][$name];
-       if ($field["type"] != "enum" && !$field["auto_increment"] ? $_POST["null"][$name] : !strlen($value)) {
+       $idf = bracket_escape($name);
+       $value = $_POST["fields"][$idf];
+       if ($field["type"] == "enum" ? $value == -1 : $_POST["function"][$idf] == "orig") {
+               return false;
+       } elseif ($field["type"] == "enum" || $field["auto_increment"] ? !strlen($value) : $_POST["function"][$idf] == "NULL") {
                return "NULL";
        } elseif ($field["type"] == "enum") {
                return (isset($_GET["default"]) ? "'" . $mysql->escape_string($value) . "'" : intval($value));
        } elseif ($field["type"] == "set") {
                return (isset($_GET["default"]) ? "'" . implode(",", array_map(array($mysql, 'escape_string'), (array) $value)) . "'" : array_sum((array) $value));
        } elseif (preg_match('~binary|blob~', $field["type"])) {
-               $file = get_file($name);
+               $file = get_file($idf);
                if (!is_string($file) && ($file != UPLOAD_ERR_NO_FILE || !$field["null"])) {
                        return false; //! report errors
                }
                return "_binary'" . (is_string($file) ? $mysql->escape_string($file) : "") . "'";
        } elseif ($field["type"] == "timestamp" && $value == "CURRENT_TIMESTAMP") {
                return $value;
+       } elseif (preg_match('~^(now|uuid)$~', $_POST["function"][$idf])) {
+               return $_POST["function"][$idf] . "()";
+       } elseif (preg_match('~^(md5|sha1|password)$~', $_POST["function"][$idf])) {
+               return $_POST["function"][$idf] . "('" . $mysql->escape_string($value) . "')";
        } else {
                return "'" . $mysql->escape_string($value) . "'";
        }
index bc82e335960a34d5cb8d8128f7628981a9cca4e7..74be5f71744d658a36523c343f21e9693785e7d3 100644 (file)
@@ -12,15 +12,14 @@ function bracket_escape($idf, $back = false) {
        return strtr($idf, ($back ? array_flip($trans) : $trans));
 }
 
-function optionlist($options, $selected = array()) {
+function optionlist($options, $selected = null) {
        $return = "";
        foreach ($options as $k => $v) {
                if (is_array($v)) {
                        $return .= '<optgroup label="' . htmlspecialchars($k) . '">';
                }
                foreach ((is_array($v) ? $v : array($v)) as $val) {
-                       $checked = in_array($val, (array) $selected, true);
-                       $return .= '<option' . ($checked ? ' selected="selected"' : '') . '>' . htmlspecialchars($val) . '</option>';
+                       $return .= '<option' . ($val === $selected ? ' selected="selected"' : '') . '>' . htmlspecialchars($val) . '</option>';
                }
                if (is_array($v)) {
                        $return .= '</optgroup>';
index aa7a17987900bdbf08195b30e56e990e6d002ecd..bc844d61be38de5569c5beae5da8bda90df06021 100644 (file)
--- a/index.php
+++ b/index.php
@@ -83,6 +83,9 @@ if (isset($_GET["download"])) {
                if (isset($_GET["default"])) {
                        $_GET["edit"] = $_GET["default"];
                }
+               if (isset($_GET["select"]) && $_POST["edit"]) {
+                       $_GET["edit"] = $_GET["select"];
+               }
                if (isset($_GET["callf"])) {
                        $_GET["call"] = $_GET["callf"];
                }
index 269c450b2d9679abaa1819ac282b7ffbeb4bee76..9c3d3f04b4c01d9b52a821048d6592b74efafc1b 100644 (file)
@@ -150,10 +150,6 @@ $translations = array(
        'Grant' => 'Povolit',
        'Revoke' => 'Zakázat',
        'Error during deleting' => 'Chyba při mazání',
-       '%d item(s) have been deleted.' => array('Byl smazán %d záznam.', 'Byly smazány %d záznamy.', 'Bylo smazáno %d záznamů.'),
-       'all' => 'vše',
-       'Delete selected' => 'Smazat označené',
-       'Truncate result' => 'Promazat výsledek',
        'Too big POST data. Reduce the data or increase the "post_max_size" configuration directive.' => 'Příliš velká POST data. Zmenšete data nebo zvyšte hodnotu konfigurační direktivy "post_max_size".',
        'Logged as: %s' => 'Přihlášen jako: %s',
        'Move up' => 'Přesunout nahoru',
@@ -171,8 +167,8 @@ $translations = array(
        'Tables' => 'Tabulky',
        'Structure' => 'Struktura',
        'Data' => 'Data',
-       'Export selected' => 'Exportovat označené',
-       'Export result' => 'Exportovat výsledek',
+       // 'Export selected' => 'Exportovat označené',
+       // 'Export result' => 'Exportovat výsledek',
        'Event has been dropped.' => 'Událost byla odstraněna.',
        'Event has been altered.' => 'Událost byla změněna.',
        'Event has been created.' => 'Událost byla vytvořena.',
@@ -205,4 +201,7 @@ $translations = array(
        'Engine' => 'Úložiště',
        'Save and continue edit' => 'Uložit a pokračovat v editaci',
        'clone' => 'klonovat',
+       'original' => 'původní',
+       '%d item(s) have been affected.' => array('Byl ovlivněn %d záznam.', 'Byly ovlivněny %d záznamy.', 'Bylo ovlivněno %d záznamů.'),
+       'whole result' => 'celý výsledek',
 );
index 4de590aee069d1c5650921e6887b0cbe8f2a082b..2219bd234c4cd135861a25cd4532987ca13d1c86 100644 (file)
@@ -5,5 +5,5 @@ $translations = array(
        'Routine has been called, %d row(s) affected.' => array('Routine has been called, %d row affected.', 'Routine has been called, %d rows affected.'),
        '%d process(es) has been killed.' => array('%d process has been killed.', '%d processes have been killed.'),
        '%d row(s)' => array('%d row', '%d rows'),
-       '%d item(s) have been deleted.' => array('%d item has been deleted.', '%d items have been deleted.'),
+       '%d item(s) have been affected.' => array('%d item have been affected.', '%d items have been affected.'),
 );
index 6c68e072b840e09d3f42288e01536bf3612709b0..c331aca0dd2a00a006b44ace10a4035108b12fb6 100644 (file)
@@ -58,49 +58,47 @@ $from = "FROM " . idf_escape($_GET["select"]) . ($where ? " WHERE " . implode("
 
 if ($_POST && !$error) {
        $result = true;
-       $deleted = 0;
-       if ($_POST["export"] || $_POST["export_result"]) {
+       $affected = 0;
+       if ($_POST["export"]) {
                dump_headers($_GET["select"]);
                dump_table($_GET["select"], "");
-       }
-       if (isset($_POST["truncate"])) {
-               $result = queries($where ? "DELETE FROM " . idf_escape($_GET["select"]) . " WHERE " . implode(" AND ", $where) : "TRUNCATE " . idf_escape($_GET["select"]));
-               $deleted = $mysql->affected_rows;
-       } elseif ($_POST["export_result"]) {
-               dump_data($_GET["select"], "INSERT", ($where ? "FROM " . idf_escape($_GET["select"]) . " WHERE " . implode(" AND ", $where) : ""));
-       } elseif (is_array($_POST["delete"])) {
-               foreach ($_POST["delete"] as $val) {
-                       parse_str($val, $delete);
-                       if ($_POST["export"]) {
-                               dump_data($_GET["select"], "INSERT", "FROM " . idf_escape($_GET["select"]) . " WHERE " . implode(" AND ", where($delete)) . " LIMIT 1");
-                       } else {
-                               $result = queries("DELETE FROM " . idf_escape($_GET["select"]) . " WHERE " . implode(" AND ", where($delete)) . " LIMIT 1");
-                               if (!$result) {
-                                       break;
-                               }
-                               $deleted += $mysql->affected_rows;
+               if ($_POST["all"]) {
+                       dump_data($_GET["select"], "INSERT", ($where ? "FROM " . idf_escape($_GET["select"]) . " WHERE " . implode(" AND ", $where) : ""));
+               } else {
+                       foreach ((array) $_POST["check"] as $val) {
+                               parse_str($val, $check);
+                               dump_data($_GET["select"], "INSERT", "FROM " . idf_escape($_GET["select"]) . " WHERE " . implode(" AND ", where($check)) . " LIMIT 1");
                        }
                }
-       } elseif ($_POST["delete_selected"]) {
-               if ($_POST["export"]) {
-                       dump_data($_GET["select"], "INSERT", $from);
-               } else {
-                       $result1 = $mysql->query("SELECT * $from");
-                       while ($row1 = $result1->fetch_assoc()) {
-                               parse_str(implode("&", unique_idf($row1, $indexes)), $delete);
-                               $result = queries("DELETE FROM " . idf_escape($_GET["select"]) . " WHERE " . implode(" AND ", where($delete)) . " LIMIT 1");
-                               if (!$result) {
-                                       break;
-                               }
-                               $deleted += $mysql->affected_rows;
+               exit;
+       }
+       $command = ($_POST["delete"] ? ($_POST["all"] && !$where ? "TRUNCATE " : "DELETE FROM ") : "UPDATE ") . idf_escape($_GET["select"]);
+       if (!$_POST["delete"]) {
+               $set = array();
+               foreach ($fields as $name => $field) {
+                       $val = process_input($name, $field);
+                       if ($val !== false) {
+                               $set[] = idf_escape($name) . " = $val";
                        }
-                       $result1->free();
                }
+               $command .= " SET " . implode(", ", $set);
        }
-       if ($_POST["export"] || $_POST["export_result"]) {
-               exit;
+       if (!$_POST["delete"] && !$set) {
+               // nothing
+       } elseif ($_POST["all"]) {
+               $result = queries($command . ($where ? " WHERE " . implode(" AND ", $where) : ""));
+               $affected = $mysql->affected_rows;
+       } else {
+               foreach ((array) $_POST["check"] as $val) {
+                       parse_str($val, $check);
+                       $result = queries($command . " WHERE " . implode(" AND ", where($check)) . " LIMIT 1");
+                       if (!$result) {
+                               break;
+                       }
+                       $affected += $mysql->affected_rows;
+               }
        }
-       query_redirect(queries(), remove_from_uri("page"), lang('%d item(s) have been deleted.', $deleted), $result, false, !$result);
+       query_redirect(queries(), remove_from_uri("page"), lang('%d item(s) have been affected.', $affected), $result, false, !$result);
 }
 page_header(lang('Select') . ": " . htmlspecialchars($_GET["select"]), ($error ? lang('Error during deleting') . ": $error" : ""));
 
@@ -156,7 +154,7 @@ function add_row(field) {
                if ($index["type"] == "FULLTEXT") {
                        echo "(<i>" . implode("</i>, <i>", array_map('htmlspecialchars', $index["columns"])) . "</i>) AGAINST";
                        echo ' <input name="fulltext[' . $i . ']" value="' . htmlspecialchars($_GET["fulltext"][$i]) . '" />';
-                       echo "<label for='boolean-$i'><input type='checkbox' name='boolean[$i]' value='1' id='boolean-$i'" . (isset($_GET["boolean"][$i]) ? " checked='checked'" : "") . " />" . lang('BOOL') . "</label>";
+                       echo "<label><input type='checkbox' name='boolean[$i]' value='1'" . (isset($_GET["boolean"][$i]) ? " checked='checked'" : "") . " />" . lang('BOOL') . "</label>";
                        echo "<br />\n";
                }
        }
@@ -229,14 +227,14 @@ for (var i=0; <?php echo $i; ?> > i; i++) {
                        echo "<table border='1' cellspacing='0' cellpadding='2'>\n";
                        for ($j=0; $row = $result->fetch_assoc(); $j++) {
                                if (!$j) {
-                                       echo '<thead><tr>' . (count($select) == count($group) ? '<td><label><input type="checkbox" name="delete_selected" value="1" onclick="var elems = this.form.elements; for (var i=0; elems.length > i; i++) if (elems[i].name == \'delete[]\') elems[i].checked = this.checked;" />' . lang('all') . '</label></td>' : '');
+                                       echo '<thead><tr>' . (count($select) == count($group) ? '<td><label><input type="checkbox" name="all" value="1" />' . lang('whole result') . '</label></td>' : '');
                                        foreach ($row as $key => $val) {
                                                echo '<th><a href="' . htmlspecialchars(remove_from_uri('(order|desc)[^=]*')) . '&amp;order%5B0%5D=' . htmlspecialchars($key) . ($_GET["order"][0] === $key && !$_GET["desc"][0] ? '&amp;desc%5B0%5D=1' : '') . '">' . htmlspecialchars($key) . "</a></th>";
                                        }
                                        echo "</tr></thead>\n";
                                }
                                $unique_idf = implode('&amp;', unique_idf($row, $indexes));
-                               echo '<tr class="nowrap">' . (count($select) == count($group) ? '<td><input type="checkbox" name="delete[]" value="' . $unique_idf . '" /> <a href="' . htmlspecialchars($SELF) . 'edit=' . urlencode($_GET['select']) . '&amp;' . $unique_idf . '">' . lang('edit') . '</a> <a href="' . htmlspecialchars($SELF) . 'edit=' . urlencode($_GET['select']) . '&amp;' . $unique_idf . '&amp;clone=1">' . lang('clone') . '</a></td>' : '');
+                               echo '<tr class="nowrap">' . (count($select) == count($group) ? '<td><input type="checkbox" name="check[]" value="' . $unique_idf . '" onclick="this.form[\'all\'].checked = false;" /> <a href="' . htmlspecialchars($SELF) . 'edit=' . urlencode($_GET['select']) . '&amp;' . $unique_idf . '">' . lang('edit') . '</a> <a href="' . htmlspecialchars($SELF) . 'edit=' . urlencode($_GET['select']) . '&amp;' . $unique_idf . '&amp;clone=1">' . lang('clone') . '</a></td>' : '');
                                foreach ($row as $key => $val) {
                                        if (!isset($val)) {
                                                $val = "<i>NULL</i>";
@@ -289,8 +287,8 @@ for (var i=0; <?php echo $i; ?> > i; i++) {
                        }
                        echo " (" . lang('%d row(s)', $found_rows) . ")</p>\n";
                        
-                       echo "<fieldset><legend>" . lang('Delete') . "</legend><input type='hidden' name='token' value='$token' />" . (count($group) == count($select) ? "<input type='submit' value='" . lang('Delete selected') . "' /> " : "") . "<input type='submit' name='truncate' value='" . lang('Truncate result') . "' onclick=\"return confirm('" . lang('Are you sure?') . "');\" /></fieldset>\n";
-                       echo "<fieldset><legend>" . lang('Export') . "</legend>$dump_options " . (count($group) == count($select) ? "<input type='submit' name='export' value='" . lang('Export selected') . "' /> " : "") . "<input type='submit' name='export_result' value='" . lang('Export result') . "' /></fieldset>\n";
+                       echo "<fieldset><legend>" . lang('Edit') . "</legend><input type='hidden' name='token' value='$token' /><input type='submit' name='edit' value='" . lang('Edit') . "' /> <input type='submit' name='delete' value='" . lang('Delete') . "' onclick=\"return !this.form['all'].checked || confirm('" . lang('Are you sure?') . "');\" /></fieldset>\n";
+                       echo "<fieldset><legend>" . lang('Export') . "</legend>$dump_options <input type='submit' name='export' value='" . lang('Export') . "' /></fieldset>\n";
                        echo "</form>\n";
                }
                $result->free();
index 40e371cb6880ddced98eef1f09b97561d43bca86..abaea3af1e6832165cceb8cba2c45a65de355188 100644 (file)
@@ -58,7 +58,7 @@ if (!$error && $_POST) {
 <input type="hidden" name="token" value="<?php echo $token; ?>" />
 <input type="submit" value="<?php echo lang('Execute'); ?>" />
 <script type="text/javascript">// <![CDATA[
-document.write('<label for="highlight"><input type="checkbox" name="highlight" id="highlight" value="jush"<?php echo ($_COOKIE["highlight"] == "jush" ? ' checked="checked"' : ''); ?> /><?php echo addcslashes(lang('Syntax highlighting'), "\r\n'\\"); ?></label>');
+document.write('<label><input type="checkbox" name="highlight" value="jush"<?php echo ($_COOKIE["highlight"] == "jush" ? ' checked="checked"' : ''); ?> /><?php echo addcslashes(lang('Syntax highlighting'), "\r\n'\\"); ?></label>');
 // ]]></script>
 </p>
 </form>
index caa61fb9a36e095916e4e057f44556e49877ed54..cf777709c9bdcf3ac90c94e79917622811bd7b51 100644 (file)
--- a/todo.txt
+++ b/todo.txt
@@ -1,14 +1,12 @@
 Add whisperer to fields with foreign key
 Highlight found fields
 MySQL 5 BIT data type
-Input function results in edit
-Bulk update - leave original, set to value, set to NULL
 Transactions in export
 Compress export and import
 Partitioning (MySQL 5.1)
 Create view and routine options
 Import CSV
-Fix database encoding - http://php.vrana.cz/prevod-kodovani-mysql.php
+Function to fix database encoding - http://php.vrana.cz/prevod-kodovani-mysql.php
 ? Execution time in sql.inc.php
 ? Save token also to cookie - for session expiration and login in other window
 ? Save uploaded files after error to session variable instead of hidden field
index 178de552916114cb0e0f5e2f631aa0664752acac..2c24a9f6e820f43071eadfa41dfca168e56fe035 100644 (file)
@@ -134,7 +134,7 @@ if ($_POST) {
 <table border="0" cellspacing="0" cellpadding="2">
 <tr><th><?php echo lang('Username'); ?></th><td><input name="user" maxlength="16" value="<?php echo htmlspecialchars($row["user"]); ?>" /></td></tr>
 <tr><th><?php echo lang('Server'); ?></th><td><input name="host" maxlength="60" value="<?php echo htmlspecialchars($row["host"]); ?>" /></td></tr>
-<tr><th><?php echo lang('Password'); ?></th><td><input id="pass" name="pass" value="<?php echo htmlspecialchars($row["pass"]); ?>" /><?php if (!$row["hashed"]) { ?><script type="text/javascript">document.getElementById('pass').type = 'password';</script><?php } ?> <label for="hashed"><input type="checkbox" name="hashed" id="hashed" value="1"<?php if ($row["hashed"]) { ?> checked="checked"<?php } ?> onclick="this.form['pass'].type = (this.checked ? 'text' : 'password');" /><?php echo lang('Hashed'); ?></label></td></tr>
+<tr><th><?php echo lang('Password'); ?></th><td><input id="pass" name="pass" value="<?php echo htmlspecialchars($row["pass"]); ?>" /><?php if (!$row["hashed"]) { ?><script type="text/javascript">document.getElementById('pass').type = 'password';</script><?php } ?> <label><input type="checkbox" name="hashed" value="1"<?php if ($row["hashed"]) { ?> checked="checked"<?php } ?> onclick="this.form['pass'].type = (this.checked ? 'text' : 'password');" /><?php echo lang('Hashed'); ?></label></td></tr>
 </table>
 
 <?php