jDownloads Support Forum

Older Versions => jDownloads 3.2 (Support ended) => Suggestions - Feature Request => Topic started by: 2borg on 07.05.2015 08:57:06

Title: Frontend Upload in current Category
Post by: 2borg on 07.05.2015 08:57:06
Hi,
just wanted to bring my forgoten Question about a Feature - Frontend Upload in Current Category.

Here is my original post (in 2.5 Development):

http://www.jdownloads.com/forum/index.php?topic=7202

this is my workaraund for jdownloads 3x:

Hi,
I managed to do it by editing some template files (its not a nice solution but it works).
Because I'm using only Single Category view and use Direct Download, i edited only
components\com_jdownloads\views\category\tmpl\default.php and edited &upload_link at line 190 to look like this:

I added:
Code:

&Catid='.$catid.'

at the end of the two <a href tags> to be able to transfer my current Category ID to Edit form.
the Line 190 Looks like this
Code:

$upload_link = '<a href="'.JRoute::_('index.php?option=com_jdownloads&amp;view=form&amp;layout=edit&amp;Itemid='.$menuItemids['upload']).'&amp;Catid='.$catid.'">'.'<img src="'.JURI::base().'components/com_jdownloads/assets/images/upload.png" width="32" height="32" border="0" alt="'.JText::_('COM_JDOWNLOADS_UPLOAD_LINKTEXT').'" /></a> <a href="'.JRoute::_('index.php?option=com_jdownloads&amp;view=form&amp;layout=edit&amp;Itemid='.$menuItemids['upload'].'').'&amp;Catid='.$catid.'">'.JText::_('COM_JDOWNLOADS_UPLOAD_LINKTEXT').'</a>';


Then I parsed Catid to variable in:
components\com_jdownloads\views\form\tmpl\edit.php
I got a new Catid Variable with:
Code:

$Catid = $_GET['Catid'];


and at the end i added this code at the line 205
Code:

$this->form->setFieldAttribute('cat_id', 'default',  $Catid);
$this->form->setFieldAttribute('cat_id', 'readonly', 'true')
;


and got this
Code:

<?php
$this
->form->setFieldAttribute('cat_id''default',  $Catid);
$this->form->setFieldAttribute('cat_id''readonly''true');
 echo 
$this->form->getInput('cat_id'); ?>



So now my user can upload files in to the category he/she is currently in.

I know that this is not a permanent solution and I will have to do this every time component gets updated, but i think that it is good feature if you have 800+ categories/folders.

An also if you leave this out

Code:

$this->form->setFieldAttribute('cat_id', 'readonly', 'true');


your users will be able to change your upload category if they want.

I hope this will be helpfull to someone and maybe serve as a feature proposal
Title: Re: Frontend Upload in current Category
Post by: ColinM on 07.05.2015 15:36:16
Hi
The suggestions are not forgotten, its at the moment emphasis is on getting rid of some rare bugs, and also introducing the remaining last major compatibility with Joomla! 3.x namely Tags.  The number of actual bugs reported is falling quite rapidly.

Thanks for your patience, and your useful suggestion.

Colin
Title: Re: Frontend Upload in current Category
Post by: Arno on 07.05.2015 20:30:07
Hi 2borg,
i it can be useful to have an option to upload directly in the current category.

I have not the time to check your modifications complete, but some from your code snippets seems for me very dangerous:
QuoteCode:
$Catid = $_GET['Catid'];
At minimum should you use:
$Catid = (int)$_GET['Catid'];

Maybe can we find a way to add your suggestion.
But he must be safe and configurable (and we must have the time to do this work).  ;)

Title: Re: Frontend Upload in current Category
Post by: 2borg on 13.05.2015 13:39:06
I know,
that's why I said that its not a nice solution.

But on my site, there are only few people with upload privilegies and I can Live with it for time being.
Thanks for your suggestion btw.

Title: Re: Frontend Upload in current Category
Post by: marco.luigiano on 06.11.2015 10:14:19
Hello could someone kindly post the  files php modified? I tried with version 3.2.39, but as a result the display of the site to me is white  ??? Thank you in advance.
Title: Re: Frontend Upload in current Category
Post by: Arno on 06.11.2015 13:15:30
Maybe can i add this feature now... will see what i can do.
Title: Re: Frontend Upload in current Category
Post by: marco.luigiano on 06.11.2015 13:51:35
Thank you very much is a very important feature for those who have to enter many documents in a category.




