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
7b390a69
Commit
7b390a69
authored
Jul 03, 2012
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused lms/problem.js
parent
e0fc5904
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
131 deletions
+0
-131
lms/templates/problem.js
+0
-131
No files found.
lms/templates/problem.js
deleted
100644 → 0
View file @
e0fc5904
function
$
{
id
}
_content_updated
()
{
MathJax
.
Hub
.
Queue
([
"Typeset"
,
MathJax
.
Hub
]);
update_schematics
();
// dynamic math display: generate MathML on click
$
.
each
(
$
(
"[id^=display_${ id }_]"
),
function
(
index
,
value
){
theid
=
value
.
id
.
replace
(
"display_"
,
""
);
// ID of the response
if
(
document
.
getElementById
(
"input_"
+
theid
)){
MathJax
.
Hub
.
queue
.
Push
(
function
()
{
math
=
MathJax
.
Hub
.
getAllJax
(
value
.
id
)[
0
];
if
(
math
){
math
.
Text
(
document
.
getElementById
(
"input_"
+
theid
).
value
);
}
});
};
});
$
(
'#check_${ id }'
).
unbind
(
'click'
).
click
(
function
()
{
$
(
"input.schematic"
).
each
(
function
(
index
,
element
){
element
.
schematic
.
update_value
();
});
$
(
".CodeMirror"
).
each
(
function
(
index
,
element
){
if
(
element
.
CodeMirror
.
save
)
element
.
CodeMirror
.
save
();
});
// dynamic math display: generate MathML on click
$
.
each
(
$
(
"[id^=input_${ id }_]"
),
function
(
index
,
value
){
theid
=
value
.
id
.
replace
(
"input_"
,
""
);
// ID of the response
if
(
document
.
getElementById
(
"display_"
+
theid
)){
MathJax
.
Hub
.
queue
.
Push
(
function
()
{
math
=
MathJax
.
Hub
.
getAllJax
(
"display_"
+
theid
)[
0
];
if
(
math
){
math
.
Text
(
document
.
getElementById
(
"input_"
+
theid
).
value
);
UpdateMathML
(
math
,
theid
);
}
});
};
});
var
submit_data
=
{};
$
.
each
(
$
(
"[id^=input_${ id }_]"
),
function
(
index
,
value
){
if
(
value
.
type
===
"checkbox"
){
if
(
value
.
checked
)
{
if
(
typeof
submit_data
[
value
.
name
]
==
'undefined'
){
submit_data
[
value
.
name
]
=
[];
}
submit_data
[
value
.
name
].
push
(
value
.
value
);
}
}
if
(
value
.
type
===
"radio"
){
if
(
value
.
checked
)
{
submit_data
[
value
.
name
]
=
value
.
value
;
}
}
else
{
submit_data
[
value
.
id
]
=
value
.
value
;
}
});
postJSON
(
'${ MITX_ROOT_URL }/modx/problem/${ id }/problem_check'
,
submit_data
,
function
(
json
)
{
switch
(
json
.
success
)
{
case
'incorrect'
:
// Worked, but answer not
case
'correct'
:
$
(
'#main_${ id }'
).
html
(
json
.
contents
);
$
{
id
}
_content_updated
();
break
;
default
:
alert
(
json
.
success
);
}
}
);
log_event
(
'problem_check'
,
submit_data
);
});
$
(
'#reset_${ id }'
).
unbind
(
'click'
).
click
(
function
()
{
var
submit_data
=
{};
$
.
each
(
$
(
"[id^=input_${ id }_]"
),
function
(
index
,
value
){
submit_data
[
value
.
id
]
=
value
.
value
;
});
postJSON
(
'${ MITX_ROOT_URL }/modx/problem/${ id }/problem_reset'
,
{
'id'
:
'${ id }'
},
function
(
html_as_json
)
{
$
(
'#main_${ id }'
).
html
(
html_as_json
);
$
{
id
}
_content_updated
();
});
log_event
(
'problem_reset'
,
submit_data
);
});
// show answer button
// TODO: the button should turn into "hide answer" afterwards
$
(
'#show_${ id }'
).
unbind
(
'click'
).
click
(
function
()
{
postJSON
(
'${ MITX_ROOT_URL }/modx/problem/${ id }/problem_show'
,
{},
function
(
data
)
{
for
(
var
key
in
data
)
{
if
(
$
.
isArray
(
data
[
key
])){
for
(
var
ans_index
in
data
[
key
]){
var
choice_id
=
'input_'
+
key
+
'_'
+
data
[
key
][
ans_index
];
$
(
"label[for="
+
choice_id
+
"]"
).
attr
(
"correct_answer"
,
"true"
);
}
}
// $("#answer_"+key).text(data[key]);
$
(
"#answer_"
+
key
).
html
(
data
[
key
]);
}
});
for
(
var
key
in
codemirror_set
)
{
codemirror_set
[
key
].
refresh
();
}
log_event
(
'problem_show'
,
{
'problem'
:
'${ id }'
});
});
$
(
'#save_${ id }'
).
unbind
(
'click'
).
click
(
function
()
{
$
(
"input.schematic"
).
each
(
function
(
index
,
element
){
element
.
schematic
.
update_value
();
});
var
submit_data
=
{};
$
.
each
(
$
(
"[id^=input_${ id }_]"
),
function
(
index
,
value
)
{
submit_data
[
value
.
id
]
=
value
.
value
;
});
postJSON
(
'${ MITX_ROOT_URL }/modx/problem/${ id }/problem_save'
,
submit_data
,
function
(
data
)
{
if
(
data
.
success
)
{
alert
(
'Saved'
);
}});
log_event
(
'problem_save'
,
submit_data
);
});
}
function
$
{
id
}
_load
()
{
$
(
'#main_${ id }'
).
load
(
'${ ajax_url }problem_get?id=${ id }'
,
$
{
id
}
_content_updated
);
}
$
(
function
()
{
$
{
id
}
_load
();
});
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