Ext.namespace("Zarafa.widgets");
Zarafa.widgets.AbstractQuickItemWidget=Ext.extend(Zarafa.core.ui.widget.Widget,{record:undefined,wrapCfg:undefined,wrap:undefined,resetOnSave:true,resetOnSend:true,hasDialog:true,constructor:function(a){a=a||{};a.wrapCfg=Ext.applyIf(a.wrapCfg||{},{useShadowStore:false,stateful:false,height:200,closeOnSave:false,closeOnSend:false});this.wrap=new Zarafa.core.ui.MessageDialog(a.wrapCfg);this.wrap.update=this.update.createDelegate(this);this.wrap.updateRecord=this.updateRecord.createDelegate(this);Ext.applyIf(a,
{name:"quickitem",title:_("Quick Item"),layout:"fit",items:[this.wrap]});Zarafa.widgets.AbstractQuickItemWidget.superclass.constructor.call(this,a);this.hasDialog&&this.tools.unshift({id:"plus",handler:this.dialog,scope:this});this.mon(this,"afterlayout",this.onAfterFirstLayout,this,{single:true});this.resetOnSave&&this.mon(this.wrap,"aftersaverecord",this.reset,this,{buffer:1});this.resetOnSend&&this.mon(this.wrap,"aftersendrecord",this.reset,this,{buffer:1})},dialog:function(){this.wrap.inputAutoFocusPlugin.beginFocusEl.focus();
this.wrap.saveRecord(false);Zarafa.common.Actions.openCreateRecord(this.record);this.record=null;this.reset()},reset:function(){var a=container.getShadowStore();this.record&&a.remove(this.record,true);this.record=this.createRecord();a.add(this.record);this.wrap.setRecord(this.record)},createRecord:Ext.emptyFn,update:Ext.emptyFn,updateRecord:Ext.emptyFn,onAfterFirstLayout:function(){var a=container.getHierarchyStore();a.getDefaultStore()?this.reset():this.mon(a,"load",this.reset,this,{single:true})},
onDestroy:function(){Zarafa.widgets.AbstractQuickItemWidget.superclass.onDestroy.apply(this,arguments);this.record&&container.getShadowStore().remove(this.record,true)}});Ext.namespace("Zarafa.widgets");
Zarafa.widgets.QuickTaskWidget=Ext.extend(Zarafa.widgets.AbstractQuickItemWidget,{constructor:function(a){a=a||{};Ext.applyIf(a,{name:"quicktask",title:_("Quick Task"),wrapCfg:{allowWrite:true,layout:"fit",items:[{xtype:"form",ref:"formPanel",layout:{type:"vbox",align:"stretch"},border:false,bodyStyle:"background-color: inherit; padding: 5px;",defaults:{border:false,labelLength:100,style:"padding-bottom: 2px"},items:[{xtype:"zarafa.compositefield",hideLabel:true,anchor:"100%",items:[{xtype:"label",
width:100,text:_("Subject")+":"},{xtype:"textfield",flex:1,name:"subject",value:undefined,listeners:{change:this.onChange,scope:this}}]},{xtype:"zarafa.compositefield",hideLabel:true,anchor:"100%",items:[{xtype:"label",width:100,text:_("End time")+":"},{xtype:"datefield",ref:"../../dueDateField",emptyText:_("None"),flex:1,name:"commonend",utcname:"duedate",format:_("d/m/Y"),minValue:new Date,listeners:{change:this.onDueDateChange,scope:this}}]},{xtype:"zarafa.editorfield",ref:"../editorField",htmlName:"html_body",
plaintextName:"body",hideLabel:true,flex:1,useHtml:false,defaultValue:"",listeners:{change:this.onBodyChange,scope:this}}]}]},buttons:[{text:_("Save"),handler:this.onSave,scope:this},{text:_("Discard"),handler:this.onDiscard,scope:this}]});Zarafa.widgets.QuickTaskWidget.superclass.constructor.call(this,a)},onChange:function(a,b){this.wrap.record.set(a.name,b)},onDueDateChange:function(a,b){if(Ext.isDate(b)){this.wrap.record.set(a.name,b.clone());this.wrap.record.set(a.utcname,b.toUTC(true))}else{this.wrap.record.set(a.name,
null);this.wrap.record.set(a.utcname,null)}},onBodyChange:function(a,b){this.wrap.record.beginEdit();a instanceof Ext.form.HtmlEditor?this.wrap.record.set("isHTML",true):this.wrap.record.set("isHTML",false);this.wrap.record.set(a.name,b);this.wrap.record.endEdit()},createRecord:function(){var a=container.getHierarchyStore().getDefaultFolder("task");return container.getContextByName("task").getModel().createRecord(a)},update:function(a){this.wrap.formPanel.getForm().loadRecord(a)},updateRecord:function(a){a.beginEdit();
this.wrap.formPanel.getForm().updateRecord(a);this.onDueDateChange(this.wrap.dueDateField,this.wrap.dueDateField.getValue());this.onBodyChange(this.wrap.editorField,this.wrap.editorField.getValue());a.endEdit()},onSave:function(){this.wrap.saveRecord()},onDiscard:function(){this.reset()}});Zarafa.onReady(function(){container.registerWidget(Zarafa.widgets.QuickTaskWidget,"quicktask",_("Quick Task"),"plugins/quickitems/resources/images/quicktask.png")});Ext.namespace("Zarafa.widgets");
Zarafa.widgets.QuickNoteWidget=Ext.extend(Zarafa.widgets.AbstractQuickItemWidget,{currentColorCls:undefined,constructor:function(a){a=a||{};Ext.applyIf(a,{name:"quicknote",title:_("Quick Note"),wrapCfg:{allowWrite:true,layout:"fit",items:[{xtype:"form",ref:"formPanel",layout:"fit",items:[{xtype:"textarea",ref:"../editorField",name:"body",listeners:{change:this.onChange,scope:this}}]}]},buttons:[{text:_("Save"),handler:this.onSave,scope:this},{text:_("Discard"),handler:this.onDiscard,scope:this}]});
Zarafa.widgets.QuickNoteWidget.superclass.constructor.call(this,a)},onChange:function(a,b){this.wrap.record.set(a.name,b)},createRecord:function(){var a=container.getHierarchyStore().getDefaultFolder("note");return container.getContextByName("note").getModel().createRecord(a)},update:function(a,b){this.wrap.formPanel.getForm().loadRecord(a);if(b||a.isModifiedSinceLastUpdate("icon_index")){var c;switch(a.get("icon_index")){case Zarafa.core.mapi.IconIndex.note_blue:c="stickynote_dialog_blue";break;
case Zarafa.core.mapi.IconIndex.note_green:c="stickynote_dialog_green";break;case Zarafa.core.mapi.IconIndex.note_pink:c="stickynote_dialog_pink";break;case Zarafa.core.mapi.IconIndex.note_yellow:default:c="stickynote_dialog_yellow";break;case Zarafa.core.mapi.IconIndex.note_white:c="stickynote_dialog_white";break}this.wrap.editorField.removeClass(this.currentColorCls);this.currentColorCls=c;this.wrap.editorField.addClass(this.currentColorCls)}},updateRecord:function(a){a.beginEdit();this.wrap.formPanel.getForm().updateRecord(a);
this.record.generateSubject();a.endEdit()},onSave:function(){this.wrap.saveRecord()},onDiscard:function(){this.reset()}});Zarafa.onReady(function(){container.registerWidget(Zarafa.widgets.QuickNoteWidget,"quicknote",_("Quick Note"),"plugins/quickitems/resources/images/quicknote.png")});Ext.namespace("Zarafa.widgets");
Zarafa.widgets.QuickMailWidget=Ext.extend(Zarafa.widgets.AbstractQuickItemWidget,{useHtml:false,constructor:function(a){a=a||{};Ext.applyIf(a,{name:"quickmail",title:_("Quick Mail"),wrapCfg:{allowWrite:true,layout:"fit",items:[{xtype:"form",ref:"formPanel",layout:{type:"vbox",align:"stretch"},border:false,bodyStyle:"background-color: inherit; padding: 5px;",defaults:{border:false,labelLength:100,style:"padding-bottom: 2px"},items:[{xtype:"zarafa.compositefield",hideLabel:true,anchor:"100%",autoHeight:true,
items:[{xtype:"label",width:100,text:_("To")+":"},{xtype:"zarafa.recipientfield",ref:"../toRecipientField",flex:1,height:30,defaultRecipientType:Zarafa.core.mapi.RecipientType.MAPI_TO}]},{xtype:"zarafa.compositefield",hideLabel:true,anchor:"100%",items:[{xtype:"label",width:100,text:_("Subject")+":"},{xtype:"textfield",flex:1,name:"subject",value:undefined,listeners:{change:this.onChange,scope:this}}]},{xtype:"zarafa.editorfield",ref:"../editorField",htmlName:"html_body",plaintextName:"body",hideLabel:true,
flex:1,useHtml:a.useHtml,defaultValue:"",listeners:{change:this.onBodyChange,scope:this}}]}]},buttons:[{text:_("Send"),handler:this.onSend,scope:this},{text:_("Discard"),handler:this.onDiscard,scope:this}]});Zarafa.widgets.QuickMailWidget.superclass.constructor.call(this,a)},onChange:function(a,b){this.wrap.record.set(a.name,b)},onBodyChange:function(a,b){this.wrap.record.beginEdit();a instanceof Ext.form.HtmlEditor?this.wrap.record.set("isHTML",true):this.wrap.record.set("isHTML",false);this.wrap.record.set(a.name,
b);this.wrap.record.endEdit()},createRecord:function(){var a=container.getHierarchyStore().getDefaultFolder("drafts");return container.getContextByName("mail").getModel().createRecord(a)},update:function(a,b){this.wrap.formPanel.getForm().loadRecord(a);b&&this.wrap.formPanel.toRecipientField.setRecipientStore(a.getSubStore("recipients"))},updateRecord:function(a){a.beginEdit();this.wrap.formPanel.getForm().updateRecord(a);this.onBodyChange(this.wrap.editorField,this.wrap.editorField.getValue());a.endEdit()},
onSend:function(){this.wrap.sendRecord()},onDiscard:function(){this.reset()}});Zarafa.onReady(function(){container.registerWidget(Zarafa.widgets.QuickMailWidget,"quickmail",_("Quick Mail"),"plugins/quickitems/resources/images/quickmail.png")});Ext.namespace("Zarafa.widgets");
Zarafa.widgets.QuickContactWidget=Ext.extend(Zarafa.widgets.AbstractQuickItemWidget,{contactParser:undefined,constructor:function(a){a=a||{};if(!a.contactParser){var b=container.getSharedComponent(Zarafa.core.data.SharedComponentType["contact.detailsparser"]);if(b)a.contactParser=new b}Ext.applyIf(a,{name:"quickcontact",title:_("Quick Contact"),wrapCfg:{allowWrite:true,layout:"fit",items:[{xtype:"form",ref:"formPanel",layout:{type:"vbox",align:"stretch"},border:false,bodyStyle:"background-color: inherit; padding: 5px;",
defaults:{border:false,labelLength:100,style:"padding-bottom: 2px"},items:[{xtype:"zarafa.compositefield",hideLabel:true,anchor:"100%",autoHeight:true,items:[{xtype:"label",width:100,text:_("Full Name")+":"},{xtype:"textfield",flex:1,name:"display_name",ref:"../../fullnameField",listeners:{scope:this,change:this.onFullNameChange}}]},{xtype:"zarafa.compositefield",hideLabel:true,anchor:"100%",autoHeight:true,items:[{xtype:"splitbutton",width:100,text:_("Mobile")+":",handler:this.onPhoneButtonClick,
scope:this,menu:this.initPhoneButtonMenu("cellular_telephone_number")},{xtype:"textfield",ref:"../../telephoneField",flex:1,name:"telephone_number",property:"cellular_telephone_number",listeners:{scope:this,change:this.onTelephoneNumberChange}}]},{xtype:"zarafa.compositefield",hideLabel:true,anchor:"100%",autoHeight:true,items:[{xtype:"label",width:100,text:_("Email")+":"},{xtype:"textfield",flex:1,ref:"../../mailAddressField",name:"email_address_1",listeners:{scope:this,change:this.onChange}}]},
{xtype:"zarafa.editorfield",ref:"../editorField",htmlName:"html_body",plaintextName:"body",hideLabel:true,flex:1,useHtml:false,defaultValue:"",listeners:{change:this.onBodyChange,scope:this}}]}]},buttons:[{text:_("Save"),handler:this.onSave,scope:this},{text:_("Discard"),handler:this.onDiscard,scope:this}]});Zarafa.widgets.QuickContactWidget.superclass.constructor.call(this,a)},initPhoneButtonMenu:function(a){return{xtype:"menu",listeners:{click:this.onMenuItemSelection,scope:this},defaults:{xtype:"menucheckitem",
group:"phone_number"},items:[{text:_("Business"),property:"business_telephone_number",checked:a=="business_telephone_number"},{text:_("Company"),property:"company_telephone_number",checked:a=="company_telephone_number"},{text:_("Home"),property:"home_telephone_number",checked:a=="home_telephone_number"},{text:_("Mobile"),property:"cellular_telephone_number",checked:a=="cellular_telephone_number"},{text:_("Other"),property:"other_telephone_number",checked:a=="other_telephone_number"}]}},onMenuItemSelection:function(a,
b){if(!Ext.isEmpty(b)){var c=a.findParentByType("zarafa.compositefield"),d=c.findByType("splitbutton")[0];c=c.findByType("textfield")[0];if(!Ext.isEmpty(d)&&!Ext.isEmpty(c)){d.setText(b.initialConfig.text);c.setValue(this.record.get(b.property));c.property=b.property}}},onPhoneButtonClick:function(a){this.showDetailedPhoneDialog(a.ownerCt.findByType("textfield")[0].name)},onChange:function(a,b){this.wrap.record.set(a.name,b)},onTelephoneNumberChange:function(a,b){this.wrap.record.set(a.property,b)},
onFullNameChange:function(a,b){var c=this.contactParser.parseInfo("name",b);this.wrap.record.set("display_name",b);this.wrap.record.set("display_name_prefix",c.display_name_prefix);this.wrap.record.set("given_name",c.given_name);this.wrap.record.set("middle_name",c.middle_name);this.wrap.record.set("surname",c.surname);this.wrap.record.set("generation",c.generation);c.incomplete_info===true&&container.getSettingsModel().get("zarafa/v1/contexts/contact/show_name_dialog")==true&&!Ext.isEmpty(b)&&this.showDetailedNameDialog(c)},
onBodyChange:function(a,b){this.wrap.record.beginEdit();a instanceof Ext.form.HtmlEditor?this.wrap.record.set("isHTML",true):this.wrap.record.set("isHTML",false);this.wrap.record.set(a.name,b);this.wrap.record.endEdit()},showDetailedNameDialog:function(a){Zarafa.contact.Actions.openDetailedNameDialog(this.contactParser,this.wrap.record,a)},showDetailedPhoneDialog:function(a){Zarafa.contact.Actions.openDetailedPhoneDialog(this.contactParser,this.wrap.record,a)},createRecord:function(){var a=container.getHierarchyStore().getDefaultFolder("contact");
return container.getContextByName("contact").getModel().createRecord(a)},update:function(a){this.wrap.formPanel.getForm().loadRecord(a);this.wrap.telephoneField.setValue(a.get(this.wrap.telephoneField.property))},updateRecord:function(a){a.beginEdit();this.wrap.formPanel.getForm().updateRecord(a);this.onFullNameChange(this.wrap.fullnameField,this.wrap.fullnameField.getValue());a.updateSubject();a.updateAddressbookProps();a.endEdit()},onSave:function(){this.wrap.saveRecord()},onDiscard:function(){this.reset()}});
Zarafa.onReady(function(){container.registerWidget(Zarafa.widgets.QuickContactWidget,"quickcontact",_("Quick Contact"),"plugins/quickitems/resources/images/quickcontact.png")});Ext.namespace("Zarafa.widgets");
Zarafa.widgets.QuickAppointmentWidget=Ext.extend(Zarafa.widgets.AbstractQuickItemWidget,{constructor:function(a){a=a||{};Ext.applyIf(a,{name:"quickappt",title:_("Quick Appointment"),wrapCfg:{allowWrite:true,layout:"fit",items:[{xtype:"form",ref:"formPanel",layout:{type:"vbox",align:"stretch"},border:false,bodyStyle:"background-color: inherit; padding: 5px;",defaults:{border:false,labelLength:100,style:"padding-bottom: 2px"},items:[{xtype:"zarafa.compositefield",hideLabel:true,anchor:"100%",items:[{xtype:"label",
width:100,text:_("Subject")+":"},{xtype:"textfield",flex:1,name:"subject",value:undefined,listeners:{change:this.onChange,scope:this}}]},{xtype:"zarafa.datetimeperiodfield",ref:"../datetimePeriod",defaultPeriod:container.getSettingsModel().get("zarafa/v1/contexts/calendar/default_appointment_period"),timeIncrement:container.getSettingsModel().get("zarafa/v1/contexts/calendar/default_zoom_level"),width:300,listeners:{change:this.onDateRangeFieldChange,scope:this},startFieldConfig:{fieldLabel:_("Start time"),
labelWidth:100,minValue:(new Date).clearTime()},endFieldConfig:{fieldLabel:_("End time"),labelWidth:100,minValue:(new Date).clearTime()}},{xtype:"zarafa.compositefield",hideLabel:true,anchor:"100%",items:[{xtype:"spacer",width:100},{xtype:"checkbox",name:"alldayevent",ref:"../../alldayCheck",hideLabel:false,boxLabel:_("All Day Event"),handler:this.onToggleAllDay,scope:this}]},{xtype:"zarafa.editorfield",ref:"../editorField",htmlName:"html_body",plaintextName:"body",hideLabel:true,flex:1,useHtml:false,
defaultValue:"",listeners:{change:this.onBodyChange,scope:this}}]}]},buttons:[{text:_("Save"),handler:this.onSave,scope:this},{text:_("Discard"),handler:this.onDiscard,scope:this}]});Zarafa.widgets.QuickAppointmentWidget.superclass.constructor.call(this,a)},onChange:function(a,b){this.wrap.record.set(a.name,b)},onBodyChange:function(a,b){this.wrap.record.beginEdit();a instanceof Ext.form.HtmlEditor?this.wrap.record.set("isHTML",true):this.wrap.record.set("isHTML",false);this.wrap.record.set(a.name,
b);this.wrap.record.endEdit()},onDateRangeFieldChange:function(a,b){this.updateStartDueDate(this.wrap.record,b)},onToggleAllDay:function(a,b){if(this.wrap.record.get("alldayevent")!==b){var c=container.getSettingsModel();this.wrap.record.beginEdit();this.wrap.record.set("alldayevent",b);if(b){this.updateStartDueDate(this.wrap.record,this.wrap.datetimePeriod.getValue());this.wrap.record.set("reminder_minutes",c.get("zarafa/v1/contexts/calendar/default_allday_reminder_time"));this.wrap.record.set("busystatus",
Zarafa.core.mapi.BusyStatus.FREE)}else{var d=c.get("zarafa/v1/contexts/calendar/default_zoom_level"),f=c.get("zarafa/v1/contexts/calendar/default_appointment_period"),e=new Date;if(this.wrap.record.get("startdate"))e=this.wrap.record.get("startdate").clearTime(true);e=e.ceil(Date.MINUTE,d);d=e.add(Date.MINUTE,f);this.wrap.record.set("reminder_minutes",c.get("zarafa/v1/contexts/calendar/default_reminder_time"));this.wrap.record.set("busystatus",Zarafa.core.mapi.BusyStatus.BUSY);this.wrap.record.set("startdate",
e);this.wrap.record.set("duedate",d);this.wrap.record.set("commonstart",e);this.wrap.record.set("commonend",d);this.wrap.record.set("duration",(d-e)/6E4)}this.wrap.record.endEdit()}},updateStartDueDate:function(a,b){var c=b.getStartDate().clone(),d=b.getDueDate().clone();if(a.get("alldayevent")===true){c=c.clearTime();d=d.add(Date.DAY,1).clearTime()}a.beginEdit();a.set("startdate",c);a.set("duedate",d);a.set("commonstart",c);a.set("commonend",d);a.set("duration",(d-c)/6E4);a.endEdit()},createRecord:function(){var a=
container.getHierarchyStore().getDefaultFolder("calendar");return container.getContextByName("calendar").getModel().createRecord(a)},update:function(a,b){if(b===true||a.isModifiedSinceLastUpdate("alldayevent"))a.get("alldayevent")?this.wrap.datetimePeriod.setEnabledTimeSelection(false):this.wrap.datetimePeriod.setEnabledTimeSelection(true);this.wrap.formPanel.getForm().loadRecord(a);var c=a.get("startdate"),d=false;if(Ext.isDate(c)){c=c.clone();d=b||a.isModifiedSinceLastUpdate("startdate")}var f=
a.get("duedate"),e=false;if(Ext.isDate(f)){f=f.clone();e=b||a.isModifiedSinceLastUpdate("duedate")}if(a.get("alldayevent"))f=f.add(Date.DAY,-1);if(d||e)this.wrap.datetimePeriod.getValue().set(c,f)},updateRecord:function(a){a.beginEdit();this.wrap.formPanel.getForm().updateRecord(a);this.updateStartDueDate(a,this.wrap.datetimePeriod.getValue());this.onToggleAllDay(this.wrap.alldayCheck,this.wrap.alldayCheck.getValue());this.onBodyChange(this.wrap.editorField,this.wrap.editorField.getValue());a.endEdit()},
onSave:function(){this.wrap.saveRecord()},onDiscard:function(){this.reset()}});Zarafa.onReady(function(){container.registerWidget(Zarafa.widgets.QuickAppointmentWidget,"quickappt",_("Quick Appointment"),"plugins/quickitems/resources/images/quickappt.png")});
Zarafa.widgets.FeaturesWidget=Ext.extend(Zarafa.widgets.QuickMailWidget,{constructor:function(a){a=a||{};Ext.applyIf(a,{title:_("Features Submitter"),name:"features",hasDialog:false,wrapCfg:{allowWrite:true,layout:"fit",height:250,items:[{xtype:"form",ref:"formPanel",items:[{xtype:"textfield",fieldLabel:_("Feature description"),name:"subject",anchor:"100%",allowBlank:false,blankText:_("A required field was not filled in"),listeners:{change:this.onChange,scope:this}},{xtype:"zarafa.editorfield",htmlName:"html_body",
plaintextName:"body",ref:"../editorField",fieldLabel:_("How Feature should work"),height:150,anchor:"100%",useHtml:a.useHtml,allowBlank:false,blankText:_("A required field was not filled in"),listeners:{change:this.onBodyChange,scope:this}},{xtype:"zarafa.compositefield",hideLabel:true,anchor:"100%",autoHeight:true,items:[{xtype:"button",width:100,border:false,text:_("Attachments")+":",name:"label_attachment",handler:function(){Zarafa.common.Actions.openAttachmentsDialog(this.record)},scope:this,
isValid:function(){return true}},{xtype:"zarafa.attachmentfield",flex:1,name:"attachment",ref:"../attachmentField",readOnly:true,hideLabel:true,value:undefined}]}]}]}});Zarafa.widgets.FeaturesWidget.superclass.constructor.call(this,a);this.mon(this.wrap,"aftersendrecord",this.afterSend,this)},createRecord:function(){var a=Zarafa.widgets.FeaturesWidget.superclass.createRecord.apply(this,arguments),b=a.getSubStore("recipients"),c=Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,
{display_name:"Zarafa Feature Request",smtp_address:"features@zarafa.com",recipient_type:Zarafa.core.mapi.RecipientType.MAPI_TO});b.add(c);a.set("body","");return a},update:function(a,b){this.wrap.formPanel.getForm().loadRecord(a);b&&this.wrap.formPanel.attachmentField.setAttachmentStore(a.getSubStore("attachments"))},updateRecord:function(a){Zarafa.widgets.FeaturesWidget.superclass.updateRecord.apply(this,arguments);a.set("subject",_("Feature Request")+": "+a.get("subject"))},onSend:function(){this.wrap.formPanel.getForm().isValid()?
Ext.Msg.show({title:_("Terms and Conditions:"),msg:_("By sending this feature request you are agreeing to send your email address<br/>and to possible correspondance from a zarafa employee regarding the<br/>issue being discussed. Any information disclosed will not be passed <br/>onto any third party or external affiliates.")+"<br/><br/>"+_("You are also agreeing to a code of conduct as Zarafa has a no tolerance <br/>spam policy. Accounts will be blacklisted and blocked if they send</br>unsolicited email messages.")+
"<br/><br/><br/>"+_("Do you agree to these terms and conditions?")+"<br/><br/>",buttons:Ext.Msg.YESNO,fn:this.processResult,scope:this,icon:Ext.MessageBox.QUESTION}):Ext.Msg.show({title:_("Feature Request incomplete"),msg:_("One or more fields have not been filled out.")+"<br/><br/>"+_("Please check that you have filled out all information before sending."),buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR})},processResult:function(a){a=="yes"?this.wrap.sendRecord():Ext.Msg.show({title:_("Terms and Conditions:"),
msg:_("The feature request has not been sent because terms<br/>and conditions were not agreed upon."),buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING})},afterSend:function(){Ext.Msg.show({title:_("Confirmation"),msg:_("The feature request has been sent to Zarafa.")+"<br/><br/>"+_("Thank you for your feedback."),buttons:Ext.Msg.OK,icon:Ext.MessageBox.INFO})}});Zarafa.onReady(function(){container.registerWidget(Zarafa.widgets.FeaturesWidget,"features",_("Features Submitter"),"plugins/quickitems/resources/images/feature.png")});
Zarafa.widgets.BugReportWidget=Ext.extend(Zarafa.widgets.QuickMailWidget,{constructor:function(a){a=a||{};Ext.applyIf(a,{title:_("Bug Reporter"),name:"bug",hasDialog:false,wrapCfg:{allowWrite:true,layout:"fit",height:250,items:[{xtype:"form",ref:"formPanel",items:[{xtype:"textfield",fieldLabel:_("Issue description"),name:"subject",anchor:"100%",allowBlank:false,blankText:_("A required field was not filled in"),listeners:{change:this.onChange,scope:this}},{xtype:"zarafa.editorfield",htmlName:"html_body",
plaintextName:"body",ref:"../editorField",fieldLabel:_("How issue occurred"),height:150,anchor:"100%",useHtml:a.useHtml,allowBlank:false,blankText:_("A required field was not filled in"),listeners:{change:this.onBodyChange,scope:this}},{xtype:"zarafa.compositefield",hideLabel:true,anchor:"100%",autoHeight:true,items:[{xtype:"button",width:100,border:false,text:_("Attachments")+":",name:"label_attachment",handler:function(){Zarafa.common.Actions.openAttachmentsDialog(this.record)},scope:this,isValid:function(){return true}},
{xtype:"zarafa.attachmentfield",flex:1,name:"attachment",ref:"../attachmentField",readOnly:true,hideLabel:true,value:undefined}]}]}]}});Zarafa.widgets.BugReportWidget.superclass.constructor.call(this,a);this.mon(this.wrap,"aftersendrecord",this.afterSend,this)},createRecord:function(){var a=Zarafa.widgets.BugReportWidget.superclass.createRecord.apply(this,arguments),b=a.getSubStore("recipients"),c=Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,
{display_name:"Zarafa Bug Report",smtp_address:"bugreport@zarafa.com",recipient_type:Zarafa.core.mapi.RecipientType.MAPI_TO});b.add(c);a.set("body","");return a},update:function(a,b){this.wrap.formPanel.getForm().loadRecord(a);b&&this.wrap.formPanel.attachmentField.setAttachmentStore(a.getSubStore("attachments"))},updateRecord:function(a){Zarafa.widgets.BugReportWidget.superclass.updateRecord.apply(this,arguments);a.set("subject",_("Bug Report issue")+": "+a.get("subject"))},onSend:function(){this.wrap.formPanel.getForm().isValid()?
Ext.Msg.show({title:_("Terms and Conditions:"),msg:_("By sending this bug report you are agreeing to send your email address<br/>and to possible correspondance from a zarafa employee regarding the<br/>issue being reported. Any information disclosed will not be passed <br/>onto any third party or external affiliates.")+"<br/><br/>"+_("You are also agreeing to a code of conduct as Zarafa has a no tolerance <br/>spam policy. Accounts will be blacklisted and blocked if they send</br>unsolicited email messages.")+
"<br/><br/><br/>"+_("Do you agree to these terms and conditions?")+"<br/><br/>",buttons:Ext.Msg.YESNO,fn:this.processResult,scope:this,icon:Ext.MessageBox.QUESTION}):Ext.Msg.show({title:_("Bug Report incomplete"),msg:_("One or more fields have not been filled out.")+"<br/><br/>"+_("Please check that you have filled out all information before sending."),buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR})},processResult:function(a){a=="yes"?this.wrap.sendRecord():Ext.Msg.show({title:_("Terms and Conditions:"),
msg:_("The bug report has not been sent because terms<br/>and conditions were not agreed upon."),buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING})},afterSend:function(){Ext.Msg.show({title:_("Confirmation"),msg:_("The bug report has been sent to Zarafa.")+"<br/><br/>"+_("Thank you for your feedback."),buttons:Ext.Msg.OK,icon:Ext.MessageBox.INFO})}});Zarafa.onReady(function(){container.registerWidget(Zarafa.widgets.BugReportWidget,"bug",_("Bug Reporter"),"plugins/quickitems/resources/images/bug.png")});
