function imce_content in IMCE 6
Same name and namespace in other branches
- 6.2 inc/imce.page.inc \imce_content()
- 7 inc/imce.page.inc \imce_content()
Content of the file browser.
File
- inc/
page.inc, line 23
Code
function imce_content($user, $jsop = '') {
//execute ajax calls.
if ($jsop) {
return imce_js($user, $jsop);
}
//initiate configuration profile
if (!($imce = imce_initiate_profile($user))) {
return '';
}
imce_process_profile($imce);
//get active directory content
//Before creating the content let's add main files required for imce to function properly.
drupal_add_js('misc/jquery.form.js');
drupal_add_js(drupal_get_path('module', 'imce') . '/js/imce.js');
//process forms.
//reference imce inside an array so it will stay referenced during argument copy of drupal_get_form
//when php4-support drops(dr7?), use an object with no reference.
$imce_ref = array(
'imce' => &$imce,
);
$forms = '';
if (!$imce['error']) {
//process file upload.
if (imce_perm_exists($imce, 'upload')) {
$forms .= drupal_get_form('imce_upload_form', $imce_ref);
}
//process file operations.
$forms .= drupal_get_form('imce_fileop_form', $imce_ref);
}
//run custom content functions. possible to insert extra forms. content is invisible when js is enabled.
foreach (variable_get('imce_custom_content', array()) as $func => $state) {
if ($state && function_exists($func) && ($output = $func($imce))) {
$forms .= $output;
}
}
$content = theme('imce_content', imce_create_tree($imce), $forms, $imce_ref);
//make necessary changes for js conversion
$imce['dir'] = str_replace('%2F', '/', rawurlencode($imce['dir']));
unset($imce['files'], $imce['name'], $imce['directories'], $imce['subdirectories'], $imce['filesize'], $imce['quota'], $imce['tuquota'], $imce['thumbnails'], $imce['uid'], $imce['usertab']);
drupal_add_js($imce_ref, 'setting');
return $content;
}