1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-08 07:36:44 +02:00
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1092 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana
2009-09-11 17:08:18 +00:00
parent f83f204304
commit 123c758e87
8 changed files with 35 additions and 11 deletions

View File

@@ -146,6 +146,7 @@ if ($suhosin && count($row["fields"]) > $suhosin) {
<select name="Engine"><option value="">(<?php echo lang('engine'); ?>)<?php echo optionlist($engines, $row["Engine"]); ?></select>
<select name="Collation"><option value="">(<?php echo lang('collation'); ?>)<?php echo optionlist($collations, $row["Collation"]); ?></select>
<input type="submit" value="<?php echo lang('Save'); ?>">
</p>
<table cellspacing="0" id="edit-fields">
<?php $column_comments = edit_fields($row["fields"], $collations, "TABLE", $suhosin, $foreign_keys); ?>
</table>

View File

@@ -149,7 +149,7 @@ echo "<tr><th>" . lang('Tables') . "<td><select name='table_style'>" . optionlis
echo "<tr><th>" . lang('Data') . "<td><select name='data_style'>" . optionlist($data_style, 'INSERT') . "</select>\n";
?>
</table>
<p><input type="submit" value="<?php echo lang('Export'); ?>">
<p><input type="submit" value="<?php echo lang('Export'); ?>"></p>
<table cellspacing="0">
<?php

View File

@@ -19,6 +19,27 @@ function body_load() {
function select_value(select) {
return select.options[select.selectedIndex].text;
}
function form_field(form, name) {
for (var i=0; i < form.length; i++) {
if (form[i].name == name) {
return form[i];
}
}
}
function type_password(el, disable) {
try {
el.type = (disable ? 'text' : 'password');
} catch (e) {
}
}
var added = '.', row_count;
function re_escape(s) {
@@ -31,7 +52,7 @@ function idf_escape(s) {
function editing_name_change(field) {
var name = field.name.substr(0, field.name.length - 7);
var type = field.form[name + '[type]'];
var type = form_field(field.form, name + '[type]');
var opts = type.options;
var table = re_escape(field.value);
var column = '';
@@ -63,7 +84,7 @@ function editing_name_change(field) {
}
}
if (candidate) {
opts.selectedIndex = candidate;
type.selectedIndex = candidate;
type.onchange();
}
}
@@ -108,7 +129,7 @@ function editing_add_row(button, allowed) {
}
function editing_remove_row(button) {
var field = button.form[button.name.replace(/drop_col(.+)/, 'fields$1[field]')];
var field = form_field(button.form, button.name.replace(/drop_col(.+)/, 'fields$1[field]'));
field.parentNode.removeChild(field);
button.parentNode.parentNode.style.display = 'none';
return true;
@@ -116,7 +137,7 @@ function editing_remove_row(button) {
function editing_type_change(type) {
var name = type.name.substr(0, type.name.length - 6);
var text = type.options[type.selectedIndex].text;
var text = select_value(type);
for (var i=0; i < type.form.elements.length; i++) {
var el = type.form.elements[i];
if (el.name == name + '[collation]') {
@@ -136,7 +157,7 @@ function column_show(checked, column) {
}
function partition_by_change(el) {
var partition_table = /RANGE|LIST/.test(el.options[el.selectedIndex].text);
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');
}
@@ -166,7 +187,9 @@ function foreign_add_row(field) {
function indexes_add_row(field) {
var row = field.parentNode.parentNode.cloneNode(true);
var spans = row.getElementsByTagName('span');
row.getElementsByTagName('td')[1].innerHTML = '<span>' + spans[spans.length - 1].innerHTML + '</span>';
for (var i=0; i < spans.length - 1; i++) {
row.removeChild(spans[i]);
}
var selects = row.getElementsByTagName('select');
for (var i=0; i < selects.length; i++) {
selects[i].name = selects[i].name.replace(/indexes\[[0-9]+/, '$&1');

View File

@@ -46,6 +46,7 @@ $target = ($TABLE === $row["table"] ? $source : get_vals("SHOW COLUMNS FROM " .
<?php echo lang('Target table'); ?>:
<select name="table" onchange="this.form['change-js'].value = '1'; this.form.submit();"><?php echo optionlist(array_keys(table_status_referencable()), $row["table"]); ?></select>
<input type="hidden" name="change-js" value="">
</p>
<noscript><p><input type="submit" name="change" value="<?php echo lang('Change'); ?>"></noscript>
<table cellspacing="0">
<thead><tr><th><?php echo lang('Source'); ?><th><?php echo lang('Target'); ?></thead>

View File

@@ -87,7 +87,6 @@ class Adminer {
* @return string
*/
function selectQuery($query) {
// it would be nice if $query can be passed by reference and printed value would be returned but call_user() doesn't allow reference parameters
return "<p><code class='jush-sql'>" . h($query) . "</code> <a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a></p>\n";
}

View File

@@ -69,7 +69,7 @@ if (!$error && $_POST) {
do {
$result = $dbh->store_result();
if (!$i) {
echo "<p class='time'>" . (is_object($result) ? lang('%d row(s)', $result->num_rows) . ", ": "") . lang('%.3f s', max(0, $end[0] - $start[0] + $end[1] - $start[1])) . "</p>\n"; // </p> required by IE
echo "<p class='time'>" . (is_object($result) ? lang('%d row(s)', $result->num_rows) . ", ": "") . lang('%.3f s', max(0, $end[0] - $start[0] + $end[1] - $start[1])) . "</p>\n";
$i++;
}
if (is_object($result)) {

View File

@@ -28,7 +28,7 @@ if ($_POST) {
<form action="" method="post" id="form">
<table cellspacing="0">
<tr><th><?php echo lang('Time'); ?><td><select name="Timing" onchange="if (/^<?php echo h(preg_quote($TABLE, "/")); ?>_[ba][iud]$/.test(this.form['Trigger'].value)) this.form['Trigger'].value = '<?php echo h(addcslashes($TABLE, "\r\n'\\")); ?>_' + this.value.charAt(0).toLowerCase() + this.form['Event'].value.charAt(0).toLowerCase();"><?php echo optionlist($trigger_time, $row["Timing"]); ?></select>
<tr><th><?php echo lang('Time'); ?><td><select name="Timing" onchange="if (/^<?php echo h(preg_quote($TABLE, "/")); ?>_[ba][iud]$/.test(this.form['Trigger'].value)) this.form['Trigger'].value = '<?php echo h(addcslashes($TABLE, "\r\n'\\")); ?>_' + select_value(this).charAt(0).toLowerCase() + select_value(this.form['Event']).charAt(0).toLowerCase();"><?php echo optionlist($trigger_time, $row["Timing"]); ?></select>
<tr><th><?php echo lang('Event'); ?><td><select name="Event" onchange="this.form['Timing'].onchange();"><?php echo optionlist($trigger_event, $row["Event"]); ?></select>
<tr><th><?php echo lang('Name'); ?><td><input name="Trigger" value="<?php echo h($row["Trigger"]); ?>" maxlength="64">
</table>

View File

@@ -118,7 +118,7 @@ if ($_POST) {
<table cellspacing="0">
<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">document.getElementById('pass').type = 'password';</script><?php } ?> <label><input type="checkbox" name="hashed" value="1"<?php if ($row["hashed"]) { ?> checked<?php } ?> onclick="this.form['pass'].type = (this.checked ? 'text' : 'password');"><?php echo lang('Hashed'); ?></label>
<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 } ?> <label><input type="checkbox" name="hashed" value="1"<?php if ($row["hashed"]) { ?> checked<?php } ?> onclick="type_password(this.form['pass'], this.checked);"><?php echo lang('Hashed'); ?></label>
</table>
<?php