Import SVN changes

This commit is contained in:
Christoph Haas UIBK 2015-04-29 13:33:05 -07:00
commit a9ed53e963
4 changed files with 1009 additions and 0 deletions

10
PATCHING_README.txt Normal file
View File

@ -0,0 +1,10 @@
@myself: diff -ruN --exclude-from=..\diffexclude.txt <PathToOriginal> . > ../webapp_sendas.diff
patch the webapp folder as follows:
patch -Np1 -d webapp-1.3.1.svn41348 < webapp_fileas.diff
If you get an error like "1 out of 1 hunk FAILED -- saving rejects to file....." make sure that you have all files with unix line endings
(under ubuntu: install "tofrodos" und use it like: fromdos <filetoconvert>)

View File

@ -0,0 +1,160 @@
diff -ruN ../webapp-1.5.svn43477_original/client/zarafa/contact/dialogs/ContactGeneralTab.js ./client/zarafa/contact/dialogs/ContactGeneralTab.js
--- ../webapp-1.5.svn43477_original/client/zarafa/contact/dialogs/ContactGeneralTab.js 2014-01-23 22:25:47.511133259 +0100
+++ ./client/zarafa/contact/dialogs/ContactGeneralTab.js 2014-01-23 22:27:23.853489217 +0100
@@ -324,6 +324,9 @@
*/
createAddressFieldset : function(config)
{
+ var type = container.getSettingsModel().get('zarafa/v1/main/default_addr_type');
+ var name = container.getSettingsModel().get('zarafa/v1/main/default_addr_type_name');
+
return {
title : _('Addresses'),
defaultType : 'zarafa.compositefield',
@@ -335,15 +338,15 @@
items : [{
xtype : 'splitbutton',
width : config.labelWidth,
- text : _('Business') + ':',
+ text : _(name) + ':',
handler : this.handleAddressButtonClick,
scope : this,
- menu : this.initAddressButtonMenu('business_address', 'business_address')
+ menu : this.initAddressButtonMenu(type, type)
// @TODO add checkbox for email address selection
}, {
xtype : 'textarea',
flex : 1,
- name : 'business_address',
+ name : type,
height : 128,
listeners : {
scope : this,
diff -ruN ../webapp-1.5.svn43477_original/client/zarafa/settings/data/SettingsDefaultValues.js ./client/zarafa/settings/data/SettingsDefaultValues.js
--- ../webapp-1.5.svn43477_original/client/zarafa/settings/data/SettingsDefaultValues.js 2014-01-23 22:25:47.498133076 +0100
+++ ./client/zarafa/settings/data/SettingsDefaultValues.js 2014-01-23 22:27:44.224775933 +0100
@@ -24,6 +24,18 @@
*/
'default_context' : 'mail',
/**
+ * zarafa/v1/main/default_addr_type
+ * @property
+ * @type String
+ */
+ 'default_addr_type' : 'business_address',
+ /**
+ * zarafa/v1/main/default_addr_type_name
+ * @property
+ * @type String
+ */
+ 'default_addr_type_name' : 'Business',
+ /**
* zarafa/v1/main/use_canvas_rendering
* @property
* @type Boolean
diff -ruN ../webapp-1.5.svn43477_original/client/zarafa/settings/ui/SettingsAccountWidget.js ./client/zarafa/settings/ui/SettingsAccountWidget.js
--- ../webapp-1.5.svn43477_original/client/zarafa/settings/ui/SettingsAccountWidget.js 2014-01-23 22:25:47.497133061 +0100
+++ ./client/zarafa/settings/ui/SettingsAccountWidget.js 2014-01-23 22:28:06.200085227 +0100
@@ -41,6 +41,23 @@
fields : ['context', 'text'],
data : items
};
+
+ // default addressbook selector
+ var addrStore = {
+ xtype : 'jsonstore',
+ autoDestroy : true,
+ fields : ['type', 'text'],
+ data : [{
+ text : _('Home'),
+ type : 'home_address'
+ }, {
+ text : _('Business'),
+ type : 'business_address'
+ }, {
+ text : _('Other'),
+ type : 'other_address'
+ }]
+ };
Ext.applyIf(config, {
title : String.format(_('Account information - {0}'), user.getDisplayName()),
@@ -100,11 +117,48 @@
select : this.onStartupSelect,
scope : this
}
+ },{
+ xtype : 'combo',
+ fieldLabel : _('Default Address Type'),
+ name : 'zarafa/v1/main/default_addr_type',
+ ref : 'addrCombo',
+ width : 200,
+ store : addrStore,
+ mode: 'local',
+ triggerAction: 'all',
+ displayField: 'text',
+ valueField: 'type',
+ lazyInit: false,
+ forceSelection: true,
+ editable: false,
+ autoSelect: true,
+ listeners : {
+ select : this.onAddrSelect,
+ scope : this
+ }
}]
});
Zarafa.settings.ui.SettingsAccountWidget.superclass.constructor.call(this, config);
},
+
+ /**
+ * Event handler which is fired when a Addressbook Type in the {@link Ext.form.ComboBox combobox}
+ * has been selected.
+ * @param {Ext.form.ComboBox} combo The combobox which fired the event
+ * @param {Ext.data.Record} record The selected record in the combobox
+ * @param {Number} index The selected index in the store
+ * @private
+ */
+ onAddrSelect : function(combo, record, index)
+ {
+ var value = record.get(combo.valueField);
+ var text = record.get(combo.displayField);
+ if (this.model) {
+ this.model.set(combo.name, value);
+ this.model.set(combo.name + "_name", text);
+ }
+ },
/**
* Event handler which is fired when a language in the {@link Ext.form.ComboBox combobox}
@@ -165,6 +219,7 @@
this.languageWarning.reset();
this.startupCombo.setValue(settingsModel.get(this.startupCombo.name));
+ this.addrCombo.setValue(settingsModel.get(this.addrCombo.name));
},
/**
@@ -179,6 +234,8 @@
settingsModel.beginEdit()
settingsModel.set(this.languageCombo.name, this.languageCombo.getValue());
settingsModel.set(this.startupCombo.name, this.startupCombo.getValue());
+ settingsModel.set(this.addrCombo.name, this.addrCombo.getValue());
+ settingsModel.set(this.addrCombo.name + "_name", this.addrCombo.getRawValue());
settingsModel.endEdit();
}
});
diff -ruN ../webapp-1.5.svn43477_original/server/language/de_DE.UTF-8/LC_MESSAGES/zarafa_webapp.po ./server/language/de_DE.UTF-8/LC_MESSAGES/zarafa_webapp.po
--- ../webapp-1.5.svn43477_original/server/language/de_DE.UTF-8/LC_MESSAGES/zarafa_webapp.po 2014-01-23 22:25:47.377131373 +0100
+++ ./server/language/de_DE.UTF-8/LC_MESSAGES/zarafa_webapp.po 2014-01-23 22:28:39.442553104 +0100
@@ -646,6 +646,9 @@
msgid "Business"
msgstr "Geschäft"
+msgid "Default Address Type"
+msgstr "Standard Adress-Typ"
+
# 88%
#: client/zarafa/addressbook/dialogs/ABUserPhoneTab.js:73
msgid "Business2"

13
webapp_fileas.diff Normal file
View File

@ -0,0 +1,13 @@
diff -ruN --exclude=tools C:\Users\admhaasch\Downloads\webapp-1.3.1.svn41348.tar\webapp-1.3.1.svn41348/client/zarafa/contact/dialogs/ContactGeneralTab.js C:\Users\admhaasch\Downloads\webapp-1.3.1.svn41348.tar\webapp-1.3.1.svn41348_EDIT/client/zarafa/contact/dialogs/ContactGeneralTab.js
--- C:\Users\admhaasch\Downloads\webapp-1.3.1.svn41348.tar\webapp-1.3.1.svn41348/client/zarafa/contact/dialogs/ContactGeneralTab.js 2013-01-29 13:22:09.000000000 +0100
+++ C:\Users\admhaasch\Downloads\webapp-1.3.1.svn41348.tar\webapp-1.3.1.svn41348_EDIT/client/zarafa/contact/dialogs/ContactGeneralTab.js 2013-05-02 13:37:31.139972000 +0200
@@ -867,6 +867,9 @@
fileasOptions.push([companyName + Zarafa.contact.data.config.NBSP + '(' + contactName + ')']);
}
}
+ } else if(!Ext.isEmpty(companyName)) {
+ // use companyname as fileas field
+ fileasOptions.push([companyName]);
}
comboStore.loadData(fileasOptions);

826
webapp_sendas.diff Normal file
View File

@ -0,0 +1,826 @@
diff -ruN --exclude-from=..\diffexclude.txt C:\Users\admhaasch\Downloads\webapp-1.3.1.svn41348.tar\webapp-1.3.1.svn41348/client/zarafa/common/CommonContext.js ./client/zarafa/common/CommonContext.js
--- C:\Users\admhaasch\Downloads\webapp-1.3.1.svn41348.tar\webapp-1.3.1.svn41348/client/zarafa/common/CommonContext.js 2013-01-04 13:42:45.000000000 +0100
+++ ./client/zarafa/common/CommonContext.js 2013-05-02 18:07:15.513665300 +0200
@@ -23,6 +23,7 @@
// Register categories for the settings
this.registerInsertionPoint('context.settings.categories', this.createDelegateSettingsCategory, this);
+ this.registerInsertionPoint('context.settings.categories', this.createSendAsSettingsCategory, this);
this.registerInsertionPoint('context.settings.categories', this.createRuleSettingsCategory, this);
// Register common specific dialog types
@@ -42,6 +43,7 @@
Zarafa.core.data.SharedComponentType.addProperty('common.contextmenu.reminder.remindergrid');
Zarafa.core.data.SharedComponentType.addProperty('common.printer.renderer');
Zarafa.core.data.SharedComponentType.addProperty('common.rules.dialog.ruleswordsedit');
+ Zarafa.core.data.SharedComponentType.addProperty('common.sendas.dialog.sendasedit');
},
/**
@@ -74,6 +76,7 @@
case Zarafa.core.data.SharedComponentType['common.contextmenu.importance']:
case Zarafa.core.data.SharedComponentType['common.contextmenu.reminder.remindergrid']:
case Zarafa.core.data.SharedComponentType['common.rules.dialog.ruleswordsedit']:
+ case Zarafa.core.data.SharedComponentType['common.sendas.dialog.sendasedit']:
bid = 1;
break;
case Zarafa.core.data.SharedComponentType['common.contextmenu.freebusy']:
@@ -144,6 +147,9 @@
case Zarafa.core.data.SharedComponentType['common.rules.dialog.ruleswordsedit']:
component = Zarafa.common.rules.dialogs.RulesWordsEditContentPanel;
break;
+ case Zarafa.core.data.SharedComponentType['common.sendas.dialog.sendasedit']:
+ component = Zarafa.common.sendas.dialogs.SendAsEditContentPanel;
+ break;
case Zarafa.core.data.SharedComponentType['common.create']:
if (record instanceof Zarafa.core.data.IPMRecipientRecord) {
component = Zarafa.common.recipientfield.ui.EditRecipientContentPanel;
@@ -220,6 +226,27 @@
settingsContext : settingsContext
};
},
+
+ /**
+ * Create the send as {@link Zarafa.settings.ui.SettingsCategory Settings Category}
+ * to the {@link Zarafa.settings.SettingsContext}. This will create new
+ * {@link Zarafa.settings.ui.SettingsCategoryTab tabs} for the
+ * {@link Zarafa.calendar.ui.SettingsSendAsCategory SendAs}
+ * in the {@link Zarafa.settings.ui.SettingsCategoryWidgetPanel Widget Panel}.
+ * @param {String} insertionName insertion point name that is currently populated
+ * @param {Zarafa.settings.ui.SettingsMainPanel} settingsMainPanel settings main panel
+ * which is populating this insertion point
+ * @param {Zarafa.settings.SettingsContext} settingsContext settings context
+ * @return {Array} configuration object for the categories to register
+ * @private
+ */
+ createSendAsSettingsCategory : function(insertionName, settingsMainPanel, settingsContext)
+ {
+ return {
+ xtype : 'zarafa.settingssendascategory',
+ settingsContext : settingsContext
+ };
+ },
/**
* Create the Rule {@link Zarafa.settings.ui.SettingsCategory Settings Category}
diff -ruN --exclude-from=..\diffexclude.txt C:\Users\admhaasch\Downloads\webapp-1.3.1.svn41348.tar\webapp-1.3.1.svn41348/client/zarafa/common/sendas/dialogs/SendAsEditContentPanel.js ./client/zarafa/common/sendas/dialogs/SendAsEditContentPanel.js
--- C:\Users\admhaasch\Downloads\webapp-1.3.1.svn41348.tar\webapp-1.3.1.svn41348/client/zarafa/common/sendas/dialogs/SendAsEditContentPanel.js 1970-01-01 01:00:00.000000000 +0100
+++ ./client/zarafa/common/sendas/dialogs/SendAsEditContentPanel.js 2013-05-02 22:39:19.679354100 +0200
@@ -0,0 +1,40 @@
+Ext.namespace('Zarafa.common.sendas.dialogs');
+
+/**
+ * @class Zarafa.common.sendas.dialogs.SendAsEditContentPanel
+ * @extends Zarafa.core.ui.ContentPanel
+ * @xtype zarafa.sendaseditcontentpanel
+ *
+ * {@link Zarafa.common.sendas.dialogs.SendAsEditContentPanel SendAsEditContentPanel} will be used to edit sendas addresses.
+ */
+Zarafa.common.sendas.dialogs.SendAsEditContentPanel = Ext.extend(Zarafa.core.ui.ContentPanel, {
+ /**
+ * @constructor
+ * @param config Configuration structure
+ */
+ constructor : function(config)
+ {
+ config = config || {};
+
+ // Add in some standard configuration data.
+ Ext.applyIf(config, {
+ // Override from Ext.Component
+ xtype : 'zarafa.sendaseditcontentpanel',
+ // Override from Ext.Component
+ layout : 'fit',
+ model : true,
+ autoSave : false,
+ width : 400,
+ height : 100,
+ title : _('Send As'),
+ items : [{
+ xtype : 'zarafa.sendaseditpanel',
+ item : config.item
+ }]
+ });
+
+ Zarafa.common.sendas.dialogs.SendAsEditContentPanel.superclass.constructor.call(this, config);
+ }
+});
+
+Ext.reg('zarafa.sendaseditcontentpanel', Zarafa.common.sendas.dialogs.SendAsEditContentPanel);
diff -ruN --exclude-from=..\diffexclude.txt C:\Users\admhaasch\Downloads\webapp-1.3.1.svn41348.tar\webapp-1.3.1.svn41348/client/zarafa/common/sendas/dialogs/SendAsEditPanel.js ./client/zarafa/common/sendas/dialogs/SendAsEditPanel.js
--- C:\Users\admhaasch\Downloads\webapp-1.3.1.svn41348.tar\webapp-1.3.1.svn41348/client/zarafa/common/sendas/dialogs/SendAsEditPanel.js 1970-01-01 01:00:00.000000000 +0100
+++ ./client/zarafa/common/sendas/dialogs/SendAsEditPanel.js 2013-05-03 13:17:58.427828000 +0200
@@ -0,0 +1,135 @@
+Ext.namespace('Zarafa.common.sendas.dialogs');
+
+/**
+ * @class Zarafa.common.sendas.dialogs.SendAsEditPanel
+ * @extends Ext.form.FormPanel
+ * @xtype zarafa.sendaseditpanel
+ *
+ * Will generate UI for {@link Zarafa.common.sendas.dialogs.SendAsEditContentPanel SendAsEditContentPanel}.
+ */
+Zarafa.common.sendas.dialogs.SendAsEditPanel = Ext.extend(Ext.form.FormPanel, {
+
+ /**
+ * the id of the currently edited item
+ */
+ currentItem : undefined,
+
+ /**
+ * @constructor
+ * @param config Configuration structure
+ */
+ constructor : function(config)
+ {
+ config = config || {};
+
+ if(config.item)
+ this.currentItem = config.item;
+
+ Ext.applyIf(config, {
+ // Override from Ext.Component
+ xtype : 'zarafa.sendaseditpanel',
+ labelAlign : 'left',
+ defaultType: 'textfield',
+ items : this.createPanelItems(config),
+ buttons: [{
+ text: _('Save'),
+ handler: this.doSave,
+ scope: this
+ },
+ {
+ text: _('Cancel'),
+ handler: this.doClose,
+ scope: this
+ }]
+ });
+
+ Zarafa.common.sendas.dialogs.SendAsEditPanel.superclass.constructor.call(this, config);
+ },
+
+ /**
+ * close the dialog
+ */
+ doClose : function() {
+ this.dialog.close();
+ },
+
+ /**
+ * save the data to the store
+ */
+ doSave : function() {
+ var store = this.dialog.store;
+ var id = 0;
+ var record = undefined;
+
+ if(!this.currentItem) {
+ record = new store.recordType({
+ id: this.hashCode(this.email_address.getValue()),
+ display_name: this.display_name.getValue(),
+ email_address: this.email_address.getValue()
+ });
+ }
+
+ if(this.email_address.isValid()) {
+ if(record) {
+ store.add(record);
+ } else {
+ this.currentItem.set('display_name', this.display_name.getValue());
+ this.currentItem.set('email_address', this.email_address.getValue());
+ }
+ this.dialog.close();
+ }
+ },
+
+ /**
+ * Function will create panel items for {@link Zarafa.common.sendas.dialogs.SendAsEditPanel SendAsEditPanel}
+ * @return {Array} array of items that should be added to panel.
+ * @private
+ */
+ createPanelItems : function(config)
+ {
+ var displayName = "";
+ var emailAddress = "";
+
+ if(config.item){
+ displayName = config.item.get('display_name');
+ emailAddress = config.item.get('email_address');
+ }
+
+ return [{
+ fieldLabel: _('Display Name'),
+ name: 'display_name',
+ ref: 'display_name',
+ value: displayName,
+ anchor: '100%'
+ },
+ {
+ fieldLabel: _('Email Address'),
+ name: 'email_address',
+ ref: 'email_address',
+ allowBlank: false,
+ value: emailAddress,
+ vtype:'email',
+ anchor: '100%'
+ }];
+ },
+
+ /**
+ * Java String.hashCode() implementation
+ * @private
+ */
+ hashCode : function(str){
+ var hash = 0;
+ var chr = 0;
+ var i = 0;
+
+ if (str.length == 0) return hash;
+ for (i = 0; i < str.length; i++) {
+ chr = str.charCodeAt(i);
+ hash = ((hash<<5)-hash)+chr;
+ hash = hash & hash; // Convert to 32bit integer
+ }
+ return Math.abs(hash);
+ }
+});
+
+Ext.reg('zarafa.sendaseditpanel', Zarafa.common.sendas.dialogs.SendAsEditPanel);
diff -ruN --exclude-from=..\diffexclude.txt C:\Users\admhaasch\Downloads\webapp-1.3.1.svn41348.tar\webapp-1.3.1.svn41348/client/zarafa/common/sendas/ui/SendAsGrid.js ./client/zarafa/common/sendas/ui/SendAsGrid.js
--- C:\Users\admhaasch\Downloads\webapp-1.3.1.svn41348.tar\webapp-1.3.1.svn41348/client/zarafa/common/sendas/ui/SendAsGrid.js 1970-01-01 01:00:00.000000000 +0100
+++ ./client/zarafa/common/sendas/ui/SendAsGrid.js 2013-05-02 21:29:16.060920900 +0200
@@ -0,0 +1,136 @@
+Ext.namespace('Zarafa.common.sendas.ui');
+
+/**
+ * @class Zarafa.common.sendas.ui.SendAsGrid
+ * @extends Ext.grid.GridPanel
+ * @xtype zarafa.sendasgrid
+ *
+ * {@link Zarafa.common.sendas.ui.SendAsGrid SendAsGrid} will be used to display
+ * sendas of the current user.
+ */
+Zarafa.common.sendas.ui.SendAsGrid = Ext.extend(Ext.grid.GridPanel, {
+ /**
+ * @constructor
+ * @param {Object} config Configuration structure
+ */
+ constructor : function(config)
+ {
+ config = config || {};
+
+ Ext.applyIf(config, {
+ xtype : 'zarafa.sendasgrid',
+ border : true,
+ store : config.store,
+ viewConfig : {
+ forceFit : true,
+ emptyText : '<div class=\'emptytext\'>' + _('No sendas address exists') + '</div>'
+ },
+ loadMask : this.initLoadMask(),
+ columns : this.initColumnModel(),
+ selModel : this.initSelectionModel(),
+ listeners : {
+ viewready : this.onViewReady,
+ rowdblclick : this.onRowDblClick,
+ scope : this
+ }
+ });
+
+ Zarafa.common.sendas.ui.SendAsGrid.superclass.constructor.call(this, config);
+ },
+
+ /**
+ * initialize events for the grid panel.
+ * @private
+ */
+ initEvents : function()
+ {
+ Zarafa.common.sendas.ui.SendAsGrid.superclass.initEvents.call(this);
+
+ // select first sendas when store has finished loading
+ this.mon(this.store, 'load', this.onViewReady, this, {single : true});
+ },
+
+ /**
+ * Creates a column model object, used in {@link #colModel} config
+ * @return {Ext.grid.ColumnModel} column model object
+ * @private
+ */
+ initColumnModel : function()
+ {
+ return [{
+ dataIndex : 'display_name',
+ header : _('Name'),
+ renderer : Zarafa.common.ui.grid.Renderers.text
+ },
+ {
+ dataIndex : 'email_address',
+ header : _('Email Address'),
+ renderer : Zarafa.common.ui.grid.Renderers.text
+ }]
+ },
+
+ /**
+ * Creates a selection model object, used in {@link #selModel} config
+ * @return {Ext.grid.RowSelectionModel} selection model object
+ * @private
+ */
+ initSelectionModel : function()
+ {
+ return new Ext.grid.RowSelectionModel({
+ singleSelect : true
+ });
+ },
+
+ /**
+ * Initialize the {@link Ext.grid.GridPanel.loadMask} field
+ *
+ * @return {Ext.LoadMask} The configuration object for {@link Ext.LoadMask}
+ * @private
+ */
+ initLoadMask : function()
+ {
+ return {
+ msg : _('Loading sendas addresses') + '...'
+ };
+ },
+
+ /**
+ * Event handler which is fired when the gridPanel is ready. This will automatically
+ * select the first row in the grid.
+ * @private
+ */
+ onViewReady : function()
+ {
+ this.getSelectionModel().selectFirstRow();
+ },
+
+ /**
+ * Function will be called to remove a sendas address.
+ */
+ removeSendAs : function()
+ {
+ var sendasRecord = this.getSelectionModel().getSelected();
+ if(!sendasRecord) {
+ Ext.Msg.alert(_('Alert'), _('Please select a sendas address.'));
+ return;
+ }
+
+ this.store.remove(sendasRecord);
+ },
+
+ /**
+ * Event handler which is fired when the {@link Zarafa.common.sendas.ui.SendAsGrid SendAsGrid} is double clicked.
+ * it will call generic function to handle the functionality.
+ * @private
+ */
+ onRowDblClick : function(grid, rowIndex)
+ {
+ Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType['common.sendas.dialog.sendasedit'], undefined, {
+ store : grid.getStore(),
+ item : grid.getStore().getAt(rowIndex),
+ manager : Ext.WindowMgr
+ });
+ }
+});
+
+Ext.reg('zarafa.sendasgrid', Zarafa.common.sendas.ui.SendAsGrid);
diff -ruN --exclude-from=..\diffexclude.txt C:\Users\admhaasch\Downloads\webapp-1.3.1.svn41348.tar\webapp-1.3.1.svn41348/client/zarafa/common/sendas/ui/SendAsPanel.js ./client/zarafa/common/sendas/ui/SendAsPanel.js
--- C:\Users\admhaasch\Downloads\webapp-1.3.1.svn41348.tar\webapp-1.3.1.svn41348/client/zarafa/common/sendas/ui/SendAsPanel.js 1970-01-01 01:00:00.000000000 +0100
+++ ./client/zarafa/common/sendas/ui/SendAsPanel.js 2013-05-02 21:12:03.987889700 +0200
@@ -0,0 +1,160 @@
+Ext.namespace('Zarafa.common.sendas.ui');
+
+/**
+ * @class Zarafa.common.sendas.ui.SendAsPanel
+ * @extends Ext.Panel
+ * @xtype zarafa.sendaspanel
+ * Will generate UI for the {@link Zarafa.common.settings.SettingsSendAsWidget SettingsSendAsWidget}.
+ */
+Zarafa.common.sendas.ui.SendAsPanel = Ext.extend(Ext.Panel, {
+
+ // store
+ store : undefined,
+
+ /**
+ * @constructor
+ * @param config Configuration structure
+ */
+ constructor : function(config)
+ {
+ config = config || {};
+ if(config.store)
+ this.store = config.store;
+
+ Ext.applyIf(config, {
+ // Override from Ext.Component
+ xtype : 'zarafa.sendaspanel',
+ border : false,
+ layout : {
+ type : 'vbox',
+ align : 'stretch',
+ pack : 'start'
+ },
+ items : this.createPanelItems(this.store)
+ });
+
+ Zarafa.common.sendas.ui.SendAsPanel.superclass.constructor.call(this, config);
+ },
+
+ /**
+ * Function will create panel items for {@link Zarafa.common.sendas.ui.SendAsPanel SendAsPanel}
+ * @return {Array} array of items that should be added to panel.
+ * @private
+ */
+ createPanelItems : function(store)
+ {
+ return [{
+ xtype : 'displayfield',
+ value : _('Here you can setup your alias email addresses.'),
+ fieldClass : 'x-form-display-field zarafa-delegates-extrainfo'
+ }, {
+ xtype : 'container',
+ flex : 1,
+ layout : {
+ type : 'hbox',
+ align : 'stretch',
+ pack : 'start'
+ },
+ items : [{
+ xtype : 'zarafa.sendasgrid',
+ ref : '../sendasGrid',
+ store : store,
+ flex : 1
+ }, {
+ xtype : 'container',
+ width : 160,
+ defaults : {
+ width : 140
+ },
+ layout : {
+ type : 'vbox',
+ align : 'center',
+ pack : 'start'
+ },
+ items : [{
+ xtype : 'button',
+ text : _('Add') + '...',
+ handler : this.onSendAsAdd,
+ ref : '../../addButton',
+ scope : this
+ }, {
+ xtype : 'spacer',
+ height : 20
+ }, {
+ xtype : 'button',
+ text : _('Remove') + '...',
+ disabled : true,
+ ref : '../../removeButton',
+ handler : this.onSendAsRemove,
+ scope : this
+ }]
+ }]
+ }];
+ },
+
+ /**
+ * initialize events for the panel.
+ * @private
+ */
+ initEvents : function()
+ {
+ Zarafa.common.sendas.ui.SendAsPanel.superclass.initEvents.call(this);
+
+ // register event to enable/disable buttons
+ this.mon(this.sendasGrid.getSelectionModel(), 'selectionchange', this.onGridSelectionChange, this);
+ },
+
+ /**
+ * Handler function will be called when user clicks on 'Add' button,
+ * this will show addressbook dialog to select sendas user.
+ * @private
+ */
+ onSendAsAdd : function()
+ {
+ Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType['common.sendas.dialog.sendasedit'], undefined, {
+ store : this.store,
+ item : undefined,
+ manager : Ext.WindowMgr
+ });
+ },
+
+ /**
+ * Event handler will be called when selection in {@link Zarafa.common.ui.SendAsGrid SendAsGrid}
+ * has been changed
+ * @param {Ext.grid.RowSelectionModel} selectionModel selection model that fired the event
+ */
+ onGridSelectionChange : function(selectionModel)
+ {
+ var noSelection = (selectionModel.hasSelection() === false);
+
+ this.removeButton.setDisabled(noSelection);
+ },
+
+ /**
+ * Handler function will be called when user clicks on 'Remove' button,
+ * this will remove currently selected sendas from sendass list.
+ * @private
+ */
+ onSendAsRemove : function()
+ {
+ this.sendasGrid.removeSendAs();
+ },
+
+ /**
+ * Function will be used to reload data in the store.
+ */
+ discardChanges : function()
+ {
+ this.store.load();
+ },
+
+ /**
+ * Function will be used to save changes in the store.
+ */
+ saveChanges : function()
+ {
+ this.store.save();
+ }
+});
+
+Ext.reg('zarafa.sendaspanel', Zarafa.common.sendas.ui.SendAsPanel);
diff -ruN --exclude-from=..\diffexclude.txt C:\Users\admhaasch\Downloads\webapp-1.3.1.svn41348.tar\webapp-1.3.1.svn41348/client/zarafa/common/settings/SettingsSendAsCategory.js ./client/zarafa/common/settings/SettingsSendAsCategory.js
--- C:\Users\admhaasch\Downloads\webapp-1.3.1.svn41348.tar\webapp-1.3.1.svn41348/client/zarafa/common/settings/SettingsSendAsCategory.js 1970-01-01 01:00:00.000000000 +0100
+++ ./client/zarafa/common/settings/SettingsSendAsCategory.js 2013-05-02 17:40:58.653474000 +0200
@@ -0,0 +1,50 @@
+Ext.namespace('Zarafa.common.settings');
+
+/**
+ * @class Zarafa.common.settings.SettingsSendAsCategory
+ * @extends Zarafa.settings.ui.SettingsCategory
+ * @xtype zarafa.settingssendascategory
+ *
+ * The sendas category for users which will allow the user to configure send as settings.
+ */
+Zarafa.common.settings.SettingsSendAsCategory = Ext.extend(Zarafa.settings.ui.SettingsCategory, {
+ // Insertion points for this class
+ /**
+ * @insert context.settings.category.sendas
+ * Insertion point to register new {@link Zarafa.settings.ui.SettingsWidget widgets}
+ * for the {@link Zarafa.common.settings.SettingsSendAsCategory SendAs Category}.
+ * @param {Zarafa.common.settings.SettingsSendAsCategory} category The sendas
+ * category to which the widgets will be added.
+ */
+
+ /**
+ * @cfg {Zarafa.settings.SettingsContext} settingsContext
+ */
+ settingsContext : undefined,
+
+ /**
+ * @constructor
+ * @param {Object} config Configuration object
+ */
+ constructor : function(config)
+ {
+ config = config || {};
+
+ Ext.applyIf(config, {
+ title : _('Send As'),
+ categoryIndex : 6,
+ xtype : 'zarafa.settingssendascategory',
+ iconCls : 'zarafa-settings-category-delegate',
+ items : [{
+ xtype : 'zarafa.settingssendaswidget',
+ settingsContext : config.settingsContext
+ },
+ container.populateInsertionPoint('context.settings.category.sendas', this)
+ ]
+ });
+
+ Zarafa.common.settings.SettingsSendAsCategory.superclass.constructor.call(this, config);
+ }
+});
+
+Ext.reg('zarafa.settingssendascategory', Zarafa.common.settings.SettingsSendAsCategory);
diff -ruN --exclude-from=..\diffexclude.txt C:\Users\admhaasch\Downloads\webapp-1.3.1.svn41348.tar\webapp-1.3.1.svn41348/client/zarafa/common/settings/SettingsSendAsWidget.js ./client/zarafa/common/settings/SettingsSendAsWidget.js
--- C:\Users\admhaasch\Downloads\webapp-1.3.1.svn41348.tar\webapp-1.3.1.svn41348/client/zarafa/common/settings/SettingsSendAsWidget.js 1970-01-01 01:00:00.000000000 +0100
+++ ./client/zarafa/common/settings/SettingsSendAsWidget.js 2013-05-02 20:23:02.528647900 +0200
@@ -0,0 +1,107 @@
+Ext.namespace('Zarafa.common.settings');
+
+/**
+ * @class Zarafa.common.settings.SettingsSendAsWidget
+ * @extends Zarafa.settings.ui.SettingsWidget
+ * @xtype zarafa.settingssendaswidget
+ *
+ * The {@link Zarafa.settings.ui.SettingsWidget widget} for configuring
+ * delegation options in the {@link Zarafa.common.settings.SettingsSendAsCategory sendas category}.
+ */
+Zarafa.common.settings.SettingsSendAsWidget = Ext.extend(Zarafa.settings.ui.SettingsWidget, {
+ /**
+ * @cfg {Zarafa.settings.SettingsContext} settingsContext
+ */
+ settingsContext : undefined,
+
+ /**
+ * @constructor
+ * @param {Object} config Configuration object
+ */
+ constructor : function(config)
+ {
+ config = config || {};
+
+ var store = new Ext.data.JsonStore({
+ fields : [
+ { name : 'id', type : 'int' },
+ { name : 'display_name' },
+ { name : 'email_address' }
+ ],
+ sortInfo : {
+ field : 'id',
+ direction : 'ASC'
+ },
+ autoDestroy : true
+ });
+
+ Ext.applyIf(config, {
+ height : 400,
+ title : _('Send As settings'),
+ xtype : 'zarafa.settingssendaswidget',
+ layout : {
+ // override from SettingsWidget
+ type : 'fit'
+ },
+ items : [{
+ xtype : 'zarafa.sendaspanel',
+ store : store,
+ ref : 'sendasPanel'
+ }]
+ });
+
+ Zarafa.common.settings.SettingsSendAsWidget.superclass.constructor.call(this, config);
+ },
+
+ /**
+ * Called by the {@link Zarafa.settings.ui.SettingsCategory Category} when
+ * it has been called with {@link zarafa.settings.ui.SettingsCategory#update}.
+ * This is used to load the latest version of the settings from the
+ * {@link Zarafa.settings.SettingsModel} into the UI of this category.
+ * @param {Zarafa.settings.SettingsModel} settingsModel The settings to load
+ */
+ update : function(settingsModel)
+ {
+ this.model = settingsModel;
+
+ // Convert the signatures into Store data
+ var addresses = settingsModel.get('zarafa/v1/contexts/mail/sendas', true);
+ var addressesArray = [];
+ for (var key in addresses) {
+ addressesArray.push(Ext.apply({}, addresses[key], { id : key }));
+ }
+
+ // Load all addresses into the GridPanel
+ var store = this.sendasPanel.sendasGrid.getStore();
+ store.loadData(addressesArray);
+ },
+
+ /**
+ * Called by the {@link Zarafa.settings.ui.SettingsCategory Category} when
+ * it has been called with {@link zarafa.settings.ui.SettingsCategory#updateSettings}.
+ * This is used to update the settings from the UI into the {@link Zarafa.settings.SettingsModel settings model}.
+ * @param {Zarafa.settings.SettingsModel} settingsModel The settings to update
+ */
+ updateSettings : function(settingsModel)
+ {
+ settingsModel.beginEdit();
+
+ // Start reading the Grid store and convert the contents back into
+ // an object which can be pushed to the settings.
+ var addresses = this.sendasPanel.sendasGrid.getStore().getRange();
+ var addressesData = {};
+ for (var i = 0, len = addresses.length; i < len; i++) {
+ var address = addresses[i];
+
+ addressesData[address.get('id')] = {
+ 'display_name' : address.get('display_name'),
+ 'email_address' : address.get('email_address')
+ };
+ }
+ settingsModel.set('zarafa/v1/contexts/mail/sendas', addressesData);
+
+ settingsModel.endEdit();
+ }
+});
+
+Ext.reg('zarafa.settingssendaswidget', Zarafa.common.settings.SettingsSendAsWidget);
diff -ruN --exclude-from=..\diffexclude.txt C:\Users\admhaasch\Downloads\webapp-1.3.1.svn41348.tar\webapp-1.3.1.svn41348/client/zarafa/mail/dialogs/MailCreatePanel.js ./client/zarafa/mail/dialogs/MailCreatePanel.js
--- C:\Users\admhaasch\Downloads\webapp-1.3.1.svn41348.tar\webapp-1.3.1.svn41348/client/zarafa/mail/dialogs/MailCreatePanel.js 2013-01-25 16:42:28.000000000 +0100
+++ ./client/zarafa/mail/dialogs/MailCreatePanel.js 2013-05-03 12:46:43.505588600 +0200
@@ -59,6 +59,44 @@
this.mon(this.dialog, 'fromtoggle', this.onDialogFromToggle, this);
}
},
+
+ /**
+ * Returns items for the splitbutton
+ * @private
+ */
+ initSendAsList : function() {
+
+ var addresses = container.getSettingsModel().get('zarafa/v1/contexts/mail/sendas', true);
+ var addressesArray = [];
+ var items = [];
+
+ for (var key in addresses) {
+ addressesArray.push(Ext.apply({}, addresses[key], { id : key }));
+ }
+
+ if(addressesArray.length != 0) {
+ Ext.each(addressesArray, function (record) {
+ var item = {
+ text: record.display_name + ' (' + record.email_address + ')',
+ handler: this.onSelectQuickUser.createDelegate(this, [record], 0)
+ };
+
+ if(record.display_name === ""){
+ // we don't need the brackets, just use the mail address
+ item.text = record.email_address;
+ }
+
+ items.push(item);
+ }, this);
+ } else {
+ items.push({
+ text: _('No alias set!'),
+ handler: this.onSelectUser
+ });
+ }
+
+ return items;
+ },
/**
* Creates the form panel
@@ -67,6 +105,7 @@
initMessageFormPanel : function(config)
{
var items = [];
+ var quickSendItems = this.initSendAsList();
items.push({
xtype: 'zarafa.compositefield',
@@ -75,10 +114,22 @@
anchor: '100%',
autoHeight: true,
items: [{
- xtype: 'button',
+ xtype: 'splitbutton',
width: 100,
text: _('From') + ':',
handler: this.onSelectUser,
+ menu: new Ext.menu.Menu({
+ style: {
+ backgroundImage: 'none' // if "showSeperator" does not work
+ },
+ defaults: {
+ style: {
+ paddingLeft: 0
+ }
+ },
+ showSeperator: false,
+ items: quickSendItems // quick sendas
+ }),
scope: this
},{
xtype: 'zarafa.addressbookboxfield',
@@ -435,6 +486,28 @@
}
});
},
+
+ /**
+ * Event handler which is fired when the user presses a item in the 'Name' splitbutton.
+ *
+ * @private
+ */
+ onSelectQuickUser : function(item)
+ {
+ var recipientRecord = Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT, {
+ display_name : item.display_name !== "" ? item.display_name : item.email_address,
+ email_address : item.email_address,
+ smtp_address : item.email_address,
+ recipient_type : Zarafa.core.mapi.RecipientType.MAPI_ORIG
+ });
+
+ var store = this.fromRecipientField.getBoxStore();
+
+ // We need to maintain that in from field there should be only one user,
+ // So remove earlier added user.
+ store.removeAll();
+ store.add(recipientRecord);
+ },
/**
* Callback function for {@link Zarafa.addressbook.dialogs.ABUserSelectionContent AddressBook}