mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-09-15 01:24:23 +08: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 = ""
|
||||
strict_html_parser = Off
|
||||
boundary_prefix = ""
|
||||
kolab_enabled = Off
|
||||
dev_email = ""
|
||||
dev_password = ""
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ export const Capa = {
|
|||
Sieve: 'SIEVE',
|
||||
AttachmentThumbnails: 'ATTACHMENT_THUMBNAILS',
|
||||
AutoLogout: 'AUTOLOGOUT',
|
||||
Kolab: 'KOLAB',
|
||||
AdditionalAccounts: 'ADDITIONAL_ACCOUNTS',
|
||||
Identities: 'IDENTITIES'
|
||||
};
|
||||
|
|
|
@ -215,6 +215,10 @@ export class FolderModel extends AbstractModel {
|
|||
collapsedPrivate: true
|
||||
});
|
||||
|
||||
this.addSubscribables({
|
||||
kolabType: sValue => this.metadata[FolderMetadataKeys.KolabFolderType] = sValue
|
||||
});
|
||||
|
||||
this.subFolders = ko.observableArray(new FolderCollectionModel);
|
||||
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 {string} sFolderFullNameRaw
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { Notification } from 'Common/Enums';
|
||||
import { ClientSideKeyName } from 'Common/EnumsUser';
|
||||
import { ClientSideKeyName, FolderMetadataKeys } from 'Common/EnumsUser';
|
||||
import { Settings } from 'Common/Globals';
|
||||
import { getNotification } from 'Common/Translator';
|
||||
|
||||
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';
|
||||
|
||||
|
@ -21,6 +24,23 @@ import { FolderSystemPopupView } from 'View/Popup/FolderSystem';
|
|||
|
||||
export class FoldersUserSettings /*extends AbstractViewSettings*/ {
|
||||
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.folderList = FolderUserStore.folderList;
|
||||
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) {
|
||||
let subscribe = !folder.subscribed();
|
||||
Local.set(ClientSideKeyName.FoldersLashHash, '');
|
||||
|
|
|
@ -13,10 +13,6 @@
|
|||
width: 1em;
|
||||
}
|
||||
|
||||
table:not(.displaySpecSetting) td:last-child {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.folder-name {
|
||||
word-break: break-all;
|
||||
white-space: pre-wrap;
|
||||
|
@ -31,6 +27,10 @@
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
select {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
tr {
|
||||
|
||||
&:not(.selectable) {
|
||||
|
|
|
@ -1964,6 +1964,10 @@ class Actions
|
|||
$aResult[] = Enumerations\Capa::PREFETCH;
|
||||
}
|
||||
|
||||
if ($oConfig->Get('labs', 'kolab_enabled', false)) {
|
||||
$aResult[] = Enumerations\Capa::KOLAB;
|
||||
}
|
||||
|
||||
$aResult[] = Enumerations\Capa::AUTOLOGOUT;
|
||||
|
||||
return $aResult;
|
||||
|
|
|
@ -153,7 +153,7 @@ trait Folders
|
|||
|
||||
public function DoFolderCreate() : array
|
||||
{
|
||||
$oAccount = $this->initMailClientConnection();
|
||||
$this->initMailClientConnection();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -171,9 +171,22 @@ trait Folders
|
|||
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
|
||||
{
|
||||
$oAccount = $this->initMailClientConnection();
|
||||
$this->initMailClientConnection();
|
||||
|
||||
$sFolderFullNameRaw = $this->GetActionParam('Folder', '');
|
||||
$bSubscribe = '1' === (string) $this->GetActionParam('Subscribe', '0');
|
||||
|
@ -244,7 +257,7 @@ trait Folders
|
|||
*/
|
||||
public function DoFolderMove() : array
|
||||
{
|
||||
$oAccount = $this->initMailClientConnection();
|
||||
$this->initMailClientConnection();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -267,7 +280,7 @@ trait Folders
|
|||
*/
|
||||
public function DoFolderRename() : array
|
||||
{
|
||||
$oAccount = $this->initMailClientConnection();
|
||||
$this->initMailClientConnection();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -290,7 +303,7 @@ trait Folders
|
|||
*/
|
||||
public function DoFolderDelete() : array
|
||||
{
|
||||
$oAccount = $this->initMailClientConnection();
|
||||
$this->initMailClientConnection();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -373,6 +373,7 @@ Enables caching in the system'),
|
|||
'startup_url' => array(''),
|
||||
'strict_html_parser' => array(false),
|
||||
'boundary_prefix' => array(''),
|
||||
'kolab_enabled' => array(false),
|
||||
'dev_email' => array(''),
|
||||
'dev_password' => array('')
|
||||
),
|
||||
|
|
|
@ -21,4 +21,5 @@ class Capa
|
|||
const ATTACHMENTS_ACTIONS = 'ATTACHMENTS_ACTIONS';
|
||||
const DANGEROUS_ACTIONS = 'DANGEROUS_ACTIONS';
|
||||
const AUTOLOGOUT = 'AUTOLOGOUT';
|
||||
const KOLAB = 'KOLAB';
|
||||
}
|
||||
|
|
|
@ -438,7 +438,14 @@
|
|||
"HELP_DELETE_FOLDER": "Delete folder",
|
||||
"HELP_SHOW_HIDE_FOLDER": "Show\/hide folder",
|
||||
"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": {
|
||||
"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); }" />
|
||||
|
||||
<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>
|
||||
</td>
|
||||
<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 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>
|
||||
<!-- ko if: $root.displaySpecSetting -->
|
||||
<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); }">
|
||||
<i class="icon-check-mark-circle-two"></i>
|
||||
</span>
|
||||
</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>
|
||||
<!-- ko template: { name: 'SettingsFolderItem', foreach: subFolders } --><!-- /ko -->
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<button type="button" class="close" data-bind="click: function () { folderListError(''); }">×</button>
|
||||
<span data-bind="text: folderListError"></span>
|
||||
</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>
|
||||
</table>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue