summaryrefslogtreecommitdiff
path: root/lib/scripts/fileuploaderextended.js
diff options
context:
space:
mode:
authorKate Arzamastseva <pshns@ukr.net>2011-08-21 02:16:39 +0300
committerKate Arzamastseva <pshns@ukr.net>2011-08-21 02:16:39 +0300
commit9de3b5710719658ef75740c0bd930423cc7c209c (patch)
treedabecdaa9dc3ed32babcf4623032e0a5e530b0db /lib/scripts/fileuploaderextended.js
parent10799f9c522a9847ebf5f2f7c91d4af7f160e4b8 (diff)
downloadrpg-9de3b5710719658ef75740c0bd930423cc7c209c.tar.gz
rpg-9de3b5710719658ef75740c0bd930423cc7c209c.tar.bz2
issue #44 uploader fixes, #45 browser testing
Diffstat (limited to 'lib/scripts/fileuploaderextended.js')
-rw-r--r--lib/scripts/fileuploaderextended.js20
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/scripts/fileuploaderextended.js b/lib/scripts/fileuploaderextended.js
index 005268bbb..ed631a9ea 100644
--- a/lib/scripts/fileuploaderextended.js
+++ b/lib/scripts/fileuploaderextended.js
@@ -80,7 +80,7 @@ qq.FileUploaderExtended = function(o){
'<div class="qq-upload-button">' + LANG.media_select + '</div>' +
'<div class="qq-upload-list"></div>' +
'<div><input class="button" type="submit" value="' + LANG.media_upload_btn + '" id="mediamanager__upload_button">' +
- '<label class="check" for="dw__ow"><input id="dw__ow" type="checkbox" value="1" name="ow"><span>' + LANG.media_overwrt + '</span></label>' +
+ '<label class="check"><input class="dw__ow" type="checkbox" value="1" name="ow"><span>' + LANG.media_overwrt + '</span></label>' +
'</div>' +
'</div>',
@@ -163,7 +163,7 @@ qq.extend(qq.FileUploaderExtended.prototype, {
qq.removeClass(fileElement, 'qq-upload-file-hidden');
qq.remove(nameInput);
jQuery('.qq-upload-button, #mediamanager__upload_button').remove();
- jQuery('#dw__ow').parent().hide();
+ jQuery('.dw__ow').parent().hide();
jQuery('.qq-upload-drop-area').remove();
if (result.success){
@@ -178,8 +178,12 @@ qq.extend(qq.FileUploaderExtended.prototype, {
}
if (document.getElementById('media__content') && !document.getElementById('mediamanager__done_form')) {
- var button = '<form method="post" action="' + document.location +'" id="mediamanager__done_form"><div>';
- button += '<input class="button" type="submit" value="' + LANG.media_done_btn + '"></div></form>'
+ var action = document.location.href;
+ var i = action.indexOf('?');
+ if (i) action = action.substr(0, i);
+ var button = '<form method="post" action="' + action + '" id="mediamanager__done_form"><div>';
+ button += '<input type="hidden" value="' + result.ns + '" name="ns">';
+ button += '<input class="button" type="submit" value="' + LANG.media_done_btn + '"></div></form>';
jQuery('#mediamanager__uploader').append(button);
}
}
@@ -232,8 +236,10 @@ qq.extend(qq.UploadHandlerForm.prototype, {
var nameInput = qq.toElement('<input name="mediaid" value="' + fileName + '" type="text">');
form.appendChild(nameInput);
- var owCheckbox = document.getElementById('dw__ow').cloneNode(true);
- form.appendChild(owCheckbox);
+ var checked = jQuery('.dw__ow').attr('checked');
+ var owCheckbox = jQuery('.dw__ow').clone();
+ owCheckbox.attr('checked', checked);
+ jQuery(form).append(owCheckbox);
var self = this;
this._attachLoadEvent(iframe, function(){
@@ -311,7 +317,7 @@ qq.extend(qq.UploadHandlerXhr.prototype, {
// build query string
params = params || {};
params['qqfile'] = name;
- params['ow'] = document.getElementById('dw__ow').checked;
+ params['ow'] = jQuery('.dw__ow').attr('checked');
var queryString = qq.obj2url(params, this._options.action);
xhr.open("POST", queryString, true);