diff --git a/ChangeLog b/ChangeLog index 6a2d9e3e7..ef1517b22 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ phpMyAdmin - ChangeLog 3.4.8.0 (not yet released) - bug #3425230 [interface] enum data split at space char (more space to edit) +- bug #3426840 [interface] ENUM/SET editor can't handle commas in values 3.4.7.0 (not yet released) - bug #3418610 [interface] Links in navigation when $cfg['MainPageIconic'] = false diff --git a/js/functions.js b/js/functions.js index 3a1ed33e9..8431b2a98 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1842,24 +1842,48 @@ $(document).ready(function() { $("#popup_background").fadeIn("fast"); $("#enum_editor").fadeIn("fast"); - // Get the values - var values = $(this).parent().prev("input").attr("value").split(","); - $.each(values, function(index, val) { - if(jQuery.trim(val) != "") { - // enclose the string in single quotes if it's not already - if(val.substr(0, 1) != "'") { - val = "'" + val; - } - if(val.substr(val.length-1, val.length) != "'") { - val = val + "'"; - } - // escape the single quotes, except the mandatory ones enclosing the entire string - val = val.substr(1, val.length-2).replace(/''/g, "'").replace(/\\\\/g, '\\').replace(/\\'/g, "'").replace(/'/g, "'"); - // escape the greater-than symbol - val = val.replace(/>/g, ">"); - $("#enum_editor #values").append(""); + // Get the values as a string + var inputstring = $(this) + .parent() + .prev("input") + .val(); + // Escape html entities + inputstring = $('
') + .text(inputstring) + .html(); + // Parse the values, escaping quotes and + // slashes on the fly, into an array + var values = []; + var in_string = false; + var curr, next, buffer = ''; + for (var i=0; i