]> git.joonet.de Git - adminer.git/commitdiff
Display table default values on wide screens
authorJakub Vrana <jakub@vrana.cz>
Sat, 22 Sep 2012 19:24:16 +0000 (12:24 -0700)
committerJakub Vrana <jakub@vrana.cz>
Sat, 22 Sep 2012 19:24:16 +0000 (12:24 -0700)
adminer/create.inc.php
adminer/include/editing.inc.php
adminer/static/editing.js
changes.txt

index dd73119f0ed2906d6fba713aad15a6005ab421ae..c2f4bc4fdf3a00b8b1826f3ddf03f2cc680a6690 100644 (file)
@@ -183,7 +183,8 @@ edit_fields($row["fields"], $collations, "TABLE", $suhosin, $foreign_keys, $comm
 </table>
 <p>
 <?php echo lang('Auto Increment'); ?>: <input name="Auto_increment" size="6" value="<?php echo h($row["Auto_increment"]); ?>">
-<label class="jsonly"><input type="checkbox" name="defaults" value="1"<?php echo ($_POST["defaults"] ? " checked" : ""); ?> onclick="columnShow(this.checked, 5);"><?php echo lang('Default values'); ?></label>
+<label class="jsonly"><input type="checkbox" id="defaults" name="defaults" value="1" checked onclick="columnShow(this.checked, 5);"><?php echo lang('Default values'); ?></label>
+<?php if (!$_POST["defaults"]) { ?><script type="text/javascript">editingHideDefaults()</script><?php } ?>
 <?php echo (support("comment") ? checkbox("comments", 1, $comments, lang('Comment'), "columnShow(this.checked, 6); toggle('Comment'); if (this.checked) this.form['Comment'].focus();", true) . ' <input id="Comment" name="Comment" value="' . h($row["Comment"]) . '" maxlength="60"' . ($comments ? '' : ' class="hidden"') . '>' : ''); ?>
 <p>
 <input type="submit" value="<?php echo lang('Save'); ?>">
index a9337568031c1007ee841327f65d7f68fd6616e1..c05e9bcbc647c04f92d3cb56ececf2b36a250bfe 100644 (file)
@@ -231,7 +231,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $allowed = 0, $forei
 <?php if ($type == "TABLE") { ?>
 <td>NULL
 <td><input type="radio" name="auto_increment_col" value=""><acronym title="<?php echo lang('Auto Increment'); ?>">AI</acronym>
-<td<?php echo ($_POST["defaults"] ? "" : " class='hidden'"); ?>><?php echo lang('Default values'); ?>
+<td><?php echo lang('Default values'); ?>
 <?php echo (support("comment") ? "<td" . ($comments ? "" : " class='hidden'") . ">" . lang('Comment') : ""); ?>
 <?php } ?>
 <td><?php echo "<input type='image' class='icon' name='add[" . (support("move_col") ? 0 : count($fields)) . "]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "'>"; ?><script type="text/javascript">row_count = <?php echo count($fields); ?>;</script>
@@ -250,7 +250,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $allowed = 0, $forei
 <?php if ($type == "TABLE") { ?>
 <td><?php echo checkbox("fields[$i][null]", 1, $field["null"]); ?>
 <td><input type="radio" name="auto_increment_col" value="<?php echo $i; ?>"<?php if ($field["auto_increment"]) { ?> checked<?php } ?> onclick="var field = this.form['fields[' + this.value + '][field]']; if (!field.value) { field.value = 'id'; field.onchange(); }">
-<td<?php echo ($_POST["defaults"] ? "" : " class='hidden'"); ?>><?php echo checkbox("fields[$i][has_default]", 1, $field["has_default"]); ?><input name="fields[<?php echo $i; ?>][default]" value="<?php echo h($field["default"]); ?>" onchange="this.previousSibling.checked = true;">
+<td><?php echo checkbox("fields[$i][has_default]", 1, $field["has_default"]); ?><input name="fields[<?php echo $i; ?>][default]" value="<?php echo h($field["default"]); ?>" onchange="this.previousSibling.checked = true;">
 <?php echo (support("comment") ? "<td" . ($comments ? "" : " class='hidden'") . "><input name='fields[$i][comment]' value='" . h($field["comment"]) . "' maxlength='255'>" : ""); ?>
 <?php } ?>
 <?php
index 37764f26ef7cc1e51724a41020baf401f0cead5c..cdd9e1e14075a015b8a3711cb67a77a4f98d5b98 100644 (file)
@@ -355,6 +355,15 @@ function columnShow(checked, column) {
        }
 }
 
+/** Hide column with default values in narrow window
+*/
+function editingHideDefaults() {
+       if (innerWidth < document.documentElement.scrollWidth) {
+               document.getElementById('defaults').checked = false;
+               columnShow(false, 5);
+       }
+}
+
 /** Display partition options
 * @param HTMLSelectElement
 */
index ddadb196d8f9d6adec3b0ab2105a1832bb41f63e..7731c9a1c80f38222377292c760c48de891f4b20 100644 (file)
@@ -1,5 +1,6 @@
 Adminer 3.6.2-dev:
 Shorten varchar fields
+Display table default values on wide screens
 Fix switching language on first load
 
 Adminer 3.6.1 (released 2012-09-17):