Go Back   Mosets Community > Archives > Mosets Tree 2.2 > Discussions, Troubleshooting & Problems

 
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-02-2012, 10:28 PM
stevenkong stevenkong is offline
Mosets'd
 
Join Date: Nov 2011
Posts: 18
Unhappy Make download link in audio to download as mp3 instead of playing it in new window

When I check the feature "display filename" in my audioplayer custom field setting to "yes" - the mp3 file name appears under player which is fine, but when I clicked this link a new window with quicktime opens and starts playing audio file.

1) Is it possible to make the download link to download as mp3 file instead of playing in new window/browser?

2) Instead of being the mp3 file name for the download link, is it possible to change it to something more generic e.g Click here to download mp3?

Your Help Is Appreciated , many thanks.
  #2  
Old 02-03-2012, 09:51 PM
stevenkong stevenkong is offline
Mosets'd
 
Join Date: Nov 2011
Posts: 18
Default

I guess it is something to do with the ft_class. However I managed to add title tag to make the audio link more accessible:

class mFieldType_audioplayer extends mFieldType_file {
function getJSValidation() {

$js = '';
$js .= '} else if (!hasExt(form.' . $this->getName() . '.value,\'mp3\')) {';
$js .= 'alert("' . addslashes($this->getCaption()) . ': Please select a mp3 file.");';
return $js;
}
function getOutput() {
$id = $this->getId();
$params['text'] = $this->getParam('textColour');
$params['displayfilename'] = $this->getParam('displayfilename',1);
$params['slider'] = $this->getParam('sliderColour');
$params['loader'] = $this->getParam('loaderColour');
$params['track'] = $this->getParam('trackColour');
$params['border'] = $this->getParam('borderColour');
$params['bg'] = $this->getParam('backgroundColour');
$params['leftbg'] = $this->getParam('leftBackgrounColour');
$params['rightbg'] = $this->getParam('rightBackgrounColour');
$params['rightbghover'] = $this->getParam('rightBackgroundHoverColour');
$params['lefticon'] = $this->getParam('leftIconColour');
$params['righticon'] = $this->getParam('rightIconColour');
$params['righticonhover'] = $this->getParam('rightIconHoverColour');

$html = '';
$html .= '<script language="JavaScript" src="' . $this->getFieldTypeAttachmentURL('audio-player.js'). '"></script>';
$html .= "\n" . '<object type="application/x-shockwave-flash" data="' . $this->getFieldTypeAttachmentURL('player.swf'). '" id="audioplayer' . $id . '" height="24" width="290">';
$html .= "\n" . '<param name="movie" value="' . $this->getFieldTypeAttachmentURL('player.swf') . '">';
$html .= "\n" . '<param name="FlashVars" value="';
$html .= 'playerID=' . $id;
$html .= '&amp;soundFile=' . urlencode($this->getDataAttachmentURL());
foreach( $params AS $key => $value ) {
if(!empty($value)) {
$html .= '&amp;' . $key . '=0x' . $value;
}
}
$html .= '">';
$html .= "\n" . '<param name="quality" value="high">';
$html .= "\n" . '<param name="menu" value="false">';
$html .= "\n" . '<param name="wmode" value="transparent">';
$html .= "\n" . '</object>';
if($params['displayfilename']) {
$html .= "\n<br />";
$html .= "\n" . '<a title="Click here to download listing page as mp3 audio" href="' . $this->getDataAttachmentURL() . '" target="_blank">';
$html .= $this->getValue();
$html .= '</a>';
}
return $html;
}


Now other stuff I want to do, not sure what to do? Guys please help or Lee?
  #3  
Old 02-04-2012, 07:28 PM
dknight dknight is offline
Mosets Team - Lead Developer
 
Join Date: Dec 2004
Posts: 27,003
Default

Hi,

The code you should be editing is here:

/components/com_mtree/mtree.php
LINE 4785
CODE:
PHP Code:
        header('Content-Disposition: inline; filename="'.$attachment->filename.'";'); 
Change this to:
PHP Code:
        header('Content-Disposition: attachment; filename="'.$attachment->filename.'";'); 
Please note that this change will apply to all attachment in your directory. Hope this helps!
__________________
Lee
Lead Developer
Mosets.com - Quality Joomla! Solutions
  #4  
Old 02-05-2012, 09:28 AM
stevenkong stevenkong is offline
Mosets'd
 
Join Date: Nov 2011
Posts: 18
Default

Quote:
Originally Posted by dknight View Post
Hi,

The code you should be editing is here:

/components/com_mtree/mtree.php
LINE 4785
CODE:
PHP Code:
        header('Content-Disposition: inline; filename="'.$attachment->filename.'";'); 
Change this to:
PHP Code:
        header('Content-Disposition: attachment; filename="'.$attachment->filename.'";'); 
Please note that this change will apply to all attachment in your directory. Hope this helps!
Hi Lee,

First of all, thanks for the reply. Congratulation on this solid component!
I did what you suggested and I replaced your codes with that line, yes it works well but I don't mean to remove the flash player from the page, the issue is the mp3 audio link which when clicked it opens a new browser and play the audio in quicktime. I don't need the audio link to open a new browser and play in quicktime when there is a flash player in the listing page already. See below screenshot for more explanation:



By the way, the audio link appears below the flash player because I have set the Audio Player "Display Filename" parameter as "YES". I really need this badly as I want to make it accessible for blind people - the assistive technology (e.g screen reader) that they are using can NOT see the flash player BUT can use the alternative audio link to download audio mp3 and play on their machine, this is the point, thanks.

Last edited by stevenkong; 02-05-2012 at 09:35 AM.
  #5  
Old 02-08-2012, 09:30 AM
stevenkong stevenkong is offline
Mosets'd
 
Join Date: Nov 2011
Posts: 18
Default

Lee, so no solution here, I really need the solution, please anyone?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide the Download File Link jodybterblanche Discussions, Troubleshooting & Problems 0 09-14-2011 04:26 PM


All times are GMT +8. The time now is 12:40 PM.

Copyright © 2005-2010 Mosets Consulting

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.