Autocreate system folders in folder list request.

Additional plugin hooks
This commit is contained in:
RainLoop Team 2013-12-18 03:00:57 +04:00
parent 972067b6d9
commit 394e22520e
19 changed files with 357 additions and 288 deletions

View file

@ -164,18 +164,17 @@ RainLoopApp.prototype.recacheInboxMessageList = function ()
};
/**
* @param {boolean=} bUseCache = true
* @param {Function=} fCallback
*/
RainLoopApp.prototype.folders = function (bUseCache, fCallback)
RainLoopApp.prototype.folders = function (fCallback)
{
this.data().foldersLoading(true);
this.remote().folders(_.bind(function (sResult, oData, bCached) {
this.remote().folders(_.bind(function (sResult, oData) {
RL.data().foldersLoading(false);
if (Enums.StorageResultType.Success === sResult)
{
this.data().setFolders(oData, bCached);
this.data().setFolders(oData);
if (fCallback)
{
fCallback(true);
@ -188,7 +187,7 @@ RainLoopApp.prototype.folders = function (bUseCache, fCallback)
fCallback(false);
}
}
}, this), bUseCache);
}, this));
};
RainLoopApp.prototype.accountsAndIdentities = function ()
@ -775,7 +774,7 @@ RainLoopApp.prototype.bootstart = function ()
{
this.setTitle(Utils.i18n('TITLES/LOADING'));
this.folders(true, _.bind(function (bValue) {
this.folders(_.bind(function (bValue) {
kn.hideLoading();

View file

@ -45,10 +45,6 @@ function FolderModel()
}
}, this);
this.canBeEdited = ko.computed(function () {
return Enums.FolderType.User === this.type();
}, this);
this.privateMessageCountAll = ko.observable(0);
this.privateMessageCountUnread = ko.observable(0);
@ -77,6 +73,10 @@ FolderModel.prototype.initComputed = function ()
});
}, this);
this.canBeEdited = ko.computed(function () {
return Enums.FolderType.User === this.type() && this.existen && this.selectable;
}, this);
this.visible = ko.computed(function () {
var
bSubScribed = this.subScribed(),

View file

@ -95,7 +95,7 @@ SettingsFolders.prototype.folderEditOnEnter = function (oFolder)
oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_RENAME_FOLDER'));
}
RL.folders(false);
RL.folders();
}, oFolder.fullNameRaw, sEditName);
@ -166,7 +166,7 @@ SettingsFolders.prototype.deleteFolder = function (oFolderToRemove)
oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_DELETE_FOLDER'));
}
RL.folders(false);
RL.folders();
}, oFolderToRemove.fullNameRaw);

View file

