Edit C:\Users\Administrator\Desktop\Back\galaxie - Copy\js\edeal\models\wallPost.js
Models.WallPost = Models.Value.extend({ classType: "MODELS.WALLPOST", date: null, targetobject: null, eventtype: null, changes: null, postInitialize: function() { //transform comments from an array to a collection of MODELS.WALLPOST if (!this.get("comment")) { this.set("comment", ""); } else { //this.set("comment", decodeURIComponent(this.get("comment")));Pe } if (this.get("comments")) { var commentsCollection = new Models.WallPostCollection(this.get("comments")); this.set("comments", commentsCollection); } else { this.set("comments", new Models.WallPostCollection()); } //parse old and new values if (this.get("changes")) { var newChanges = this.get("changes"); for (var j=0; j<newChanges.length;j++) { newChanges[j].newvalue = this.cleanValue(newChanges[j].newvalue); newChanges[j].oldvalue = this.cleanValue(newChanges[j].oldvalue); } this.set("changes", newChanges); } }, cleanValue: function(str) { var toReturn = str; if (str.substring(0,1) == "[") { toReturn = str.substring(1, str.length - 1); } if (toReturn.substring(toReturn.length -1) == "]") { toReturn = toReturn.substring(0, toReturn.length -1); } return toReturn; }, getAdditionalJSONObject: function() { var comments = ""; var istherecomments = false; var nbcomments = 0; var isgroupactormessage = false; nbcomments = this.get("nbcomment"); if (nbcomments > 0) { istherecomments = true; } if (this.get("comments")) { if (istherecomments) { comments = JSON.stringify(this.get("comments")); } } var comment = ""; if (this.get("comment")) { //comment = unescape(this.get("comment")); comment = this.get("comment"); } var nbchanges = 0; var istherechanges = false; if (this.get("changes")) { //comment = unescape(this.get("comment")); nbchanges = this.get("changes").length; if (nbchanges > 0) { istherechanges = true; } } if (this.get("targetobject")) { if (this.get("targetobject").object == "GroupActor") { isgroupactormessage = true; } if (this.get("targetobject").object.match(/^[a-z]*$|^[A-Z]*$/)) this.get("targetobject").object = this.get("targetobject").object.toLowerCase(); } var toReturn = { date: this.get("date"), targetobject: this.get("targetobject"), actor: this.get("actor"), isgroupactormessage: isgroupactormessage, eventtype: this.get("eventtype"), changes: this.get("changes"), iscreationevent: (this.get("eventtype")=="CREATION"), isfusionevent: (this.get("eventtype")=="FUSION"), isdeletable: this.get("isdeletable"), iscommentable: this.get("iscommentable"), amiowner: (this.get("actor").id==edContext().actorId), comments: comments, comment: comment, //comment: this.get("comment"), nbcomments: nbcomments, istherecomments: istherecomments, nbchanges: nbchanges, istherechanges: istherechanges }; //toReturn.targetobject.objectName = JSON.stringify(toReturn.targetobject.objectName); //console.log(toReturn.targetobject.objectName); //console.log(toReturn.targetobject.objectName.replace(new RegExp('"', 'g'), '\"')); return toReturn; } }); Models.WallPostCollection = Models.BaseCollection.extend({ classType: "MODELS.WALLPOSTCOLLECTION", model: Models.WallPost, getAdditionalJSONObject: function() { var toReturn = { iscommentable: this.iscommentable }; return toReturn; } });
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de