]> git.joonet.de Git - adminer.git/commitdiff
Don't use AJAX with Ctrl
authorJakub Vrana <jakub@vrana.cz>
Tue, 19 Oct 2010 22:15:33 +0000 (00:15 +0200)
committerJakub Vrana <jakub@vrana.cz>
Tue, 19 Oct 2010 22:15:33 +0000 (00:15 +0200)
adminer/edit.inc.php
adminer/include/adminer.inc.php
adminer/include/functions.inc.php
adminer/select.inc.php
adminer/static/functions.js
editor/include/adminer.inc.php

index f3f860875318be4563142d96e9b2921ea524354b..4390bc0c0eef548b62d1ff1586e75af69852a899 100644 (file)
@@ -107,7 +107,7 @@ if ($update) {
        echo "<input type='submit' name='delete' value='" . lang('Delete') . "' onclick=\"return confirm('" . lang('Are you sure?') . "')" . (isset($_GET["select"]) ? " &amp;&amp; !ajaxForm(this.form, 'delete=1')" : "") . ";\">\n";
 }
 if (isset($_GET["select"])) {
-       echo "<a href='" . h($_SERVER["REQUEST_URI"]) . "' onclick='return !ajaxMain(this.href);'>" . lang('Cancel') . "</a>\n";
+       echo "<a href='" . h($_SERVER["REQUEST_URI"]) . "' onclick='return !ajaxMain(this.href, undefined, event);'>" . lang('Cancel') . "</a>\n";
 }
 ?>
 </form>
