Révision d1c64ea8
Ajouté par Assos Assos il y a plus de 6 ans
drupal7/sites/all/modules/file_entity/file_entity.admin.inc | ||
---|---|---|
385 | 385 |
foreach ($files as $file) { |
386 | 386 |
$file_type = file_type_load($file->type); |
387 | 387 |
$account = isset($accounts[$file->uid]) ? $accounts[$file->uid] : NULL; |
388 |
$total_count = (int) isset($result[$file->fid]->total_count) ? $result[$file->fid]->total_count : 0; |
|
388 | 389 |
$options[$file->fid] = array( |
389 | 390 |
'title' => array( |
390 | 391 |
'data' => array( |
... | ... | |
397 | 398 |
'size' => format_size($file->filesize), |
398 | 399 |
'author' => theme('username', array('account' => $account)), |
399 | 400 |
'timestamp' => format_date($file->timestamp, 'short'), |
400 |
'usage' => format_plural((int) $result[$file->fid]->total_count, '1 place', '@count places'),
|
|
401 |
'usage' => format_plural($total_count, '1 place', '@count places'),
|
|
401 | 402 |
); |
402 | 403 |
|
403 | 404 |
// Show a warning for files that do not exist. |
drupal7/sites/all/modules/file_entity/file_entity.field.inc | ||
---|---|---|
34 | 34 |
'field types' => array('file'), |
35 | 35 |
'settings' => array( |
36 | 36 |
'controls' => TRUE, |
37 |
'controls_list' => array( |
|
38 |
'download' => 'download', |
|
39 |
'remote_playback' => 'remote_playback', |
|
40 |
), |
|
37 | 41 |
'autoplay' => FALSE, |
38 | 42 |
'loop' => FALSE, |
39 | 43 |
'preload' => '', |
... | ... | |
49 | 53 |
'field types' => array('file'), |
50 | 54 |
'settings' => array( |
51 | 55 |
'controls' => TRUE, |
56 |
'controls_list' => array( |
|
57 |
'fullscreen' => 'fullscreen', |
|
58 |
'download' => 'download', |
|
59 |
'remote_playback' => 'remote_playback', |
|
60 |
), |
|
52 | 61 |
'autoplay' => FALSE, |
53 | 62 |
'loop' => FALSE, |
54 | 63 |
'muted' => FALSE, |
... | ... | |
123 | 132 |
'#type' => 'checkbox', |
124 | 133 |
'#default_value' => $settings['controls'], |
125 | 134 |
); |
135 |
$element['controls_list'] = array( |
|
136 |
'#title' => t('Controls list'), |
|
137 |
'#type' => 'checkboxes', |
|
138 |
'#options' => array( |
|
139 |
'download' => t('Download'), |
|
140 |
'remote_playback' => t('Remote playback'), |
|
141 |
), |
|
142 |
'#default_value' => $settings['controls_list'], |
|
143 |
'#description' => t("Customize native media controls such as the download and remoteplayback buttons. Valid only if above \"Show audio controls\" setting is enabled.<br>Please note that not all browsers support this feature. Only Chrome 58+ and Opera 45+ supports it."), |
|
144 |
); |
|
126 | 145 |
$element['autoplay'] = array( |
127 | 146 |
'#title' => t('Autoplay'), |
128 | 147 |
'#type' => 'checkbox', |
... | ... | |
159 | 178 |
'#type' => 'checkbox', |
160 | 179 |
'#default_value' => $settings['controls'], |
161 | 180 |
); |
181 |
$element['controls_list'] = array( |
|
182 |
'#title' => t('Controls list'), |
|
183 |
'#type' => 'checkboxes', |
|
184 |
'#options' => array( |
|
185 |
'fullscreen' => t('Fullscreen'), |
|
186 |
'download' => t('Download'), |
|
187 |
'remote_playback' => t('Remote playback'), |
|
188 |
), |
|
189 |
'#default_value' => $settings['controls_list'], |
|
190 |
'#description' => t("Customize native media controls such as the download, fullscreen and remoteplayback buttons. Valid only if above \"Show video controls\" setting is enabled.<br>Please note that not all browsers support this feature. Only Chrome 58+ and Opera 45+ supports it."), |
|
191 |
); |
|
162 | 192 |
$element['autoplay'] = array( |
163 | 193 |
'#title' => t('Autoplay'), |
164 | 194 |
'#type' => 'checkbox', |
... | ... | |
231 | 261 |
elseif ($display['type'] === 'file_audio') { |
232 | 262 |
if (isset($settings['controls'])) { |
233 | 263 |
$summary[] = t('Controls: %controls', array('%controls' => $settings['controls'] ? 'visible' : 'hidden')); |
264 |
if (!empty($settings['controls_list'])) { |
|
265 |
$controls_list = array(); |
|
266 |
foreach ($settings['controls_list'] as $key => $value) { |
|
267 |
if ($value) { |
|
268 |
$controls_list[] = ucfirst(str_replace('_', ' ', $key)); |
|
269 |
} |
|
270 |
} |
|
271 |
if (!empty($controls_list)) { |
|
272 |
$summary[] = t('Controls list: %controls_list', array('%controls_list' => implode(', ', $controls_list))); |
|
273 |
} |
|
274 |
} |
|
234 | 275 |
} |
235 | 276 |
if (isset($settings['autoplay'])) { |
236 | 277 |
$summary[] = t('Autoplay: %autoplay', array('%autoplay' => $settings['autoplay'] ? t('yes') : t('no'))); |
... | ... | |
248 | 289 |
elseif ($display['type'] === 'file_video') { |
249 | 290 |
if (isset($settings['controls'])) { |
250 | 291 |
$summary[] = t('Controls: %controls', array('%controls' => $settings['controls'] ? 'visible' : 'hidden')); |
292 |
if (!empty($settings['controls_list'])) { |
|
293 |
$controls_list = array(); |
|
294 |
foreach ($settings['controls_list'] as $key => $value) { |
|
295 |
if ($value) { |
|
296 |
$controls_list[] = ucfirst(str_replace('_', ' ', $key)); |
|
297 |
} |
|
298 |
} |
|
299 |
if (!empty($controls_list)) { |
|
300 |
$summary[] = t('Controls list: %controls_list', array('%controls_list' => implode(', ', $controls_list))); |
|
301 |
} |
|
302 |
} |
|
251 | 303 |
} |
252 | 304 |
if (isset($settings['autoplay'])) { |
253 | 305 |
$summary[] = t('Autoplay: %autoplay', array('%autoplay' => $settings['autoplay'] ? t('yes') : t('no'))); |
... | ... | |
397 | 449 |
'#theme' => 'file_entity_file_audio', |
398 | 450 |
'#files' => $sources, |
399 | 451 |
'#controls' => $settings['controls'], |
452 |
'#controls_list' => $settings['controls_list'], |
|
400 | 453 |
'#autoplay' => $settings['autoplay'], |
401 | 454 |
'#loop' => $settings['loop'], |
402 | 455 |
'#preload' => $settings['preload'], |
... | ... | |
430 | 483 |
'#theme' => 'file_entity_file_video', |
431 | 484 |
'#files' => $sources, |
432 | 485 |
'#controls' => $settings['controls'], |
486 |
'#controls_list' => $settings['controls_list'], |
|
433 | 487 |
'#autoplay' => $settings['autoplay'], |
434 | 488 |
'#loop' => $settings['loop'], |
435 | 489 |
'#muted' => $settings['muted'], |
drupal7/sites/all/modules/file_entity/file_entity.file.inc | ||
---|---|---|
176 | 176 |
// Add alt and title text to images. |
177 | 177 |
file_entity_set_title_alt_properties($files); |
178 | 178 |
|
179 |
// Load and unserialize metadata. |
|
179 |
// Add metadata to each file. |
|
180 |
foreach ($files as $file) { |
|
181 |
$file->metadata = array(); |
|
182 |
} |
|
180 | 183 |
$results = db_query("SELECT * FROM {file_metadata} WHERE fid IN (:fids)", array(':fids' => array_keys($files))); |
181 | 184 |
|
182 | 185 |
foreach ($results as $result) { |
... | ... | |
200 | 203 |
file_entity_set_title_alt_properties($files); |
201 | 204 |
} |
202 | 205 |
|
206 |
/** |
|
207 |
* Implements hook_entity_load(). |
|
208 |
*/ |
|
209 |
function file_entity_entity_load($entities, $entity_type) { |
|
210 |
file_entity_set_title_alt_properties_on_file_fields($entities, $entity_type); |
|
211 |
} |
|
212 |
|
|
213 |
/** |
|
214 |
* Implements hook_entitycache_load(). |
|
215 |
*/ |
|
216 |
function file_entity_entitycache_load($entities, $entity_type) { |
|
217 |
file_entity_set_title_alt_properties_on_file_fields($entities, $entity_type); |
|
218 |
} |
|
219 |
|
|
220 |
/** |
|
221 |
* Sets the title / alt properties on file fields attached to entities. |
|
222 |
* |
|
223 |
* Files attached to a file or image field can be stored in the field cache or |
|
224 |
* entity cache for whichever entity that the field is attached to. Because |
|
225 |
* $file->alt and $file->title are set in file_entity_file_load() based on the |
|
226 |
* current page language, they will go into the cache with that language as |
|
227 |
* well. To ensure that the correct language is used when the entity is later |
|
228 |
* loaded and displayed in a different language, the alt and title properties |
|
229 |
* can be set again using this function. |
|
230 |
* |
|
231 |
* @param array $entities |
|
232 |
* An array of entity objects of the same type. |
|
233 |
* @param string $entity_type |
|
234 |
* The type of entity. |
|
235 |
* |
|
236 |
* @see file_entity_entity_load() |
|
237 |
* @see file_entity_entitycache_load() |
|
238 |
*/ |
|
239 |
function file_entity_set_title_alt_properties_on_file_fields($entities, $entity_type) { |
|
240 |
foreach ($entities as $entity) { |
|
241 |
list(, , $bundle) = entity_extract_ids($entity_type, $entity); |
|
242 |
foreach (field_info_instances($entity_type, $bundle) as $instance) { |
|
243 |
if (!empty($entity->{$instance['field_name']})) { |
|
244 |
foreach ($entity->{$instance['field_name']} as &$items) { |
|
245 |
foreach ($items as &$item) { |
|
246 |
// We need to detect any field items that passed through |
|
247 |
// file_field_load(), whether they are files, images, or something |
|
248 |
// else. There is no direct way to do that, but checking for a few |
|
249 |
// expected file properties on the field item should be sufficient. |
|
250 |
if (is_array($item) && !empty($item['fid']) && isset($item['uri']) && isset($item['filename'])) { |
|
251 |
$file = (object) $item; |
|
252 |
file_entity_set_title_alt_properties(array($file)); |
|
253 |
$item = (array) $file; |
|
254 |
} |
|
255 |
} |
|
256 |
} |
|
257 |
} |
|
258 |
} |
|
259 |
} |
|
260 |
} |
|
261 |
|
|
203 | 262 |
/** |
204 | 263 |
* Set the title / alt properties of file objects. |
205 | 264 |
* |
206 |
* @param array $files List of file entities. |
|
265 |
* @param array $files |
|
266 |
* List of file entities. |
|
267 |
* @param stdClass $language |
|
268 |
* (optional) A language object to use for translating the title and alt |
|
269 |
* properties. Defaults to the language of the current request. |
|
207 | 270 |
*/ |
208 |
function file_entity_set_title_alt_properties($files) { |
|
271 |
function file_entity_set_title_alt_properties($files, $language = NULL) { |
|
272 |
if (!isset($language)) { |
|
273 |
$language = $GLOBALS['language']; |
|
274 |
} |
|
275 |
|
|
209 | 276 |
$alt = variable_get('file_entity_alt', '[file:field_file_image_alt_text]'); |
210 | 277 |
$title = variable_get('file_entity_title', '[file:field_file_image_title_text]'); |
211 | 278 |
|
212 | 279 |
$replace_options = array( |
213 | 280 |
'clear' => TRUE, |
214 | 281 |
'sanitize' => FALSE, |
215 |
'language' => $GLOBALS['language'],
|
|
282 |
'language' => $language,
|
|
216 | 283 |
); |
217 | 284 |
|
218 | 285 |
foreach ($files as $file) { |
219 |
$file->metadata = array(); |
|
220 |
|
|
221 | 286 |
// Load alt and title text from fields. |
222 | 287 |
if (!empty($alt)) { |
223 | 288 |
$output = token_replace($alt, array('file' => $file), $replace_options); |
drupal7/sites/all/modules/file_entity/file_entity.file_api.inc | ||
---|---|---|
241 | 241 |
drupal_alter('file_displays', $displays, $file, $view_mode); |
242 | 242 |
_file_sort_array_by_weight($displays); |
243 | 243 |
|
244 |
// Since $file->alt and $file->title were set in file_entity_file_load() |
|
245 |
// (which is a language-agnostic hook) they will not be in the correct |
|
246 |
// language if the file is being displayed in a language other than the |
|
247 |
// default one. Set them again here, using the correct language. This must |
|
248 |
// run after hook_file_displays_alter() since the Media module sets |
|
249 |
// $file->alt and $file->title again during that hook. |
|
250 |
if ($langcode != $GLOBALS['language_content']->language) { |
|
251 |
$languages = language_list(); |
|
252 |
if (isset($languages[$langcode])) { |
|
253 |
file_entity_set_title_alt_properties(array($file), $languages[$langcode]); |
|
254 |
} |
|
255 |
} |
|
256 |
|
|
244 | 257 |
// Attempt to display the file with each of the possible displays. Stop after |
245 | 258 |
// the first successful one. See file_displays() for details. |
246 | 259 |
$element = NULL; |
drupal7/sites/all/modules/file_entity/file_entity.file_default_displays.inc | ||
---|---|---|
18 | 18 |
$file_display->status = TRUE; |
19 | 19 |
$file_display->settings = array( |
20 | 20 |
'controls' => 1, |
21 |
'controls_list' => array( |
|
22 |
'download' => 'download', |
|
23 |
'remote_playback' => 'remote_playback', |
|
24 |
), |
|
21 | 25 |
'autoplay' => 0, |
22 | 26 |
'loop' => 0, |
23 | 27 |
'multiple_file_behavior' => 'tags', |
... | ... | |
39 | 43 |
$file_display->status = TRUE; |
40 | 44 |
$file_display->settings = array( |
41 | 45 |
'controls' => 1, |
46 |
'controls_list' => array( |
|
47 |
'download' => 'download', |
|
48 |
'remote_playback' => 'remote_playback', |
|
49 |
), |
|
42 | 50 |
'autoplay' => 0, |
43 | 51 |
'loop' => 0, |
44 | 52 |
'multiple_file_behavior' => 'tags', |
... | ... | |
139 | 147 |
$file_display->status = TRUE; |
140 | 148 |
$file_display->settings = array( |
141 | 149 |
'controls' => 1, |
150 |
'controls_list' => array( |
|
151 |
'fullscreen' => 'fullscreen', |
|
152 |
'download' => 'download', |
|
153 |
'remote_playback' => 'remote_playback', |
|
154 |
), |
|
142 | 155 |
'autoplay' => 0, |
143 | 156 |
'loop' => 0, |
144 | 157 |
'width' => '', |
... | ... | |
162 | 175 |
$file_display->status = TRUE; |
163 | 176 |
$file_display->settings = array( |
164 | 177 |
'controls' => 1, |
178 |
'controls_list' => array( |
|
179 |
'fullscreen' => 'fullscreen', |
|
180 |
'download' => 'download', |
|
181 |
'remote_playback' => 'remote_playback', |
|
182 |
), |
|
165 | 183 |
'autoplay' => 0, |
166 | 184 |
'loop' => 0, |
167 | 185 |
'width' => '', |
drupal7/sites/all/modules/file_entity/file_entity.info | ||
---|---|---|
32 | 32 |
; We have to add a fake version so Git checkouts do not fail Media dependencies |
33 | 33 |
version = 7.x-2.x-dev |
34 | 34 |
|
35 |
; Information added by Drupal.org packaging script on 2017-10-03
|
|
36 |
version = "7.x-2.6"
|
|
35 |
; Information added by Drupal.org packaging script on 2017-10-18
|
|
36 |
version = "7.x-2.11"
|
|
37 | 37 |
core = "7.x" |
38 | 38 |
project = "file_entity" |
39 |
datestamp = "1507063150"
|
|
39 |
datestamp = "1508346687"
|
|
40 | 40 |
|
drupal7/sites/all/modules/file_entity/file_entity.module | ||
---|---|---|
894 | 894 |
'variables' => array( |
895 | 895 |
'files' => array(), |
896 | 896 |
'controls' => TRUE, |
897 |
'controls_list' => array( |
|
898 |
'download' => 'download', |
|
899 |
'remote_playback' => 'remote_playback', |
|
900 |
), |
|
897 | 901 |
'autoplay' => FALSE, |
898 | 902 |
'loop' => FALSE, |
899 | 903 |
'preload' => NULL, |
... | ... | |
904 | 908 |
'variables' => array( |
905 | 909 |
'files' => array(), |
906 | 910 |
'controls' => TRUE, |
911 |
'controls_list' => array( |
|
912 |
'fullscreen' => 'fullscreen', |
|
913 |
'download' => 'download', |
|
914 |
'remote_playback' => 'remote_playback', |
|
915 |
), |
|
907 | 916 |
'autoplay' => FALSE, |
908 | 917 |
'loop' => FALSE, |
909 | 918 |
'muted' => FALSE, |
... | ... | |
1678 | 1687 |
// $file may be either an object or a file type. Since file types cannot be |
1679 | 1688 |
// an integer, use either fid or type as the static cache id. |
1680 | 1689 |
$cache_id = NULL; |
1681 |
if (!empty($file->id)) {
|
|
1682 |
$cache_id = $file->id; |
|
1690 |
if (is_object($file) && !empty($file->fid)) {
|
|
1691 |
$cache_id = $file->fid;
|
|
1683 | 1692 |
} |
1684 |
elseif (is_string($file) && $op == 'create') {
|
|
1693 |
elseif ($op == 'create' && is_string($file)) {
|
|
1685 | 1694 |
$cache_id = $file; |
1686 | 1695 |
} |
1696 |
elseif ($op == 'create' && is_object($file) && !empty($file->type)) { |
|
1697 |
$cache_id = $file->type; |
|
1698 |
} |
|
1687 | 1699 |
else { |
1688 | 1700 |
$cache_id = drupal_hash_base64(serialize($file)); |
1689 | 1701 |
} |
... | ... | |
1746 | 1758 |
* Implements hook_file_entity_access(). |
1747 | 1759 |
*/ |
1748 | 1760 |
function file_entity_file_entity_access($op, $file, $account) { |
1761 |
// If the op is "create," all that's needed is to check the create permission. |
|
1762 |
if ($op == 'create') { |
|
1763 |
if (user_access('create files')) { |
|
1764 |
return FILE_ENTITY_ACCESS_ALLOW; |
|
1765 |
} |
|
1766 |
} |
|
1749 | 1767 |
// If the file URI is invalid, deny access. |
1750 | 1768 |
if (is_object($file) && isset($file->uri) && !file_valid_uri($file->uri)) { |
1751 | 1769 |
if(isset($file->is_new) && $file->is_new == true && user_access('create files')) { |
... | ... | |
1754 | 1772 |
return FILE_ENTITY_ACCESS_DENY; |
1755 | 1773 |
} |
1756 | 1774 |
|
1757 |
if ($op == 'create') { |
|
1758 |
if (user_access('create files')) { |
|
1759 |
return FILE_ENTITY_ACCESS_ALLOW; |
|
1760 |
} |
|
1761 |
} |
|
1762 |
|
|
1763 | 1775 |
if (!empty($file)) { |
1764 | 1776 |
$type = is_string($file) ? $file : $file->type; |
1765 | 1777 |
|
... | ... | |
2137 | 2149 |
'label' => t('Document'), |
2138 | 2150 |
'description' => t('A <em>Document</em> file is written information.'), |
2139 | 2151 |
'mimetypes' => array( |
2152 |
'text/html', |
|
2140 | 2153 |
'text/plain', |
2154 |
'application/acad', |
|
2141 | 2155 |
'application/msword', |
2142 | 2156 |
'application/vnd.ms-excel', |
2143 | 2157 |
'application/pdf', |
drupal7/sites/all/modules/file_entity/file_entity.pages.inc | ||
---|---|---|
90 | 90 |
'enabledPlugins' => array(), |
91 | 91 |
'schemes' => array(), |
92 | 92 |
'max_filesize' => '', |
93 |
'uri_scheme' => 'public',
|
|
93 |
'uri_scheme' => file_default_scheme(),
|
|
94 | 94 |
'plugins' => '' |
95 | 95 |
); |
96 | 96 |
|
drupal7/sites/all/modules/file_entity/file_entity.theme.inc | ||
---|---|---|
53 | 53 |
$options['attributes']['title'] = check_plain($file->filename); |
54 | 54 |
} |
55 | 55 |
|
56 |
return '<span class="file">' . $icon . ' ' . l($link_text, $url, $options) . '</span>'; |
|
56 |
$output = '<span class="file">' . $icon . ' ' . l($link_text, $uri['path'], $uri['options']); |
|
57 |
$output .= ' ' . '<span class="file-size">(' . format_size($file->filesize) . ')</span>'; |
|
58 |
$output .= '</span>'; |
|
59 |
return $output; |
|
57 | 60 |
} |
58 | 61 |
|
59 | 62 |
/** |
... | ... | |
131 | 134 |
$audio_attributes = array(); |
132 | 135 |
if ($variables['controls']) { |
133 | 136 |
$audio_attributes['controls'] = 'controls'; |
137 |
|
|
138 |
if (!empty($variables['controls_list'])) { |
|
139 |
$controls_list = array(); |
|
140 |
foreach ($variables['controls_list'] as $key => $value) { |
|
141 |
if (!$value) { |
|
142 |
switch ($key) { |
|
143 |
case 'download': |
|
144 |
$controls_list[] = 'nodownload'; |
|
145 |
break; |
|
146 |
case 'remote_playback': |
|
147 |
$controls_list[] = 'noremoteplayback'; |
|
148 |
break; |
|
149 |
} |
|
150 |
} |
|
151 |
} |
|
152 |
$audio_attributes['controlsList'] = implode(' ', $controls_list); |
|
153 |
} |
|
134 | 154 |
} |
135 | 155 |
if ($variables['autoplay']) { |
136 | 156 |
$audio_attributes['autoplay'] = 'autoplay'; |
... | ... | |
177 | 197 |
$video_attributes = array(); |
178 | 198 |
if ($variables['controls']) { |
179 | 199 |
$video_attributes['controls'] = 'controls'; |
200 |
|
|
201 |
if (!empty($variables['controls_list'])) { |
|
202 |
$controls_list = array(); |
|
203 |
foreach ($variables['controls_list'] as $key => $value) { |
|
204 |
if (!$value) { |
|
205 |
switch ($key) { |
|
206 |
case 'fullscreen': |
|
207 |
$controls_list[] = 'nofullscreen'; |
|
208 |
break; |
|
209 |
case 'download': |
|
210 |
$controls_list[] = 'nodownload'; |
|
211 |
break; |
|
212 |
case 'remote_playback': |
|
213 |
$controls_list[] = 'noremoteplayback'; |
|
214 |
break; |
|
215 |
} |
|
216 |
} |
|
217 |
} |
|
218 |
$video_attributes['controlsList'] = implode(' ', $controls_list); |
|
219 |
} |
|
180 | 220 |
} |
181 | 221 |
if ($variables['autoplay']) { |
182 | 222 |
$video_attributes['autoplay'] = 'autoplay'; |
drupal7/sites/all/modules/file_entity/tests/file_entity_test.info | ||
---|---|---|
5 | 5 |
dependencies[] = file_entity |
6 | 6 |
hidden = TRUE |
7 | 7 |
|
8 |
; Information added by Drupal.org packaging script on 2017-10-03
|
|
9 |
version = "7.x-2.6"
|
|
8 |
; Information added by Drupal.org packaging script on 2017-10-18
|
|
9 |
version = "7.x-2.11"
|
|
10 | 10 |
core = "7.x" |
11 | 11 |
project = "file_entity" |
12 |
datestamp = "1507063150"
|
|
12 |
datestamp = "1508346687"
|
|
13 | 13 |
|
drupal7/sites/all/modules/media/css/media.css | ||
---|---|---|
19 | 19 |
display: none; |
20 | 20 |
} |
21 | 21 |
|
22 |
/* Workaround for Modal dialog underneith the Ctools modal dialog with jQuery 1.10. |
|
23 |
@TODO Remove this if ever ctools issue #1397370 ever gets fixed. */ |
|
24 |
.ui-front { |
|
25 |
z-index: 10001 !important; |
|
26 |
} |
|
27 |
|
|
22 | 28 |
#media-browser-tabset .ui-widget-header { |
23 | 29 |
background: none; |
24 | 30 |
} |
drupal7/sites/all/modules/media/js/media.js | ||
---|---|---|
18 | 18 |
var elements; |
19 | 19 |
|
20 | 20 |
function initMediaBrowser(selector) { |
21 |
$context.find(selector) |
|
22 |
.once('media-browser-launch') |
|
23 |
.siblings('.browse').show() |
|
24 |
.siblings('.upload').hide() |
|
25 |
.siblings('.attach').hide() |
|
26 |
.siblings('.browse').bind('click', {configuration: settings.media.elements[selector]}, Drupal.media.openBrowser); |
|
21 |
var widget=$context.find(selector).once('media-browser-launch'); |
|
22 |
var browse=widget.siblings('.browse').add(widget.find('.browse')); |
|
23 |
var upload=browse.siblings('.upload').add(widget.find('.upload')); |
|
24 |
var attach=upload.siblings('.attach').add(widget.find('.attach')); |
|
25 |
browse.show(); |
|
26 |
upload.hide(); |
|
27 |
attach.hide(); |
|
28 |
browse.bind('click', {configuration: settings.media.elements[selector]}, Drupal.media.openBrowser); |
|
27 | 29 |
} |
28 | 30 |
|
29 | 31 |
if (settings.media && settings.media.elements) { |
drupal7/sites/all/modules/media/media.info | ||
---|---|---|
24 | 24 |
; We have to add a fake version so Git checkouts do not fail Media dependencies |
25 | 25 |
version = 7.x-2.x-dev |
26 | 26 |
|
27 |
; Information added by Drupal.org packaging script on 2017-09-05
|
|
28 |
version = "7.x-2.11"
|
|
27 |
; Information added by Drupal.org packaging script on 2017-10-13
|
|
28 |
version = "7.x-2.12"
|
|
29 | 29 |
core = "7.x" |
30 | 30 |
project = "media" |
31 |
datestamp = "1504575549"
|
|
31 |
datestamp = "1507905248"
|
|
32 | 32 |
|
drupal7/sites/all/modules/media/modules/media_bulk_upload/media_bulk_upload.info | ||
---|---|---|
15 | 15 |
files[] = includes/MediaBrowserBulkUpload.inc |
16 | 16 |
files[] = tests/media_bulk_upload.test |
17 | 17 |
|
18 |
; Information added by Drupal.org packaging script on 2017-09-05
|
|
19 |
version = "7.x-2.11"
|
|
18 |
; Information added by Drupal.org packaging script on 2017-10-13
|
|
19 |
version = "7.x-2.12"
|
|
20 | 20 |
core = "7.x" |
21 | 21 |
project = "media" |
22 |
datestamp = "1504575549"
|
|
22 |
datestamp = "1507905248"
|
|
23 | 23 |
|
drupal7/sites/all/modules/media/modules/media_internet/media_internet.info | ||
---|---|---|
12 | 12 |
files[] = includes/MediaInternetValidationException.inc |
13 | 13 |
files[] = tests/media_internet.test |
14 | 14 |
|
15 |
; Information added by Drupal.org packaging script on 2017-09-05
|
|
16 |
version = "7.x-2.11"
|
|
15 |
; Information added by Drupal.org packaging script on 2017-10-13
|
|
16 |
version = "7.x-2.12"
|
|
17 | 17 |
core = "7.x" |
18 | 18 |
project = "media" |
19 |
datestamp = "1504575549"
|
|
19 |
datestamp = "1507905248"
|
|
20 | 20 |
|
drupal7/sites/all/modules/media/modules/media_internet/tests/media_internet_test.info | ||
---|---|---|
7 | 7 |
files[] = includes/MediaInternetTestStreamWrapper.inc |
8 | 8 |
files[] = includes/MediaInternetTestHandler.inc |
9 | 9 |
|
10 |
; Information added by Drupal.org packaging script on 2017-09-05
|
|
11 |
version = "7.x-2.11"
|
|
10 |
; Information added by Drupal.org packaging script on 2017-10-13
|
|
11 |
version = "7.x-2.12"
|
|
12 | 12 |
core = "7.x" |
13 | 13 |
project = "media" |
14 |
datestamp = "1504575549"
|
|
14 |
datestamp = "1507905248"
|
|
15 | 15 |
|
drupal7/sites/all/modules/media/modules/media_migrate_file_types/media_migrate_file_types.info | ||
---|---|---|
8 | 8 |
|
9 | 9 |
configure = admin/structure/file-types/upgrade |
10 | 10 |
|
11 |
; Information added by Drupal.org packaging script on 2017-09-05
|
|
12 |
version = "7.x-2.11"
|
|
11 |
; Information added by Drupal.org packaging script on 2017-10-13
|
|
12 |
version = "7.x-2.12"
|
|
13 | 13 |
core = "7.x" |
14 | 14 |
project = "media" |
15 |
datestamp = "1504575549"
|
|
15 |
datestamp = "1507905248"
|
|
16 | 16 |
|
drupal7/sites/all/modules/media/modules/media_wysiwyg/css/media_wysiwyg.base.css | ||
---|---|---|
2 | 2 |
* @file |
3 | 3 |
* Styles to apply to all user-facing pages for alignment support. |
4 | 4 |
*/ |
5 |
.media-wysiwyg-align-left { |
|
5 |
.media-wysiwyg-align-left, |
|
6 |
.media-float-left { |
|
6 | 7 |
float: left; |
7 | 8 |
margin-right: 20px; |
8 | 9 |
} |
9 |
.media-wysiwyg-align-right { |
|
10 |
.media-wysiwyg-align-right, |
|
11 |
.media-float-right { |
|
10 | 12 |
float: right; |
11 | 13 |
margin-left: 20px; |
12 | 14 |
} |
drupal7/sites/all/modules/media/modules/media_wysiwyg/includes/media_wysiwyg.features.inc | ||
---|---|---|
42 | 42 |
} |
43 | 43 |
// Add default option. |
44 | 44 |
$options[$file_type . '_default_restrict_wysiwyg'] = |
45 |
t('@file_type view mode restriction: Default', array(
|
|
45 |
t('@file_type view mode restriction: Default', array( |
|
46 | 46 |
'@file_type' => $file_type_label, |
47 | 47 |
)); |
48 | 48 |
} |
... | ... | |
91 | 91 |
$mode_data_key = $file_type . '_wysiwyg_view_mode'; |
92 | 92 |
if (array_key_exists($mode_data_key, $data) || in_array($mode_data_key, $data, TRUE)) { |
93 | 93 |
$view_mode = _media_wysiwyg_get_wysiwyg_mode($file_type); |
94 |
$view_mode_export = (!empty($view_mode) ? features_var_export($view_mode) : "'none'");
|
|
94 |
$view_mode_export = (!empty($view_mode) ? features_var_export($view_mode) : "'none'"); |
|
95 | 95 |
$code[] = " // WYSIWYG view mode for $file_type files."; |
96 | 96 |
$code[] = " \$media_wysiwyg['{$mode_data_key}'] = {$view_mode_export};"; |
97 | 97 |
$code[] = ""; |
drupal7/sites/all/modules/media/modules/media_wysiwyg/includes/media_wysiwyg.file_usage.inc | ||
---|---|---|
59 | 59 |
unset($entity_files[$fid]); |
60 | 60 |
} |
61 | 61 |
// There are the same number of files, nothing to do |
62 |
elseif ($entity_files[$fid] == $old_file_count) {
|
|
62 |
elseif ($entity_files[$fid] == $old_file_count) { |
|
63 | 63 |
unset($entity_files[$fid]); |
64 | 64 |
} |
65 | 65 |
// There are more files now, adjust the difference for the greater number. |
... | ... | |
121 | 121 |
/** |
122 | 122 |
* Utility function to get the file count in this entity |
123 | 123 |
* |
124 |
* @param type $entity
|
|
125 |
* @param type $entity_type
|
|
124 |
* @param string or int or object... $entity
|
|
125 |
* @param string or int or object... $entity_type
|
|
126 | 126 |
* @return int |
127 | 127 |
*/ |
128 | 128 |
function media_wysiwyg_entity_field_count_files($entity_type, $entity) { |
... | ... | |
154 | 154 |
/** |
155 | 155 |
* Implements hook_field_attach_delete_revision(). |
156 | 156 |
* |
157 |
* @param type $entity_type
|
|
158 |
* @param type $entity
|
|
157 |
* @param string or int or object... $entity_type
|
|
158 |
* @param string or int or object... $entity
|
|
159 | 159 |
*/ |
160 | 160 |
function media_wysiwyg_field_attach_delete_revision($entity_type, $entity) { |
161 | 161 |
list($entity_id) = entity_extract_ids($entity_type, $entity); |
162 | 162 |
$files = media_wysiwyg_entity_field_count_files($entity_type, $entity); |
163 | 163 |
foreach ($files as $fid => $count) { |
164 | 164 |
if ($file = file_load($fid)) { |
165 |
file_usage_delete($file, 'media', $entity_type , $entity_id, $count);
|
|
165 |
file_usage_delete($file, 'media', $entity_type, $entity_id, $count); |
|
166 | 166 |
} |
167 | 167 |
} |
168 | 168 |
} |
drupal7/sites/all/modules/media/modules/media_wysiwyg/includes/media_wysiwyg.pages.inc | ||
---|---|---|
80 | 80 |
'#default_value' => $default_view_mode, |
81 | 81 |
'#description' => t('Choose the type of display you would like for this |
82 | 82 |
file. Please be aware that files may display differently than they do when |
83 |
they are inserted into an editor.') |
|
83 |
they are inserted into an editor.'),
|
|
84 | 84 |
); |
85 | 85 |
|
86 | 86 |
// If necessary, display the alignment widget. |
... | ... | |
112 | 112 |
// Get the external url from the fid array. |
113 | 113 |
$external_url = empty($query_fields['external_url']) ? NULL : $query_fields['external_url']; |
114 | 114 |
// Field to attach external url's to files for linking. |
115 |
if(variable_get('media_wysiwyg_external_link', FALSE)) { |
|
116 |
if($file->type == 'image') { |
|
115 |
if (variable_get('media_wysiwyg_external_link', FALSE)) {
|
|
116 |
if ($file->type == 'image') {
|
|
117 | 117 |
$form['options']['external_url'] = array( |
118 | 118 |
'#type' => 'textfield', |
119 | 119 |
'#title' => t('Link Image'), |
... | ... | |
155 | 155 |
/** |
156 | 156 |
* Add ajax preview when selecting view mode in wysiwyg editor. |
157 | 157 |
*/ |
158 |
function media_wysiwyg_format_form_view_mode(&$form, $form_state, $file) {
|
|
158 |
function media_wysiwyg_format_form_view_mode(&$form, $form_state, $file) { |
|
159 | 159 |
// Check to see if a view mode ("format") has already been specified for |
160 |
// this media item. First, check for a standard form-submitted value.
|
|
160 |
// this media item. First, check for a standard form-submitted value. |
|
161 | 161 |
if (!empty($form_state['values']['format'])) { |
162 | 162 |
$view_mode = $form_state['values']['format']; |
163 | 163 |
} |
... | ... | |
169 | 169 |
} |
170 | 170 |
} |
171 | 171 |
// If we were unable to determine a view mode, or we found a view mode |
172 |
// that does not exist in the list of format options presented on this
|
|
173 |
// form, use the default view mode.
|
|
172 |
// that does not exist in the list of format options presented on this |
|
173 |
// form, use the default view mode. |
|
174 | 174 |
if (!isset($view_mode) || !array_key_exists($view_mode, $form['options']['format']['#options'])) { |
175 | 175 |
$view_mode = variable_get('media_wysiwyg_wysiwyg_default_view_mode', 'full'); |
176 | 176 |
} |
177 | 177 |
|
178 |
$link_options = array( |
|
179 |
'attributes' => array( |
|
180 |
'class' => 'button', |
|
181 |
'title' => t('Use for replace fox or edit file fields.'), |
|
182 |
), |
|
183 |
); |
|
184 |
if (!empty($_GET['render'])) { |
|
185 |
$link_options['query']['render'] = $_GET['render']; |
|
186 |
} |
|
187 |
|
|
178 | 188 |
$form['preview'] = array(); |
179 | 189 |
$form['preview']['#prefix'] = '<div class="media-preview-group"><div class="media-item"><div class="media-thumbnail">'; |
180 |
$form['preview']['#suffix'] = '</div><div class="label-wrapper"><label class="media-filename">' . check_plain($file->filename) . '</label></div></div><div class="edit-file-link">' . l(t('Edit file'), 'file/'.$file->fid.'/edit', array('attributes' => array('class' => 'button', 'title' => t('Use for replace file or edit file fields.')))) . '</div></div>';
|
|
190 |
$form['preview']['#suffix'] = '</div><div class="label-wrapper"><label class="media-filename">' . check_plain($file->filename) . '</label></div></div><div class="edit-file-link">' . l(t('Edit file'), 'file/' . $file->fid . '/edit', $link_options) . '</div></div>';
|
|
181 | 191 |
$form['preview']['thumbnail'] = file_view_file($file, $view_mode); |
182 | 192 |
$form['preview']['thumbnail']['#prefix'] = '<div id="media-preview">'; |
183 | 193 |
$form['preview']['thumbnail']['#suffix'] = '</div>'; |
... | ... | |
212 | 222 |
} |
213 | 223 |
|
214 | 224 |
/** |
215 |
* AJAX callback to select the portion of the format form to be updated with a preview.
|
|
225 |
* AJAX callback to select portion of format form to be updated with a preview.
|
|
216 | 226 |
* |
217 | 227 |
* @param array $form |
218 | 228 |
* An associative array containing the structure of the form. |
drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.info | ||
---|---|---|
16 | 16 |
|
17 | 17 |
configure = admin/config/media/browser |
18 | 18 |
|
19 |
; Information added by Drupal.org packaging script on 2017-09-05
|
|
20 |
version = "7.x-2.11"
|
|
19 |
; Information added by Drupal.org packaging script on 2017-10-13
|
|
20 |
version = "7.x-2.12"
|
|
21 | 21 |
core = "7.x" |
22 | 22 |
project = "media" |
23 |
datestamp = "1504575549"
|
|
23 |
datestamp = "1507905248"
|
|
24 | 24 |
|
drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.install | ||
---|---|---|
89 | 89 |
$dependencies['media_wysiwyg'][7201] = array( |
90 | 90 |
'media' => 7226, |
91 | 91 |
); |
92 |
|
|
93 |
return $dependencies; |
|
92 | 94 |
} |
93 | 95 |
|
94 | 96 |
/** |
drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.variable.inc | ||
---|---|---|
20 | 20 |
} |
21 | 21 |
|
22 | 22 |
/** |
23 |
* Implements hook_variable_info(). |
|
24 |
*/ |
|
23 |
* Implements hook_variable_info().
|
|
24 |
*/
|
|
25 | 25 |
function media_wysiwyg_variable_info($options) { |
26 | 26 |
$variables['media_wysiwyg_wysiwyg_title'] = array( |
27 | 27 |
'type' => 'string', |
drupal7/sites/all/modules/media/modules/media_wysiwyg_view_mode/media_wysiwyg_view_mode.info | ||
---|---|---|
3 | 3 |
package = Media |
4 | 4 |
core = 7.x |
5 | 5 |
|
6 |
; Information added by Drupal.org packaging script on 2017-09-05
|
|
7 |
version = "7.x-2.11"
|
|
6 |
; Information added by Drupal.org packaging script on 2017-10-13
|
|
7 |
version = "7.x-2.12"
|
|
8 | 8 |
core = "7.x" |
9 | 9 |
project = "media" |
10 |
datestamp = "1504575549"
|
|
10 |
datestamp = "1507905248"
|
|
11 | 11 |
|
drupal7/sites/all/modules/media/modules/mediafield/mediafield.info | ||
---|---|---|
4 | 4 |
core = 7.x |
5 | 5 |
dependencies[] = media |
6 | 6 |
|
7 |
; Information added by Drupal.org packaging script on 2017-09-05
|
|
8 |
version = "7.x-2.11"
|
|
7 |
; Information added by Drupal.org packaging script on 2017-10-13
|
|
8 |
version = "7.x-2.12"
|
|
9 | 9 |
core = "7.x" |
10 | 10 |
project = "media" |
11 |
datestamp = "1504575549"
|
|
11 |
datestamp = "1507905248"
|
|
12 | 12 |
|
drupal7/sites/all/modules/media/tests/media_module_test.info | ||
---|---|---|
6 | 6 |
|
7 | 7 |
files[] = includes/MediaModuleTest.inc |
8 | 8 |
|
9 |
; Information added by Drupal.org packaging script on 2017-09-05
|
|
10 |
version = "7.x-2.11"
|
|
9 |
; Information added by Drupal.org packaging script on 2017-10-13
|
|
10 |
version = "7.x-2.12"
|
|
11 | 11 |
core = "7.x" |
12 | 12 |
project = "media" |
13 |
datestamp = "1504575549"
|
|
13 |
datestamp = "1507905248"
|
|
14 | 14 |
|
Formats disponibles : Unified diff
Weekly update of contrib modules