Ticket #491: 491.patch
| File 491.patch, 1.6 kB (added by crschmidt, 2 years ago) |
|---|
-
Util.js
old new 377 387 * @returns a concatenation of the properties of an object in 378 388 * http parameter notation. 379 389 * (ex. <i>"key1=value1&key2=value2&key3=value3"</i>) 390 * If a parameter is actually a list, that parameter will then 391 * be set to a comma-seperated list of values (foo,bar) instead 392 * of being URL escaped (foo%3Abar). 380 393 * @type String 381 394 */ 382 395 OpenLayers.Util.getParameterString = function(params) { 383 396 paramsArray = new Array(); 384 397 385 398 for (var key in params) { 386 var value = params[key]; 387 if ((value != null) && (typeof value != 'function')) { 388 paramsArray.push(encodeURIComponent(key) + "=" + 389 encodeURIComponent(value)); 399 var value = params[key]; 400 if ((value != null) && (typeof value != 'function')) { 401 var encodedValue; 402 if (typeof value == 'object' && value.constructor == Array) { 403 /* value is an array; encode items and separate with "," */ 404 var encodedItemArray = new Array(); 405 for (var itemIndex=0; itemIndex<value.length; itemIndex++) { 406 encodedItemArray.push(encodeURIComponent(value[itemIndex])); 407 } 408 encodedValue = encodedItemArray.join(","); 390 409 } 410 else { 411 /* value is a string; simply encode */ 412 encodedValue = encodeURIComponent(value); 413 } 414 paramsArray.push(encodeURIComponent(key) + "=" + encodedValue); 415 } 391 416 } 392 417 393 418 return paramsArray.join("&");
