temp commit

This commit is contained in:
Christoph Haas 2013-08-25 10:44:25 +00:00
parent ae48beb111
commit fbe6a184f4
5 changed files with 116 additions and 99 deletions

View File

@ -0,0 +1,40 @@
Ext.namespace('Zarafa.plugins.calendarimporter.settings.dialogs');
/**
* @class Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditContentPanel
* @extends Zarafa.core.ui.ContentPanel
* @xtype calendarimporter.calsynceditcontentpanel
*
* {@link Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditContentPanel CalSyncEditContentPanel} will be used to edit ics sync entries.
*/
Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditContentPanel = 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 : 'calendarimporter.calsynceditcontentpanel',
// Override from Ext.Component
layout : 'fit',
model : true,
autoSave : false,
width : 400,
height : 100,
title : _('ICAL Sync'),
items : [{
xtype : 'calendarimporter.calsynceditpanel',
item : config.item
}]
});
Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditContentPanel.superclass.constructor.call(this, config);
}
});
Ext.reg('calendarimporter.calsynceditcontentpanel', Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditContentPanel);

View File

@ -1,13 +1,13 @@
Ext.namespace('Zarafa.common.sendas.dialogs'); Ext.namespace('Zarafa.plugins.calendarimporter.settings.dialogs');
/** /**
* @class Zarafa.common.sendas.dialogs.SendAsEditPanel * @class Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel
* @extends Ext.form.FormPanel * @extends Ext.form.FormPanel
* @xtype zarafa.sendaseditpanel * @xtype calendarimporter.calsynceditpanel
* *
* Will generate UI for {@link Zarafa.common.sendas.dialogs.SendAsEditContentPanel SendAsEditContentPanel}. * Will generate UI for {@link Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel CalSyncEditPanel}.
*/ */
Zarafa.common.sendas.dialogs.SendAsEditPanel = Ext.extend(Ext.form.FormPanel, { Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(Ext.form.FormPanel, {
/** /**
* the id of the currently edited item * the id of the currently edited item
@ -27,7 +27,7 @@ Zarafa.common.sendas.dialogs.SendAsEditPanel = Ext.extend(Ext.form.FormPanel, {
Ext.applyIf(config, { Ext.applyIf(config, {
// Override from Ext.Component // Override from Ext.Component
xtype : 'zarafa.sendaseditpanel', xtype : 'calendarimporter.calsynceditpanel',
labelAlign : 'left', labelAlign : 'left',
defaultType: 'textfield', defaultType: 'textfield',
items : this.createPanelItems(config), items : this.createPanelItems(config),
@ -43,7 +43,7 @@ Zarafa.common.sendas.dialogs.SendAsEditPanel = Ext.extend(Ext.form.FormPanel, {
}] }]
}); });
Zarafa.common.sendas.dialogs.SendAsEditPanel.superclass.constructor.call(this, config); Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel.superclass.constructor.call(this, config);
}, },
/** /**
@ -63,18 +63,18 @@ Zarafa.common.sendas.dialogs.SendAsEditPanel = Ext.extend(Ext.form.FormPanel, {
if(!this.currentItem) { if(!this.currentItem) {
record = new store.recordType({ record = new store.recordType({
id: this.hashCode(this.email_address.getValue()), id: this.hashCode(this.icsurl.getValue()),
display_name: this.display_name.getValue(), display_name: this.display_name.getValue(),
email_address: this.email_address.getValue() icsurl: this.icsurl.getValue()
}); });
} }
if(this.email_address.isValid()) { if(this.icsurl.isValid()) {
if(record) { if(record) {
store.add(record); store.add(record);
} else { } else {
this.currentItem.set('display_name', this.display_name.getValue()); this.currentItem.set('display_name', this.display_name.getValue());
this.currentItem.set('email_address', this.email_address.getValue()); this.currentItem.set('icsurl', this.icsurl.getValue());
} }
this.dialog.close(); this.dialog.close();
} }
@ -88,11 +88,11 @@ Zarafa.common.sendas.dialogs.SendAsEditPanel = Ext.extend(Ext.form.FormPanel, {
createPanelItems : function(config) createPanelItems : function(config)
{ {
var displayName = ""; var displayName = "";
var emailAddress = ""; var icsUrl = "";
if(config.item){ if(config.item){
displayName = config.item.get('display_name'); displayName = config.item.get('display_name');
emailAddress = config.item.get('email_address'); icsUrl = config.item.get('icsurl');
} }
return [{ return [{
@ -103,11 +103,11 @@ Zarafa.common.sendas.dialogs.SendAsEditPanel = Ext.extend(Ext.form.FormPanel, {
anchor: '100%' anchor: '100%'
}, },
{ {
fieldLabel: _('Email Address'), fieldLabel: _('ICS Url'),
name: 'email_address', name: 'icsurl',
ref: 'email_address', ref: 'icsurl',
allowBlank: false, allowBlank: false,
value: emailAddress, value: icsUrl,
vtype:'email', vtype:'email',
anchor: '100%' anchor: '100%'
}]; }];
@ -132,4 +132,4 @@ Zarafa.common.sendas.dialogs.SendAsEditPanel = Ext.extend(Ext.form.FormPanel, {
} }
}); });
Ext.reg('zarafa.sendaseditpanel', Zarafa.common.sendas.dialogs.SendAsEditPanel); Ext.reg('calendarimporter.calsynceditpanel', Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel);

View File

@ -1,40 +0,0 @@
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);

View File

@ -1,14 +1,14 @@
Ext.namespace('Zarafa.common.sendas.ui'); Ext.namespace('Zarafa.plugins.calendarimporter.settings.ui');
/** /**
* @class Zarafa.common.sendas.ui.SendAsGrid * @class Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid
* @extends Ext.grid.GridPanel * @extends Ext.grid.GridPanel
* @xtype zarafa.sendasgrid * @xtype calendarimporter.calsyncgrid
* *
* {@link Zarafa.common.sendas.ui.SendAsGrid SendAsGrid} will be used to display * {@link Zarafa.common.sendas.ui.SendAsGrid SendAsGrid} will be used to display
* sendas of the current user. * sendas of the current user.
*/ */
Zarafa.common.sendas.ui.SendAsGrid = Ext.extend(Ext.grid.GridPanel, { Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid = Ext.extend(Ext.grid.GridPanel, {
/** /**
* @constructor * @constructor
* @param {Object} config Configuration structure * @param {Object} config Configuration structure
@ -18,12 +18,12 @@ Zarafa.common.sendas.ui.SendAsGrid = Ext.extend(Ext.grid.GridPanel, {
config = config || {}; config = config || {};
Ext.applyIf(config, { Ext.applyIf(config, {
xtype : 'zarafa.sendasgrid', xtype : 'calendarimporter.calsyncpanel',
border : true, border : true,
store : config.store, store : config.store,
viewConfig : { viewConfig : {
forceFit : true, forceFit : true,
emptyText : '<div class=\'emptytext\'>' + _('No sendas address exists') + '</div>' emptyText : '<div class=\'emptytext\'>' + _('No ICAL sync entry exists') + '</div>'
}, },
loadMask : this.initLoadMask(), loadMask : this.initLoadMask(),
columns : this.initColumnModel(), columns : this.initColumnModel(),
@ -35,7 +35,7 @@ Zarafa.common.sendas.ui.SendAsGrid = Ext.extend(Ext.grid.GridPanel, {
} }
}); });
Zarafa.common.sendas.ui.SendAsGrid.superclass.constructor.call(this, config); Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid.superclass.constructor.call(this, config);
}, },
/** /**
@ -44,11 +44,21 @@ Zarafa.common.sendas.ui.SendAsGrid = Ext.extend(Ext.grid.GridPanel, {
*/ */
initEvents : function() initEvents : function()
{ {
Zarafa.common.sendas.ui.SendAsGrid.superclass.initEvents.call(this); Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid.superclass.initEvents.call(this);
// select first sendas when store has finished loading // select first sendas when store has finished loading
this.mon(this.store, 'load', this.onViewReady, this, {single : true}); this.mon(this.store, 'load', this.onViewReady, this, {single : true});
}, },
/**
* Render function
* @return {String}
* @private
*/
renderAuthColumn : function(value, p, record)
{
return value ? "true" : "false";
},
/** /**
* Creates a column model object, used in {@link #colModel} config * Creates a column model object, used in {@link #colModel} config
@ -58,13 +68,22 @@ Zarafa.common.sendas.ui.SendAsGrid = Ext.extend(Ext.grid.GridPanel, {
initColumnModel : function() initColumnModel : function()
{ {
return [{ return [{
dataIndex : 'display_name', dataIndex : 'icsurl',
header : _('Name'), header : _('ICS File'),
renderer : Zarafa.common.ui.grid.Renderers.text renderer : Zarafa.common.ui.grid.Renderers.text
}, },
{ {
dataIndex : 'email_address', dataIndex : 'user',
header : _('Email Address'), header : _('Authentication'),
renderer : this.renderAuthColumn
},
{
dataIndex : 'intervall',
header : _('Sync Intervall')
},
{
dataIndex : 'lastsync',
header : _('Last Synchronisation'),
renderer : Zarafa.common.ui.grid.Renderers.text renderer : Zarafa.common.ui.grid.Renderers.text
}] }]
}, },
@ -90,7 +109,7 @@ Zarafa.common.sendas.ui.SendAsGrid = Ext.extend(Ext.grid.GridPanel, {
initLoadMask : function() initLoadMask : function()
{ {
return { return {
msg : _('Loading sendas addresses') + '...' msg : _('Loading ics sync entries') + '...'
}; };
}, },
@ -105,27 +124,27 @@ Zarafa.common.sendas.ui.SendAsGrid = Ext.extend(Ext.grid.GridPanel, {
}, },
/** /**
* Function will be called to remove a sendas address. * Function will be called to remove a ics sync entry.
*/ */
removeSendAs : function() removeSendAs : function()
{ {
var sendasRecord = this.getSelectionModel().getSelected(); var icsRecord = this.getSelectionModel().getSelected();
if(!sendasRecord) { if(!icsRecord) {
Ext.Msg.alert(_('Alert'), _('Please select a sendas address.')); Ext.Msg.alert(_('Alert'), _('Please select a ics sync entry.'));
return; return;
} }
this.store.remove(sendasRecord); this.store.remove(icsRecord);
}, },
/** /**
* Event handler which is fired when the {@link Zarafa.common.sendas.ui.SendAsGrid SendAsGrid} is double clicked. * Event handler which is fired when the {@link Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid CalSyncGrid} is double clicked.
* it will call generic function to handle the functionality. * it will call generic function to handle the functionality.
* @private * @private
*/ */
onRowDblClick : function(grid, rowIndex) onRowDblClick : function(grid, rowIndex)
{ {
Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType['common.sendas.dialog.sendasedit'], undefined, { Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType['plugins.calendarimporter.settings.dialogs.calsyncedit'], undefined, {
store : grid.getStore(), store : grid.getStore(),
item : grid.getStore().getAt(rowIndex), item : grid.getStore().getAt(rowIndex),
manager : Ext.WindowMgr manager : Ext.WindowMgr
@ -133,4 +152,4 @@ Zarafa.common.sendas.ui.SendAsGrid = Ext.extend(Ext.grid.GridPanel, {
} }
}); });
Ext.reg('zarafa.sendasgrid', Zarafa.common.sendas.ui.SendAsGrid); Ext.reg('calendarimporter.calsyncpanel', Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid);

View File

@ -1,12 +1,12 @@
Ext.namespace('Zarafa.common.sendas.ui'); Ext.namespace('Zarafa.plugins.calendarimporter.settings.ui');
/** /**
* @class Zarafa.common.sendas.ui.SendAsPanel * @class Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel
* @extends Ext.Panel * @extends Ext.Panel
* @xtype zarafa.sendaspanel * @xtype calendarimporter.calsyncpanel
* Will generate UI for the {@link Zarafa.common.settings.SettingsSendAsWidget SettingsSendAsWidget}. * Will generate UI for the {@link Zarafa.common.settings.SettingsSendAsWidget SettingsSendAsWidget}.
*/ */
Zarafa.common.sendas.ui.SendAsPanel = Ext.extend(Ext.Panel, { Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel = Ext.extend(Ext.Panel, {
// store // store
store : undefined, store : undefined,
@ -23,7 +23,7 @@ Zarafa.common.sendas.ui.SendAsPanel = Ext.extend(Ext.Panel, {
Ext.applyIf(config, { Ext.applyIf(config, {
// Override from Ext.Component // Override from Ext.Component
xtype : 'zarafa.sendaspanel', xtype : 'calendarimporter.calsyncpanel',
border : false, border : false,
layout : { layout : {
type : 'vbox', type : 'vbox',
@ -33,11 +33,11 @@ Zarafa.common.sendas.ui.SendAsPanel = Ext.extend(Ext.Panel, {
items : this.createPanelItems(this.store) items : this.createPanelItems(this.store)
}); });
Zarafa.common.sendas.ui.SendAsPanel.superclass.constructor.call(this, config); Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel.superclass.constructor.call(this, config);
}, },
/** /**
* Function will create panel items for {@link Zarafa.common.sendas.ui.SendAsPanel SendAsPanel} * Function will create panel items for {@link Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel CalSyncPanel}
* @return {Array} array of items that should be added to panel. * @return {Array} array of items that should be added to panel.
* @private * @private
*/ */
@ -45,8 +45,8 @@ Zarafa.common.sendas.ui.SendAsPanel = Ext.extend(Ext.Panel, {
{ {
return [{ return [{
xtype : 'displayfield', xtype : 'displayfield',
value : _('Here you can setup your alias email addresses.'), value : _('Here you can .ics files that will be synchronised.'),
fieldClass : 'x-form-display-field zarafa-delegates-extrainfo' fieldClass : 'x-form-display-field'
}, { }, {
xtype : 'container', xtype : 'container',
flex : 1, flex : 1,
@ -56,8 +56,8 @@ Zarafa.common.sendas.ui.SendAsPanel = Ext.extend(Ext.Panel, {
pack : 'start' pack : 'start'
}, },
items : [{ items : [{
xtype : 'zarafa.sendasgrid', xtype : 'calendarimporter.calsyncgrid',
ref : '../sendasGrid', ref : '../calsyncGrid',
store : store, store : store,
flex : 1 flex : 1
}, { }, {
@ -98,20 +98,19 @@ Zarafa.common.sendas.ui.SendAsPanel = Ext.extend(Ext.Panel, {
*/ */
initEvents : function() initEvents : function()
{ {
Zarafa.common.sendas.ui.SendAsPanel.superclass.initEvents.call(this); Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel.superclass.initEvents.call(this);
// register event to enable/disable buttons // register event to enable/disable buttons
this.mon(this.sendasGrid.getSelectionModel(), 'selectionchange', this.onGridSelectionChange, this); this.mon(this.calsyncGrid.getSelectionModel(), 'selectionchange', this.onGridSelectionChange, this);
}, },
/** /**
* Handler function will be called when user clicks on 'Add' button, * Handler function will be called when user clicks on 'Add' button.
* this will show addressbook dialog to select sendas user.
* @private * @private
*/ */
onSendAsAdd : function() onSendAsAdd : function()
{ {
Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType['common.sendas.dialog.sendasedit'], undefined, { Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType['plugins.calendarimporter.settings.dialogs.calsyncedit'], undefined, {
store : this.store, store : this.store,
item : undefined, item : undefined,
manager : Ext.WindowMgr manager : Ext.WindowMgr
@ -119,7 +118,7 @@ Zarafa.common.sendas.ui.SendAsPanel = Ext.extend(Ext.Panel, {
}, },
/** /**
* Event handler will be called when selection in {@link Zarafa.common.ui.SendAsGrid SendAsGrid} * Event handler will be called when selection in {@link Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid CalSyncGrid}
* has been changed * has been changed
* @param {Ext.grid.RowSelectionModel} selectionModel selection model that fired the event * @param {Ext.grid.RowSelectionModel} selectionModel selection model that fired the event
*/ */
@ -131,8 +130,7 @@ Zarafa.common.sendas.ui.SendAsPanel = Ext.extend(Ext.Panel, {
}, },
/** /**
* Handler function will be called when user clicks on 'Remove' button, * Handler function will be called when user clicks on 'Remove' button.
* this will remove currently selected sendas from sendass list.
* @private * @private
*/ */
onSendAsRemove : function() onSendAsRemove : function()
@ -157,4 +155,4 @@ Zarafa.common.sendas.ui.SendAsPanel = Ext.extend(Ext.Panel, {
} }
}); });
Ext.reg('zarafa.sendaspanel', Zarafa.common.sendas.ui.SendAsPanel); Ext.reg('calendarimporter.calsyncpanel', Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel);