Highlight current links

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1253 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2009-11-26 12:14:39 +00:00
parent ecb56e6ff5
commit 94a2be52ba
4 changed files with 17 additions and 7 deletions

View file

@ -83,7 +83,7 @@ class Adminer {
$links["edit"] = lang('New item'); $links["edit"] = lang('New item');
} }
foreach ($links as $key => $val) { foreach ($links as $key => $val) {
echo " <a href='" . h(ME) . "$key=" . urlencode($tableStatus["Name"]) . ($key == "edit" ? $set : "") . "'>" . (isset($_GET[$key]) ? "<b>$val</b>" : $val) . "</a>"; echo " <a href='" . h(ME) . "$key=" . urlencode($tableStatus["Name"]) . ($key == "edit" ? $set : "") . "'>" . bold($val, isset($_GET[$key])) . "</a>";
} }
echo "\n"; echo "\n";
} }
@ -480,8 +480,8 @@ class Adminer {
?> ?>
<form action="" method="post"> <form action="" method="post">
<p class="logout"> <p class="logout">
<a href="<?php echo h(ME); ?>sql="><?php echo lang('SQL command'); ?></a> <a href="<?php echo h(ME); ?>sql="><?php echo bold(lang('SQL command'), isset($_GET["sql"])); ?></a>
<a href="<?php echo h(ME); ?>dump=<?php echo urlencode(isset($_GET["table"]) ? $_GET["table"] : $_GET["select"]); ?>"><?php echo lang('Dump'); ?></a> <a href="<?php echo h(ME); ?>dump=<?php echo urlencode(isset($_GET["table"]) ? $_GET["table"] : $_GET["select"]); ?>"><?php echo bold(lang('Dump'), isset($_GET["dump"])); ?></a>
<input type="hidden" name="token" value="<?php echo $_SESSION["tokens"][$_GET["server"]]; ?>"> <input type="hidden" name="token" value="<?php echo $_SESSION["tokens"][$_GET["server"]]; ?>">
<input type="submit" name="logout" value="<?php echo lang('Logout'); ?>"> <input type="submit" name="logout" value="<?php echo lang('Logout'); ?>">
</p> </p>
@ -505,7 +505,7 @@ class Adminer {
} else { } else {
$this->tablesPrint($tables); $this->tablesPrint($tables);
} }
echo '<p><a href="' . h(ME) . 'create=">' . lang('Create new table') . "</a>\n"; echo '<p><a href="' . h(ME) . 'create=">' . bold(lang('Create new table'), $_GET["create"] === "") . "</a>\n";
} }
} }
} }
@ -517,8 +517,8 @@ class Adminer {
function tablesPrint($tables) { function tablesPrint($tables) {
echo "<p id='tables'>\n"; echo "<p id='tables'>\n";
foreach ($tables as $table) { foreach ($tables as $table) {
echo '<a href="' . h(ME) . 'select=' . urlencode($table) . '">' . lang('select') . '</a> '; echo '<a href="' . h(ME) . 'select=' . urlencode($table) . '">' . bold(lang('select'), $_GET["select"] == $table) . '</a> ';
echo '<a href="' . h(ME) . 'table=' . urlencode($table) . '">' . $this->tableName(array("Name" => $table)) . "</a><br>\n"; //! Adminer::tableName may work with full table status echo '<a href="' . h(ME) . 'table=' . urlencode($table) . '">' . bold($this->tableName(array("Name" => $table)), $_GET["table"] == $table) . "</a><br>\n"; //! Adminer::tableName may work with full table status
} }
} }

View file

@ -526,3 +526,12 @@ function is_url($string) {
function print_fieldset($id, $legend, $visible = false) { function print_fieldset($id, $legend, $visible = false) {
echo "<fieldset><legend><a href='#fieldset-$id' onclick=\"return !toggle('fieldset-$id');\">$legend</a></legend><div id='fieldset-$id'" . ($visible ? "" : " class='hidden'") . ">\n"; echo "<fieldset><legend><a href='#fieldset-$id' onclick=\"return !toggle('fieldset-$id');\">$legend</a></legend><div id='fieldset-$id'" . ($visible ? "" : " class='hidden'") . ">\n";
} }
/** Enclose $string to <b> if $bold is true
* @param string
* @param bool
* @return string
*/
function bold($string, $bold) {
return ($bold ? "<b>$string</b>" : $string);
}

View file

@ -1,4 +1,5 @@
Adminer 2.2.1-dev: Adminer 2.2.1-dev:
Highlight current links
Improve concurrency Improve concurrency
Move number of tables to DB info (performance) Move number of tables to DB info (performance)
Search by foreign keys (Editor) Search by foreign keys (Editor)

View file

@ -466,7 +466,7 @@ ORDER BY ORDINAL_POSITION");
foreach ($tables as $row) { foreach ($tables as $row) {
$name = $this->tableName($row); $name = $this->tableName($row);
if (isset($row["Engine"]) && strlen($name)) { // ignore views and tables without name if (isset($row["Engine"]) && strlen($name)) { // ignore views and tables without name
echo "<a href='" . h(ME) . 'select=' . urlencode($row["Name"]) . "'>$name</a><br>\n"; echo "<a href='" . h(ME) . 'select=' . urlencode($row["Name"]) . "'>" . bold($name, $_GET["select"] == $row["Name"]) . "</a><br>\n";
} }
} }
} }