summaryrefslogtreecommitdiff
path: root/js/codeq
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@araneo.org>2015-08-31 18:55:22 +0200
committerTimotej Lazar <timotej.lazar@araneo.org>2015-08-31 18:55:22 +0200
commit827a8a489fa781c741e3723f26cb1f51192d286b (patch)
tree3b1c016f2a7ebe40332db8464bf998f48598f275 /js/codeq
parent6f33adc4056bf9cefbde7fca3b476bfa02637660 (diff)
Get problem data for all languages in login.js
Diffstat (limited to 'js/codeq')
-rw-r--r--js/codeq/login.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/js/codeq/login.js b/js/codeq/login.js
index af50b22..8135506 100644
--- a/js/codeq/login.js
+++ b/js/codeq/login.js
@@ -8,9 +8,7 @@
'url': urlPrefix + 'list_problems',
'accepts': 'application/json',
'contentType': 'application/json; charset=UTF-8',
- 'data': JSON.stringify({
- 'language': 'prolog'
- }),
+ 'data': JSON.stringify({}),
'processData': false,
'dataType': 'json',
'error': function loginErrorHandler(jqXHR, textStatus, errorThrown) {
@@ -41,8 +39,10 @@
groups = data.problems;
for (i = 0; i < groups.length; i++) {
group = groups[i];
- html.push('<option value="', group.identifier, '">', group.name, '</option>\n');
- mapping[group.identifier] = group.problems;
+ var identifier = group.identifier.language + '/' + group.identifier.group;
+ var name = group.name.language + ': ' + group.name.group;
+ html.push('<option value="', identifier, '">', name, '</option>\n');
+ mapping[identifier] = group.problems;
}
jqGroup.html(html.join(''));
first_group = html[1];
@@ -53,9 +53,9 @@
onGroupChange();
$("#submit").on('click', function () {
- var group = $('#problem_group').val(),
+ var identifier = $('#problem_group').val().split('/'),
problem = $('#problems').val();
- if (!group) alert('Choose a problem group');
+ if (identifier.length < 2) alert('Choose a problem group');
else if (!problem) alert('Choose a problem');
else {
$.ajax({
@@ -74,7 +74,7 @@
},
'success': function loginSuccessHandler(data, textStatus, jqXHR) {
if (data && (data.code === 0)) {
- window.location = 'prolog.html#sid=' + data.sid + '/grp=' + group + '/prb=' + problem;
+ window.location = identifier[0] + '.html#sid=' + data.sid + '/grp=' + identifier[1] + '/prb=' + problem;
}
else {
alert('Login failed: code=' + data.code + ', reason=' + data.message);
@@ -91,4 +91,4 @@
}
});
});
-})(); \ No newline at end of file
+})();