Slightly more logging
This commit is contained in:
@@ -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" >
|
||||
|
||||
48
problem.js
48
problem.js
@@ -9,39 +9,49 @@ function ${ id }_load() {
|
||||
$.each($("[id^=input_${ id }_]"), function(index,value){
|
||||
submit_data[value.id]=value.value;
|
||||
});
|
||||
|
||||
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();
|
||||
});
|
||||
}
|
||||
$.getJSON('/modx/problem/${ id }/problem_check',
|
||||
submit_data,
|
||||
function(json) {
|
||||
${ id }_load();
|
||||
});
|
||||
log_event('problem_check', submit_data);
|
||||
});
|
||||
|
||||
$('#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();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user