| 1 |
- MWF.xApplication.process=MWF.xApplication.process||{};MWF.xApplication.cms.QueryViewDesigner=MWF.xApplication.cms.QueryViewDesigner||{};MWF.xApplication.cms.QueryViewDesigner.widget=MWF.xApplication.cms.QueryViewDesigner.widget||{};MWF.xDesktop.requireApp("Selector","package",null,false);MWF.xDesktop.requireApp("process.ProcessDesigner","widget.PersonSelector",null,false);MWF.require("MWF.widget.O2Identity",null,false);MWF.widget.O2CMSApplication=new Class({Extends:MWF.widget.O2Application,getPersonData:function(){if(!this.data.distinguishedName){this.action=new MWF.xDesktop.Actions.RestActions("","x_cms_assemble_control","");this.action.actions={getCMSApplication:{uri:"/jaxrs/appinfo/{id}"}};this.action.invoke({name:"getCMSApplication",async:false,parameter:{id:this.data.id||this.data.name},success:function(t){this.data=t.data;this.data.name=this.data.appName}.bind(this)})}}});MWF.widget.O2CMSCategory=new Class({Extends:MWF.widget.O2CMSApplication,getPersonData:function(){if(!this.data.distinguishedName){this.action=new MWF.xDesktop.Actions.RestActions("","x_cms_assemble_control","");this.action.actions={getCMSCategory:{uri:"/jaxrs/categoryinfo/{id}"}};this.action.invoke({name:"getCMSCategory",async:false,parameter:{id:this.data.id||this.data.name},success:function(t){this.data=t.data;this.data.name=this.data.categoryName}.bind(this)})}}});MWF.xApplication.cms.QueryViewDesigner.widget.PersonSelector=new Class({Implements:[Options,Events],Extends:MWF.xApplication.process.ProcessDesigner.widget.PersonSelector,options:{style:"default",type:"identity",names:[]},loadIdentitys:function(){var e={actions:this.restActions,app:{lp:this.app.lp}};if(this.options.names){if(this.options.type.toLowerCase()=="duty"){var t=JSON.decode(this.options.names);t.each(function(t){var i=new MWF.widget.Duty(t,this.node,e,true,function(t){var i=this;var e=this.selector.app.lp.deleteDutyText.replace(/{duty}/g,this.data.name);this.selector.app.confirm("warm",t,this.selector.app.lp.deleteDutyTitle,e,300,120,function(){i.selector.fireEvent("removeDuty",[i]);this.close()},function(){this.close()});t.stopPropagation()});i.selector=this;i.explorer=e;this.identitys.push(i)}.bind(this))}else{this.options.names.each(function(t){MWF.require("MWF.widget.O2Identity",function(){if(this.options.type.toLowerCase()=="identity")this.identitys.push(new MWF.widget.O2Identity({name:t.name,id:t.id},this.node,{}));if(this.options.type.toLowerCase()=="unit")this.identitys.push(new MWF.widget.O2Unit({name:t.name,id:t.id},this.node,{}));if(this.options.type.toLowerCase()=="person")this.identitys.push(new MWF.widget.O2Person({name:t.name,id:t.id},this.node,{}));if(this.options.type.toLowerCase()=="application")this.identitys.push(new MWF.widget.O2CMSApplication({name:t.name,id:t.id},this.node,{}));if(this.options.type.toLowerCase()=="category")this.identitys.push(new MWF.widget.O2CMSCategory({name:t.name,id:t.id},this.node,{}));if(this.options.type.toLowerCase()=="formfield")this.identitys.push(new MWF.widget.O2FormField({name:t,id:t},this.node,{}));if(this.options.type.toLowerCase()==="view")this.identitys.push(new MWF.widget.O2View(data,this.node));if(this.options.type.toLowerCase()==="cmsview")this.identitys.push(new MWF.widget.O2CMSView(data,this.node))}.bind(this))}.bind(this))}}},createAddNode:function(){this.addNode=new Element("div",{styles:this.css.addPersonNode}).inject(this.node,"before");this.addNode.addEvent("click",function(t){var i=[];this.identitys.each(function(t){i.push(t.data.id)});var e={actions:this.restActions,app:{lp:this.app.lp}};var s=this.options.type;if(s=="application"){s="CMSApplication"}else if(s=="category"){s="CMSCategory"}else if(s=="formField"){s="CMSFormField"}var n={type:s,application:this.options.application,fieldType:this.options.fieldType,count:this.options.type.toLowerCase()=="duty"?1:0,values:i,zIndex:2e4,form:this.options.form,onComplete:function(t){this.identitys=[];if(this.options.type.toLowerCase()!="duty")this.node.empty();MWF.require("MWF.widget.O2Identity",function(){t.each(function(t){if(this.options.type.toLowerCase()=="identity")this.identitys.push(new MWF.widget.O2Identity(t.data,this.node,{}));if(this.options.type.toLowerCase()=="unit")this.identitys.push(new MWF.widget.O2Unit(t.data,this.node,{}));if(this.options.type.toLowerCase()=="person")this.identitys.push(new MWF.widget.O2Person(t.data,this.node,{}));if(this.options.type.toLowerCase()=="application")this.identitys.push(new MWF.widget.O2CMSApplication(t.data,this.node,{}));if(this.options.type.toLowerCase()=="category")this.identitys.push(new MWF.widget.O2CMSCategory(t.data,this.node,{}));if(this.options.type.toLowerCase()=="formfield")this.identitys.push(new MWF.widget.O2FormField(t.data,this.node,{}));if(this.options.type.toLowerCase()==="view")this.identitys.push(new MWF.widget.O2View(data,this.node));if(this.options.type.toLowerCase()==="cmsview")this.identitys.push(new MWF.widget.O2CMSView(data,this.node))}.bind(this));if(this.options.type.toLowerCase()=="duty"){t.each(function(t){new MWF.xApplication.cms.QueryViewDesigner.widget.PersonSelector.DutyInput(this,t.data,this.node,e,2e4)}.bind(this))}this.fireEvent("change",[this.identitys])}.bind(this))}.bind(this)};var o=new MWF.O2Selector(this.app.content,n)}.bind(this))}});MWF.xApplication.cms.QueryViewDesigner.widget.PersonSelector.DutyInput=Class({Extends:MWF.xApplication.process.ProcessDesigner.widget.PersonSelector.DutyInput});
|