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

« back to all changes in this revision

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

  • Committer: mattgiuca
  • Date: 2008-08-18 12:15:25 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:1027
Tutorial: Added new feature - previous attempt viewing. Allows users to see
    code they have previously submitted to tutorials.
    A new button ("View previous attempts") appears on each exercise box.
    This uses the getattempts and getattempt Ajax services checked in
    previously.
Note once again: Students are not (for the moment) able to see deactivated
attempts (this is a conservative approach - the ability to see deactivated
attempts can be turned on by setting HISTORY_ALLOW_INACTIVE = True in
tutorialservice).

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
    var callback1 = function(xhr)
59
59
        {
60
60
            var json_text = xhr.responseText;
61
 
            server_key = JSON.parse(json_text).key;
 
61
            server_key = JSON.parse(json_text);
62
62
            server_started = true;
63
63
            if (callback != null)
64
64
                callback();
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
 
261
261
    else
262
262
    {
263
263
        GLOBAL_inputbox = inputbox;     /* For timer */
264
 
        var inputline = inputbox.value + "\n";
 
264
        var inputline = inputbox.value;
265
265
        var graytimer = setTimeout("GLOBAL_inputbox.setAttribute(\"class\", "
266
266
            + "\"disabled\");", 100);
267
267
    }
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");
279
277
        span.setAttribute("class", "inputMsg");
280
 
        span.appendChild(document.createTextNode(inputline));
 
278
        span.appendChild(document.createTextNode(inputline + "\n"));
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
}