You are here

function imce_form_template in IMCE 5

Return settings form for a role or user1.

1 call to imce_form_template()
imce_form_admin_form in ./imce.module
return the form for admin/settings/imce

File

./imce.module, line 533

Code

function imce_form_template($rid) {
  if ($rid == 'user1') {
    $set = (object) imce_settings_user1();
    $form['width'] = array(
      '#type' => 'textfield',
      '#size' => 4,
      '#default_value' => $set->width,
      '#prefix' => '<div class="form-item"><label>' . t('Dimensions for scaling') . ':</label><div class="container-inline">' . t('Width') . ' X ' . t('Height') . ': ',
      '#suffix' => ' X ',
    );
    $form['height'] = array(
      '#type' => 'textfield',
      '#size' => 4,
      '#default_value' => $set->height,
      '#suffix' => 'px</div><div class="description">' . t('These dimensions will be used while scaling down newly uploaded big images.') . '</div></div>',
    );
    $form['twidth'] = array(
      '#type' => 'textfield',
      '#size' => 4,
      '#default_value' => $set->twidth,
      '#prefix' => '<div class="form-item"><label>' . t('Thumbnail dimensions') . ':</label><div class="container-inline">' . t('Width') . ' X ' . t('Height') . ': ',
      '#suffix' => ' X ',
    );
    $form['theight'] = array(
      '#type' => 'textfield',
      '#size' => 4,
      '#default_value' => $set->theight,
      '#suffix' => 'px</div><div class="description">' . t('You can enable automatic thumbnail creation from newly uploaded images. To disable leave the fields blank.') . '</div></div>',
    );
    $form['shared'] = array(
      '#type' => 'textfield',
      '#title' => t('Your upload directory'),
      '#default_value' => $set->shared ? $set->shared : 'u1',
      '#description' => t('This directory must be relative to <strong>!filepath</strong> directory. So if you want to use <strong>!filepath/foldername</strong>, just enter <strong>foldername</strong> here. You may also enter <strong>/</strong> to use the file system root. If you leave it blank, u1 will be used.', array(
        '!filepath' => file_directory_path(),
      )),
    );
    $form['extras'] = array(
      '#type' => 'checkbox',
      '#title' => '<strong>' . t('Enable extras') . '</strong>',
      '#default_value' => $set->extras,
      '#description' => t('This javascript package includes browsing enhancements like file sorting, keyboard shortcuts, file filtering, etc.'),
    );
    return $form;
  }
  $set = (object) imce_settings_role($rid);
  $form['delete'] = array(
    '#type' => 'checkbox',
    '#title' => t('delete files'),
    '#default_value' => $set->delete,
    '#prefix' => '<div class="form-item"><label>' . t('Permissions') . ':</label><div class="container-inline">',
    '#suffix' => ', ',
  );
  $form['upload'] = array(
    '#type' => 'checkbox',
    '#title' => t('upload files'),
    '#default_value' => $set->upload,
    '#suffix' => ', ',
  );
  $form['nolimit'] = array(
    '#type' => 'checkbox',
    '#title' => t('limitless upload'),
    '#default_value' => $set->nolimit,
    '#suffix' => '</div><div class="description">' . t('Enable/disable access for file upload and deletion in user directories. Limitless upload disables controlling filesize, image dimensions and quota.') . '</div></div>',
  );
  $form['width'] = array(
    '#type' => 'textfield',
    '#size' => 4,
    '#default_value' => $set->width,
    '#prefix' => '<div class="form-item"><label>' . t('Image dimensions') . ':</label><div class="container-inline">' . t('Width') . ' X ' . t('Height') . ': ',
    '#suffix' => ' X ',
  );
  $form['height'] = array(
    '#type' => 'textfield',
    '#size' => 4,
    '#default_value' => $set->height,
    '#suffix' => 'px</div><div class="description">' . t('Define the maximum dimensions for an image to be uploaded.') . '</div></div>',
  );
  $form['scale'] = array(
    '#type' => 'checkbox',
    '#title' => '<strong>' . t('Enable scaling of newly uploaded images.') . '</strong>',
    '#default_value' => $set->scale,
    '#description' => t('If a newly uploaded image has dimensions exceeding the limit, it will be scaled down instead of giving an error.'),
  );
  $form['twidth'] = array(
    '#type' => 'textfield',
    '#size' => 4,
    '#default_value' => $set->twidth,
    '#prefix' => '<div class="form-item"><label>' . t('Thumbnail dimensions') . ':</label><div class="container-inline">' . t('Width') . ' X ' . t('Height') . ': ',
    '#suffix' => ' X ',
  );
  $form['theight'] = array(
    '#type' => 'textfield',
    '#size' => 4,
    '#default_value' => $set->theight,
    '#suffix' => 'px</div><div class="description">' . t('You can enable automatic thumbnail creation from newly uploaded images. To disable leave the fields blank.') . '</div></div>',
  );
  $form['resize'] = array(
    '#type' => 'checkbox',
    '#title' => '<strong>' . t('Enable custom resizing.') . '</strong>',
    '#default_value' => $set->resize,
    '#description' => t('Users will be able to resize their images to any size up to allowed dimensions.'),
  );
  $form['filesize'] = array(
    '#type' => 'textfield',
    '#title' => t('File size'),
    '#default_value' => $set->filesize,
    '#description' => t('Define the maximum file size(KB) for an image to be uploaded.'),
  );
  $form['quota'] = array(
    '#type' => 'textfield',
    '#title' => t('Upload quota'),
    '#default_value' => $set->quota,
    '#description' => t('Define the total upload quota(KB) per user.'),
  );
  $form['prefix'] = array(
    '#type' => 'textfield',
    '#title' => t('Prefix for personal folder names'),
    '#default_value' => $set->prefix,
    '#description' => t('Define the prefix that user IDs will be appended in order to create personal folders. Ex: entering "u" will result in folder names like u1, u14 etc. If you leave it blank, user IDs will be used as folder names.'),
  );
  $form['shared'] = array(
    '#type' => 'textfield',
    '#title' => t('Use a shared folder'),
    '#default_value' => $set->shared,
    '#description' => t('If you want all your users to <strong>use a common folder instead of personal folders</strong>, here you can define that folder name (ex. images). Notice that shared upload means shared quota. If you are happy with personal folders leave this field blank.'),
  );
  $form['subnav'] = array(
    '#type' => 'checkbox',
    '#title' => '<strong>' . t('Enable sub-folder navigation.') . '</strong>',
    '#default_value' => $set->subnav,
    '#description' => t('This option allows users to manage multiple folders under their main folder. Only the users who have at least one sub-folder can use this feature.'),
  );
  $form['subdirs'] = array(
    '#type' => 'textfield',
    '#title' => t('Default sub-folder names'),
    '#default_value' => $set->subdirs,
    '#description' => t('Enter comma separated sub-folder names that will be created automatically, if the sub-folder navigation is enabled. Each user of this role will have these folders in their main folder by default. Additional folders can be created using !subfoldertool. You should note that total user quota increases with every new sub-folder because the quotation is per folder basis.', array(
      '!subfoldertool' => l(t('Sub-folder tool'), 'admin/settings/imce/subfolder'),
    )),
  );
  $form['extensions'] = array(
    '#type' => 'textfield',
    '#title' => t('Non-image file support'),
    '#default_value' => $set->extensions,
    '#description' => t('Although IMCE is mainly designed to browse images, it supports uploading and browsing of any file type. If you like to use this feature, define your <strong>allowed non-image file extensions</strong> here with a comma between them. Ex .doc, .pdf, .zip.  Note that, image upload limits also apply for these files. For a pure image browser leave this field blank.'),
  );
  $form['extras'] = array(
    '#type' => 'checkbox',
    '#title' => '<strong>' . t('Enable extras') . '</strong>',
    '#default_value' => $set->extras,
    '#description' => t('This javascript package includes browsing enhancements like file sorting, keyboard shortcuts, file filtering, etc.'),
  );
  return $form;
}