Skip to content

Commit

Permalink
mediamanager fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
akate committed Jun 22, 2011
1 parent 030dd1d commit 6b46772
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 23 deletions.
37 changes: 25 additions & 12 deletions inc/media.php
Expand Up @@ -697,7 +697,7 @@ function media_tab_view($image, $ns, $auth=null) {

echo '<div class="mediamanager-tab-detail-view">';
echo '<div class="background-container">';
echo $lang['media_view'];
echo $image;
echo '</div>';

echo '<div class="scroll-container">';
Expand Down Expand Up @@ -880,17 +880,17 @@ function media_diff($image, $ns, $auth) {
$revs = getRevisions($image, 0, 1, 8192, true);
$l_rev = $revs[0];
}
echo '<table><tr><td>';
echo '<ul class="mediamanager-table-50"><li><div>';
media_preview($image, $auth, $l_rev);
echo '</td>';
echo '<td>';
echo '</div></li>';
echo '<li><div>';
media_preview($image, $auth, $r_rev);
echo '</td></tr><tr><td>';
echo '</div></li><li><div>';
media_details($image, $auth, $l_rev);
echo '</td>';
echo '<td>';
echo '</div></li>';
echo '<li><div>';
media_details($image, $auth, $r_rev);
echo '</td></tr></table>';
echo '</div></li></ul>';
}

/**
Expand Down Expand Up @@ -1045,7 +1045,14 @@ function media_printfile_thumbs($item,$auth,$jump){

// output
echo '<li><div>';
if($item['isimg']) media_printimgdetail($item, true);
if($item['isimg']) {
media_printimgdetail($item, true);
} else {
echo '<a name="d_:'.$item['id'].'" class="image" title="'.$item['id'].'" href="'.
media_managerURL(array('image' => hsc($item['id']))).'">';
echo '<img src="'.DOKU_BASE.'lib/images/icon-file.png" width="90px" />';
echo '</a>';
}
echo '<a href="'.media_managerURL(array('image' => hsc($item['id']))).'" name=
"h_:'.$item['id'].'" class="info" >'.hsc($file).'</a>';
if($item['isimg']){
Expand All @@ -1054,6 +1061,8 @@ function media_printfile_thumbs($item,$auth,$jump){
$info .= '&#215;';
$info .= (int) $item['meta']->getField('File.Height');
echo '<span class="info">'.$info.'</span>';
} else {
echo '<span class="info">&nbsp;</span>';
}
$info = '<i>'.dformat($item['mtime']).'</i>';
echo '<span class="info">'.$info.'</span>';
Expand All @@ -1073,21 +1082,25 @@ function media_printimgdetail($item, $fullscreen=false){
$w = (int) $item['meta']->getField('File.Width');
$h = (int) $item['meta']->getField('File.Height');
if($w>$size || $h>$size){
$ratio = $item['meta']->getResizeRatio($size);
if (!$fullscreen) {
$ratio = $item['meta']->getResizeRatio($size);
} else {
$ratio = $item['meta']->getResizeRatio($size,$size);
}
$w = floor($w * $ratio);
$h = floor($h * $ratio);
}
$src = ml($item['id'],array('w'=>$w,'h'=>$h));
$p = array();
$p['width'] = $w;
$p['height'] = $h;
if (!$fullscreen) $p['height'] = $h;
$p['alt'] = $item['id'];
$p['class'] = 'thumb';
$att = buildAttributes($p);

// output
if ($fullscreen) {
echo '<a name="d_:'.$item['id'].'" class="image" href="'.
echo '<a name="d_:'.$item['id'].'" class="image" title="'.$item['id'].'" href="'.
media_managerURL(array('image' => hsc($item['id']))).'">';
echo '<img src="'.$src.'" '.$att.' />';
echo '</a>';
Expand Down
14 changes: 10 additions & 4 deletions inc/template.php
Expand Up @@ -1163,8 +1163,9 @@ function tpl_fileDetails(){
global $NS;
global $IMG;

$image = $_REQUEST['image'];
if ($_REQUEST['image']) $image = cleanID($_REQUEST['image']);
if (!isset($IMG) && !isset($image)) return '';
if (isset($NS) && getNS($image) != $NS) return '';

$opened_tab = $_REQUEST['tab_details'];
if (!$opened_tab) $opened_tab = 'view';
Expand Down Expand Up @@ -1422,15 +1423,20 @@ function tpl_getFavicon($abs=false) {
*/
function tpl_media() {
//
global $DEL, $NS, $IMG, $AUTH, $JUMPTO;
global $DEL, $NS, $IMG, $AUTH, $JUMPTO, $lang;
require_once(DOKU_INC.'lib/exe/mediamanager.php');

echo '<div class="mediamanager" id="id-mediamanager">';
echo '<div class="mediamanager-slider" id="id-mediamanager-layout">';
echo '<div id="id-mediamanager-layout-namespaces" class="layout" style="width: 25%;">';
html_msgarea();
echo hsc('Namespaces:');
echo '<br /><br />';
echo '<div class="mediamanager-tabs">';
echo '<a href="#" class="selected">'.hsc($lang['namespaces']).'</a>';
echo '<div class="clearer"></div>';
echo '</div>';
echo '<div class="background-container">';
echo hsc($lang['namespaces']);
echo '</div>';
echo '<div class="scroll-container">';
tpl_mediaTree(true);
echo '</div>';
Expand Down
Binary file added lib/images/icon-file.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 72 additions & 7 deletions lib/tpl/default/mediamanager.css
Expand Up @@ -24,6 +24,11 @@
overflow-y: auto;
}

