Permalink
Browse files

Print SQL query by messages

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@480 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
jakubvrana
jakubvrana committed Sep 3, 2008
1 parent c48a017 commit 06faef23e72052778de657348efea2ddabf92894
Showing with 13 additions and 2 deletions.
  1. +2 −0 default.css
  2. +8 −0 design.inc.php
  3. +2 −1 functions.inc.php
  4. +1 −1 select.inc.php
View
@@ -12,6 +12,8 @@ th { background: #eee; }
fieldset { display: inline; vertical-align: top; padding: .5em .8em; margin: 0 .5em .5em 0; border: 1px solid #999; }
p { margin: 0 20px 1em 0; }
img { vertical-align: middle; }
+code { background-color: #eee; }
+.js .hidden { display: none; }
.error { color: red; background: #fee; padding: .5em .8em; }
.message { color: green; background: #efe; padding: .5em .8em; }
.char { color: #007F00; }
View
@@ -15,6 +15,14 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
</head>
<body>
+<script type="text/javascript">
+document.body.className = 'js';
+function toggle(id) {
+ var el = document.getElementById(id);
+ el.className = (el.className == 'hidden' ? '' : 'hidden');
+ return true;
+}
+</script>
<div id="content">
<?php
View
@@ -197,7 +197,8 @@ function redirect($location, $message = null) {
function query_redirect($query, $location, $message, $redirect = true, $execute = true) {
global $mysql, $error, $SELF;
- $sql = ' <a href="' . htmlspecialchars($SELF) . 'sql=' . urlencode($query) . '">' . lang('SQL command') . "</a>";
+ $id = "sql-" . count($_SESSION["messages"]);
+ $sql = " <a href='#$id' onclick=\"return !toggle('$id');\">" . lang('SQL command') . "</a><span id='$id' class='hidden'><br /><code class='jush-sql'>" . htmlspecialchars($query) . '</code> <a href="' . htmlspecialchars($SELF) . 'sql=' . urlencode($query) . '">' . lang('Edit') . '</a></span>';
if ($execute && !$mysql->query($query)) {
$error = htmlspecialchars($mysql->error) . $sql;
return false;
View
@@ -214,7 +214,7 @@ function where_change(op) {
echo "</form>\n";
$query = "SELECT " . ($select ? (count($group) < count($select) ? "SQL_CALC_FOUND_ROWS " : "") . implode(", ", $select) : "*") . " $from";
- echo "<p><code class='jush-sql'>" . htmlspecialchars($query) . "</code> - <a href='" . htmlspecialchars($SELF) . "sql=" . urlencode($query) . "'>" . lang('edit') . "</a></p>\n";
+ echo "<p><code class='jush-sql'>" . htmlspecialchars($query) . "</code> <a href='" . htmlspecialchars($SELF) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a></p>\n";
$result = $mysql->query($query);
if (!$result) {

0 comments on commit 06faef2

Please sign in to comment.