Commit cc8489f1 authored by Gero Müller's avatar Gero Müller
Browse files

fix paths in terminal

parent a29e342c
......@@ -63,8 +63,9 @@ var TerminalContent = ExtensionContentFull.extend({
getContent : function() {
var _this = this;
this.content = $('<div />').addClass('terminal-full-body')
this.content.load('/extensions/terminal/static/content.html?'
+ new Date().getTime(), function() {
this.content.load(_this._vispa.urlHandler
.dynamic('/extensions/terminal/static/content.html?'
+ new Date().getTime()), function() {
var terminal = this;
var cmd = $(terminal).find(".terminal-command").addClass(
......@@ -81,23 +82,29 @@ var TerminalContent = ExtensionContentFull.extend({
});
// create/open a new terminal session, returns id
$.get('extensions/terminal/open', function(terminalid) {
// add on click action for submit button
sub.click({
terminalid : terminalid
}, function(event) {
// send command
var command = encodeURI(cmd.val())
$.get('extensions/terminal/command?id='
+ event.data.terminalid + "&command=" + command);
cmd.val('');
});
// poll output
var interval = setInterval(function() {
$.get('extensions/terminal/output?id=' + terminalid,
function(lines) {
$.get(_this._vispa.urlHandler.dynamic('extensions/terminal/open'),
function(terminalid) {
// add on click action for submit button
sub.click({
terminalid : terminalid
}, function(event) {
// send command
var command = encodeURI(cmd.val())
$.get(_this._vispa.urlHandler
.dynamic('extensions/terminal/command'), {
id : event.data.terminalid,
command : command
});
cmd.val('');
});
// poll output
var interval = setInterval(function() {
$.get(_this._vispa.urlHandler
.dynamic('extensions/terminal/output'), {
id : terminalid
}, function(lines) {
var output = $(terminal).find(
".terminal-output")
for ( var i = 0; i < lines.length; i++) {
......@@ -106,15 +113,18 @@ var TerminalContent = ExtensionContentFull.extend({
}
});
}, 500);
}, 500);
// close remote terminal, clear polling
_this.beforeClose = function() {
$.get('extensions/terminal/close?id=' + terminalid);
window.clearInterval(interval);
return true;
}
});
// close remote terminal, clear polling
_this.beforeClose = function() {
$.get(_this._vispa.urlHandler
.dynamic('extensions/terminal/close'), {
id : terminalid
});
window.clearInterval(interval);
return true;
}
});
});
return this.content;
},
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment