]> git.joonet.de Git - adminer.git/commitdiff
AJAX title
authorJakub Vrana <jakub@vrana.cz>
Mon, 22 Nov 2010 17:13:07 +0000 (18:13 +0100)
committerJakub Vrana <jakub@vrana.cz>
Mon, 22 Nov 2010 17:13:07 +0000 (18:13 +0100)
adminer/include/design.inc.php
adminer/static/functions.js

index 8f94806443046f1e6d520af10ef7eae2d75a1093..4d273ccaa2cd7b8a7518f79c67446935140eb470 100644 (file)
@@ -11,7 +11,10 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
        header("Content-Type: text/html; charset=utf-8");
        $adminer->headers();
        $title_all = $title . ($title2 != "" ? ": " . h($title2) : "");
-       if (!is_ajax()) {
+       $title_page = $title_all . (SERVER != "" && SERVER != "localhost" ? h(" - " . SERVER) : "") . " - " . $adminer->name();
+       if (is_ajax()) {
+               header("X-AJAX-Title: " . rawurlencode($title_page));
+       } else {
                $protocol = ($HTTPS ? "https" : "http");
                ?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
@@ -19,7 +22,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 <meta http-equiv="Content-Script-Type" content="text/javascript">
 <meta name="robots" content="noindex">
-<title><?php echo $title_all . (SERVER != "" && SERVER != "localhost" ? h(" - " . SERVER) : "") . " - " . $adminer->name(); ?></title>
+<title><?php echo $title_page; ?></title>
 <link rel="shortcut icon" type="image/x-icon" href="../adminer/static/favicon.ico">
 <link rel="stylesheet" type="text/css" href="../adminer/static/default.css<?php // Ondrej Valka, http://valka.info ?>">
 <?php if (file_exists("adminer.css")) { ?>
index 4edba2e951c4f9047854bf0cd0e6fd4dd652b4f0..0faae95f312fabe95ec63675c24902c45dc40cb9 100644 (file)
@@ -197,6 +197,10 @@ function ajax(url, callback, data) {
                                if (redirect && history.replaceState) {
                                        history.replaceState(null, '', redirect);
                                }
+                               var title = xmlhttp.getResponseHeader('X-AJAX-Title');
+                               if (title) {
+                                       document.title = decodeURIComponent(title);
+                               }
                                callback(xmlhttp.responseText);
                        }
                };