Line endings
This commit is contained in:
130
js/ABOUT.js
130
js/ABOUT.js
@@ -1,66 +1,66 @@
|
||||
/**
|
||||
* ABOUT.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
Ext.namespace('Zarafa.plugins.calendarimporter');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.calendarimporter.ABOUT
|
||||
* @extends String
|
||||
*
|
||||
* The copyright string holding the copyright notice for the Zarafa calendarimporter Plugin.
|
||||
*/
|
||||
Zarafa.plugins.calendarimporter.ABOUT = ""
|
||||
+ "<p>Copyright (C) 2012-2016 Christoph Haas <christoph.h@sprinternet.at></p>"
|
||||
|
||||
+ "<p>This program is free software; you can redistribute it and/or "
|
||||
+ "modify it under the terms of the GNU Lesser General Public "
|
||||
+ "License as published by the Free Software Foundation; either "
|
||||
+ "version 2.1 of the License, or (at your option) any later version.</p>"
|
||||
|
||||
+ "<p>This program is distributed in the hope that it will be useful, "
|
||||
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of "
|
||||
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU "
|
||||
+ "Lesser General Public License for more details.</p>"
|
||||
|
||||
+ "<p>You should have received a copy of the GNU Lesser General Public "
|
||||
+ "License along with this program; if not, write to the Free Software "
|
||||
+ "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</p>"
|
||||
|
||||
+ "<hr />"
|
||||
|
||||
+ "<p>The calendarimporter plugin contains the following third-party components:</p>"
|
||||
|
||||
+ "<h1>iCalcreator v2.16.12</h1>"
|
||||
|
||||
+ "<p>Copyright 2007-2013 Kjell-Inge Gustafsson kigkonsult</p>"
|
||||
|
||||
+ "<p>This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.</p>"
|
||||
|
||||
+ "<p>This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</p>"
|
||||
|
||||
+ "<h1>Ics-parser</h1>"
|
||||
|
||||
+ "<p>Copyright 2002-2007 Martin Thoma <info@martin-thoma.de></p>"
|
||||
|
||||
+ "<p>Licensed under the MIT License.</p>"
|
||||
|
||||
/**
|
||||
* ABOUT.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
Ext.namespace('Zarafa.plugins.calendarimporter');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.calendarimporter.ABOUT
|
||||
* @extends String
|
||||
*
|
||||
* The copyright string holding the copyright notice for the Zarafa calendarimporter Plugin.
|
||||
*/
|
||||
Zarafa.plugins.calendarimporter.ABOUT = ""
|
||||
+ "<p>Copyright (C) 2012-2016 Christoph Haas <christoph.h@sprinternet.at></p>"
|
||||
|
||||
+ "<p>This program is free software; you can redistribute it and/or "
|
||||
+ "modify it under the terms of the GNU Lesser General Public "
|
||||
+ "License as published by the Free Software Foundation; either "
|
||||
+ "version 2.1 of the License, or (at your option) any later version.</p>"
|
||||
|
||||
+ "<p>This program is distributed in the hope that it will be useful, "
|
||||
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of "
|
||||
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU "
|
||||
+ "Lesser General Public License for more details.</p>"
|
||||
|
||||
+ "<p>You should have received a copy of the GNU Lesser General Public "
|
||||
+ "License along with this program; if not, write to the Free Software "
|
||||
+ "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</p>"
|
||||
|
||||
+ "<hr />"
|
||||
|
||||
+ "<p>The calendarimporter plugin contains the following third-party components:</p>"
|
||||
|
||||
+ "<h1>iCalcreator v2.16.12</h1>"
|
||||
|
||||
+ "<p>Copyright 2007-2013 Kjell-Inge Gustafsson kigkonsult</p>"
|
||||
|
||||
+ "<p>This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.</p>"
|
||||
|
||||
+ "<p>This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</p>"
|
||||
|
||||
+ "<h1>Ics-parser</h1>"
|
||||
|
||||
+ "<p>Copyright 2002-2007 Martin Thoma <info@martin-thoma.de></p>"
|
||||
|
||||
+ "<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>";
|
@@ -1,85 +1,85 @@
|
||||
/**
|
||||
* ResponseHandler.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* ResponseHandler
|
||||
*
|
||||
* This class handles all responses from the php backend
|
||||
*/
|
||||
Ext.namespace('Zarafa.plugins.calendarimporter.data');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.calendarimporter.data.ResponseHandler
|
||||
* @extends Zarafa.plugins.calendarimporter.data.AbstractResponseHandler
|
||||
*
|
||||
* Calendar specific response handler.
|
||||
*/
|
||||
Zarafa.plugins.calendarimporter.data.ResponseHandler = Ext.extend(Zarafa.core.data.AbstractResponseHandler, {
|
||||
/**
|
||||
* @cfg {Function} successCallback The function which
|
||||
* will be called after success request.
|
||||
*/
|
||||
successCallback: null,
|
||||
|
||||
/**
|
||||
* Call the successCallback callback function.
|
||||
* @param {Object} response Object contained the response data.
|
||||
*/
|
||||
doExport: function (response) {
|
||||
this.successCallback(response);
|
||||
},
|
||||
|
||||
/**
|
||||
* Call the successCallback callback function.
|
||||
* @param {Object} response Object contained the response data.
|
||||
*/
|
||||
doLoad: function (response) {
|
||||
this.successCallback(response);
|
||||
},
|
||||
|
||||
/**
|
||||
* Call the successCallback callback function.
|
||||
* @param {Object} response Object contained the response data.
|
||||
*/
|
||||
doImport: function (response) {
|
||||
this.successCallback(response);
|
||||
},
|
||||
|
||||
/**
|
||||
* Call the successCallback callback function.
|
||||
* @param {Object} response Object contained the response data.
|
||||
*/
|
||||
doImportattachment: function (response) {
|
||||
this.successCallback(response);
|
||||
},
|
||||
|
||||
/**
|
||||
* In case exception happened on server, server will return
|
||||
* exception response with the code of exception.
|
||||
* @param {Object} response Object contained the response data.
|
||||
*/
|
||||
doError: function (response) {
|
||||
alert("error response code: " + response.error.info.code);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* ResponseHandler.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* ResponseHandler
|
||||
*
|
||||
* This class handles all responses from the php backend
|
||||
*/
|
||||
Ext.namespace('Zarafa.plugins.calendarimporter.data');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.calendarimporter.data.ResponseHandler
|
||||
* @extends Zarafa.plugins.calendarimporter.data.AbstractResponseHandler
|
||||
*
|
||||
* Calendar specific response handler.
|
||||
*/
|
||||
Zarafa.plugins.calendarimporter.data.ResponseHandler = Ext.extend(Zarafa.core.data.AbstractResponseHandler, {
|
||||
/**
|
||||
* @cfg {Function} successCallback The function which
|
||||
* will be called after success request.
|
||||
*/
|
||||
successCallback: null,
|
||||
|
||||
/**
|
||||
* Call the successCallback callback function.
|
||||
* @param {Object} response Object contained the response data.
|
||||
*/
|
||||
doExport: function (response) {
|
||||
this.successCallback(response);
|
||||
},
|
||||
|
||||
/**
|
||||
* Call the successCallback callback function.
|
||||
* @param {Object} response Object contained the response data.
|
||||
*/
|
||||
doLoad: function (response) {
|
||||
this.successCallback(response);
|
||||
},
|
||||
|
||||
/**
|
||||
* Call the successCallback callback function.
|
||||
* @param {Object} response Object contained the response data.
|
||||
*/
|
||||
doImport: function (response) {
|
||||
this.successCallback(response);
|
||||
},
|
||||
|
||||
/**
|
||||
* Call the successCallback callback function.
|
||||
* @param {Object} response Object contained the response data.
|
||||
*/
|
||||
doImportattachment: function (response) {
|
||||
this.successCallback(response);
|
||||
},
|
||||
|
||||
/**
|
||||
* In case exception happened on server, server will return
|
||||
* exception response with the code of exception.
|
||||
* @param {Object} response Object contained the response data.
|
||||
*/
|
||||
doError: function (response) {
|
||||
alert("error response code: " + response.error.info.code);
|
||||
}
|
||||
});
|
||||
|
||||
Ext.reg('calendarimporter.calendarresponsehandler', Zarafa.plugins.calendarimporter.data.ResponseHandler);
|
1532
js/data/timezones.js
1532
js/data/timezones.js
File diff suppressed because it is too large
Load Diff
@@ -1,66 +1,66 @@
|
||||
/**
|
||||
* ImportContentPanel.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* ImportContentPanel
|
||||
*
|
||||
* Container for the importpanel.
|
||||
*/
|
||||
Ext.namespace("Zarafa.plugins.calendarimporter.dialogs");
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel
|
||||
* @extends Zarafa.core.ui.ContentPanel
|
||||
*
|
||||
* The content panel which shows the hierarchy tree of Owncloud account files.
|
||||
* @xtype calendarimportercontentpanel
|
||||
*/
|
||||
Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel = Ext.extend(Zarafa.core.ui.ContentPanel, {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param config Configuration structure
|
||||
*/
|
||||
constructor: function (config) {
|
||||
config = config || {};
|
||||
Ext.applyIf(config, {
|
||||
layout: 'fit',
|
||||
title: dgettext('plugin_calendarimporter', 'Import Calendar File'),
|
||||
closeOnSave: true,
|
||||
width: 800,
|
||||
height: 700,
|
||||
//Add panel
|
||||
items: [
|
||||
{
|
||||
xtype: 'calendarimporter.importpanel',
|
||||
filename: config.filename,
|
||||
folder: config.folder
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel.superclass.constructor.call(this, config);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* ImportContentPanel.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* ImportContentPanel
|
||||
*
|
||||
* Container for the importpanel.
|
||||
*/
|
||||
Ext.namespace("Zarafa.plugins.calendarimporter.dialogs");
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel
|
||||
* @extends Zarafa.core.ui.ContentPanel
|
||||
*
|
||||
* The content panel which shows the hierarchy tree of Owncloud account files.
|
||||
* @xtype calendarimportercontentpanel
|
||||
*/
|
||||
Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel = Ext.extend(Zarafa.core.ui.ContentPanel, {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param config Configuration structure
|
||||
*/
|
||||
constructor: function (config) {
|
||||
config = config || {};
|
||||
Ext.applyIf(config, {
|
||||
layout: 'fit',
|
||||
title: dgettext('plugin_calendarimporter', 'Import Calendar File'),
|
||||
closeOnSave: true,
|
||||
width: 800,
|
||||
height: 700,
|
||||
//Add panel
|
||||
items: [
|
||||
{
|
||||
xtype: 'calendarimporter.importpanel',
|
||||
filename: config.filename,
|
||||
folder: config.folder
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel.superclass.constructor.call(this, config);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Ext.reg('calendarimporter.contentpanel', Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel);
|
92
js/external/Ext.util.base64.js
vendored
92
js/external/Ext.util.base64.js
vendored
@@ -1,47 +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);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,306 +1,306 @@
|
||||
/**
|
||||
* plugin.calendarimporter.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
Ext.namespace("Zarafa.plugins.calendarimporter"); // Assign the right namespace
|
||||
|
||||
Zarafa.plugins.calendarimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, { // create new import plugin
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} config Configuration object
|
||||
*
|
||||
*/
|
||||
constructor: function (config) {
|
||||
config = config || {};
|
||||
|
||||
Zarafa.plugins.calendarimporter.ImportPlugin.superclass.constructor.call(this, config);
|
||||
},
|
||||
|
||||
/**
|
||||
* initialises insertion point for plugin
|
||||
* @protected
|
||||
*/
|
||||
initPlugin: function () {
|
||||
Zarafa.plugins.calendarimporter.ImportPlugin.superclass.initPlugin.apply(this, arguments);
|
||||
|
||||
/* our panel */
|
||||
Zarafa.core.data.SharedComponentType.addProperty('plugins.calendarimporter.dialogs.importevents');
|
||||
|
||||
/* directly import received icals */
|
||||
this.registerInsertionPoint('common.contextmenu.attachment.actions', this.createAttachmentImportButton);
|
||||
|
||||
/* add settings widget */
|
||||
this.registerInsertionPoint('context.settings.category.calendar', this.createSettingsWidget);
|
||||
|
||||
/* export a calendar entry via rightclick */
|
||||
this.registerInsertionPoint('context.calendar.contextmenu.actions', this.createItemExportInsertionPoint, 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.createSettingsCalSyncWidget);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* This method hooks to the contact context menu and allows users to export users to vcf.
|
||||
*
|
||||
* @param include
|
||||
* @param btn
|
||||
* @returns {Object}
|
||||
*/
|
||||
createItemExportInsertionPoint: function (include, btn) {
|
||||
return {
|
||||
text: dgettext('plugin_calendarimporter', 'Export Event'),
|
||||
handler: this.exportToICS.createDelegate(this, [btn]),
|
||||
scope: this,
|
||||
iconCls: 'icon_calendarimporter_export'
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Generates a request to download the selected records as vCard.
|
||||
* @param {Ext.Button} btn
|
||||
*/
|
||||
exportToICS: function (btn) {
|
||||
if (btn.records.length == 0) {
|
||||
return; // skip if no records where given!
|
||||
}
|
||||
|
||||
var recordIds = [];
|
||||
|
||||
for (var i = 0; i < btn.records.length; i++) {
|
||||
recordIds.push(btn.records[i].get("entryid"));
|
||||
}
|
||||
|
||||
Zarafa.plugins.calendarimporter.data.Actions.exportToICS(btn.records[0].get("store_entryid"), recordIds, undefined);
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates the button
|
||||
*
|
||||
* @return {Object} Configuration object for a {@link Ext.Button button}
|
||||
*
|
||||
*/
|
||||
createSettingsWidget: function () {
|
||||
return [{
|
||||
xtype: 'calendarimporter.settingswidget'
|
||||
}];
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates the button
|
||||
*
|
||||
* @return {Object} Configuration object for a {@link Ext.Button button}
|
||||
*
|
||||
*/
|
||||
createSettingsCalSyncWidget: function () {
|
||||
return [{
|
||||
xtype: 'calendarimporter.settingscalsyncwidget'
|
||||
}];
|
||||
},
|
||||
|
||||
/**
|
||||
* Insert import button in all attachment suggestions
|
||||
|
||||
* @return {Object} Configuration object for a {@link Ext.Button button}
|
||||
*/
|
||||
createAttachmentImportButton: function (include, btn) {
|
||||
return {
|
||||
text: dgettext('plugin_calendarimporter', 'Import to Calendar'),
|
||||
handler: this.getAttachmentFileName.createDelegate(this, [btn]),
|
||||
scope: this,
|
||||
iconCls: 'icon_calendarimporter_button',
|
||||
beforeShow: function (item, record) {
|
||||
var extension = record.data.name.split('.').pop().toLowerCase();
|
||||
|
||||
if (record.data.filetype == "text/calendar" || extension == "ics" || extension == "ifb" || extension == "ical" || extension == "ifbf") {
|
||||
item.setVisible(true);
|
||||
} else {
|
||||
item.setVisible(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Callback for getAttachmentFileName
|
||||
*/
|
||||
gotAttachmentFileName: function (response) {
|
||||
if (response.status == true) {
|
||||
this.scope.openImportDialog(response.tmpname);
|
||||
} else {
|
||||
Zarafa.common.dialogs.MessageBox.show({
|
||||
title: dgettext('plugin_calendarimporter', 'Error'),
|
||||
msg: response["message"],
|
||||
icon: Zarafa.common.dialogs.MessageBox.ERROR,
|
||||
buttons: Zarafa.common.dialogs.MessageBox.OK
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Clickhandler for the button
|
||||
*/
|
||||
getAttachmentFileName: function (btn, callback) {
|
||||
Zarafa.common.dialogs.MessageBox.show({
|
||||
title: dgettext('plugin_calendarimporter', 'Please wait'),
|
||||
msg: dgettext('plugin_calendarimporter', 'Loading attachment...'),
|
||||
progressText: dgettext('plugin_calendarimporter', 'Initializing...'),
|
||||
width: 300,
|
||||
progress: true,
|
||||
closable: false
|
||||
});
|
||||
|
||||
// progress bar... ;)
|
||||
var f = function (v) {
|
||||
return function () {
|
||||
if (v == 100) {
|
||||
Zarafa.common.dialogs.MessageBox.hide();
|
||||
} else {
|
||||
// # TRANSLATORS: {0} will be replaced by the percentage value (0-100)
|
||||
Zarafa.common.dialogs.MessageBox.updateProgress(v / 100, String.format(dgettext('plugin_calendarimporter', '{0}% loaded'), Math.round(v)));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
for (var i = 1; i < 101; i++) {
|
||||
setTimeout(f(i), 20 * i);
|
||||
}
|
||||
|
||||
/* store the attachment to a temporary folder and prepare it for uploading */
|
||||
var attachmentRecord = btn.records;
|
||||
var attachmentStore = attachmentRecord.store;
|
||||
|
||||
var store = attachmentStore.getParentRecord().get('store_entryid');
|
||||
var entryid = attachmentStore.getAttachmentParentRecordEntryId();
|
||||
var attachNum = new Array(1);
|
||||
if (attachmentRecord.get('attach_num') != -1) {
|
||||
attachNum[0] = attachmentRecord.get('attach_num');
|
||||
} else {
|
||||
attachNum[0] = attachmentRecord.get('tmpname');
|
||||
}
|
||||
var dialog_attachments = attachmentStore.getId();
|
||||
var filename = attachmentRecord.data.name;
|
||||
|
||||
var responseHandler = new Zarafa.plugins.calendarimporter.data.ResponseHandler({
|
||||
successCallback: this.gotAttachmentFileName,
|
||||
scope: this
|
||||
});
|
||||
|
||||
// request attachment preperation
|
||||
container.getRequest().singleRequest(
|
||||
'calendarmodule',
|
||||
'importattachment',
|
||||
{
|
||||
entryid: entryid,
|
||||
store: store,
|
||||
attachNum: attachNum,
|
||||
dialog_attachments: dialog_attachments,
|
||||
filename: filename
|
||||
},
|
||||
responseHandler
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Open the import dialog.
|
||||
* @param {String} filename
|
||||
*/
|
||||
openImportDialog: function (filename) {
|
||||
var componentType = Zarafa.core.data.SharedComponentType['plugins.calendarimporter.dialogs.importevents'];
|
||||
var config = {
|
||||
filename: filename,
|
||||
modal: true
|
||||
};
|
||||
|
||||
Zarafa.core.data.UIFactory.openLayerComponent(componentType, undefined, config);
|
||||
},
|
||||
|
||||
/**
|
||||
* Bid for the type of shared component
|
||||
* and the given record.
|
||||
* This will bid on calendar.dialogs.importevents
|
||||
* @param {Zarafa.core.data.SharedComponentType} type Type of component a context can bid for.
|
||||
* @param {Ext.data.Record} record Optionally passed record.
|
||||
* @return {Number} The bid for the shared component
|
||||
*/
|
||||
bidSharedComponent: function (type, record) {
|
||||
var bid = -1;
|
||||
switch (type) {
|
||||
case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.dialogs.importevents']:
|
||||
bid = 2;
|
||||
break;
|
||||
case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.settings.dialogs.calsyncedit']:
|
||||
bid = 2;
|
||||
break;
|
||||
case Zarafa.core.data.SharedComponentType['common.contextmenu']:
|
||||
if (record instanceof Zarafa.core.data.MAPIRecord) {
|
||||
if (record.get('object_type') == Zarafa.core.mapi.ObjectType.MAPI_FOLDER && record.get('container_class') == "IPF.Appointment") {
|
||||
bid = 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return bid;
|
||||
},
|
||||
|
||||
/**
|
||||
* Will return the reference to the shared component.
|
||||
* Based on the type of component requested a component is returned.
|
||||
* @param {Zarafa.core.data.SharedComponentType} type Type of component a context can bid for.
|
||||
* @param {Ext.data.Record} record Optionally passed record.
|
||||
* @return {Ext.Component} Component
|
||||
*/
|
||||
getSharedComponent: function (type, record) {
|
||||
var component;
|
||||
switch (type) {
|
||||
case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.dialogs.importevents']:
|
||||
component = Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel;
|
||||
break;
|
||||
case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.settings.dialogs.calsyncedit']:
|
||||
component = Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditContentPanel;
|
||||
break;
|
||||
case Zarafa.core.data.SharedComponentType['common.contextmenu']:
|
||||
component = Zarafa.plugins.calendarimporter.ui.ContextMenu;
|
||||
break;
|
||||
}
|
||||
|
||||
return component;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/*############################################################################################################################*
|
||||
* STARTUP
|
||||
*############################################################################################################################*/
|
||||
Zarafa.onReady(function () {
|
||||
container.registerPlugin(new Zarafa.core.PluginMetaData({
|
||||
name: 'calendarimporter',
|
||||
displayName: dgettext('plugin_calendarimporter', 'Calendarimporter Plugin'),
|
||||
about: Zarafa.plugins.calendarimporter.ABOUT,
|
||||
pluginConstructor: Zarafa.plugins.calendarimporter.ImportPlugin
|
||||
}));
|
||||
});
|
||||
/**
|
||||
* plugin.calendarimporter.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
Ext.namespace("Zarafa.plugins.calendarimporter"); // Assign the right namespace
|
||||
|
||||
Zarafa.plugins.calendarimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, { // create new import plugin
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} config Configuration object
|
||||
*
|
||||
*/
|
||||
constructor: function (config) {
|
||||
config = config || {};
|
||||
|
||||
Zarafa.plugins.calendarimporter.ImportPlugin.superclass.constructor.call(this, config);
|
||||
},
|
||||
|
||||
/**
|
||||
* initialises insertion point for plugin
|
||||
* @protected
|
||||
*/
|
||||
initPlugin: function () {
|
||||
Zarafa.plugins.calendarimporter.ImportPlugin.superclass.initPlugin.apply(this, arguments);
|
||||
|
||||
/* our panel */
|
||||
Zarafa.core.data.SharedComponentType.addProperty('plugins.calendarimporter.dialogs.importevents');
|
||||
|
||||
/* directly import received icals */
|
||||
this.registerInsertionPoint('common.contextmenu.attachment.actions', this.createAttachmentImportButton);
|
||||
|
||||
/* add settings widget */
|
||||
this.registerInsertionPoint('context.settings.category.calendar', this.createSettingsWidget);
|
||||
|
||||
/* export a calendar entry via rightclick */
|
||||
this.registerInsertionPoint('context.calendar.contextmenu.actions', this.createItemExportInsertionPoint, 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.createSettingsCalSyncWidget);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* This method hooks to the contact context menu and allows users to export users to vcf.
|
||||
*
|
||||
* @param include
|
||||
* @param btn
|
||||
* @returns {Object}
|
||||
*/
|
||||
createItemExportInsertionPoint: function (include, btn) {
|
||||
return {
|
||||
text: dgettext('plugin_calendarimporter', 'Export Event'),
|
||||
handler: this.exportToICS.createDelegate(this, [btn]),
|
||||
scope: this,
|
||||
iconCls: 'icon_calendarimporter_export'
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Generates a request to download the selected records as vCard.
|
||||
* @param {Ext.Button} btn
|
||||
*/
|
||||
exportToICS: function (btn) {
|
||||
if (btn.records.length == 0) {
|
||||
return; // skip if no records where given!
|
||||
}
|
||||
|
||||
var recordIds = [];
|
||||
|
||||
for (var i = 0; i < btn.records.length; i++) {
|
||||
recordIds.push(btn.records[i].get("entryid"));
|
||||
}
|
||||
|
||||
Zarafa.plugins.calendarimporter.data.Actions.exportToICS(btn.records[0].get("store_entryid"), recordIds, undefined);
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates the button
|
||||
*
|
||||
* @return {Object} Configuration object for a {@link Ext.Button button}
|
||||
*
|
||||
*/
|
||||
createSettingsWidget: function () {
|
||||
return [{
|
||||
xtype: 'calendarimporter.settingswidget'
|
||||
}];
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates the button
|
||||
*
|
||||
* @return {Object} Configuration object for a {@link Ext.Button button}
|
||||
*
|
||||
*/
|
||||
createSettingsCalSyncWidget: function () {
|
||||
return [{
|
||||
xtype: 'calendarimporter.settingscalsyncwidget'
|
||||
}];
|
||||
},
|
||||
|
||||
/**
|
||||
* Insert import button in all attachment suggestions
|
||||
|
||||
* @return {Object} Configuration object for a {@link Ext.Button button}
|
||||
*/
|
||||
createAttachmentImportButton: function (include, btn) {
|
||||
return {
|
||||
text: dgettext('plugin_calendarimporter', 'Import to Calendar'),
|
||||
handler: this.getAttachmentFileName.createDelegate(this, [btn]),
|
||||
scope: this,
|
||||
iconCls: 'icon_calendarimporter_button',
|
||||
beforeShow: function (item, record) {
|
||||
var extension = record.data.name.split('.').pop().toLowerCase();
|
||||
|
||||
if (record.data.filetype == "text/calendar" || extension == "ics" || extension == "ifb" || extension == "ical" || extension == "ifbf") {
|
||||
item.setVisible(true);
|
||||
} else {
|
||||
item.setVisible(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Callback for getAttachmentFileName
|
||||
*/
|
||||
gotAttachmentFileName: function (response) {
|
||||
if (response.status == true) {
|
||||
this.scope.openImportDialog(response.tmpname);
|
||||
} else {
|
||||
Zarafa.common.dialogs.MessageBox.show({
|
||||
title: dgettext('plugin_calendarimporter', 'Error'),
|
||||
msg: response["message"],
|
||||
icon: Zarafa.common.dialogs.MessageBox.ERROR,
|
||||
buttons: Zarafa.common.dialogs.MessageBox.OK
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Clickhandler for the button
|
||||
*/
|
||||
getAttachmentFileName: function (btn, callback) {
|
||||
Zarafa.common.dialogs.MessageBox.show({
|
||||
title: dgettext('plugin_calendarimporter', 'Please wait'),
|
||||
msg: dgettext('plugin_calendarimporter', 'Loading attachment...'),
|
||||
progressText: dgettext('plugin_calendarimporter', 'Initializing...'),
|
||||
width: 300,
|
||||
progress: true,
|
||||
closable: false
|
||||
});
|
||||
|
||||
// progress bar... ;)
|
||||
var f = function (v) {
|
||||
return function () {
|
||||
if (v == 100) {
|
||||
Zarafa.common.dialogs.MessageBox.hide();
|
||||
} else {
|
||||
// # TRANSLATORS: {0} will be replaced by the percentage value (0-100)
|
||||
Zarafa.common.dialogs.MessageBox.updateProgress(v / 100, String.format(dgettext('plugin_calendarimporter', '{0}% loaded'), Math.round(v)));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
for (var i = 1; i < 101; i++) {
|
||||
setTimeout(f(i), 20 * i);
|
||||
}
|
||||
|
||||
/* store the attachment to a temporary folder and prepare it for uploading */
|
||||
var attachmentRecord = btn.records;
|
||||
var attachmentStore = attachmentRecord.store;
|
||||
|
||||
var store = attachmentStore.getParentRecord().get('store_entryid');
|
||||
var entryid = attachmentStore.getAttachmentParentRecordEntryId();
|
||||
var attachNum = new Array(1);
|
||||
if (attachmentRecord.get('attach_num') != -1) {
|
||||
attachNum[0] = attachmentRecord.get('attach_num');
|
||||
} else {
|
||||
attachNum[0] = attachmentRecord.get('tmpname');
|
||||
}
|
||||
var dialog_attachments = attachmentStore.getId();
|
||||
var filename = attachmentRecord.data.name;
|
||||
|
||||
var responseHandler = new Zarafa.plugins.calendarimporter.data.ResponseHandler({
|
||||
successCallback: this.gotAttachmentFileName,
|
||||
scope: this
|
||||
});
|
||||
|
||||
// request attachment preperation
|
||||
container.getRequest().singleRequest(
|
||||
'calendarmodule',
|
||||
'importattachment',
|
||||
{
|
||||
entryid: entryid,
|
||||
store: store,
|
||||
attachNum: attachNum,
|
||||
dialog_attachments: dialog_attachments,
|
||||
filename: filename
|
||||
},
|
||||
responseHandler
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Open the import dialog.
|
||||
* @param {String} filename
|
||||
*/
|
||||
openImportDialog: function (filename) {
|
||||
var componentType = Zarafa.core.data.SharedComponentType['plugins.calendarimporter.dialogs.importevents'];
|
||||
var config = {
|
||||
filename: filename,
|
||||
modal: true
|
||||
};
|
||||
|
||||
Zarafa.core.data.UIFactory.openLayerComponent(componentType, undefined, config);
|
||||
},
|
||||
|
||||
/**
|
||||
* Bid for the type of shared component
|
||||
* and the given record.
|
||||
* This will bid on calendar.dialogs.importevents
|
||||
* @param {Zarafa.core.data.SharedComponentType} type Type of component a context can bid for.
|
||||
* @param {Ext.data.Record} record Optionally passed record.
|
||||
* @return {Number} The bid for the shared component
|
||||
*/
|
||||
bidSharedComponent: function (type, record) {
|
||||
var bid = -1;
|
||||
switch (type) {
|
||||
case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.dialogs.importevents']:
|
||||
bid = 2;
|
||||
break;
|
||||
case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.settings.dialogs.calsyncedit']:
|
||||
bid = 2;
|
||||
break;
|
||||
case Zarafa.core.data.SharedComponentType['common.contextmenu']:
|
||||
if (record instanceof Zarafa.core.data.MAPIRecord) {
|
||||
if (record.get('object_type') == Zarafa.core.mapi.ObjectType.MAPI_FOLDER && record.get('container_class') == "IPF.Appointment") {
|
||||
bid = 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return bid;
|
||||
},
|
||||
|
||||
/**
|
||||
* Will return the reference to the shared component.
|
||||
* Based on the type of component requested a component is returned.
|
||||
* @param {Zarafa.core.data.SharedComponentType} type Type of component a context can bid for.
|
||||
* @param {Ext.data.Record} record Optionally passed record.
|
||||
* @return {Ext.Component} Component
|
||||
*/
|
||||
getSharedComponent: function (type, record) {
|
||||
var component;
|
||||
switch (type) {
|
||||
case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.dialogs.importevents']:
|
||||
component = Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel;
|
||||
break;
|
||||
case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.settings.dialogs.calsyncedit']:
|
||||
component = Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditContentPanel;
|
||||
break;
|
||||
case Zarafa.core.data.SharedComponentType['common.contextmenu']:
|
||||
component = Zarafa.plugins.calendarimporter.ui.ContextMenu;
|
||||
break;
|
||||
}
|
||||
|
||||
return component;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/*############################################################################################################################*
|
||||
* STARTUP
|
||||
*############################################################################################################################*/
|
||||
Zarafa.onReady(function () {
|
||||
container.registerPlugin(new Zarafa.core.PluginMetaData({
|
||||
name: 'calendarimporter',
|
||||
displayName: dgettext('plugin_calendarimporter', 'Calendarimporter Plugin'),
|
||||
about: Zarafa.plugins.calendarimporter.ABOUT,
|
||||
pluginConstructor: Zarafa.plugins.calendarimporter.ImportPlugin
|
||||
}));
|
||||
});
|
||||
|
@@ -1,136 +1,136 @@
|
||||
/**
|
||||
* SettingsCalSyncWidget.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
Ext.namespace('Zarafa.plugins.calendarimporter.settings');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget
|
||||
* @extends Zarafa.settings.ui.SettingsWidget
|
||||
* @xtype calendarimporter.settingscalsyncwidget
|
||||
*
|
||||
*/
|
||||
Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget = Ext.extend(Zarafa.settings.ui.SettingsWidget, {
|
||||
/**
|
||||
* @cfg {Zarafa.settings.SettingsContext} settingsContext
|
||||
*/
|
||||
settingsContext: undefined,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} config Configuration object
|
||||
*/
|
||||
constructor: function (config) {
|
||||
config = config || {};
|
||||
|
||||
var store = new Ext.data.JsonStore({
|
||||
fields: [
|
||||
{name: 'id', type: 'int'},
|
||||
{name: 'icsurl'},
|
||||
{name: 'user'},
|
||||
{name: 'pass'},
|
||||
{name: 'intervall', type: 'int'},
|
||||
{name: 'calendar'},
|
||||
{name: 'calendarname'},
|
||||
{name: 'lastsync'}
|
||||
],
|
||||
sortInfo: {
|
||||
field: 'id',
|
||||
direction: 'ASC'
|
||||
},
|
||||
autoDestroy: true
|
||||
});
|
||||
|
||||
Ext.applyIf(config, {
|
||||
height: 400,
|
||||
title: dgettext('plugin_calendarimporter', 'Calendar Sync settings'),
|
||||
xtype: 'calendarimporter.settingscalsyncwidget',
|
||||
layout: {
|
||||
// override from SettingsWidget
|
||||
type: 'fit'
|
||||
},
|
||||
items: [{
|
||||
xtype: 'calendarimporter.calsyncpanel',
|
||||
store: store,
|
||||
ref: 'calsyncPanel'
|
||||
}]
|
||||
});
|
||||
|
||||
Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget.superclass.constructor.call(this, config);
|
||||
},
|
||||
|
||||
/**
|
||||
* Called by the {@link Zarafa.settings.ui.SettingsCategory Category} when
|
||||
* it has been called with {@link zarafa.settings.ui.SettingsCategory#update}.
|
||||
* This is used to load the latest version of the settings from the
|
||||
* {@link Zarafa.settings.SettingsModel} into the UI of this category.
|
||||
* @param {Zarafa.settings.SettingsModel} settingsModel The settings to load
|
||||
*/
|
||||
update: function (settingsModel) {
|
||||
this.model = settingsModel;
|
||||
|
||||
// Convert the signatures into Store data
|
||||
var icslinks = settingsModel.get('zarafa/v1/contexts/calendar/icssync', true);
|
||||
var syncArray = [];
|
||||
for (var key in icslinks) {
|
||||
if (icslinks.hasOwnProperty(key)) { // skip inherited props
|
||||
syncArray.push(Ext.apply({}, icslinks[key], {id: key}));
|
||||
}
|
||||
}
|
||||
|
||||
// Load all icslinks into the GridPanel
|
||||
var store = this.calsyncPanel.calsyncGrid.getStore();
|
||||
store.loadData(syncArray);
|
||||
},
|
||||
|
||||
/**
|
||||
* Called by the {@link Zarafa.settings.ui.SettingsCategory Category} when
|
||||
* it has been called with {@link zarafa.settings.ui.SettingsCategory#updateSettings}.
|
||||
* 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) {
|
||||
settingsModel.beginEdit();
|
||||
|
||||
// Start reading the Grid store and convert the contents back into
|
||||
// an object which can be pushed to the settings.
|
||||
var icslinks = this.calsyncPanel.calsyncGrid.getStore().getRange();
|
||||
var icslinkData = {};
|
||||
for (var i = 0, len = icslinks.length; i < len; i++) {
|
||||
var icslink = icslinks[i];
|
||||
|
||||
icslinkData[icslink.get('id')] = {
|
||||
'icsurl': icslink.get('icsurl'),
|
||||
'intervall': icslink.get('intervall'),
|
||||
'user': icslink.get('user'),
|
||||
'pass': icslink.get('pass'),
|
||||
'lastsync': icslink.get('lastsync'),
|
||||
'calendar': icslink.get('calendar'),
|
||||
'calendarname': Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(icslink.get('calendar')).display_name
|
||||
};
|
||||
}
|
||||
settingsModel.set('zarafa/v1/contexts/calendar/icssync', icslinkData);
|
||||
|
||||
settingsModel.endEdit();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* SettingsCalSyncWidget.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
Ext.namespace('Zarafa.plugins.calendarimporter.settings');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget
|
||||
* @extends Zarafa.settings.ui.SettingsWidget
|
||||
* @xtype calendarimporter.settingscalsyncwidget
|
||||
*
|
||||
*/
|
||||
Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget = Ext.extend(Zarafa.settings.ui.SettingsWidget, {
|
||||
/**
|
||||
* @cfg {Zarafa.settings.SettingsContext} settingsContext
|
||||
*/
|
||||
settingsContext: undefined,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} config Configuration object
|
||||
*/
|
||||
constructor: function (config) {
|
||||
config = config || {};
|
||||
|
||||
var store = new Ext.data.JsonStore({
|
||||
fields: [
|
||||
{name: 'id', type: 'int'},
|
||||
{name: 'icsurl'},
|
||||
{name: 'user'},
|
||||
{name: 'pass'},
|
||||
{name: 'intervall', type: 'int'},
|
||||
{name: 'calendar'},
|
||||
{name: 'calendarname'},
|
||||
{name: 'lastsync'}
|
||||
],
|
||||
sortInfo: {
|
||||
field: 'id',
|
||||
direction: 'ASC'
|
||||
},
|
||||
autoDestroy: true
|
||||
});
|
||||
|
||||
Ext.applyIf(config, {
|
||||
height: 400,
|
||||
title: dgettext('plugin_calendarimporter', 'Calendar Sync settings'),
|
||||
xtype: 'calendarimporter.settingscalsyncwidget',
|
||||
layout: {
|
||||
// override from SettingsWidget
|
||||
type: 'fit'
|
||||
},
|
||||
items: [{
|
||||
xtype: 'calendarimporter.calsyncpanel',
|
||||
store: store,
|
||||
ref: 'calsyncPanel'
|
||||
}]
|
||||
});
|
||||
|
||||
Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget.superclass.constructor.call(this, config);
|
||||
},
|
||||
|
||||
/**
|
||||
* Called by the {@link Zarafa.settings.ui.SettingsCategory Category} when
|
||||
* it has been called with {@link zarafa.settings.ui.SettingsCategory#update}.
|
||||
* This is used to load the latest version of the settings from the
|
||||
* {@link Zarafa.settings.SettingsModel} into the UI of this category.
|
||||
* @param {Zarafa.settings.SettingsModel} settingsModel The settings to load
|
||||
*/
|
||||
update: function (settingsModel) {
|
||||
this.model = settingsModel;
|
||||
|
||||
// Convert the signatures into Store data
|
||||
var icslinks = settingsModel.get('zarafa/v1/contexts/calendar/icssync', true);
|
||||
var syncArray = [];
|
||||
for (var key in icslinks) {
|
||||
if (icslinks.hasOwnProperty(key)) { // skip inherited props
|
||||
syncArray.push(Ext.apply({}, icslinks[key], {id: key}));
|
||||
}
|
||||
}
|
||||
|
||||
// Load all icslinks into the GridPanel
|
||||
var store = this.calsyncPanel.calsyncGrid.getStore();
|
||||
store.loadData(syncArray);
|
||||
},
|
||||
|
||||
/**
|
||||
* Called by the {@link Zarafa.settings.ui.SettingsCategory Category} when
|
||||
* it has been called with {@link zarafa.settings.ui.SettingsCategory#updateSettings}.
|
||||
* 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) {
|
||||
settingsModel.beginEdit();
|
||||
|
||||
// Start reading the Grid store and convert the contents back into
|
||||
// an object which can be pushed to the settings.
|
||||
var icslinks = this.calsyncPanel.calsyncGrid.getStore().getRange();
|
||||
var icslinkData = {};
|
||||
for (var i = 0, len = icslinks.length; i < len; i++) {
|
||||
var icslink = icslinks[i];
|
||||
|
||||
icslinkData[icslink.get('id')] = {
|
||||
'icsurl': icslink.get('icsurl'),
|
||||
'intervall': icslink.get('intervall'),
|
||||
'user': icslink.get('user'),
|
||||
'pass': icslink.get('pass'),
|
||||
'lastsync': icslink.get('lastsync'),
|
||||
'calendar': icslink.get('calendar'),
|
||||
'calendarname': Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(icslink.get('calendar')).display_name
|
||||
};
|
||||
}
|
||||
settingsModel.set('zarafa/v1/contexts/calendar/icssync', icslinkData);
|
||||
|
||||
settingsModel.endEdit();
|
||||
}
|
||||
});
|
||||
|
||||
Ext.reg('calendarimporter.settingscalsyncwidget', Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget);
|
@@ -1,230 +1,230 @@
|
||||
/**
|
||||
* SettingsWidget.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
Ext.namespace('Zarafa.plugins.calendarimporter.settings');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.calendarimporter.settings.SettingsWidget
|
||||
* @extends Zarafa.settings.ui.SettingsWidget
|
||||
* @xtype calendarimporter.settingswidget
|
||||
*
|
||||
*/
|
||||
Zarafa.plugins.calendarimporter.settings.SettingsWidget = Ext.extend(Zarafa.settings.ui.SettingsWidget, {
|
||||
/**
|
||||
* @cfg {Zarafa.settings.SettingsContext} settingsContext
|
||||
*/
|
||||
settingsContext: undefined,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} config Configuration object
|
||||
*/
|
||||
constructor: function (config) {
|
||||
config = config || {};
|
||||
|
||||
Ext.applyIf(config, {
|
||||
title: dgettext('plugin_calendarimporter', 'Calendar Import/Export plugin settings'),
|
||||
xtype: 'calendarimporter.settingswidget',
|
||||
items: [
|
||||
{
|
||||
xtype: 'checkbox',
|
||||
name: 'zarafa/v1/plugins/calendarimporter/enable_sync',
|
||||
ref: 'enableSync',
|
||||
fieldLabel: dgettext('plugin_calendarimporter', 'Enable ical sync'),
|
||||
lazyInit: false
|
||||
},
|
||||
this.createSelectBox(),
|
||||
this.createTimezoneBox()
|
||||
]
|
||||
});
|
||||
|
||||
Zarafa.plugins.calendarimporter.settings.SettingsWidget.superclass.constructor.call(this, config);
|
||||
},
|
||||
|
||||
createSelectBox: function () {
|
||||
var myStore = Zarafa.plugins.calendarimporter.data.Actions.getAllCalendarFolders(true);
|
||||
|
||||
return {
|
||||
xtype: "selectbox",
|
||||
ref: 'defaultCalendar',
|
||||
editable: false,
|
||||
name: "zarafa/v1/plugins/calendarimporter/default_calendar",
|
||||
value: Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByName(container.getSettingsModel().get("zarafa/v1/plugins/calendarimporter/default_calendar")).entryid,
|
||||
width: 100,
|
||||
fieldLabel: dgettext('plugin_calendarimporter', 'Default calender'),
|
||||
store: myStore,
|
||||
mode: 'local',
|
||||
labelSeperator: ":",
|
||||
border: false,
|
||||
anchor: "100%",
|
||||
scope: this,
|
||||
allowBlank: false
|
||||
}
|
||||
},
|
||||
|
||||
createTimezoneBox: function () {
|
||||
return {
|
||||
xtype: "selectbox",
|
||||
ref: 'defaultTimezone',
|
||||
editable: false,
|
||||
name: "zarafa/v1/plugins/calendarimporter/default_timezone",
|
||||
value: Zarafa.plugins.calendarimporter.data.Timezones.unMap(container.getSettingsModel().get("zarafa/v1/plugins/calendarimporter/default_timezone")),
|
||||
width: 100,
|
||||
fieldLabel: dgettext('plugin_calendarimporter', 'Default timezone'),
|
||||
store: Zarafa.plugins.calendarimporter.data.Timezones.store,
|
||||
labelSeperator: ":",
|
||||
mode: 'local',
|
||||
border: false,
|
||||
anchor: "100%",
|
||||
scope: this,
|
||||
allowBlank: false
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Called by the {@link Zarafa.settings.ui.SettingsCategory Category} when
|
||||
* it has been called with {@link zarafa.settings.ui.SettingsCategory#update}.
|
||||
* This is used to load the latest version of the settings from the
|
||||
* {@link Zarafa.settings.SettingsModel} into the UI of this category.
|
||||
* @param {Zarafa.settings.SettingsModel} settingsModel The settings to load
|
||||
*/
|
||||
update: function (settingsModel) {
|
||||
this.enableSync.setValue(settingsModel.get(this.enableSync.name));
|
||||
this.defaultCalendar.setValue(Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByName(settingsModel.get(this.defaultCalendar.name)).entryid);
|
||||
this.defaultTimezone.setValue(settingsModel.get(this.defaultTimezone.name));
|
||||
},
|
||||
|
||||
/**
|
||||
* Called by the {@link Zarafa.settings.ui.SettingsCategory Category} when
|
||||
* it has been called with {@link zarafa.settings.ui.SettingsCategory#updateSettings}.
|
||||
* 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) {
|
||||
// check if the user changed a value
|
||||
var changed = false;
|
||||
|
||||
if (settingsModel.get(this.enableSync.name) != this.enableSync.getValue()) {
|
||||
changed = true;
|
||||
} else if (settingsModel.get(this.defaultCalendar.name) != Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(this.defaultCalendar.getValue()).display_name) {
|
||||
changed = true;
|
||||
} else if (settingsModel.get(this.defaultTimezone.name) != this.defaultTimezone.getValue()) {
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
// Really save changes
|
||||
settingsModel.set(this.enableSync.name, this.enableSync.getValue());
|
||||
settingsModel.set(this.defaultCalendar.name, Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(this.defaultCalendar.getValue()).display_name); // store name
|
||||
settingsModel.set(this.defaultTimezone.name, this.defaultTimezone.getValue());
|
||||
|
||||
this.onUpdateSettings();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Called after the {@link Zarafa.settings.SettingsModel} fires the {@link Zarafa.settings.SettingsModel#save save}
|
||||
* event to indicate the settings were successfully saved and it will forcefully realod the webapp.
|
||||
* settings which were saved to the server.
|
||||
* @private
|
||||
*/
|
||||
onUpdateSettings: function () {
|
||||
var message = _('Your WebApp needs to be reloaded to make the changes visible!');
|
||||
message += '<br/><br/>';
|
||||
message += _('WebApp will automatically restart in order for these changes to take effect');
|
||||
message += '<br/>';
|
||||
|
||||
Zarafa.common.dialogs.MessageBox.addCustomButtons({
|
||||
title: _('Restart WebApp'),
|
||||
msg: message,
|
||||
icon: Ext.MessageBox.QUESTION,
|
||||
fn: this.restartWebapp,
|
||||
customButton: [{
|
||||
text: _('Restart'),
|
||||
name: 'restart'
|
||||
}, {
|
||||
text: _('Cancel'),
|
||||
name: 'cancel'
|
||||
}],
|
||||
scope: this
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Event handler for {@link #onResetSettings}. This will check if the user
|
||||
* wishes to reset the default settings or not.
|
||||
* @param {String} button The button which user pressed.
|
||||
* @private
|
||||
*/
|
||||
restartWebapp: function (button) {
|
||||
if (button === 'restart') {
|
||||
var contextModel = this.ownerCt.settingsContext.getModel();
|
||||
var realModel = contextModel.getRealSettingsModel();
|
||||
|
||||
realModel.save();
|
||||
|
||||
this.loadMask = new Zarafa.common.ui.LoadMask(Ext.getBody(), {
|
||||
msg: '<b>' + _('Webapp is reloading, Please wait.') + '</b>'
|
||||
});
|
||||
this.loadMask.show();
|
||||
|
||||
this.mon(realModel, 'save', this.onSettingsSave, this);
|
||||
this.mon(realModel, 'exception', this.onSettingsException, this);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Called when the {@link Zarafa.settings.} fires the {@link Zarafa.settings.SettingsModel#save save}
|
||||
* event to indicate the settings were successfully saved and it will forcefully realod the webapp.
|
||||
* @param {Zarafa.settings.SettingsModel} model The model which fired the event.
|
||||
* @param {Object} parameters The key-value object containing the action and the corresponding
|
||||
* settings which were saved to the server.
|
||||
* @private
|
||||
*/
|
||||
onSettingsSave: function (model, parameters) {
|
||||
this.mun(model, 'save', this.onSettingsSave, this);
|
||||
Zarafa.core.Util.reloadWebapp();
|
||||
},
|
||||
|
||||
/**
|
||||
* Called when the {@link Zarafa.settings.SettingsModel} fires the {@link Zarafa.settings.SettingsModel#exception exception}
|
||||
* event to indicate the settings were not successfully saved.
|
||||
* @param {Zarafa.settings.SettingsModel} model The settings model which fired the event
|
||||
* @param {String} type The value of this parameter will be either 'response' or 'remote'.
|
||||
* @param {String} action Name of the action (see {@link Ext.data.Api#actions}).
|
||||
* @param {Object} options The object containing a 'path' and 'value' field indicating
|
||||
* respectively the Setting and corresponding value for the setting which was being saved.
|
||||
* @param {Object} response The response object as received from the PHP-side
|
||||
* @private
|
||||
*/
|
||||
onSettingsException: function (model, type, action, options, response) {
|
||||
this.loadMask.hide();
|
||||
|
||||
// Remove event handlers
|
||||
this.mun(model, 'save', this.onSettingsSave, this);
|
||||
this.mun(model, 'exception', this.onSettingsException, this);
|
||||
}
|
||||
});
|
||||
|
||||
Ext.reg('calendarimporter.settingswidget', Zarafa.plugins.calendarimporter.settings.SettingsWidget);
|
||||
/**
|
||||
* SettingsWidget.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
Ext.namespace('Zarafa.plugins.calendarimporter.settings');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.calendarimporter.settings.SettingsWidget
|
||||
* @extends Zarafa.settings.ui.SettingsWidget
|
||||
* @xtype calendarimporter.settingswidget
|
||||
*
|
||||
*/
|
||||
Zarafa.plugins.calendarimporter.settings.SettingsWidget = Ext.extend(Zarafa.settings.ui.SettingsWidget, {
|
||||
/**
|
||||
* @cfg {Zarafa.settings.SettingsContext} settingsContext
|
||||
*/
|
||||
settingsContext: undefined,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} config Configuration object
|
||||
*/
|
||||
constructor: function (config) {
|
||||
config = config || {};
|
||||
|
||||
Ext.applyIf(config, {
|
||||
title: dgettext('plugin_calendarimporter', 'Calendar Import/Export plugin settings'),
|
||||
xtype: 'calendarimporter.settingswidget',
|
||||
items: [
|
||||
{
|
||||
xtype: 'checkbox',
|
||||
name: 'zarafa/v1/plugins/calendarimporter/enable_sync',
|
||||
ref: 'enableSync',
|
||||
fieldLabel: dgettext('plugin_calendarimporter', 'Enable ical sync'),
|
||||
lazyInit: false
|
||||
},
|
||||
this.createSelectBox(),
|
||||
this.createTimezoneBox()
|
||||
]
|
||||
});
|
||||
|
||||
Zarafa.plugins.calendarimporter.settings.SettingsWidget.superclass.constructor.call(this, config);
|
||||
},
|
||||
|
||||
createSelectBox: function () {
|
||||
var myStore = Zarafa.plugins.calendarimporter.data.Actions.getAllCalendarFolders(true);
|
||||
|
||||
return {
|
||||
xtype: "selectbox",
|
||||
ref: 'defaultCalendar',
|
||||
editable: false,
|
||||
name: "zarafa/v1/plugins/calendarimporter/default_calendar",
|
||||
value: Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByName(container.getSettingsModel().get("zarafa/v1/plugins/calendarimporter/default_calendar")).entryid,
|
||||
width: 100,
|
||||
fieldLabel: dgettext('plugin_calendarimporter', 'Default calender'),
|
||||
store: myStore,
|
||||
mode: 'local',
|
||||
labelSeperator: ":",
|
||||
border: false,
|
||||
anchor: "100%",
|
||||
scope: this,
|
||||
allowBlank: false
|
||||
}
|
||||
},
|
||||
|
||||
createTimezoneBox: function () {
|
||||
return {
|
||||
xtype: "selectbox",
|
||||
ref: 'defaultTimezone',
|
||||
editable: false,
|
||||
name: "zarafa/v1/plugins/calendarimporter/default_timezone",
|
||||
value: Zarafa.plugins.calendarimporter.data.Timezones.unMap(container.getSettingsModel().get("zarafa/v1/plugins/calendarimporter/default_timezone")),
|
||||
width: 100,
|
||||
fieldLabel: dgettext('plugin_calendarimporter', 'Default timezone'),
|
||||
store: Zarafa.plugins.calendarimporter.data.Timezones.store,
|
||||
labelSeperator: ":",
|
||||
mode: 'local',
|
||||
border: false,
|
||||
anchor: "100%",
|
||||
scope: this,
|
||||
allowBlank: false
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Called by the {@link Zarafa.settings.ui.SettingsCategory Category} when
|
||||
* it has been called with {@link zarafa.settings.ui.SettingsCategory#update}.
|
||||
* This is used to load the latest version of the settings from the
|
||||
* {@link Zarafa.settings.SettingsModel} into the UI of this category.
|
||||
* @param {Zarafa.settings.SettingsModel} settingsModel The settings to load
|
||||
*/
|
||||
update: function (settingsModel) {
|
||||
this.enableSync.setValue(settingsModel.get(this.enableSync.name));
|
||||
this.defaultCalendar.setValue(Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByName(settingsModel.get(this.defaultCalendar.name)).entryid);
|
||||
this.defaultTimezone.setValue(settingsModel.get(this.defaultTimezone.name));
|
||||
},
|
||||
|
||||
/**
|
||||
* Called by the {@link Zarafa.settings.ui.SettingsCategory Category} when
|
||||
* it has been called with {@link zarafa.settings.ui.SettingsCategory#updateSettings}.
|
||||
* 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) {
|
||||
// check if the user changed a value
|
||||
var changed = false;
|
||||
|
||||
if (settingsModel.get(this.enableSync.name) != this.enableSync.getValue()) {
|
||||
changed = true;
|
||||
} else if (settingsModel.get(this.defaultCalendar.name) != Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(this.defaultCalendar.getValue()).display_name) {
|
||||
changed = true;
|
||||
} else if (settingsModel.get(this.defaultTimezone.name) != this.defaultTimezone.getValue()) {
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
// Really save changes
|
||||
settingsModel.set(this.enableSync.name, this.enableSync.getValue());
|
||||
settingsModel.set(this.defaultCalendar.name, Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(this.defaultCalendar.getValue()).display_name); // store name
|
||||
settingsModel.set(this.defaultTimezone.name, this.defaultTimezone.getValue());
|
||||
|
||||
this.onUpdateSettings();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Called after the {@link Zarafa.settings.SettingsModel} fires the {@link Zarafa.settings.SettingsModel#save save}
|
||||
* event to indicate the settings were successfully saved and it will forcefully realod the webapp.
|
||||
* settings which were saved to the server.
|
||||
* @private
|
||||
*/
|
||||
onUpdateSettings: function () {
|
||||
var message = _('Your WebApp needs to be reloaded to make the changes visible!');
|
||||
message += '<br/><br/>';
|
||||
message += _('WebApp will automatically restart in order for these changes to take effect');
|
||||
message += '<br/>';
|
||||
|
||||
Zarafa.common.dialogs.MessageBox.addCustomButtons({
|
||||
title: _('Restart WebApp'),
|
||||
msg: message,
|
||||
icon: Ext.MessageBox.QUESTION,
|
||||
fn: this.restartWebapp,
|
||||
customButton: [{
|
||||
text: _('Restart'),
|
||||
name: 'restart'
|
||||
}, {
|
||||
text: _('Cancel'),
|
||||
name: 'cancel'
|
||||
}],
|
||||
scope: this
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Event handler for {@link #onResetSettings}. This will check if the user
|
||||
* wishes to reset the default settings or not.
|
||||
* @param {String} button The button which user pressed.
|
||||
* @private
|
||||
*/
|
||||
restartWebapp: function (button) {
|
||||
if (button === 'restart') {
|
||||
var contextModel = this.ownerCt.settingsContext.getModel();
|
||||
var realModel = contextModel.getRealSettingsModel();
|
||||
|
||||
realModel.save();
|
||||
|
||||
this.loadMask = new Zarafa.common.ui.LoadMask(Ext.getBody(), {
|
||||
msg: '<b>' + _('Webapp is reloading, Please wait.') + '</b>'
|
||||
});
|
||||
this.loadMask.show();
|
||||
|
||||
this.mon(realModel, 'save', this.onSettingsSave, this);
|
||||
this.mon(realModel, 'exception', this.onSettingsException, this);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Called when the {@link Zarafa.settings.} fires the {@link Zarafa.settings.SettingsModel#save save}
|
||||
* event to indicate the settings were successfully saved and it will forcefully realod the webapp.
|
||||
* @param {Zarafa.settings.SettingsModel} model The model which fired the event.
|
||||
* @param {Object} parameters The key-value object containing the action and the corresponding
|
||||
* settings which were saved to the server.
|
||||
* @private
|
||||
*/
|
||||
onSettingsSave: function (model, parameters) {
|
||||
this.mun(model, 'save', this.onSettingsSave, this);
|
||||
Zarafa.core.Util.reloadWebapp();
|
||||
},
|
||||
|
||||
/**
|
||||
* Called when the {@link Zarafa.settings.SettingsModel} fires the {@link Zarafa.settings.SettingsModel#exception exception}
|
||||
* event to indicate the settings were not successfully saved.
|
||||
* @param {Zarafa.settings.SettingsModel} model The settings model which fired the event
|
||||
* @param {String} type The value of this parameter will be either 'response' or 'remote'.
|
||||
* @param {String} action Name of the action (see {@link Ext.data.Api#actions}).
|
||||
* @param {Object} options The object containing a 'path' and 'value' field indicating
|
||||
* respectively the Setting and corresponding value for the setting which was being saved.
|
||||
* @param {Object} response The response object as received from the PHP-side
|
||||
* @private
|
||||
*/
|
||||
onSettingsException: function (model, type, action, options, response) {
|
||||
this.loadMask.hide();
|
||||
|
||||
// Remove event handlers
|
||||
this.mun(model, 'save', this.onSettingsSave, this);
|
||||
this.mun(model, 'exception', this.onSettingsException, this);
|
||||
}
|
||||
});
|
||||
|
||||
Ext.reg('calendarimporter.settingswidget', Zarafa.plugins.calendarimporter.settings.SettingsWidget);
|
||||
|
@@ -1,60 +1,60 @@
|
||||
/**
|
||||
* CalSyncEditContentPanel.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
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',
|
||||
layout: 'fit',
|
||||
model: true,
|
||||
autoSave: false,
|
||||
width: 400,
|
||||
height: 400,
|
||||
title: dgettext('plugin_calendarimporter', '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);
|
||||
/**
|
||||
* CalSyncEditContentPanel.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
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',
|
||||
layout: 'fit',
|
||||
model: true,
|
||||
autoSave: false,
|
||||
width: 400,
|
||||
height: 400,
|
||||
title: dgettext('plugin_calendarimporter', '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);
|
||||
|
@@ -1,223 +1,223 @@
|
||||
/**
|
||||
* CalSyncEditPanel.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
Ext.namespace('Zarafa.plugins.calendarimporter.settings.dialogs');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel
|
||||
* @extends Ext.form.FormPanel
|
||||
* @xtype calendarimporter.calsynceditpanel
|
||||
*
|
||||
* Will generate UI for {@link Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel CalSyncEditPanel}.
|
||||
*/
|
||||
Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(Ext.form.FormPanel, {
|
||||
|
||||
/**
|
||||
* the id of the currently edited item
|
||||
*/
|
||||
currentItem: undefined,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param config Configuration structure
|
||||
*/
|
||||
constructor: function (config) {
|
||||
config = config || {};
|
||||
|
||||
if (config.item)
|
||||
this.currentItem = config.item;
|
||||
|
||||
Ext.applyIf(config, {
|
||||
// Override from Ext.Component
|
||||
xtype: 'calendarimporter.calsynceditpanel',
|
||||
labelAlign: 'top',
|
||||
defaultType: 'textfield',
|
||||
items: this.createPanelItems(config),
|
||||
buttons: [{
|
||||
text: _('Save'),
|
||||
handler: this.doSave,
|
||||
scope: this
|
||||
},
|
||||
{
|
||||
text: _('Cancel'),
|
||||
handler: this.doClose,
|
||||
scope: this
|
||||
}]
|
||||
});
|
||||
|
||||
Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel.superclass.constructor.call(this, config);
|
||||
},
|
||||
|
||||
/**
|
||||
* close the dialog
|
||||
*/
|
||||
doClose: function () {
|
||||
this.dialog.close();
|
||||
},
|
||||
|
||||
/**
|
||||
* save the data to the store
|
||||
*/
|
||||
doSave: function () {
|
||||
var store = this.dialog.store;
|
||||
var id = 0;
|
||||
var record = undefined;
|
||||
|
||||
if (!this.currentItem) {
|
||||
record = new store.recordType({
|
||||
id: this.hashCode(this.icsurl.getValue()),
|
||||
icsurl: this.icsurl.getValue(),
|
||||
intervall: this.intervall.getValue(),
|
||||
user: this.user.getValue(),
|
||||
pass: Ext.util.base64.encode(this.pass.getValue()),
|
||||
calendar: this.calendar.getValue(),
|
||||
calendarname: Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(this.calendar.getValue()).display_name,
|
||||
lastsync: "never"
|
||||
});
|
||||
}
|
||||
|
||||
if (this.icsurl.isValid()) {
|
||||
if (record) {
|
||||
store.add(record);
|
||||
} else {
|
||||
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', Ext.util.base64.encode(this.pass.getValue()));
|
||||
this.currentItem.set('calendar', this.calendar.getValue());
|
||||
this.currentItem.set('calendarname', Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(this.calendar.getValue()).display_name);
|
||||
}
|
||||
this.dialog.close();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @private
|
||||
*/
|
||||
createPanelItems: function (config) {
|
||||
var icsurl = "";
|
||||
var intervall = "15";
|
||||
var user = "";
|
||||
var pass = "";
|
||||
var calendarname = "";
|
||||
var calendar = Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByName(container.getSettingsModel().get("zarafa/v1/plugins/calendarimporter/default_calendar")).entryid;
|
||||
var myStore = Zarafa.plugins.calendarimporter.data.Actions.getAllCalendarFolders(true);
|
||||
|
||||
if (config.item) {
|
||||
icsurl = config.item.get('icsurl');
|
||||
intervall = config.item.get('intervall');
|
||||
user = config.item.get('user');
|
||||
pass = Ext.util.base64.decode(config.item.get('pass'));
|
||||
calendar = config.item.get('calendar');
|
||||
calendarname = config.item.get('calendarname');
|
||||
}
|
||||
|
||||
|
||||
return [{
|
||||
xtype: 'fieldset',
|
||||
title: dgettext('plugin_calendarimporter', 'ICAL Information'),
|
||||
defaultType: 'textfield',
|
||||
layout: 'form',
|
||||
flex: 1,
|
||||
defaults: {
|
||||
anchor: '100%',
|
||||
flex: 1
|
||||
},
|
||||
items: [{
|
||||
fieldLabel: dgettext('plugin_calendarimporter', 'ICS Url'),
|
||||
name: 'icsurl',
|
||||
ref: '../icsurl',
|
||||
value: icsurl,
|
||||
allowBlank: false
|
||||
},
|
||||
{
|
||||
xtype: 'selectbox',
|
||||
fieldLabel: dgettext('plugin_calendarimporter', 'Destination Calendar'),
|
||||
name: 'calendar',
|
||||
ref: '../calendar',
|
||||
value: calendar,
|
||||
editable: false,
|
||||
store: myStore,
|
||||
mode: 'local',
|
||||
labelSeperator: ":",
|
||||
border: false,
|
||||
anchor: "100%",
|
||||
scope: this,
|
||||
allowBlank: false
|
||||
},
|
||||
{
|
||||
xtype: 'numberfield',
|
||||
fieldLabel: dgettext('plugin_calendarimporter', 'Sync Intervall (minutes)'),
|
||||
name: 'intervall',
|
||||
ref: '../intervall',
|
||||
value: intervall,
|
||||
allowBlank: false
|
||||
}]
|
||||
},
|
||||
{
|
||||
xtype: 'fieldset',
|
||||
title: dgettext('plugin_calendarimporter', 'Authentication (optional)'),
|
||||
defaultType: 'textfield',
|
||||
layout: 'form',
|
||||
defaults: {
|
||||
anchor: '100%'
|
||||
},
|
||||
items: [{
|
||||
fieldLabel: dgettext('plugin_calendarimporter', 'Username'),
|
||||
name: 'user',
|
||||
ref: '../user',
|
||||
value: user,
|
||||
allowBlank: true
|
||||
},
|
||||
{
|
||||
fieldLabel: dgettext('plugin_calendarimporter', 'Password'),
|
||||
name: 'pass',
|
||||
ref: '../pass',
|
||||
value: pass,
|
||||
inputType: 'password',
|
||||
allowBlank: true
|
||||
}]
|
||||
}];
|
||||
},
|
||||
|
||||
/**
|
||||
* Java String.hashCode() implementation
|
||||
* @private
|
||||
*/
|
||||
hashCode: function (str) {
|
||||
var hash = 0;
|
||||
var chr = 0;
|
||||
var i = 0;
|
||||
|
||||
if (str.length == 0) return hash;
|
||||
for (i = 0; i < str.length; i++) {
|
||||
chr = str.charCodeAt(i);
|
||||
hash = ((hash << 5) - hash) + chr;
|
||||
hash = hash & hash; // Convert to 32bit integer
|
||||
}
|
||||
return Math.abs(hash);
|
||||
}
|
||||
});
|
||||
|
||||
Ext.reg('calendarimporter.calsynceditpanel', Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel);
|
||||
/**
|
||||
* CalSyncEditPanel.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
Ext.namespace('Zarafa.plugins.calendarimporter.settings.dialogs');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel
|
||||
* @extends Ext.form.FormPanel
|
||||
* @xtype calendarimporter.calsynceditpanel
|
||||
*
|
||||
* Will generate UI for {@link Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel CalSyncEditPanel}.
|
||||
*/
|
||||
Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(Ext.form.FormPanel, {
|
||||
|
||||
/**
|
||||
* the id of the currently edited item
|
||||
*/
|
||||
currentItem: undefined,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param config Configuration structure
|
||||
*/
|
||||
constructor: function (config) {
|
||||
config = config || {};
|
||||
|
||||
if (config.item)
|
||||
this.currentItem = config.item;
|
||||
|
||||
Ext.applyIf(config, {
|
||||
// Override from Ext.Component
|
||||
xtype: 'calendarimporter.calsynceditpanel',
|
||||
labelAlign: 'top',
|
||||
defaultType: 'textfield',
|
||||
items: this.createPanelItems(config),
|
||||
buttons: [{
|
||||
text: _('Save'),
|
||||
handler: this.doSave,
|
||||
scope: this
|
||||
},
|
||||
{
|
||||
text: _('Cancel'),
|
||||
handler: this.doClose,
|
||||
scope: this
|
||||
}]
|
||||
});
|
||||
|
||||
Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel.superclass.constructor.call(this, config);
|
||||
},
|
||||
|
||||
/**
|
||||
* close the dialog
|
||||
*/
|
||||
doClose: function () {
|
||||
this.dialog.close();
|
||||
},
|
||||
|
||||
/**
|
||||
* save the data to the store
|
||||
*/
|
||||
doSave: function () {
|
||||
var store = this.dialog.store;
|
||||
var id = 0;
|
||||
var record = undefined;
|
||||
|
||||
if (!this.currentItem) {
|
||||
record = new store.recordType({
|
||||
id: this.hashCode(this.icsurl.getValue()),
|
||||
icsurl: this.icsurl.getValue(),
|
||||
intervall: this.intervall.getValue(),
|
||||
user: this.user.getValue(),
|
||||
pass: Ext.util.base64.encode(this.pass.getValue()),
|
||||
calendar: this.calendar.getValue(),
|
||||
calendarname: Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(this.calendar.getValue()).display_name,
|
||||
lastsync: "never"
|
||||
});
|
||||
}
|
||||
|
||||
if (this.icsurl.isValid()) {
|
||||
if (record) {
|
||||
store.add(record);
|
||||
} else {
|
||||
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', Ext.util.base64.encode(this.pass.getValue()));
|
||||
this.currentItem.set('calendar', this.calendar.getValue());
|
||||
this.currentItem.set('calendarname', Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(this.calendar.getValue()).display_name);
|
||||
}
|
||||
this.dialog.close();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @private
|
||||
*/
|
||||
createPanelItems: function (config) {
|
||||
var icsurl = "";
|
||||
var intervall = "15";
|
||||
var user = "";
|
||||
var pass = "";
|
||||
var calendarname = "";
|
||||
var calendar = Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByName(container.getSettingsModel().get("zarafa/v1/plugins/calendarimporter/default_calendar")).entryid;
|
||||
var myStore = Zarafa.plugins.calendarimporter.data.Actions.getAllCalendarFolders(true);
|
||||
|
||||
if (config.item) {
|
||||
icsurl = config.item.get('icsurl');
|
||||
intervall = config.item.get('intervall');
|
||||
user = config.item.get('user');
|
||||
pass = Ext.util.base64.decode(config.item.get('pass'));
|
||||
calendar = config.item.get('calendar');
|
||||
calendarname = config.item.get('calendarname');
|
||||
}
|
||||
|
||||
|
||||
return [{
|
||||
xtype: 'fieldset',
|
||||
title: dgettext('plugin_calendarimporter', 'ICAL Information'),
|
||||
defaultType: 'textfield',
|
||||
layout: 'form',
|
||||
flex: 1,
|
||||
defaults: {
|
||||
anchor: '100%',
|
||||
flex: 1
|
||||
},
|
||||
items: [{
|
||||
fieldLabel: dgettext('plugin_calendarimporter', 'ICS Url'),
|
||||
name: 'icsurl',
|
||||
ref: '../icsurl',
|
||||
value: icsurl,
|
||||
allowBlank: false
|
||||
},
|
||||
{
|
||||
xtype: 'selectbox',
|
||||
fieldLabel: dgettext('plugin_calendarimporter', 'Destination Calendar'),
|
||||
name: 'calendar',
|
||||
ref: '../calendar',
|
||||
value: calendar,
|
||||
editable: false,
|
||||
store: myStore,
|
||||
mode: 'local',
|
||||
labelSeperator: ":",
|
||||
border: false,
|
||||
anchor: "100%",
|
||||
scope: this,
|
||||
allowBlank: false
|
||||
},
|
||||
{
|
||||
xtype: 'numberfield',
|
||||
fieldLabel: dgettext('plugin_calendarimporter', 'Sync Intervall (minutes)'),
|
||||
name: 'intervall',
|
||||
ref: '../intervall',
|
||||
value: intervall,
|
||||
allowBlank: false
|
||||
}]
|
||||
},
|
||||
{
|
||||
xtype: 'fieldset',
|
||||
title: dgettext('plugin_calendarimporter', 'Authentication (optional)'),
|
||||
defaultType: 'textfield',
|
||||
layout: 'form',
|
||||
defaults: {
|
||||
anchor: '100%'
|
||||
},
|
||||
items: [{
|
||||
fieldLabel: dgettext('plugin_calendarimporter', 'Username'),
|
||||
name: 'user',
|
||||
ref: '../user',
|
||||
value: user,
|
||||
allowBlank: true
|
||||
},
|
||||
{
|
||||
fieldLabel: dgettext('plugin_calendarimporter', 'Password'),
|
||||
name: 'pass',
|
||||
ref: '../pass',
|
||||
value: pass,
|
||||
inputType: 'password',
|
||||
allowBlank: true
|
||||
}]
|
||||
}];
|
||||
},
|
||||
|
||||
/**
|
||||
* Java String.hashCode() implementation
|
||||
* @private
|
||||
*/
|
||||
hashCode: function (str) {
|
||||
var hash = 0;
|
||||
var chr = 0;
|
||||
var i = 0;
|
||||
|
||||
if (str.length == 0) return hash;
|
||||
for (i = 0; i < str.length; i++) {
|
||||
chr = str.charCodeAt(i);
|
||||
hash = ((hash << 5) - hash) + chr;
|
||||
hash = hash & hash; // Convert to 32bit integer
|
||||
}
|
||||
return Math.abs(hash);
|
||||
}
|
||||
});
|
||||
|
||||
Ext.reg('calendarimporter.calsynceditpanel', Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel);
|
||||
|
@@ -1,180 +1,180 @@
|
||||
/**
|
||||
* CalSyncGrid.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
Ext.namespace('Zarafa.plugins.calendarimporter.settings.ui');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid
|
||||
* @extends Ext.grid.GridPanel
|
||||
* @xtype calendarimporter.calsyncgrid
|
||||
*
|
||||
*/
|
||||
Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid = Ext.extend(Ext.grid.GridPanel, {
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} config Configuration structure
|
||||
*/
|
||||
constructor: function (config) {
|
||||
config = config || {};
|
||||
|
||||
Ext.applyIf(config, {
|
||||
xtype: 'calendarimporter.calsyncgrid',
|
||||
border: true,
|
||||
store: config.store,
|
||||
viewConfig: {
|
||||
forceFit: true,
|
||||
emptyText: '<div class=\'emptytext\'>' + dgettext('plugin_calendarimporter', 'No ICAL sync entry exists') + '</div>'
|
||||
},
|
||||
loadMask: this.initLoadMask(),
|
||||
columns: this.initColumnModel(),
|
||||
selModel: this.initSelectionModel(),
|
||||
listeners: {
|
||||
viewready: this.onViewReady,
|
||||
rowdblclick: this.onRowDblClick,
|
||||
scope: this
|
||||
}
|
||||
});
|
||||
|
||||
Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid.superclass.constructor.call(this, config);
|
||||
},
|
||||
|
||||
/**
|
||||
* initialize events for the grid panel.
|
||||
* @private
|
||||
*/
|
||||
initEvents: function () {
|
||||
Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid.superclass.initEvents.call(this);
|
||||
|
||||
// select first icssync 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";
|
||||
},
|
||||
|
||||
/**
|
||||
* Render function
|
||||
* @return {String}
|
||||
* @private
|
||||
*/
|
||||
renderCalendarColumn: function (value, p, record) {
|
||||
return Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(value).display_name;
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a column model object, used in {@link #colModel} config
|
||||
* @return {Ext.grid.ColumnModel} column model object
|
||||
* @private
|
||||
*/
|
||||
initColumnModel: function () {
|
||||
return [{
|
||||
dataIndex: 'icsurl',
|
||||
header: dgettext('plugin_calendarimporter', 'ICS File'),
|
||||
renderer: Zarafa.common.ui.grid.Renderers.text
|
||||
},
|
||||
{
|
||||
dataIndex: 'calendarname',
|
||||
header: dgettext('plugin_calendarimporter', 'Destination Calender'),
|
||||
renderer: Zarafa.common.ui.grid.Renderers.text
|
||||
},
|
||||
{
|
||||
dataIndex: 'user',
|
||||
header: dgettext('plugin_calendarimporter', 'Authentication'),
|
||||
renderer: this.renderAuthColumn
|
||||
},
|
||||
{
|
||||
dataIndex: 'intervall',
|
||||
header: dgettext('plugin_calendarimporter', 'Sync Intervall')
|
||||
},
|
||||
{
|
||||
dataIndex: 'lastsync',
|
||||
header: dgettext('plugin_calendarimporter', 'Last Synchronisation'),
|
||||
renderer: Zarafa.common.ui.grid.Renderers.text
|
||||
}]
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a selection model object, used in {@link #selModel} config
|
||||
* @return {Ext.grid.RowSelectionModel} selection model object
|
||||
* @private
|
||||
*/
|
||||
initSelectionModel: function () {
|
||||
return new Ext.grid.RowSelectionModel({
|
||||
singleSelect: true
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Initialize the {@link Ext.grid.GridPanel.loadMask} field
|
||||
*
|
||||
* @return {Ext.LoadMask} The configuration object for {@link Ext.LoadMask}
|
||||
* @private
|
||||
*/
|
||||
initLoadMask: function () {
|
||||
return {
|
||||
msg: dgettext('plugin_calendarimporter', 'Loading ics sync entries...')
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Event handler which is fired when the gridPanel is ready. This will automatically
|
||||
* select the first row in the grid.
|
||||
* @private
|
||||
*/
|
||||
onViewReady: function () {
|
||||
this.getSelectionModel().selectFirstRow();
|
||||
},
|
||||
|
||||
/**
|
||||
* Function will be called to remove a ics sync entry.
|
||||
*/
|
||||
removeIcsSyncAs: function () {
|
||||
var icsRecord = this.getSelectionModel().getSelected();
|
||||
if (!icsRecord) {
|
||||
Ext.Msg.alert(dgettext('plugin_calendarimporter', 'Alert'), dgettext('plugin_calendarimporter', 'Please select a ics sync entry.'));
|
||||
return;
|
||||
}
|
||||
|
||||
this.store.remove(icsRecord);
|
||||
},
|
||||
|
||||
/**
|
||||
* 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['plugins.calendarimporter.settings.dialogs.calsyncedit'], undefined, {
|
||||
store: grid.getStore(),
|
||||
item: grid.getStore().getAt(rowIndex),
|
||||
manager: Ext.WindowMgr
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Ext.reg('calendarimporter.calsyncgrid', Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid);
|
||||
/**
|
||||
* CalSyncGrid.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
Ext.namespace('Zarafa.plugins.calendarimporter.settings.ui');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid
|
||||
* @extends Ext.grid.GridPanel
|
||||
* @xtype calendarimporter.calsyncgrid
|
||||
*
|
||||
*/
|
||||
Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid = Ext.extend(Ext.grid.GridPanel, {
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} config Configuration structure
|
||||
*/
|
||||
constructor: function (config) {
|
||||
config = config || {};
|
||||
|
||||
Ext.applyIf(config, {
|
||||
xtype: 'calendarimporter.calsyncgrid',
|
||||
border: true,
|
||||
store: config.store,
|
||||
viewConfig: {
|
||||
forceFit: true,
|
||||
emptyText: '<div class=\'emptytext\'>' + dgettext('plugin_calendarimporter', 'No ICAL sync entry exists') + '</div>'
|
||||
},
|
||||
loadMask: this.initLoadMask(),
|
||||
columns: this.initColumnModel(),
|
||||
selModel: this.initSelectionModel(),
|
||||
listeners: {
|
||||
viewready: this.onViewReady,
|
||||
rowdblclick: this.onRowDblClick,
|
||||
scope: this
|
||||
}
|
||||
});
|
||||
|
||||
Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid.superclass.constructor.call(this, config);
|
||||
},
|
||||
|
||||
/**
|
||||
* initialize events for the grid panel.
|
||||
* @private
|
||||
*/
|
||||
initEvents: function () {
|
||||
Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid.superclass.initEvents.call(this);
|
||||
|
||||
// select first icssync 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";
|
||||
},
|
||||
|
||||
/**
|
||||
* Render function
|
||||
* @return {String}
|
||||
* @private
|
||||
*/
|
||||
renderCalendarColumn: function (value, p, record) {
|
||||
return Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(value).display_name;
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a column model object, used in {@link #colModel} config
|
||||
* @return {Ext.grid.ColumnModel} column model object
|
||||
* @private
|
||||
*/
|
||||
initColumnModel: function () {
|
||||
return [{
|
||||
dataIndex: 'icsurl',
|
||||
header: dgettext('plugin_calendarimporter', 'ICS File'),
|
||||
renderer: Zarafa.common.ui.grid.Renderers.text
|
||||
},
|
||||
{
|
||||
dataIndex: 'calendarname',
|
||||
header: dgettext('plugin_calendarimporter', 'Destination Calender'),
|
||||
renderer: Zarafa.common.ui.grid.Renderers.text
|
||||
},
|
||||
{
|
||||
dataIndex: 'user',
|
||||
header: dgettext('plugin_calendarimporter', 'Authentication'),
|
||||
renderer: this.renderAuthColumn
|
||||
},
|
||||
{
|
||||
dataIndex: 'intervall',
|
||||
header: dgettext('plugin_calendarimporter', 'Sync Intervall')
|
||||
},
|
||||
{
|
||||
dataIndex: 'lastsync',
|
||||
header: dgettext('plugin_calendarimporter', 'Last Synchronisation'),
|
||||
renderer: Zarafa.common.ui.grid.Renderers.text
|
||||
}]
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a selection model object, used in {@link #selModel} config
|
||||
* @return {Ext.grid.RowSelectionModel} selection model object
|
||||
* @private
|
||||
*/
|
||||
initSelectionModel: function () {
|
||||
return new Ext.grid.RowSelectionModel({
|
||||
singleSelect: true
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Initialize the {@link Ext.grid.GridPanel.loadMask} field
|
||||
*
|
||||
* @return {Ext.LoadMask} The configuration object for {@link Ext.LoadMask}
|
||||
* @private
|
||||
*/
|
||||
initLoadMask: function () {
|
||||
return {
|
||||
msg: dgettext('plugin_calendarimporter', 'Loading ics sync entries...')
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Event handler which is fired when the gridPanel is ready. This will automatically
|
||||
* select the first row in the grid.
|
||||
* @private
|
||||
*/
|
||||
onViewReady: function () {
|
||||
this.getSelectionModel().selectFirstRow();
|
||||
},
|
||||
|
||||
/**
|
||||
* Function will be called to remove a ics sync entry.
|
||||
*/
|
||||
removeIcsSyncAs: function () {
|
||||
var icsRecord = this.getSelectionModel().getSelected();
|
||||
if (!icsRecord) {
|
||||
Ext.Msg.alert(dgettext('plugin_calendarimporter', 'Alert'), dgettext('plugin_calendarimporter', 'Please select a ics sync entry.'));
|
||||
return;
|
||||
}
|
||||
|
||||
this.store.remove(icsRecord);
|
||||
},
|
||||
|
||||
/**
|
||||
* 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['plugins.calendarimporter.settings.dialogs.calsyncedit'], undefined, {
|
||||
store: grid.getStore(),
|
||||
item: grid.getStore().getAt(rowIndex),
|
||||
manager: Ext.WindowMgr
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Ext.reg('calendarimporter.calsyncgrid', Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid);
|
||||
|
@@ -1,172 +1,172 @@
|
||||
/**
|
||||
* CalSyncPanel.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
Ext.namespace('Zarafa.plugins.calendarimporter.settings.ui');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel
|
||||
* @extends Ext.Panel
|
||||
* @xtype calendarimporter.calsyncpanel
|
||||
* Will generate UI for the {@link Zarafa.common.settings.SettingsSendAsWidget SettingsSendAsWidget}.
|
||||
*/
|
||||
Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel = Ext.extend(Ext.Panel, {
|
||||
|
||||
// store
|
||||
store: undefined,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param config Configuration structure
|
||||
*/
|
||||
constructor: function (config) {
|
||||
config = config || {};
|
||||
if (config.store)
|
||||
this.store = config.store;
|
||||
|
||||
Ext.applyIf(config, {
|
||||
// Override from Ext.Component
|
||||
xtype: 'calendarimporter.calsyncpanel',
|
||||
border: false,
|
||||
layout: {
|
||||
type: 'vbox',
|
||||
align: 'stretch',
|
||||
pack: 'start'
|
||||
},
|
||||
items: this.createPanelItems(this.store)
|
||||
});
|
||||
|
||||
Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel.superclass.constructor.call(this, config);
|
||||
},
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
createPanelItems: function (store) {
|
||||
return [{
|
||||
xtype: 'displayfield',
|
||||
value: dgettext('plugin_calendarimporter', 'Setup calendars you want to subscribe to.'),
|
||||
fieldClass: 'x-form-display-field'
|
||||
}, {
|
||||
xtype: 'container',
|
||||
flex: 1,
|
||||
layout: {
|
||||
type: 'hbox',
|
||||
align: 'stretch',
|
||||
pack: 'start'
|
||||
},
|
||||
items: [{
|
||||
xtype: 'calendarimporter.calsyncgrid',
|
||||
ref: '../calsyncGrid',
|
||||
store: store,
|
||||
flex: 1
|
||||
}, {
|
||||
xtype: 'container',
|
||||
width: 160,
|
||||
defaults: {
|
||||
width: 140
|
||||
},
|
||||
layout: {
|
||||
type: 'vbox',
|
||||
align: 'center',
|
||||
pack: 'start'
|
||||
},
|
||||
items: [{
|
||||
xtype: 'button',
|
||||
text: _('Add') + '...',
|
||||
handler: this.onCalSyncAdd,
|
||||
ref: '../../addButton',
|
||||
scope: this
|
||||
}, {
|
||||
xtype: 'spacer',
|
||||
height: 20
|
||||
}, {
|
||||
xtype: 'button',
|
||||
text: _('Remove') + '...',
|
||||
disabled: true,
|
||||
ref: '../../removeButton',
|
||||
handler: this.onCalSyncRemove,
|
||||
scope: this
|
||||
}]
|
||||
}]
|
||||
}];
|
||||
},
|
||||
|
||||
/**
|
||||
* initialize events for the panel.
|
||||
* @private
|
||||
*/
|
||||
initEvents: function () {
|
||||
Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel.superclass.initEvents.call(this);
|
||||
|
||||
// register event to enable/disable buttons
|
||||
this.mon(this.calsyncGrid.getSelectionModel(), 'selectionchange', this.onGridSelectionChange, this);
|
||||
},
|
||||
|
||||
/**
|
||||
* Handler function will be called when user clicks on 'Add' button.
|
||||
* @private
|
||||
*/
|
||||
onCalSyncAdd: function () {
|
||||
Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType['plugins.calendarimporter.settings.dialogs.calsyncedit'], undefined, {
|
||||
store: this.store,
|
||||
item: undefined,
|
||||
manager: Ext.WindowMgr
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
onGridSelectionChange: function (selectionModel) {
|
||||
var noSelection = (selectionModel.hasSelection() === false);
|
||||
|
||||
this.removeButton.setDisabled(noSelection);
|
||||
},
|
||||
|
||||
/**
|
||||
* Handler function will be called when user clicks on 'Remove' button.
|
||||
* @private
|
||||
*/
|
||||
onCalSyncRemove: function () {
|
||||
this.calsyncGrid.removeIcsSyncAs();
|
||||
},
|
||||
|
||||
/**
|
||||
* Function will be used to reload data in the store.
|
||||
*/
|
||||
discardChanges: function () {
|
||||
this.store.load();
|
||||
},
|
||||
|
||||
/**
|
||||
* Function will be used to save changes in the store.
|
||||
*/
|
||||
saveChanges: function () {
|
||||
this.store.save();
|
||||
}
|
||||
});
|
||||
|
||||
Ext.reg('calendarimporter.calsyncpanel', Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel);
|
||||
/**
|
||||
* CalSyncPanel.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
Ext.namespace('Zarafa.plugins.calendarimporter.settings.ui');
|
||||
|
||||
/**
|
||||
* @class Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel
|
||||
* @extends Ext.Panel
|
||||
* @xtype calendarimporter.calsyncpanel
|
||||
* Will generate UI for the {@link Zarafa.common.settings.SettingsSendAsWidget SettingsSendAsWidget}.
|
||||
*/
|
||||
Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel = Ext.extend(Ext.Panel, {
|
||||
|
||||
// store
|
||||
store: undefined,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param config Configuration structure
|
||||
*/
|
||||
constructor: function (config) {
|
||||
config = config || {};
|
||||
if (config.store)
|
||||
this.store = config.store;
|
||||
|
||||
Ext.applyIf(config, {
|
||||
// Override from Ext.Component
|
||||
xtype: 'calendarimporter.calsyncpanel',
|
||||
border: false,
|
||||
layout: {
|
||||
type: 'vbox',
|
||||
align: 'stretch',
|
||||
pack: 'start'
|
||||
},
|
||||
items: this.createPanelItems(this.store)
|
||||
});
|
||||
|
||||
Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel.superclass.constructor.call(this, config);
|
||||
},
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
createPanelItems: function (store) {
|
||||
return [{
|
||||
xtype: 'displayfield',
|
||||
value: dgettext('plugin_calendarimporter', 'Setup calendars you want to subscribe to.'),
|
||||
fieldClass: 'x-form-display-field'
|
||||
}, {
|
||||
xtype: 'container',
|
||||
flex: 1,
|
||||
layout: {
|
||||
type: 'hbox',
|
||||
align: 'stretch',
|
||||
pack: 'start'
|
||||
},
|
||||
items: [{
|
||||
xtype: 'calendarimporter.calsyncgrid',
|
||||
ref: '../calsyncGrid',
|
||||
store: store,
|
||||
flex: 1
|
||||
}, {
|
||||
xtype: 'container',
|
||||
width: 160,
|
||||
defaults: {
|
||||
width: 140
|
||||
},
|
||||
layout: {
|
||||
type: 'vbox',
|
||||
align: 'center',
|
||||
pack: 'start'
|
||||
},
|
||||
items: [{
|
||||
xtype: 'button',
|
||||
text: _('Add') + '...',
|
||||
handler: this.onCalSyncAdd,
|
||||
ref: '../../addButton',
|
||||
scope: this
|
||||
}, {
|
||||
xtype: 'spacer',
|
||||
height: 20
|
||||
}, {
|
||||
xtype: 'button',
|
||||
text: _('Remove') + '...',
|
||||
disabled: true,
|
||||
ref: '../../removeButton',
|
||||
handler: this.onCalSyncRemove,
|
||||
scope: this
|
||||
}]
|
||||
}]
|
||||
}];
|
||||
},
|
||||
|
||||
/**
|
||||
* initialize events for the panel.
|
||||
* @private
|
||||
*/
|
||||
initEvents: function () {
|
||||
Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel.superclass.initEvents.call(this);
|
||||
|
||||
// register event to enable/disable buttons
|
||||
this.mon(this.calsyncGrid.getSelectionModel(), 'selectionchange', this.onGridSelectionChange, this);
|
||||
},
|
||||
|
||||
/**
|
||||
* Handler function will be called when user clicks on 'Add' button.
|
||||
* @private
|
||||
*/
|
||||
onCalSyncAdd: function () {
|
||||
Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType['plugins.calendarimporter.settings.dialogs.calsyncedit'], undefined, {
|
||||
store: this.store,
|
||||
item: undefined,
|
||||
manager: Ext.WindowMgr
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
onGridSelectionChange: function (selectionModel) {
|
||||
var noSelection = (selectionModel.hasSelection() === false);
|
||||
|
||||
this.removeButton.setDisabled(noSelection);
|
||||
},
|
||||
|
||||
/**
|
||||
* Handler function will be called when user clicks on 'Remove' button.
|
||||
* @private
|
||||
*/
|
||||
onCalSyncRemove: function () {
|
||||
this.calsyncGrid.removeIcsSyncAs();
|
||||
},
|
||||
|
||||
/**
|
||||
* Function will be used to reload data in the store.
|
||||
*/
|
||||
discardChanges: function () {
|
||||
this.store.load();
|
||||
},
|
||||
|
||||
/**
|
||||
* Function will be used to save changes in the store.
|
||||
*/
|
||||
saveChanges: function () {
|
||||
this.store.save();
|
||||
}
|
||||
});
|
||||
|
||||
Ext.reg('calendarimporter.calsyncpanel', Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel);
|
||||
|
Reference in New Issue
Block a user