Moving in Ike's new files, touches of multicourse
This commit is contained in:
committed by
Piotr Mitros
parent
15cae333d4
commit
8989605cba
@@ -62,7 +62,7 @@ def textline(element, value, state, msg=""):
|
||||
#-----------------------------------------------------------------------------
|
||||
# TODO: Make a wrapper for <formulainput>
|
||||
# TODO: Make an AJAX loop to confirm equation is okay in real-time as user types
|
||||
def js_textline(element, value, state, msg=""):
|
||||
def jstextline(element, value, state, msg=""):
|
||||
'''
|
||||
textline is used for simple one-line inputs, like formularesponse and symbolicresponse.
|
||||
'''
|
||||
@@ -76,7 +76,7 @@ def js_textline(element, value, state, msg=""):
|
||||
'dojs':dojs,
|
||||
'msg':msg,
|
||||
}
|
||||
html=render_to_string("textinput.html", context)
|
||||
html=render_to_string("jstext.html", context)
|
||||
return etree.XML(html)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
@@ -30,7 +30,7 @@ from lxml import etree
|
||||
import requests
|
||||
from copy import deepcopy
|
||||
|
||||
print "Warning: Dark code. Needs review before enabling in prod."
|
||||
print "[lib.sympy_check.formula] Warning: Dark code. Needs review before enabling in prod."
|
||||
|
||||
os.environ['PYTHONIOENCODING'] = 'utf-8'
|
||||
|
||||
|
||||
23
settings.py
23
settings.py
@@ -5,12 +5,35 @@ import tempfile
|
||||
|
||||
import djcelery
|
||||
|
||||
### Dark code. Should be enabled in local settings for devel.
|
||||
|
||||
ENABLE_MULTICOURSE = False # set to False to disable multicourse display (see lib.util.views.mitxhome)
|
||||
|
||||
###
|
||||
|
||||
|
||||
MITX_ROOT_URL = ''
|
||||
|
||||
COURSE_NAME = "6.002_Spring_2012"
|
||||
COURSE_NUMBER = "6.002x"
|
||||
COURSE_TITLE = "Circuits and Electronics"
|
||||
|
||||
COURSE_DEFAULT = '6.002_Spring_2012'
|
||||
|
||||
COURSE_LIST = {'6.002_Spring_2012': {'number' : '6.002x',
|
||||
'title' : 'Circuits and Electronics',
|
||||
'datapath': '6002x/',
|
||||
},
|
||||
'8.02_Spring_2013': {'number' : '8.02x',
|
||||
'title' : 'Electricity & Magnetism',
|
||||
'datapath': '802x/',
|
||||
},
|
||||
'8.01_Spring_2013': {'number' : '8.01x',
|
||||
'title' : 'Mechanics',
|
||||
'datapath': '801x/',
|
||||
},
|
||||
}
|
||||
|
||||
ROOT_URLCONF = 'urls'
|
||||
|
||||
# from settings2.askbotsettings import LIVESETTINGS_OPTIONS
|
||||
|
||||
16
templates/imageinput.html
Normal file
16
templates/imageinput.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<span>
|
||||
<input type="hidden" class="imageinput" src="${src}" name="input_${id}" id="input_${id}" value="${value}" />
|
||||
<div id="imageinput_${id}" onclick="image_input_click('${id}',event);" style = "background-image:url('${src}');width:${width}px;height:${height}px;position: relative; left: 0; top: 0;">
|
||||
<img src="/static/green-pointer.png" id="cross_${id}" style="position: absolute;top: ${gy}px;left: ${gx}px;" />
|
||||
</div>
|
||||
|
||||
% if state == 'unsubmitted':
|
||||
<span class="unanswered" style="display:inline-block;" id="status_${id}"></span>
|
||||
% elif state == 'correct':
|
||||
<span class="correct" id="status_${id}"></span>
|
||||
% elif state == 'incorrect':
|
||||
<span class="incorrect" id="status_${id}"></span>
|
||||
% elif state == 'incomplete':
|
||||
<span class="incorrect" id="status_${id}"></span>
|
||||
% endif
|
||||
</span>
|
||||
34
templates/jstextline.html
Normal file
34
templates/jstextline.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<section class="text-input">
|
||||
<input type="text" name="input_${id}" id="input_${id}" value="${value}"
|
||||
% if size:
|
||||
size="${size}"
|
||||
% endif
|
||||
% if dojs == 'math':
|
||||
onkeyup="DoUpdateMath('${id}')"
|
||||
% endif
|
||||
/>
|
||||
|
||||
% if dojs == 'math':
|
||||
<span id="display_${id}">`{::}`</span>
|
||||
% endif
|
||||
|
||||
<span id="answer_${id}"></span>
|
||||
|
||||
% if dojs == 'math':
|
||||
<textarea style="display:none" id="input_${id}_fromjs" name="input_${id}_fromjs"></textarea>
|
||||
% endif
|
||||
|
||||
% if state == 'unsubmitted':
|
||||
<span class="unanswered" style="display:inline-block;" id="status_${id}"></span>
|
||||
% elif state == 'correct':
|
||||
<span class="correct" id="status_${id}"></span>
|
||||
% elif state == 'incorrect':
|
||||
<span class="incorrect" id="status_${id}"></span>
|
||||
% elif state == 'incomplete':
|
||||
<span class="incorrect" id="status_${id}"></span>
|
||||
% endif
|
||||
% if msg:
|
||||
<br/>
|
||||
<span class="debug">${msg|n}</span>
|
||||
% endif
|
||||
</section>
|
||||
8
templates/mathstring.html
Normal file
8
templates/mathstring.html
Normal file
@@ -0,0 +1,8 @@
|
||||
<section class="math-string">
|
||||
% if isinline:
|
||||
<span>[mathjaxinline]${mathstr}[/mathjaxinline]</span>
|
||||
% else:
|
||||
<span>[mathjax]${mathstr}[/mathjax]</span>
|
||||
% endif
|
||||
<span>${tail}</span>
|
||||
</section>
|
||||
37
templates/mitxhome.html
Normal file
37
templates/mitxhome.html
Normal file
@@ -0,0 +1,37 @@
|
||||
<%inherit file="main.html" />
|
||||
|
||||
<%block name="js_extra">
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
//if(!page) {
|
||||
// cookie_page = $.cookie("book_page");
|
||||
// if(cookie_page) {
|
||||
// goto_page(cookie_page);
|
||||
// }
|
||||
//}
|
||||
|
||||
$(".handouts ol").treeview({collapsed:true, unique:true/*, cookieId: "treeview-book-nav", persist: "cookie"*/});
|
||||
});
|
||||
|
||||
</script>
|
||||
</%block>
|
||||
|
||||
<%block name="title"><title>MITx Home</title></%block>
|
||||
|
||||
<%include file="navigation.html" args="active_page='info'" />
|
||||
|
||||
<section class="main-content">
|
||||
<div class="info-wrapper">
|
||||
<section class="updates">
|
||||
<h2>Welcome to MITx</h2>
|
||||
<hr width="100%">
|
||||
<h3>Courses available:</h3>
|
||||
<ul>
|
||||
<li><a href=${ MITX_ROOT_URL }/courseware/6.002_Spring_2012/>6.002 (Spring 2012)</a></li>
|
||||
<li><a href=${ MITX_ROOT_URL }/courseware/8.02_Spring_2013/>8.02 (Spring 2013)</a></li>
|
||||
<li><a href=${ MITX_ROOT_URL }/courseware/8.01_Spring_2013/>8.01 (Spring 201x)</a></li>
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
@@ -2,7 +2,13 @@
|
||||
<div class="header-wrapper">
|
||||
<header>
|
||||
<hgroup>
|
||||
<h1><em>MITx</em></h1>
|
||||
<h1><em>
|
||||
% if settings.ENABLE_MULTICOURSE:
|
||||
<a href="${ MITX_ROOT_URL }/mitxhome" style="color:black;">MITx</a>
|
||||
% else:
|
||||
MITx
|
||||
% endif
|
||||
</em></h1>
|
||||
<h2><a href="${ MITX_ROOT_URL }/courseware/">${ settings.COURSE_TITLE }</a></h2>
|
||||
</hgroup>
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@ function ${ id }_content_updated() {
|
||||
update_schematics();
|
||||
|
||||
$('#check_${ id }').unbind('click').click(function() {
|
||||
$("input.schematic").each(function(index,element){ element.schematic.update_value(); });
|
||||
$("input.schematic").each(function(index,element){ element.schematic.update_value(); });
|
||||
$(".CodeMirror").each(function(index,element){ if (element.CodeMirror.save) element.CodeMirror.save(); });
|
||||
var submit_data={};
|
||||
$.each($("[id^=input_${ id }_]"), function(index,value){
|
||||
if (value.type==="checkbox"){
|
||||
@@ -52,6 +53,8 @@ function ${ 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) {
|
||||
|
||||
Reference in New Issue
Block a user