]> git.joonet.de Git - adminer.git/commitdiff
Increase click target for checkboxes (thanks to Roman)
authorJakub Vrana <jakub@vrana.cz>
Mon, 20 May 2013 17:06:23 +0000 (10:06 -0700)
committerJakub Vrana <jakub@vrana.cz>
Mon, 20 May 2013 17:13:54 +0000 (10:13 -0700)
adminer/create.inc.php
adminer/dump.inc.php
adminer/include/editing.inc.php
adminer/include/functions.inc.php
adminer/static/default.css
adminer/static/editing.js
adminer/user.inc.php
changes.txt

index 2570d6f2d05de245b4c13c2b2cc18130e50fa75d..eca2694e5a7cd5444cd2a279e1bf2061e2a2e681 100644 (file)
@@ -172,9 +172,13 @@ edit_fields($row["fields"], $collations, "TABLE", $foreign_keys, $comments);
 </table>
 <p>
 <?php echo lang('Auto Increment'); ?>: <input type="number" name="Auto_increment" size="6" value="<?php echo h($row["Auto_increment"]); ?>">
-<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 echo checkbox("defaults", 1, true, lang('Default values'), "columnShow(this.checked, 5)", "jsonly"); ?>
 <?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 name="Comment" id="Comment" value="' . h($row["Comment"]) . '" maxlength="' . ($connection->server_info >= 5.5 ? 2048 : 60) . '"' . ($comments ? '' : ' class="hidden"') . '>' : ''); ?>
+<?php echo (support("comment")
+       ? "<label><input type='checkbox' name='comments' value='1' class='jsonly' onclick=\"columnShow(this.checked, 6); toggle('Comment'); if (this.checked) this.form['Comment'].focus();\"" . ($comments ? " checked" : "") . ">" . lang('Comment') . "</label>"
+               . ' <input name="Comment" id="Comment" value="' . h($row["Comment"]) . '" maxlength="' . ($connection->server_info >= 5.5 ? 2048 : 60) . '"' . ($comments ? '' : ' class="hidden"') . '>'
+       : '')
+; ?>
 <p>
 <input type="submit" value="<?php echo lang('Save'); ?>">
 <?php if ($_GET["create"] != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo confirm(); ?>><?php } ?>
index 586996580fae82b8efaa69090c21d539cffec8e9..cb51f18157982175a86ddc0bf6baecbca4abdd85 100644 (file)
@@ -164,8 +164,8 @@ $prefixes = array();
 if (DB != "") {
        $checked = ($TABLE != "" ? "" : " checked");
        echo "<thead><tr>";
-       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 "<th style='text-align: left;'><label class='block'><input type='checkbox' id='check-tables'$checked onclick='formCheck(this, /^tables\\[/);'>" . lang('Tables') . "</label>";
+       echo "<th style='text-align: right;'><label class='block'>" . lang('Data') . "<input type='checkbox' id='check-data'$checked onclick='formCheck(this, /^data\\[/);'></label>";
        echo "</thead>\n";
        
        $views = "";
@@ -173,11 +173,11 @@ if (DB != "") {
        foreach ($tables_list as $name => $type) {
                $prefix = ereg_replace("_.*", "", $name);
                $checked = ($TABLE == "" || $TABLE == (substr($TABLE, -1) == "%" ? "$prefix%" : $name)); //! % may be part of table name
-               $print = "<tr><td>" . checkbox("tables[]", $name, $checked, $name, "checkboxClick(event, this); formUncheck('check-tables');");
+               $print = "<tr><td>" . checkbox("tables[]", $name, $checked, $name, "checkboxClick(event, this); formUncheck('check-tables');", "block");
                if ($type !== null && !eregi("table", $type)) {
                        $views .= "$print\n";
                } else {
-                       echo "$print<td align='right'><label><span id='Rows-" . h($name) . "'></span>" . checkbox("data[]", $name, $checked, "", "checkboxClick(event, this); formUncheck('check-data');") . "</label>\n";
+                       echo "$print<td align='right'><label class='block'><span id='Rows-" . h($name) . "'></span>" . checkbox("data[]", $name, $checked, "", "checkboxClick(event, this); formUncheck('check-data');") . "</label>\n";
                }
                $prefixes[$prefix]++;
        }
@@ -188,13 +188,13 @@ if (DB != "") {
        }
        
 } else {
-       echo "<thead><tr><th style='text-align: left;'><label><input type='checkbox' id='check-databases'" . ($TABLE == "" ? " checked" : "") . " onclick='formCheck(this, /^databases\\[/);'>" . lang('Database') . "</label></thead>\n";
+       echo "<thead><tr><th style='text-align: left;'><label class='block'><input type='checkbox' id='check-databases'" . ($TABLE == "" ? " checked" : "") . " onclick='formCheck(this, /^databases\\[/);'>" . lang('Database') . "</label></thead>\n";
        $databases = $adminer->databases();
        if ($databases) {
                foreach ($databases as $db) {
                        if (!information_schema($db)) {
                                $prefix = ereg_replace("_.*", "", $db);
-                               echo "<tr><td>" . checkbox("databases[]", $db, $TABLE == "" || $TABLE == "$prefix%", $db, "formUncheck('check-databases');") . "</label>\n";
+                               echo "<tr><td>" . checkbox("databases[]", $db, $TABLE == "" || $TABLE == "$prefix%", $db, "formUncheck('check-databases');", "block") . "\n";
                                $prefixes[$prefix]++;
                        }
                }
index 7e21d55b5e1452eba4ceaf4b695fc22862df0669..d42541ea6add60c3499c9faf851742cd7f51733a 100644 (file)
@@ -241,9 +241,9 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
 <th><?php if ($display) { ?><input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" onchange="<?php echo ($field["field"] != "" || count($fields) > 1 ? "" : "editingAddRow(this); "); ?>editingNameChange(this);" maxlength="64" autocapitalize="off"><?php } ?><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"]); ?>
-<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 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][null]", 1, $field["null"], "", "", "block"); ?>
+<td><label class="block"><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(); }"></label><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='" . ($connection->server_info >= 5.5 ? 1024 : 255) . "'>" : ""); ?>
 <?php } ?>
 <?php