@ -15,21 +15,15 @@ _.extend(WebMailAjaxRemoteStorage.prototype, AbstractAjaxRemoteStorage.prototype
/**
* @param {?Function} fCallback
* @param {boolean=} bUseCache = true
*/
WebMailAjaxRemoteStorage.prototype.folders = function (fCallback, bUseCache)
WebMailAjaxRemoteStorage.prototype.folders = function (fCallback)
{
var sFoldersHash = RL.data().lastFoldersHash;
bUseCache = Utils.isUnd(bUseCache) ? false : !!bUseCache;
if (bUseCache && '' !== sFoldersHash)
{
this.defaultRequest(fCallback, 'Folders', {}, null, 'Folders/' + RL.data().projectHash() + '-' + sFoldersHash, ['Folders']);
}
else
{
this.defaultRequest(fCallback, 'Folders', {}, null, '', ['Folders']);
}
this.defaultRequest(fCallback, 'Folders', {
'SentFolder': RL.settingsGet('SentFolder'),
'DraftFolder': RL.settingsGet('DraftFolder'),
'SpamFolder': RL.settingsGet('SpamFolder'),
'TrashFolder': RL.settingsGet('TrashFolder')
}, null, '', ['Folders']);
};
/**

View file

@ -486,10 +486,9 @@ WebMailDataStorage.prototype.initUidNextAndNewMessages = function (sFolder, sUid
/**
* @param {string} sNamespace
* @param {Array} aFolders
* @param {boolean} bCached
* @return {Array}
*/
WebMailDataStorage.prototype.folderResponseParseRec = function (sNamespace, aFolders, bCached)
WebMailDataStorage.prototype.folderResponseParseRec = function (sNamespace, aFolders)
{
var
iIndex = 0,
@ -501,8 +500,6 @@ WebMailDataStorage.prototype.folderResponseParseRec = function (sNamespace, aFol
aList = []
;
bCached = !!bCached;
for (iIndex = 0, iLen = aFolders.length; iIndex < iLen; iIndex++)
{
oFolder = aFolders[iIndex];
@ -536,7 +533,7 @@ WebMailDataStorage.prototype.folderResponseParseRec = function (sNamespace, aFol
{
oCacheFolder.collapsed(!Utils.isFolderExpanded(oCacheFolder.fullNameHash));
if (!bCached && oFolder.Extended)
if (oFolder.Extended)
{
if (oFolder.Extended.Hash)
{
@ -559,7 +556,7 @@ WebMailDataStorage.prototype.folderResponseParseRec = function (sNamespace, aFol
aSubFolders['@Collection'] && Utils.isArray(aSubFolders['@Collection']))
{
oCacheFolder.subFolders(
this.folderResponseParseRec(sNamespace, aSubFolders['@Collection'], bCached));
this.folderResponseParseRec(sNamespace, aSubFolders['@Collection']));
}
aList.push(oCacheFolder);
@ -572,16 +569,13 @@ WebMailDataStorage.prototype.folderResponseParseRec = function (sNamespace, aFol
/**
* @param {*} oData
* @param {boolean=} bCached = false
*/
WebMailDataStorage.prototype.setFolders = function (oData, bCached)
WebMailDataStorage.prototype.setFolders = function (oData)
{
var
aList = [],
bUpdate = false,
oRLData = RL.data(),
aFolders = oRLData.folderList(),
bFoldersFirst = 0 === aFolders.length,
fNormalizeFolder = function (sFolderFullNameRaw) {
return ('' === sFolderFullNameRaw || Consts.Values.UnuseOptionValue === sFolderFullNameRaw ||
null !== RL.cache().getFolderFromCacheList(sFolderFullNameRaw)) ? sFolderFullNameRaw : '';
@ -598,12 +592,12 @@ WebMailDataStorage.prototype.setFolders = function (oData, bCached)
this.threading(!!RL.settingsGet('UseImapThread') && oData.Result.IsThreadsSupported && true);
aList = this.folderResponseParseRec(oRLData.namespace, oData.Result['@Collection'], !!bCached);
aList = this.folderResponseParseRec(oRLData.namespace, oData.Result['@Collection']);
oRLData.folderList(aList);
if (oData.Result['SystemFolders'] &&
'' === '' + RL.settingsGet('SentFolder') + RL.settingsGet('DraftFolder') +
RL.settingsGet('SpamFolder') + RL.settingsGet('TrashFolder'))
RL.settingsGet('SpamFolder') + RL.settingsGet('TrashFolder') + RL.settingsGet('NullFolder'))
{
// TODO Magic Numbers
RL.settingsSet('SentFolder', oData.Result['SystemFolders'][2] || null);
@ -625,19 +619,12 @@ WebMailDataStorage.prototype.setFolders = function (oData, bCached)
'SentFolder': oRLData.sentFolder(),
'DraftFolder': oRLData.draftFolder(),
'SpamFolder': oRLData.spamFolder(),
'TrashFolder': oRLData.trashFolder()
'TrashFolder': oRLData.trashFolder(),
'NullFolder': 'NullFolder'
});
}
if (!bCached)
{
RL.local().set(Enums.ClientSideKeyName.FoldersLashHash, oData.Result.FoldersHash);
}
if (bFoldersFirst && bCached)
{
RL.folders(false);
}
RL.local().set(Enums.ClientSideKeyName.FoldersLashHash, oData.Result.FoldersHash);
}
};

View file

@ -1,104 +1,125 @@
.folderPaddingHelper(@i) {
(~".folder-padding.deep-@{i}") {
width: 15px * @i + 10px;
}
}
.b-settings-folders {
&.ignore-folder-subscribe {
.subscribe-folder, .unsubscribe-folder {
display: none;
}
}
.process-place {
text-align: center;
width: 600px;
padding: 14px 0;
}
.folders-list-error {
width: 550px;
margin: 10px 0px;
}
.list-table {
width: 600px;
.e-action {
cursor: pointer;
}
td {
padding: 4px 8px;
line-height: 30px;
}
.folder-padding {
display: inline-block;
width: 0;
}
.folder-name {
display: inline-block;
word-break: break-all;
.box-sizing(border-box);
margin-left: 7px;
line-height: 22px;
cursor: default;
}
.folder-system-name {
display: inline-block;
line-height: 22px;
color: #999;
cursor: default;
}
.folder-name.can-be-edited:hover {
border-bottom: 1px dashed #333;
cursor: pointer;
}
.folder-name-input {
border-width: 1px;
margin-bottom: 0;
}
}
.folder-item {
.button-delete {
margin-right: 15px;
margin-top: 5px;
visibility: hidden;
.opacity(0);
}
.delete-access {
&.button-delete {
visibility: visible;
margin-right: 0;
.opacity(100);
}
}
.delete-folder, .subscribe-folder, .unsubscribe-folder {
cursor: pointer;
.opacity(60);
}
.unsubscribe-folder {
.opacity(25);
}
}
.folderPaddingHelper(1);
.folderPaddingHelper(2);
.folderPaddingHelper(3);
.folderPaddingHelper(4);
.folderPaddingHelper(5);
/*.folderPaddingHelper(@i) {
(~".folder-padding.deep-@{i}") {
width: 15px * @i + 10px;
}
}*/
.b-settings-folders {
&.ignore-folder-subscribe {
.subscribe-folder, .unsubscribe-folder {
display: none;
}
}
.process-place {
text-align: center;
width: 600px;
padding: 14px 0;
}
.folders-list-error {
width: 550px;
margin: 10px 0px;
}
.list-table {
width: 600px;
.e-action {
cursor: pointer;
}
td {
padding: 4px 8px;
line-height: 30px;
}
.folder-padding {
display: inline-block;
width: 0;
}
.folder-name {
display: inline-block;
word-break: break-all;
.box-sizing(border-box);
margin-left: 7px;
line-height: 22px;
cursor: default;
}
.folder-system-name {
display: inline-block;
line-height: 22px;
color: #999;
cursor: default;
}
.folder-name.can-be-edited:hover {
border-bottom: 1px dashed #333;
cursor: pointer;
}
.folder-name-input {
border-width: 1px;
margin-bottom: 0;
margin-left: -4px;
}
}
.folder-item {
&.system .folder-name {
font-weight: bold;
}
.button-delete {
margin-right: 15px;
margin-top: 5px;
visibility: hidden;
.opacity(0);
}
.delete-access {
&.button-delete {
visibility: visible;
margin-right: 0;
.opacity(100);
}
}
.delete-folder, .subscribe-folder, .unsubscribe-folder {
cursor: pointer;
.opacity(60);
}
.unsubscribe-folder {
.opacity(25);
}
}
.folder-padding.deep-1 {
width: 15px * 1 + 10px;
}
.folder-padding.deep-2 {
width: 15px * 2 + 10px;
}
.folder-padding.deep-3 {
width: 15px * 3 + 10px;
}
.folder-padding.deep-4 {
width: 15px * 4 + 10px;
}
.folder-padding.deep-5 {
width: 15px * 5 + 10px;
}
/* .folderPaddingHelper(1);
.folderPaddingHelper(2);
.folderPaddingHelper(3);
.folderPaddingHelper(4);
.folderPaddingHelper(5);*/
}

View file

@ -1,5 +0,0 @@
input[type="text"], input[type="password"], input[type="email"], input[type="search"] {
height: 20px;
line-height: 21px;
}

View file

@ -63,7 +63,7 @@ function PopupsFolderCreateViewModel()
RL.data().foldersCreating(false);
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
{
RL.folders(false);
RL.folders();
}
else
{

View file

@ -45,7 +45,8 @@ function PopupsFolderSystemViewModel()
'SentFolder': self.sentFolder(),
'DraftFolder': self.draftFolder(),
'SpamFolder': self.spamFolder(),
'TrashFolder': self.trashFolder()
'TrashFolder': self.trashFolder(),
'NullFolder': 'NullFolder'
});
}, 1000);

View file

@ -2,7 +2,7 @@
"name": "RainLoop",
"title": "RainLoop Webmail",
"version": "1.5.1",
"release": "553",
"release": "554",
"description": "Simple, modern & fast web-based email client",
"homepage": "http://rainloop.net",
"main": "Gruntfile.js",

View file

@ -1653,12 +1653,11 @@ class MailClient
/**
* @param string $sParent = ''
* @param string $sListPattern = '*'
* @param bool $bUseListStatus = false
* @param bool $bUseListSubscribeStatus = false
*
* @return \MailSo\Mail\FolderCollection|false
*/
public function Folders($sParent = '', $sListPattern = '*', $bUseListStatus = false, $bUseListSubscribeStatus = true)
public function Folders($sParent = '', $sListPattern = '*', $bUseListSubscribeStatus = true)
{
$oFolderCollection = false;
@ -1671,19 +1670,9 @@ class MailClient
{
$aSubscribedFolders = $this->oImapClient->FolderSubscribeList($sParent, $sListPattern);
}
catch (\Exception $oException)
{
}
catch (\Exception $oException) {}
}
// TODO
// $mStatusFolders = null;
// if ($bUseListStatus)
// {
// $mStatusFolders = $this->oImapClient->FolderStatusList($sParent, $sListPattern);
// }
$aImapSubscribedFoldersHelper = null;
if (\is_array($aSubscribedFolders))
{

View file

@ -1063,6 +1063,7 @@ class Actions
$aResult['DraftFolder'] = $oSettings->GetConf('DraftFolder', '');
$aResult['SpamFolder'] = $oSettings->GetConf('SpamFolder', '');
$aResult['TrashFolder'] = $oSettings->GetConf('TrashFolder', '');
$aResult['NullFolder'] = $oSettings->GetConf('NullFolder', '');
$aResult['EditorDefaultType'] = $oSettings->GetConf('EditorDefaultType', $aResult['EditorDefaultType']);
$aResult['ShowImages'] = (bool) $oSettings->GetConf('ShowImages', $aResult['ShowImages']);
$aResult['MPP'] = (int) $oSettings->GetConf('MPP', $aResult['MPP']);
@ -1749,6 +1750,7 @@ class Actions
$oSettings->SetConf('DraftFolder', $this->GetActionParam('DraftFolder', ''));
$oSettings->SetConf('TrashFolder', $this->GetActionParam('TrashFolder', ''));
$oSettings->SetConf('SpamFolder', $this->GetActionParam('SpamFolder', ''));
$oSettings->SetConf('NullFolder', $this->GetActionParam('NullFolder', ''));
return $this->DefaultResponse(__FUNCTION__,
$this->SettingsProvider()->Save($oAccount, $oSettings));
@ -3151,40 +3153,61 @@ class Actions
return $aResult;
}
private function systemFoldersNames()
/**
* @staticvar array $aCache
* @param \RainLoop\Account $oAccount
*
* @return array
*/
private function systemFoldersNames($oAccount)
{
static $aCache = null;
if (null === $aCache)
{
$aCache = array(
'Sent' => \MailSo\Imap\Enumerations\FolderType::SENT,
'Send' => \MailSo\Imap\Enumerations\FolderType::SENT,
'Sent Items' => \MailSo\Imap\Enumerations\FolderType::SENT,
'Sent Item' => \MailSo\Imap\Enumerations\FolderType::SENT,
'Send Items' => \MailSo\Imap\Enumerations\FolderType::SENT,
'Sent Items' => \MailSo\Imap\Enumerations\FolderType::SENT,
'Send Item' => \MailSo\Imap\Enumerations\FolderType::SENT,
'Send Items' => \MailSo\Imap\Enumerations\FolderType::SENT,
'Sent Mail' => \MailSo\Imap\Enumerations\FolderType::SENT,
'Sent Mails' => \MailSo\Imap\Enumerations\FolderType::SENT,
'Send Mail' => \MailSo\Imap\Enumerations\FolderType::SENT,
'Send Mails' => \MailSo\Imap\Enumerations\FolderType::SENT,
'Draft' => \MailSo\Imap\Enumerations\FolderType::DRAFTS,
'Drafts' => \MailSo\Imap\Enumerations\FolderType::DRAFTS,
'Draft Mail' => \MailSo\Imap\Enumerations\FolderType::DRAFTS,
'Draft Mails' => \MailSo\Imap\Enumerations\FolderType::DRAFTS,
'Drafts Mail' => \MailSo\Imap\Enumerations\FolderType::DRAFTS,
'Drafts Mails' => \MailSo\Imap\Enumerations\FolderType::DRAFTS,
'Spam' => \MailSo\Imap\Enumerations\FolderType::SPAM,
'Junk' => \MailSo\Imap\Enumerations\FolderType::SPAM,
'Bulk Mail' => \MailSo\Imap\Enumerations\FolderType::SPAM,
'Deleted' => \MailSo\Imap\Enumerations\FolderType::TRASH,
'Bulk Mails' => \MailSo\Imap\Enumerations\FolderType::SPAM,
'Trash' => \MailSo\Imap\Enumerations\FolderType::TRASH,
'Deleted' => \MailSo\Imap\Enumerations\FolderType::TRASH,
'Bin' => \MailSo\Imap\Enumerations\FolderType::TRASH
);
$this->Plugins()->RunHook('filter.system-folders-names', array($oAccount, &$aCache));
}
return $aCache;
}
/**
* @param \RainLoop\Account $oAccount
* @param \MailSo\Mail\FolderCollection $oFolders
* @param array $aResult
* @param bool $bXList = true
*/
private function recFoldersTypes($oFolders, &$aResult, $bXList = true)
private function recFoldersTypes($oAccount, $oFolders, &$aResult, $bXList = true)
{
if ($oFolders)
{
@ -3209,12 +3232,12 @@ class Actions
$oSub = $oFolder->SubFolders();
if ($oSub && 0 < $oSub->Count())
{
$this->recFoldersTypes($oSub, $aResult, true);
$this->recFoldersTypes($oAccount, $oSub, $aResult, true);
}
}
}
$aMap = $this->systemFoldersNames();
$aMap = $this->systemFoldersNames($oAccount);
foreach ($aFolders as $oFolder)
{
$sName = $oFolder->Name();
@ -3235,7 +3258,7 @@ class Actions
$oSub = $oFolder->SubFolders();
if ($oSub && 0 < $oSub->Count())
{
$this->recFoldersTypes($oSub, $aResult, false);
$this->recFoldersTypes($oAccount, $oSub, $aResult, false);
}
}
}
@ -3253,24 +3276,93 @@ class Actions
$this->verifyCacheByKey($sRawKey);
}
$this->initMailClientConnection();
$oAccount = $this->initMailClientConnection();
$oFolderCollection = $this->MailClient()->Folders('', '*',
!!$this->Config()->Get('labs', 'use_imap_list_status', false),
!!$this->Config()->Get('labs', 'use_imap_list_subscribe', true)
);
$oFolderCollection = null;
$this->Plugins()->RunHook('filter.folders-before', array($oAccount, &$oFolderCollection));
if (null === $oFolderCollection)
{
$oFolderCollection = $this->MailClient()->Folders('', '*',
!!$this->Config()->Get('labs', 'use_imap_list_subscribe', true)
);
}
$this->Plugins()->RunHook('filter.folders-post', array($oAccount, &$oFolderCollection));
if ($oFolderCollection instanceof \MailSo\Mail\FolderCollection)
{
$oFolderCollection->FoldersHash = \md5(\implode("\x0", $this->recFoldersNames($oFolderCollection)));
$aSystemFolders = array();
$this->recFoldersTypes($oFolderCollection, $aSystemFolders);
$this->recFoldersTypes($oAccount, $oFolderCollection, $aSystemFolders);
$oFolderCollection->SystemFolders = $aSystemFolders;
$this->cacheByKey($sRawKey);
if ($this->Config()->Get('labs', 'autocreate_system_folders', true))
{
$bDoItAgain = false;
$sNamespace = $oFolderCollection->GetNamespace();
$sNamespace = empty($sNamespace) ? '' : \substr($sNamespace, 0, -1);
$aList = array();
$aMap = $this->systemFoldersNames($oAccount);
if ('' === $this->GetActionParam('SentFolder', ''))
{
$aList[] = \MailSo\Imap\Enumerations\FolderType::SENT;
}
if ('' === $this->GetActionParam('DraftFolder', ''))
{
$aList[] = \MailSo\Imap\Enumerations\FolderType::DRAFTS;
}
if ('' === $this->GetActionParam('SpamFolder', ''))
{
$aList[] = \MailSo\Imap\Enumerations\FolderType::SPAM;
}
if ('' === $this->GetActionParam('TrashFolder', ''))
{
$aList[] = \MailSo\Imap\Enumerations\FolderType::TRASH;
}
$this->Plugins()->RunHook('filter.folders-system-types', array($oAccount, &$aList));
foreach ($aList as $iType)
{
if (!isset($aSystemFolders[$iType]))
{
$mFolderNameToCreate = \array_search($iType, $aMap);
if (!empty($mFolderNameToCreate))
{
if ($this->MailClient()->FolderCreate($mFolderNameToCreate, $sNamespace))
{
$bDoItAgain = true;
}
}
}
}
if ($bDoItAgain)
{
$oFolderCollection = $this->MailClient()->Folders('', '*',
!!$this->Config()->Get('labs', 'use_imap_list_subscribe', true)
);
if ($oFolderCollection)
{
$aSystemFolders = array();
$this->recFoldersTypes($oAccount, $oFolderCollection, $aSystemFolders);
$oFolderCollection->SystemFolders = $aSystemFolders;
}
}
}
if ($oFolderCollection)
{
$oFolderCollection->FoldersHash = \md5(\implode("\x0", $this->recFoldersNames($oFolderCollection)));
$this->cacheByKey($sRawKey);
}
}
$this->Plugins()->RunHook('filter.folders-complete', array($oAccount, &$oFolderCollection));
return $this->DefaultResponse(__FUNCTION__, $oFolderCollection);
}
@ -5266,7 +5358,7 @@ class Actions
public function GetLanguages()
{
static $aCache = null;
if (is_array($aCache))
if (\is_array($aCache))
{
return $aCache;
}
@ -5274,17 +5366,17 @@ class Actions
$bEn = false;
$sList = array();
$sDir = APP_VERSION_ROOT_PATH.'langs/';
if (@is_dir($sDir))
if (@\is_dir($sDir))
{
$rDirH = opendir($sDir);
if ($rDirH)
{
while (($sFile = readdir($rDirH)) !== false)
while (($sFile = \readdir($rDirH)) !== false)
{
if ('.' !== $sFile{0} && is_file($sDir.'/'.$sFile) && '.ini' === substr($sFile, -4))
if ('.' !== $sFile{0} && \is_file($sDir.'/'.$sFile) && '.ini' === \substr($sFile, -4))
{
$sLang = strtolower(substr($sFile, 0, -4));
if (0 < strlen($sLang) && 'always' !== $sLang)
$sLang = \strtolower(\substr($sFile, 0, -4));
if (0 < \strlen($sLang) && 'always' !== $sLang)
{
if (\in_array($sLang, array('en')))
{
@ -5298,11 +5390,11 @@ class Actions
}
}
@closedir($rDirH);
@\closedir($rDirH);
}
}
sort($sList);
\sort($sList);
if ($bEn)
{
\array_unshift($sList, 'en');

View file

@ -209,11 +209,11 @@ Enables caching in the system'),
'determine_user_language' => array(true),
'use_imap_sort' => array(false),
'use_imap_force_selection' => array(false),
'use_imap_list_status' => array(false),
'use_imap_list_subscribe' => array(true),
'use_imap_thread' => array(true),
'use_imap_move' => array(true),
'use_imap_auth_plain' => array(false),
'autocreate_system_folders' => array(true),
'repo_type' => array('stable'),
'custom_repo' => array(''),
'additional_repo' => array(''),

View file

@ -1,26 +1,26 @@
<tr class="folder-item" data-bind="css: { 'selectable': selectable, 'gmailFolder' : isGmailFolder }">
<td>
<span class="folder-padding" data-bind="css: 'deep-' + deep">&nbsp;</span>
<span class="folder-name" data-bind="text: name, visible: !edited(), css: { 'e-action': canBeEdited, 'can-be-edited': canBeEdited }, click: function (oFolder) { $root.folderForEdit(oFolder); }"></span>
&nbsp;
<span class="folder-system-name" data-bind="text: manageFolderSystemName, visible: isSystemFolder"></span>
<input type="text" class="folder-name-input" data-bind="value: nameForEdit, visible: edited, hasfocus: edited, onEnter: function () { $root.folderEditOnEnter($data); }, onEsc: function () { $root.folderEditOnEsc($data); }" />
<a class="btn btn-small btn-small-small btn-danger pull-right button-delete" data-bind="css: {'delete-access': deleteAccess()}, click: function() { $root.deleteFolder($data); }">
<span class="i18n" data-i18n-text="SETTINGS_FOLDERS/DELETING_ASK"></span>
</a>
</td>
<td>
<span class="delete-folder" data-bind="visible: canBeDeleted() && !deleteAccess(), click: function (oFolder) { $root.folderForDeletion(oFolder); }">
<i class="icon-trash"></i>
</span>
</td>
<td>
<span class="unsubscribe-folder" data-bind="visible: canBeSubScribed() && !subScribed(), click: function(oFolder) { $root.subscribeFolder(oFolder); }">
<i class="icon-eye"></i>
</span>
<span class="subscribe-folder" data-bind="visible: canBeSubScribed() && subScribed(), click: function(oFolder) { $root.unSubscribeFolder(oFolder); }">
<i class="icon-eye"></i>
</span>
</td>
</tr>
<tr class="folder-item" data-bind="css: { 'selectable': selectable, 'gmailFolder' : isGmailFolder, 'system': isSystemFolder }">
<td>
<span class="folder-padding" data-bind="css: 'deep-' + deep">&nbsp;</span>
<span class="folder-name" data-bind="text: name, visible: !edited(), css: { 'e-action': canBeEdited, 'can-be-edited': canBeEdited }, click: function (oFolder) { $root.folderForEdit(oFolder); }"></span>
&nbsp;
<span class="folder-system-name" data-bind="text: manageFolderSystemName, visible: isSystemFolder"></span>
<input type="text" class="folder-name-input" data-bind="value: nameForEdit, visible: edited, hasfocus: edited, onEnter: function () { $root.folderEditOnEnter($data); }, onEsc: function () { $root.folderEditOnEsc($data); }" />
<a class="btn btn-small btn-small-small btn-danger pull-right button-delete" data-bind="css: {'delete-access': deleteAccess()}, click: function() { $root.deleteFolder($data); }">
<span class="i18n" data-i18n-text="SETTINGS_FOLDERS/DELETING_ASK"></span>
</a>
</td>
<td>
<span class="delete-folder" data-bind="visible: canBeDeleted() && !deleteAccess(), click: function (oFolder) { $root.folderForDeletion(oFolder); }">
<i class="icon-trash"></i>
</span>
</td>
<td>
<span class="unsubscribe-folder" data-bind="visible: canBeSubScribed() && !subScribed(), click: function(oFolder) { $root.subscribeFolder(oFolder); }">
<i class="icon-eye"></i>
</span>
<span class="subscribe-folder" data-bind="visible: canBeSubScribed() && subScribed(), click: function(oFolder) { $root.unSubscribeFolder(oFolder); }">
<i class="icon-eye"></i>
</span>
</td>
</tr>
<!-- ko template: { name: 'SettingsFolderItem', foreach: subFolders } --><!-- /ko -->

View file

@ -1143,7 +1143,7 @@ table {
border-spacing: 0;
}
@charset "UTF-8";
/*@charset "UTF-8";*/
@font-face {
font-family: "rainloop";
@ -7903,6 +7903,19 @@ html.rl-message-fullscreen .messageView .b-content .buttonFull {
opacity: 0.5;
filter: alpha(opacity=50);
}
/*.folderPaddingHelper(@i) {
(~".folder-padding.deep-@{i}") {
width: 15px * @i + 10px;
}
}*/
.b-settings-folders {
/* .folderPaddingHelper(1);
.folderPaddingHelper(2);
.folderPaddingHelper(3);
.folderPaddingHelper(4);
.folderPaddingHelper(5);*/
}
.b-settings-folders.ignore-folder-subscribe .subscribe-folder,
.b-settings-folders.ignore-folder-subscribe .unsubscribe-folder {
display: none;
@ -7953,6 +7966,10 @@ html.rl-message-fullscreen .messageView .b-content .buttonFull {
.b-settings-folders .list-table .folder-name-input {
border-width: 1px;
margin-bottom: 0;
margin-left: -4px;
}
.b-settings-folders .folder-item.system .folder-name {
font-weight: bold;
}
.b-settings-folders .folder-item .button-delete {
margin-right: 15px;
@ -8426,10 +8443,3 @@ html.rl-message-fullscreen .messageView .b-content .buttonFull {
.editorFontStylePicker .editorFpFonts .editorFpFont {
padding: 5px;
}
input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"] {
height: 20px;
line-height: 21px;
}

File diff suppressed because one or more lines are too long

View file

@ -7180,10 +7180,6 @@ function FolderModel()
}
}, this);
this.canBeEdited = ko.computed(function () {
return Enums.FolderType.User === this.type();
}, this);
this.privateMessageCountAll = ko.observable(0);
this.privateMessageCountUnread = ko.observable(0);
@ -7212,6 +7208,10 @@ FolderModel.prototype.initComputed = function ()
});
}, this);
this.canBeEdited = ko.computed(function () {
return Enums.FolderType.User === this.type() && this.existen && this.selectable;
}, this);
this.visible = ko.computed(function () {
var
bSubScribed = this.subScribed(),
@ -7689,7 +7689,7 @@ function PopupsFolderCreateViewModel()
RL.data().foldersCreating(false);
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
{
RL.folders(false);
RL.folders();
}
else
{
@ -7791,7 +7791,8 @@ function PopupsFolderSystemViewModel()
'SentFolder': self.sentFolder(),
'DraftFolder': self.draftFolder(),
'SpamFolder': self.spamFolder(),
'TrashFolder': self.trashFolder()
'TrashFolder': self.trashFolder(),
'NullFolder': 'NullFolder'
});
}, 1000);
@ -12730,7 +12731,7 @@ SettingsFolders.prototype.folderEditOnEnter = function (oFolder)
oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_RENAME_FOLDER'));
}
RL.folders(false);
RL.folders();
}, oFolder.fullNameRaw, sEditName);
@ -12801,7 +12802,7 @@ SettingsFolders.prototype.deleteFolder = function (oFolderToRemove)
oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_DELETE_FOLDER'));
}
RL.folders(false);
RL.folders();
}, oFolderToRemove.fullNameRaw);
@ -13601,10 +13602,9 @@ WebMailDataStorage.prototype.initUidNextAndNewMessages = function (sFolder, sUid
/**
* @param {string} sNamespace
* @param {Array} aFolders
* @param {boolean} bCached
* @return {Array}
*/
WebMailDataStorage.prototype.folderResponseParseRec = function (sNamespace, aFolders, bCached)
WebMailDataStorage.prototype.folderResponseParseRec = function (sNamespace, aFolders)
{
var
iIndex = 0,
@ -13616,8 +13616,6 @@ WebMailDataStorage.prototype.folderResponseParseRec = function (sNamespace, aFol
aList = []
;
bCached = !!bCached;
for (iIndex = 0, iLen = aFolders.length; iIndex < iLen; iIndex++)
{
oFolder = aFolders[iIndex];
@ -13651,7 +13649,7 @@ WebMailDataStorage.prototype.folderResponseParseRec = function (sNamespace, aFol
{
oCacheFolder.collapsed(!Utils.isFolderExpanded(oCacheFolder.fullNameHash));
if (!bCached && oFolder.Extended)
if (oFolder.Extended)
{
if (oFolder.Extended.Hash)
{
@ -13674,7 +13672,7 @@ WebMailDataStorage.prototype.folderResponseParseRec = function (sNamespace, aFol
aSubFolders['@Collection'] && Utils.isArray(aSubFolders['@Collection']))
{
oCacheFolder.subFolders(
this.folderResponseParseRec(sNamespace, aSubFolders['@Collection'], bCached));
this.folderResponseParseRec(sNamespace, aSubFolders['@Collection']));
}
aList.push(oCacheFolder);
@ -13687,16 +13685,13 @@ WebMailDataStorage.prototype.folderResponseParseRec = function (sNamespace, aFol
/**
* @param {*} oData
* @param {boolean=} bCached = false
*/
WebMailDataStorage.prototype.setFolders = function (oData, bCached)
WebMailDataStorage.prototype.setFolders = function (oData)
{
var
aList = [],
bUpdate = false,
oRLData = RL.data(),
aFolders = oRLData.folderList(),
bFoldersFirst = 0 === aFolders.length,
fNormalizeFolder = function (sFolderFullNameRaw) {
return ('' === sFolderFullNameRaw || Consts.Values.UnuseOptionValue === sFolderFullNameRaw ||
null !== RL.cache().getFolderFromCacheList(sFolderFullNameRaw)) ? sFolderFullNameRaw : '';
@ -13713,12 +13708,12 @@ WebMailDataStorage.prototype.setFolders = function (oData, bCached)
this.threading(!!RL.settingsGet('UseImapThread') && oData.Result.IsThreadsSupported && true);
aList = this.folderResponseParseRec(oRLData.namespace, oData.Result['@Collection'], !!bCached);
aList = this.folderResponseParseRec(oRLData.namespace, oData.Result['@Collection']);
oRLData.folderList(aList);
if (oData.Result['SystemFolders'] &&
'' === '' + RL.settingsGet('SentFolder') + RL.settingsGet('DraftFolder') +
RL.settingsGet('SpamFolder') + RL.settingsGet('TrashFolder'))
RL.settingsGet('SpamFolder') + RL.settingsGet('TrashFolder') + RL.settingsGet('NullFolder'))
{
// TODO Magic Numbers
RL.settingsSet('SentFolder', oData.Result['SystemFolders'][2] || null);
@ -13740,19 +13735,12 @@ WebMailDataStorage.prototype.setFolders = function (oData, bCached)
'SentFolder': oRLData.sentFolder(),
'DraftFolder': oRLData.draftFolder(),
'SpamFolder': oRLData.spamFolder(),
'TrashFolder': oRLData.trashFolder()
'TrashFolder': oRLData.trashFolder(),
'NullFolder': 'NullFolder'
});
}
if (!bCached)
{
RL.local().set(Enums.ClientSideKeyName.FoldersLashHash, oData.Result.FoldersHash);
}
if (bFoldersFirst && bCached)
{
RL.folders(false);
}
RL.local().set(Enums.ClientSideKeyName.FoldersLashHash, oData.Result.FoldersHash);
}
};
@ -14365,21 +14353,15 @@ _.extend(WebMailAjaxRemoteStorage.prototype, AbstractAjaxRemoteStorage.prototype
/**
* @param {?Function} fCallback
* @param {boolean=} bUseCache = true
*/
WebMailAjaxRemoteStorage.prototype.folders = function (fCallback, bUseCache)
WebMailAjaxRemoteStorage.prototype.folders = function (fCallback)
{
var sFoldersHash = RL.data().lastFoldersHash;
bUseCache = Utils.isUnd(bUseCache) ? false : !!bUseCache;
if (bUseCache && '' !== sFoldersHash)
{
this.defaultRequest(fCallback, 'Folders', {}, null, 'Folders/' + RL.data().projectHash() + '-' + sFoldersHash, ['Folders']);
}
else
{
this.defaultRequest(fCallback, 'Folders', {}, null, '', ['Folders']);
}
this.defaultRequest(fCallback, 'Folders', {
'SentFolder': RL.settingsGet('SentFolder'),
'DraftFolder': RL.settingsGet('DraftFolder'),
'SpamFolder': RL.settingsGet('SpamFolder'),
'TrashFolder': RL.settingsGet('TrashFolder')
}, null, '', ['Folders']);
};
/**
@ -16226,18 +16208,17 @@ RainLoopApp.prototype.recacheInboxMessageList = function ()
};
/**
* @param {boolean=} bUseCache = true
* @param {Function=} fCallback
*/
RainLoopApp.prototype.folders = function (bUseCache, fCallback)
RainLoopApp.prototype.folders = function (fCallback)
{
this.data().foldersLoading(true);
this.remote().folders(_.bind(function (sResult, oData, bCached) {
this.remote().folders(_.bind(function (sResult, oData) {
RL.data().foldersLoading(false);
if (Enums.StorageResultType.Success === sResult)
{
this.data().setFolders(oData, bCached);
this.data().setFolders(oData);
if (fCallback)
{
fCallback(true);
@ -16250,7 +16231,7 @@ RainLoopApp.prototype.folders = function (bUseCache, fCallback)
fCallback(false);
}
}
}, this), bUseCache);
}, this));
};
RainLoopApp.prototype.accountsAndIdentities = function ()
@ -16837,7 +16818,7 @@ RainLoopApp.prototype.bootstart = function ()
{
this.setTitle(Utils.i18n('TITLES/LOADING'));
this.folders(true, _.bind(function (bValue) {
this.folders(_.bind(function (bValue) {
kn.hideLoading();

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,4 @@
@charset "UTF-8";
/*@charset "UTF-8";*/
@font-face {
font-family: "rainloop";