if ($_POST["search"] && $_POST["query"] != "") {
search_tables();
}
- echo "<table cellspacing='0' class='nowrap' onclick='tableClick(event);'>\n";
+ echo "<table cellspacing='0' class='nowrap checkable' onclick='tableClick(event);'>\n";
echo '<thead><tr class="wrap"><td><input id="check-all" type="checkbox" onclick="formCheck(this, /^(tables|views)\[/);">';
echo '<th>' . lang('Table');
echo '<td>' . lang('Engine');
echo "<td align='right' id='sum-$key'> ";
}
echo "</table>\n";
+ echo "<script type='text/javascript'>tableCheck();</script>\n";
if (!information_schema(DB)) {
echo "<p>" . ($jush == "sql" ? "<input type='submit' value='" . lang('Analyze') . "'> <input type='submit' name='optimize' value='" . lang('Optimize') . "'> <input type='submit' name='check' value='" . lang('Check') . "'> <input type='submit' name='repair' value='" . lang('Repair') . "'> " : "") . "<input type='submit' name='truncate' value='" . lang('Truncate') . "'" . confirm("formChecked(this, /tables/)") . "> <input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm("formChecked(this, /tables|views/)", 1) . ">\n"; // 1 - eventStop
$databases = (support("scheme") ? schemas() : get_databases());
$scheme = support("scheme");
$collations = collations();
echo "<form action='' method='post'>\n";
- echo "<table cellspacing='0' onclick='tableClick(event);'>\n";
+ echo "<table cellspacing='0' class='checkable' onclick='tableClick(event);'>\n";
echo "<thead><tr><td> <th>" . lang('Database') . "<td>" . lang('Collation') . "<td>" . lang('Tables') . "</thead>\n";
foreach ($databases as $db) {
$root = h(ME) . "db=" . urlencode($db);
echo "\n";
}
echo "</table>\n";
+ echo "<script type='text/javascript'>tableCheck();</script>\n";
echo "<p><input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm("formChecked(this, /db/)", 1) . ">\n"; // 1 - eventStop
echo "<input type='hidden' name='token' value='$token'>\n";
echo "<a href='" . h(ME) . "refresh=1' onclick='eventStop(event);'>" . lang('Refresh') . "</a>\n";
?>
<form action="" method="post">
-<table cellspacing="0" onclick="tableClick(event);" class="nowrap">
+<table cellspacing="0" onclick="tableClick(event);" class="nowrap checkable">
<?php
// HTML valid because there is always at least one process
$i = -1;
}
?>
</table>
+<script type='text/javascript'>tableCheck();</script>
<p>
<?php
if (support("kill")) {
} else {
$backward_keys = $adminer->backwardKeys($TABLE, $table_name);
- echo "<table cellspacing='0' class='nowrap' onclick='tableClick(event);' onkeydown='return editingKeydown(event);'>\n";
+ echo "<table cellspacing='0' class='nowrap checkable' onclick='tableClick(event);' onkeydown='return editingKeydown(event);'>\n";
echo "<thead><tr>" . (!$group && $select ? "" : "<td><input type='checkbox' id='all-page' onclick='formCheck(this, /check/);'> <a href='" . h($_GET["modify"] ? remove_from_uri("modify") : $_SERVER["REQUEST_URI"] . "&modify=1") . "'>" . lang('edit') . "</a>");
$names = array();
$functions = array();
echo "</tr>\n"; // close to allow white-space: pre
}
echo "</table>\n";
+ echo (!$group && $select ? "" : "<script type='text/javascript'>tableCheck();</script>\n");
}
if ($rows || $page) {
img { vertical-align: middle; border: 0; }
td img { max-width: 200px; max-height: 200px; }
code { background: #eee; }
-tr:hover td, tr:hover th { background: #ddf; }
+tbody tr:hover td, tbody tr:hover th { background: #eee; }
pre { margin: 1em 0 0; }
input[type=image] { vertical-align: middle; }
.version { color: #777; font-size: 67%; }
.enum { color: #007F7F; }
.binary { color: red; }
.odd td { background: #F5F5F5; }
+.js .checked td, .js .checked th { background: #ddf; }
.time { color: silver; font-size: 70%; }
.function { text-align: right; }
.number { text-align: right; }
return ((selected.attributes.value || {}).specified ? selected.value : selected.text);
}
+/** Set checked class
+* @param HTMLInputElement
+*/
+function trCheck(el) {
+ var tr = el.parentNode.parentNode;
+ tr.className = tr.className.replace(/(^|\s)checked(\s|$)/, '$2') + (el.checked ? ' checked' : '');
+}
+
/** Check all elements matching given name
* @param HTMLInputElement
* @param RegExp
for (var i=0; i < elems.length; i++) {
if (name.test(elems[i].name)) {
elems[i].checked = el.checked;
+ trCheck(elems[i]);
+ }
+ }
+}
+
+/** Check all rows in <table class="checkable">
+*/
+function tableCheck() {
+ var tables = document.getElementsByTagName('table');
+ for (var i=0; i < tables.length; i++) {
+ if (/(^|\s)checkable(\s|$)/.test(tables[i].className)) {
+ var trs = tables[i].getElementsByTagName('tr');
+ for (var j=0; j < trs.length; j++) {
+ trCheck(trs[j].firstChild.firstChild);
+ }
}
}
}
* @param string
*/
function formUncheck(id) {
- document.getElementById(id).checked = false;
+ var el = document.getElementById(id);
+ el.checked = false;
+ trCheck(el);
}
/** Get number of checked elements matching given name
* @param MouseEvent
*/
function tableClick(event) {
+ var click = true;
var el = event.target || event.srcElement;
while (!/^tr$/i.test(el.tagName)) {
- if (/^(table|a|input|textarea)$/i.test(el.tagName)) {
+ if (/^table$/i.test(el.tagName)) {
return;
}
+ if (/^(a|input|textarea)$/i.test(el.tagName)) {
+ click = false;
+ }
el = el.parentNode;
}
el = el.firstChild.firstChild;
- el.click && el.click();
- el.onclick && el.onclick();
+ if (click) {
+ el.click && el.click();
+ el.onclick && el.onclick();
+ }
+ trCheck(el);
}
/** Set HTML code of an element
Adminer 3.3.3-dev:
+Highlight checked rows
Titles of links in database overview and navigation
Fix trigger export (SQLite)
Default trigger statement (SQLite, PostgreSQL)
if ($_POST["query"] != "") {
search_tables();
}
- echo "<table cellspacing='0' class='nowrap' onclick='tableClick(event);'>\n";
+ echo "<table cellspacing='0' class='nowrap checkable' onclick='tableClick(event);'>\n";
echo '<thead><tr class="wrap"><td><input id="check-all" type="checkbox" onclick="formCheck(this, /^tables\[/);"><th>' . lang('Table') . '<td>' . lang('Rows') . "</thead>\n";
foreach (table_status() as $table => $row) {
$name = $adminer->tableName($row);
}
}
echo "</table>\n";
+ echo "<script type='text/javascript'>tableCheck();</script>\n";
echo "</form>\n";
}