Closed (won't fix)
Project:
IMCE
Version:
6.x-1.4
Component:
Code
Priority:
Major
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
16 Dec 2010 at 16:05 UTC
Updated:
2 Mar 2012 at 12:22 UTC
The function imce.setSendTo allows to send only one file to the requesting application.
I would like to send more that one file.
In the README.txt file, it is written :
~~~~~~~ADVANCED INTEGRATION~~~~~~~~~
In case:
...
- Your application wants IMCE to send multiple files to it.(e.g., a gallery application)
...
Then you should consider applying advanced integration.
So it seems that it should be possible to send several images.
I tried this code (issued from imceImage) :
imceImage.open = function (url, field) {
imceImage.pop = window.open(url, '', 'width=860,height=600,resizable=1');
imceImage.pop['imceOnLoad'] = function (win) {
win.imce.opAdd({name:'multiSendTo', title: Drupal.t('Add images to album'), func:imceImage.multiInsert( win)});
}
imceImage.pop.focus();
}
imceImage.multiInsert = function ( win){
console.debug(win.imce);
var imce = win.imce;
var op=$(imce.el('op-item-multiSendTo'));
var button=op.find('a');
console.log(button);
button.click(function (){
console.debug(win.imce.selected);
for (var fid in win.imce.selected){
var file = win.imce.fileGet(fid);
imceImage.insert (file,win);
}
win.close();
});
}
The problem is that in fact the button variable not corresponds to the list of tags of the imce window, but to the list of tags of the content form in which I called imce.
Is it the good way to make what I described before ?
How do I access to the button and add the click function ?
Comments
Comment #1
ufku commentedYou should pass your onload function in the URL. Setting imceOnLoad property of popup object is deprecated because of limited support by browsers.
Inside onload function define your file operation
Comment #2
lucuhb commentedThanks for your response. I didn't know why ImceImage was noted as deprecated : is it for this problem of setting imceOnLoad of popup object ?
Comment #3
ufku commentedI have no idea why imceimage deprecated. I'm not a maintainer of that module.
Comment #4
lucuhb commentedAs you says, I used the imceload on the url. Now all work. Thanks.
Comment #5
gregarios commentedIs there any way one of you with the "working" code could attach the whole "imceimage.js" file to this thread please?
Comment #6
lucuhb commentedYou will find this on this imceimage thread : #1006108: IMCEImage for multi-elements field
Comment #7
ufku commented