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
* @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
@ -27,7 +27,7 @@ Zarafa.common.sendas.dialogs.SendAsEditPanel = Ext.extend(Ext.form.FormPanel, {
Ext.applyIf(config, {
// Override from Ext.Component
xtype : 'zarafa.sendaseditpanel',
xtype : 'calendarimporter.calsynceditpanel',
labelAlign : 'left',
defaultType: 'textfield',
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) {
record = new store.recordType({
id: this.hashCode(this.email_address.getValue()),
id: this.hashCode(this.icsurl.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) {
store.add(record);
} else {
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();
}
@ -88,11 +88,11 @@ Zarafa.common.sendas.dialogs.SendAsEditPanel = Ext.extend(Ext.form.FormPanel, {
createPanelItems : function(config)
{
var displayName = "";
var emailAddress = "";
var icsUrl = "";
if(config.item){
displayName = config.item.get('display_name');
emailAddress = config.item.get('email_address');
icsUrl = config.item.get('icsurl');
}
return [{
@ -103,11 +103,11 @@ Zarafa.common.sendas.dialogs.SendAsEditPanel = Ext.extend(Ext.form.FormPanel, {
anchor: '100%'
},
{
fieldLabel: _('Email Address'),
name: 'email_address',
ref: 'email_address',
fieldLabel: _('ICS Url'),
name: 'icsurl',
ref: 'icsurl',
allowBlank: false,
value: emailAddress,
value: icsUrl,
vtype:'email',
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
* @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);