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 @ 6ae446a4

1
<?php
2

    
3
/**
4
 * @file
5
 * Administration page callbacks for the Media module.
6
 */
7

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

    
15
  foreach (list_themes() as $key => $theme) {
16
    if ($theme->status) {
17
      $theme_options[$key] = $theme->info['name'];
18
    }
19
  }
20

    
21
  $form['media_dialog_theme'] = array(
22
    '#type' => 'select',
23
    '#title' => t('Media browser theme'),
24
    '#options' => $theme_options,
25
    '#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
  );
28

    
29
  $form['array_filter'] = array(
30
    '#type' => 'value',
31
    '#value' => TRUE,
32
  );
33

    
34
  $form['mediapopup'] = array(
35
    '#type' => 'fieldset',
36
    '#title' => t('Media Popup'),
37
    '#collapsible' => TRUE,
38
    '#collapsed' => TRUE,
39
  );
40
  $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
  );
46
  $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
    '#type' => 'textfield',
78
    '#title' => t('Min Width'),
79
    '#default_value' => variable_get('media_minwidth', 500),
80
    '#description' => t('CSS property min-width.'),
81
  );
82
  $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
  );
122

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

    
125
  return system_settings_form($form);
126
}
127

    
128
/**
129
 * Form submission handler for media_admin_config_browser().
130
 */
131
function media_admin_config_browser_pre_submit(&$form, &$form_state) {
132
  if (!$form_state['values']['media_dialog_theme']) {
133
    variable_del('media_dialog_theme');
134
    unset($form_state['values']['media_dialog_theme']);
135
  }
136
}