summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/codeq.js18
-rw-r--r--js/codeq/login.js2
-rw-r--r--js/prolog.js2
-rw-r--r--prolog.html2
4 files changed, 19 insertions, 5 deletions
diff --git a/js/codeq.js b/js/codeq.js
index a08d207..ed59e4e 100644
--- a/js/codeq.js
+++ b/js/codeq.js
@@ -746,7 +746,7 @@ window.phandler = null; // TODO: this is for debug only
var hash = location.hash,
error = false,
- params, param, sid, grp, prb, i, key, j;
+ params, param, sid, lang, grp, prb, i, key, j;
if (hash.length < 2) {
error = 'No execution parameters were provided';
@@ -764,6 +764,9 @@ window.phandler = null; // TODO: this is for debug only
case 'sid':
sid = param.substring(j+1);
break;
+ case 'lang':
+ lang = param.substring(j+1);
+ break;
case 'grp':
grp = param.substring(j+1);
break;
@@ -794,10 +797,19 @@ window.phandler = null; // TODO: this is for debug only
// DEBUG: phandler.processServerHints([{id:'drop_down', start: 20, end: 26, choices:['ena', 'dva', 'tri']}]);
}
});*/
- codeq.comms.getProblem('prolog', grp, prb).then(
+ codeq.comms.getProblem(lang, grp, prb).then(
function getProblemOK (data) {
if (data.code == 0) {
- window.phandler = codeq.createPrologHandler(data.data, grp, prb); // TODO: assignment to window for debug only
+ switch (lang) {
+ case 'prolog':
+ // TODO: assignment to window for debug only
+ window.phandler = codeq.createPrologHandler(data.data, grp, prb);
+ break;
+ case 'python':
+ // TODO: assignment to window for debug only
+ window.phandler = codeq.createPythonHandler(data.data, grp, prb);
+ break;
+ }
}
else {
alert(data.message);
diff --git a/js/codeq/login.js b/js/codeq/login.js
index 8135506..e1daadf 100644
--- a/js/codeq/login.js
+++ b/js/codeq/login.js
@@ -74,7 +74,7 @@
},
'success': function loginSuccessHandler(data, textStatus, jqXHR) {
if (data && (data.code === 0)) {
- window.location = identifier[0] + '.html#sid=' + data.sid + '/grp=' + identifier[1] + '/prb=' + problem;
+ window.location = identifier[0] + '.html#sid=' + data.sid + '/lang=' + identifier[0] + '/grp=' + identifier[1] + '/prb=' + problem;
}
else {
alert('Login failed: code=' + data.code + ', reason=' + data.message);
diff --git a/js/prolog.js b/js/prolog.js
index 72687c3..7fe73fd 100644
--- a/js/prolog.js
+++ b/js/prolog.js
@@ -362,6 +362,7 @@
jqConsole.pause();
var doc = editor.getDoc();
codeq.comms.sendHint({
+ 'language': 'prolog',
'program': editor.getDoc().getValue(),
'problem_id': problem.id
}).then(
@@ -383,6 +384,7 @@
jqConsole.pause();
var doc = editor.getDoc();
codeq.comms.sendTest({
+ 'language': 'prolog',
'program': editor.getDoc().getValue(),
'problem_id': problem.id
}).then(
diff --git a/prolog.html b/prolog.html
index 96d13cb..5dbfde9 100644
--- a/prolog.html
+++ b/prolog.html
@@ -27,7 +27,7 @@
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#" title="Intelligent tutor system">CodeQ</a>
- <a class="navbar-brand" id="title">Intro to Prolog programming</a>
+ <a class="navbar-brand" id="title"></a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">