Commit f4f5f815 by Piotr Mitros

Slightly more logging

parent a8d0bafc
......@@ -4,7 +4,10 @@
<input type="hidden" name="problem_id" value="${ problem['name'] }">
% if check_button:
<input id="check_${ id }" type="button" value="${ check_button }" >
<input id="check_${ id }" type="button" value="Check ${ attempts }" >
% endif
% if reset_button:
<input id="reset_${ id }" type="button" value="Reset ${ attempts }" >
% endif
% if save_button:
<input id="save_${ id }" type="button" value="Save" >
......
......@@ -9,39 +9,49 @@ function ${ id }_load() {
$.each($("[id^=input_${ id }_]"), function(index,value){
submit_data[value.id]=value.value;
});
$.getJSON('/modx/problem/${ id }/problem_check',
submit_data,
function(json) {
${ id }_load();
});
log_event('problem_check', submit_data);
});
if($('#check_${ id }').attr('value').substring(0,5) != 'Reset') {
$.getJSON('/modx/problem/${ id }/problem_check',
submit_data,
function(json) {
${ id }_load();
});
} else /* if 'Reset' */ {
$.getJSON('/modx/problem/${ id }/problem_reset', {'id':'${ id }'}, function(json) {
${ id }_load();
});
}
$('#reset_${ id }').click(function() {
var submit_data={};
$.each($("[id^=input_${ id }_]"), function(index,value){
submit_data[value.id]=value.value;
});
$.getJSON('/modx/problem/${ id }/problem_reset', {'id':'${ id }'}, function(json) {
${ id }_load();
});
log_event('problem_reset', submit_data);
});
$('#show_${ id }').click(function() {
$.getJSON('/modx/problem/${ id }/problem_show', function(data) {
for (var key in data) {
$("#answer_${ id }_"+key).text(data[key]);
}
});
log_event('problem_show', submit_data);
});
$('#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');
}}
);
$.getJSON('/modx/problem/${ id }/problem_save',
submit_data, function(data){
if(data.success) {
alert('Saved');
}}
);
log_event('problem_save', submit_data);
});
}
);}
$(function() {
${ id }_load();
});
});
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