Due dates and number of submissions work
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
<h2> ${ problem['name'] } </h2>
|
||||
${ problem['html'] }
|
||||
<br>
|
||||
|
||||
<input type="hidden" name="problem_id" value="${ problem['name'] }">
|
||||
% if check_button:
|
||||
<input id="check_${ id }" type="button" value="${ check_button }" >
|
||||
% endif
|
||||
% if save_button:
|
||||
<input id="save_${ id }" type="button" value="Save" >
|
||||
% endif
|
||||
|
||||
28
problem.js
28
problem.js
@@ -13,25 +13,27 @@ function ${ id }_load() {
|
||||
$.getJSON('/modx/problem/${ id }/problem_check',
|
||||
submit_data,
|
||||
function(json) {
|
||||
for(p in json) {
|
||||
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");
|
||||
}
|
||||
});
|
||||
${ id }_load();
|
||||
});
|
||||
} else /* if 'Reset' */ {
|
||||
$.getJSON('/modx/problem/${ id }/problem_reset', {'id':'${ id }'}, function(json) {
|
||||
${ 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() {
|
||||
${ id }_load();
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// CRITICAL TODO: Namespace
|
||||
// IMPORTANT TODO: Namespace
|
||||
|
||||
var ${ id }contents=["",
|
||||
%for t in items:
|
||||
@@ -7,19 +7,27 @@ var ${ id }contents=["",
|
||||
""
|
||||
];
|
||||
|
||||
var ${ id }functions=["",
|
||||
var ${ id }init_functions=["",
|
||||
%for t in items:
|
||||
function(){ ${t[1]['init_js']} },
|
||||
%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) {
|
||||
// TODO:
|
||||
// ${ id }contents[${ id }loc] = $('#content').html();
|
||||
if (${ id }loc!=-1)
|
||||
${ id }init_functions[ ${ id }loc ]();
|
||||
$('#content').html(${ id }contents[i]);
|
||||
${ id }functions[i]()
|
||||
${ id }init_functions[i]()
|
||||
$('#tt_'+${ id }loc).attr("style", "background-color:grey");
|
||||
${ id }loc=i;
|
||||
$('#tt_'+i).attr("style", "background-color:red");
|
||||
|
||||
Reference in New Issue
Block a user