Commit 6cdfd9a7 by Piotr Mitros

Due dates and number of submissions work

parent ab0cb29c
<h2> ${ problem['name'] } </h2> <h2> ${ problem['name'] } </h2>
${ problem['html'] } ${ problem['html'] }
<br> <br>
<input type="hidden" name="problem_id" value="${ problem['name'] }"> <input type="hidden" name="problem_id" value="${ problem['name'] }">
% if check_button: % if check_button:
<input id="check_${ id }" type="button" value="${ check_button }" > <input id="check_${ id }" type="button" value="${ check_button }" >
% endif % endif
% if save_button:
<input id="save_${ id }" type="button" value="Save" >
% endif
...@@ -13,25 +13,27 @@ function ${ id }_load() { ...@@ -13,25 +13,27 @@ function ${ id }_load() {
$.getJSON('/modx/problem/${ id }/problem_check', $.getJSON('/modx/problem/${ id }/problem_check',
submit_data, submit_data,
function(json) { function(json) {
for(p in json) { ${ id }_load();
if(json[p]=='correct') });
$("#status_"+p).attr("class", "ui-icon ui-icon-check");
if(json[p]=='incorrect')
$("#status_"+p).attr("class", "ui-icon ui-icon-close");
$('#check_${ id }').attr("value", "Reset");
}
});
} else /* if 'Reset' */ { } else /* if 'Reset' */ {
$.getJSON('/modx/problem/${ id }/problem_reset', {'id':'${ id }'}, function(json) { $.getJSON('/modx/problem/${ id }/problem_reset', {'id':'${ id }'}, function(json) {
${ id }_load(); ${ id }_load();
//$('#main_${ id }').html(json);
//MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
}); });
} }
}); });
}); $('#save_${ id }').click(function() {
} var submit_data={};
$.each($("[id^=input_${ id }_]"), function(index,value){
submit_data[value.id]=value.value;});
$.getJSON('/modx/problem/${ id }/problem_save',
submit_data, function(data){
if(data.success) {
alert('Saved');
}}
);
});
}
);}
$(function() { $(function() {
${ id }_load(); ${ id }_load();
}); });
// CRITICAL TODO: Namespace // IMPORTANT TODO: Namespace
var ${ id }contents=["", var ${ id }contents=["",
%for t in items: %for t in items:
...@@ -7,19 +7,27 @@ var ${ id }contents=["", ...@@ -7,19 +7,27 @@ var ${ id }contents=["",
"" ""
]; ];
var ${ id }functions=["", var ${ id }init_functions=["",
%for t in items: %for t in items:
function(){ ${t[1]['init_js']} }, function(){ ${t[1]['init_js']} },
%endfor %endfor
""]; ""];
var ${ id }loc; var ${ id }destroy_functions=["",
%for t in items:
function(){ ${t[1]['destroy_js']} },
%endfor
""];
var ${ id }loc = -1;
function ${ id }goto(i) { function ${ id }goto(i) {
// TODO: // TODO:
// ${ id }contents[${ id }loc] = $('#content').html(); // ${ id }contents[${ id }loc] = $('#content').html();
if (${ id }loc!=-1)
${ id }init_functions[ ${ id }loc ]();
$('#content').html(${ id }contents[i]); $('#content').html(${ id }contents[i]);
${ id }functions[i]() ${ id }init_functions[i]()
$('#tt_'+${ id }loc).attr("style", "background-color:grey"); $('#tt_'+${ id }loc).attr("style", "background-color:grey");
${ id }loc=i; ${ id }loc=i;
$('#tt_'+i).attr("style", "background-color:red"); $('#tt_'+i).attr("style", "background-color:red");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment