You are here

function node_gallery_upload_form in Node Gallery 6

Same name and namespace in other branches
  1. 6.2 node_gallery.pages.inc \node_gallery_upload_form()
2 string references to 'node_gallery_upload_form'
node_gallery_menu in ./node_gallery.module
Implementation of hook_menu()
node_gallery_upload_js in ./node_gallery.pages.inc

File

./node_gallery.pages.inc, line 34
Node gallery pages.

Code

function node_gallery_upload_form($form_state, $gallery) {
  $config = gallery_config_gateway::get_by($gallery->type);

  //bad hack, this is for node_gallery_image item_form, since we use ahah in here;
  drupal_add_tabledrag('upload-attachments', 'order', 'sibling', 'upload-weight');
  drupal_add_js('misc/autocomplete.js');
  $form['#attributes']['enctype'] = 'multipart/form-data';
  $form['#node'] = $gallery;
  $form['upload_wrapper'] = array(
    '#prefix' => "<div id='gallery-upload-wrapper'>",
    '#suffix' => "</div>",
  );
  $upload_number = 5;
  if (is_numeric($config->upload_settings['number_uploads'])) {
    $upload_number = $config->upload_settings['number_uploads'];
  }
  for ($i = 1; $i <= $upload_number; $i++) {
    $form['upload_wrapper']['uploads-' . $i] = array(
      '#type' => 'file',
      '#title' => t('Please select a file'),
    );
  }
  $form['upload_wrapper']['description'] = array(
    '#value' => node_gallery_upload_limits(),
  );
  $form['upload_wrapper']['next'] = array(
    '#type' => 'submit',
    '#value' => t('Submit Files'),
    '#weight' => 20,
    '#ahah' => array(
      'path' => 'node_gallery/upload/js',
      'wrapper' => 'gallery-upload-wrapper',
      'progress' => array(
        'type' => 'bar',
        'message' => t('Please wait...'),
      ),
    ),
  );
  return $form;
}