Set Direct Link default to yes?

Phoca Download - download manager
nunoleite
Phoca Member
Phoca Member
Posts: 38
Joined: 15 Apr 2018, 01:00

Re: Set Direct Link default to yes?

Post by nunoleite »

Hi,

Your Direct Link already count as a Download. So this is what i want and it's already functioning.

The problem is that the link is not opened in a new tab and i have more than 1000 documents and i would like the Direct Link option to be YES by default on all files.

Thanks
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47794
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Set Direct Link default to yes?

Post by Jan »

Hi, if you need to have target blank o links, this needs to be customized in the output code. The problem is, target blank does not work for direct download. It means if you click on file which will be downloaded immediately, then it is displayed for download but empty tab will be open and then closed.

So depends on in which file the link is displayed and which type of the link it is (if direct download, then no content is displayed and it does not make any sense to open empty tab, if link to other content, then the target blank needs to be added - customized) But all this depends on which link you exactly mean?

Jan
If you find Phoca extensions useful, please support the project
nunoleite
Phoca Member
Phoca Member
Posts: 38
Joined: 15 Apr 2018, 01:00

Re: Set Direct Link default to yes?

Post by nunoleite »

Hi,

What o really need it's a way to open the file in the browser without needing to download and at the same time i would like to count it as a download.
I think for documents like pdfs and others, previewing is the same as downloading.

I think the way you use the preview as a popup modal, is a good option, but it doesn't count as download. From my understanding if a user previews a file they have seen it and from that point it as to count as a download.

Just clicking on a file it should count.

In terms of Statistics i would like to know what are the file most accessed by users.

Thanks
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47794
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Set Direct Link default to yes?

Post by Jan »

Just clicking on a file it should count.
No, when you click on the file, then your browser just opens the file but there is noone who can store the statistics.

When you on your PC directly opens a file on server, it means the communication is between your browser (PC) and the server - without having the intermediary who will store the statistics:

(a) PHOCA DOWNLOAD LINK - INDIRECT LINK:

USER (PC) --> PHOCA DOWNLOAD (Phoca Download stores the statistics) --> FILE ON THE SERVER

(b) DIRECT LINK

USER (PC) --> FILE ON THE SERVER

As you can see, by variant (b) there is noone who will store the statistics, noone who will store the counts/hits

But this is not a Phoca Download or Joomla! issue, it is just standard internet feature.

Jan
If you find Phoca extensions useful, please support the project
nunoleite
Phoca Member
Phoca Member
Posts: 38
Joined: 15 Apr 2018, 01:00

Re: Set Direct Link default to yes?

Post by nunoleite »

first option:
Behavior of Phoca Download with Direct Link = YES

Click on file, it opens in same tab and the download is registered.

You can confirm testing your component.

The problem of this behavior is that it opens in same tab, and i wanted to open has new tab.
So you already have this working in your component, i just want that these direct links are opened on a new tab.

I don't know much of code, but it seems to me that you already record the download when the direct link is marked as yes. So you just have to change the behavior of opening the file in a new tab.

second option:
Another way is using the preview button.

This way just before you open the popup modal box, you record the download and then open the popup with the file inside.

This would make Phoca download very practical and usable.

Please consider these development.
nunoleite
Phoca Member
Phoca Member
Posts: 38
Joined: 15 Apr 2018, 01:00

Re: Set Direct Link default to yes?

Post by nunoleite »

I was messing with the code and change these lines:
file: /components/com_phocadownload/views/category/tmpl/default_files.php

lines 72 to 77:

Code: Select all

				if ($v->link_external != '' && $v->directlink == 1) {
					$linkDownloadB = '<a class="" target="_blank" href="'.$v->link_external.'" target="'.$this->t['download_external_link'].'" >';
					$linkDownloadE ='</a>';
				} else {
					$linkDownloadB = '<a class="" target="_blank" href="'. JRoute::_(PhocaDownloadRoute::getFileRoute($v->id, $this->catitem[$v->id]->id,$v->alias, $this->catitem[$v->id]->alias, $v->sectionid, 'download').$this->t['limitstarturl']).'" >';
					$linkDownloadE ='</a>';
Just adding the target="_blank" to those lines i solved the problem.
I just need to have Direct link=yes in all files.
With this i have the pdf files processes by the browser in a new tab and they count as a download.

So easy.....

I'm sure that this is a workaround hack that i don't link to do, but you could transform this in a real option.

I'm interested in contribute so that you can develop this option.

On the global options something like.... all links open in new tab = yes/no
Something similar to External Download Link = Blank, but for all the files, not just for external links.

Do you understand what i'm explaining here?

Thanks
nunoleite
Phoca Member
Phoca Member
Posts: 38
Joined: 15 Apr 2018, 01:00

Re: Set Direct Link default to yes?

Post by nunoleite »

In the plugin i found that i have the option to open in blank:
|target=b
nunoleite
Phoca Member
Phoca Member
Posts: 38
Joined: 15 Apr 2018, 01:00

Re: Set Direct Link default to yes?

Post by nunoleite »

So i just need that i could choose to always open in new tab and the directlink = yes by default on all files.
I think this is an option that could be useful for a lot of users, understanding that some other may no want this, but this is an alternative configuration.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47794
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Set Direct Link default to yes?

Post by Jan »

Hi, it can be useful but needs to be managed by option because what happened, if the direct link goes to directly to download. Then new opened tab will be displayed and when download dialog will be opened, then the tab will be closed immediately. So it is not enough to only set "target blank" but this needs to be threated for different types of links. And the problem is when you have direct link, you cannot detect it on your server, for example:

- Direct link goes to website and you open it with display blank - all is OK, the direct link will be opened in new tab
- Direct link goes directly to file and prompt dialog will be openend and when clicked on this link (in such case opening empty tag does not make any sense)

Jan
If you find Phoca extensions useful, please support the project
nunoleite
Phoca Member
Phoca Member
Posts: 38
Joined: 15 Apr 2018, 01:00

Re: Set Direct Link default to yes?

Post by nunoleite »

Yes, I could be an option in global configuration, and it could have a warning with that information so the user could know the difference and risks.

Thanks
Post Reply