Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
da64c8f0
Commit
da64c8f0
authored
Aug 11, 2012
by
ichuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add xqa interface to staff_problem_info, make staff_debug a modal
window, add xqa modal window, add xqa_key to course metadata
parent
241d445f
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
126 additions
and
14 deletions
+126
-14
common/djangoapps/xmodule_modifiers.py
+7
-3
common/lib/xmodule/xmodule/x_module.py
+2
-1
common/lib/xmodule/xmodule/xml_module.py
+1
-0
lms/djangoapps/courseware/module_render.py
+1
-1
lms/templates/staff_problem_info.html
+115
-9
No files found.
common/djangoapps/xmodule_modifiers.py
View file @
da64c8f0
...
@@ -69,14 +69,14 @@ def grade_histogram(module_id):
...
@@ -69,14 +69,14 @@ def grade_histogram(module_id):
return
grades
return
grades
def
add_histogram
(
get_html
,
module
):
def
add_histogram
(
get_html
,
module
,
user
):
"""
"""
Updates the supplied module with a new get_html function that wraps
Updates the supplied module with a new get_html function that wraps
the output of the old get_html function with additional information
the output of the old get_html function with additional information
for admin users only, including a histogram of student answers and the
for admin users only, including a histogram of student answers and the
definition of the xmodule
definition of the xmodule
Does nothing if module is a SequenceModule
Does nothing if module is a SequenceModule
or a VerticalModule.
"""
"""
@wraps
(
get_html
)
@wraps
(
get_html
)
def
_get_html
():
def
_get_html
():
...
@@ -104,8 +104,12 @@ def add_histogram(get_html, module):
...
@@ -104,8 +104,12 @@ def add_histogram(get_html, module):
staff_context
=
{
'definition'
:
module
.
definition
.
get
(
'data'
),
staff_context
=
{
'definition'
:
module
.
definition
.
get
(
'data'
),
'metadata'
:
json
.
dumps
(
module
.
metadata
,
indent
=
4
),
'metadata'
:
json
.
dumps
(
module
.
metadata
,
indent
=
4
),
'element_id'
:
module
.
location
.
html_id
(),
'location'
:
module
.
location
,
'xqa_key'
:
module
.
metadata
.
get
(
'xqa_key'
,
''
),
'category'
:
str
(
module
.
__class__
.
__name__
),
'element_id'
:
module
.
location
.
html_id
()
.
replace
(
'-'
,
'_'
),
'edit_link'
:
edit_link
,
'edit_link'
:
edit_link
,
'user'
:
user
,
'histogram'
:
json
.
dumps
(
histogram
),
'histogram'
:
json
.
dumps
(
histogram
),
'render_histogram'
:
render_histogram
,
'render_histogram'
:
render_histogram
,
'module_content'
:
get_html
()}
'module_content'
:
get_html
()}
...
...
common/lib/xmodule/xmodule/x_module.py
View file @
da64c8f0
...
@@ -319,7 +319,8 @@ class XModuleDescriptor(Plugin, HTMLSnippet):
...
@@ -319,7 +319,8 @@ class XModuleDescriptor(Plugin, HTMLSnippet):
# A list of metadata that this module can inherit from its parent module
# A list of metadata that this module can inherit from its parent module
inheritable_metadata
=
(
inheritable_metadata
=
(
'graded'
,
'start'
,
'due'
,
'graceperiod'
,
'showanswer'
,
'rerandomize'
,
'graded'
,
'start'
,
'due'
,
'graceperiod'
,
'showanswer'
,
'rerandomize'
,
# TODO (ichuang): used for Fall 2012 xqa server access
'xqa_key'
,
# TODO: This is used by the XMLModuleStore to provide for locations for
# TODO: This is used by the XMLModuleStore to provide for locations for
# static files, and will need to be removed when that code is removed
# static files, and will need to be removed when that code is removed
'data_dir'
'data_dir'
...
...
common/lib/xmodule/xmodule/xml_module.py
View file @
da64c8f0
...
@@ -80,6 +80,7 @@ class XmlDescriptor(XModuleDescriptor):
...
@@ -80,6 +80,7 @@ class XmlDescriptor(XModuleDescriptor):
metadata_attributes
=
(
'format'
,
'graceperiod'
,
'showanswer'
,
'rerandomize'
,
metadata_attributes
=
(
'format'
,
'graceperiod'
,
'showanswer'
,
'rerandomize'
,
'start'
,
'due'
,
'graded'
,
'display_name'
,
'url_name'
,
'hide_from_toc'
,
'start'
,
'due'
,
'graded'
,
'display_name'
,
'url_name'
,
'hide_from_toc'
,
'ispublic'
,
# if True, then course is listed for all users; see
'ispublic'
,
# if True, then course is listed for all users; see
'xqa_key'
,
# for xqaa server access
# VS[compat] Remove once unused.
# VS[compat] Remove once unused.
'name'
,
'slug'
)
'name'
,
'slug'
)
...
...
lms/djangoapps/courseware/module_render.py
View file @
da64c8f0
...
@@ -197,7 +197,7 @@ def get_module(user, request, location, student_module_cache, position=None):
...
@@ -197,7 +197,7 @@ def get_module(user, request, location, student_module_cache, position=None):
if
settings
.
MITX_FEATURES
.
get
(
'DISPLAY_HISTOGRAMS_TO_STAFF'
):
if
settings
.
MITX_FEATURES
.
get
(
'DISPLAY_HISTOGRAMS_TO_STAFF'
):
if
has_staff_access_to_course
(
user
,
module
.
location
.
course
):
if
has_staff_access_to_course
(
user
,
module
.
location
.
course
):
module
.
get_html
=
add_histogram
(
module
.
get_html
,
module
)
module
.
get_html
=
add_histogram
(
module
.
get_html
,
module
,
user
)
return
module
return
module
...
...
lms/templates/staff_problem_info.html
View file @
da64c8f0
${module_content}
${module_content}
%if edit_link:
%if edit_link:
<div><a
href=
"${edit_link}"
>
Edit
</a></div>
<div><a
href=
"${edit_link}"
>
Edit
</a>
/
<a
href=
"#${element_id}_xqa-modal"
onclick=
"getlog_${element_id}()"
id=
"${element_id}_xqa_log"
>
QA
</a>
</div>
% endif
% endif
<div><a
href=
"
javascript:void(0)"
onclick=
"javascript:$('#${element_id}_debug').slideToggle()
"
>
Staff Debug Info
</a></div>
<div><a
href=
"
#${element_id}_debug"
id=
"${element_id}_trig
"
>
Staff Debug Info
</a></div>
<span
style=
"display:none"
id=
"${element_id}_debug"
>
<section
id=
"${element_id}_xqa-modal"
class=
"modal xqa-modal"
style=
"width:80%; left:20%; height:80%; overflow:auto"
>
<div
class=
"staff_info"
>
<div
class=
"inner-wrapper"
>
<header>
<h2>
edX Content Quality Assessment
</h2>
</header>
<form
id=
"${element_id}_xqa_form"
class=
"xqa_form"
>
<label>
Comment
</label>
<input
id=
"${element_id}_xqa_entry"
type=
"text"
placeholder=
"comment"
>
<label>
Tag
</label>
<span
style=
"color:black;vertical-align: -10pt"
>
Optional tag (eg "done" or "broken"):
</span>
<input
id=
"${element_id}_xqa_tag"
type=
"text"
placeholder=
"tag"
style=
"width:80px;display:inline"
>
<div
class=
"submit"
>
<button
name=
"submit"
type=
"submit"
>
Add comment
</button>
</div>
<hr>
<div
id=
"${element_id}_xqa_log_data"
></div>
</form>
</div>
</section>
<section
class=
"modal staff-modal"
id=
"${element_id}_debug"
style=
"width:80%; left:20%; height:80%; overflow:auto;"
>
<div
class=
"inner-wrapper"
style=
"color:black"
>
<header>
<h2>
Staff Debug
</h2>
</header>
<div
class=
"staff_info"
>
location = ${location | h}
github =
<a
href=
"${edit_link}"
>
${edit_link | h}
</a>
definition =
<pre>
${definition | h}
</pre>
definition =
<pre>
${definition | h}
</pre>
metadata = ${metadata | h}
metadata = ${metadata | h}
</div>
category = ${category | h}
%if render_histogram:
</div>
<div
id=
"histogram_${element_id}"
class=
"histogram"
data-histogram=
"${histogram}"
></div>
%if render_histogram:
%endif
<div
id=
"histogram_${element_id}"
class=
"histogram"
data-histogram=
"${histogram}"
></div>
</span>
%endif
</div>
</section>
<div
id=
"${element_id}_setup"
></div>
## leanModal needs to be included here otherwise this breaks when in a
<vertical>
<script
type=
"text/javascript"
src=
"/static/js/vendor/jquery.leanModal.min.js"
></script>
<script
type=
"text/javascript"
>
function
setup_debug_$
{
element_id
}(){
$
(
'#${element_id}_trig'
).
leanModal
();
$
(
'#${element_id}_xqa_log'
).
leanModal
();
$
(
'#${element_id}_xqa_form'
).
submit
(
sendlog_$
{
element_id
});
}
setup_debug_$
{
element_id
}();
function
sendlog_$
{
element_id
}(){
var
xqaLog
=
{
authkey
:
'${xqa_key}'
,
location
:
'${location}'
,
%
if
edit_link
:
giturl
:
'${edit_link}'
,
%
endif
category
:
'${category}'
,
username
:
'${user.username}'
,
return
:
'query'
,
format
:
'html'
,
email
:
'${user.email}'
,
tag
:
$
(
'#${element_id}_xqa_tag'
).
val
(),
entry
:
$
(
'#${element_id}_xqa_entry'
).
val
()};
$
.
ajax
({
url
:
'http://zion.ike.net:9001/log'
,
type
:
'GET'
,
contentType
:
'application/json'
,
data
:
JSON
.
stringify
(
xqaLog
),
crossDomain
:
true
,
dataType
:
'jsonp'
,
timeout
:
1000
,
success
:
function
(
result
)
{
$
(
'#${element_id}_xqa_log_data'
).
html
(
result
);
},
error
:
function
()
{
alert
(
'Error: cannot connect to XQA server'
);
console
.
log
(
'error!'
);
}
});
return
false
;
};
function
getlog_$
{
element_id
}(){
var
xqaQuery
=
{
authkey
:
'${xqa_key}'
,
location
:
'${location}'
,
format
:
'html'
};
$
.
ajax
({
url
:
'http://zion.ike.net:9001/query'
,
type
:
'GET'
,
contentType
:
'application/json'
,
data
:
JSON
.
stringify
(
xqaQuery
),
crossDomain
:
true
,
dataType
:
'jsonp'
,
timeout
:
1000
,
success
:
function
(
result
)
{
$
(
'#${element_id}_xqa_log_data'
).
html
(
result
);
},
error
:
function
()
{
alert
(
'Error: cannot connect to XQA server'
);
}
});
};
</script>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment