You are here

function gallery_assist_settings_submit in Gallery Assist 6

Update the settings of gallery_assist or of assignments.

See also

gallery_assist_settings()

1 string reference to 'gallery_assist_settings_submit'
gallery_assist_settings in ./gallery_assist.admin.inc
Settings form.

File

./gallery_assist.module, line 1417
Drupal content type with gallery functionality.

Code

function gallery_assist_settings_submit(&$form, $form_state) {

  //gallery_assist_invalidate_cache();
  $cq = "TRUNCATE TABLE {cache_gallery_assist_data}";
  db_query($cq);
  $type = $form_state['values']['node_type'];
  $settings = variable_get('gallery_assist_' . $type . '_data', array());
  $gallery_assist_data = $settings;
  if ($form_state['values']['gallery_assist_' . $type . '_change'] == TRUE) {
    $gallery_assist_update_data = array(
      'upload_thm' => check_plain($form_state['values']['gallery_assist_' . $type . '_upload_thm']),
      'upload_prev' => check_plain($form_state['values']['gallery_assist_' . $type . '_upload_prev']),
      'items_per_row' => $form_state['values']['gallery_assist_' . $type . '_items_per_row'],
      't_items_per_row' => $form_state['values']['gallery_assist_' . $type . '_t_items_per_row'],
      'rows_per_page' => $form_state['values']['gallery_assist_' . $type . '_rows_per_page'],
      'thumbnail_size' => $form_state['values']['gallery_assist_' . $type . '_thumbnail_size'],
      'thumbnail_size_plus' => check_plain($form_state['values']['gallery_assist_' . $type . '_thumbnail_size_plus']),
      'preview_size' => check_plain($form_state['values']['gallery_assist_' . $type . '_preview_size']),
      'item_margin' => $form_state['values']['gallery_assist_' . $type . '_item_margin'],
      'item_padding' => $form_state['values']['gallery_assist_' . $type . '_item_padding'],
      'item_border' => $form_state['values']['gallery_assist_' . $type . '_item_border'],
      'item_border_color' => check_plain($form_state['values']['gallery_assist_' . $type . '_item_border_color']),
      'show_backlink' => $form_state['values']['gallery_assist_' . $type . '_show_backlink'],
      'show_toggle' => $form_state['values']['gallery_assist_' . $type . '_show_toggle'],
      'show_title' => $form_state['values']['gallery_assist_' . $type . '_show_title'],
      //
      'ga_align' => $form_state['values']['gallery_assist_' . $type . '_ga_align'],
      'gap_align' => $form_state['values']['gallery_assist_' . $type . '_gap_align'],
      't_ga_float' => $form_state['values']['gallery_assist_' . $type . '_t_ga_float'],
      'p_ga_float' => $form_state['values']['gallery_assist_' . $type . '_p_ga_float'],
      //
      'show_in_homepage_block' => $form_state['values']['gallery_assist_' . $type . '_show_in_homepage_block'],
      'position_toggle' => $form_state['values']['gallery_assist_' . $type . '_position_toggle'],
      'title_substr' => check_plain($form_state['values']['gallery_assist_' . $type . '_title_substr']),
      'pager_symbol' => $form_state['values']['gallery_assist_' . $type . '_pager_symbol'],
      'pager_layout' => $form_state['values']['gallery_assist_' . $type . '_pager_layout'],
      'pager_position' => $form_state['values']['gallery_assist_' . $type . '_pager_position'],
      'pager_visibles' => check_plain($form_state['values']['gallery_assist_' . $type . '_pager_visibles']),
      'force_image_height' => $form_state['values']['gallery_assist_' . $type . '_force_image_height'],
      'show_download_link' => $form_state['values']['gallery_assist_' . $type . '_show_download_link'],
      'use_mbImgNav' => $form_state['values']['gallery_assist_' . $type . '_use_mbImgNav'],
      'use_galleria' => $form_state['values']['gallery_assist_' . $type . '_use_galleria'],
      'hide_in_teaser' => $form_state['values']['gallery_assist_' . $type . '_hide_in_teaser'],
      'item_effect' => $form_state['values']['gallery_assist_' . $type . '_item_effect'],
      'max_items' => check_plain($form_state['values']['gallery_assist_' . $type . '_max_items']),
      'max_form_items' => check_plain($form_state['values']['gallery_assist_' . $type . '_max_form_items']),
      //
      'file_size' => $form_state['values']['gallery_assist_' . $type . '_file_size'] * 1024 * 1024,
      'user_size' => $form_state['values']['gallery_assist_' . $type . '_user_size'] * 1024 * 1024,
      'resolution' => check_plain($form_state['values']['gallery_assist_' . $type . '_resolution']),
      'extensions' => check_plain($form_state['values']['gallery_assist_' . $type . '_extensions']),
      //
      'ga_public_status' => $form_state['values']['gallery_assist_' . $type . '_ga_public_status'],
      'admin_public_status' => $form_state['values']['gallery_assist_' . $type . '_admin_public_status'],
      'pager_t_height' => check_plain($form_state['values']['gallery_assist_' . $type . '_pager_t_height']),
      'pager_t_active_height' => check_plain($form_state['values']['gallery_assist_' . $type . '_pager_t_active_height']),
      'pager_presetid' => $form_state['values']['gallery_assist_' . $type . '_pager_presetid'],
      'extra_layout_settings_allowed' => $form_state['values']['gallery_assist_' . $type . '_extra_layout_settings_allowed'],
      'common_settings_allowed' => $form_state['values']['gallery_assist_' . $type . '_common_settings_allowed'],
      'hide_teaser_container_allowed' => $form_state['values']['gallery_assist_' . $type . '_hide_teaser_container_allowed'],
      'display_download_link_allowed' => $form_state['values']['gallery_assist_' . $type . '_display_download_link_allowed'],
      'container_format_allowed' => $form_state['values']['gallery_assist_' . $type . '_container_format_allowed'],
      'gallery_container_weight_allowed' => $form_state['values']['gallery_assist_' . $type . '_gallery_container_weight_allowed'],
      'show_in_homepage_block_allowed' => $form_state['values']['gallery_assist_' . $type . '_show_in_homepage_block_allowed'],
      'gallery_public_status_allowed' => $form_state['values']['gallery_assist_' . $type . '_gallery_public_status_allowed'],
      'show_titles_allowed' => $form_state['values']['gallery_assist_' . $type . '_show_titles_allowed'],
      'show_in_userprofile_allowed' => $form_state['values']['gallery_assist_' . $type . '_show_in_userprofile_allowed'],
      'gallery_items_shadow_allowed' => $form_state['values']['gallery_assist_' . $type . '_gallery_items_shadow_allowed'],
      'gallery_items_shadow' => $form_state['values']['gallery_assist_' . $type . '_gallery_items_shadow'],
      'disable_margin_top' => $form_state['values']['gallery_assist_' . $type . '_disable_margin_top'],
      'in_profile' => $form_state['values']['gallery_assist_' . $type . '_in_profile'],
      'show_layout' => $form_state['values']['gallery_assist_' . $type . '_show_layout'],
      'gallery_assist_weight' => $form_state['values']['gallery_assist_' . $type . '_gallery_assist_weight'],
      'ga_db_order_field' => $form_state['values']['gallery_assist_' . $type . '_ga_db_order_field'],
      'ga_db_order' => $form_state['values']['gallery_assist_' . $type . '_ga_db_order'],
      'graphlinks' => $form_state['values']['gallery_assist_' . $type . '_graphlinks'],
      'pager_format' => $form_state['values']['gallery_assist_' . $type . '_pager_format'],
      'gallery_call_type' => $form_state['values']['gallery_assist_' . $type . '_gallery_call_type'],
      'ga_item_title_type' => $form_state['values']['gallery_assist_' . $type . '_ga_item_title_type'],
      'pager_align' => $form_state['values']['gallery_assist_' . $type . '_pager_align'],
      't_thm_link_format' => $form_state['values']['gallery_assist_' . $type . '_t_thm_link_format'],
      'ga_pager_show_pages' => $form_state['values']['gallery_assist_' . $type . '_ga_pager_show_pages'],
      'ga_cover_sticky' => $form_state['values']['gallery_assist_' . $type . '_ga_cover_sticky'],
    );
    if ($form_state['values']['gallery_assist_' . $type . '_show_layout'] == 'list') {
      $gallery_assist_update_data['show_title'] = FALSE;
      $gallery_assist_update_data['gallery_items_shadow'] = FALSE;
    }
    if ($form_state['values']['gallery_assist_' . $type . '_ga_public_status_updater'] == 1) {
      gallery_assist_public_status_updater($type, $form_state['values']['gallery_assist_' . $type . '_ga_public_status']);
    }
    variable_set("hide_node_first_notice_for_{$type}", $form_state['values']['gallery_assist_' . $type . '_hide_node_first_notice']);
    if (function_exists('imagecache_preset') && is_numeric($form_state['values']['gallery_assist_' . $type . '_pager_presetid'])) {
      $preset = imagecache_preset($gallery_assist_update_data['pager_presetid']);
      $gallery_assist_update_data['pager_presetname'] = $preset['presetname'];
    }
    if (function_exists('i18n_menu')) {
      $gallery_assist_update_data['translation_behavior'] = $form_state['values']['gallery_assist_' . $type . '_translation_behavior'];
      $gallery_assist_update_data['translation_behavior_allowed'] = $form_state['values']['gallery_assist_' . $type . '_translation_behavior_allowed'];
    }
    if (function_exists('pathauto_menu')) {
      $gallery_assist_update_data['build_aliases'] = $form_state['values']['gallery_assist_' . $type . '_build_aliases'];
    }
    variable_set('gallery_assist_' . $type . '_data', $gallery_assist_update_data);
  }
}