In any case you may in the meantime post the php files with the modify  mentioned in this topic? thank you.
Title: Re: Frontend Upload in current Category
Post by: ColinM on 07.11.2015 15:50:28
Hi
One solution to having several fixed category selections is to use multiple versions of the Create Download menu item as that allows fixing the target category.

In any scheme one may well consider having a different User Group (UG) for each type of uploader, that is the permitted category.  So the menu items could have a related view access so that only members of that UG would see the appropriate create download menu item.  Users may of course be members of multiple UGs.

What may be a useful addition to the Create Download menu is a third option that restricts choice to a category and its sub categories.  The selected category may of course be part way down a category tree.

Colin
Title: Re: Frontend Upload in current Category
Post by: marco.luigiano on 10.11.2015 09:07:45
Hello Colin, what you suggest is fine, but if you have 100-200 categories, really gets down to create a link to each category.




An alternative would be to create a field to auto-complete the entry in the form create download for the items categories as In this example:
https://jqueryui.com/autocomplete/#maxheight (in Tags, try to type BASIC)


It becomes complicated to do?
Title: Re: Frontend Upload in current Category
Post by: ColinM on 10.11.2015 10:56:02
Marco
Yes with a large number of categories it would become very tiresome and unmanageable.
I liked your idea of using an autocomplete as that would be useful.  making a list of all categories to which the user has create/edit access is intrinsic in jD now.  It would probably help everyone.  And it is like tag names anyway.

So really two suggestion!
One of the 'challenges' with Current Category is it assumes there is a current category.  So one assumes the code should remember the current category in the present session and preset that in the selection box.  If no current category then the blank type preselect.  And of course to update the current category when Saving as the user may have changed it.
Is the above how you see it?
Colin
Title: Re: Frontend Upload in current Category
Post by: marco.luigiano on 10.11.2015 13:44:57
For me is perfect, but unfortunately, I am not familiar so optimal jdownloader, we found this script (obviously with instead of the countries, we have categories, derived from a mysql query and put into an array I think)




http://easyautocomplete.com/

but I have no idea how to integrate it into the component.

I hope it can give you a starting point for an integration.
Title: Re: Frontend Upload in current Category
Post by: ColinM on 10.11.2015 23:31:06
Hi
Yes that does look good. If  auto complete does get into jD I expect however that Arno might prefer to code directly using the basic jquery calls because of potential support issues as maybe Joomla has a different release of jQuery for example.

Colin
Title: Re: Frontend Upload in current Category
Post by: marco.luigiano on 11.11.2015 09:41:14
ok, i hope, the modify will be made, as soon as possible.

thanks
Title: Re: Frontend Upload in current Category
Post by: Arno on 11.11.2015 12:01:02
It is not planned to add for this request a special jquery code.
But i will add today a solution. Then will be select the current category as default value.
This will be published in jD 3.2.41 very soon.
Title: Re: Frontend Upload in current Category
Post by: marco.luigiano on 11.11.2015 12:49:44
many thanks.
Title: Re: Frontend Upload in current Category
Post by: marco.luigiano on 17.11.2015 10:30:44
Good morning, I forgot to signal another change if it is possible.
After uploading the document / s, you should return to the category where the document is loaded, not on the list of all categories.
Thanks again.
Title: Re: Frontend Upload in current Category
Post by: Arno on 19.11.2015 15:02:21
We need yet  a few days to get  the next version ready.  ;)
Title: Re: Frontend Upload in current Category
Post by: marco.luigiano on 23.02.2016 10:38:31
Hi guys, i have download and installed the latest version of the plugin but the modify that i suggested was not implemented, could you explain me why please? many thanks
Title: Re: Frontend Upload in current Category
Post by: ColinM on 23.02.2016 10:57:37
Hi
We have not yet had the time to do the work.  The Component is free and we do this in our own time as a community effort so please be a little patient.  Also please remember that jD is a comprehensive component with many configuration possibilities so testing is not a simple task!

Colin
Title: Re: Frontend Upload in current Category
Post by: Arno on 23.02.2016 11:42:50
Hi Guys,
since 3.2.41 is the current category selected as default in frontend creation form.
More is not required and also not planned.