summaryrefslogtreecommitdiff
path: root/sites/all/modules/media/includes/media.admin.inc
blob: 9cc9fa14531a8690be1e7d730a61d98b48019861 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php

/**
 * @file
 * Administration page callbacks for the Media module.
 */

/**
 * Displays the media administration page.
 */
function media_admin_config_browser($form, &$form_state) {
  $theme_options = array();
  $theme_options[NULL] = t('Default administration theme');

  foreach (list_themes() as $key => $theme) {
    if ($theme->status) {
      $theme_options[$key] = $theme->info['name'];
    }
  }

  $form['media_dialog_theme'] = array(
    '#type' => 'select',
    '#title' => t('Media browser theme'),
    '#options' => $theme_options,
    '#description' => t("This theme will be used for all media related dialogs. It can be different from your site's theme because many site themes do not work well in the small windows which media uses."),
    '#default_value' => variable_get('media_dialog_theme', ''),
  );

  $form['array_filter'] = array(
    '#type' => 'value',
    '#value' => TRUE,
  );

  $form['mediapopup'] = array(
    '#type' => 'fieldset',
    '#title' => t('Media Popup'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['mediapopup']['media_dialogclass'] = array(
    '#type' => 'textfield',
    '#title' => t('Dialog Class'),
    '#default_value' => variable_get('media_dialogclass', 'media-wrapper'),
    '#description' => t('The class used to identify the popup wrapper element.'),
  );
  $form['mediapopup']['media_modal'] = array(
    '#type' => 'select',
    '#title' => t('Modal'),
    '#options' => array(
      FALSE => t('False'),
      TRUE => t('True'),
    ),
    '#default_value' => variable_get('media_modal', TRUE),
    '#description' => t('Open as modal window.'),
  );
  $form['mediapopup']['media_draggable'] = array(
    '#type' => 'select',
    '#title' => t('Draggable'),
    '#options' => array(
      FALSE => t('False'),
      TRUE => t('True'),
    ),
    '#default_value' => variable_get('media_draggable', FALSE),
    '#description' => t('Draggable modal window.'),
  );
  $form['mediapopup']['media_resizable'] = array(
    '#type' => 'select',
    '#title' => t('Resizable'),
    '#options' => array(
      FALSE => t('False'),
      TRUE => t('True'),
    ),
    '#default_value' => variable_get('media_resizable', FALSE),
    '#description' => t('Resizable modal window.'),
  );
  $form['mediapopup']['media_minwidth'] = array(
    '#type' => 'textfield',
    '#title' => t('Min Width'),
    '#default_value' => variable_get('media_minwidth', 500),
    '#description' => t('CSS property min-width.'),
  );
  $form['mediapopup']['media_width'] = array(
    '#type' => 'textfield',
    '#title' => t('Width'),
    '#default_value' => variable_get('media_width', 670),
    '#description' => t('CSS property width.'),
  );
  $form['mediapopup']['media_height'] = array(
    '#type' => 'textfield',
    '#title' => t('Height'),
    '#default_value' => variable_get('media_height', 280),
    '#description' => t('CSS property height.'),
  );
  $form['mediapopup']['media_position'] = array(
    '#type' => 'textfield',
    '#title' => t('Position'),
    '#default_value' => variable_get('media_position', 'center'),
    '#description' => t('CSS property position.'),
  );
  $form['mediapopup']['media_zindex'] = array(
    '#type' => 'textfield',
    '#title' => t('Z-Index'),
    '#default_value' => variable_get('media_zindex', 10000),
    '#description' => t('CSS property z-index.'),
  );
  $form['mediapopup']['overlay'] = array(
    '#type' => 'fieldset',
    '#title' => t('Overlay'),
  );
  $form['mediapopup']['overlay']['media_backgroundcolor'] = array(
    '#type' => 'textfield',
    '#title' => t('Background Color'),
    '#default_value' => variable_get('media_backgroundcolor', '#000000'),
    '#description' => t('CSS property background-color; used with overlay.'),
  );
  $form['mediapopup']['overlay']['media_opacity'] = array(
    '#type' => 'textfield',
    '#title' => t('Opacity'),
    '#default_value' => variable_get('media_opacity', 0.4),
    '#description' => t('CSS property opacity; used with overlay.'),
  );

  $form['#submit'][] = 'media_admin_config_browser_pre_submit';

  return system_settings_form($form);
}

/**
 * Form submission handler for media_admin_config_browser().
 */
function media_admin_config_browser_pre_submit(&$form, &$form_state) {
  if (!$form_state['values']['media_dialog_theme']) {
    variable_del('media_dialog_theme');
    unset($form_state['values']['media_dialog_theme']);
  }
}