]> git.joonet.de Git - adminer.git/commitdiff
Hide columns when rendering
authorJakub Vrana <jakub@vrana.cz>
Fri, 20 Dec 2019 13:00:40 +0000 (14:00 +0100)
committerJakub Vrana <jakub@vrana.cz>
Fri, 20 Dec 2019 13:00:40 +0000 (14:00 +0100)
adminer/create.inc.php
adminer/include/editing.inc.php

index 05a4df412abc99d9ef5f307401842a8016516788..47e7d06515d00ef8537d0f38c1d57af01f6aa9bc 100644 (file)
@@ -221,4 +221,3 @@ foreach ($row["partition_names"] as $key => $val) {
 ?>
 <input type="hidden" name="token" value="<?php echo $token; ?>">
 </form>
-<?php echo script("qs('#form')['defaults'].onclick();" . (support("comment") ? " editingCommentsClick(qs('#form')['comments']);" : "")); ?>
index c8677c85a7c1cf1a3a512ea4fabcf1125764195a..517cb539a4b105963438aa255bc6b82fdb78c4a5 100644 (file)
@@ -263,6 +263,8 @@ function type_class($type) {
 function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = array()) {
        global $inout;
        $fields = array_values($fields);
+       $default_class = (($_POST ? $_POST["defaults"] : adminer_setting("defaults")) ? "" : " class='hidden'");
+       $comment_class = (($_POST ? $_POST["comments"] : adminer_setting("comments")) ? "" : " class='hidden'");
        ?>
 <thead><tr>
 <?php if ($type == "PROCEDURE") { ?><td><?php } ?>
@@ -279,8 +281,8 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
        'pgsql' => "datatype.html#DATATYPE-SERIAL",
        'mssql' => "ms186775.aspx",
 )); ?>
-<td id="label-default"><?php echo lang('Default value'); ?>
-<?php echo (support("comment") ? "<td id='label-comment'>" . lang('Comment') : ""); ?>
+<td id="label-default"<?php echo $default_class; ?>><?php echo lang('Default value'); ?>
+<?php echo (support("comment") ? "<td id='label-comment'$comment_class>" . 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("row_count = " . count($fields) . ";"); ?>
 </thead>
@@ -298,9 +300,9 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
 <input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo h($orig); ?>"><?php edit_type("fields[$i]", $field, $collations, $foreign_keys); ?>
 <?php if ($type == "TABLE") { ?>
 <td><?php echo checkbox("fields[$i][null]", 1, $field["null"], "", "", "block", "label-null"); ?>
-<td><label class="block"><input type="radio" name="auto_increment_col" value="<?php echo $i; ?>"<?php if ($field["auto_increment"]) { ?> checked<?php } ?> aria-labelledby="label-ai"></label><td><?php
+<td><label class="block"><input type="radio" name="auto_increment_col" value="<?php echo $i; ?>"<?php if ($field["auto_increment"]) { ?> checked<?php } ?> aria-labelledby="label-ai"></label><td<?php echo $default_class; ?>><?php
                        echo checkbox("fields[$i][has_default]", 1, $field["has_default"], "", "", "", "label-default"); ?><input name="fields[<?php echo $i; ?>][default]" value="<?php echo h($field["default"]); ?>" aria-labelledby="label-default"><?php
-                       echo (support("comment") ? "<td><input name='fields[$i][comment]' value='" . h($field["comment"]) . "' data-maxlength='" . (min_version(5.5) ? 1024 : 255) . "' aria-labelledby='label-comment'>" : "");
+                       echo (support("comment") ? "<td$comment_class><input name='fields[$i][comment]' value='" . h($field["comment"]) . "' data-maxlength='" . (min_version(5.5) ? 1024 : 255) . "' aria-labelledby='label-comment'>" : "");
                }
                echo "<td>";
                echo (support("move_col") ?