Edit C:\Users\Administrator\Desktop\Back\galaxie - Copy\js\edeal\views\mailRecipient.js
Views.MailRecipient = Views.Base.extend({ classType: "Views.MailRecipient", tagName: "div", listenEvents: function() { this.on("onrender", this.onRender); this.options.mailinput.separator = this.options.mailinput.separator ? this.options.mailinput.separator : "|"; this.options.personinput.separator = this.options.personinput.separator ? this.options.personinput.separator : "|"; this.options.actorinput.separator = this.options.actorinput.separator ? this.options.actorinput.separator : "|"; }, onRender: function() { this.mailInputTo = this.$el.find(".To input.mail"); this.mailInputCc = this.$el.find(".Cc input.mail"); this.mailInputCci = this.$el.find(".Cci input.mail"); this.actorInput = this.$el.find("input.actor"); this.personInput = this.$el.find("input.person"); this.correspondentInput = this.$el.find("input.correspondent"); this.recipientListViewTo = edManager.getViewByID(this.$el.find(".To .mailRecipientItemList").attr('id')); this.recipientListViewTo.model.on("change", $.proxy(this.onMailListUpdatedTo, this)); this.recipientListViewTo.model.on("add", $.proxy(this.onMailListUpdatedTo, this)); this.recipientListViewTo.model.on("remove", $.proxy(this.onMailListUpdatedTo, this)); this.recipientListViewCc = edManager.getViewByID(this.$el.find(".Cc .mailRecipientItemList").attr('id')); this.recipientListViewCc.model.on("change", $.proxy(this.onMailListUpdatedCc, this)); this.recipientListViewCc.model.on("add", $.proxy(this.onMailListUpdatedCc, this)); this.recipientListViewCc.model.on("remove", $.proxy(this.onMailListUpdatedCc, this)); this.recipientListViewCci = edManager.getViewByID(this.$el.find(".Cci .mailRecipientItemList").attr('id')); this.recipientListViewCci.model.on("change", $.proxy(this.onMailListUpdatedCci, this)); this.recipientListViewCci.model.on("add", $.proxy(this.onMailListUpdatedCci, this)); this.recipientListViewCci.model.on("remove", $.proxy(this.onMailListUpdatedCci, this)); if (this.options.values && this.options.values.get("To")) { this.recipientListViewTo.model.add(this.options.values.get("To")); } if (this.options.values && this.options.values.get("Cc")) { this.recipientListViewCc.model.add(this.options.values.get("Cc")); } if (this.options.values && this.options.values.get("Cci")) { this.recipientListViewCci.model.add(this.options.values.get("Cci")); } }, onMailListUpdatedTo: function () { this.onMailListUpdated(this.mailInputTo, this.recipientListViewTo); }, onMailListUpdatedCc: function () { this.onMailListUpdated(this.mailInputCc, this.recipientListViewCc); }, onMailListUpdatedCci: function () { this.onMailListUpdated(this.mailInputCci, this.recipientListViewCci); }, onMailListUpdated: function (mailInput, recipientListView) { var mailInputValues = []; var actorInputValues = []; var personInputValues = []; var correspondentInputValues = []; for (var i=0; i<recipientListView.model.length; i++) { var data = recipientListView.model.at(i); mailInputValues.push(data.get("email")); } this.populateActorAndCorrespondantIDList(actorInputValues, personInputValues, correspondentInputValues, this.recipientListViewTo); this.populateActorAndCorrespondantIDList(actorInputValues, personInputValues, correspondentInputValues, this.recipientListViewCc); this.populateActorAndCorrespondantIDList(actorInputValues, personInputValues, correspondentInputValues, this.recipientListViewCci); mailInput.val(mailInputValues.join(this.options.mailinput.separator)); this.actorInput.val(actorInputValues.join(this.options.actorinput.separator)); this.personInput.val(personInputValues.join(this.options.personinput.separator)); this.correspondentInput.val(correspondentInputValues.join(this.options.correspondentinput.separator)); }, populateActorAndCorrespondantIDList: function (actorList, personList, correspondentInputValues, recipientList) { var model = recipientList.model; for (var i=0; i< model.length; i++) { var data = model.at(i); if (data.get("type") == "Actor" && actorList.indexOf(data.get("id"))<0) { actorList.push(data.get("id")); } if (data.get("type") == "Person" && personList.indexOf(data.get("id"))<0) { personList.push(data.get("id")); correspondentInputValues.push(data.get("correspondentID")); } } } }); Views.MailRecipientItem = Views.Base.extend({ classType: "Views.MailRecipientItem", tagName: "div", listenEvents: function() { this.on("onrender", this.onRender); this.on("oninitialize", this.onInitialize); this.on("onshow", function() { // For init in case or we are in a clone model this.chooseEmail(); }); }, triggerAddModelToCollectionOn: function() { var that = this; this.on("onemailchoosed", function(event) { that.trigger("onaddmodeltocollection"); }); }, onInitialize: function() { }, onRender: function() { this.result = this.$el.find(".result"); this.autoCompleteFieldView = edManager.getViewByID(this.$el.find(".autoCompleteInput").attr('id')); this.autoCompleteFieldView.on("onmodelchange", $.proxy(this.autoCompletionDone, this)); this.autoCompleteFieldView.on("onautocompleteresponse", $.proxy(function (apiData) { this.setExcludeIDs(); this.apiData = apiData; }, this)); this.autoCompleteFieldView.on("onblur", $.proxy(function () { this.autoCompleteFieldView.$el.val(""); }, this)); }, autoCompletionDone: function () { id = this.autoCompleteFieldView.model.attributes.value; if(id) { data = this.apiData.extraDatas[id]; data = data?data:{}; data.searched = this.apiData.searched; this.model.set(data); this.chooseEmail(); this.trigger("onemailchoosed"); } else { data = {}; data.searched = this.apiData.searched; this.model.set(data); this.chooseEmail(); } }, chooseEmail: function () { var id = this.model.get("id"); var toString = this.model.get("label"); this.model.set("value", id); var searched = this.model.get("searched"); this.$el.parent().removeClass("noemail"); if(id) { this.autoCompleteFieldView.hide(); var email = this.model.get("email")?this.model.get("email"):""; this.result.find("span").html(toString+" ("+email+")"); this.result.show(); this.autoCompleteFieldView.initSearchField(searched); if(!this.model.get("email")) this.$el.parent().addClass("noemail"); } else { this.autoCompleteFieldView.show(); this.result.find("span").html(""); this.result.hide(); this.autoCompleteFieldView.initSearchField(searched); } }, resetAddEl: function () { Backbone.Model.prototype.clear.apply(this.model); this.autoCompleteFieldView.resetAddEl(); this.chooseEmail(); }, setExcludeIDs: function () { var allRecipient = this.options.parentview.model; var allIDs = []; for (var i=0; i<allRecipient.length; i++) { allIDs.push (allRecipient.at(i).get("id")); } this.autoCompleteFieldView.setExcludeValues(allIDs); } }); Views.MailRecipientItemList = Views.BaseList.extend({ classType: "Views.MailRecipientItemList", tagName: "div", listenEvents: function() { this.on("oninitialize", this.onInitialize); this.on("onshow", this.onRender); }, onInitialize: function() { }, onRender: function() { console.log("list rendered"); }, onAdvancedSearchPerson: function (ids) { this.onAdvancedSearchIds(ids, "PerIDs"); }, onAdvancedSearchCorrespondent: function (ids) { this.onAdvancedSearchIds(ids, "CorIDs"); }, onAdvancedSearchActor: function (ids) { this.onAdvancedSearchIds(ids, "ActIDs"); }, onAdvancedSearchIds: function (ids, fieldname) { idsArray = new Array() ; for (var i=0; i<ids.size(); i++) { idsArray.push(ids.elementAt(i)); } var url = this.options.getemailfromidaction; url += url.indexOf('?')<0?"?":"&"; url += fieldname+"="+idsArray.join("|"); $.getJSON(url, $.proxy(function(data) { //this.model.reset(); //this.render(); this.model.setValue(data); }, this)); } });
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de