mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-10 17:13:38 +08:00
Save multiple .EML to Nextcloud Files storage
https://github.com/the-djmaze/snappymail/issues/569#issuecomment-1287030832
This commit is contained in:
parent
b1bcbc1671
commit
aeabb16808
2 changed files with 43 additions and 1 deletions
|
@ -23,9 +23,11 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
$this->addJs('js/message.js');
|
||||
$this->addHook('json.attachments', 'DoAttachmentsActions');
|
||||
$this->addJsonHook('NextcloudSaveMsg', 'NextcloudSaveMsg');
|
||||
$this->addJsonHook('NextcloudAttachFile', 'NextcloudAttachFile');
|
||||
|
||||
$this->addJs('js/composer.js');
|
||||
$this->addJsonHook('NextcloudAttachFile', 'NextcloudAttachFile');
|
||||
|
||||
$this->addJs('js/messagelist.js');
|
||||
|
||||
$this->addTemplate('templates/PopupsNextcloudFiles.html');
|
||||
}
|
||||
|
|
40
plugins/nextcloud/js/messagelist.js
Normal file
40
plugins/nextcloud/js/messagelist.js
Normal file
|
@ -0,0 +1,40 @@
|
|||
(rl => {
|
||||
// if (rl.settings.get('Nextcloud'))
|
||||
|
||||
addEventListener('rl-view-model.create', e => {
|
||||
if ('MailMessageList' === e.detail.viewModelTemplateID) {
|
||||
let view = e.detail;
|
||||
view.nextcloudSaveMsgs = () => {
|
||||
view.messageList.hasChecked()
|
||||
&& rl.ncFiles.selectFolder().then(folder => {
|
||||
folder && view.messageList.forEach(msg => {
|
||||
msg.checked() && rl.pluginRemoteRequest(
|
||||
(iError, data) => {
|
||||
console.dir({
|
||||
iError:iError,
|
||||
data:data
|
||||
});
|
||||
},
|
||||
'NextcloudSaveMsg',
|
||||
{
|
||||
'msgHash': msg.requestHash,
|
||||
'folder': folder,
|
||||
'filename': msg.subject()
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
let template = document.getElementById('MailMessageList');
|
||||
|
||||
const msgMenu = template.content.querySelector('#more-list-dropdown-id + menu [data-bind*="forwardCommand"]');
|
||||
if (msgMenu) {
|
||||
msgMenu.after(Element.fromHTML('<li role="presentation" data-bind="css:{disabled:!messageList.hasChecked()}">'
|
||||
+ '<a href="#" tabindex="-1" data-icon="📥" data-bind="click: nextcloudSaveMsgs" data-i18n="NEXTCLOUD/SAVE_EML"></a>'
|
||||
+ '</li>'));
|
||||
}
|
||||
|
||||
})(window.rl);
|
Loading…
Reference in a new issue