~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/media/console/console.js

  • Committer: wagrant
  • Date: 2008-12-23 01:58:44 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:1063
Set PATH_INFO and PATH_TRANSLATED properly for student CGI scripts.

If the requested path doesn't exist, interpretservice now traverses up the
directory tree until it finds a prefix of the path that does exist. If we are
allowed to execute that path, we do so, giving it the trimmed bits in
PATH_INFO. If execution is not permissible, we 404 anyway.

Fixes [ 2094777 ] Serve: Allow path after CGI script

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
            tmp_path.pop();
82
82
            path = path_join("/home", tmp_path.join('/'));
83
83
        }
84
 
        ajax_call(callback1, "console", "service", {"ivle.op": "start", "cwd": path}, "POST");
 
84
        ajax_call(callback1, "consoleservice", "start", {"startdir": path}, "POST");
85
85
    }
86
86
    else
87
87
    {
88
88
        // No current_path - let the server decide
89
 
        ajax_call(callback1, "console", "service", {"ivle.op": "start"}, "POST");
 
89
        ajax_call(callback1, "consoleservice", "start", {}, "POST");
90
90
    }
91
91
}
92
92
 
270
270
        // Print ">>>" span
271
271
        var span = document.createElement("span");
272
272
        span.setAttribute("class", "inputPrompt");
273
 
        span.appendChild(document.createTextNode(
274
 
              document.getElementById("console_prompt").firstChild.textContent)
275
 
                        );
 
273
        span.appendChild(document.createTextNode(">>> "));
276
274
        output.appendChild(span);
277
275
        // Print input line itself in a span
278
276
        var span = document.createElement("span");
280
278
        span.appendChild(document.createTextNode(inputline));
281
279
        output.appendChild(span);
282
280
    }
283
 
    var args = {"ivle.op": "chat", "kind": which, "key": server_key, "text":inputline};
 
281
    var args = {"key": server_key, "text":inputline};
284
282
    var callback = function(xhr)
285
283
        {
286
284
            console_response(inputbox, graytimer, inputline, xhr.responseText);
288
286
    /* Disable the text box */
289
287
    if (inputbox != null)
290
288
        inputbox.setAttribute("disabled", "disabled");
291
 
    ajax_call(callback, "console", "service", args, "POST");
 
289
    ajax_call(callback, "consoleservice", which, args, "POST");
292
290
}
293
291
 
294
292
function console_response(inputbox, graytimer, inputline, responseText)
361
359
        {
362
360
            var kind = "chat";
363
361
        }
364
 
        var args = {"ivle.op": "chat", "kind": kind, "key": server_key, "text":''};
365
 
        ajax_call(callback, "console", "service", args, "POST");
 
362
        var args = {"key": server_key, "text":''};
 
363
        ajax_call(callback, "consoleservice", kind, args, "POST");
366
364
 
367
365
        // Open up the console so we can see the output
368
366
        // FIXME: do we need to maximize here?
470
468
    }
471
469
    else
472
470
    {
473
 
        xhr = ajax_call(null, "console", "service", {"ivle.op": "chat", "kind": "terminate", "key": server_key}, "POST");
 
471
        xhr = ajax_call(null, "consoleservice", "restart", {"key": server_key}, "POST");
474
472
        console_response(null, null, null, xhr.responseText);
475
473
    }
476
474
}