[adminer-svn] SF.net SVN: adminer:[1273] trunk
Database management in a single PHP file
Brought to you by:
jakubvrana
From: <jak...@us...> - 2009-12-17 13:22:38
|
Revision: 1273 http://adminer.svn.sourceforge.net/adminer/?rev=1273&view=rev Author: jakubvrana Date: 2009-12-17 13:22:28 +0000 (Thu, 17 Dec 2009) Log Message: ----------- Use camelCase in JavaScript Modified Paths: -------------- trunk/adminer/create.inc.php trunk/adminer/db.inc.php trunk/adminer/dump.inc.php trunk/adminer/foreign.inc.php trunk/adminer/include/adminer.inc.php trunk/adminer/include/connect.inc.php trunk/adminer/include/design.inc.php trunk/adminer/include/editing.inc.php trunk/adminer/indexes.inc.php trunk/adminer/processlist.inc.php trunk/adminer/schema.inc.php trunk/adminer/select.inc.php trunk/adminer/static/editing.js trunk/adminer/static/functions.js trunk/adminer/trigger.inc.php trunk/adminer/user.inc.php trunk/editor/include/adminer.inc.php trunk/editor/static/editing.js trunk/tests/2-create-table.html trunk/tests/4-create-table-2.html Modified: trunk/adminer/create.inc.php =================================================================== --- trunk/adminer/create.inc.php 2009-12-17 12:54:17 UTC (rev 1272) +++ trunk/adminer/create.inc.php 2009-12-17 13:22:28 UTC (rev 1273) @@ -165,8 +165,8 @@ <?php echo lang('Auto Increment'); ?>: <input name="auto_increment" size="6" value="<?php echo h($row["auto_increment"]); // don't prefill by original Auto_increment for the sake of performance and not reusing deleted ids ?>"> <?php echo lang('Comment'); ?>: <input name="Comment" value="<?php echo h($row["Comment"]); ?>" maxlength="60"> <script type="text/javascript"> -document.write('<label><input type="checkbox" onclick="column_show(this.checked, 5);"><?php echo lang('Default values'); ?><\/label>'); -document.write('<label><input type="checkbox"<?php if ($column_comments) { ?> checked<?php } ?> onclick="column_show(this.checked, 6);"><?php echo lang('Show column comments'); ?><\/label>'); +document.write('<label><input type="checkbox" onclick="columnShow(this.checked, 5);"><?php echo lang('Default values'); ?><\/label>'); +document.write('<label><input type="checkbox"<?php if ($column_comments) { ?> checked<?php } ?> onclick="columnShow(this.checked, 6);"><?php echo lang('Show column comments'); ?><\/label>'); </script> <p> <input type="hidden" name="token" value="<?php echo $token; ?>"> @@ -177,7 +177,7 @@ ?> <fieldset><legend><?php echo lang('Partition by'); ?></legend> <p> -<?php echo html_select("partition_by", array(-1 => "") + $partition_by, $row["partition_by"], "partition_by_change(this);"); ?> +<?php echo html_select("partition_by", array(-1 => "") + $partition_by, $row["partition_by"], "partitionByChange(this);"); ?> (<input name="partition" value="<?php echo h($row["partition"]); ?>">) <?php echo lang('Partitions'); ?>: <input name="partitions" size="2" value="<?php echo h($row["partitions"]); ?>"<?php echo ($partition_table || !$row["partition_by"] ? " class='hidden'" : ""); ?>> <table cellspacing="0" id="partition-table"<?php echo ($partition_table ? "" : " class='hidden'"); ?>> @@ -185,7 +185,7 @@ <?php foreach ($row["partition_names"] as $key => $val) { echo '<tr>'; - echo '<td><input name="partition_names[]" value="' . h($val) . '"' . ($key == count($row["partition_names"]) - 1 ? ' onchange="partition_name_change(this);"' : '') . '>'; + echo '<td><input name="partition_names[]" value="' . h($val) . '"' . ($key == count($row["partition_names"]) - 1 ? ' onchange="partitionNameChange(this);"' : '') . '>'; echo '<td><input name="partition_values[]" value="' . h($row["partition_values"][$key]) . '">'; } ?> Modified: trunk/adminer/db.inc.php =================================================================== --- trunk/adminer/db.inc.php 2009-12-17 12:54:17 UTC (rev 1272) +++ trunk/adminer/db.inc.php 2009-12-17 13:22:28 UTC (rev 1273) @@ -47,11 +47,11 @@ echo "<p class='message'>" . lang('No tables.') . "\n"; } else { echo "<form action='' method='post'>\n"; - echo "<table cellspacing='0' class='nowrap' onclick='table_click(event);'>\n"; - echo '<thead><tr class="wrap"><td><input id="check-all" type="checkbox" onclick="form_check(this, /^(tables|views)\[/);" title="' . count($table_status) . '"><th>' . lang('Table') . '<td>' . lang('Engine') . '<td>' . lang('Collation') . '<td>' . lang('Data Length') . '<td>' . lang('Index Length') . '<td>' . lang('Data Free') . '<td>' . lang('Auto Increment') . '<td>' . lang('Rows') . '<td>' . lang('Comment') . "</thead>\n"; + echo "<table cellspacing='0' class='nowrap' onclick='tableClick(event);'>\n"; + echo '<thead><tr class="wrap"><td><input id="check-all" type="checkbox" onclick="formCheck(this, /^(tables|views)\[/);" title="' . count($table_status) . '"><th>' . lang('Table') . '<td>' . lang('Engine') . '<td>' . lang('Collation') . '<td>' . lang('Data Length') . '<td>' . lang('Index Length') . '<td>' . lang('Data Free') . '<td>' . lang('Auto Increment') . '<td>' . lang('Rows') . '<td>' . lang('Comment') . "</thead>\n"; foreach ($table_status as $row) { $name = $row["Name"]; - echo '<tr' . odd() . '><td>' . checkbox((isset($row["Rows"]) ? "tables[]" : "views[]"), $name, in_array($name, $tables_views, true), "", "form_uncheck('check-all');"); + echo '<tr' . odd() . '><td>' . checkbox((isset($row["Rows"]) ? "tables[]" : "views[]"), $name, in_array($name, $tables_views, true), "", "formUncheck('check-all');"); echo '<th><a href="' . h(ME) . 'table=' . urlencode($name) . '">' . h($name) . '</a>'; if (isset($row["Rows"])) { echo "<td>$row[Engine]<td>$row[Collation]"; @@ -67,7 +67,7 @@ } } 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') . "' 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"; + 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?') . " (' + formChecked(this, /tables/) + ')');\"> <input type='submit' name='drop' value='" . lang('Drop') . "' onclick=\"return confirm('" . lang('Are you sure?') . " (' + formChecked(this, /tables|views/) + ')');\">\n"; $dbs = get_databases(); if (count($dbs) != 1) { $db = (isset($_POST["target"]) ? $_POST["target"] : DB); Modified: trunk/adminer/dump.inc.php =================================================================== --- trunk/adminer/dump.inc.php 2009-12-17 12:54:17 UTC (rev 1272) +++ trunk/adminer/dump.inc.php 2009-12-17 13:22:28 UTC (rev 1273) @@ -168,25 +168,25 @@ if (strlen(DB)) { $checked = (strlen($TABLE) ? "" : " checked"); echo "<thead><tr>"; - echo "<th style='text-align: left;'><label><input type='checkbox' id='check-tables'$checked onclick='form_check(this, /^tables\\[/);'>" . lang('Tables') . "</label>"; - echo "<th style='text-align: right;'><label>" . lang('Data') . "<input type='checkbox' id='check-data'$checked onclick='form_check(this, /^data\\[/);'></label>"; + echo "<th style='text-align: left;'><label><input type='checkbox' id='check-tables'$checked onclick='formCheck(this, /^tables\\[/);'>" . lang('Tables') . "</label>"; + echo "<th style='text-align: right;'><label>" . lang('Data') . "<input type='checkbox' id='check-data'$checked onclick='formCheck(this, /^data\\[/);'></label>"; echo "</thead>\n"; $views = ""; foreach (table_status() as $row) { $checked = !strlen($TABLE) || $row["Name"] == $TABLE; - $print = "<tr><td>" . checkbox("tables[]", $row["Name"], $checked, $row["Name"], "form_uncheck('check-tables');"); + $print = "<tr><td>" . checkbox("tables[]", $row["Name"], $checked, $row["Name"], "formUncheck('check-tables');"); if (!$row["Engine"]) { $views .= "$print\n"; } else { - echo "$print<td align='right'><label>" . ($row["Engine"] == "InnoDB" && $row["Rows"] ? lang('~ %s', $row["Rows"]) : $row["Rows"]) . checkbox("data[]", $row["Name"], $checked, "", "form_uncheck('check-data');") . "</label>\n"; + echo "$print<td align='right'><label>" . ($row["Engine"] == "InnoDB" && $row["Rows"] ? lang('~ %s', $row["Rows"]) : $row["Rows"]) . checkbox("data[]", $row["Name"], $checked, "", "formUncheck('check-data');") . "</label>\n"; } } echo $views; } else { - echo "<thead><tr><th style='text-align: left;'><label><input type='checkbox' id='check-databases' checked onclick='form_check(this, /^databases\\[/);'>" . lang('Database') . "</label></thead>\n"; + echo "<thead><tr><th style='text-align: left;'><label><input type='checkbox' id='check-databases' checked onclick='formCheck(this, /^databases\\[/);'>" . lang('Database') . "</label></thead>\n"; foreach (get_databases() as $db) { if (!information_schema($db)) { - echo "<tr><td>" . checkbox("databases[]", $db, 1, $db, "form_uncheck('check-databases');") . "</label>\n"; + echo "<tr><td>" . checkbox("databases[]", $db, 1, $db, "formUncheck('check-databases');") . "</label>\n"; } } } Modified: trunk/adminer/foreign.inc.php =================================================================== --- trunk/adminer/foreign.inc.php 2009-12-17 12:54:17 UTC (rev 1272) +++ trunk/adminer/foreign.inc.php 2009-12-17 13:22:28 UTC (rev 1273) @@ -55,7 +55,7 @@ $j = 0; foreach ($row["source"] as $key => $val) { echo "<tr>"; - echo "<td>" . html_select("source[" . intval($key) . "]", array(-1 => "") + $source, $val, ($j == count($row["source"]) - 1 ? "foreign_add_row(this);" : 1)); + echo "<td>" . html_select("source[" . intval($key) . "]", array(-1 => "") + $source, $val, ($j == count($row["source"]) - 1 ? "foreignAddRow(this);" : 1)); echo "<td>" . html_select("target[" . intval($key) . "]", $target, $row["target"][$key]); $j++; } Modified: trunk/adminer/include/adminer.inc.php =================================================================== --- trunk/adminer/include/adminer.inc.php 2009-12-17 12:54:17 UTC (rev 1272) +++ trunk/adminer/include/adminer.inc.php 2009-12-17 13:22:28 UTC (rev 1273) @@ -169,7 +169,7 @@ $i++; } echo "<div>" . html_select("columns[$i][fun]", array(-1 => "") + $fun_group, "", "this.nextSibling.onchange();"); - echo "<select name='columns[$i][col]' onchange='select_add_row(this);'><option>" . optionlist($columns, null, true) . "</select></div>\n"; + echo "<select name='columns[$i][col]' onchange='selectAddRow(this);'><option>" . optionlist($columns, null, true) . "</select></div>\n"; echo "</div></fieldset>\n"; } @@ -198,7 +198,7 @@ $i++; } } - echo "<div><select name='where[$i][col]' onchange='select_add_row(this);'><option value=''>" . lang('(anywhere)') . optionlist($columns, null, true) . "</select>"; + echo "<div><select name='where[$i][col]' onchange='selectAddRow(this);'><option value=''>" . lang('(anywhere)') . optionlist($columns, null, true) . "</select>"; echo html_select("where[$i][op]", $this->operators); echo "<input name='where[$i][val]'></div>\n"; echo "</div></fieldset>\n"; @@ -220,7 +220,7 @@ $i++; } } - echo "<div><select name='order[$i]' onchange='select_add_row(this);'><option>" . optionlist($columns, null, true) . "</select>"; + echo "<div><select name='order[$i]' onchange='selectAddRow(this);'><option>" . optionlist($columns, null, true) . "</select>"; echo checkbox("desc[$i]", 1, 0, lang('descending')) . "</div>\n"; echo "</div></fieldset>\n"; } Modified: trunk/adminer/include/connect.inc.php =================================================================== --- trunk/adminer/include/connect.inc.php 2009-12-17 12:54:17 UTC (rev 1272) +++ trunk/adminer/include/connect.inc.php 2009-12-17 13:22:28 UTC (rev 1273) @@ -30,7 +30,7 @@ if ($databases) { $collations = collations(); echo "<form action='' method='post'>\n"; - echo "<table cellspacing='0' onclick='table_click(event);'>\n"; + echo "<table cellspacing='0' onclick='tableClick(event);'>\n"; echo "<thead><tr><td><input type='hidden' name='token' value='$token'> <th>" . lang('Database') . "<td>" . lang('Collation') . "</thead>\n"; foreach ($databases as $db) { $root = h(ME) . "db=" . urlencode($db); @@ -40,7 +40,7 @@ echo "\n"; } echo "</table>\n"; - echo "<p><input type='submit' name='drop' value='" . lang('Drop') . "' onclick=\"return confirm('" . lang('Are you sure?') . " (' + form_checked(this, /db/) + ')');\">\n"; + echo "<p><input type='submit' name='drop' value='" . lang('Drop') . "' onclick=\"return confirm('" . lang('Are you sure?') . " (' + formChecked(this, /db/) + ')');\">\n"; echo "</form>\n"; } } Modified: trunk/adminer/include/design.inc.php =================================================================== --- trunk/adminer/include/design.inc.php 2009-12-17 12:54:17 UTC (rev 1272) +++ trunk/adminer/include/design.inc.php 2009-12-17 13:22:28 UTC (rev 1273) @@ -17,7 +17,7 @@ <link rel="stylesheet" type="text/css" href="adminer.css"> <?php } ?> -<body onload="body_load(<?php echo substr($connection->server_info, 0, 3); ?>);<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " verify_version();"); ?>"> +<body onload="bodyLoad(<?php echo substr($connection->server_info, 0, 3); ?>);<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " verifyVersion();"); ?>"> <script type="text/javascript" src="../adminer/static/functions.js"></script> <script type="text/javascript" src="static/editing.js"></script> Modified: trunk/adminer/include/editing.inc.php =================================================================== --- trunk/adminer/include/editing.inc.php 2009-12-17 12:54:17 UTC (rev 1272) +++ trunk/adminer/include/editing.inc.php 2009-12-17 13:22:28 UTC (rev 1273) @@ -108,8 +108,8 @@ function edit_type($key, $field, $collations, $foreign_keys = array()) { global $structured_types, $unsigned, $inout; ?> -<td><select name="<?php echo $key; ?>[type]" class="type" onfocus="last_type = select_value(this);" onchange="editing_type_change(this);"><?php echo optionlist($structured_types + ($foreign_keys ? array(lang('Foreign keys') => $foreign_keys) : array()), $field["type"]); ?></select> -<td><input name="<?php echo $key; ?>[length]" value="<?php echo h($field["length"]); ?>" size="3" onfocus="editing_length_focus(this);"> +<td><select name="<?php echo $key; ?>[type]" class="type" onfocus="lastType = selectValue(this);" onchange="editingTypeChange(this);"><?php echo optionlist($structured_types + ($foreign_keys ? array(lang('Foreign keys') => $foreign_keys) : array()), $field["type"]); ?></select> +<td><input name="<?php echo $key; ?>[length]" value="<?php echo h($field["length"]); ?>" size="3" onfocus="editingLengthFocus(this);"> <td><?php echo "<select name='$key" . "[collation]'" . (ereg('(char|text|enum|set)$', $field["type"]) ? "" : " class='hidden'") . '><option value="">(' . lang('collation') . ')' . optionlist($collations, $field["collation"]) . '</select>'; echo ($unsigned ? " <select name='$key" . "[unsigned]'" . (!$field["type"] || ereg('(int|float|double|decimal)$', $field["type"]) ? "" : " class='hidden'") . '><option>' . optionlist($unsigned, $field["unsigned"]) . '</select>' : ''); @@ -191,7 +191,7 @@ <thead><tr> <?php if ($type == "PROCEDURE") { ?><td> <?php } ?> <th><?php echo ($type == "TABLE" ? lang('Column name') : lang('Parameter name')); ?> -<td><?php echo lang('Type'); ?><textarea id="enum-edit" rows="4" cols="10" style="display: none;" onblur="editing_length_blur(this);"></textarea> +<td><?php echo lang('Type'); ?><textarea id="enum-edit" rows="4" cols="10" style="display: none;" onblur="editingLengthBlur(this);"></textarea> <td><?php echo lang('Length'); ?> <td><?php echo lang('Options'); ?> <?php if ($type == "TABLE") { ?> @@ -213,7 +213,7 @@ echo "<td>" . html_select("fields[$i][inout]", $inout, $field["inout"]); } ?> -<th><?php if ($display) { ?><input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" onchange="<?php echo (strlen($field["field"]) || count($fields) > 1 ? "" : "editing_add_row(this, $allowed); "); ?>editing_name_change(this);" maxlength="64"><?php } ?><input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo h($field[($_POST ? "orig" : "field")]); ?>"> +<th><?php if ($display) { ?><input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" onchange="<?php echo (strlen($field["field"]) || count($fields) > 1 ? "" : "editingAddRow(this, $allowed); "); ?>editingNameChange(this);" maxlength="64"><?php } ?><input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo h($field[($_POST ? "orig" : "field")]); ?>"> <?php edit_type("fields[$i]", $field, $collations, $foreign_keys); ?> <?php if ($type == "TABLE") { ?> <td><?php echo checkbox("fields[$i][null]", 1, $field["null"]); ?> @@ -222,8 +222,8 @@ <td<?php echo ($column_comments ? "" : " class='hidden'"); ?>><input name="fields[<?php echo $i; ?>][comment]" value="<?php echo h($field["comment"]); ?>" maxlength="255"> <?php } ?> <?php - echo "<td class='nowrap'><input type='image' name='add[$i]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "' onclick='return !editing_add_row(this, $allowed, 1);'>"; - echo " <input type='image' name='drop_col[$i]' src='../adminer/static/cross.gif' alt='x' title='" . lang('Remove') . "' onclick='return !editing_remove_row(this);'>"; + echo "<td class='nowrap'><input type='image' name='add[$i]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "' onclick='return !editingAddRow(this, $allowed, 1);'>"; + echo " <input type='image' name='drop_col[$i]' src='../adminer/static/cross.gif' alt='x' title='" . lang('Remove') . "' onclick='return !editingRemoveRow(this);'>"; echo " <input type='image' name='up[$i]' src='../adminer/static/up.gif' alt='^' title='" . lang('Move up') . "'>"; echo " <input type='image' name='down[$i]' src='../adminer/static/down.gif' alt='v' title='" . lang('Move down') . "'>"; echo "\n"; Modified: trunk/adminer/indexes.inc.php =================================================================== --- trunk/adminer/indexes.inc.php 2009-12-17 12:54:17 UTC (rev 1272) +++ trunk/adminer/indexes.inc.php 2009-12-17 13:22:28 UTC (rev 1273) @@ -73,10 +73,10 @@ <?php $j = 0; foreach ($row["indexes"] as $index) { - echo "<tr><td>" . html_select("indexes[$j][type]", array(-1 => "") + $index_types, $index["type"], ($j == count($row["indexes"]) - 1 ? "indexes_add_row(this);" : 1)) . "<td>\n"; + echo "<tr><td>" . html_select("indexes[$j][type]", array(-1 => "") + $index_types, $index["type"], ($j == count($row["indexes"]) - 1 ? "indexesAddRow(this);" : 1)) . "<td>\n"; ksort($index["columns"]); foreach ($index["columns"] as $i => $column) { - echo "<span>" . html_select("indexes[$j][columns][$i]", array(-1 => "") + $fields, $column, ($i == count($index["columns"]) ? "indexes_add_column(this);" : 1)); + echo "<span>" . html_select("indexes[$j][columns][$i]", array(-1 => "") + $fields, $column, ($i == count($index["columns"]) ? "indexesAddColumn(this);" : 1)); echo "<input name='indexes[$j][lengths][$i]' size='2' value='" . h($index["lengths"][$i]) . "'> </span>\n"; } echo "\n"; Modified: trunk/adminer/processlist.inc.php =================================================================== --- trunk/adminer/processlist.inc.php 2009-12-17 12:54:17 UTC (rev 1272) +++ trunk/adminer/processlist.inc.php 2009-12-17 13:22:28 UTC (rev 1273) @@ -13,7 +13,7 @@ ?> <form action="" method="post"> -<table cellspacing="0" onclick="table_click(event);"> +<table cellspacing="0" onclick="tableClick(event);"> <?php $result = $connection->query("SHOW PROCESSLIST"); for ($i=0; $row = $result->fetch_assoc(); $i++) { Modified: trunk/adminer/schema.inc.php =================================================================== --- trunk/adminer/schema.inc.php 2009-12-17 12:54:17 UTC (rev 1272) +++ trunk/adminer/schema.inc.php 2009-12-17 13:22:28 UTC (rev 1273) @@ -54,12 +54,12 @@ <script type="text/javascript"> table_pos = {<?php echo implode(",", $table_pos_js) . "\n"; ?>}; em = document.getElementById('schema').offsetHeight / <?php echo $top; ?>; -document.onmousemove = schema_mousemove; -document.onmouseup = schema_mouseup; +document.onmousemove = schemaMousemove; +document.onmouseup = schemaMouseup; </script> <?php foreach ($schema as $name => $table) { - echo "<div class='table' style='top: " . $table["pos"][0] . "em; left: " . $table["pos"][1] . "em;' onmousedown='schema_mousedown(this, event);'>"; + echo "<div class='table' style='top: " . $table["pos"][0] . "em; left: " . $table["pos"][1] . "em;' onmousedown='schemaMousedown(this, event);'>"; echo '<a href="' . h(ME) . 'table=' . urlencode($name) . '"><strong>' . h($name) . "</strong></a><br>\n"; foreach ($table["fields"] as $field) { $val = '<span' . type_class($field["type"]) . ' title="' . h($field["full_type"] . ($field["null"] ? " NULL" : '')) . '">' . h($field["field"]) . '</span>'; Modified: trunk/adminer/select.inc.php =================================================================== --- trunk/adminer/select.inc.php 2009-12-17 12:54:17 UTC (rev 1272) +++ trunk/adminer/select.inc.php 2009-12-17 13:22:28 UTC (rev 1273) @@ -184,8 +184,8 @@ $backward_keys = $adminer->backwardKeys($TABLE, $table_name); - echo "<table cellspacing='0' class='nowrap' onclick='table_click(event);'>\n"; - echo "<thead><tr><td><input type='checkbox' id='all-page' onclick='form_check(this, /check/);'>"; + echo "<table cellspacing='0' class='nowrap' onclick='tableClick(event);'>\n"; + echo "<thead><tr><td><input type='checkbox' id='all-page' onclick='formCheck(this, /check/);'>"; $names = array(); reset($select); $order = 1; @@ -203,7 +203,7 @@ echo ($backward_keys ? "<th>" . lang('Relations') : "") . "</thead>\n"; foreach ($adminer->rowDescriptions($rows, $foreign_keys) as $n => $row) { $unique_idf = implode('&', unique_idf($rows[$n], $indexes)); - echo "<tr" . odd() . "><td>" . checkbox("check[]", $unique_idf, in_array($unique_idf, (array) $_POST["check"]), "", "this.form['all'].checked = false; form_uncheck('all-page');") . (count($select) != count($group) || information_schema(DB) ? '' : " <a href='" . h(ME . "edit=" . urlencode($TABLE) . "&$unique_idf") . "'>" . lang('edit') . "</a>"); + echo "<tr" . odd() . "><td>" . checkbox("check[]", $unique_idf, in_array($unique_idf, (array) $_POST["check"]), "", "this.form['all'].checked = false; formUncheck('all-page');") . (count($select) != count($group) || information_schema(DB) ? '' : " <a href='" . h(ME . "edit=" . urlencode($TABLE) . "&$unique_idf") . "'>" . lang('edit') . "</a>"); foreach ($row as $key => $val) { if (isset($names[$key])) { $field = $fields[$key]; @@ -271,7 +271,7 @@ } echo " (" . lang('%d row(s)', $found_rows) . ") " . checkbox("all", 1, 0, lang('whole result')) . "\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"); + 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 : formChecked(this, /check/)) + ')');\"></div></fieldset>\n"); print_fieldset("export", lang('Export')); echo $adminer->dumpOutput(1) . " " . $adminer->dumpFormat(1); // 1 - select echo " <input type='submit' name='export' value='" . lang('Export') . "'>\n"; Modified: trunk/adminer/static/editing.js =================================================================== --- trunk/adminer/static/editing.js 2009-12-17 12:54:17 UTC (rev 1272) +++ trunk/adminer/static/editing.js 2009-12-17 13:22:28 UTC (rev 1273) @@ -1,15 +1,15 @@ // Adminer specific functions -function body_load(version) { - var jush_root = '../externals/jush/'; +function bodyLoad(version) { + var jushRoot = '../externals/jush/'; var script = document.createElement('script'); - script.src = jush_root + 'jush.js'; + script.src = jushRoot + 'jush.js'; script.onload = function () { if (window.jush) { // IE runs in case of an error too jush.create_links = ' target="_blank"'; jush.urls.sql[0] = 'http://dev.mysql.com/doc/refman/' + version + '/en/$key'; jush.urls.sql[0] = jush.urls.sql[0]; - jush.style(jush_root + 'jush.css'); + jush.style(jushRoot + 'jush.css'); jush.highlight_tag('pre', 0); jush.highlight_tag('code'); } @@ -24,11 +24,11 @@ -function select_value(select) { +function selectValue(select) { return select.options[select.selectedIndex].text; } -function form_field(form, name) { +function formField(form, name) { for (var i=0; i < form.length; i++) { if (form[i].name == name) { return form[i]; @@ -36,7 +36,7 @@ } } -function type_password(el, disable) { +function typePassword(el, disable) { try { el.type = (disable ? 'text' : 'password'); } catch (e) { @@ -45,21 +45,21 @@ -var added = '.', row_count; +var added = '.', rowCount; -function re_escape(s) { +function reEscape(s) { return s.replace(/[\[\]\\^$*+?.(){|}]/, '\\$&'); } -function idf_escape(s) { +function idfEscape(s) { return '`' + s.replace(/`/, '``') + '`'; } -function editing_name_change(field) { +function editingNameChange(field) { var name = field.name.substr(0, field.name.length - 7); - var type = form_field(field.form, name + '[type]'); + var type = formField(field.form, name + '[type]'); var opts = type.options; - var table = re_escape(field.value); + var table = reEscape(field.value); var column = ''; var match; if ((match = /(.+)_(.+)/.exec(table)) || (match = /(.*[a-z])([A-Z].*)/.exec(table))) { // limited to single word columns @@ -67,11 +67,11 @@ column = match[2]; } var plural = '(?:e?s)?'; - var tab_col = table + plural + '_?' + column; - var re = new RegExp('(^' + idf_escape(table + plural) + '\\.' + idf_escape(column) + '$' // table_column - + '|^' + idf_escape(tab_col) + '\\.' // table - + '|^' + idf_escape(column + plural) + '\\.' + idf_escape(table) + '$' // column_table - + ')|\\.' + idf_escape(tab_col) + '$' // column + var tabCol = table + plural + '_?' + column; + var re = new RegExp('(^' + idfEscape(table + plural) + '\\.' + idfEscape(column) + '$' // table_column + + '|^' + idfEscape(tabCol) + '\\.' // table + + '|^' + idfEscape(column + plural) + '\\.' + idfEscape(table) + '$' // column_table + + ')|\\.' + idfEscape(tabCol) + '$' // column , 'i'); var candidate; // don't select anything with ambiguous match (like column `id`) for (var i = opts.length; i--; ) { @@ -94,8 +94,8 @@ } } -function editing_add_row(button, allowed, focus) { - if (allowed && row_count >= allowed) { +function editingAddRow(button, allowed, focus) { + if (allowed && rowCount >= allowed) { return false; } var match = /([0-9]+)(\.[0-9]+)?/.exec(button.name); @@ -125,36 +125,36 @@ } } tags[0].onchange = function () { - editing_name_change(tags[0]); + editingNameChange(tags[0]); }; row.parentNode.insertBefore(row2, row.nextSibling); if (focus) { input.onchange = function () { - editing_name_change(input); + editingNameChange(input); }; input.focus(); } added += '0'; - row_count++; + rowCount++; return true; } -function editing_remove_row(button) { - var field = form_field(button.form, button.name.replace(/drop_col(.+)/, 'fields$1[field]')); +function editingRemoveRow(button) { + var field = formField(button.form, button.name.replace(/drop_col(.+)/, 'fields$1[field]')); field.parentNode.removeChild(field); button.parentNode.parentNode.style.display = 'none'; return true; } -var last_type = ''; -function editing_type_change(type) { +var lastType = ''; +function editingTypeChange(type) { var name = type.name.substr(0, type.name.length - 6); - var text = select_value(type); + var text = selectValue(type); for (var i=0; i < type.form.elements.length; i++) { var el = type.form.elements[i]; if (el.name == name + '[length]' && !( - (/(char|binary)$/.test(last_type) && /(char|binary)$/.test(text)) - || (/(enum|set)$/.test(last_type) && /(enum|set)$/.test(text)) + (/(char|binary)$/.test(lastType) && /(char|binary)$/.test(text)) + || (/(enum|set)$/.test(lastType) && /(enum|set)$/.test(text)) )) { el.value = ''; } @@ -167,9 +167,9 @@ } } -function editing_length_focus(field) { +function editingLengthFocus(field) { var td = field.parentNode; - if (/enum|set/.test(select_value(td.previousSibling.firstChild))) { + if (/enum|set/.test(selectValue(td.previousSibling.firstChild))) { var edit = document.getElementById('enum-edit'); var val = field.value; edit.value = (/^'.+','.+'$/.test(val) ? val.substr(1, val.length - 2).replace(/','/g, "\n").replace(/''/g, "'") : val); @@ -180,7 +180,7 @@ } } -function editing_length_blur(edit) { +function editingLengthBlur(edit) { var field = edit.parentNode.firstChild; var val = edit.value; field.value = (/\n/.test(val) ? "'" + val.replace(/\n+$/, '').replace(/'/g, "''").replace(/\n/g, "','") + "'" : val); @@ -188,20 +188,20 @@ edit.style.display = 'none'; } -function column_show(checked, column) { +function columnShow(checked, column) { var trs = document.getElementById('edit-fields').getElementsByTagName('tr'); for (var i=0; i < trs.length; i++) { trs[i].getElementsByTagName('td')[column].className = (checked ? 'nowrap' : 'hidden'); } } -function partition_by_change(el) { - var partition_table = /RANGE|LIST/.test(select_value(el)); - el.form['partitions'].className = (partition_table || !el.selectedIndex ? 'hidden' : ''); - document.getElementById('partition-table').className = (partition_table ? '' : 'hidden'); +function partitionByChange(el) { + var partitionTable = /RANGE|LIST/.test(selectValue(el)); + el.form['partitions'].className = (partitionTable || !el.selectedIndex ? 'hidden' : ''); + document.getElementById('partition-table').className = (partitionTable ? '' : 'hidden'); } -function partition_name_change(el) { +function partitionNameChange(el) { var row = el.parentNode.parentNode.cloneNode(true); row.firstChild.firstChild.value = ''; el.parentNode.parentNode.parentNode.appendChild(row); @@ -210,7 +210,7 @@ -function foreign_add_row(field) { +function foreignAddRow(field) { var row = field.parentNode.parentNode.cloneNode(true); var selects = row.getElementsByTagName('select'); for (var i=0; i < selects.length; i++) { @@ -223,7 +223,7 @@ -function indexes_add_row(field) { +function indexesAddRow(field) { var row = field.parentNode.parentNode.cloneNode(true); var spans = row.getElementsByTagName('span'); for (var i=0; i < spans.length - 1; i++) { @@ -241,7 +241,7 @@ field.onchange = function () { }; } -function indexes_add_column(field) { +function indexesAddColumn(field) { var column = field.parentNode.cloneNode(true); var select = column.getElementsByTagName('select')[0]; select.name = select.name.replace(/\]\[[0-9]+/, '$&1'); @@ -255,27 +255,27 @@ -var that, x, y, em, table_pos; +var that, x, y, em, tablePos; -function schema_mousedown(el, event) { +function schemaMousedown(el, event) { that = el; x = event.clientX - el.offsetLeft; y = event.clientY - el.offsetTop; } -function schema_mousemove(ev) { +function schemaMousemove(ev) { if (that !== undefined) { ev = ev || event; var left = (ev.clientX - x) / em; var top = (ev.clientY - y) / em; var divs = that.getElementsByTagName('div'); - var line_set = { }; + var lineSet = { }; for (var i=0; i < divs.length; i++) { if (divs[i].className == 'references') { var div2 = document.getElementById((divs[i].id.substr(0, 4) == 'refs' ? 'refd' : 'refs') + divs[i].id.substr(4)); - var ref = (table_pos[divs[i].title] ? table_pos[divs[i].title] : [ div2.parentNode.offsetTop / em, 0 ]); + var ref = (tablePos[divs[i].title] ? tablePos[divs[i].title] : [ div2.parentNode.offsetTop / em, 0 ]); var left1 = -1; - var is_top = true; + var isTop = true; var id = divs[i].id.replace(/^ref.(.+)-.+/, '$1'); if (divs[i].parentNode != div2.parentNode) { left1 = Math.min(0, ref[1] - left) - 1; @@ -284,20 +284,20 @@ var left2 = Math.min(0, left - ref[1]) - 1; div2.style.left = left2 + 'em'; div2.getElementsByTagName('div')[0].style.width = -left2 + 'em'; - is_top = (div2.offsetTop + ref[0] * em > divs[i].offsetTop + top * em); + isTop = (div2.offsetTop + ref[0] * em > divs[i].offsetTop + top * em); } - if (!line_set[id]) { + if (!lineSet[id]) { var line = document.getElementById(divs[i].id.replace(/^....(.+)-[0-9]+$/, 'refl$1')); var shift = ev.clientY - y - that.offsetTop; line.style.left = (left + left1) + 'em'; - if (is_top) { + if (isTop) { line.style.top = (line.offsetTop + shift) / em + 'em'; } if (divs[i].parentNode != div2.parentNode) { line = line.getElementsByTagName('div')[0]; - line.style.height = (line.offsetHeight + (is_top ? -1 : 1) * shift) / em + 'em'; + line.style.height = (line.offsetHeight + (isTop ? -1 : 1) * shift) / em + 'em'; } - line_set[id] = true; + lineSet[id] = true; } } } @@ -306,16 +306,16 @@ } } -function schema_mouseup(ev) { +function schemaMouseup(ev) { if (that !== undefined) { ev = ev || event; - table_pos[that.firstChild.firstChild.firstChild.data] = [ (ev.clientY - y) / em, (ev.clientX - x) / em ]; + tablePos[that.firstChild.firstChild.firstChild.data] = [ (ev.clientY - y) / em, (ev.clientX - x) / em ]; that = undefined; var date = new Date(); date.setMonth(date.getMonth() + 1); var s = ''; - for (var key in table_pos) { - s += '_' + key + ':' + Math.round(table_pos[key][0] * 10000) / 10000 + 'x' + Math.round(table_pos[key][1] * 10000) / 10000; + for (var key in tablePos) { + s += '_' + key + ':' + Math.round(tablePos[key][0] * 10000) / 10000 + 'x' + Math.round(tablePos[key][1] * 10000) / 10000; } document.cookie = 'adminer_schema=' + encodeURIComponent(s.substr(1)) + '; expires=' + date + '; path=' + location.pathname + location.search; } Modified: trunk/adminer/static/functions.js =================================================================== --- trunk/adminer/static/functions.js 2009-12-17 12:54:17 UTC (rev 1272) +++ trunk/adminer/static/functions.js 2009-12-17 13:22:28 UTC (rev 1273) @@ -6,14 +6,14 @@ return true; } -function verify_version() { +function verifyVersion() { document.cookie = 'adminer_version=0'; var script = document.createElement('script'); script.src = 'https://adminer.svn.sourceforge.net/svnroot/adminer/trunk/version.js'; document.body.appendChild(script); } -function form_check(el, name) { +function formCheck(el, name) { var elems = el.form.elements; for (var i=0; i < elems.length; i++) { if (name.test(elems[i].name)) { @@ -22,11 +22,11 @@ } } -function form_uncheck(id) { +function formUncheck(id) { document.getElementById(id).checked = false; } -function form_checked(el, name) { +function formChecked(el, name) { var checked = 0; var elems = el.form.elements; for (var i=0; i < elems.length; i++) { @@ -37,7 +37,7 @@ return checked; } -function table_click(event) { +function tableClick(event) { var el = event.target || event.srcElement; while (!/^tr$/i.test(el.tagName)) { if (/^(table|a|input)$/i.test(el.tagName)) { @@ -52,7 +52,7 @@ -function select_add_row(field) { +function selectAddRow(field) { var row = field.parentNode.cloneNode(true); var selects = row.getElementsByTagName('select'); for (var i=0; i < selects.length; i++) { Modified: trunk/adminer/trigger.inc.php =================================================================== --- trunk/adminer/trigger.inc.php 2009-12-17 12:54:17 UTC (rev 1272) +++ trunk/adminer/trigger.inc.php 2009-12-17 13:22:28 UTC (rev 1273) @@ -29,7 +29,7 @@ <form action="" method="post" id="form"> <table cellspacing="0"> -<tr><th><?php echo lang('Time'); ?><td><?php echo html_select("Timing", $trigger_time, $row["Timing"], "if (/^" . h(preg_quote($TABLE, "/")) . "_[ba][iud]$/.test(this.form['Trigger'].value)) this.form['Trigger'].value = '" . h(addcslashes($TABLE, "\r\n'\\")) . "_' + select_value(this).charAt(0).toLowerCase() + select_value(this.form['Event']).charAt(0).toLowerCase();"); ?> +<tr><th><?php echo lang('Time'); ?><td><?php echo html_select("Timing", $trigger_time, $row["Timing"], "if (/^" . h(preg_quote($TABLE, "/")) . "_[ba][iud]$/.test(this.form['Trigger'].value)) this.form['Trigger'].value = '" . h(addcslashes($TABLE, "\r\n'\\")) . "_' + selectValue(this).charAt(0).toLowerCase() + selectValue(this.form['Event']).charAt(0).toLowerCase();"); ?> <tr><th><?php echo lang('Event'); ?><td><?php echo html_select("Event", $trigger_event, $row["Event"], "this.form['Timing'].onchange();"); ?> <tr><th><?php echo lang('Name'); ?><td><input name="Trigger" value="<?php echo h($row["Trigger"]); ?>" maxlength="64"> </table> Modified: trunk/adminer/user.inc.php =================================================================== --- trunk/adminer/user.inc.php 2009-12-17 12:54:17 UTC (rev 1272) +++ trunk/adminer/user.inc.php 2009-12-17 13:22:28 UTC (rev 1273) @@ -119,8 +119,8 @@ <tr><th><?php echo lang('Username'); ?><td><input name="user" maxlength="16" value="<?php echo h($row["user"]); ?>"> <tr><th><?php echo lang('Server'); ?><td><input name="host" maxlength="60" value="<?php echo h($row["host"]); ?>"> <tr><th><?php echo lang('Password'); ?><td><input id="pass" name="pass" value="<?php echo h($row["pass"]); ?>"> -<?php if (!$row["hashed"]) { ?><script type="text/javascript">type_password(document.getElementById('pass'));</script><?php } ?> -<?php echo checkbox("hashed", 1, $row["hashed"], lang('Hashed'), "type_password(this.form['pass'], this.checked);"); ?> +<?php if (!$row["hashed"]) { ?><script type="text/javascript">typePassword(document.getElementById('pass'));</script><?php } ?> +<?php echo checkbox("hashed", 1, $row["hashed"], lang('Hashed'), "typePassword(this.form['pass'], this.checked);"); ?> </table> <?php @@ -152,7 +152,7 @@ } elseif (isset($_GET["grant"])) { echo "<td><select name=$name><option><option value='1'" . ($value ? " selected" : "") . ">" . lang('Grant') . "<option value='0'" . ($value == "0" ? " selected" : "") . ">" . lang('Revoke') . "</select>"; } else { - echo "<td align='center'><input type='checkbox' name=$name value='1'" . ($value ? " checked" : "") . ($privilege == "All privileges" ? " id='grants-$i-all'" : ($privilege == "Grant option" ? "" : " onclick=\"if (this.checked) form_uncheck('grants-$i-all');\"")) . ">"; //! uncheck all except grant if all is checked + echo "<td align='center'><input type='checkbox' name=$name value='1'" . ($value ? " checked" : "") . ($privilege == "All privileges" ? " id='grants-$i-all'" : ($privilege == "Grant option" ? "" : " onclick=\"if (this.checked) formUncheck('grants-$i-all');\"")) . ">"; //! uncheck all except grant if all is checked } $i++; } Modified: trunk/editor/include/adminer.inc.php =================================================================== --- trunk/editor/include/adminer.inc.php 2009-12-17 12:54:17 UTC (rev 1272) +++ trunk/editor/include/adminer.inc.php 2009-12-17 13:22:28 UTC (rev 1273) @@ -205,7 +205,7 @@ $i++; } } - echo "<div><select name='where[$i][col]' onchange='select_add_row(this);'><option value=''>" . lang('(anywhere)') . optionlist($columns, null, true) . "</select>"; + echo "<div><select name='where[$i][col]' onchange='selectAddRow(this);'><option value=''>" . lang('(anywhere)') . optionlist($columns, null, true) . "</select>"; echo html_select("where[$i][op]", array(-1 => "") + $this->operators); echo "<input name='where[$i][val]'></div>\n"; echo "</div></fieldset>\n"; Modified: trunk/editor/static/editing.js =================================================================== --- trunk/editor/static/editing.js 2009-12-17 12:54:17 UTC (rev 1272) +++ trunk/editor/static/editing.js 2009-12-17 13:22:28 UTC (rev 1273) @@ -1,4 +1,4 @@ // Editor specific functions -function body_load(version) { +function bodyLoad(version) { } Modified: trunk/tests/2-create-table.html =================================================================== --- trunk/tests/2-create-table.html 2009-12-17 12:54:17 UTC (rev 1272) +++ trunk/tests/2-create-table.html 2009-12-17 13:22:28 UTC (rev 1273) @@ -63,7 +63,7 @@ </tr> <tr> <td>click</td> - <td>//input[@type='checkbox' and @onclick='column_show(this.checked, 6);']</td> + <td>//input[@type='checkbox' and @onclick='columnShow(this.checked, 6);']</td> <td></td> </tr> <tr> Modified: trunk/tests/4-create-table-2.html =================================================================== --- trunk/tests/4-create-table-2.html 2009-12-17 12:54:17 UTC (rev 1272) +++ trunk/tests/4-create-table-2.html 2009-12-17 13:22:28 UTC (rev 1273) @@ -68,7 +68,7 @@ </tr> <tr> <td>click</td> - <td>//input[@type='checkbox' and @onclick='column_show(this.checked, 6);']</td> + <td>//input[@type='checkbox' and @onclick='columnShow(this.checked, 6);']</td> <td></td> </tr> <tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |