How do you download a file auto. mark it on the preview?

Phoca Download - download manager
zabrat
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 16 Jun 2011, 19:11

How do you download a file auto. mark it on the preview?

Post by zabrat »

Hello!

I am concerned about three issues. Ask them for relevance to me.

1. Such a problem, I do that when you download a file, it is automatically flagged for preview, and would not need to go into the admin area so that it is selected for preview. how to do it I can not understand. tried to change the code in the file components \ com_phocadownload \ views \ file \ tmpl \ default_grey2.php

Code: Select all

// PREVIEW
					if ($this->tmpl['display_preview'] == 1)
					{
						//if (isset($valueDoc->filename_preview) && $valueDoc->filename_preview != '') 
						{
							$fileExt = PhocaDownloadHelper::getExtension($valueDoc->filename_preview);
							//if ($fileExt == 'pdf' || $fileExt == 'jpeg' || $fileExt == 'jpg' || $fileExt == 'png' || $fileExt == 'gif') 
							{
								$filePath	= PhocaDownloadHelper::getPathSet('file');
								$filePath	= str_replace ( '../', JURI::base(true).'/', $filePath['orig_rel_ds']);
								//$filePath	= $linkDownloadB;
								//$filePath	= $linkDownloadE;
								$previewLink = $filePath . $valueDoc->filename_preview;	
								$previewOutput	.= '<div class="pddownload'.$this->tmpl['button_style'].'"><div>';
								
								if ($this->tmpl['preview_popup_window'] == 1) {
									$previewOutput .= '<a  href="'.$previewLink.'" onclick="'. $this->buttonpr->options.'" >'. JText::_('COM_PHOCADOWNLOAD_PREVIEW').'</a>';
								} else {	
									if ($fileExt == 'pdf') {
										// Iframe - modal
										$previewOutput	.= '<a class="pd-modal-button" href="'.$previewLink.'" rel="'. $this->buttonpr->options.'" >'. JText::_('COM_PHOCADOWNLOAD_PREVIEW').'</a>';
									} else {
										// Image - modal
										$previewOutput	.= '<a class="pd-modal-button" href="'.$previewLink.'" rel="'. $this->buttonpr->optionsimg.'" >'. JText::_('COM_PHOCADOWNLOAD_PREVIEW').'</a>';
									}
								}
								$previewOutput	.= '</div></div>';
							}
						}
					}
but perhaps I'm not looking in the wrong place.
Theoretically, every newly downloaded file should be marked on the preview, but where it is done ...

2. How to implement delete files downloaded by users by themselves. For example as in phocagallery?

3. When you delete files from the admin kicks by an authorization, and as it passes the top line disappears in joomla. (as in Denwer, and the server on FreeBSD)

I use Joomla 1.6.3, Phoca Download2.0.0 RC3

I would be grateful for the help. :)
zabrat
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 16 Jun 2011, 19:11

Re: How do you download a file auto. mark it on the preview?

Post by zabrat »

At least tell me where to look in the code. Where PD is in a file mark on the preview, not in the admin area, namely in the code, so you can change so that when the file it is prescribed as a preview file.
Please :|
zabrat
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 16 Jun 2011, 19:11

Re: How do you download a file auto. mark it on the preview?

Post by zabrat »

Corrected here and has earned)

