Commit 64a9ec5b by ichuang Committed by Carson Gee

add problem reset link to staff debug page

parent 3b49c17c
...@@ -592,7 +592,7 @@ function goto( mode) ...@@ -592,7 +592,7 @@ function goto( mode)
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
%if msg: %if msg:
<p></p><p>${msg}</p> <p></p><p id="idash_msg">${msg}</p>
%endif %endif
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
......
...@@ -52,6 +52,70 @@ ${block_content} ...@@ -52,6 +52,70 @@ ${block_content}
<header> <header>
<h2>${_('Staff Debug')}</h2> <h2>${_('Staff Debug')}</h2>
</header> </header>
<script type="text/javascript">
var StaffDebug = (function(){
geturl = function(action){
var pathname = window.location.pathname;
var url = pathname.substr(0,pathname.indexOf('/courseware')) + '/' + action;
return url;
}
get_user = function(locname){
var uname = $('#sd_fu_' + locname).val();
if (uname==""){
uname = "${user.username}";
}
return uname;
}
do_idash_action = function(locname, idaction){
var pdata = {'csrfmiddlewaretoken': "${csrf_token}",
'action': idaction,
'problem_for_student': locname,
'unique_student_identifier': get_user(locname)
}
$.ajax({
type: "POST",
url: geturl('instructor'),
data: pdata,
success: function(data){
var msg = $("#idash_msg", data);
$( "#result_"+locname ).html( msg );
},
dataType: 'html'
});
}
reset = function(locname){
do_idash_action(locname, "Reset student's attempts");
}
sdelete = function(locname){
do_idash_action(locname, "Delete student state for module");
}
reload = function(locname){
var url = geturl('jump_to_id/' + locname);
window.location.replace(url);
}
return {reset: reset,
reload: reload,
sdelete: sdelete,
do_idash_action: do_idash_action
}
})();
</script>
[ <a href='javascript:StaffDebug.reset("${location.name}")'>${_('Reset Attempts')}</a> |
<a href='javascript:StaffDebug.reload("${location.name}")'>${_('Reload Page')}</a> |
<a href='javascript:StaffDebug.sdelete("${location.name}")'>${_('Delete State')}</a>
]
<span style="float:right">For user:<input type="text" id="sd_fu_${location.name}" /></span>
<div id="result_${location.name}"/>
<div class="staff_info" style="display:block"> <div class="staff_info" style="display:block">
is_released = ${is_released} is_released = ${is_released}
location = ${location | h} location = ${location | h}
......
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