The branch, master has been updated
via 16875ecd705259dc2e4474aed88870b734b44964 (commit)
via a66a40262a01cd888ddbddd67660e9341988c15e (commit)
from f6971604275100df73f0a72ec88a75e5ce8237ec (commit)
- Log -----------------------------------------------------------------
commit 16875ecd705259dc2e4474aed88870b734b44964
Author: Piotr Przybylski <piotrprz(a)gmail.com>
Date: Wed Nov 16 21:21:12 2011 +0100
Followup of Rouslan's recent commit - form field selection should never be based on language strings
commit a66a40262a01cd888ddbddd67660e9341988c15e
Author: Piotr Przybylski <piotrprz(a)gmail.com>
Date: Wed Nov 16 21:16:44 2011 +0100
Field values may not be in correct selector syntax - added a specialized filter function to narrow down form fields to the one with specified value
-----------------------------------------------------------------------
Summary of changes:
js/functions.js | 14 +++++++++++++-
js/import.js | 6 +++---
js/sql.js | 2 +-
js/tbl_structure.js | 2 +-
4 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/js/functions.js b/js/functions.js
index 3836aca..4377a1d 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -2324,7 +2324,7 @@ $(document).ready(function() {
$("#sqlqueryresults").html(data.sql_query);
$("#result_query .notice").remove();
$("#result_query").prepend((data.message));
- $("#copyTable").find("select[name='target_db'] option[value="+data.db+"]").attr('selected', 'selected');
+ $("#copyTable").find("select[name='target_db'] option").filterByValue(data.db).attr('selected', 'selected');
//Refresh navigation frame when the table is coppied
if (window.parent && window.parent.frame_navigation) {
@@ -3546,6 +3546,18 @@ $(document).ready(function() {
})(jQuery);
/**
+ * jQuery plugin to correctly filter input fields by value, needed
+ * because some nasty values may break selector syntax
+ */
+(function ($) {
+ $.fn.filterByValue = function (value) {
+ return this.filter(function () {
+ return $(this).val() === value
+ });
+ };
+})(jQuery);
+
+/**
* Create default PMA tooltip for the element specified. The default appearance
* can be overriden by specifying optional "options" parameter (see qTip options).
*/
diff --git a/js/import.js b/js/import.js
index 68a3793..98e34fa 100644
--- a/js/import.js
+++ b/js/import.js
@@ -31,15 +31,15 @@ function matchFile(fname)
{
var fname_array = fname.toLowerCase().split(".");
var len = fname_array.length;
- if(len != 0) {
+ if (len != 0) {
var extension = fname_array[len - 1];
if (extension == "gz" || extension == "bz2" || extension == "zip") {
len--;
}
// Only toggle if the format of the file can be imported
- if($("select[name='format'] option[value='" + fname_array[len - 1] + "']").length == 1) {
+ if($("select[name='format'] option").filterByValue(fname_array[len - 1]).length == 1) {
$("#plugins option:selected").removeAttr("selected");
- $("select[name='format'] option[value='" + fname_array[len - 1] + "']").attr('selected', 'selected');
+ $("select[name='format'] option").filterByValue(fname_array[len - 1]).attr('selected', 'selected');
changePluginOpts();
}
}
diff --git a/js/sql.js b/js/sql.js
index bfbbf3a..a7cfe98 100644
--- a/js/sql.js
+++ b/js/sql.js
@@ -411,7 +411,7 @@ $(document).ready(function() {
/**
* Click action for "Go" button in ajax dialog insertForm -> insertRowTable
*/
- $("#insertForm .insertRowTable.ajax input[value=Go]").live('click', function(event) {
+ $("#insertForm .insertRowTable.ajax input[type=submit]").live('click', function(event) {
event.preventDefault();
/**
* @var the_form object referring to the insert form
diff --git a/js/tbl_structure.js b/js/tbl_structure.js
index f278807..8bbd8bb 100644
--- a/js/tbl_structure.js
+++ b/js/tbl_structure.js
@@ -339,7 +339,7 @@ $(document).ready(function() {
/**
*Ajax event handler for Add column(s)
**/
- $("#addColumns.ajax input[value=Go]").live('click', function(event){
+ $("#addColumns.ajax input[type=submit]").live('click', function(event){
event.preventDefault();
/*Remove the hidden dialogs if there are*/
hooks/post-receive
--
phpMyAdmin