浏览 3446 次
锁定老帖子 主题:Ht PageView
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2011-04-06
最后修改:2011-04-06
------------------------------------------- Ext.ux.EasyComboBox=Ext.extend(Ext.form.ComboBox,{allowBlank:false,editable:false,maxHeight:200,valueField:'id',displayField:'name',triggerAction:'all',isAutoLoad:true,initComponent:function(){this.store=new Ext.data.Store({autoLoad:this.isAutoLoad,proxy:new Ext.data.HttpProxy({url:this.dataUrl}),reader:new Ext.data.JsonReader({root:"result",totalProperty:"totalCount",id:'id'},[{name:'id'},{name:'name'}])})Ext.ux.EasyComboBox.superclass.initComponent.call(this)}});Ext.reg("easycombo",Ext.ux.EasyComboBox);Ext.ux.EasyComboBox2=Ext.extend(Ext.form.ComboBox,{allowBlank:false,editable:false,maxHeight:200,valueField:'id',displayField:'name',triggerAction:'all',mode:"local",isAutoLoad:true,initComponent:function(){this.store=new Ext.data.SimpleStore({autoLoad:this.isAutoLoad,url:this.dataUrl,fields:["id","name"]})Ext.ux.EasyComboBox2.superclass.initComponent.call(this)}});Ext.reg("easycombo2",Ext.ux.EasyComboBox2);Ext.ux.EasyTreePanel=Ext.extend(Ext.tree.TreePanel,{border:false,autoScroll:true,rootVisible:false,isLoaded:false,initComponent:function(){this.loader=new Ext.tree.TreeLoader({url:this.dataUrl}),this.root=new Ext.tree.AsyncTreeNode({expanded:true,loaded:this.isLoaded}),Ext.ux.EasyTreePanel.superclass.initComponent.call(this);this.registerEvents()},clickNode:function(){},registerEvents:function(){this.on("contextmenu",this.contextmenu,this);this.on("expand",this.doExp,this);this.on("click",this.clickNode,this)},doExp:function(){if(this.isLoaded){this.root.reload();this.isLoaded=false}},clickNode:function(){},buildMenuItems:function(){this.refreshMenu=new Ext.menu.Item({text:"刷新",iconCls:"btn-refresh",handler:function(){this.root.reload()}.createDelegate(this)});this.expandMenu=new Ext.menu.Item({text:"展开",iconCls:"btn-expand",handler:function(){this.expandAll()}.createDelegate(this)});this.collapseMenu=new Ext.menu.Item({text:"收起",iconCls:"btn-collapse",handler:function(){this.collapseAll()}.createDelegate(this)})},buildMenuList:function(){this.menuList=[this.refreshMenu,'-',this.expandMenu,this.collapseMenu]},contextmenu:function(n,o){this.buildMenuItems();this.buildMenuList();this.treeMenu=new Ext.menu.Menu({items:this.menuList})this.treeMenu.showAt(o.getXY())}});Ext.reg("easytree",Ext.ux.EasyTreePanel); ---------------------------------------------- var MailFormView=function(b,c,a){return this.setup(b,c,a)};MailFormView.prototype.setup=function(d,j,a){var h=this.initToolbar();var e=new copyFieldItems();var g=new Ext.data.JsonReader({root:"data"},[{name:"mail.recipientids",mapping:"recipientids"},{name:"mail.copytoids",mapping:"copytoids"},{name:"mail.status",mapping:"status"},{name:"mail.fileids",mapping:"fileids"},{name:"mail.id",mapping:"id"},{name:"mail.recipientnames",mapping:"recipientnames"},{name:"mail.subject",mapping:"subject"},{name:"mail.importantflag",mapping:"importantflag"},{name:"mail.filenames",mapping:"filenames"},{name:"mail.content",mapping:"content"},{name:"mail.copytonames",mapping:"copytonames"}]);var b=new Ext.FormPanel({url:"talkpark/mail!save.do",id:"mailFormPanel",border:false,frame:true,autoHeight:true,reader:g,items:[{fieldLabel:"收件人ID列表用,分隔",name:"mail.recipientids",id:"mail.recipientids",xtype:"hidden"},{fieldLabel:"抄送人ID列表用,分开",name:"mail.copytoids",id:"mail.copytoids",xtype:"hidden"},{fieldLabel:"邮件状态",name:"mail.status",id:"mail.status",xtype:"hidden",value:1},{fieldLabel:"附件IDs",name:"mail.fileids",xtype:"hidden",id:"mail.fileids"},{fieldLabel:"BOXID",name:"boxId",xtype:"hidden",id:"mailBoxId"},{fieldLabel:"MailId",name:"mail.id",xtype:"hidden",id:"mail.id"},{fieldLabel:"操作",name:"replyBoxId",xtype:"hidden",id:"mail.replyBoxId"},{fieldLabel:"附件名称列表",name:"mail.filenames",xtype:"hidden",id:"mail.filenames"},{fieldLabel:"主题",xtype:"textfield",name:"mail.subject",id:"mail.subject",allowBlank:false,width:530,blankText:"邮件主题为必填"},{xtype:"container",layout:"column",height:32,defaultType:"textfield",items:[{xtype:"label",text:"收件人:",style:"padding-left:0px;padding-top:3px;",width:106},{width:280,fieldLabel:"收件人姓名列表",name:"mail.recipientnames",id:"mail.recipientnames",allowBlank:false,blankText:"请选择收件人",readOnly:true},{xtype:"button",text:"选择收件人",iconCls:"btn-mail_recipient",handler:function(){oa.sky.userSelector("mail.recipientids","mail.recipientnames")}},{xtype:"button",text:"清除收件人",iconCls:"icon-clear",handler:function(){var recipientids=Ext.getCmp('mail.recipientids');var recipientnames=Ext.getCmp('mail.recipientnames');recipientids.setValue("");recipientnames.setValue("")}},{xtype:"button",text:"我要抄送",iconCls:"btn-mail_copy",handler:function(){var k=Ext.getCmp("copyField");var copytonamesBlank=Ext.getCmp('mail.copytonames');copytonamesBlank.allowBlank=false;copytonamesBlank.blankText="请选择抄送人";k.show()}}]},{xtype:"container",id:"copyField",layout:"column",height:32,hidden:true,defaultType:"textfield",items:[e]},{xtype:"container",layout:"column",height:32,defaultType:"textfield",style:"padding-left:0px;",items:[{xtype:"label",text:"优先级:",style:"padding-left:0px;padding-top:3px;",width:105},{width:350,fieldLabel:"邮件优先级",hiddenName:"mail.importantflag",id:"mailImportantFlag",xtype:"combo",mode:"local",editable:false,value:"1",triggerAction:"all",store:[["1","一般"],["2","重要"],["3","非常重要"]]},{xtype:"checkbox",name:"sendMessage",boxLabel:"告诉他有信"}]},{xtype:"container",layout:"column",autoHeight:true,defaultType:"textfield",items:[{xtype:"label",text:"附件:",width:105},{xtype:"panel",width:355,layout:"column",name:"filenames.display",defaults:{border:false},id:"filenames.display",items:[{xtype:"label",height:40,id:"placeholder"}]},{xtype:"button",text:"上传",iconCls:"btn-upload",handler:function(){var k=App.createUploadDialog({file_cat:"talkpark",callback:uploadMailAttach});k.show()}}]},{fieldLabel:"内容",name:"mail.content",id:"mail.content",xtype:"htmleditor"}]});if(d!=null&&d!="undefined"){var i=Ext.getCmp("mail.id");i.setValue(d);if(a=="draft"){b.getForm().load({deferredRender:false,url:"talkpark/mail/get-mail!getMailInfo.do?",method:"post",params:{mailId:d,folderId:3,boxId:j},waitMsg:"正在载入数据...",success:function(k,m){var r=Ext.getCmp("mail.copytoids");if(r.value!=""&&r.value!=null){var l=Ext.getCmp("copyField");l.show()}var p=Ext.getCmp("mail.filenames").value;if(p!=""&&p!=null){var q=Ext.getCmp("filenames.display");var s=Ext.getCmp("placeholder");if(s!=null){s.hide()}var t=p.split(",");var o=Ext.getCmp("mail.fileids").value.split(",");for(var n=0;n<t.length;n++){q.add(new Ext.form.FieldSet({border:false,frame:false,id:"mailAttachDisplay"+o[n],columnWidth:0.5,html:'<IMG src="'+__ctxPath+'/images/flag/attachment.png"> '+t[n]+' <A href="javascript:deleteAttach('+o[n]+')">删除</A>'}))}q.doLayout(true)}},failure:function(k,l){}})}else{if(a=="reply"){b.getForm().load({deferredRender:false,url:"talkpark/mail!optMail.do",method:"post",params:{mailId:d,boxId:j,opt:"回复"},waitMsg:"正在载入数据...",success:function(k,l){Ext.getCmp("mail.replyBoxId").setValue(j)},failure:function(k,l){}})}else{if(a=="forward"){var p=Ext.getCmp("mail.filenames").value;b.getForm().load({deferredRender:false,url:"talkpark/mail!optMail.do",method:"post",params:{mailId:d,opt:"转发"},waitMsg:"正在载入数据...",success:function(k,l){var p=Ext.getCmp("mail.filenames").value;if(p!=""&&p!=null){var q=Ext.getCmp("filenames.display");var s=Ext.getCmp("placeholder");if(s!=null){s.hide()}var t=p.split(",");var o=Ext.getCmp("mail.fileids").value.split(",");for(var n=0;n<t.length;n++){q.add(new Ext.form.FieldSet({border:false,frame:false,id:"mailAttachDisplay"+o[n],columnWidth:0.5,html:'<IMG src="'+__ctxPath+'/images/flag/attachment.png"> '+t[n]+' <SPAN style="DISPLAY: none"><A href="javascript:deleteAttach('+o[n]+')">删除</A></SPAN>'}))}q.doLayout(true)}},failure:function(k,l){}})}}}}if(j!=null&&j!="undefined"){var f=Ext.getCmp("mailBoxId");f.setValue(j)}var c=new Ext.Panel({title:"发送邮件",iconCls:"menu-mail_send",autoScroll:true,tbar:h,id:"MailFormView",layout:"hbox",margins:"0 0 6 0",layoutConfig:{padding:"5",pack:"center",align:"middle"},defaults:{margins:"0 5 0 0"},items:[b]});return c};MailFormView.prototype.initToolbar=function(){var a=new Ext.Toolbar({height:30,items:[{text:"立即发送",iconCls:"btn-mail_send",handler:function(){var c=Ext.getCmp("mailFormPanel");var b=Ext.getCmp("mail.status");if(c.getForm().isValid()){b.setValue(1);c.getForm().submit({waitMsg:"正在发送邮件,请稍候...",success:function(d,e){Ext.Msg.confirm("操作信息","邮件发送成功!继续发邮件?",function(g){if(g=="yes"){c.getForm().reset()}else{var f=Ext.getCmp("centerTabPanel");f.remove("MailFormView")}})},failure:function(d,e){Ext.ux.Toast.msg("错误信息",e.result.msg)}})}}},{text:"存草稿",iconCls:"btn-mail_save",handler:function(){var c=Ext.getCmp("mail.status");c.setValue(0);var b=Ext.getCmp("mailFormPanel");if(b.getForm().isValid()){b.getForm().submit({waitMsg:"正在保存草稿,请稍候...",success:function(d,e){Ext.Msg.confirm("操作信息","草稿保存成功!继续发邮件?",function(g){if(g=="yes"){b.getForm().reset()}else{var f=Ext.getCmp("centerTabPanel");f.remove("MailFormView")}})},failure:function(d,e){Ext.ux.Toast.msg("错误信息",e.result.msg)}})}}},{text:"重置",iconCls:"reset",handler:function(){alert(0);var b=Ext.getCmp("mailFormPanel");b.getForm().reset()}},{text:"取消",iconCls:"btn-mail_remove",handler:function(){var b=Ext.getCmp("centerTabPanel");b.remove("MailFormView")}}]});return a};function copyFieldItems(){var a=[{xtype:"label",text:"抄送人:",style:"padding-left:0px;padding-top:3px;",width:105},{width:280,fieldLabel:"抄送人姓名列表",name:"mail.copytonames",id:"mail.copytonames",readOnly:true},{xtype:"button",text:"选择抄送人",iconCls:"btn-mail_recipient",handler:function(){oa.sky.userSelector("mail.copytoids","mail.copytonames")}},{xtype:"button",text:"清除抄送人",iconCls:"icon-clear",handler:function(){var copytoids=Ext.getCmp('mail.copytoids');var copytonames=Ext.getCmp('mail.copytonames');copytoids.setValue("");copytonames.setValue("")}},{xtype:"button",text:"取消抄送",iconCls:"btn-delete_copy",handler:function(){var b=Ext.getCmp("copyField");var c=Ext.getCmp("mail.copytoids");var u=Ext.getCmp("mail.copytonames");c.setValue("");u.setValue("");u.allowBlank=true;u.blankText="";b.hide()}}];return a}function uploadMailAttach(d){var a=Ext.getCmp("mail.fileids");var c=Ext.getCmp("mail.filenames");var e=Ext.getCmp("filenames.display");var f=Ext.getCmp("placeholder");if(f!=null){f.hide()}for(var b=0;b<d.length;b++){if(a.getValue()!=""){a.setValue(a.getValue()+",");c.setValue(c.getValue()+",")}a.setValue(a.getValue()+d[b].fileId);c.setValue(c.getValue()+d[b].filename);e.add(new Ext.form.FieldSet({id:"mailAttachDisplay"+d[b].fileId,columnWidth:1,html:'<IMG src="'+__ctxPath+'/images/flag/attachment.png"> '+d[b].filename+' <A href="javascript:deleteAttach('+d[b].fileId+')">删除</A>'}))}e.doLayout(true)}function deleteAttach(f){var b=Ext.getCmp("mail.fileids").value.split(",");var j=Ext.getCmp("mail.filenames").value.split(",");var h="";var d="";for(var c=0;c<b.length;c++){if(b[c]!=f){h+=b[c]+",";d+=j[c]+","}}if(h!=""){h=h.substring(0,h.length-1);d=d.substring(0,d.length-1)}Ext.getCmp("mail.fileids").setValue(h);Ext.getCmp("mail.filenames").setValue(d);var e=Ext.getCmp("filenames.display");var a=Ext.getCmp("mailAttachDisplay"+f);e.remove(a);if(Ext.getCmp("mail.fileids").value==""){Ext.getCmp("placeholder").show()}e.doLayout(true);var g=Ext.getCmp("mail.id").value;if(g!=""&&g!="undefined"&&g!=null){Ext.Ajax.request({url:__ctxPath+"/talkpark/mail!addFileMail.do",method:"post",params:{mailId:g,fileId:f,fileIds:h,filenames:d},success:function(){Ext.ux.Toast.msg("信息提示","成功删除记录!")}})}else{Ext.Ajax.requesta({url:__ctxPath+"/docs/file-attach!delete.do",params:{id:f},method:"post",success:function(){Ext.ux.Toast.msg("信息提示","成功删除所选记录!")}})}} 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |