Skip to content
Snippets Groups Projects
Commit 1eeeced2 authored by Kate Arzamastseva's avatar Kate Arzamastseva
Browse files

media manager fixes

parent dad6764e
No related branches found
No related tags found
No related merge requests found
...@@ -702,17 +702,7 @@ function media_tab_view($image, $ns, $auth=null) { ...@@ -702,17 +702,7 @@ function media_tab_view($image, $ns, $auth=null) {
echo '</div>'; echo '</div>';
echo '<div class="scroll-container">'; echo '<div class="scroll-container">';
if ($auth >= AUTH_READ && $image) { media_preview($image, $auth);
$info = new JpegMeta(mediaFN($image));
$w = (int) $info->getField('File.Width');
$rev = $_REQUEST['rev'];
$more = '';
if (isset($rev)) $more = "rev=$rev";
$src = ml($image, $more);
echo '<img src="'.$src.'" alt="" width="99%" style="max-width: '.$w.'px;" />';
}
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
} }
...@@ -732,7 +722,11 @@ function media_tab_edit($image, $ns, $auth=null) { ...@@ -732,7 +722,11 @@ function media_tab_edit($image, $ns, $auth=null) {
echo '</div>'; echo '</div>';
echo '<div class="scroll-container">'; echo '<div class="scroll-container">';
if ($image) media_metaform($image,$auth,true); if ($image) {
$info = new JpegMeta(mediaFN($image));
if ($info->getField('File.Mime') == 'image/jpeg')
media_metaform($image,$auth,true);
}
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
} }
...@@ -758,6 +752,68 @@ function media_tab_history($image, $ns, $auth=null) { ...@@ -758,6 +752,68 @@ function media_tab_history($image, $ns, $auth=null) {
echo '</div>'; echo '</div>';
} }
/**
* Prints mediafile details
*
* @author Kate Arzamastseva <pshns@ukr.net>
*/
function media_preview($image, $auth) {
global $lang;
if ($auth >= AUTH_READ && $image) {
$info = new JpegMeta(mediaFN($image));
$w = (int) $info->getField('File.Width');
$rev = $_REQUEST['rev'];
$more = '';
if (isset($rev)) $more = "rev=$rev";
$src = ml($image, $more);
echo '<img src="'.$src.'" alt="" width="99%" style="max-width: '.$w.'px;" /><br /><br />';
$link = ml($image,'',true);
echo $image.' <a href="'.$link.'" target="_blank"><img src="'.DOKU_BASE.'lib/images/magnifier.png" '.
'alt="'.$lang['mediaview'].'" title="'.$lang['mediaview'].'" class="btn" /></a>';
// delete button
if($auth >= AUTH_DELETE){
$link = media_managerURL(array('delete' => $image,'sectok' => getSecurityToken()));
echo ' <a href="'.$link.'" class="btn_media_delete" title="'.$image.'">'.
'<img src="'.DOKU_BASE.'lib/images/trash.png" alt="'.$lang['btn_delete'].'" '.
'title="'.$lang['btn_delete'].'" class="btn" /></a>';
}
echo '<br /><br />';
$tags = array(
array('simple.title','img_title','text'),
array('Date.EarliestTime','img_date','date'),
array('File.Name','img_fname','text'),
array(array('Iptc.Byline','Exif.TIFFArtist','Exif.Artist','Iptc.Credit'),'img_artist','text'),
array(array('Iptc.CopyrightNotice','Exif.TIFFCopyright','Exif.Copyright'),'img_copyr','text'),
array('File.Format','img_format','text'),
array('File.NiceSize','img_fsize','text'),
array('Simple.Camera','img_camera','text'),
array(array('IPTC.Keywords','IPTC.Category','xmp.dc:subject'),'img_keywords','text')
);
$src = mediaFN($image);
echo '<dl class="img_tags">';
foreach($tags as $key => $tag){
$t = $tag[0];
if (!is_array($t)) $t = array($tag[0]);
$value = tpl_img_getTag($t,'',$src);
$value = cleanText($value);
if ($value) {
echo '<dt>'.$lang[$tag[1]].':</dt><dd>';
if ($tag[2] == 'text') echo hsc($value);
if ($tag[2] == 'date') echo dformat($value);
echo '</dd>';
}
}
echo '</dl>';
}
}
/** /**
* List all files found by the search request * List all files found by the search request
* *
...@@ -809,7 +865,7 @@ function media_searchlist($query,$ns,$auth=null,$fullscreen=false){ ...@@ -809,7 +865,7 @@ function media_searchlist($query,$ns,$auth=null,$fullscreen=false){
* Print action links for a file depending on filetype * Print action links for a file depending on filetype
* and available permissions * and available permissions
*/ */
function media_fileactions($item,$auth,$fullscreen=false){ function media_fileactions($item,$auth){
global $lang; global $lang;
// view button // view button
...@@ -822,10 +878,8 @@ function media_fileactions($item,$auth,$fullscreen=false){ ...@@ -822,10 +878,8 @@ function media_fileactions($item,$auth,$fullscreen=false){
// delete button // delete button
if($auth >= AUTH_DELETE){ if($auth >= AUTH_DELETE){
if (!$fullscreen) $link = DOKU_BASE.'lib/exe/mediamanager.php?delete='.rawurlencode($item['id']). $link = DOKU_BASE.'lib/exe/mediamanager.php?delete='.rawurlencode($item['id']).
'&amp;sectok='.getSecurityToken(); '&amp;sectok='.getSecurityToken();
else $link = media_managerURL(array('delete' => $item['id'],
'sectok' => getSecurityToken()));
echo ' <a href="'.$link.'" class="btn_media_delete" title="'.$item['id'].'">'. echo ' <a href="'.$link.'" class="btn_media_delete" title="'.$item['id'].'">'.
'<img src="'.DOKU_BASE.'lib/images/trash.png" alt="'.$lang['btn_delete'].'" '. '<img src="'.DOKU_BASE.'lib/images/trash.png" alt="'.$lang['btn_delete'].'" '.
'title="'.$lang['btn_delete'].'" class="btn" /></a>'; 'title="'.$lang['btn_delete'].'" class="btn" /></a>';
...@@ -833,8 +887,7 @@ function media_fileactions($item,$auth,$fullscreen=false){ ...@@ -833,8 +887,7 @@ function media_fileactions($item,$auth,$fullscreen=false){
// edit button // edit button
if($auth >= AUTH_UPLOAD && $item['isimg'] && $item['meta']->getField('File.Mime') == 'image/jpeg'){ if($auth >= AUTH_UPLOAD && $item['isimg'] && $item['meta']->getField('File.Mime') == 'image/jpeg'){
if (!$fullscreen) $link = DOKU_BASE.'lib/exe/mediamanager.php?edit='.rawurlencode($item['id']); $link = DOKU_BASE.'lib/exe/mediamanager.php?edit='.rawurlencode($item['id']);
else $link = media_managerURL(array('edit' => $item['id']));
echo ' <a href="'.$link.'">'. echo ' <a href="'.$link.'">'.
'<img src="'.DOKU_BASE.'lib/images/pencil.png" alt="'.$lang['metaedit'].'" '. '<img src="'.DOKU_BASE.'lib/images/pencil.png" alt="'.$lang['metaedit'].'" '.
'title="'.$lang['metaedit'].'" class="btn" /></a>'; 'title="'.$lang['metaedit'].'" class="btn" /></a>';
...@@ -928,7 +981,6 @@ function media_printfile_thumbs($item,$auth,$jump){ ...@@ -928,7 +981,6 @@ function media_printfile_thumbs($item,$auth,$jump){
echo '<br/><a href="'.media_managerURL(array('image' => hsc($item['id']))).'" name= echo '<br/><a href="'.media_managerURL(array('image' => hsc($item['id']))).'" name=
"h_:'.$item['id'].'" >'.hsc($file).'</a><br/>'; "h_:'.$item['id'].'" >'.hsc($file).'</a><br/>';
echo '<span>'.$info.'</span><br/>'; echo '<span>'.$info.'</span><br/>';
media_fileactions($item,$auth,true);
echo '</div>'.NL; echo '</div>'.NL;
} }
...@@ -956,7 +1008,8 @@ function media_printimgdetail($item, $fullscreen=false){ ...@@ -956,7 +1008,8 @@ function media_printimgdetail($item, $fullscreen=false){
// output // output
if ($fullscreen) { if ($fullscreen) {
echo '<a name="d_:'.$item['id'].'" >'; echo '<a name="d_:'.$item['id'].'" href="'.
media_managerURL(array('image' => hsc($item['id']))).'">';
echo '<img src="'.$src.'" '.$att.' />'; echo '<img src="'.$src.'" '.$att.' />';
echo '</a>'; echo '</a>';
return 1; return 1;
...@@ -1019,6 +1072,10 @@ function media_managerURL($params=false, $amp='&') { ...@@ -1019,6 +1072,10 @@ function media_managerURL($params=false, $amp='&') {
} }
} }
unset($gets['id']); unset($gets['id']);
if ($gets['delete']) {
unset($gets['image']);
unset($gets['tab_details']);
}
return wl($ID,$gets,false,$amp); return wl($ID,$gets,false,$amp);
} }
......
...@@ -1161,13 +1161,14 @@ function tpl_fileDetails(){ ...@@ -1161,13 +1161,14 @@ function tpl_fileDetails(){
global $NS; global $NS;
global $IMG; global $IMG;
$image = $_REQUEST['image'];
if (!isset($IMG) && !isset($image)) return '';
$opened_tab = $_REQUEST['tab_details']; $opened_tab = $_REQUEST['tab_details'];
if (!$opened_tab) $opened_tab = 'view'; if (!$opened_tab) $opened_tab = 'view';
if ($_REQUEST['edit']) $opened_tab = 'edit'; if ($_REQUEST['edit']) $opened_tab = 'edit';
media_tabs_details($opened_tab); media_tabs_details($opened_tab);
$image = $_REQUEST['image'];
if (!$image && !$IMG) return false;
if ($opened_tab == 'view') media_tab_view($image, $NS, $AUTH); if ($opened_tab == 'view') media_tab_view($image, $NS, $AUTH);
if ($opened_tab == 'edit') { if ($opened_tab == 'edit') {
if ($IMG) media_tab_edit($IMG, $NS, $AUTH); if ($IMG) media_tab_edit($IMG, $NS, $AUTH);
......
...@@ -152,4 +152,11 @@ ...@@ -152,4 +152,11 @@
.mediamanager-table tr:hover { .mediamanager-table tr:hover {
background-color: #DEE7EC; background-color: #DEE7EC;
} }
\ No newline at end of file
form.meta textarea.edit {
height: 8em;
width: 95%;
min-width: 95%;
max-width: 95%;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment