diff options
-rw-r--r-- | askbot/doc/source/changelog.rst | 1 | ||||
-rw-r--r-- | askbot/skins/common/media/js/editor.js | 9 | ||||
-rw-r--r-- | askbot/views/writers.py | 16 |
3 files changed, 16 insertions, 10 deletions
diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst index 42be87d5..965db53c 100644 --- a/askbot/doc/source/changelog.rst +++ b/askbot/doc/source/changelog.rst @@ -16,6 +16,7 @@ Development version (not released yet) * Added progress bars to slow data migrations (Evgeny) * Added a management command to build_thread_summary_cache (Evgeny) * Added a management delete_contextless_badge_award_activities (Evgeny) +* Fixed a file upload issue in FF and IE found by jerry_gzy (Evgeny) 0.7.39 (Jan 11, 2012) --------------------- diff --git a/askbot/skins/common/media/js/editor.js b/askbot/skins/common/media/js/editor.js index e580f9f6..2d1f5670 100644 --- a/askbot/skins/common/media/js/editor.js +++ b/askbot/skins/common/media/js/editor.js @@ -42,11 +42,11 @@ function ajaxFileUpload(imageUrl, startUploadHandler) url: askbot['urls']['upload'], secureuri:false, fileElementId:'file-upload', - dataType: 'json', + dataType: 'xml', success: function (data, status) { - var fileURL = data['file_url']; - var error = data['error']; + var fileURL = $(data).find('file_url').text(); + var error = $(data).find('error').text(); if(error != ''){ alert(error); if (startUploadHandler){ @@ -57,6 +57,7 @@ function ajaxFileUpload(imageUrl, startUploadHandler) }else{ imageUrl.attr('value', fileURL); } + }, error: function (data, status, e) { @@ -71,4 +72,4 @@ function ajaxFileUpload(imageUrl, startUploadHandler) ) return false; -} +}; diff --git a/askbot/views/writers.py b/askbot/views/writers.py index 855f2977..7ebb1991 100644 --- a/askbot/views/writers.py +++ b/askbot/views/writers.py @@ -113,12 +113,16 @@ def upload(request):#ajax upload file to a question or answer result = '' file_url = '' - data = simplejson.dumps({ - 'result': result, - 'error': error, - 'file_url': file_url - }) - return HttpResponse(data, mimetype = 'application/json') + #data = simplejson.dumps({ + # 'result': result, + # 'error': error, + # 'file_url': file_url + #}) + #return HttpResponse(data, mimetype = 'application/json') + xml_template = "<result><msg><![CDATA[%s]]></msg><error><![CDATA[%s]]></error><file_url>%s</file_url></result>" + xml = xml_template % (result, error, file_url) + + return HttpResponse(xml, mimetype="application/xml") def __import_se_data(dump_file): """non-view function that imports the SE data |