Skip to content

Commit

Permalink
Highlight current link
Browse files Browse the repository at this point in the history
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1251 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information
jakubvrana committed Nov 24, 2009
1 parent 3e9b1ba commit 294b10b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
16 changes: 9 additions & 7 deletions adminer/include/adminer.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,22 @@ function fieldName($field, $order = 0) {

/** Print links after select heading
* @param array result of SHOW TABLE STATUS
* @param strin new item options, NULL for no new item
* @param string new item options, NULL for no new item
* @return null
*/
function selectLinks($tableStatus, $set = "") {
$TABLE = $tableStatus["Name"];
echo '<p class="tabs"><a href="' . h(ME) . 'select=' . urlencode($TABLE) . '">' . lang('Select table') . '</a>';
echo ' <a href="' . h(ME) . 'table=' . urlencode($TABLE) . '">' . lang('Table structure') . '</a>';
echo '<p class="tabs">';
$links = array("select" => lang('Select table'), "table" => lang('Table structure'));
if (isset($tableStatus["Rows"])) {
echo ' <a href="' . h(ME) . 'create=' . urlencode($TABLE) . '">' . lang('Alter table') . '</a>';
$links["create"] = lang('Alter table');
} else {
echo ' <a href="' . h(ME) . 'view=' . urlencode($TABLE) . '">' . lang('Alter view') . '</a>';
$links["view"] = lang('Alter view');
}
if (isset($set)) {
echo ' <a href="' . h(ME . 'edit=' . urlencode($TABLE) . $set) . '">' . lang('New item') . '</a>';
$links["edit"] = lang('New item');
}
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 "\n";
}
Expand Down
5 changes: 2 additions & 3 deletions adminer/table.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
$error = h($connection->error);
}
$table_status = ($fields ? table_status($TABLE) : array());
$is_view = !isset($table_status["Rows"]);

page_header(($fields && $is_view ? lang('View') : lang('Table')) . ": " . h($TABLE), $error);
$adminer->selectLinks($table_status, $is_view ? null : "");
page_header(($fields && !isset($table_status["Rows"]) ? lang('View') : lang('Table')) . ": " . h($TABLE), $error);
$adminer->selectLinks($table_status);

if ($fields) {
echo "<table cellspacing='0'>\n";
Expand Down

0 comments on commit 294b10b

Please sign in to comment.