多个口译员登录

Multiple Interpreters with login

我正在尝试设置并运行多口译员,运行遇到了一些问题,特别是利用外部登录源。

首先,我用来设置终端的片段。

$(document).ready(function() {
  var term = $('#content').terminal('terminal/process.php', {
    login: true,
    onExit: function(terminal) { terminal.clear(); },
    prompt: '>',
    completion: true,
    greetings: '\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nTerminal\n\n\n\n\n\n\n',
    height: 320,
    width: 560
  });
});

现在登录部分按设计工作了。但是,我想添加多个解释器,同时在启动时保留所需的登录名。如果我将 http://terminal.jcubic.pl/examples.php#multiple_interpreters 调整为

}, {
  login: true,
  greetings: "multiply terminals demo use help"+
        " to see available commands"
});});

它抛出错误 'Authenticate must be a function'。

我正在寻找任何关于最佳设置方法的建议,无论是编写登录函数、调整初始终端的创建方式,还是完全不同的东西。最终目标是尝试模拟具有两个 运行 时间级别的 Cisco 类型终端,并可选择根据各种命令输入更改两个 运行 级别的提示。

感谢您的意见!

如果你有多个终端,但 terminal/process.php 以 JSON-RPC 方法登录,那么你自己调用登录:

{
   login: function(login, password, callback) {
     $.jrpc('terminal/process.php', 'login', [login, password], function(data) {
        callback(data.result);
     });
   },
   ...
}