====== Media Manager and File Size ====== When you click on a file in the [[:media manager]] the link to the file is inserted in the parent window textarea as in {{some:namespace:some_image.gif|}} I wanted the file size to also be appended: {{some:namespace:some_image.gif|}} 1.8 KB The following two patches for ''lib/scripts/media.js'' and ''inc/media.php'' (for DokuWiki ver-rc2007-05-24) did the trick. ===== Patch for lib/scripts/media.js ===== --- lib/scripts/media.js-00000000 Thu May 24 20:32:29 2007 +++ lib/scripts/media.js Thu Jun 21 16:47:27 2007 @@ -169,7 +169,22 @@ * @author Andreas Gohr */ select: function(event,link){ - var id = link.name.substr(2); + var inputdata = link.name.substr(2); + var temp = new Array(); + temp = inputdata.split(' '); + var id = temp[0]; + var filesize = temp[1]; + var sizeunits = temp[2]; + if (typeof filesize == 'undefined'){ + filesize = ''; + }else{ + filesize = ' '+filesize; + } + if (typeof sizeunits == 'undefined'){ + sizeunits = ''; + }else{ + sizeunits = ' '+sizeunits; + } if(!opener){ // if we don't run in popup display example @@ -181,7 +196,7 @@ } return false; } - opener.insertTags('wiki__text','{{'+id+'|','}}',''); + opener.insertTags('wiki__text','{{'+id+'|','}}'+filesize+sizeunits,''); if(!media.keepopen) window.close(); opener.focus(); ===== Patch for inc/media.php ===== --- inc/media.php-00000000 Thu May 24 20:32:28 2007 +++ inc/media.php Thu Jun 21 17:29:19 2007 @@ -439,7 +439,7 @@ // ouput echo '
'.NL; - echo ''.$file.' '; + echo ''.$file.' '; echo '('.$info.')'.NL; media_fileactions($item,$auth); echo '
'; @@ -473,7 +473,7 @@ // output echo '
'; echo '
'; - echo ''; + echo ''; echo ''; echo ''; echo '
';
===== Warning ===== I haven't tested this extensively, so be cautious. --- //[[tm@thriasio.gr|Thanos Massias]] 2007-06-21 16:17//