Set Direct Link default to yes?

Phoca Download - download manager
larcwebmaster
Phoca Newbie
Phoca Newbie
Posts: 1
Joined: 04 Sep 2020, 19:29

Set Direct Link default to yes?

Post by larcwebmaster » 04 Sep 2020, 19:36

The "Direct Link" option default appears to be "No." When I create a file, I have to set the "Direct Link" to yes for each file. I want the majority of the files on my site to use the "Direct Link" option.

Is there a way set the default option for "Direct Link" to "Yes"? I imagine this could be changed in one of the config files, but I have no idea where to look.

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

Re: Set Direct Link default to yes?

Post by Jan » 08 Sep 2020, 11:44

Hi, see:
administrator\components\com_phocadownload\models\forms\phocadownloadfile.xml

set default="1" to parameter: directlink

Code: Select all

<field name="directlink" type="list" label="COM_PHOCADOWNLOAD_FIELD_DIRECT_LINK_LABEL" default="1"  description="COM_PHOCADOWNLOAD_FIELD_DIRECT_LINK_DESC" class="inputbox"  >
	<option value="1">COM_PHOCADOWNLOAD_YES</option>
	<option	value="0">COM_PHOCADOWNLOAD_NO</option>
</field>
Be aware: if you edit this file, make a backup which will be needed after update.

Jan
If you find Phoca extensions useful, please support the project

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

Re: Set Direct Link default to yes?

Post by nunoleite » 11 May 2021, 23:37

Hi,

Can you convert this in an option in general configurations?

Thanks

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

Re: Set Direct Link default to yes?

Post by Jan » 11 May 2021, 23:56

Hi, because of different features like statistics, headers, etc. the direct link is not a default.

Jan
If you find Phoca extensions useful, please support the project

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

Re: Set Direct Link default to yes?

Post by nunoleite » 12 May 2021, 12:25

Hi,

I understand, but the direct link doesn't log statistics? I thought it would.

But i'm not saying to turn this option on has a default, but to have an option in global configurations so it was easy to change the behavior of all files.

What i'm trying to accomplish here is an ability to open the files as a popup modal with the pdf opened inside and at the same time to count has a view/download.

I know there is a preview option but that doesn't log statistics.

I was trying to use Regular Labs Modals and with direct link it works and it seems to log statistics.

So, is there a way just using Phoca Download?

Thanks

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

Re: Set Direct Link default to yes?

Post by Jan » 12 May 2021, 16:53

Hi, direct link is a direct link - this means that if you click on this link, external server runs your request which means there is no way how to do statistics on your site, because all is then running on external server.

If you open the files with some other website part (modal, other component, etc. etc.) the statistisc will be not counted, because to store the statistics, you need to get the "not direct" link, which first makes the statistics and prepare headers for downloading the file.

If case of direct download, you just lose control over the link, it is just link to another place (external server, external extension, external ...), so there is no control by Phoca Download which means, no statistics - With clicking on direct link, you in fact leave Phoca Download component and it is not active (not active to store statistics, not active to influence download, header, etc. etc.)

Jan
If you find Phoca extensions useful, please support the project

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

Re: Set Direct Link default to yes?

Post by nunoleite » 12 May 2021, 18:05

I just made a test using Direct Link on one pdf file, and it opens the file and counts as a new download.

All the files are internal files.

Is there a way to accomplish this using a modal box?

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

Re: Set Direct Link default to yes?

Post by Jan » 15 May 2021, 18:12

Hi, sorry, I don't understand what do you exactly mean?

Jan
If you find Phoca extensions useful, please support the project

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

Re: Set Direct Link default to yes?

Post by nunoleite » 17 May 2021, 10:20

Hi,

I would like something like the preview, but that counts as a download.

The Direct link option on files, count as a download.

So, i think that something like an iframe on a modal box that browser handles, would do the trick, and the file has to have the Direct link option True so that the browser would handle the file inside the iframe.
A Global option to make this Direct link a default would be great.

This would make very easy for the users navigating documents and opening them directly on the browser instead of making them to download and them opening the files.

Thanks

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

Re: Set Direct Link default to yes?

Post by Jan » 17 May 2021, 17:32

Hi,

if you want to count the hits, you always need to run it on your server, so even you will do every possible hack, the link will be always not direct.

1) the way, it is handled as default

- user clicks on download link, your server is active and recoreds the hit

2) direct link
- users clicks on download link and it has nothing to do with your server - it is like when user clicks on e.g. google link - the browser goes to google without any interaction to your server.

You can do specific hacks to 2)

- you will go to your server and your server will be redirected to link set as direct (so direct link is in fact reached, hits counted but in fact this is not direct link then)
- or you will click direct link and some javascript will be run when clicking on this direct link - e.g. javascript which calls AJAX and such AJAX will store the hits on your server - So the link goes to direct link and the hit is stored by AJAX

So there are possible different hacks but using them in fact mean, your direct links will never be direct or the links are divided into two function - first a link - which goes to direct link target and second AJAX function which only saves the statistics on your server.


Jan
If you find Phoca extensions useful, please support the project

Post Reply