PDA

View Full Version : Has anyone fixed the swf uploader attachment category bug?


thenetbox
04-03-2011, 08:44 PM
There is a bug in the vb 4 and vb4.1 uploader where it does not preserve the selected category.

For example, if you create categories in the attachment manager, then you click one of the categories, then click on Add Files, choose a file, click upload.... and instead of the file being uploaded into the selected category, it puts it in categoryid 0, which is Home.

However, if you use the basic uploader, then the category gets preserved.

This bug was reported here a year ago:
http://tracker.vbulletin.com/browse/VBIV-4955?page=com.atlassian.jira.plugin.system.issueta bpanels%3Aall-tabpanel

I am trying to fix this for my board but I'm wondering if someone else has figured out a work around?

As I wrote in the bug report:

I looked at the code in vbulletin_yuiupload.js, vbulletin_asset.js and assetmanage.js

In vbulletin_asset.js, this is where the postvars appears to be given information about categoryid:


vB_Asset.prototype.yuiuploadevent_upload = function (B, A, C) {
this.yuiupload.postvars.categoryid = C.tree.selectednode.categoryid; // <=== here C.showprogress();
YAHOO.util.Dom.addClass("upload_controls_close3", "invisible");
YAHOO.util.Dom.setStyle("upload_controls_container", "z-index", 10000);
C.hideuploader()
};


But in vbulletin_yuiupload.js, vB_YUI_Upload.prototype.upload function, when it calls

this.uploader.uploadAll(this.target, "POST", this.postvars, this.fieldname)


the this.postvars container does not have a categoryid attribute. (I checked in firebug and chrome)

and same in assetmanager.js:


uploadAll: function (A, D, B, C) {
this._swf.uploadAll(A, D, B, C);
},

When uploadAll is called, B, does not have categoryid in postvars.

However, if you try to add a category just for testing in vB_YUI_Upload.prototype.upload like:

this.postvars.categoryid = "4";


the sql query starting with
INSERT IGNORE INTO attachmentcategoryuser
never gets called but I don't know where and why.

Has anyone made any progress on this and would like to share some notes?

Thanks