Edit C:\Users\Administrator\Desktop\Back\galaxie - Copy\js\edeal\views\correspondent.js
Views.Correspondent = Views.Base.extend({ classType: "Views.Correspondent", tagName: "div", listenEvents: function() { //See Views.Base listenDefaultEvents() this.on("oninitialize", this.onInitialize); this.on("onrender", this.onRender); }, triggerEventsOn: function() { //See Views.Base launchDefaultActionsOn() }, triggerAddModelToCollectionOn: function() { var that = this; this.on("onmodelchange", function(event) { that.trigger("onaddmodeltocollection"); }); }, selectTemplate: function() { if (this.isCorrespondent) { return this.options.descriptor.templates.correspondent; } else { return this.options.descriptor.templates.enterprisePerson; } }, hide: function(callback) { //this.$el.animate({height:'0px'}, 100, callback); var that = this; this.$el.slideUp(100, function() { if (callback) { callback(); } that.trigger("onhide"); }); this.options.isShowed = false; }, show: function(callback) { //this.$el.animate({height:'0px'}, 100, callback); var that = this; this.$el.slideDown(100, function() { if (callback) { callback(); } that.trigger("onshow"); }); this.options.isShowed = true; }, onInitialize: function() { //if we have a correspondentId, use a readonly template //if we have an enterpriseId or a personId, use an editable template this.isCorrespondent = false; if (this.model.get("correspondentId") || this.model.get("enterpriseId") || this.model.get("personId")) { this.isCorrespondent = true; } }, onRender: function() { if (!this.isCorrespondent) { this.enterpriseEl = $("#enterprise_" + this.id, this.$el); this.enterpriseView = edManager.getViewByID("enterprise_" + this.id); this.enterpriseEl.on("change", {view: this}, function(event) { event.data.view.selectPersonEl(); }); this.personAutoCompleteEl = $("#person_autocomplete_" + this.id, this.$el); this.personAutoCompleteView = edManager.getViewByID("person_autocomplete_" + this.id); this.personAutoFilterEl = $("#person_autofilter_" + this.id, this.$el); this.personAutoFilterView = edManager.getViewByID("person_autofilter_" + this.id); this.personAutoFilterView.on("onrender", function(event) { if (this.options.possiblevalues.length == 0) { this.$el.attr("disabled", true); } else { this.$el.removeAttr("disabled"); } }); this.selectPersonEl(); this.personAutoFilterEl.hide(); } }, selectPersonEl: function() { if (this.enterpriseView.model.get("value") != "") { this.personAutoCompleteView.hide(); //Immediately call the web service in order to fill the model var url = edApplication().path + "getEnterprisePersons.fl"; var data = { entId: this.enterpriseView.model.get("value") }; $.ajax({ url: url , data: data, dataType:"json", context: this, statusCode: { 500: function() { console.log("autocomplete error 500"); } }, success: function(data, textStatus, jqXHR) { if (data.results) { var newPossibleValues = new Models.PossibleValueCollection(); newPossibleValues.initFromObjectArray(data.results); this.personAutoFilterView.options.possiblevalues = newPossibleValues; this.personAutoFilterView.render(); this.personAutoFilterView.show(); } }, error: function(jqXHR, textStatus, errorThrown) { console.log("error :"); console.log("jqXHR :"); console.log(jqXHR); console.log("textStatus :"); console.log(textStatus); console.log("errorThrown :"); console.log(errorThrown); } }); } else { this.personAutoCompleteView.show(); this.personAutoFilterView.hide(); } }, resetAddEl: function() { // this.$el.val(""); }, resetEl: function() { }, //return a Model.Value getModelValueFromInput: function(aString) { var aModelValue = this.model; /*aModelValue.set("value", aString); var aPossibleValue = this.options.possiblevalues.getByProperty("value", aString); if (aPossibleValue) { aModelValue.set("label", aPossibleValue.get("label")); }*/ return aModelValue; } }); Views.CorrespondentList = Views.BaseList.extend({ classType: "Views.CorrespondentList", listenEvents: function() { //See Views.Base listenDefaultEvents() this.on("oninitialize", this.onInitialize); this.on("onremovemodelfromcollection ", function() { this.resetEl(); }); this.on("onrenderlist", function() { this.resetEl(); }); }, onInitialize: function() { if (!this.options.actions) { this.options.actions = {}; } if (!this.options.actions.add) { this.options.actions.add = {}; } if (!this.options.actions.remove) { this.options.actions.remove = {}; } if (!this.options.actions.remove.button) { this.options.actions.remove.button = {}; } this.options.actions.add.active = true; //this.options.actions.add.authorizedouble = true; this.options.actions.remove.active = true; this.options.actions.remove.button.position = { my: "left center", at: "left center", collision: "none" }; if (!this.options.actions.sort) { this.options.actions.sort = {}; this.options.actions.sort.active = false; } if (!this.options.actions.sort.button) { this.options.actions.sort.button = {}; } this.options.actions.sort.button.position = { my: "left center", at: "left center", collision: "none" }; }, resetEl: function() { var that = this; var addAction = this.options.actions.add; var authorizedouble = addAction.authorizedouble; if (addAction.view) { addAction.view.resetAddEl(); } this.model.each(function(item) { var view = item.view; if (view) { if (!authorizedouble) { view.resetEl(); } //$('option[value=""]', view.$el).html(edApplication().labels.LABELRESETTHEVALUE); view.$el.on("change", function(event) { that.resetEl(); }); } }); } });
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de