temp commit

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

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
* @xtype zarafa.sendasgrid
* @xtype calendarimporter.calsyncgrid
*
* {@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, {
Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid = Ext.extend(Ext.grid.GridPanel, {
/**
* @constructor
* @param {Object} config Configuration structure
@@ -18,12 +18,12 @@ Zarafa.common.sendas.ui.SendAsGrid = Ext.extend(Ext.grid.GridPanel, {
config = config || {};
Ext.applyIf(config, {
xtype : 'zarafa.sendasgrid',
xtype : 'calendarimporter.calsyncpanel',
border : true,
store : config.store,
viewConfig : {
forceFit : true,
emptyText : '<div class=\'emptytext\'>' + _('No sendas address exists') + '</div>'
emptyText : '<div class=\'emptytext\'>' + _('No ICAL sync entry exists') + '</div>'
},
loadMask : this.initLoadMask(),
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()
{
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
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
@@ -58,13 +68,22 @@ Zarafa.common.sendas.ui.SendAsGrid = Ext.extend(Ext.grid.GridPanel, {
initColumnModel : function()
{
return [{
dataIndex : 'display_name',
header : _('Name'),
dataIndex : 'icsurl',
header : _('ICS File'),
renderer : Zarafa.common.ui.grid.Renderers.text
},
{
dataIndex : 'email_address',
header : _('Email Address'),
dataIndex : 'user',
header : _('Authentication'),
renderer : this.renderAuthColumn
},
{
dataIndex : 'intervall',
header : _('Sync Intervall')
},
{
dataIndex : 'lastsync',
header : _('Last Synchronisation'),
renderer : Zarafa.common.ui.grid.Renderers.text
}]
},
@@ -90,7 +109,7 @@ Zarafa.common.sendas.ui.SendAsGrid = Ext.extend(Ext.grid.GridPanel, {
initLoadMask : function()
{
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()
{
var sendasRecord = this.getSelectionModel().getSelected();
if(!sendasRecord) {
Ext.Msg.alert(_('Alert'), _('Please select a sendas address.'));
var icsRecord = this.getSelectionModel().getSelected();
if(!icsRecord) {
Ext.Msg.alert(_('Alert'), _('Please select a ics sync entry.'));
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.
* @private
*/
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(),
item : grid.getStore().getAt(rowIndex),
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
* @xtype zarafa.sendaspanel
* @xtype calendarimporter.calsyncpanel
* 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 : undefined,
@@ -23,7 +23,7 @@ Zarafa.common.sendas.ui.SendAsPanel = Ext.extend(Ext.Panel, {
Ext.applyIf(config, {
// Override from Ext.Component
xtype : 'zarafa.sendaspanel',
xtype : 'calendarimporter.calsyncpanel',
border : false,
layout : {
type : 'vbox',
@@ -33,11 +33,11 @@ Zarafa.common.sendas.ui.SendAsPanel = Ext.extend(Ext.Panel, {
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.
* @private
*/
@@ -45,8 +45,8 @@ Zarafa.common.sendas.ui.SendAsPanel = Ext.extend(Ext.Panel, {
{
return [{
xtype : 'displayfield',
value : _('Here you can setup your alias email addresses.'),
fieldClass : 'x-form-display-field zarafa-delegates-extrainfo'
value : _('Here you can .ics files that will be synchronised.'),
fieldClass : 'x-form-display-field'
}, {
xtype : 'container',
flex : 1,
@@ -56,8 +56,8 @@ Zarafa.common.sendas.ui.SendAsPanel = Ext.extend(Ext.Panel, {
pack : 'start'
},
items : [{
xtype : 'zarafa.sendasgrid',
ref : '../sendasGrid',
xtype : 'calendarimporter.calsyncgrid',
ref : '../calsyncGrid',
store : store,
flex : 1
}, {
@@ -98,20 +98,19 @@ Zarafa.common.sendas.ui.SendAsPanel = Ext.extend(Ext.Panel, {
*/
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
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,
* this will show addressbook dialog to select sendas user.
* Handler function will be called when user clicks on 'Add' button.
* @private
*/
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,
item : undefined,
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
* @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,
* this will remove currently selected sendas from sendass list.
* Handler function will be called when user clicks on 'Remove' button.
* @private
*/
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);