In administrator/components/com_media/models/list.php line 154 add

case 'pdf':
if (strpos($_SERVER['REQUEST_URI'],"imagesList")) {
$images[] = $tmp;
} else {
$docs[] = $tmp;
}

In administrator/components/com_media/assets/popup-imagemanager.js and components/com_media/assets/popup-imagemanager.js line 120 add

if (url.match('.pdf'+"$")=='.pdf') {
if (alt == '' && url.lastIndexOf("/")>1) {
alt = url.substr(url.lastIndexOf("/") + 1); }
if (title == '') { extra = 'title="'+title+'" '; }
tag = "<a href=\""+url+"\" "+extra+">"+alt+"</a>";
}

In plugins\editors\tinymce\jscripts\tiny_mce\themes\advanced\link.htm line 48 add

<tr><td colspan="2">Note: To upload a PDF file and link to it you can use the Image link below the editor.</td></tr>
17/2/2011 10:23:39 pm

Based on
http://bchristie.weebly.com/1/post/2010/7/allow-pdf-upload-and-linking-via-tiny-mce-in-joomla.html

Hi, thank to your post I solved my problem.
Indeed I created a more general solution that works for all file types with nice icons.

In list.php (instead of your mod) line 169, after
$docs[] = $tmp;
I added
$images[] = $tmp;

Then in /home/genesi/public_html/administrator/components/com_media/views/imageslist/default_image.php
I replaced
$this->baseURL.'/'.$this->_tmp_img->path_relative;
into the img src with
($this->_tmp_img->icon_32 ? $this->_tmp_img->icon_32 : $this->baseURL.'/'.$this->_tmp_img->path_relative);

This allows for nice icons for all files.

Both js files can be enriched with this code:

imgRegEx = /\.(jpg|png|gif|xcf|odg|bmp|jpeg)$/i;
if (!url.match(imgRegEx)) {
if (alt == '' && url.lastIndexOf("/")>1) {
alt = url.substr(url.lastIndexOf("/") + 1);
}
if (title == '') { extra = 'title="'+title+'" '; }
tag = "<a href=\""+url+"\" "+extra+">"+alt+"</a>";
}

Enjoy,
Saverio.


Comments are closed.