Settings widget for sync is functional now

This commit is contained in:
Christoph Haas 2016-11-01 00:34:32 +01:00
parent 6f3561722c
commit 6b9e371b70
6 changed files with 200 additions and 85 deletions

View File

@ -2,11 +2,11 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="e7c9c2bb-66f1-4e37-904c-d33d8c113bde" name="Default" comment="">
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/js/data/CalendarHelper.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/data/Actions.js" afterPath="$PROJECT_DIR$/js/data/Actions.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/dialogs/ImportPanel.js" afterPath="$PROJECT_DIR$/js/dialogs/ImportPanel.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/settings/SettingsCalSyncWidget.js" afterPath="$PROJECT_DIR$/js/settings/SettingsCalSyncWidget.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/settings/SettingsWidget.js" afterPath="$PROJECT_DIR$/js/settings/SettingsWidget.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/settings/dialogs/CalSyncEditContentPanel.js" afterPath="$PROJECT_DIR$/js/settings/dialogs/CalSyncEditContentPanel.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/settings/dialogs/CalSyncEditPanel.js" afterPath="$PROJECT_DIR$/js/settings/dialogs/CalSyncEditPanel.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/settings/ui/CalSyncGrid.js" afterPath="$PROJECT_DIR$/js/settings/ui/CalSyncGrid.js" />
</list>
<ignored path="calendarimporter.iws" />
<ignored path=".idea/workspace.xml" />
@ -27,24 +27,62 @@
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="SettingsWidget.js" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/js/settings/SettingsWidget.js">
<file leaf-file-name="CalSyncEditPanel.js" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/js/settings/dialogs/CalSyncEditPanel.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="700">
<caret line="113" column="34" selection-start-line="113" selection-start-column="34" selection-end-line="113" selection-end-column="34" />
<state relative-caret-position="1480">
<caret line="101" column="30" selection-start-line="101" selection-start-column="30" selection-end-line="101" selection-end-column="30" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="ImportPanel.js" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/js/dialogs/ImportPanel.js">
<file leaf-file-name="CalSyncGrid.js" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/js/settings/ui/CalSyncGrid.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="332">
<caret line="245" column="12" selection-start-line="245" selection-start-column="12" selection-end-line="245" selection-end-column="226" />
<folding>
<element signature="n#!!doc" expanded="true" />
</folding>
<state relative-caret-position="504">
<caret line="85" column="59" selection-start-line="85" selection-start-column="59" selection-end-line="85" selection-end-column="59" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="plugin.calendarimporter.js" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/js/plugin.calendarimporter.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-51">
<caret line="262" column="12" selection-start-line="262" selection-start-column="12" selection-end-line="262" selection-end-column="12" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="SettingsCalSyncWidget.js" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/js/settings/SettingsCalSyncWidget.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="729">
<caret line="104" column="16" selection-start-line="104" selection-start-column="16" selection-end-line="104" selection-end-column="142" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="sync.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/backend/sync.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="510">
<caret line="131" column="50" selection-start-line="131" selection-start-column="30" selection-end-line="131" selection-end-column="50" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="CalSyncEditContentPanel.js" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/js/settings/dialogs/CalSyncEditContentPanel.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="63" selection-start-line="0" selection-start-column="63" selection-end-line="0" selection-end-column="63" />
<folding />
</state>
</provider>
</entry>
@ -52,8 +90,8 @@
<file leaf-file-name="Actions.js" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/js/data/Actions.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-6">
<caret line="107" column="8" selection-start-line="107" selection-start-column="8" selection-end-line="107" selection-end-column="8" />
<state relative-caret-position="144">
<caret line="133" column="67" selection-start-line="133" selection-start-column="22" selection-end-line="133" selection-end-column="67" />
<folding>
<element signature="n#!!doc" expanded="true" />
</folding>
@ -83,7 +121,11 @@
<option value="$PROJECT_DIR$/js/data/CalendarHelper.js" />
<option value="$PROJECT_DIR$/js/data/Actions.js" />
<option value="$PROJECT_DIR$/js/dialogs/ImportPanel.js" />
<option value="$PROJECT_DIR$/js/settings/dialogs/CalSyncEditContentPanel.js" />
<option value="$PROJECT_DIR$/js/settings/SettingsWidget.js" />
<option value="$PROJECT_DIR$/js/settings/SettingsCalSyncWidget.js" />
<option value="$PROJECT_DIR$/js/settings/ui/CalSyncGrid.js" />
<option value="$PROJECT_DIR$/js/settings/dialogs/CalSyncEditPanel.js" />
</list>
</option>
</component>
@ -158,6 +200,24 @@
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="calendarimporter" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="calendarimporter" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="js" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="ui" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="calendarimporter" />
@ -198,6 +258,28 @@
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="calendarimporter" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="calendarimporter" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="js" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="settings" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="dialogs" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="calendarimporter" />
@ -234,6 +316,20 @@
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="calendarimporter" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="calendarimporter" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="backend" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
<pane id="Scope" />
@ -296,12 +392,12 @@
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1477949602474</updated>
<workItem from="1477949603566" duration="4096000" />
<workItem from="1477949603566" duration="7047000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="4096000" />
<option name="totallyTimeSpent" value="7047000" />
</component>
<component name="ToolWindowManager">
<frame x="65" y="24" width="1792" height="999" extended-state="6" />
@ -381,19 +477,11 @@
<state relative-caret-position="-456">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="n#!!doc" expanded="true" />
<element signature="n#!!doc" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/js/plugin.calendarimporter.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="287">
<caret line="107" column="19" selection-start-line="107" selection-start-column="17" selection-end-line="107" selection-end-column="19" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/php/module.calendar.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1057">
@ -428,20 +516,12 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/js/settings/SettingsCalSyncWidget.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/js/dialogs/ImportContentPanel.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-171">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="n#!!doc" expanded="true" />
<element signature="n#!!doc" expanded="false" />
</folding>
</state>
</provider>
@ -466,8 +546,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/js/data/Actions.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-6">
<caret line="107" column="8" selection-start-line="107" selection-start-column="8" selection-end-line="107" selection-end-column="8" />
<state relative-caret-position="144">
<caret line="133" column="67" selection-start-line="133" selection-start-column="22" selection-end-line="133" selection-end-column="67" />
<folding>
<element signature="n#!!doc" expanded="true" />
</folding>
@ -476,8 +556,56 @@
</entry>
<entry file="file://$PROJECT_DIR$/js/settings/SettingsWidget.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="700">
<caret line="113" column="34" selection-start-line="113" selection-start-column="34" selection-end-line="113" selection-end-column="34" />
<state relative-caret-position="340">
<caret line="83" column="82" selection-start-line="83" selection-start-column="82" selection-end-line="83" selection-end-column="82" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/backend/sync.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="510">
<caret line="131" column="50" selection-start-line="131" selection-start-column="30" selection-end-line="131" selection-end-column="50" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/js/plugin.calendarimporter.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-51">
<caret line="262" column="12" selection-start-line="262" selection-start-column="12" selection-end-line="262" selection-end-column="12" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/js/settings/ui/CalSyncGrid.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="504">
<caret line="85" column="59" selection-start-line="85" selection-start-column="59" selection-end-line="85" selection-end-column="59" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/js/settings/SettingsCalSyncWidget.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="729">
<caret line="104" column="16" selection-start-line="104" selection-start-column="16" selection-end-line="104" selection-end-column="142" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/js/settings/dialogs/CalSyncEditContentPanel.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="63" selection-start-line="0" selection-start-column="63" selection-end-line="0" selection-end-column="63" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/js/settings/dialogs/CalSyncEditPanel.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1480">
<caret line="101" column="30" selection-start-line="101" selection-start-column="30" selection-end-line="101" selection-end-column="30" />
<folding />
</state>
</provider>

