tmp commit

This commit is contained in:
Christoph Haas 2013-08-25 13:47:49 +00:00
parent fbe6a184f4
commit 4065607f40
11 changed files with 130 additions and 45 deletions

View File

@ -1,6 +1,6 @@
<project default="all"> <project default="all">
<!--############# CONFIGURE ALL PROPERTIES FOR THE REPLACER HERE ################--> <!--############# CONFIGURE ALL PROPERTIES FOR THE REPLACER HERE ################-->
<property name="plugin_version" value="2.0.3"/> <property name="plugin_version" value="2.0.4"/>
<!-- EOC --> <!-- EOC -->
<property name="root-folder" value="${basedir}/../"/> <property name="root-folder" value="${basedir}/../"/>
@ -102,6 +102,11 @@
<fileset file="js/data/ResponseHandler.js" /> <fileset file="js/data/ResponseHandler.js" />
<fileset file="js/dialogs/ImportContentPanel.js" /> <fileset file="js/dialogs/ImportContentPanel.js" />
<fileset file="js/dialogs/ImportPanel.js" /> <fileset file="js/dialogs/ImportPanel.js" />
<fileset file="js/settings/SettingsCalSyncWidget.js" />
<fileset file="js/settings/ui/CalSyncPanel.js" />
<fileset file="js/settings/ui/CalSyncGrid.js" />
<fileset file="js/settings/dialogs/CalSyncEditContentPanel.js" />
<fileset file="js/settings/dialogs/CalSyncEditPanel.js" />
</concat> </concat>
</then> </then>
</if> </if>

View File

@ -1,3 +1,6 @@
calendarimporter 2.0.3:
- added sync support for ics files
calendarimporter 2.0.3: calendarimporter 2.0.3:
- fixed all day events - fixed all day events

View File

@ -3,6 +3,8 @@
define('PLUGIN_CALENDARIMPORTER_USER_DEFAULT_ENABLE', false); define('PLUGIN_CALENDARIMPORTER_USER_DEFAULT_ENABLE', false);
/** Disable the export feature for all clients */ /** Disable the export feature for all clients */
define('PLUGIN_CALENDARIMPORTER_USER_DEFAULT_ENABLE_EXPORT', false); define('PLUGIN_CALENDARIMPORTER_USER_DEFAULT_ENABLE_EXPORT', false);
/** Disable the sync feature for all clients */
define('PLUGIN_CALENDARIMPORTER_USER_DEFAULT_ENABLE_SYNC', true);
/** The default calendar to import to*/ /** The default calendar to import to*/
define('PLUGIN_CALENDARIMPORTER_DEFAULT', "calendar"); define('PLUGIN_CALENDARIMPORTER_DEFAULT', "calendar");

View File

@ -50,8 +50,8 @@ Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel = Ext.extend(Zarafa.c
layout : 'fit', layout : 'fit',
title : title, title : title,
closeOnSave : true, closeOnSave : true,
width : 620, width : 800,
height : 465, height : 700,
//Add panel //Add panel
items : [ items : [
{ {

View File

@ -55,6 +55,14 @@ Zarafa.plugins.calendarimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, {
this.registerInsertionPoint('common.contextmenu.attachment.actions', this.createAttachmentImportButton); this.registerInsertionPoint('common.contextmenu.attachment.actions', this.createAttachmentImportButton);
/* add import button to south navigation */ /* add import button to south navigation */
this.registerInsertionPoint("navigation.south", this.createImportButton, this); this.registerInsertionPoint("navigation.south", this.createImportButton, this);
/* ical sync stuff */
if(container.getSettingsModel().get("zarafa/v1/plugins/calendarimporter/enable_sync") === true) {
/* edit panel */
Zarafa.core.data.SharedComponentType.addProperty('plugins.calendarimporter.settings.dialogs.calsyncedit');
/* enable the settings widget */
this.registerInsertionPoint('context.settings.category.calendar', this.createSettingsWidget);
}
}, },
/** /**
@ -82,6 +90,18 @@ Zarafa.plugins.calendarimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, {
return button; return button;
}, },
/**
* Creates the button
*
* @return {Object} Configuration object for a {@link Ext.Button button}
*
*/
createSettingsWidget: function () {
return [{
xtype : 'calendarimporter.settingscalsyncwidget'
}];
},
/** /**
* Insert import button in all attachment suggestions * Insert import button in all attachment suggestions
@ -208,6 +228,9 @@ Zarafa.plugins.calendarimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, {
case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.dialogs.importevents']: case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.dialogs.importevents']:
bid = 2; bid = 2;
break; break;
case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.settings.dialogs.calsyncedit']:
bid = 2;
break;
} }
return bid; return bid;
}, },
@ -225,6 +248,9 @@ Zarafa.plugins.calendarimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, {
case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.dialogs.importevents']: case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.dialogs.importevents']:
component = Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel; component = Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel;
break; break;
case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.settings.dialogs.calsyncedit']:
component = Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditContentPanel;
break;
} }
return component; return component;
@ -232,7 +258,7 @@ Zarafa.plugins.calendarimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, {
}); });
/*############################################################################################################################ /*############################################################################################################################*
* STARTUP * STARTUP
*############################################################################################################################*/ *############################################################################################################################*/
Zarafa.onReady(function() { Zarafa.onReady(function() {

View File

@ -5,10 +5,8 @@ Ext.namespace('Zarafa.plugins.calendarimporter.settings');
* @extends Zarafa.settings.ui.SettingsWidget * @extends Zarafa.settings.ui.SettingsWidget
* @xtype calendarimporter.settingscalsyncwidget * @xtype calendarimporter.settingscalsyncwidget
* *
* 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, { Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget = Ext.extend(Zarafa.settings.ui.SettingsWidget, {
/** /**
* @cfg {Zarafa.settings.SettingsContext} settingsContext * @cfg {Zarafa.settings.SettingsContext} settingsContext
*/ */
@ -91,17 +89,20 @@ Zarafa.common.settings.SettingsSendAsWidget = Ext.extend(Zarafa.settings.ui.Sett
// Start reading the Grid store and convert the contents back into // Start reading the Grid store and convert the contents back into
// an object which can be pushed to the settings. // an object which can be pushed to the settings.
var icslinks = this.sendasPanel.sendasGrid.getStore().getRange(); var icslinks = this.calsyncPanel.calsyncGrid.getStore().getRange();
var icslinkData = {}; var icslinkData = {};
for (var i = 0, len = icslinks.length; i < len; i++) { for (var i = 0, len = icslinks.length; i < len; i++) {
var icslink = icslinks[i]; var icslink = icslinks[i];
icslinkData[icslink.get('id')] = { icslinkData[icslink.get('id')] = {
'display_name' : icslink.get('display_name'), 'icsurl' : icslink.get('icsurl'),
'email_address' : icslink.get('email_address') 'intervall' : icslink.get('intervall'),
'user' : icslink.get('user'),
'pass' : icslink.get('pass'),
'lastsync' : icslink.get('lastsync')
}; };
} }
settingsModel.set('zarafa/v1/contexts/mail/sendas', icslinkData); settingsModel.set('zarafa/v1/contexts/calendar/icssync', icslinkData);
settingsModel.endEdit(); settingsModel.endEdit();
} }

View File

@ -61,11 +61,15 @@ Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(E
var id = 0; var id = 0;
var record = undefined; var record = undefined;
console.log(this);
if(!this.currentItem) { if(!this.currentItem) {
record = new store.recordType({ record = new store.recordType({
id: this.hashCode(this.icsurl.getValue()), id: this.hashCode(this.icsurl.getValue()),
display_name: this.display_name.getValue(), icsurl: this.icsurl.getValue(),
icsurl: this.icsurl.getValue() intervall: this.intervall.getValue(),
user: this.user.getValue(),
pass: this.pass.getValue(),
lastsync: 0
}); });
} }
@ -73,43 +77,83 @@ Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(E
if(record) { if(record) {
store.add(record); store.add(record);
} else { } else {
this.currentItem.set('display_name', this.display_name.getValue());
this.currentItem.set('icsurl', this.icsurl.getValue()); this.currentItem.set('icsurl', this.icsurl.getValue());
this.currentItem.set('intervall', this.intervall.getValue());
this.currentItem.set('user', this.user.getValue());
this.currentItem.set('pass', this.pass.getValue());
} }
this.dialog.close(); this.dialog.close();
} }
}, },
/** /**
* Function will create panel items for {@link Zarafa.common.sendas.dialogs.SendAsEditPanel SendAsEditPanel} * Function will create panel items for {@link Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel CalSyncEditPanel}
* @return {Array} array of items that should be added to panel. * @return {Array} array of items that should be added to panel.
* @private * @private
*/ */
createPanelItems : function(config) createPanelItems : function(config)
{ {
var displayName = ""; var icsurl = "";
var icsUrl = ""; var intervall = "";
var user = "";
var pass = "";
if(config.item){ if(config.item){
displayName = config.item.get('display_name'); icsurl = config.item.get('icsurl');
icsUrl = config.item.get('icsurl'); intervall = config.item.get('intervall');
user = config.item.get('user');
pass = config.item.get('pass');
} }
return [{ return [{
fieldLabel: _('Display Name'), xtype: 'fieldset',
name: 'display_name', title: _('ICAL Information'),
ref: 'display_name', defaultType: 'textfield',
value: displayName, labelWidth: 120,
anchor: '100%' layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
fieldLabel: _('ICS Url'),
name: 'icsurl',
ref: '../icsurl',
value: icsurl,
allowBlank: false
},
{
xtype:'numberfield',
fieldLabel: _('Sync Intervall'),
name: 'intervall',
ref: '../intervall',
value: intervall,
allowBlank: false
}]
}, },
{ {
fieldLabel: _('ICS Url'), xtype: 'fieldset',
name: 'icsurl', title: _('Authentication (optional)'),
ref: 'icsurl', defaultType: 'textfield',
allowBlank: false, labelWidth: 120,
value: icsUrl, layout: 'anchor',
vtype:'email', defaults: {
anchor: '100%' anchor: '100%'
},
items: [{
fieldLabel: _('Username'),
name: 'user',
ref: '../user',
value: user,
allowBlank: true
},
{
fieldLabel: _('Password'),
name: 'pass',
ref: '../pass',
value: pass,
inputType: 'password',
allowBlank: true
}]
}]; }];
}, },

View File

@ -5,8 +5,6 @@ Ext.namespace('Zarafa.plugins.calendarimporter.settings.ui');
* @extends Ext.grid.GridPanel * @extends Ext.grid.GridPanel
* @xtype calendarimporter.calsyncgrid * @xtype calendarimporter.calsyncgrid
* *
* {@link Zarafa.common.sendas.ui.SendAsGrid SendAsGrid} will be used to display
* sendas of the current user.
*/ */
Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid = Ext.extend(Ext.grid.GridPanel, { Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid = Ext.extend(Ext.grid.GridPanel, {
/** /**
@ -18,7 +16,7 @@ Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid = Ext.extend(Ext.grid.Gr
config = config || {}; config = config || {};
Ext.applyIf(config, { Ext.applyIf(config, {
xtype : 'calendarimporter.calsyncpanel', xtype : 'calendarimporter.calsyncgrid',
border : true, border : true,
store : config.store, store : config.store,
viewConfig : { viewConfig : {
@ -46,7 +44,7 @@ Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid = Ext.extend(Ext.grid.Gr
{ {
Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid.superclass.initEvents.call(this); Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid.superclass.initEvents.call(this);
// select first sendas when store has finished loading // select first icssync 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});
}, },
@ -126,7 +124,7 @@ Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid = Ext.extend(Ext.grid.Gr
/** /**
* Function will be called to remove a ics sync entry. * Function will be called to remove a ics sync entry.
*/ */
removeSendAs : function() removeIcsSyncAs : function()
{ {
var icsRecord = this.getSelectionModel().getSelected(); var icsRecord = this.getSelectionModel().getSelected();
if(!icsRecord) { if(!icsRecord) {
@ -152,4 +150,4 @@ Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid = Ext.extend(Ext.grid.Gr
} }
}); });
Ext.reg('calendarimporter.calsyncpanel', Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid); Ext.reg('calendarimporter.calsyncgrid', Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid);

View File

@ -45,7 +45,7 @@ Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel = Ext.extend(Ext.Panel,
{ {
return [{ return [{
xtype : 'displayfield', xtype : 'displayfield',
value : _('Here you can .ics files that will be synchronised.'), value : _('Here you can enter .ics files that will be synchronised.'),
fieldClass : 'x-form-display-field' fieldClass : 'x-form-display-field'
}, { }, {
xtype : 'container', xtype : 'container',
@ -74,7 +74,7 @@ Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel = Ext.extend(Ext.Panel,
items : [{ items : [{
xtype : 'button', xtype : 'button',
text : _('Add') + '...', text : _('Add') + '...',
handler : this.onSendAsAdd, handler : this.onCalSyncAdd,
ref : '../../addButton', ref : '../../addButton',
scope : this scope : this
}, { }, {
@ -85,7 +85,7 @@ Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel = Ext.extend(Ext.Panel,
text : _('Remove') + '...', text : _('Remove') + '...',
disabled : true, disabled : true,
ref : '../../removeButton', ref : '../../removeButton',
handler : this.onSendAsRemove, handler : this.onCalSyncRemove,
scope : this scope : this
}] }]
}] }]
@ -108,7 +108,7 @@ Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel = Ext.extend(Ext.Panel,
* Handler function will be called when user clicks on 'Add' button. * Handler function will be called when user clicks on 'Add' button.
* @private * @private
*/ */
onSendAsAdd : function() onCalSyncAdd : function()
{ {
Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType['plugins.calendarimporter.settings.dialogs.calsyncedit'], undefined, { Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType['plugins.calendarimporter.settings.dialogs.calsyncedit'], undefined, {
store : this.store, store : this.store,
@ -133,9 +133,9 @@ Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel = 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.
* @private * @private
*/ */
onSendAsRemove : function() onCalSyncRemove : function()
{ {
this.sendasGrid.removeSendAs(); this.calsyncGrid.removeIcsSyncAs();
}, },
/** /**

View File

@ -28,6 +28,11 @@
<clientfile load="source">js/data/ResponseHandler.js</clientfile> <clientfile load="source">js/data/ResponseHandler.js</clientfile>
<clientfile load="source">js/dialogs/ImportContentPanel.js</clientfile> <clientfile load="source">js/dialogs/ImportContentPanel.js</clientfile>
<clientfile load="source">js/dialogs/ImportPanel.js</clientfile> <clientfile load="source">js/dialogs/ImportPanel.js</clientfile>
<clientfile load="source">js/dialogs/settings/SettingsCalSyncWidget.js</clientfile>
<clientfile load="source">js/dialogs/settings/ui/CalSyncGrid.js</clientfile>
<clientfile load="source">js/dialogs/settings/ui/CalSyncPanel.js</clientfile>
<clientfile load="source">js/dialogs/settings/dialogs/CalSyncEditContentPanel.js</clientfile>
<clientfile load="source">js/dialogs/settings/dialogs/CalSyncEditPanel.js</clientfile>
</client> </client>
<resources> <resources>
<resourcefile load="release">resources/css/calendarimporter-min.css</resourcefile> <resourcefile load="release">resources/css/calendarimporter-min.css</resourcefile>

View File

@ -48,6 +48,7 @@ class Plugincalendarimporter extends Plugin {
'calendarimporter' => Array( 'calendarimporter' => Array(
'enable' => PLUGIN_CALENDARIMPORTER_USER_DEFAULT_ENABLE, 'enable' => PLUGIN_CALENDARIMPORTER_USER_DEFAULT_ENABLE,
'enable_export' => PLUGIN_CALENDARIMPORTER_USER_DEFAULT_ENABLE_EXPORT, 'enable_export' => PLUGIN_CALENDARIMPORTER_USER_DEFAULT_ENABLE_EXPORT,
'enable_sync' => PLUGIN_CALENDARIMPORTER_USER_DEFAULT_ENABLE_SYNC,
'default_calendar' => PLUGIN_CALENDARIMPORTER_DEFAULT, 'default_calendar' => PLUGIN_CALENDARIMPORTER_DEFAULT,
'default_timezone' => PLUGIN_CALENDARIMPORTER_DEFAULT_TIMEZONE 'default_timezone' => PLUGIN_CALENDARIMPORTER_DEFAULT_TIMEZONE
) )