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
709012e3
Commit
709012e3
authored
Aug 26, 2014
by
Don Mitchell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4965 from edx/split/lms_bugs
Split/lms bugs
parents
f5f4326b
49ed7328
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
75 deletions
+68
-75
common/static/js/src/utility.js
+3
-2
lms/templates/courseware/xqa_interface.html
+65
-73
No files found.
common/static/js/src/utility.js
View file @
709012e3
...
@@ -35,8 +35,9 @@ window.rewriteStaticLinks = function(content, from, to) {
...
@@ -35,8 +35,9 @@ window.rewriteStaticLinks = function(content, from, to) {
}
}
// change all relative urls only which may be embedded inside other tags in content.
// change all relative urls only which may be embedded inside other tags in content.
// handle http and https
// handle http and https
// note: add other protocols here
// escape all regex interpretable chars
var
regex
=
new
RegExp
(
"(https?:
\
/
\
/(www
\
.)?[-a-zA-Z0-9@:%._
\
+~#=]{2,256}
\
.[a-z]{2,6}([-a-zA-Z0-9@:%_
\
+.~#?&//=]*))?"
+
from
,
'g'
);
fromRe
=
from
.
replace
(
/
[
-
\/\\
^$*+?.()|[
\]
{}
]
/g
,
'
\\
$&'
);
var
regex
=
new
RegExp
(
"(https?:
\
/
\
/(www
\
.)?[-a-zA-Z0-9@:%._
\
+~#=]{2,256}
\
.[a-z]{2,6}([-a-zA-Z0-9@:%_
\
+.~#?&//=]*))?"
+
fromRe
,
'g'
);
return
content
.
replace
(
regex
,
replacer
);
return
content
.
replace
(
regex
,
replacer
);
};
};
...
...
lms/templates/courseware/xqa_interface.html
View file @
709012e3
...
@@ -5,90 +5,82 @@
...
@@ -5,90 +5,82 @@
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
function
setup_debug
(
element_id
,
edit_link
,
staff_context
){
function
setup_debug
(
element_id
,
edit_link
,
staff_context
){
$
(
'#'
+
element_id
+
'_trig'
).
leanModal
();
$
(
'#'
+
element_id
+
'_trig'
).
leanModal
();
$
(
'#'
+
element_id
+
'_xqa_log'
).
leanModal
();
$
(
'#'
+
element_id
+
'_xqa_log'
).
leanModal
();
$
(
'#'
+
element_id
+
'_xqa_form'
).
submit
(
function
()
{
sendlog
(
element_id
,
edit_link
,
staff_context
);});
$
(
'#'
+
element_id
+
'_xqa_form'
).
submit
(
function
()
{
sendlog
(
element_id
,
edit_link
,
staff_context
);});
$
(
"#"
+
element_id
+
"_history_trig"
).
leanModal
();
$
(
"#"
+
element_id
+
"_history_trig"
).
leanModal
();
$
(
'#'
+
element_id
+
'_history_form'
).
submit
(
$
(
'#'
+
element_id
+
'_history_form'
).
submit
(
function
()
{
function
()
{
var
username
=
$
(
"#"
+
element_id
+
"_history_student_username"
).
val
();
var
username
=
$
(
"#"
+
element_id
+
"_history_student_username"
).
val
();
var
location
=
$
(
"#"
+
element_id
+
"_history_location"
).
val
();
var
location
=
$
(
"#"
+
element_id
+
"_history_location"
).
val
();
// This is a ridiculous way to get the course_id, but I'm not sure
$
(
"#"
+
element_id
+
"_history_text"
).
load
(
'/courses/'
+
"${unicode(course.id)}"
+
// how to do it sensibly from within the staff debug code.
"/submission_history/"
+
username
+
"/"
+
location
);
// staff_problem_info.html is rendered through a wrapper to get_html
return
false
;
// that's injected by the code that adds the histogram -- it's all
}
// kinda bizarre, and it remains awkward to simply ask "what course
);
// is this problem being shown in the context of."
var
path_parts
=
window
.
location
.
pathname
.
split
(
'/'
);
var
course_id
=
path_parts
[
2
]
+
"/"
+
path_parts
[
3
]
+
"/"
+
path_parts
[
4
];
$
(
"#"
+
element_id
+
"_history_text"
).
load
(
'/courses/'
+
course_id
+
"/submission_history/"
+
username
+
"/"
+
location
);
return
false
;
}
);
}
}
function
sendlog
(
element_id
,
edit_link
,
staff_context
){
function
sendlog
(
element_id
,
edit_link
,
staff_context
){
var
xqaLog
=
{
var
xqaLog
=
{
authkey
:
staff_context
.
xqa_key
,
authkey
:
staff_context
.
xqa_key
,
location
:
staff_context
.
location
,
location
:
staff_context
.
location
,
category
:
staff_context
.
category
,
category
:
staff_context
.
category
,
'username'
:
staff_context
.
user
.
username
,
'username'
:
staff_context
.
user
.
username
,
'return'
:
'query'
,
'return'
:
'query'
,
format
:
'html'
,
format
:
'html'
,
email
:
staff_context
.
user
.
email
,
email
:
staff_context
.
user
.
email
,
tag
:
$
(
'#'
+
element_id
+
'_xqa_tag'
).
val
(),
tag
:
$
(
'#'
+
element_id
+
'_xqa_tag'
).
val
(),
entry
:
$
(
'#'
+
element_id
+
'_xqa_entry'
).
val
()
entry
:
$
(
'#'
+
element_id
+
'_xqa_entry'
).
val
()
};
};
$
.
ajax
({
$
.
ajax
({
url
:
'${xqa_server}/log'
,
url
:
'${xqa_server}/log'
,
type
:
'GET'
,
type
:
'GET'
,
contentType
:
'application/json'
,
contentType
:
'application/json'
,
data
:
JSON
.
stringify
(
xqaLog
),
data
:
JSON
.
stringify
(
xqaLog
),
crossDomain
:
true
,
crossDomain
:
true
,
dataType
:
'jsonp'
,
dataType
:
'jsonp'
,
beforeSend
:
function
(
xhr
)
{
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"Authorization"
,
"Basic eHFhOmFnYXJ3YWw="
);
},
xhr
.
setRequestHeader
(
"Authorization"
,
"Basic eHFhOmFnYXJ3YWw="
);
},
timeout
:
1000
,
timeout
:
1000
,
success
:
function
(
result
)
{
success
:
function
(
result
)
{
$
(
'#'
+
element_id
+
'_xqa_log_data'
).
html
(
result
);
$
(
'#'
+
element_id
+
'_xqa_log_data'
).
html
(
result
);
},
},
error
:
function
()
{
error
:
function
()
{
alert
(
'Error: cannot connect to XQA server'
);
alert
(
'Error: cannot connect to XQA server'
);
console
.
log
(
'error!'
);
console
.
log
(
'error!'
);
}
}
});
});
return
false
;
return
false
;
};
};
function
getlog
(
element_id
,
staff_context
){
function
getlog
(
element_id
,
staff_context
){
var
xqaQuery
=
{
var
xqaQuery
=
{
authkey
:
staff_context
.
xqa_key
,
authkey
:
staff_context
.
xqa_key
,
location
:
staff_context
.
location
,
location
:
staff_context
.
location
,
format
:
'html'
format
:
'html'
};
};
$
.
ajax
({
$
.
ajax
({
url
:
'${xqa_server}/query'
,
url
:
'${xqa_server}/query'
,
type
:
'GET'
,
type
:
'GET'
,
contentType
:
'application/json'
,
contentType
:
'application/json'
,
data
:
JSON
.
stringify
(
xqaQuery
),
data
:
JSON
.
stringify
(
xqaQuery
),
crossDomain
:
true
,
crossDomain
:
true
,
dataType
:
'jsonp'
,
dataType
:
'jsonp'
,
timeout
:
1000
,
timeout
:
1000
,
success
:
function
(
result
)
{
success
:
function
(
result
)
{
$
(
'#'
+
element_id
+
'_xqa_log_data'
).
html
(
result
);
$
(
'#'
+
element_id
+
'_xqa_log_data'
).
html
(
result
);
},
},
error
:
function
()
{
error
:
function
()
{
alert
(
'Error: cannot connect to XQA server'
);
alert
(
'Error: cannot connect to XQA server'
);
}
}
});
});
};
};
...
...
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