View File

@ -27,6 +27,7 @@ Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget = Ext.extend(Zara
{ name : 'pass' },
{ name : 'intervall', type : 'int' },
{ name : 'calendar' },
{ name : 'calendarname' },
{ name : 'lastsync' }
],
sortInfo : {
@ -68,8 +69,10 @@ Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget = Ext.extend(Zara
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();
@ -98,7 +101,8 @@ Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget = Ext.extend(Zara
'user' : icslink.get('user'),
'pass' : icslink.get('pass'),
'lastsync' : icslink.get('lastsync'),
'calendar' : icslink.get('calendar')
'calendar' : icslink.get('calendar'),
'calendarname' : Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(icslink.get('calendar')).display_name
};
}
settingsModel.set('zarafa/v1/contexts/calendar/icssync', icslinkData);

View File

@ -88,7 +88,7 @@ Zarafa.plugins.calendarimporter.settings.SettingsWidget = Ext.extend(Zarafa.sett
*/
update : function(settingsModel) {
this.enableSync.setValue(settingsModel.get(this.enableSync.name));
this.defaultCalendar.setValue(settingsModel.get(this.defaultCalendar.name));
this.defaultCalendar.setValue(Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByName(settingsModel.get(this.defaultCalendar.name)).entryid);
this.defaultTimezone.setValue(settingsModel.get(this.defaultTimezone.name));
},
@ -104,7 +104,7 @@ Zarafa.plugins.calendarimporter.settings.SettingsWidget = Ext.extend(Zarafa.sett
if(settingsModel.get(this.enableSync.name) != this.enableSync.getValue()) {
changed = true;
} else if(settingsModel.get(this.defaultCalendar.name) != this.defaultCalendar.getValue()) {
} 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;
@ -113,7 +113,7 @@ Zarafa.plugins.calendarimporter.settings.SettingsWidget = Ext.extend(Zarafa.sett
if(changed) {
// Really save changes
settingsModel.set(this.enableSync.name, this.enableSync.getValue());
settingsModel.set(this.defaultCalendar.name, this.defaultCalendar.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();

View File

@ -23,7 +23,7 @@ Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditContentPanel = Ext.e
model : true,
autoSave : false,
width : 400,
height : 350,
height : 400,
title : _('ICAL Sync'),
items : [{
xtype : 'calendarimporter.calsynceditpanel',

View File

@ -60,7 +60,6 @@ Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(E
var id = 0;
var record = undefined;
console.log(this);
if(!this.currentItem) {
record = new store.recordType({
id: this.hashCode(this.icsurl.getValue()),
@ -69,6 +68,7 @@ Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(E
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"
});
}
@ -82,6 +82,7 @@ Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(E
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();
}
@ -95,14 +96,12 @@ Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(E
createPanelItems : function(config)
{
var icsurl = "";
var intervall = "";
var intervall = "15";
var user = "";
var pass = "";
var calendar = "";
var defaultFolder = container.getHierarchyStore().getDefaultFolder('calendar'); // @type: Zarafa.hierarchy.data.MAPIFolderRecord
var subFolders = defaultFolder.getChildren();
var myStore = [];
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');
@ -110,33 +109,7 @@ Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(E
user = config.item.get('user');
pass = Ext.util.base64.decode(config.item.get('pass'));
calendar = config.item.get('calendar');
}
/* add all local calendar folders */
var i = 0;
myStore.push(new Array(defaultFolder.getDefaultFolderKey(), defaultFolder.getDisplayName()));
for(i = 0; i < subFolders.length; i++) {
/* Store all subfolders */
myStore.push(new Array(subFolders[i].getDisplayName(), subFolders[i].getDisplayName(), false)); // 3rd field = isPublicfolder
}
/* add all shared calendar folders */
var pubStore = container.getHierarchyStore().getPublicStore();
if(typeof pubStore !== "undefined") {
try {
var pubFolder = pubStore.getDefaultFolder("publicfolders");
var pubSubFolders = pubFolder.getChildren();
for(i = 0; i < pubSubFolders.length; i++) {
if(pubSubFolders[i].isContainerClass("IPF.Appointment")){
myStore.push(new Array(pubSubFolders[i].getDisplayName(), pubSubFolders[i].getDisplayName() + " [Shared]", true)); // 3rd field = isPublicfolder
}
}
} catch (e) {
console.log("Error opening the shared folder...");
console.log(e);
}
calendarname = config.item.get('calendarname');
}

View File

@ -58,6 +58,16 @@ Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid = Ext.extend(Ext.grid.Gr
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
@ -71,7 +81,7 @@ Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid = Ext.extend(Ext.grid.Gr
renderer : Zarafa.common.ui.grid.Renderers.text
},
{
dataIndex : 'calendar',
dataIndex : 'calendarname',
header : _('Destination Calender'),
renderer : Zarafa.common.ui.grid.Renderers.text
},