calendarimporter 2.1.0:

- ics sync is now implemented
This commit is contained in:
2014-05-14 23:30:00 +00:00
parent 38855391f0
commit c387565a45
19 changed files with 430 additions and 114 deletions

View File

@@ -63,4 +63,4 @@ Zarafa.plugins.calendarimporter.ABOUT = ""
+ "<p>Licensed under the MIT License.</p>"
+ "<p>Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.</p>"
+ "<p>Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.</p>";

47
js/external/Ext.util.base64.js vendored Normal file
View File

@@ -0,0 +1,47 @@
Ext.util.base64 = {
base64s : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
encode: function(decStr){
if (typeof btoa === 'function') {
return btoa(decStr);
}
var base64s = this.base64s;
var bits;
var dual;
var i = 0;
var encOut = "";
while(decStr.length >= i + 3){
bits = (decStr.charCodeAt(i++) & 0xff) <<16 | (decStr.charCodeAt(i++) & 0xff) <<8 | decStr.charCodeAt(i++) & 0xff;
encOut += base64s.charAt((bits & 0x00fc0000) >>18) + base64s.charAt((bits & 0x0003f000) >>12) + base64s.charAt((bits & 0x00000fc0) >> 6) + base64s.charAt((bits & 0x0000003f));
}
if(decStr.length -i > 0 && decStr.length -i < 3){
dual = Boolean(decStr.length -i -1);
bits = ((decStr.charCodeAt(i++) & 0xff) <<16) | (dual ? (decStr.charCodeAt(i) & 0xff) <<8 : 0);
encOut += base64s.charAt((bits & 0x00fc0000) >>18) + base64s.charAt((bits & 0x0003f000) >>12) + (dual ? base64s.charAt((bits & 0x00000fc0) >>6) : '=') + '=';
}
return(encOut);
},
decode: function(encStr){
if (typeof atob === 'function') {
return atob(encStr);
}
var base64s = this.base64s;
var bits;
var decOut = "";
var i = 0;
for(; i<encStr.length; i += 4){
bits = (base64s.indexOf(encStr.charAt(i)) & 0xff) <<18 | (base64s.indexOf(encStr.charAt(i +1)) & 0xff) <<12 | (base64s.indexOf(encStr.charAt(i +2)) & 0xff) << 6 | base64s.indexOf(encStr.charAt(i +3)) & 0xff;
decOut += String.fromCharCode((bits & 0xff0000) >>16, (bits & 0xff00) >>8, bits & 0xff);
}
if(encStr.charCodeAt(i -2) == 61){
return(decOut.substring(0, decOut.length -2));
}
else if(encStr.charCodeAt(i -1) == 61){
return(decOut.substring(0, decOut.length -1));
}
else {
return(decOut);
}
}
}

View File

@@ -16,8 +16,7 @@ Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget = Ext.extend(Zara
* @constructor
* @param {Object} config Configuration object
*/
constructor : function(config)
{
constructor : function(config) {
config = config || {};
var store = new Ext.data.JsonStore({
@@ -39,9 +38,8 @@ Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget = Ext.extend(Zara
Ext.applyIf(config, {
height : 400,
title : _('Calendar Sync settings - Comming soon'),
title : _('Calendar Sync settings'),
xtype : 'calendarimporter.settingscalsyncwidget',
disabled : true,
layout : {
// override from SettingsWidget
type : 'fit'
@@ -63,8 +61,7 @@ Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget = Ext.extend(Zara
* {@link Zarafa.settings.SettingsModel} into the UI of this category.
* @param {Zarafa.settings.SettingsModel} settingsModel The settings to load
*/
update : function(settingsModel)
{
update : function(settingsModel) {
this.model = settingsModel;
// Convert the signatures into Store data
@@ -85,8 +82,7 @@ Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget = Ext.extend(Zara
* 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)
{
updateSettings : function(settingsModel) {
settingsModel.beginEdit();
// Start reading the Grid store and convert the contents back into
@@ -111,4 +107,4 @@ Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget = Ext.extend(Zara
}
});
Ext.reg('calendarimporter.settingscalsyncwidget', Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget);
Ext.reg('calendarimporter.settingscalsyncwidget', Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget);

View File

@@ -12,20 +12,18 @@ Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditContentPanel = Ext.e
* @constructor
* @param config Configuration structure
*/
constructor : function(config)
{
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,
height : 350,
title : _('ICAL Sync'),
items : [{
xtype : 'calendarimporter.calsynceditpanel',

View File

@@ -18,8 +18,7 @@ Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(E
* @constructor
* @param config Configuration structure
*/
constructor : function(config)
{
constructor : function(config) {
config = config || {};
if(config.item)
@@ -28,7 +27,7 @@ Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(E
Ext.applyIf(config, {
// Override from Ext.Component
xtype : 'calendarimporter.calsynceditpanel',
labelAlign : 'left',
labelAlign : 'top',
defaultType: 'textfield',
items : this.createPanelItems(config),
buttons: [{
@@ -68,9 +67,9 @@ Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(E
icsurl: this.icsurl.getValue(),
intervall: this.intervall.getValue(),
user: this.user.getValue(),
pass: this.pass.getValue(),
pass: Ext.util.base64.encode(this.pass.getValue()),
calendar: this.calendar.getValue(),
lastsync: 0
lastsync: "never"
});
}
@@ -81,7 +80,7 @@ Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(E
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.currentItem.set('pass', Ext.util.base64.encode(this.pass.getValue()));
this.currentItem.set('calendar', this.calendar.getValue());
}
this.dialog.close();
@@ -109,7 +108,7 @@ Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(E
icsurl = config.item.get('icsurl');
intervall = config.item.get('intervall');
user = config.item.get('user');
pass = config.item.get('pass');
pass = Ext.util.base64.decode(config.item.get('pass'));
calendar = config.item.get('calendar');
}
@@ -144,16 +143,15 @@ Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(E
return [{
xtype: 'fieldset',
title: _('ICAL Information'),
defaultType: 'textfield',
layout: 'anchor',
defaultType: 'textfield',
layout: 'form',
flex: 1,
defaults: {
anchor: '100%',
flex: 1,
labelWidth: 120
flex: 1
},
items: [{
fieldLabel: _('ICS Url'),
fieldLabel: 'ICS Url',
name: 'icsurl',
ref: '../icsurl',
value: icsurl,
@@ -176,7 +174,7 @@ Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(E
},
{
xtype:'numberfield',
fieldLabel: _('Sync Intervall'),
fieldLabel: _('Sync Intervall (minutes)'),
name: 'intervall',
ref: '../intervall',
value: intervall,
@@ -187,8 +185,7 @@ Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(E
xtype: 'fieldset',
title: _('Authentication (optional)'),
defaultType: 'textfield',
labelWidth: 120,
layout: 'anchor',
layout: 'form',
defaults: {
anchor: '100%'
},

View File

@@ -45,7 +45,7 @@ Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel = Ext.extend(Ext.Panel,
{
return [{
xtype : 'displayfield',
value : _('Here you can enter .ics files that will be synchronised.'),
value : _('Setup calendars you want to subscribe to.'),
fieldClass : 'x-form-display-field'
}, {
xtype : 'container',