]> git.joonet.de Git - adminer.git/commitdiff
No AJAX in drop table, drop database and logout
authorJakub Vrana <jakub@vrana.cz>
Fri, 26 Nov 2010 09:53:05 +0000 (10:53 +0100)
committerJakub Vrana <jakub@vrana.cz>
Fri, 26 Nov 2010 09:58:22 +0000 (10:58 +0100)
adminer/db.inc.php
adminer/include/connect.inc.php
adminer/include/functions.inc.php
adminer/static/editing.js
adminer/static/functions.js

index d2a734145779591b548429c1493df517079e4468..a519ca35e35b5edad01f4b4fd5862c080eef3ff7 100644 (file)
@@ -73,11 +73,11 @@ if ($_GET["ns"] !== "") {
                }
                echo "</table>\n";
                if (!information_schema(DB)) {
-                       echo "<p><input type='hidden' name='token' value='$token'>" . ($jush == "sql" ? "<input type='submit' value='" . lang('Analyze') . "'> <input type='submit' name='optimize' value='" . lang('Optimize') . "'> <input type='submit' name='check' value='" . lang('Check') . "'> <input type='submit' name='repair' value='" . lang('Repair') . "'> " : "") . "<input type='submit' name='truncate' value='" . lang('Truncate') . "'" . confirm("formChecked(this, /tables/)") . "> <input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm("formChecked(this, /tables|views/)") . ">\n";
+                       echo "<p><input type='hidden' name='token' value='$token'>" . ($jush == "sql" ? "<input type='submit' value='" . lang('Analyze') . "'> <input type='submit' name='optimize' value='" . lang('Optimize') . "'> <input type='submit' name='check' value='" . lang('Check') . "'> <input type='submit' name='repair' value='" . lang('Repair') . "'> " : "") . "<input type='submit' name='truncate' value='" . lang('Truncate') . "'" . confirm("formChecked(this, /tables/)") . "> <input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm("formChecked(this, /tables|views/)", 1) . ">\n"; // 1 - eventStop
                        $databases = (support("scheme") ? schemas() : get_databases());
                        if (count($databases) != 1 && $jush != "sqlite") {
                                $db = (isset($_POST["target"]) ? $_POST["target"] : (support("scheme") ? $_GET["ns"] : DB));
-                               echo "<p>" . lang('Move to other database') . ($databases ? ": " . html_select("target", $databases, $db) : ': <input name="target" value="' . h($db) . '">') . " <input type='submit' name='move' value='" . lang('Move') . "'>\n";
+                               echo "<p>" . lang('Move to other database') . ($databases ? ": " . html_select("target", $databases, $db) : ': <input name="target" value="' . h($db) . '">') . " <input type='submit' name='move' value='" . lang('Move') . "' onclick='eventStop(event);'>\n";
                        }
                }
                echo "</form>\n";
index 01009712c0399402c45a816ff39f40515527bbe2..c61b32aeaf535230e82be393df6f5a2f0f18b03a 100644 (file)
@@ -42,8 +42,8 @@ function connect_error() {
                                echo "\n";
                        }
                        echo "</table>\n";
-                       echo "<p><input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm("formChecked(this, /db/)") . ">\n";
-                       echo "<a href='" . h(ME) . "refresh=1'>" . lang('Refresh') . "</a>\n";
+                       echo "<p><input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm("formChecked(this, /db/)", 1) . ">\n"; // 1 - eventStop
+                       echo "<a href='" . h(ME) . "refresh=1' onclick='eventStop(event);'>" . lang('Refresh') . "</a>\n";
                        echo "</form>\n";
                }
        }
index ded6952b1c630c88b97af1d9c12e631119c8baf4..2e18be3732a070b00c38eb12f9fc739fbbde638f 100644 (file)
@@ -137,10 +137,11 @@ function html_select($name, $options, $value = "", $onchange = true) {
 
 /** Get onclick confirmation
 * @param string JavaScript expression
+* @param bool stop event propagation
 * @return string
 */
-function confirm($count = "") {
-       return " onclick=\"return confirm('" . lang('Are you sure?') . ($count ? " (' + $count + ')" : "") . "');\"";
+function confirm($count = "", $stop = false) {
+       return " onclick=\"" . ($stop ? "eventStop(event); " : "") . "return confirm('" . lang('Are you sure?') . ($count ? " (' + $count + ')" : "") . "');\"";
 }
 
 /** Escape string for JavaScript apostrophes
index a18fa31efb6d33e60283092c35d408a633678166..9ef3e45fdaab75f402e63ac379b8a91fb0ad3c1e 100644 (file)
@@ -399,3 +399,16 @@ function schemaMouseup(ev) {
                cookie('adminer_schema=' + encodeURIComponent(s.substr(1)), 30, '; path="' + location.pathname + location.search + '"');
        }
 }
+
+
+
+/** Stop event propagation
+* @param Event
+*/
+function eventStop(event) {
+       if (event.stopPropagation) {
+               event.stopPropagation();
+       } else {
+               event.cancelBubble = true;
+       }
+}
index 91a3b0cb99d86a9af68d80cc3e994cabd0eaefee..a7f2073f4d7c9edd271c335856c09947f5b6c8dc 100644 (file)
@@ -383,7 +383,7 @@ function bodyClick(event, db) {
                var match = /&db=([^&]*)/.exec(el.href);
                return !(db == (match ? match[1] : '') && ajaxMain(el.href, '', event));
        }
-       if (/^input$/i.test(el.tagName) && /submit|image/.test(el.type) && !/&(database|scheme|create|view|sql|user)=/.test(location.href)) {
+       if (/^input$/i.test(el.tagName) && /submit|image/.test(el.type) && el.name != 'logout' && !/&(database|scheme|create|view|sql|user)=/.test(location.href)) {
                return !ajaxForm(el.form, (el.name ? encodeURIComponent(el.name) + '=1' : ''));
        }
        return true;