Commit 311dae76 authored by Paris Liakos's avatar Paris Liakos

Accidentally committed #1881152 with this:/

Revert "Issue #1898360 by arthurf: Deprecated code removal"

This reverts commit b499adf1.
parent b499adf1
......@@ -13,56 +13,22 @@
display: none;
}
/* Remove the default border */
.ui-widget-content {
border: none;
}
#media-dialog-tabs-wrapper {
height: 2.6em;
padding-left: 10px;
}
/* Title for the media browser */
#media-dialog-tabs-wrapper .item-list h3 {
float: left;
}
#media-browser-tabset ul.tabs {
padding: 0;
border: none;
}
/* Reset the height to match the browser */
#media-browser-tabset ul.tabs.primary li a:link {
height: 2em;
}
.media-browser-tab.ui-tabs-panel {
border: 1px solid #cccccc;
}
/* Media item */
.media-item {
background: #FFFFFF;
border: 1px solid #CCCCCC;
padding: 5px;
position: relative;
width: 100px;
}
.media-item img {
height: auto;
margin-bottom: 10px;
width: 100%;
}
.media-item .label-wrapper {
text-align: center;
position: absolute;
bottom: 0;
margin-left: auto;
margin-right: auto;
width: 90%;
}
.media-item .label-wrapper label {
......
......@@ -154,12 +154,7 @@ function media_browser($selected = NULL) {
'#suffix' => '</div>',
);
$output['tabset']['list'] = array(
'#theme' => 'item_list',
'#title' => t('Select a file'),
'#attributes' => array('class' => array('tabs', 'primary')),
'#items' => $tabs,
'#prefix' => '<div id="media-dialog-tabs-wrapper">' . "\n",
'#suffix' => "</div>\n",
'#markup' => theme('item_list', array('items' => $tabs)),
);
$output['tabset']['plugins'] = $plugin_output;
......
......@@ -5,6 +5,25 @@
* Common pages for the Media module.
*/
/**
* Menu callback; display a thumbnail for an AJAX preview.
*/
function media_preview_ajax() {
$url = $_GET['url'];
$uri = media_parse_to_uri($url);
if ($uri) {
$file = file_uri_to_object($uri);
drupal_json_output(array(
'preview' => theme('media_admin_thumbnail', array('file' => $file)),
));
}
else {
drupal_json_output(array(
'error' => t('Invalid URL.'),
));
}
die();
}
/**
* Menu callback; Edit multiple files on the same page using multiform module.
......
......@@ -22,6 +22,51 @@ function theme_media_file_list($element) {
return '<div class="media-file-list">' . theme('form_element', $element, $element['#children']) . '</div>';
}
/**
* Theme a thumbnail.
*
* @param array $variables
* array items being passed in
*/
function theme_media_admin_thumbnail($variables) {
$path = drupal_get_path('module', 'media');
$file = $variables['file'];
$style_name = $variables['style_name'];
if (isset($file)) {
$file_url = file_create_url($file->uri);
}
else {
return '';
}
$output = '';
// Display a thumbnail for images.
if (strstr($file->filemime, 'image')) {
$thumbnail = theme('image_style',
array(
'style_name' => 'thumbnail',
'path' => $file->uri,
'alt' => t('Thumbnail for !filename.', array('!filename' => $file->filename)),
)
);
}
// Display the 'unknown' icon for other file types.
else {
$thumbnail = theme('image',
array(
'path' => $path . '/images/file-unknown.png',
'alt' => t('Thumbnail for !filename.', array('!filename' => $file->filename)),
'attributes' => array('class' => 'file-unknown'),
));
}
$output .= l($thumbnail,
$file_url,
array(
'html' => TRUE,
'attributes' => array('class' => 'media-thumbnail'),
));
return $output;
}
/**
* Add messages to the page.
*/
......
......@@ -305,9 +305,9 @@ Drupal.media.popups.getDialogOptions = function () {
modal: true,
draggable: false,
resizable: false,
minWidth: 500,
width: 670,
height: 280,
minWidth: 600,
width: 800,
height: 550,
position: 'center',
overlay: {
backgroundColor: '#000000',
......
......@@ -270,6 +270,12 @@ function media_theme() {
'file' => 'includes/media.theme.inc',
),
// Administrative thumbnail previews.
'media_admin_thumbnail' => array(
'variables' => array('file' => array(), 'style_name' => 'thumbnail'),
'file' => 'includes/media.theme.inc',
),
// Dialog page.
'media_dialog_page' => array(
'render element' => 'page',
......@@ -300,7 +306,7 @@ function media_image_default_styles() {
'effects' => array(
array(
'name' => 'image_scale_and_crop',
'data' => array('width' => 100, 'height' => 100),
'data' => array('width' => 180, 'height' => 180),
'weight' => 0,
),
),
......@@ -652,10 +658,10 @@ function media_library() {
$path . '/js/media.popups.js' => array('group' => JS_DEFAULT),
),
'dependencies' => array(
array('media', 'media_base'),
array('system', 'ui.resizable'),
array('system', 'ui.draggable'),
array('system', 'ui.dialog'),
array('media', 'media_base'),
),
);
......@@ -665,11 +671,14 @@ function media_library() {
'js' => array(
$path . '/js/media.browser.js' => array('group' => JS_DEFAULT),
),
'css' => array(
$path . '/css/media.browser.css' => array('group' => CSS_DEFAULT),
),
'dependencies' => array(
array('media', 'media_base'),
array('system', 'ui.tabs'),
array('system', 'ui.draggable'),
array('system', 'ui.dialog'),
array('media', 'media_base'),
),
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment