diff --git a/webroot/js/pmgr.js b/webroot/js/pmgr.js index b9b96be..b9ce8a0 100644 --- a/webroot/js/pmgr.js +++ b/webroot/js/pmgr.js @@ -191,7 +191,7 @@ function datepickerEOM(fromid, id) { // I'm not keen on redesigning it at the moment. So, here // is a serialize implementation I found on the web. -function serialize( mixed_value ) { +function serialize( mixed_value, depth ) { // http://kevin.vanzonneveld.net // + original by: Arpad Ray (mailto:arpad@php.net) // + improved by: Dino @@ -205,7 +205,19 @@ function serialize( mixed_value ) { // * returns 1: 'a:3:{i:0;s:5:"Kevin";i:1;s:3:"van";i:2;s:9:"Zonneveld";}' // * example 2: serialize({firstName: 'Kevin', midName: 'van', surName: 'Zonneveld'}); // * returns 2: 'a:3:{s:9:"firstName";s:5:"Kevin";s:7:"midName";s:3:"van";s:7:"surName";s:9:"Zonneveld";}' - +// if (depth == null) +// depth = ''; + +// if (depth == '') +// $("#debug").html('

'); + +// $("#debug").append(depth+"serialize()
\n"); + +// if (depth.length > 80) { +// $("#debug").append(depth+"OVERFLOW
\n"); +// return 'ABORTED'; +// } + var _getType = function( inp ) { var type = typeof inp, match; var key; @@ -233,6 +245,8 @@ function serialize( mixed_value ) { }; var type = _getType(mixed_value); var val, ktype = ''; + +// $("#debug").append(depth+"  - type: "+type+"
\n"); switch (type) { case "function": @@ -269,13 +283,16 @@ function serialize( mixed_value ) { var key; for (key in mixed_value) { ktype = _getType(mixed_value[key]); +// $("#debug").append(depth+"    - key["+count+"] type: "+type+"
\n"); if (ktype == "function") { continue; } okey = (key.match(/^[0-9]+$/) ? parseInt(key, 10) : key); - vals += serialize(okey) + - serialize(mixed_value[key]); +// $("#debug").append(depth+"    - okey: "+okey+"
\n"); +// $("#debug").append(depth+"    - mixed[key]: "+mixed_value[key]+"
\n"); + vals += serialize(okey, depth+'      ') + + serialize(mixed_value[key], depth+'      '); count++; } val += ":" + count + ":{" + vals + "}"; @@ -284,6 +301,7 @@ function serialize( mixed_value ) { if (type != "object" && type != "array") { val += ";"; } +// $("#debug").append(depth+"  - val: "+val+"
\n"); return val; }