[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_6-21203-g4336ffc

Marc Delisle lem9 at users.sourceforge.net
Sun Oct 16 15:13:01 CEST 2011


The branch, master has been updated
       via  4336ffca2bec81d98b52ed95229ddfb84f9a9b7e (commit)
      from  ba2159baca78325d9b6f6819e59b5f5546f503cd (commit)


- Log -----------------------------------------------------------------
commit 4336ffca2bec81d98b52ed95229ddfb84f9a9b7e
Author: Marc Delisle <marc at infomarc.info>
Date:   Sun Oct 16 09:10:48 2011 -0400

    As suggested by Tyron Madlener:
    
    Display the input field for the default value only after "As defined:"
    is selected, and also focus it automatically once it's selected so the user
    can type immediately

-----------------------------------------------------------------------

Summary of changes:
 js/db_structure.js               |    4 ++--
 js/functions.js                  |   28 +++++++++++++++++++++++-----
 js/sql.js                        |    4 ++--
 js/tbl_structure.js              |   12 ++++++------
 libraries/tbl_properties.inc.php |    4 ++--
 5 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/js/db_structure.js b/js/db_structure.js
index a6229c7..162a6c7 100644
--- a/js/db_structure.js
+++ b/js/db_structure.js
@@ -96,7 +96,7 @@ $(document).ready(function() {
                     height: 230,
                     width: 900,
                     modal: true,
-                    open: PMA_verifyTypeOfAllColumns,
+                    open: PMA_verifyColumnsProperties,
                     buttons : button_options_error
                 })// end dialog options
             } else {
@@ -107,7 +107,7 @@ $(document).ready(function() {
                         height: 600,
                         width: 900,
                         modal: true,
-                        open: PMA_verifyTypeOfAllColumns,
+                        open: PMA_verifyColumnsProperties,
                         buttons : button_options
                     });// end dialog options
                 //Remove the top menu container from the dialog
diff --git a/js/functions.js b/js/functions.js
index 9dcc20e..19ab7ce 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -1517,7 +1517,7 @@ function PMA_createTableDialog( $div, url , target)
                  title: PMA_messages['strCreateTable'],
                  height: 230,
                  width: 900,
-                 open: PMA_verifyTypeOfAllColumns,
+                 open: PMA_verifyColumnsProperties,
                  buttons : button_options_error
              })// end dialog options
              //remove the redundant [Back] link in the error message.
@@ -1559,7 +1559,7 @@ function PMA_createTableDialog( $div, url , target)
                              top: 0
                          });
 
