summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2006-05-25 16:40:00 +0200
committerAndreas Gohr <andi@splitbrain.org>2006-05-25 16:40:00 +0200
commitcf6894df38261b3b92c75d441bbe0a0ba58d963e (patch)
tree8ea05553b2d36f0e8aa65f5778a7f71ed721fa6a
parentfb53bfe26d4ed0fd3e63d17c7b02d9c8d0e98fb4 (diff)
downloadrpg-cf6894df38261b3b92c75d441bbe0a0ba58d963e.tar.gz
rpg-cf6894df38261b3b92c75d441bbe0a0ba58d963e.tar.bz2
more mediamanager fixes
This fixes some styling issues, the cookie handling and a bug in the JavaScript caching mechanism. darcs-hash:20060525144000-7ad00-2f0b673d4f747c979f460e4e927a50eeeae81ec1.gz
-rw-r--r--inc/lang/en/lang.php6
-rw-r--r--inc/media.php13
-rw-r--r--lib/exe/css.php1
-rw-r--r--lib/exe/js.php3
-rw-r--r--lib/exe/mediamanager.php2
-rw-r--r--lib/images/magnifier.pngbin0 -> 615 bytes
-rw-r--r--lib/scripts/media.js4
-rw-r--r--lib/tpl/default/media.css53
-rw-r--r--lib/tpl/default/mediamanager.php4
9 files changed, 70 insertions, 16 deletions
diff --git a/inc/lang/en/lang.php b/inc/lang/en/lang.php
index 49f9676ae..c5584113b 100644
--- a/inc/lang/en/lang.php
+++ b/inc/lang/en/lang.php
@@ -91,8 +91,8 @@ $lang['notsavedyet'] = 'Unsaved changes will be lost.\nReally continue?';
$lang['rssfailed'] = 'An error occured while fetching this feed: ';
$lang['nothingfound']= 'Nothing was found.';
-$lang['mediaselect'] = 'Mediafiles';
-$lang['fileupload'] = 'Mediafile Upload';
+$lang['mediaselect'] = 'Media Files';
+$lang['fileupload'] = 'Media File Upload';
$lang['uploadsucc'] = 'Upload successful';
$lang['uploadfail'] = 'Upload failed. Maybe wrong permissions?';
$lang['uploadwrong'] = 'Upload denied. This file extension is forbidden!';
@@ -106,6 +106,8 @@ $lang['mediafiles'] = 'Available files in';
$lang['js']['keepopen'] = 'Keep window open on selection';
$lang['js']['hidedetails'] = 'Hide Details';
$lang['mediausage'] = 'Use the following syntax to reference this file:';
+$lang['mediaview'] = 'View original file';
+$lang['mediaupload'] = 'Upload a file to the current namespace here. To create subnamespaces, prepend them to your filename separated by colons.';
$lang['reference'] = 'References for';
$lang['ref_inuse'] = 'The file can\'t be deleted, because it\'s still used by the following pages:';
diff --git a/inc/media.php b/inc/media.php
index f09aff2eb..7d2dbd5ff 100644
--- a/inc/media.php
+++ b/inc/media.php
@@ -114,7 +114,7 @@ function media_metaform($id,$auth){
echo '<div class="metafield">';
echo '<label for="meta__'.$key.'">';
echo ($lang[$field[1]]) ? $lang[$field[1]] : $field[1];
- echo '</label>';
+ echo ':</label>';
// put input field
if($field[2] == 'text'){
@@ -268,7 +268,13 @@ function media_filelist($ns,$auth=null,$jump=''){
function media_fileactions($item,$auth){
global $lang;
- // no actions if not writable
+ // view button
+ $link = ml($item['id'],'',true);
+ echo ' <a href="'.$link.'" target="_blank"><img src="'.DOKU_BASE.'lib/images/magnifier.png" '.
+ 'alt="'.$lang['mediaview'].'" title="'.$lang['mediaview'].'" class="btn" /></a>';
+
+
+ // no further actions if not writable
if(!$item['writable']) return;
// delete button
@@ -377,6 +383,7 @@ function media_printimgdetail($item){
$t = $item['meta']->getField(array('IPTC.Caption','EXIF.UserComment',
'EXIF.TIFFImageDescription',
'EXIF.TIFFUserComment'));
+ if(utf8_strlen($t) > 250) $t = utf8_substr($t,0,250).'...';
if($t) echo htmlspecialchars($t).'<br />';
$t = $item['meta']->getField(array('IPTC.Keywords','IPTC.Category'));
@@ -396,10 +403,12 @@ function media_uploadform($ns, $auth){
if($auth < AUTH_UPLOAD) return; //fixme print info on missing permissions?
?>
+ <div class="upload"><?php echo $lang['mediaupload']?></div>
<form action="<?php echo DOKU_BASE?>lib/exe/mediamanager.php"
method="post" enctype="multipart/form-data" class="upload">
<input type="hidden" name="ns" value="<?php echo hsc($ns)?>" />
+
<?php echo $lang['txt_upload']?>:
<input type="file" name="upload" class="edit" id="upload__file" /><br />
diff --git a/lib/exe/css.php b/lib/exe/css.php
index b63841a03..cb85d1a35 100644
--- a/lib/exe/css.php
+++ b/lib/exe/css.php
@@ -72,6 +72,7 @@ function css_out(){
header('Pragma: public');
if(css_cacheok($cache,array_keys($files))){
http_conditionalRequest(filemtime($cache));
+ if($conf['allowdebug']) header("X-CacheUsed: $cache");
readfile($cache);
return;
} else {
diff --git a/lib/exe/js.php b/lib/exe/js.php
index 583faa5ad..7ff60710c 100644
--- a/lib/exe/js.php
+++ b/lib/exe/js.php
@@ -35,7 +35,7 @@ function js_out(){
$write = (bool) $_REQUEST['write']; // writable?
// The generated script depends on some dynamic options
- $cache = getCacheName('scripts'.$edit.$write,'.js');
+ $cache = getCacheName('scripts'.$edit.'x'.$write,'.js');
// Array of needed files
$files = array(
@@ -66,6 +66,7 @@ function js_out(){
header('Pragma: public');
if(js_cacheok($cache,array_merge($files,$plugins))){
http_conditionalRequest(filemtime($cache));
+ if($conf['allowdebug']) header("X-CacheUsed: $cache");
readfile($cache);
return;
} else {
diff --git a/lib/exe/mediamanager.php b/lib/exe/mediamanager.php
index 23140ee3c..b381fabf6 100644
--- a/lib/exe/mediamanager.php
+++ b/lib/exe/mediamanager.php
@@ -1,4 +1,4 @@
-<?
+<?php
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
define('DOKU_MEDIAMANAGER',1);
require_once(DOKU_INC.'inc/init.php');
diff --git a/lib/images/magnifier.png b/lib/images/magnifier.png
new file mode 100644
index 000000000..cf3d97f75
--- /dev/null
+++ b/lib/images/magnifier.png
Binary files differ
diff --git a/lib/scripts/media.js b/lib/scripts/media.js
index 876b84f9f..da030be28 100644
--- a/lib/scripts/media.js
+++ b/lib/scripts/media.js
@@ -73,7 +73,8 @@ media = {
kobox.type = 'checkbox';
kobox.id = 'media__keepopen';
if(DokuCookie.getValue('keepopen')){
- kobox.checked = true;
+ kobox.checked = true;
+ media.keepopen = true;
}
addEvent(kobox,'change',function(event){ return media.togglekeepopen(event,this); });
@@ -94,6 +95,7 @@ media = {
hdbox.id = 'media__hide';
if(DokuCookie.getValue('hide')){
hdbox.checked = true;
+ media.hide = true;
}
addEvent(hdbox,'change',function(event){ return media.togglehide(event,this); });
diff --git a/lib/tpl/default/media.css b/lib/tpl/default/media.css
index 805abc467..4606cae45 100644
--- a/lib/tpl/default/media.css
+++ b/lib/tpl/default/media.css
@@ -4,7 +4,7 @@
#media__manager {
height: 100%;
- overflow: hide;
+ overflow: hidden;
}
#media__left {
@@ -18,7 +18,7 @@
}
#media__right {
- width: 69.9%;
+ width: 69.8%;
height: 100%;
overflow: auto;
@@ -26,6 +26,14 @@
right: 0;
}
+#media__manager h1 {
+ margin: 0;
+ padding: 0;
+ margin-bottom: 0.5em;
+}
+
+/* --- Tree formatting --- */
+
#media__tree img {
float:left;
padding: 0.5em 0.3em 0 0;
@@ -42,6 +50,28 @@
list-style-image: none;
}
+/* --- options --- */
+
+#media__opts {
+ padding-left: 1em;
+ margin-bottom: 0.5em;
+}
+
+#media__opts input {
+ float: left;
+ position: absolute;
+}
+
+#media__opts label {
+ display: block;
+ float: left;
+ margin-left: 30px;
+}
+
+#media__opts br {
+ clear: left;
+}
+
/* --- file list --- */
#media__content img.load {
@@ -89,6 +119,11 @@
/* --- upload form --- */
+#media__content div.upload {
+ font-size: 80%;
+ padding: 0.5em 0 0.5em 0.5em;
+}
+
#media__content form.upload {
display: block;
border-bottom: solid 1px __dark__;
@@ -104,20 +139,24 @@
#media__content form.meta label {
display: block;
- width: 20%;
+ width: 25%;
float: left;
- text-align: right;
font-weight: bold;
- padding-right: 1em;
+ margin-left: 1em;
+ clear: left;
}
#media__content form.meta .edit {
+ font: 100% "Lucida Grande", Verdana, Lucida, Helvetica, Arial, sans-serif;
float: left;
- width: 75%;
+ width: 70%;
+ padding-right: 0;
+ padding-left: 0.2em;
+ margin: 2px;
}
#media__content form.meta textarea.edit {
- height: 6em;
+ height: 8em;
}
#media__content form.meta div.metafield {
diff --git a/lib/tpl/default/mediamanager.php b/lib/tpl/default/mediamanager.php
index 0ae4f7c66..2b032ac46 100644
--- a/lib/tpl/default/mediamanager.php
+++ b/lib/tpl/default/mediamanager.php
@@ -27,10 +27,10 @@
<?html_msgarea()?>
<h1><?php echo hsc($lang['mediaselect'])?></h1>
- <?php tpl_mediaTree() ?>
-
<?php /* keep the id! additional elements are inserted via JS here */?>
<div id="media__opts"></div>
+
+ <?php tpl_mediaTree() ?>
</div>
<div id="media__right">