index e94edc95164850422a23a61b71574a0f233fc4cc..db4c0dc5aa72fa13f4d4e8dc439ab93e280d0372 100644 (file)
@@ -95,14 +95,18 @@ function nl_br($string) {
 * @param bool
 * @param string
 * @param string
-* @param bool
+* @param string
 * @return string
 */
-function checkbox($name, $value, $checked, $label = "", $onclick = "", $jsonly = false) {
+function checkbox($name, $value, $checked, $label = "", $onclick = "", $class = "") {
        static $id = 0;
        $id++;
-       $return = "<input type='checkbox' name='$name' value='" . h($value) . "'" . ($checked ? " checked" : "") . ($onclick ? ' onclick="' . h($onclick) . '"' : '') . ($jsonly ? " class='jsonly'" : "") . " id='checkbox-$id'>";
-       return ($label != "" ? "<label for='checkbox-$id'>$return" . h($label) . "</label>" : $return);
+       $return = "<input type='checkbox' name='$name' value='" . h($value) . "'"
+               . ($checked ? " checked" : "")
+               . ($onclick ? ' onclick="' . h($onclick) . '"' : '')
+               . " id='checkbox-$id'>"
+       ;
+       return ($label != "" || $class ? "<label for='checkbox-$id'" . ($class ? " class='$class'" : "") . ">$return" . h($label) . "</label>" : $return);
 }
 
 /** Generate list of HTML options
index 6bb659aa43f2795f2a0c4b81ea96bfab27768eb3..92501ea22371b6cddc98872cc17de4e2dacb7259 100644 (file)
@@ -22,6 +22,7 @@ tbody tr:hover td, tbody tr:hover th { background: #eee; }
 pre { margin: 1em 0 0; }
 input[type=image] { vertical-align: middle; }
 input.default { box-shadow: 1px 1px 1px rgba(0, 0, 0, .5); }
+.block { display: block; }
 .version { color: #777; font-size: 67%; }
 .js .hidden, .nojs .jsonly { display: none; }
 .js .column { position: absolute; background: #ddf; padding: .3em 1ex .3em 0; margin-top: -.3em; }
index d27236c94611c43456e7adb9e4f3bc4f069c1899..61a97a040617e6e21d723af9aa92e7a197e054ab 100644 (file)
@@ -416,7 +416,7 @@ function columnShow(checked, column) {
 */
 function editingHideDefaults() {
        if (innerWidth < document.documentElement.scrollWidth) {
-               document.getElementById('defaults').checked = false;
+               document.getElementById('form')['defaults'].checked = false;
                columnShow(false, 5);
        }
 }
index ec4663b78315ccddaf52d0c83ebdeece8a35f42e..71e7cf6a475e55ea0c52a6fff7343d632d4ca000 100644 (file)
@@ -169,7 +169,7 @@ foreach (array(
                        } 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) formUncheck('grants-$i-all');\"")) . ">"; //! uncheck all except grant if all is checked
+                               echo "<td align='center'><label class='block'><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');\"")) . "></label>"; //! uncheck all except grant if all is checked
                        }
                        $i++;
                }
index 66762b9dfd1f1e109969547a4b3524e5e3175a3a..77f03026b085d95558cefc3a8c3cff72444d3613 100644 (file)
@@ -1,4 +1,5 @@
 Adminer 3.7.1-dev:
+Increase click target for checkboxes
 Use shadow for highlighting default button
 
 Adminer 3.7.0 (released 2013-05-19):