]> git.joonet.de Git - adminer.git/commitdiff
Refresh breadcrumb and title in AJAX
authorJakub Vrana <jakub@vrana.cz>
Thu, 18 Nov 2010 11:17:06 +0000 (12:17 +0100)
committerJakub Vrana <jakub@vrana.cz>
Fri, 19 Nov 2010 14:50:56 +0000 (15:50 +0100)
adminer/include/design.inc.php
adminer/static/functions.js

index 5d821fe5c28f684c301dd14b2e26f2a8b76720d1..7b9bcd939148c1f4013eda084290bc9aed6f4424 100644 (file)
@@ -10,8 +10,8 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
        global $LANG, $HTTPS, $adminer, $connection, $drivers;
        header("Content-Type: text/html; charset=utf-8");
        $adminer->headers();
+       $title_all = $title . ($title2 != "" ? ": " . h($title2) : "");
        if (!is_ajax()) {
-               $title_all = $title . ($title2 != "" ? ": " . h($title2) : "");
                $protocol = ($HTTPS ? "https" : "http");
                ?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
@@ -32,35 +32,34 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
 
 <div id="content">
 <?php
-               if (isset($breadcrumb)) {
-                       $link = substr(preg_replace('~(username|db|ns)=[^&]*&~', '', ME), 0, -1);
-                       echo '<p id="breadcrumb"><a href="' . ($link ? h($link) : ".") . '">' . $drivers[DRIVER] . '</a> &raquo; ';
-                       $link = substr(preg_replace('~(db|ns)=[^&]*&~', '', ME), 0, -1);
-                       $server = (SERVER != "" ? h(SERVER) : lang('Server'));
-                       if ($breadcrumb === false) {
-                               echo "$server\n";
-                       } else {
-                               echo "<a href='" . ($link ? h($link) : ".") . "'>$server</a> &raquo; ";
-                               if ($_GET["ns"] != "" || (DB != "" && is_array($breadcrumb))) {
-                                       echo '<a href="' . h($link . "&db=" . urlencode(DB) . (support("scheme") ? "&ns=" : "")) . '">' . h(DB) . '</a> &raquo; ';
+       }
+       if (isset($breadcrumb)) {
+               $link = substr(preg_replace('~(username|db|ns)=[^&]*&~', '', ME), 0, -1);
+               echo '<p id="breadcrumb"><a href="' . ($link ? h($link) : ".") . '">' . $drivers[DRIVER] . '</a> &raquo; ';
+               $link = substr(preg_replace('~(db|ns)=[^&]*&~', '', ME), 0, -1);
+               $server = (SERVER != "" ? h(SERVER) : lang('Server'));
+               if ($breadcrumb === false) {
+                       echo "$server\n";
+               } else {
+                       echo "<a href='" . ($link ? h($link) : ".") . "'>$server</a> &raquo; ";
+                       if ($_GET["ns"] != "" || (DB != "" && is_array($breadcrumb))) {
+                               echo '<a href="' . h($link . "&db=" . urlencode(DB) . (support("scheme") ? "&ns=" : "")) . '">' . h(DB) . '</a> &raquo; ';
+                       }
+                       if (is_array($breadcrumb)) {
+                               if ($_GET["ns"] != "") {
+                                       echo '<a href="' . h(substr(ME, 0, -1)) . '">' . h($_GET["ns"]) . '</a> &raquo; ';
                                }
-                               if (is_array($breadcrumb)) {
-                                       if ($_GET["ns"] != "") {
-                                               echo '<a href="' . h(substr(ME, 0, -1)) . '">' . h($_GET["ns"]) . '</a> &raquo; ';
-                                       }
-                                       foreach ($breadcrumb as $key => $val) {
-                                               $desc = (is_array($val) ? $val[1] : $val);
-                                               if ($desc != "") {
-                                                       echo '<a href="' . h(ME . "$key=") . urlencode(is_array($val) ? $val[0] : $val) . '">' . h($desc) . '</a> &raquo; ';
-                                               }
+                               foreach ($breadcrumb as $key => $val) {
+                                       $desc = (is_array($val) ? $val[1] : $val);
+                                       if ($desc != "") {
+                                               echo '<a href="' . h(ME . "$key=") . urlencode(is_array($val) ? $val[0] : $val) . '">' . h($desc) . '</a> &raquo; ';
                                        }
                                }
-                               echo "$title\n";
                        }
+                       echo "$title\n";
                }
-               echo "<h2>$title_all</h2>\n";
-               echo "<div id='main'>\n";
        }
+       echo "<h2>$title_all</h2>\n";
        restart_session();
        if ($_SESSION["messages"]) {
                echo "<div class='message'>" . implode("</div>\n<div class='message'>", $_SESSION["messages"]) . "</div>\n";
@@ -84,7 +83,6 @@ function page_footer($missing = "") {
        if (!is_ajax()) {
                ?>
 </div>
-</div>
 
 <?php switch_lang(); ?>
 <div id="menu">
index 8b1b8ef9fb2077ee5ff0d91175637838d6c1e885..9c19046fffe3d9bb3fe4c9d5d666866a34463a5e 100644 (file)
@@ -221,7 +221,7 @@ function ajaxSetHtml(url) {
 var ajaxState = 0;
 var ajaxTimeout;
 
-/** Safely load content to #main
+/** Safely load content to #content
 * @param string
 * @param [string]
 * @return XMLHttpRequest or false in case of an error
@@ -230,12 +230,12 @@ function ajaxSend(url, data) {
        var currentState = ++ajaxState;
        clearTimeout(ajaxTimeout);
        ajaxTimeout = setTimeout(function () {
-               setHtml('main', '<img src="../adminer/static/loader.gif" alt="">');
+               setHtml('content', '<img src="../adminer/static/loader.gif" alt="">');
        }, 500); // defer displaying loader
        return ajax(url, function (text) {
                if (currentState == ajaxState) {
                        clearTimeout(ajaxTimeout);
-                       setHtml('main', text);
+                       setHtml('content', text);
                        if (window.jush) {
                                jush.highlight_tag('code', 0);
                        }
@@ -243,7 +243,7 @@ function ajaxSend(url, data) {
        }, data);
 }
 
-/** Load content to #main
+/** Load content to #content
 * @param string
 * @param [string]
 * @param [MouseEvent]