mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Get Kolab integration working
This commit is contained in:
parent
11823c280d
commit
0c237376e5
13 changed files with 95 additions and 15 deletions
|
|
@ -288,6 +288,7 @@ replace_env_in_configuration = ""
|
||||||
startup_url = ""
|
startup_url = ""
|
||||||
strict_html_parser = Off
|
strict_html_parser = Off
|
||||||
boundary_prefix = ""
|
boundary_prefix = ""
|
||||||
|
kolab_enabled = Off
|
||||||
dev_email = ""
|
dev_email = ""
|
||||||
dev_password = ""
|
dev_password = ""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ export const Capa = {
|
||||||
Sieve: 'SIEVE',
|
Sieve: 'SIEVE',
|
||||||
AttachmentThumbnails: 'ATTACHMENT_THUMBNAILS',
|
AttachmentThumbnails: 'ATTACHMENT_THUMBNAILS',
|
||||||
AutoLogout: 'AUTOLOGOUT',
|
AutoLogout: 'AUTOLOGOUT',
|
||||||
|
Kolab: 'KOLAB',
|
||||||
AdditionalAccounts: 'ADDITIONAL_ACCOUNTS',
|
AdditionalAccounts: 'ADDITIONAL_ACCOUNTS',
|
||||||
Identities: 'IDENTITIES'
|
Identities: 'IDENTITIES'
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -215,6 +215,10 @@ export class FolderModel extends AbstractModel {
|
||||||
collapsedPrivate: true
|
collapsedPrivate: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.addSubscribables({
|
||||||
|
kolabType: sValue => this.metadata[FolderMetadataKeys.KolabFolderType] = sValue
|
||||||
|
});
|
||||||
|
|
||||||
this.subFolders = ko.observableArray(new FolderCollectionModel);
|
this.subFolders = ko.observableArray(new FolderCollectionModel);
|
||||||
this.actionBlink = ko.observable(false).extend({ falseTimeout: 1000 });
|
this.actionBlink = ko.observable(false).extend({ falseTimeout: 1000 });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -494,6 +494,19 @@ class RemoteUserFetch extends AbstractFetchRemote {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {?Function} fCallback
|
||||||
|
* @param {string} sFolderFullNameRaw
|
||||||
|
* @param {boolean} bSubscribe
|
||||||
|
*/
|
||||||
|
folderSetMetadata(fCallback, sFolderFullNameRaw, sKey, sValue) {
|
||||||
|
this.defaultRequest(fCallback, 'FolderSetMetadata', {
|
||||||
|
Folder: sFolderFullNameRaw,
|
||||||
|
Key: sKey,
|
||||||
|
Value: sValue
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {?Function} fCallback
|
* @param {?Function} fCallback
|
||||||
* @param {string} sFolderFullNameRaw
|
* @param {string} sFolderFullNameRaw
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,14 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { Notification } from 'Common/Enums';
|
import { Notification } from 'Common/Enums';
|
||||||
import { ClientSideKeyName } from 'Common/EnumsUser';
|
import { ClientSideKeyName, FolderMetadataKeys } from 'Common/EnumsUser';
|
||||||
import { Settings } from 'Common/Globals';
|
import { Settings } from 'Common/Globals';
|
||||||
import { getNotification } from 'Common/Translator';
|
import { getNotification } from 'Common/Translator';
|
||||||
|
|
||||||
import { removeFolderFromCacheList } from 'Common/Cache';
|
import { removeFolderFromCacheList } from 'Common/Cache';
|
||||||
|
import { Capa } from 'Common/Enums';
|
||||||
|
import { defaultOptionsAfterRender } from 'Common/Utils';
|
||||||
|
import { initOnStartOrLangChange, i18n } from 'Common/Translator';
|
||||||
|
|
||||||
import * as Local from 'Storage/Client';
|
import * as Local from 'Storage/Client';
|
||||||
|
|
||||||
|
|
@ -21,6 +24,23 @@ import { FolderSystemPopupView } from 'View/Popup/FolderSystem';
|
||||||
|
|
||||||
export class FoldersUserSettings /*extends AbstractViewSettings*/ {
|
export class FoldersUserSettings /*extends AbstractViewSettings*/ {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
this.showKolab = Settings.capa(Capa.Kolab);
|
||||||
|
this.defaultOptionsAfterRender = defaultOptionsAfterRender;
|
||||||
|
this.kolabTypeOptions = ko.observableArray()
|
||||||
|
let i18nFilter = key => i18n('SETTINGS_FOLDERS/TYPE_' + key);
|
||||||
|
initOnStartOrLangChange(()=>{
|
||||||
|
this.kolabTypeOptions([
|
||||||
|
{ id: '', name: '' },
|
||||||
|
{ id: 'event', name: i18nFilter('CALENDAR') },
|
||||||
|
{ id: 'contact', name: i18nFilter('CONTACTS') },
|
||||||
|
{ id: 'task', name: i18nFilter('TASKS') },
|
||||||
|
{ id: 'note', name: i18nFilter('NOTES') },
|
||||||
|
{ id: 'file', name: i18nFilter('FILES') },
|
||||||
|
{ id: 'journal', name: i18nFilter('JOURNAL') },
|
||||||
|
{ id: 'configuration', name: i18nFilter('CONFIGURATION') }
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
this.displaySpecSetting = FolderUserStore.displaySpecSetting;
|
this.displaySpecSetting = FolderUserStore.displaySpecSetting;
|
||||||
this.folderList = FolderUserStore.folderList;
|
this.folderList = FolderUserStore.folderList;
|
||||||
this.folderListOptimized = FolderUserStore.folderListOptimized;
|
this.folderListOptimized = FolderUserStore.folderListOptimized;
|
||||||
|
|
@ -117,6 +137,12 @@ export class FoldersUserSettings /*extends AbstractViewSettings*/ {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toggleFolderKolabType(folder, event) {
|
||||||
|
let type = event.target.value;
|
||||||
|
Remote.folderSetMetadata(()=>0, folder.fullNameRaw, FolderMetadataKeys.KolabFolderType, type);
|
||||||
|
folder.kolabType(type);
|
||||||
|
}
|
||||||
|
|
||||||
toggleFolderSubscription(folder) {
|
toggleFolderSubscription(folder) {
|
||||||
let subscribe = !folder.subscribed();
|
let subscribe = !folder.subscribed();
|
||||||
Local.set(ClientSideKeyName.FoldersLashHash, '');
|
Local.set(ClientSideKeyName.FoldersLashHash, '');
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,6 @@
|
||||||
width: 1em;
|
width: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
table:not(.displaySpecSetting) td:last-child {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.folder-name {
|
.folder-name {
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
|
|
@ -31,6 +27,10 @@
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
tr {
|
tr {
|
||||||
|
|
||||||
&:not(.selectable) {
|
&:not(.selectable) {
|
||||||
|
|
|
||||||
|
|
@ -1964,6 +1964,10 @@ class Actions
|
||||||
$aResult[] = Enumerations\Capa::PREFETCH;
|
$aResult[] = Enumerations\Capa::PREFETCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($oConfig->Get('labs', 'kolab_enabled', false)) {
|
||||||
|
$aResult[] = Enumerations\Capa::KOLAB;
|
||||||
|
}
|
||||||
|
|
||||||
$aResult[] = Enumerations\Capa::AUTOLOGOUT;
|
$aResult[] = Enumerations\Capa::AUTOLOGOUT;
|
||||||
|
|
||||||
return $aResult;
|
return $aResult;
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ trait Folders
|
||||||
|
|
||||||
public function DoFolderCreate() : array
|
public function DoFolderCreate() : array
|
||||||
{
|
{
|
||||||
$oAccount = $this->initMailClientConnection();
|
$this->initMailClientConnection();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -171,9 +171,22 @@ trait Folders
|
||||||
return $this->TrueResponse(__FUNCTION__);
|
return $this->TrueResponse(__FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function DoFolderSetMetadata() : array
|
||||||
|
{
|
||||||
|
$this->initMailClientConnection();
|
||||||
|
$sFolderFullNameRaw = $this->GetActionParam('Folder');
|
||||||
|
$sMetadataKey = $this->GetActionParam('Key');
|
||||||
|
if ($sFolderFullNameRaw && $sMetadataKey) {
|
||||||
|
$this->MailClient()->FolderSetMetadata($sFolderFullNameRaw, [
|
||||||
|
$sMetadataKey => $this->GetActionParam('Value') ?: null
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return $this->TrueResponse(__FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
public function DoFolderSubscribe() : array
|
public function DoFolderSubscribe() : array
|
||||||
{
|
{
|
||||||
$oAccount = $this->initMailClientConnection();
|
$this->initMailClientConnection();
|
||||||
|
|
||||||
$sFolderFullNameRaw = $this->GetActionParam('Folder', '');
|
$sFolderFullNameRaw = $this->GetActionParam('Folder', '');
|
||||||
$bSubscribe = '1' === (string) $this->GetActionParam('Subscribe', '0');
|
$bSubscribe = '1' === (string) $this->GetActionParam('Subscribe', '0');
|
||||||
|
|
@ -244,7 +257,7 @@ trait Folders
|
||||||
*/
|
*/
|
||||||
public function DoFolderMove() : array
|
public function DoFolderMove() : array
|
||||||
{
|
{
|
||||||
$oAccount = $this->initMailClientConnection();
|
$this->initMailClientConnection();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -267,7 +280,7 @@ trait Folders
|
||||||
*/
|
*/
|
||||||
public function DoFolderRename() : array
|
public function DoFolderRename() : array
|
||||||
{
|
{
|
||||||
$oAccount = $this->initMailClientConnection();
|
$this->initMailClientConnection();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -290,7 +303,7 @@ trait Folders
|
||||||
*/
|
*/
|
||||||
public function DoFolderDelete() : array
|
public function DoFolderDelete() : array
|
||||||
{
|
{
|
||||||
$oAccount = $this->initMailClientConnection();
|
$this->initMailClientConnection();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -373,6 +373,7 @@ Enables caching in the system'),
|
||||||
'startup_url' => array(''),
|
'startup_url' => array(''),
|
||||||
'strict_html_parser' => array(false),
|
'strict_html_parser' => array(false),
|
||||||
'boundary_prefix' => array(''),
|
'boundary_prefix' => array(''),
|
||||||
|
'kolab_enabled' => array(false),
|
||||||
'dev_email' => array(''),
|
'dev_email' => array(''),
|
||||||
'dev_password' => array('')
|
'dev_password' => array('')
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -21,4 +21,5 @@ class Capa
|
||||||
const ATTACHMENTS_ACTIONS = 'ATTACHMENTS_ACTIONS';
|
const ATTACHMENTS_ACTIONS = 'ATTACHMENTS_ACTIONS';
|
||||||
const DANGEROUS_ACTIONS = 'DANGEROUS_ACTIONS';
|
const DANGEROUS_ACTIONS = 'DANGEROUS_ACTIONS';
|
||||||
const AUTOLOGOUT = 'AUTOLOGOUT';
|
const AUTOLOGOUT = 'AUTOLOGOUT';
|
||||||
|
const KOLAB = 'KOLAB';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -438,7 +438,14 @@
|
||||||
"HELP_DELETE_FOLDER": "Delete folder",
|
"HELP_DELETE_FOLDER": "Delete folder",
|
||||||
"HELP_SHOW_HIDE_FOLDER": "Show\/hide folder",
|
"HELP_SHOW_HIDE_FOLDER": "Show\/hide folder",
|
||||||
"HELP_CHECK_FOR_NEW_MESSAGES": "Check\/don't check for new messages",
|
"HELP_CHECK_FOR_NEW_MESSAGES": "Check\/don't check for new messages",
|
||||||
"HIDE_UNSUBSCRIBED": "Hide unsubscribed folders"
|
"HIDE_UNSUBSCRIBED": "Hide unsubscribed folders",
|
||||||
|
"TYPE_CALENDAR": "Calendar",
|
||||||
|
"TYPE_CONFIGURATION": "Configuration",
|
||||||
|
"TYPE_CONTACTS": "Contacts",
|
||||||
|
"TYPE_FILES": "Files",
|
||||||
|
"TYPE_JOURNAL": "Journal",
|
||||||
|
"TYPE_NOTES": "Notes",
|
||||||
|
"TYPE_TASKS": "Tasks"
|
||||||
},
|
},
|
||||||
"SETTINGS_ACCOUNTS": {
|
"SETTINGS_ACCOUNTS": {
|
||||||
"LEGEND_ACCOUNTS": "Accounts",
|
"LEGEND_ACCOUNTS": "Accounts",
|
||||||
|
|
|
||||||
|
|
@ -6,19 +6,28 @@
|
||||||
data-bind="value: nameForEdit, visible: edited, hasfocus: edited, onEnter: function () { $root.folderEditOnEnter($data); }, onEsc: function () { $root.folderEditOnEsc($data); }" />
|
data-bind="value: nameForEdit, visible: edited, hasfocus: edited, onEnter: function () { $root.folderEditOnEnter($data); }, onEsc: function () { $root.folderEditOnEsc($data); }" />
|
||||||
|
|
||||||
<span class="folder-system-name" data-bind="text: manageFolderSystemName, visible: isSystemFolder"></span>
|
<span class="folder-system-name" data-bind="text: manageFolderSystemName, visible: isSystemFolder"></span>
|
||||||
<a class="btn btn-small btn-small-small btn-danger pull-right button-confirm-delete button-delete-transitions" data-bind="css: {'delete-access': deleteAccess()}, click: function() { $root.deleteFolder($data); }"
|
<a class="btn btn-small btn-small-small btn-danger pull-right button-confirm-delete button-delete-transitions" data-bind="css: {'delete-access': deleteAccess()}, click: $root.deleteFolder"
|
||||||
data-i18n="GLOBAL/ARE_YOU_SURE"></a>
|
data-i18n="GLOBAL/ARE_YOU_SURE"></a>
|
||||||
</td>
|
</td>
|
||||||
<td data-i18n="[title]SETTINGS_FOLDERS/HELP_DELETE_FOLDER">
|
<td data-i18n="[title]SETTINGS_FOLDERS/HELP_DELETE_FOLDER">
|
||||||
<span class="delete-folder e-action fontastic" data-bind="visible: canBeDeleted() && !deleteAccess(), click: function (oFolder) { $root.folderForDeletion(oFolder); }">🗑</span>
|
<span class="delete-folder e-action fontastic" data-bind="visible: canBeDeleted() && !deleteAccess(), click: $root.folderForDeletion">🗑</span>
|
||||||
</td>
|
</td>
|
||||||
<td data-i18n="[title]SETTINGS_FOLDERS/HELP_SHOW_HIDE_FOLDER">
|
<td data-i18n="[title]SETTINGS_FOLDERS/HELP_SHOW_HIDE_FOLDER">
|
||||||
<span class="e-action fontastic" data-bind="css: {'unsubscribed-folder':!subscribed()}, visible: canBeSubscribed(), click: function(oFolder) { $root.toggleFolderSubscription(oFolder); }">👁</span>
|
<span class="e-action fontastic" data-bind="css: {'unsubscribed-folder':!subscribed()}, visible: canBeSubscribed(), click: $root.toggleFolderSubscription">👁</span>
|
||||||
</td>
|
</td>
|
||||||
|
<!-- ko if: $root.displaySpecSetting -->
|
||||||
<td data-i18n="[title]SETTINGS_FOLDERS/HELP_CHECK_FOR_NEW_MESSAGES">
|
<td data-i18n="[title]SETTINGS_FOLDERS/HELP_CHECK_FOR_NEW_MESSAGES">
|
||||||
<span class="e-action" data-bind="css: {'check-folder':checkable(), 'unchecked-folder':!checkable()}, visible: canBeSelected() && subscribed(), click: function(oFolder) { $root.toggleFolderCheckable(oFolder); }">
|
<span class="e-action" data-bind="css: {'check-folder':checkable(), 'unchecked-folder':!checkable()}, visible: canBeSelected() && subscribed(), click: function(oFolder) { $root.toggleFolderCheckable(oFolder); }">
|
||||||
<i class="icon-check-mark-circle-two"></i>
|
<i class="icon-check-mark-circle-two"></i>
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
|
<!-- /ko -->
|
||||||
|
<!-- ko if: $root.showKolab -->
|
||||||
|
<td class="kolab" title="Kolab">
|
||||||
|
<select data-bind="options: $root.kolabTypeOptions, value: kolabType,
|
||||||
|
optionsText: 'name', optionsValue: 'id', optionsAfterRender: $root.defaultOptionsAfterRender,
|
||||||
|
event:{ input: $root.toggleFolderKolabType}"></select>
|
||||||
|
</td>
|
||||||
|
<!-- /ko -->
|
||||||
</tr>
|
</tr>
|
||||||
<!-- ko template: { name: 'SettingsFolderItem', foreach: subFolders } --><!-- /ko -->
|
<!-- ko template: { name: 'SettingsFolderItem', foreach: subFolders } --><!-- /ko -->
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
<button type="button" class="close" data-bind="click: function () { folderListError(''); }">×</button>
|
<button type="button" class="close" data-bind="click: function () { folderListError(''); }">×</button>
|
||||||
<span data-bind="text: folderListError"></span>
|
<span data-bind="text: folderListError"></span>
|
||||||
</div>
|
</div>
|
||||||
<table class="table table-hover list-table" data-bind="i18nUpdate: folderList, css:{'displaySpecSetting': displaySpecSetting}">
|
<table class="table table-hover list-table" data-bind="i18nUpdate: folderList">
|
||||||
<tbody data-bind="template: { name: 'SettingsFolderItem', foreach: folderList }"></tbody>
|
<tbody data-bind="template: { name: 'SettingsFolderItem', foreach: folderList }"></tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue