Projet

Général

Profil

Paste
Télécharger (4,32 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / media / includes / media.admin.inc @ 1f623f01

1 85ad3d82 Assos Assos
<?php
2
3
/**
4
 * @file
5 ca0757b9 Assos Assos
 * Administration page callbacks for the Media module.
6 85ad3d82 Assos Assos
 */
7
8
/**
9 ca0757b9 Assos Assos
 * Displays the media administration page.
10 85ad3d82 Assos Assos
 */
11
function media_admin_config_browser($form, &$form_state) {
12
  $theme_options = array();
13 ca0757b9 Assos Assos
  $theme_options[NULL] = t('Default administration theme');
14
15 85ad3d82 Assos Assos
  foreach (list_themes() as $key => $theme) {
16
    if ($theme->status) {
17
      $theme_options[$key] = $theme->info['name'];
18
    }
19
  }
20
21 ca0757b9 Assos Assos
  $form['media_dialog_theme'] = array(
22 85ad3d82 Assos Assos
    '#type' => 'select',
23
    '#title' => t('Media browser theme'),
24
    '#options' => $theme_options,
25 ca0757b9 Assos Assos
    '#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."),
26
    '#default_value' => variable_get('media_dialog_theme', ''),
27 85ad3d82 Assos Assos
  );
28
29 ca0757b9 Assos Assos
  $form['array_filter'] = array(
30
    '#type' => 'value',
31
    '#value' => TRUE,
32
  );
33
34
  $form['mediapopup'] = array(
35 85ad3d82 Assos Assos
    '#type' => 'fieldset',
36 ca0757b9 Assos Assos
    '#title' => t('Media Popup'),
37 85ad3d82 Assos Assos
    '#collapsible' => TRUE,
38 ca0757b9 Assos Assos
    '#collapsed' => TRUE,
39 85ad3d82 Assos Assos
  );
40 ca0757b9 Assos Assos
  $form['mediapopup']['media_dialogclass'] = array(
41
    '#type' => 'textfield',
42
    '#title' => t('Dialog Class'),
43
    '#default_value' => variable_get('media_dialogclass', 'media-wrapper'),
44
    '#description' => t('The class used to identify the popup wrapper element.'),
45 85ad3d82 Assos Assos
  );
46 ca0757b9 Assos Assos
  $form['mediapopup']['media_modal'] = array(
47
    '#type' => 'select',
48
    '#title' => t('Modal'),
49
    '#options' => array(
50
      FALSE => t('False'),
51
      TRUE => t('True'),
52
    ),
53
    '#default_value' => variable_get('media_modal', TRUE),
54
    '#description' => t('Open as modal window.'),
55
  );
56
  $form['mediapopup']['media_draggable'] = array(
57
    '#type' => 'select',
58
    '#title' => t('Draggable'),
59
    '#options' => array(
60
      FALSE => t('False'),
61
      TRUE => t('True'),
62
    ),
63
    '#default_value' => variable_get('media_draggable', FALSE),
64
    '#description' => t('Draggable modal window.'),
65
  );
66
  $form['mediapopup']['media_resizable'] = array(
67
    '#type' => 'select',
68
    '#title' => t('Resizable'),
69
    '#options' => array(
70
      FALSE => t('False'),
71
      TRUE => t('True'),
72
    ),
73
    '#default_value' => variable_get('media_resizable', FALSE),
74
    '#description' => t('Resizable modal window.'),
75
  );
76
  $form['mediapopup']['media_minwidth'] = array(
77 85ad3d82 Assos Assos
    '#type' => 'textfield',
78 ca0757b9 Assos Assos
    '#title' => t('Min Width'),
79
    '#default_value' => variable_get('media_minwidth', 500),
80
    '#description' => t('CSS property min-width.'),
81 85ad3d82 Assos Assos
  );
82 ca0757b9 Assos Assos
  $form['mediapopup']['media_width'] = array(
83
    '#type' => 'textfield',
84
    '#title' => t('Width'),
85
    '#default_value' => variable_get('media_width', 670),
86
    '#description' => t('CSS property width.'),
87
  );
88
  $form['mediapopup']['media_height'] = array(
89
    '#type' => 'textfield',
90
    '#title' => t('Height'),
91
    '#default_value' => variable_get('media_height', 280),
92
    '#description' => t('CSS property height.'),
93
  );
94
  $form['mediapopup']['media_position'] = array(
95
    '#type' => 'textfield',
96
    '#title' => t('Position'),
97
    '#default_value' => variable_get('media_position', 'center'),
98
    '#description' => t('CSS property position.'),
99
  );
100
  $form['mediapopup']['media_zindex'] = array(
101
    '#type' => 'textfield',
102
    '#title' => t('Z-Index'),
103
    '#default_value' => variable_get('media_zindex', 10000),
104
    '#description' => t('CSS property z-index.'),
105
  );
106
  $form['mediapopup']['overlay'] = array(
107
    '#type' => 'fieldset',
108
    '#title' => t('Overlay'),
109
  );
110
  $form['mediapopup']['overlay']['media_backgroundcolor'] = array(
111
    '#type' => 'textfield',
112
    '#title' => t('Background Color'),
113
    '#default_value' => variable_get('media_backgroundcolor', '#000000'),
114
    '#description' => t('CSS property background-color; used with overlay.'),
115
  );
116
  $form['mediapopup']['overlay']['media_opacity'] = array(
117
    '#type' => 'textfield',
118
    '#title' => t('Opacity'),
119
    '#default_value' => variable_get('media_opacity', 0.4),
120
    '#description' => t('CSS property opacity; used with overlay.'),
121 85ad3d82 Assos Assos
  );
122
123
  $form['#submit'][] = 'media_admin_config_browser_pre_submit';
124 ca0757b9 Assos Assos
125 85ad3d82 Assos Assos
  return system_settings_form($form);
126
}
127
128
/**
129 ca0757b9 Assos Assos
 * Form submission handler for media_admin_config_browser().
130 85ad3d82 Assos Assos
 */
131
function media_admin_config_browser_pre_submit(&$form, &$form_state) {
132 ca0757b9 Assos Assos
  if (!$form_state['values']['media_dialog_theme']) {
133
    variable_del('media_dialog_theme');
134
    unset($form_state['values']['media_dialog_theme']);
135 85ad3d82 Assos Assos
  }
136
}