You are here

function filedepot_newfile_dialog in filedepot 7

1 string reference to 'filedepot_newfile_dialog'
filedepot_menu in ./filedepot.module
Implementation of hook_menu().

File

./filedepot.module, line 2108
filedepot.module Filedepot: File Management Module developed by Nextide www.nextide.ca Full featured document managment module with a desktop application feel. Integrated Organic Group, Role and User permissions to secure folders, automated…

Code

function filedepot_newfile_dialog($js = NULL) {

  // Fall back if $js is not set.
  if (!$js) {
    return drupal_get_form('filedepot_newfile_form');
  }
  ctools_include('modal');
  ctools_include('ajax');
  ctools_add_js('ajax-responder');
  drupal_add_css(drupal_get_path('module', 'filedepot') . '/css/filedepot_ctools.css');
  $form_state = array(
    'title' => t('New File'),
    'ajax' => TRUE,
    'has_file_element' => TRUE,
  );
  $output = ctools_modal_form_wrapper('filedepot_newfile_form', $form_state);
  if ($form_state['executed'] && $js) {
    $cid = intval($form_state['values']['filedepot_parentfolder']);
    $commands = array();
    $commands[] = ctools_ajax_command_redirect("filedepot/folder/{$cid}");
    $commands[] = ctools_modal_command_dismiss(t('Upload Success'));

    // In typical usage you will do something else here, such as update a
    // div with HTML or redirect the page based upon the results of the modal
    // form.
    print ajax_render($commands);
    exit;
  }
  print ajax_render($output);
  exit;
}