You are here

function photos_swfu_form in Album Photos 6.2

Same name and namespace in other branches
  1. 7.3 photos_swfu/photos_swfu.module \photos_swfu_form()
1 call to photos_swfu_form()
photos_swfu_form_alter in photos_swfu/photos_swfu.module

File

photos_swfu/photos_swfu.module, line 54

Code

function photos_swfu_form($pid, $nid) {
  global $user, $language;
  if ($_SESSION['photos_swfu_switch'] != 1) {
    drupal_add_css(drupal_get_path('module', 'photos_swfu') . '/simpledemo/default.css');
    drupal_add_js(drupal_get_path('module', 'photos_swfu') . '/simpledemo/swfupload.js');
    drupal_add_js(drupal_get_path('module', 'photos_swfu') . '/simpledemo/swfupload.queue.js');
    drupal_add_js(drupal_get_path('module', 'photos_swfu') . '/simpledemo/fileprogress.js');
    drupal_add_js(drupal_get_path('module', 'photos_swfu') . '/simpledemo/handlers.js');
    $op = array();
    $op['query']['uid'] = $user->uid;
    if ($nid) {
      $op['query']['nid'] = $nid;
    }
    $v['url'] = url('photos_swfu/upload/' . $pid, $op);
    $path = drupal_get_path('module', 'photos_swfu');
    if (is_file($path . '/simpledemo/button/' . $language->language . '_61x22.png')) {
      $v['image'] = base_path() . $path . '/simpledemo/button/' . $language->language . '_61x22.png';
    }
    else {
      $v['image'] = base_path() . $path . '/simpledemo/XPButtonUploadText_61x22.png';
    }
    $v['swf'] = base_path() . $path . '/simpledemo/swfupload.swf';
    if (arg(1) == 'quote') {
      $v['href'] = url($_GET['q'], array(
        'query' => array(
          'type' => 'upload',
        ),
      ));
    }
    else {
      $v['href'] = url($_GET['q'], array(
        'query' => array(
          'type' => 'tx',
        ),
      ));
    }
    if ($user->uid == 1) {
      $v['max_file_size'] = '200';
      $v['num_uploads'] = '0';
    }
    else {
      $limits = _upload_file_limits($user);
      $v['max_file_size'] = $limits['file_size'] / 1024 / 1024;
      $v['num_uploads'] = variable_get('photos_swfu_num', 50);
    }
    $form['new']['swfu'] = array(
      '#value' => theme('photos_swfu_style', $v),
      '#weight' => -1,
    );
    $svluae = t('Click here to switch to the classic upload form');
  }
  else {
    $svluae = t('Click here to switch back to the flash form');
  }
  $form['button']['#weight'] = -10;
  $form['button']['switch'] = array(
    '#type' => 'submit',
    '#value' => $svluae,
    '#submit' => array(
      '_photos_swfu_switch',
    ),
    '#weight' => -20,
  );
  return $form;
}