好的,所以我设法找到了答案。
使用为 Roundcube 构建插件的指南[roundcubeRoot]/plugin/no_forward_for_groupes
,我在文件夹中设置了一个“no_forward_for_groupes”插件。我[roundcubeRoot]/config/config.inc.php
通过 wrtiting 在文件中激活了它
$config['plugins'] = array('no_forward_for_groupes');
与任何其他插件一样。
在对[roundcubeRoot]/program/js/app.js
文件(Roundcube 的核心 JS)进行了一些阅读和研究之后,我找到了我需要操作的对象和要监听的事件。最终代码就在后面。如您所见,我禁用了许多其他命令,以及拖放。所以基本上我有一个只读文件夹,你不能从中取出任何邮件。我知道这是一个特定的用例,但我希望有一天它会帮助一些人!
no_forward_for_groupes.php
<?php
/**
* No Forward For Groups
*
* This plugin disables the Send / Forward menus from the Mails_Groupes folder
*
* @version 0.1
* @author Remy Sanfeliu
*/
class no_forward_for_groupes extends rcube_plugin
{
public $task = 'mail';
function init(){
$this->include_script('no_forward_for_groupes.js');
}
}
no_forward_for_groupes.js
/**
* No Forward For Groups
*
* This plugin disables the Send / Forward menus from the Mails_Groupes folder
*
* @version 0.1
* @author Remy Sanfeliu
*/
window.rcmail.addEventListener('listupdate', function(folder, old) {
if (folder.folder=="SENT.Mails_Groupes"){
window.rcmail.message_list.addEventListener('select', select_msglist);
window.rcmail.message_list.addEventListener('dragstart', do_nothing);
window.rcmail.message_list.addEventListener('dragmove', do_nothing);
window.rcmail.message_list.addEventListener('dragend', do_nothing);
}else{
window.rcmail.message_list.removeEventListener('select', select_msglist);
window.rcmail.message_list.removeEventListener('dragstart', do_nothing);
window.rcmail.message_list.removeEventListener('dragmove', do_nothing);
window.rcmail.message_list.removeEventListener('dragend', do_nothing);
}
});
function select_msglist(list){
window.rcmail.enable_command( 'reply',
'reply-all',
'reply-list',
'move',
'copy',
'delete',
'mark',
'edit',
'forward',
'forward-attachment',
'forward-inline',
false);
}
function do_nothing(){
// DO NOTHING
}