News:

Dear forum visitors, if the support forum is not available, please try again a few minutes later. Thanks!

Main Menu
Support-Forum

Frontend Upload in current Category

Started by 2borg, 07.05.2015 08:57:06

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

2borg

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
  •  

ColinM

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
Colin M
  •  

Arno

#2
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).  ;)

Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •  

2borg

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.

  •  

marco.luigiano

#4
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.
  •  

Arno

Maybe can i add this feature now... will see what i can do.
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •  

marco.luigiano

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.
  •  

ColinM

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
Colin M
  •  

marco.luigiano

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?
  •  

ColinM

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 as a Frontend Upload in Current Category.
  • The other is to make the selection list have autocomplete.
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
Colin M
  •  

marco.luigiano

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.
  •  

ColinM

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
Colin M
  •  

marco.luigiano

ok, i hope, the modify will be made, as soon as possible.

thanks
  •  

Arno

#13
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.
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •  

marco.luigiano

  •