Commit d25c8f08 by ichuang

fixes to quickedit and dogfood to use new static/coffee/* and ajax

parent 75e36e83
...@@ -28,7 +28,7 @@ def check_problem_code(ans,the_lcp,correct_answers,false_answers): ...@@ -28,7 +28,7 @@ def check_problem_code(ans,the_lcp,correct_answers,false_answers):
msg += '<hr width="100%"/>' msg += '<hr width="100%"/>'
endmsg = """<p><font size="-1" color="purple">Note: if the code text box disappears after clicking on "Check", endmsg = """<p><font size="-1" color="purple">Note: if the code text box disappears after clicking on "Check",
please click on "Show Answer" to make it refresh properly. This is a please type something in the box to make it refresh properly. This is a
bug with Chrome; it does not happen with Firefox. It is being fixed. bug with Chrome; it does not happen with Firefox. It is being fixed.
</font></p>""" </font></p>"""
......
...@@ -187,6 +187,7 @@ def quickedit(request, id=None, qetemplate='quickedit.html',coursename=None): ...@@ -187,6 +187,7 @@ def quickedit(request, id=None, qetemplate='quickedit.html',coursename=None):
xml, xml,
id, id,
state=None) state=None)
log.info('ajax_url = ' + instance.ajax_url)
# create empty student state for this problem, if not previously existing # create empty student state for this problem, if not previously existing
s = StudentModule.objects.filter(student=request.user, s = StudentModule.objects.filter(student=request.user,
...@@ -242,9 +243,10 @@ def quickedit(request, id=None, qetemplate='quickedit.html',coursename=None): ...@@ -242,9 +243,10 @@ def quickedit(request, id=None, qetemplate='quickedit.html',coursename=None):
lcp = instance.lcp lcp = instance.lcp
# get the rendered problem HTML # get the rendered problem HTML
phtml = instance.get_problem_html() phtml = instance.get_html()
init_js = instance.get_init_js() # phtml = instance.get_problem_html()
destory_js = instance.get_destroy_js() # init_js = instance.get_init_js()
# destory_js = instance.get_destroy_js()
context = {'id':id, context = {'id':id,
'msg' : msg, 'msg' : msg,
...@@ -252,8 +254,8 @@ def quickedit(request, id=None, qetemplate='quickedit.html',coursename=None): ...@@ -252,8 +254,8 @@ def quickedit(request, id=None, qetemplate='quickedit.html',coursename=None):
'filename' : lcp.fileobject.name, 'filename' : lcp.fileobject.name,
'pxmls' : pxmls, 'pxmls' : pxmls,
'phtml' : phtml, 'phtml' : phtml,
"destroy_js":destory_js, "destroy_js":'',
'init_js':init_js, 'init_js':'',
'csrf':csrf(request)['csrf_token'], 'csrf':csrf(request)['csrf_token'],
} }
......
...@@ -10,28 +10,53 @@ ...@@ -10,28 +10,53 @@
<link rel="stylesheet" href="${static.url('js/jquery.treeview.css')}" type="text/css" media="all" /> <link rel="stylesheet" href="${static.url('js/jquery.treeview.css')}" type="text/css" media="all" />
## <link rel="stylesheet" href="${ settings.LIB_URL }jquery.treeview.css" type="text/css" media="all" /> ## <link rel="stylesheet" href="${ settings.LIB_URL }jquery.treeview.css" type="text/css" media="all" />
## <link rel="stylesheet" href="/static/sass/application.css" type="text/css" media="all" / > ## <link rel="stylesheet" href="/static/sass/application.css" type="text/css" media="all" / >
<link rel="stylesheet" href="/static/css/codemirror.css" type="text/css" media="all" />
<script type="text/javascript" src="${ settings.LIB_URL }jquery-1.6.2.min.js"></script> % if settings.MITX_FEATURES['USE_DJANGO_PIPELINE']:
<script type="text/javascript" src="${ settings.LIB_URL }jquery-ui-1.8.16.custom.min.js"></script> ## <%static:css group='application'/>
% endif
% if not settings.MITX_FEATURES['USE_DJANGO_PIPELINE']:
## <link rel="stylesheet" href="/static/sass/application.css" type="text/css" media="all" / >
% endif
<script type="text/javascript" src="${static.url('js/jquery-1.6.2.min.js')}"></script>
<script type="text/javascript" src="${static.url('js/jquery-ui-1.8.16.custom.min.js')}"></script>
<script type="text/javascript" src="${static.url('js/swfobject/swfobject.js')}"></script> <script type="text/javascript" src="${static.url('js/swfobject/swfobject.js')}"></script>
<script type="text/javascript" src="${ settings.LIB_URL }codemirror-compressed.js"></script>
<script type="text/javascript" src="/static/js/schematic.js"></script>
<script type="text/javascript" src="/static/coffee/src/courseware.js"></script> % if settings.MITX_FEATURES['USE_DJANGO_PIPELINE']:
<script type="text/javascript" src="/static/coffee/src/feedback_form.js"></script> <%static:js group='application'/>
<script type="text/javascript" src="/static/coffee/src/calculator.js"></script> % endif
<script type="text/javascript" src="/static/coffee/src/main.js"></script>
% if not settings.MITX_FEATURES['USE_DJANGO_PIPELINE']:
% for jsfn in [ '/static/%s' % x.replace('.coffee','.js') for x in settings.PIPELINE_JS['application']['source_filenames'] ]:
<script type="text/javascript" src="${jsfn}"></script>
% endfor
% endif
## codemirror
<link rel="stylesheet" href="/static/css/codemirror.css" type="text/css" media="all" />
<script type="text/javascript" src="${ settings.LIB_URL }codemirror-compressed.js"></script>
## alternate codemirror
## <script type="text/javascript" src="/static/js/CodeMirror-2.25/lib/codemirror.js"></script>
## <script type="text/javascript" src="/static/js/CodeMirror-2.25/mode/xml/xml.js"></script>
## <script type="text/javascript" src="/static/js/CodeMirror-2.25/mode/python/python.js"></script>
## image input: for clicking on images (see imageinput.html)
<script type="text/javascript" src="/static/js/imageinput.js"></script>
<%include file="mathjax_include.html" /> <%include file="mathjax_include.html" />
</head> </head>
<body> <body class="courseware">
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="/static/js/html5shiv.js"></script> <script src="/static/js/html5shiv.js"></script>
<![endif]--> <![endif]-->
<div class="courseware"></div>
## ----------------------------------------------------------------------------- ## -----------------------------------------------------------------------------
## information ## information
...@@ -90,15 +115,19 @@ ...@@ -90,15 +115,19 @@
} }
</style> </style>
<form> <meta name="path_prefix" content="${MITX_ROOT_URL}">
${phtml}
</form> <section class="course-content">
<form>
${phtml}
</form>
</section>
<script type="text/javascript" src="${static.url('js/jquery.treeview.js')}"></script> <script type="text/javascript" src="${static.url('js/jquery.treeview.js')}"></script>
<script type="text/javascript" src="${static.url('js/jquery.leanModal.min.js')}"></script> <script type="text/javascript" src="${static.url('js/jquery.leanModal.min.js')}"></script>
<script type="text/javascript" src="${static.url('js/jquery.qtip.min.js')}"></script> <script type="text/javascript" src="${static.url('js/jquery.qtip.min.js')}"></script>
<script type="text/javascript" src="${static.url('js/jquery.cookie.js')}"></script> <script type="text/javascript" src="${static.url('js/jquery.cookie.js')}"></script>
<script type="text/javascript" src="${static.url('js/video_player.js')}"></script> ## <script type="text/javascript" src="${static.url('js/video_player.js')}"></script>
<script type="text/javascript" src="${static.url('js/schematic.js')}"></script> <script type="text/javascript" src="${static.url('js/schematic.js')}"></script>
<script type="text/javascript" src="${static.url('js/cktsim.js')}"></script> <script type="text/javascript" src="${static.url('js/cktsim.js')}"></script>
......
...@@ -11,18 +11,47 @@ ...@@ -11,18 +11,47 @@
## <link rel="stylesheet" href="${ settings.LIB_URL }jquery.treeview.css" type="text/css" media="all" /> ## <link rel="stylesheet" href="${ settings.LIB_URL }jquery.treeview.css" type="text/css" media="all" />
## <link rel="stylesheet" href="/static/sass/application.css" type="text/css" media="all" / > ## <link rel="stylesheet" href="/static/sass/application.css" type="text/css" media="all" / >
<link rel="stylesheet" href="/static/css/codemirror.css" type="text/css" media="all" /> % if settings.MITX_FEATURES['USE_DJANGO_PIPELINE']:
<%static:css group='application'/>
% endif
<script type="text/javascript" src="${ settings.LIB_URL }jquery-1.6.2.min.js"></script> % if not settings.MITX_FEATURES['USE_DJANGO_PIPELINE']:
<script type="text/javascript" src="${ settings.LIB_URL }jquery-ui-1.8.16.custom.min.js"></script> ## <link rel="stylesheet" href="/static/sass/application.css" type="text/css" media="all" / >
% endif
<script type="text/javascript" src="${static.url('js/jquery-1.6.2.min.js')}"></script>
<script type="text/javascript" src="${static.url('js/jquery-ui-1.8.16.custom.min.js')}"></script>
<script type="text/javascript" src="${static.url('js/swfobject/swfobject.js')}"></script> <script type="text/javascript" src="${static.url('js/swfobject/swfobject.js')}"></script>
<script type="text/javascript" src="${ settings.LIB_URL }codemirror-compressed.js"></script>
<script type="text/javascript" src="/static/js/schematic.js"></script>
<script type="text/javascript" src="/static/coffee/src/courseware.js"></script> % if settings.MITX_FEATURES['USE_DJANGO_PIPELINE']:
<script type="text/javascript" src="/static/coffee/src/feedback_form.js"></script> <%static:js group='application'/>
<script type="text/javascript" src="/static/coffee/src/calculator.js"></script> % endif
<script type="text/javascript" src="/static/coffee/src/main.js"></script>
% if not settings.MITX_FEATURES['USE_DJANGO_PIPELINE']:
% for jsfn in [ '/static/%s' % x.replace('.coffee','.js') for x in settings.PIPELINE_JS['application']['source_filenames'] ]:
<script type="text/javascript" src="${jsfn}"></script>
% endfor
% endif
## codemirror
<link rel="stylesheet" href="/static/css/codemirror.css" type="text/css" media="all" />
<script type="text/javascript" src="${ settings.LIB_URL }codemirror-compressed.js"></script>
## alternate codemirror
## <script type="text/javascript" src="/static/js/CodeMirror-2.25/lib/codemirror.js"></script>
## <script type="text/javascript" src="/static/js/CodeMirror-2.25/mode/xml/xml.js"></script>
## <script type="text/javascript" src="/static/js/CodeMirror-2.25/mode/python/python.js"></script>
## image input: for clicking on images (see imageinput.html)
<script type="text/javascript" src="/static/js/imageinput.js"></script>
## <script type="text/javascript">
## var codemirror_set = {}; // track all codemirror textareas, so they can be refreshed on page changes
## </script>
<!--[if lt IE 9]>
<script src="${static.url('js/html5shiv.js')}"></script>
<![endif]-->
<%block name="headextra"/> <%block name="headextra"/>
...@@ -30,14 +59,10 @@ ...@@ -30,14 +59,10 @@
It can't be run through static.url because MathJax uses crazy url introspection to do lazy loading of It can't be run through static.url because MathJax uses crazy url introspection to do lazy loading of
MathJax extension libraries --> MathJax extension libraries -->
<%include file="mathjax_include.html" /> <%include file="mathjax_include.html" />
## <script type="text/javascript" src="/static/js/mathjax-MathJax-c9db6ac/MathJax.js?config=TeX-AMS_HTML-full"></script>
</head> </head>
<body> <body class="courseware">
<!--[if lt IE 9]>
<script src="/static/js/html5shiv.js"></script>
<![endif]-->
<style type="text/css"> <style type="text/css">
.CodeMirror {border-style: solid; .CodeMirror {border-style: solid;
...@@ -125,20 +150,30 @@ ${init_js} ...@@ -125,20 +150,30 @@ ${init_js}
} }
</style> </style>
<div id="seq_content"> <meta name="path_prefix" content="${MITX_ROOT_URL}">
<form>
${phtml} <section class="course-content">
</form> <div id="seq_content">
</div> <form>
${phtml}
</form>
</div>
</section>
<script type="text/javascript" src="${static.url('js/jquery.treeview.js')}"></script> <script type="text/javascript" src="${static.url('js/jquery.treeview.js')}"></script>
<script type="text/javascript" src="${static.url('js/jquery.leanModal.min.js')}"></script> <script type="text/javascript" src="${static.url('js/jquery.leanModal.min.js')}"></script>
<script type="text/javascript" src="${static.url('js/jquery.qtip.min.js')}"></script> <script type="text/javascript" src="${static.url('js/jquery.qtip.min.js')}"></script>
<script type="text/javascript" src="${static.url('js/jquery.cookie.js')}"></script> <script type="text/javascript" src="${static.url('js/jquery.cookie.js')}"></script>
<script type="text/javascript" src="${static.url('js/video_player.js')}"></script> ## <script type="text/javascript" src="${static.url('js/video_player.js')}"></script>
<script type="text/javascript" src="${static.url('js/schematic.js')}"></script> <script type="text/javascript" src="${static.url('js/schematic.js')}"></script>
<script type="text/javascript" src="${static.url('js/cktsim.js')}"></script> <script type="text/javascript" src="${static.url('js/cktsim.js')}"></script>
<script type="text/javascript" >
var codemirror_set= {}; // associative array of codemirror objects
</script>
<script type="text/javascript" src="${static.url('js/jquery.scrollTo-1.4.2-min.js')}"></script>
<%block name="js_extra"/> <%block name="js_extra"/>
</body> </body>
......
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