-                     PMA_verifyTypeOfAllColumns();
+                     PMA_verifyColumnsProperties();
                  },
                  close: function() {
                      $(window).unbind('resize.dialog-resizer');
@@ -2180,7 +2180,7 @@ $(document).ready(function() {
             if ($("#create_table_div").length > 0) {
                 $("#create_table_div").html(data);
             }
-            PMA_verifyTypeOfAllColumns();
+            PMA_verifyColumnsProperties();
             PMA_ajaxRemoveMessage($msgbox);
         }) //end $.post()
 
@@ -2540,19 +2540,37 @@ $(document).ready(function() {
 $(document).ready(function() {
     // is called here for normal page loads and also when opening
     // the Create table dialog
-    PMA_verifyTypeOfAllColumns();
+    PMA_verifyColumnsProperties();
     //
     // needs live() to work also in the Create Table dialog
     $("select[class='column_type']").live('change', function() {
         PMA_showNoticeForEnum($(this));
     });
+    $(".default_type").live('change', function() {
+        PMA_hideShowDefaultValue($(this));
+    });
 });
 
-function PMA_verifyTypeOfAllColumns()
+function PMA_verifyColumnsProperties()
 {
     $("select[class='column_type']").each(function() {
         PMA_showNoticeForEnum($(this));
     });
+    $(".default_type").each(function() {
+        PMA_hideShowDefaultValue($(this));
+    });
+}
+
+/**
+ * Hides/shows the default value input field, depending on the default type 
+ */
+function PMA_hideShowDefaultValue($default_type)
+{
+    if ($default_type.val() == 'USER_DEFINED') {
+        $default_type.siblings('.default_value').show().focus();
+    } else {
+        $default_type.siblings('.default_value').hide();
+    }
 }
 
 /**
diff --git a/js/sql.js b/js/sql.js
index d729677..bfbbf3a 100644
--- a/js/sql.js
+++ b/js/sql.js
@@ -376,7 +376,7 @@ $(document).ready(function() {
                         title: PMA_messages['strChangeTbl'],
                         height: 230,
                         width: 900,
-                        open: PMA_verifyTypeOfAllColumns,
+                        open: PMA_verifyColumnsProperties,
                         close: function(event, ui) {
                             $('#change_row_dialog').remove();
                         },
@@ -389,7 +389,7 @@ $(document).ready(function() {
                         title: PMA_messages['strChangeTbl'],
                         height: 600,
                         width: 900,
-                        open: PMA_verifyTypeOfAllColumns,
+                        open: PMA_verifyColumnsProperties,
                         close: function(event, ui) {
                             $('#change_row_dialog').remove();
                         },
diff --git a/js/tbl_structure.js b/js/tbl_structure.js
index bdcf1ee..226d1c4 100644
--- a/js/tbl_structure.js
+++ b/js/tbl_structure.js
@@ -219,7 +219,7 @@ $(document).ready(function() {
                     title: PMA_messages['strEdit'],
                     height: 230,
                     width: 900,
-                    open: PMA_verifyTypeOfAllColumns,
+                    open: PMA_verifyColumnsProperties,
                     modal: true,
                     buttons : button_options_error
                 })// end dialog options
@@ -230,7 +230,7 @@ $(document).ready(function() {
                     title: PMA_messages['strEdit'],
                     height: 600,
                     width: 900,
-                    open: PMA_verifyTypeOfAllColumns,
+                    open: PMA_verifyColumnsProperties,
                     modal: true,
                     buttons : button_options
                 })
@@ -371,7 +371,7 @@ $(document).ready(function() {
                     title: PMA_messages['strAddColumns'],
                     height: 230,
                     width: 900,
-                    open: PMA_verifyTypeOfAllColumns,
+                    open: PMA_verifyColumnsProperties,
                     modal: true,
                     buttons : button_options_error
                 })// end dialog options
@@ -382,7 +382,7 @@ $(document).ready(function() {
                     title: PMA_messages['strAddColumns'],
                     height: 600,
                     width: 900,
-                    open: PMA_verifyTypeOfAllColumns,
+                    open: PMA_verifyColumnsProperties,
                     modal: true,
                     buttons : button_options
                 })
@@ -441,7 +441,7 @@ function changeColumns(action,url)
                 height: 230,
                 width: 900,
                 modal: true,
-                open: PMA_verifyTypeOfAllColumns,
+                open: PMA_verifyColumnsProperties,
                 buttons : button_options_error
             })// end dialog options
         } else {
@@ -452,7 +452,7 @@ function changeColumns(action,url)
                 height: 600,
                 width: 900,
                 modal: true,
-                open: PMA_verifyTypeOfAllColumns,
+                open: PMA_verifyColumnsProperties,
                 buttons : button_options
             })
             //Remove the top menu container from the dialog
diff --git a/libraries/tbl_properties.inc.php b/libraries/tbl_properties.inc.php
index 6f3cba4..12576f4 100644
--- a/libraries/tbl_properties.inc.php
+++ b/libraries/tbl_properties.inc.php
@@ -360,7 +360,7 @@ for ($i = 0; $i < $num_fields; $i++) {
         $row['DefaultValue'] = PMA_convert_bit_default_value($row['DefaultValue']);
     }
 
-    $content_cells[$i][$ci] = '<select name="field_default_type[' . $i . ']">';
+    $content_cells[$i][$ci] = '<select name="field_default_type[' . $i . ']" class="default_type">';
     foreach ($default_options as $key => $value) {
         $content_cells[$i][$ci] .= '<option value="' . $key . '"';
         // is only set when we go back to edit a field's structure
@@ -374,7 +374,7 @@ for ($i = 0; $i < $num_fields; $i++) {
     $content_cells[$i][$ci] .= '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"'
         . ' type="text" name="field_default_value[' . $i . ']" size="12"'
         . ' value="' . (isset($row['DefaultValue']) ? htmlspecialchars($row['DefaultValue']) : '') . '"'
-        . ' class="textfield" />';
+        . ' class="textfield default_value" />';
     $ci++;
 
     // column collation


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list