自定义 Roundcube 网络邮件服务器列表

Customize Rouncube webmail server list

我有 -latest version 1.2.0- webmail works with 。我在该服务器上托管多个域,并使用 IIS 作为 Roundcube 的 Web 服务器。网络邮件可通过 https://mail.xxxx.tld 访问,其中 xxxx 是我托管的域名。

使用 IIS 网站设置中的 bindings,所有域仅指向 IIS 上的一个网站。

在圆立方体中config.inc.php:

$config['default_host'] = array('mail.x1.net', 'mail.x2.net', 'mail.x3.org', 'mail.x4.net');

因此,在登录页面中有如下屏幕截图所示的服务器列表:

默认情况下始终选择服务器列表中的第一台服务器。我需要得到的是根据访问登录页面的 URL 使选定的服务器甚至使单个服务器可用。

现在,我的意思不是如何实现它,客户端使用 javascript 或服务器端使用 PHP,我的意思是我可以在哪里应用任何该要求的实施?

我已尝试修改 skins/larry/templates/login.html 但我无法找到除以下内容以外的登录表单的任何详细信息:

<roundcube:form name="form" method="post">
<roundcube:object name="loginform" form="form" size="40" submit=true />
</form> 

换句话说,用户名、密码和服务器这三个表单元素都是从<roundcube:object name="loginform" form="form" size="40" submit=true />生成的,那么我在哪里可以修改这个对象?

我发现有两种方法:

  1. 路漫漫其修远兮,学习 Roundcube API 并构建插件。
  2. 捷径,在skins/larry/templates/login.html
  3. 末尾添加一点脚本

以下是我添加的脚本:

<script>
/* By: Said Bakr
 Making only one select list server item equals to the current host.
*/
$(document).ready(function() {
    my_host = $(location).attr('hostname');
    $("#rcmloginhost option").each(function(){
      if ($(this).val().replace(/^(.*)\:\/\//i, "") != my_host){
        $(this).remove();
      } 
    })
});
</script>
</body>