1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-18 12:21:24 +02:00

Display number of manipulated rows in JS confirm

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1133 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana
2009-09-23 12:21:14 +00:00
parent 6168e0b601
commit 06ce6828b1
5 changed files with 20 additions and 11 deletions

View File

@@ -8,15 +8,13 @@ if ($tables_views && !$error) {
queries("SET foreign_key_checks = 0"); // allows to truncate or drop several tables at once
}
if (isset($_POST["truncate"])) {
if ($_POST["tables"]) {
foreach ($_POST["tables"] as $table) {
if (!queries("TRUNCATE " . idf_escape($table))) {
$result = false;
break;
}
foreach ((array) $_POST["tables"] as $table) {
if (!queries("TRUNCATE " . idf_escape($table))) {
$result = false;
break;
}
$message = lang('Tables have been truncated.');
}
$message = lang('Tables have been truncated.');
} elseif (isset($_POST["move"])) {
$rename = array();
foreach ($tables_views as $table) {
@@ -66,7 +64,7 @@ if (!$table_status) {
}
}
echo "</table>\n";
echo "<p><input type='hidden' name='token' value='$token'><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> <input type='submit' name='drop' value='" . lang('Drop') . "'$confirm>\n";
echo "<p><input type='hidden' name='token' value='$token'><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') . "' onclick=\"return confirm('" . lang('Are you sure?') . " (' + form_checked(this, /tables/) + ')');\"> <input type='submit' name='drop' value='" . lang('Drop') . "' onclick=\"return confirm('" . lang('Are you sure?') . " (' + form_checked(this, /tables|views/) + ')');\">\n";
$dbs = get_databases();
if (count($dbs) != 1) {
$db = (isset($_POST["target"]) ? $_POST["target"] : DB);

View File

@@ -280,7 +280,7 @@ if (!$columns) {
}
echo " (" . lang('%d row(s)', $found_rows) . ') <label><input type="checkbox" name="all" value="1">' . lang('whole result') . "</label>\n";
echo (information_schema(DB) ? "" : "<fieldset><legend>" . lang('Edit') . "</legend><div><input type='submit' name='edit' value='" . lang('Edit') . "'> <input type='submit' name='clone' value='" . lang('Clone') . "'> <input type='submit' name='delete' value='" . lang('Delete') . "'$confirm></div></fieldset>\n");
echo (information_schema(DB) ? "" : "<fieldset><legend>" . lang('Edit') . "</legend><div><input type='submit' name='edit' value='" . lang('Edit') . "'> <input type='submit' name='clone' value='" . lang('Clone') . "'> <input type='submit' name='delete' value='" . lang('Delete') . "' onclick=\"return confirm('" . lang('Are you sure?') . " (' + (this.form['all'].checked ? $found_rows : form_checked(this, /check/)) + ')');\"></div></fieldset>\n");
print_fieldset("export", lang('Export'));
echo "$dump_output $dump_format $dump_compress <input type='submit' name='export' value='" . lang('Export') . "'>\n";
echo "</div></fieldset>\n";

View File

@@ -26,6 +26,17 @@ function form_uncheck(id) {
document.getElementById(id).checked = false;
}
function form_checked(el, name) {
var checked = 0;
var elems = el.form.elements;
for (var i=0; i < elems.length; i++) {
if (name.test(elems[i].name) && elems[i].checked) {
checked++;
}
}
return checked;
}
function table_click(event) {
var el = event.target || event.srcElement;
while (!/^tr$/i.test(el.tagName)) {