Commit d06f5f77 by Vik Paruchuri

Fix file upload stuff, debug some image check routines

parent 0622dc99
......@@ -178,13 +178,27 @@ class @CombinedOpenEnded
save_answer: (event) =>
event.preventDefault()
max_filesize = 2*1000*1000 #2MB
if @child_state == 'initial'
file_data = ""
files = ""
if @can_upload_files == true
files = $('.file-upload-box')[0].files[0]
file_data = files
data = {'student_answer' : @answer_area.val(), 'file_data' : file_data}
$.postWithPrefix "#{@ajax_url}/save_answer", data, (response) =>
if files.size > max_filesize
@can_upload_files = false
files = ""
fd = new FormData()
fd.append('student_answer', @answer_area.val())
fd.append('student_file', files)
fd.append('can_upload_files', files)
#data = {'student_answer' : @answer_area.val(), 'file_value' : file_value, 'file_id' : file_id}
settings =
type: "POST"
data: fd
processData: false
contentType: false
success: (response) =>
if response.success
@rubric_wrapper.html(response.rubric_html)
@rubric_wrapper.show()
......@@ -193,6 +207,9 @@ class @CombinedOpenEnded
@rebind()
else
@errors_area.html(response.error)
$.ajaxWithPrefix("#{@ajax_url}/save_answer",settings)
else
@errors_area.html('Problem state got out of sync. Try reloading the page.')
......
......@@ -70,7 +70,7 @@ class URLProperties(object):
def check_suffix(self):
good_suffix = False
for suffix in ALLOWABLE_IMAGE_SUFFIXES:
if self.url_string.endswith(suffix)
if self.url_string.endswith(suffix):
good_suffix = True
break
return good_suffix
......
......@@ -23,6 +23,7 @@ from .stringify import stringify_children
from .xml_module import XmlDescriptor
from xmodule.modulestore import Location
from capa.util import *
import open_ended_image_submission
from datetime import datetime
......@@ -274,12 +275,13 @@ class OpenEndedChild(object):
correctness = 'correct' if self.is_submission_correct(score) else 'incorrect'
return correctness
def should_request_image(self):
def upload_image_to_s3(self, image_data):
"""
@return:
"""
pass
success = False
image_ok = run_image_checks(image)
......
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