.mediamanager .clearer {
font-size: 0;
line-height: 0;
}

.mediamanager .mediamanager-slider {
width: auto;
}
Expand Down Expand Up @@ -51,7 +56,7 @@
}

.mediamanager-link-thumbnails {
background: url('/lib/images/icon-thumb.png') 0 -4px no-repeat;
background: url('../../images/icon-thumb.png') 0 -4px no-repeat;
padding-left: 30px;
display: block;
float: left;
Expand All @@ -60,7 +65,7 @@
}

.mediamanager-link-list {
background: url('/lib/images/icon-list.png') 0 -4px no-repeat;
background: url('../../images/icon-list.png') 0 -4px no-repeat;
padding-left: 30px;
display: block;
float: left;
Expand All @@ -69,7 +74,7 @@
}

.mediamanager-block-sort {
background: url('/lib/images/icon-sort.png') 0 -4px no-repeat;
background: url('../../images/icon-sort.png') 0 -4px no-repeat;
padding-left: 30px;
display: block;
float: right;
Expand Down Expand Up @@ -148,14 +153,44 @@ form.meta textarea.edit {
vertical-align: top;
display: -moz-inline-stack;
text-align: center;
zoom: 1;
*display: inline;
_height: 130px;
position: relative;
}

.mediamanager-thumbs li .image {
width: 100%;
height: 90px;
display: block;
overflow: hidden;
}

.mediamanager-thumbs li .info {
display: block;
overflow: hidden;
}

.mediamanager-thumbs li input[type=checkbox] {
/*position: absolute;
left: 100%;
top: 100%;
margin-left: -20px;
margin-top: -20px;*/
display: none;
}

.mediamanager-thumbs li:hover input[type=checkbox],
.mediamanager-thumbs li input[type=checkbox]:checked {
display: inline;
}

.mediamanager-list li {
list-style: none;
display: block;
position: relative;
max-height: 50px;
margin: 0;
margin-bottom: 3px;
}

Expand All @@ -164,10 +199,11 @@ form.meta textarea.edit {
}

.mediamanager-list li .image {
width: 50px;
height: 50px;
width: 10%;
display: block;
overflow: hidden;
float: left;
height: 40px;
}

.mediamanager-list li .image img {
Expand All @@ -177,10 +213,39 @@ form.meta textarea.edit {
.mediamanager-list li .info {
overflow: hidden;
float: left;
margin-left: 5px;
width: 20%;
width: 19%;
margin-left: 1%;
}

.mediamanager-list li input[type=checkbox] {
position: absolute;
left: 100%;
margin-left: -20px;
margin-top: 3px;
display: none;
}

.mediamanager-list li:hover input[type=checkbox],
.mediamanager-list li input[type=checkbox]:checked {
display: block;
}

.mediamanager-file-list li:hover {
background-color: #dadada;
}

.mediamanager-table-50 {
padding: 0;
margin: 0 !important;
}

.mediamanager-table-50 li {
width: 48%;
display: inline-block;
margin: 0;
margin-bottom: 10px;
padding: 2px;
vertical-align: top;
zoom: 1;
*display: inline;
}

0 comments on commit 6b46772

Please sign in to comment.