index 5a31af0b7e538be52e895a8f7e85d49799ae59a8..a24b1ba8f7efe4efe866e1de36a44d0244b94433 100644 (file)
@@ -130,7 +130,7 @@ document.getElementById('username').focus();
        */
        function selectQuery($query) {
                global $jush;
-               return "<p><a href='" . h(remove_from_uri("page")) . "&amp;page=last' title='" . lang('Page') . ": " . lang('last') . "' onclick='return !ajaxMain(this.href);'>&gt;&gt;</a> <code class='jush-$jush'>" . h(str_replace("\n", " ", $query)) . "</code> <a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a>" . (is_ajax() ? " <a href='" . h($_SERVER["REQUEST_URI"]) . "'>#</a>" : "") . "\n";
+               return "<p><a href='" . h(remove_from_uri("page")) . "&amp;page=last' title='" . lang('Page') . ": " . lang('last') . "' onclick='return !ajaxMain(this.href, undefined, event);'>&gt;&gt;</a> <code class='jush-$jush'>" . h(str_replace("\n", " ", $query)) . "</code> <a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a>" . (is_ajax() ? " <a href='" . h($_SERVER["REQUEST_URI"]) . "'>#</a>" : "") . "\n";
        }
        
        /** Description of a row in a table
index 0c477db90e663618d347973dfa5b999d66701c95..36ba89163da079ae79f2539234545d41de23a511 100644 (file)
@@ -450,7 +450,7 @@ function remove_from_uri($param = "") {
 * @return string
 */
 function pagination($page, $current) {
-       return " " . ($page == $current ? $page + 1 : '<a href="' . h(remove_from_uri("page") . ($page ? "&page=$page" : "")) . '" onclick="return !ajaxMain(this.href);">' . ($page + 1) . "</a>");
+       return " " . ($page == $current ? $page + 1 : '<a href="' . h(remove_from_uri("page") . ($page ? "&page=$page" : "")) . '" onclick="return !ajaxMain(this.href, undefined, event);">' . ($page + 1) . "</a>");
 }
 
 /** Get file contents from $_FILES
index bdfdced8d9abaadde96c5615b7f1dd577becb360..cbb2ac89190d8231665ad2cf665e49da1029720a 100644 (file)
@@ -262,7 +262,7 @@ if (!$columns) {
                                if ($name != "") {
                                        $order++;
                                        $names[$key] = $name;
-                                       echo '<th><a href="' . h(remove_from_uri('(order|desc)[^=]*|page') . '&order%5B0%5D=' . urlencode($key) . ($_GET["order"][0] == $key && !$_GET["desc"][0] ? '&desc%5B0%5D=1' : '')) . '" onclick="return !ajaxMain(this.href);">' . apply_sql_function($val["fun"], $name) . "</a>"; //! columns looking like functions
+                                       echo '<th><a href="' . h(remove_from_uri('(order|desc)[^=]*|page') . '&order%5B0%5D=' . urlencode($key) . ($_GET["order"][0] == $key && !$_GET["desc"][0] ? '&desc%5B0%5D=1' : '')) . '" onclick="return !ajaxMain(this.href, undefined, event);">' . apply_sql_function($val["fun"], $name) . "</a>"; //! columns looking like functions
                                }
                                $functions[$key] = $val["fun"];
                                next($select);
@@ -377,12 +377,12 @@ if (!$columns) {
                        if (intval($limit) && $found_rows > $limit) {
                                // display first, previous 4, next 4 and last page
                                $max_page = floor(($found_rows - 1) / $limit);
-                               echo '<a href="' . h(remove_from_uri("page")) . "\" onclick=\"var page = +prompt('" . lang('Page') . "', '" . ($page + 1) . "'); if (!isNaN(page) &amp;&amp; page) ajaxMain(this.href + (page != 1 ? '&amp;page=' + (page - 1) : '')); return false;\">" . lang('Page') . "</a>:";
+                               echo '<a href="' . h(remove_from_uri("page")) . "\" onclick=\"var page = +prompt('" . lang('Page') . "', '" . ($page + 1) . "'); if (!isNaN(page) &amp;&amp; page) ajaxMain(this.href + (page != 1 ? '&amp;page=' + (page - 1) : ''), undefined, event); return false;\">" . lang('Page') . "</a>:";
                                echo pagination(0, $page) . ($page > 5 ? " ..." : "");
                                for ($i = max(1, $page - 4); $i < min($max_page, $page + 5); $i++) {
                                        echo pagination($i, $page);
                                }
-                               echo ($page + 5 < $max_page ? " ..." : "") . ($exact_count ? pagination($max_page, $page) : ' <a href="' . h(remove_from_uri() . "&page=last") . '" onclick="return !ajaxMain(this.href);">' . lang('last') . "</a>");
+                               echo ($page + 5 < $max_page ? " ..." : "") . ($exact_count ? pagination($max_page, $page) : ' <a href="' . h(remove_from_uri() . "&page=last") . '" onclick="return !ajaxMain(this.href, undefined, event);">' . lang('last') . "</a>");
                        }
                        echo " (" . ($exact_count ? "" : "~ ") . lang('%d row(s)', $found_rows) . ") " . checkbox("all", 1, 0, lang('whole result')) . "\n";
                        
index 27a3468f45f8e73849acc61e8d970ec8bd7a7c76..c04e9bde66752917aeb5a8bf75b670546dc1a792 100644 (file)
@@ -206,9 +206,13 @@ var ajaxTimeout;
 /** Load content to #main
 * @param string
 * @param [string]
+* @param [MouseEvent]
 * @return XMLHttpRequest or false in case of an error
 */
-function ajaxMain(url, data) {
+function ajaxMain(url, data, event) {
+       if (event && event.ctrlKey) {
+               return false;
+       }
        var currentState = ++ajaxState;
        clearTimeout(ajaxTimeout);
        ajaxTimeout = setTimeout(function () {
index 6fe01978dc85d834af10c86e9b90554b5df242b6..b1fe14708aa1770f71c3aceb890085bc4c184579 100644 (file)
@@ -61,7 +61,7 @@ document.getElementById('username').focus();
                if (isset($set)) {
                        echo '<p class="tabs"><a href="' . h(ME . 'edit=' . urlencode($TABLE) . $set) . '">' . lang('New item') . "</a>\n";
                }
-               echo "<a href='" . h(remove_from_uri("page")) . "&amp;page=last' title='" . lang('Page') . ": " . lang('last') . "' onclick='return !ajaxMain(this.href);'>&gt;&gt;</a>\n";
+               echo "<a href='" . h(remove_from_uri("page")) . "&amp;page=last' title='" . lang('Page') . ": " . lang('last') . "' onclick='return !ajaxMain(this.href, undefined, event);'>&gt;&gt;</a>\n";
                if (is_ajax()) {
                        echo "<a href='" . h($_SERVER["REQUEST_URI"]) . "'>#</a>\n";
                }