Code: Select all

	if ($this->tmpl['display_preview'] == 1) {
						if (isset($valueDoc->filename) && $valueDoc->filename != ''){
						$fileExt = PhocaDownloadHelper::getExtension($valueDoc->filename);
							if ($fileExt == 'pdf' || $fileExt == 'jpeg' || $fileExt == 'jpg' || $fileExt == 'png' || $fileExt == 'gif') {
							$filePath	= PhocaDownloadHelper::getPathSet('file');
								$filePath	= str_replace ( '../', JURI::base(true).'/', $filePath['orig_rel_ds']);
									$previewLink = $filePath .$valueDoc->filename; 
										$previewOutput	.= '<div class="pdpreview'.$this->tmpl['button_style'].'"><div>';
								if ($this->tmpl['preview_popup_window'] == 1) {
									$previewOutput .= '<a  href="'.$previewLink.'" onclick="'. $this->buttonpr->options.'" >'. JText::_('COM_PHOCADOWNLOAD_PREVIEW').'</a>';
								} else {	
									if ($fileExt == 'pdf') {
										// Iframe - modal
										$previewOutput	.= '<a class="pd-modal-button" href="'.$previewLink.'" rel="'. $this->buttonpr->options.'" >'. JText::_('COM_PHOCADOWNLOAD_PREVIEW').'</a>';
									} else {
										// Image - modal
										$previewOutput	.= '<a class="pd-modal-button" href="'.$previewLink.'" rel="'. $this->buttonpr->options.'" >'. JText::_('COM_PHOCADOWNLOAD_PREVIEW').'</a>';
									}
								}
								$previewOutput	.= '</div></div>';
							}
						}
					}
SonRiab
Phoca Professional
Phoca Professional
Posts: 258
Joined: 02 Jun 2011, 09:29
Contact:

Re: How do you download a file auto. mark it on the preview?

Post by SonRiab »

With this code you haven't the ability to display previews for files which aren't images/pdfs.
Maybe this code is more helpful (untested!!!):

Code: Select all

// is preview enabled?
if ($this->tmpl['display_preview'] == 1) {
    // get the file extension of the download
    $downFileExt = PhocaDownloadHelper::getExtension($valueDoc->filename);
    // first we check if we have a file which should be previewed
    if (isset($valueDoc->filename_preview) && $valueDoc->filename_preview != '') {
        // get the file extension of the preview
        $fileExt = PhocaDownloadHelper::getExtension($valueDoc->filename_preview);
        // if it is an image or a pdf file set the path to it
        if ($fileExt == 'pdf' || $fileExt == 'jpeg' || $fileExt == 'jpg' || $fileExt == 'png' || $fileExt == 'gif') {
            $previewLink = $filePath . $valueDoc->filename_preview;	
        }
    }
    // if we have no preview defined check if the download can be directly previewed
    else if($downFileExt == 'pdf' || $downFileExt == 'jpeg' || $downFileExt == 'jpg' || $downFileExt == 'png' || $downFileExt == 'gif') {
        // if yes set the path
        $previewLink = $filePath . $valueDoc->filename;	
    }
    // if the path is set, display the preview button
    if(isset($previewLink) && $previewLink != "") {
        $filePath	= PhocaDownloadHelper::getPathSet('file');
        $filePath	= str_replace ( '../', JURI::base(true).'/', $filePath['orig_rel_ds']);
        $previewOutput	.= '<div class="pdpreview'.$this->tmpl['button_style'].'"><div>';
        
        if ($this->tmpl['preview_popup_window'] == 1) {
            $previewOutput .= '<a  href="'.$previewLink.'" onclick="'. $this->buttonpr->options.'" >'. JText::_('COM_PHOCADOWNLOAD_PREVIEW').'</a>';
        } else {	
            if ($fileExt == 'pdf') {
                // Iframe - modal
                $previewOutput	.= '<a class="pd-modal-button" href="'.$previewLink.'" rel="'. $this->buttonpr->options.'" >'. JText::_('COM_PHOCADOWNLOAD_PREVIEW').'</a>';
            } else {
                // Image - modal
                $previewOutput	.= '<a class="pd-modal-button" href="'.$previewLink.'" rel="'. $this->buttonpr->optionsimg.'" >'. JText::_('COM_PHOCADOWNLOAD_PREVIEW').'</a>';
            }
        }
        $previewOutput	.= '</div></div>';
    }
}
Kind regards
zabrat
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 16 Jun 2011, 19:11

Re: How do you download a file auto. mark it on the preview?

Post by zabrat »

In my case, will be only images / pdfs so that I and this is enough. Progress your thoughts clear)
Thanks for the help)
Post Reply