Refresh breadcrumb and title in AJAX
This commit is contained in:
parent
a97c45fc9b
commit
4c9044800d
|
@ -10,8 +10,8 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
|
||||||
global $LANG, $HTTPS, $adminer, $connection, $drivers;
|
global $LANG, $HTTPS, $adminer, $connection, $drivers;
|
||||||
header("Content-Type: text/html; charset=utf-8");
|
header("Content-Type: text/html; charset=utf-8");
|
||||||
$adminer->headers();
|
$adminer->headers();
|
||||||
if (!is_ajax()) {
|
|
||||||
$title_all = $title . ($title2 != "" ? ": " . h($title2) : "");
|
$title_all = $title . ($title2 != "" ? ": " . h($title2) : "");
|
||||||
|
if (!is_ajax()) {
|
||||||
$protocol = ($HTTPS ? "https" : "http");
|
$protocol = ($HTTPS ? "https" : "http");
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||||
|
@ -32,6 +32,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
|
||||||
|
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<?php
|
<?php
|
||||||
|
}
|
||||||
if (isset($breadcrumb)) {
|
if (isset($breadcrumb)) {
|
||||||
$link = substr(preg_replace('~(username|db|ns)=[^&]*&~', '', ME), 0, -1);
|
$link = substr(preg_replace('~(username|db|ns)=[^&]*&~', '', ME), 0, -1);
|
||||||
echo '<p id="breadcrumb"><a href="' . ($link ? h($link) : ".") . '">' . $drivers[DRIVER] . '</a> » ';
|
echo '<p id="breadcrumb"><a href="' . ($link ? h($link) : ".") . '">' . $drivers[DRIVER] . '</a> » ';
|
||||||
|
@ -59,8 +60,6 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "<h2>$title_all</h2>\n";
|
echo "<h2>$title_all</h2>\n";
|
||||||
echo "<div id='main'>\n";
|
|
||||||
}
|
|
||||||
restart_session();
|
restart_session();
|
||||||
if ($_SESSION["messages"]) {
|
if ($_SESSION["messages"]) {
|
||||||
echo "<div class='message'>" . implode("</div>\n<div class='message'>", $_SESSION["messages"]) . "</div>\n";
|
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()) {
|
if (!is_ajax()) {
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php switch_lang(); ?>
|
<?php switch_lang(); ?>
|
||||||
<div id="menu">
|
<div id="menu">
|
||||||
|
|
|
@ -221,7 +221,7 @@ function ajaxSetHtml(url) {
|
||||||
var ajaxState = 0;
|
var ajaxState = 0;
|
||||||
var ajaxTimeout;
|
var ajaxTimeout;
|
||||||
|
|
||||||
/** Safely load content to #main
|
/** Safely load content to #content
|
||||||
* @param string
|
* @param string
|
||||||
* @param [string]
|
* @param [string]
|
||||||
* @return XMLHttpRequest or false in case of an error
|
* @return XMLHttpRequest or false in case of an error
|
||||||
|
@ -230,12 +230,12 @@ function ajaxSend(url, data) {
|
||||||
var currentState = ++ajaxState;
|
var currentState = ++ajaxState;
|
||||||
clearTimeout(ajaxTimeout);
|
clearTimeout(ajaxTimeout);
|
||||||
ajaxTimeout = setTimeout(function () {
|
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
|
}, 500); // defer displaying loader
|
||||||
return ajax(url, function (text) {
|
return ajax(url, function (text) {
|
||||||
if (currentState == ajaxState) {
|
if (currentState == ajaxState) {
|
||||||
clearTimeout(ajaxTimeout);
|
clearTimeout(ajaxTimeout);
|
||||||
setHtml('main', text);
|
setHtml('content', text);
|
||||||
if (window.jush) {
|
if (window.jush) {
|
||||||
jush.highlight_tag('code', 0);
|
jush.highlight_tag('code', 0);
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,7 @@ function ajaxSend(url, data) {
|
||||||
}, data);
|
}, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Load content to #main
|
/** Load content to #content
|
||||||
* @param string
|
* @param string
|
||||||
* @param [string]
|
* @param [string]
|
||||||
* @param [MouseEvent]
|
* @param [MouseEvent]
|
||||||
|
|
Loading…
Reference in a new issue