When I upgraded to 1.2 my custom integration script failed. Reverting back to 1.1 fixed the problem.

I've got this script:

drupal_add_js('
function openFileBrowser(field) {
window.open("/imce&app=CMI|name@"+field, "imce", "width=960,height=760,resizable=1");
}
', 'inline');

Being called by this element:

$form['asset']['button'] = array(
'#attributes' => array('onclick' => "openFileBrowser('edit-file'); return false;"),
'#type' => 'button',
'#title' => t('Attach file'),
'#value' => 'Browse',
);

Comments

rimian’s picture

Oh, and this element:

$form['asset']['file'] = array(
'#type' => 'textfield',
'#title' => t('Attach file'),
);

ufku’s picture

I had made a small change where file url is the key field for triggering automatic filling. It seems i should also add name property for that.
A workaround for you is to add url property to IMCE URL, e.g.
window.open("/imce&app=CMI|url@"+ field +"|name@"+field, "imce", "width=960,height=760,resizable=1");
This will insert url first and then name into the field.
You can also set your sendto Funtion by URL /imce?app=CMI|sendto@mySendTo where you should have

function mySendTo(file, win) {
$('#edit-file').val(file.name);
win.close();
}
ufku’s picture

Status: Active » Closed (works as designed)