Base = XObject.define(
function(cfg) {
-
+
XObject.extend(this, cfg);
+
},
Object,
{
+ /**
+ * @cfg {Array} doubleStringProps list of properties that can be double quoted.
+ */
+ doubleStringProps : false,
id : false,
name : false, // is the JS name of the file.
{
var ret = { };
var _this = this;
- ['id', 'name', 'parent', 'title', 'path', 'items' ].forEach( function(k) {
- ret[k] = _this[k];
+ ['id', 'name', 'parent', 'title', 'path', 'items' , 'permname' ].forEach( function(k) {
+ ret[k] = typeof(_this[k]) == 'undefined' ? '' _this[k];
});
return ret;
},
left = "'" + leftv + "'";
} else if (leftv.match(/[^A-Z_]+/i)) { // not plain a-z... - quoted.
var val = JSON.stringify(leftv);
- left = "'" + val.substring(1, val.length-1).replace(/'/, "\\'") + "'";
+ left = "'" + val.substring(1, val.length-1).replace(/'/g, "\\'") + "'";
} else {
left = '' + leftv;
}
return;
}
// standard. .
+ if (typeof(obj[i]) != 'string') {
+ els.push(left + JSON.stringify(obj[i]));
+ return;
+ }
+ // strings..
+ if (!_this.doubleStringProps) {
+ els.push(left + JSON.stringify(obj[i]));
+ return;
+ }
+ if (_this.doubleStringProps.indexOf(i) > -1) {
+ els.push(left + JSON.stringify(obj[i]));
+ return;
+ }
+ // single quote..
+ els.push(left + "'" + obj[i].replace(/'/g, "\\'") + "'");
- els.push(left + JSON.stringify(obj[i]));
+
});
if (!isArray && !els.length) {
}
+
+
+
);