]> git.joonet.de Git - adminer.git/commitdiff
Editor: Display field comment's text inside [] only in edit form
authorJakub Vrana <jakub@vrana.cz>
Sun, 1 Oct 2017 15:45:17 +0000 (08:45 -0700)
committerJakub Vrana <jakub@vrana.cz>
Sun, 1 Oct 2017 15:45:17 +0000 (08:45 -0700)
adminer/include/adminer.inc.php
adminer/include/functions.inc.php
changes.txt
editor/include/adminer.inc.php
plugins/plugin.php

index d8a672dd1d756b2754c98b6641deffa79a4175d5..1861b561b6b12e66781715fb406ad9bd4e1bd779 100644 (file)
@@ -626,6 +626,16 @@ focus(document.getElementById('username'));
                return "";
        }
 
+       /** Get hint for edit field
+       * @param string table name
+       * @param array single field from fields()
+       * @param string
+       * @return string
+       */
+       function editHint($table, $field, $value) {
+               return "";
+       }
+
        /** Process sent input
        * @param array single field from fields()
        * @param string
index d8383e4de0fec9f2e462f2655ff35eeab5313c5f..da99c9cc9645183c503e8300789752af1abe0454 100644 (file)
@@ -920,6 +920,7 @@ function input($field, $value, $function) {
                                . "$attrs>"
                        ;
                }
+               echo $adminer->editHint($_GET["edit"], $field, $value);
        }
 }
 
index 4af40c02b9b4932b9af43040579da1f6b7cacba0..44136d01b67cd7510a950d4d6cc1b84bb9e63e30 100644 (file)
@@ -2,6 +2,7 @@ Adminer 4.3.2-dev:
 MySQL: Remove dedicated view for replication status (added in 4.3.0)
 PostgreSQL: Sort table names (regression from 4.3.1)
 Editor: Don't set time zone from PHP, fixes DST
+Editor: Display field comment's text inside [] only in edit form
 Hebrew translation
 
 Adminer 4.3.1 (released 2017-04-14):
index dc323fab829f28763724b39a18860987e494a68c..ae4052027a77406df633615967fc78a3d57f7706 100644 (file)
@@ -75,7 +75,7 @@ focus(document.getElementById('username'));
        }
 
        function fieldName($field, $order = 0) {
-               return h($field["comment"] != "" ? $field["comment"] : $field["field"]);
+               return h(preg_replace('~\s+\[.*\]$~', '', ($field["comment"] != "" ? $field["comment"] : $field["field"])));
        }
 
        function selectLinks($tableStatus, $set = "") {
@@ -479,6 +479,10 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
                return '';
        }
 
+       function editHint($table, $field, $value) {
+               return (preg_match('~\s+(\[.*\])$~', ($field["comment"] != "" ? $field["comment"] : $field["field"]), $match) ? h(" $match[1]") : '');
+       }
+
        function processInput($field, $value, $function = "") {
                if ($function == "now") {
                        return "$function()";
index c1330fb45cfd107b95083f836648797a251af979..c2c6aa0dc1bc7c0799a68cc6b9458c66f238ce5c 100644 (file)
@@ -307,6 +307,11 @@ class AdminerPlugin extends Adminer {
                return $this->_applyPlugin(__FUNCTION__, $args);
        }
 
+       function editHint($table, $field, $value) {
+               $args = func_get_args();
+               return $this->_applyPlugin(__FUNCTION__, $args);
+       }
+
        function processInput($field, $value, $function = "") {
                $args = func_get_args();
                return $this->_applyPlugin(__FUNCTION__, $args);