You are here

function _filebrowser_form_rights_part in Filebrowser 6.2

2 calls to _filebrowser_form_rights_part()
filebrowser_admin_settings in ./filebrowser.admin.inc
filebrowser_form in ./filebrowser.module
Implementation of hook_form().

File

includes/node.inc, line 212

Code

function _filebrowser_form_rights_part($settings = NULL, $weight = 0) {
  if (is_null($settings)) {
    $globale_settings = variable_get('filebrowser', NULL);
    if (!is_null($globale_settings) && isset($globale_settings['folder_rights'])) {
      $settings = (object) $globale_settings['folder_rights'];
    }
    if (is_null($settings)) {
      $settings = (object) array(
        'explore_subdirs' => FALSE,
        'create_folders' => FALSE,
        'download_archive' => FALSE,
        'forbidden_files' => "descript.ion\nfile.bbs\n.git\nCSV\n.svn\n",
        'filtered_files' => "",
        'download_manager' => variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC ? 'public' : 'private',
      );
    }
  }

  /** Folder rights
   * *************************************************************** */
  $form['folder_rights'] = array(
    '#type' => 'fieldset',
    '#title' => t('Folder rights'),
    '#tree' => TRUE,
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#weight' => $weight,
  );
  $form['folder_rights']['explore_subdirs'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow subdirectory listings.'),
    '#default_value' => $settings->explore_subdirs,
  );
  $form['folder_rights']['download_archive'] = array(
    '#type' => 'checkbox',
    '#title' => t("Allow folder's files to be downloaded as an archive"),
    '#description' => t("Check this if you allow users to download all folder files as an archive."),
    '#default_value' => $settings->download_archive,
  );
  $form['folder_rights']['create_folders'] = array(
    '#type' => 'checkbox',
    '#title' => t("Allow folder to be created"),
    '#description' => t("Check this if you allow users to create new folders."),
    '#default_value' => $settings->create_folders,
  );
  $managers = _filebrowser_options(_filebrowser_externals('download_manager_info'));
  $form['folder_rights']['download_manager'] = array(
    '#type' => 'select',
    '#title' => t("Download manager"),
    '#description' => t("A download manager will handle the way of download folder files."),
    '#default_value' => $settings->download_manager,
    '#options' => $managers,
    '#weight' => -7,
  );
  $form['folder_rights']['forbidden_files'] = array(
    '#type' => 'textarea',
    '#title' => t('Blacklist'),
    '#description' => t('List of patterns of forbidden files, you can use wildcards (ex. .*).'),
    '#default_value' => $settings->forbidden_files,
  );
  $form['folder_rights']['filtered_files'] = array(
    '#type' => 'textarea',
    '#title' => t('Whitelist'),
    '#description' => t('List of patterns to filter, one per line, you can use wildcards (ex. *.pdf).'),
    '#default_value' => $settings->filtered_files,
  );
  return $form;
}