function imce_content in IMCE 6.2
Same name and namespace in other branches
- 6 inc/page.inc \imce_content()
- 7 inc/imce.page.inc \imce_content()
Returns the content of the file browser.
1 call to imce_content()
- imce_page in inc/
imce.page.inc - Returns the imce page for the specified user.
File
- inc/
imce.page.inc, line 35 - Implements the file browser.
Code
function imce_content($user, $jsop = NULL) {
//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.
$path = drupal_get_path('module', 'imce');
drupal_add_js(module_exists('jquery_update') && variable_get('jquery_update_jquery_version', '1.3') > 1.3 ? 'misc/jquery.form.js' : $path . '/js/jquery.form.js');
drupal_add_js($path . '/js/imce.js');
drupal_add_js($path . '/js/imce_extras.js');
drupal_add_css($path . '/css/imce-content.css');
//process forms.
//reference imce inside an array so it will stay referenced during argument copy of drupal_get_form
$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;
}