]> git.joonet.de Git - adminer.git/commitdiff
Use AJAX for pagination
authorJakub Vrana <jakub@vrana.cz>
Mon, 18 Oct 2010 20:39:17 +0000 (22:39 +0200)
committerJakub Vrana <jakub@vrana.cz>
Mon, 18 Oct 2010 20:39:17 +0000 (22:39 +0200)
adminer/include/adminer.inc.php
adminer/include/functions.inc.php
adminer/select.inc.php
editor/include/adminer.inc.php

index 418a2cc80c0a81783ed62d634f6c86c47f129b3a..5a31af0b7e538be52e895a8f7e85d49799ae59a8 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') . "'>&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);'>&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 6c78fa70bdb37c564bfab9ec1d5d99808305ded9..683135c126f738cdd96ef97f053d1def9d40671e 100644 (file)
@@ -442,7 +442,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" : "")) . '">' . ($page + 1) . "</a>");
+       return " " . ($page == $current ? $page + 1 : '<a href="' . h(remove_from_uri("page") . ($page ? "&page=$page" : "")) . '" onclick="return !ajaxMain(this.href);">' . ($page + 1) . "</a>");
 }
 
 /** Get file contents from $_FILES
index aa175afc275d2b941f6774b75b8f94242a861fe5..715a075706a3258599886b4b6ca736b12a74289f 100644 (file)
@@ -377,11 +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) location.href = this.href + (page != 1 ? '&amp;page=' + (page - 1) : ''); return false;\">" . lang('Page') . "</a>:" . pagination(0, $page) . ($page > 5 ? " ..." : "");
+                               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 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") . '">' . 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);">' . lang('last') . "</a>");
                        }
                        echo " (" . ($exact_count ? "" : "~ ") . lang('%d row(s)', $found_rows) . ") " . checkbox("all", 1, 0, lang('whole result')) . "\n";
                        
index 224246c344cfc3698c76623afaf0ccbfcdc82e02..a198d118acfd909448cc3d8a97df2e36743b4e83 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') . "'>&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);'>&gt;&gt;</a>\n";
                if (is_ajax()) {
                        echo "<a href='" . h($_SERVER["REQUEST_URI"]) . "'>#</a>\n";
                }