summaryrefslogtreecommitdiff
path: root/js/codeq
diff options
context:
space:
mode:
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
+})();