jDownloadsownloads.com


Author Topic: Redirect after deleting a file  (Read 2844 times)

0 Members and 1 Guest are viewing this topic.

Offline RMDsign

  • Newbie
  • *
  • Posts: 12
Redirect after deleting a file
« on: 23.02.2015 12:58:49 »
Hi,

another question... ;)

After deleting a file from the frontend category-view, a redirect to the "All Downloads"-view take place. Can I change this, that the user stay in his category? Or can I change the layout of this view? I cant find them under layouts. Maybe I'am blind... yet again.

Regards, Ralph

Offline ColinM

  • Moderator
  • *
  • Posts: 3.640
Re: Redirect after deleting a file
« Reply #1 on: 23.02.2015 21:44:53 »
Hi
Just to be clear
Were you deleting a file ( red X button) or a Download (delete button)??

I think you mean Deleting an entire Download.

Doing that does take you back to List All Downloads, which really means List All Downloads for which User has View Access Level.

This is presently fixed in the code.  It would need a new Config or User Groups option.  So I have moved this thread to Suggestions
Colin

Offline RMDsign

  • Newbie
  • *
  • Posts: 12
Re: Redirect after deleting a file
« Reply #2 on: 24.02.2015 09:36:23 »
Yes... I mean deleting an entire download. THX for moving to suggestions! But where can I change the layout for the all downloads list view? I cant find it in the layout-section. Or is it only in the code components/com_jdownloads/views/downloads/tmpl/default.php?

Offline ColinM

  • Moderator
  • *
  • Posts: 3.640
Re: Redirect after deleting a file
« Reply #3 on: 25.02.2015 01:00:20 »
The main body uses the active layout in Downloads Details such as Standard Details Layout v2.5 - Full Info. Plese remember to do a Save As Copy before changing the 'default' one.  Tthe header and subheader come from the active Files layout.

Colin

Offline RMDsign

  • Newbie
  • *
  • Posts: 12
Re: Redirect after deleting a file
« Reply #4 on: 26.02.2015 16:02:49 »
Thx! I have placed a redirect in the default.php:

 // ==========================================
    // VIEW THE BUILDED OUTPUT
    // ==========================================

    if ( !$jlistConfig['offline'] ) {
            // echo $html;
            // Do a redirect instead
         $app->redirect(JRoute::_(JURI::root().'index.php?option=com_jdownloads&view=category&catid=2&Itemid=-1'));
    } else {

After deleting an entire download, the redirect brings me to category 2. Unfortunately I have not yet managed to grab the current category.  :'(

Regards, Ralph

Offline ColinM

  • Moderator
  • *
  • Posts: 3.640
Re: Redirect after deleting a file
« Reply #5 on: 26.02.2015 18:22:40 »
Hi
You might like to consider getting the output of javascript function history.go(-1)

I have used something like below to show a button to go back to previous page
Code: [Select]
<input value="Back" onclick="history.go(-1)" class="jd_back_button2A jorange" type="button">
and links like
Code: [Select]
<a href="javascript:history.go(-1)">Go back</a>
However it would probably need a form with Get/Post or maybe a jQuery call

Colin

Offline karencho

  • Newbie
  • *
  • Posts: 6
Re: Redirect after deleting a file
« Reply #6 on: 01.02.2017 15:30:55 »
Hello,

How do we make the user to stay on the current category instead of redirecting to all downloads list page after deleting a file from front end? 
Could you please tell us exactly where do we need to add this code? 


jDownloads Version 3.2.46
Joomla! 3.6.4

Thank you
KG

Offline ColinM

  • Moderator
  • *
  • Posts: 3.640
Re: Redirect after deleting a file
« Reply #7 on: 01.02.2017 19:04:59 »
Hi
In jD a Download consists of many items such as a description, previews and the like together with the actual file that is downloadable.
So do you mean deleting the file associated with a Download or deleting the entire Download?
Colin

Offline karencho

  • Newbie
  • *
  • Posts: 6
Re: Redirect after deleting a file
« Reply #8 on: 02.02.2017 11:59:56 »
Hi Colin,

Thank you for getting back to me.

I am talking about deleting the entire download.

After deleting the entire download from the front end it redirects the user to the All Downloads List page.
We want the user to stay in the same category.

please see the attached file


Thank you
« Last Edit: 02.02.2017 12:01:50 by karencho »

Offline ColinM

  • Moderator
  • *
  • Posts: 3.640
Re: Redirect after deleting a file
« Reply #9 on: 04.02.2017 13:56:41 »
Ok
Will need to look further into this to examine possibilities.
Colin

Offline karencho

  • Newbie
  • *
  • Posts: 6
Re: Redirect after deleting a file
« Reply #10 on: 06.02.2017 19:10:26 »
Hi,

I managed to redirect the user to the previous category automatically by using JavaScript

Code: [Select]
if ( !$jlistConfig['offline'] ) {
// echo $html;
echo '<script>history.go(-2);</script>';


But I don't think this is good fix.

Offline ColinM

  • Moderator
  • *
  • Posts: 3.640
Re: Redirect after deleting a file
« Reply #11 on: 07.02.2017 20:50:48 »
Hi
Where did you place the code?
Have discussed with Arno the possibility of a configurable solution - it would need quite some code to make it both flexible and robust.YTour solution is good for your purposes but beware on updates.
Colin