Problems, need help? Have a tip or advice? Post it here.
8 posts Page 1 of 1
Hello everybody :) ,

I am building a web site for a school and I've been searching for a long time for a good CMS that will suit mine and client's needs. Then I stumbled on this CMS and I am very pleased with it, very powerful and like the way you build your own admin panel from zero.

I have a question about a functionality that i need to implement but i can't figure how to do it. I would like to give my client ( users managing this website in this case ) possibility to create public folders ( folder in a folder also ) where they can store/upload some public documents in the admin panel and display the folder hierarchy or better navigate from root folder to others and backwards.

So, I came up with the idea of creating a gallery because it has all the functionality i need ( creating folders, subfolders, deleting them, uploading and displaying folders on the web site ). My idea was crushed :P when I saw that I can't upload files other then pictures and suspected that there are some file restrictions on gallery module.

Is there a way of creating something like this or if not would it be a good idea to disable file restrictions on the gallery module so the client can upload whatever file they need?

Tnx for a response in advance,

rewind
Hi and welcome @rewind. :)

I'm not sure how the Gallery feature came into play here as it has little to do with the functionality you want. A non-gallery clonable template possesses the same feature-set you described: "creating folders, subfolders, deleting them, uploading and displaying folders on the web site". Maybe you could expand on your thinking here?

Couch doesn't natively support the direct file/directory listing you desire. Nevertheless, you could always resort to raw PHP to do this. There are some other solutions out there however that you may want to take a look at first.

http://adamwhitcroft.com/apaxy/: DEMO
http://larsjung.de/h5ai/: DEMO

You could use a single type 'file' editable region, upload files, and make the directory to which it uploads publicly viewable.
Also, we could alternatively simply use dynamic folders and cloned pages to imitate a directory structure; I think this is the best way to go if you don't need to upload thousands of files:
Code: Select all
<cms:template clonable='1' dynamic_folders='1' title='Files'>
   <cms:editable label='File' name='file' type='file'/>
</cms:template>
With this approach, each cloned page represents a file. Let me know which path you pursue.
Hey cheesypoof :) ,

Thank you for the quick reply. Well, the gallery was an idea as i wanted the look ( taken from the template in documentation ) but instead of pictures to show files.

Oh, I forgot that I can do this with clonable template and dynamic folders :) . I was blinded by the gallery like approach that I forgot about that.

The recap:
I could make a template listing all the dynamic folders the client has created represented by a link with whom we access a specific folder listing all the "file editable regions" and display the navigation buttons so the user can easily switch between dynamic folders!?

Could there be any difficulties along the way making it this way i described above?

Edit: I saw now your post. I think that they will not upload more then cca 50 files.
I don't foresee any difficulties. I was able to code up an example if you want to take a look; the parent directory logic is a bit convoluted so perhaps there is a way to make it more efficient:
Code: Select all
<p>
   <a href="<cms:show k_template_link/>"><cms:show k_template_title/></a>
   <cms:set current_name=k_folder_name/>
   <cms:parentfolders folder=current_name>
      &raquo;&nbsp;<a href="<cms:show k_folder_link/>"><cms:show k_folder_title/></a>
      <cms:if current_name != k_folder_name && "<cms:is_ancestor parent=k_folder_name child=current_name/>">
         <cms:set parent_directory=k_folder_link scope='global'/>
         <cms:else/>
            <cms:if k_folder_parentid == '-1'>
               <cms:set parent_directory=k_template_link scope='global'/>
            </cms:if>
      </cms:if>
   </cms:parentfolders>
</p>
<cms:if parent_directory>
   <p><a href="<cms:show parent_directory/>">Parent Directory</a></p>
</cms:if>

<p>Folders:</p>
<cms:folders childof="<cms:if k_folder_name><cms:show k_folder_name/></cms:if>" depth='1'>
   <cms:if k_folder_totalpagecount>
      <a href="<cms:show k_folder_link/>"><cms:show k_folder_title/></a><br/>
   </cms:if>
</cms:folders>

<p>Files:</p>
<cms:pages folder=k_folder_name include_subfolders='0'>
   <a href="<cms:show file/>"><cms:show k_page_title/></a> - <cms:date k_page_modification_date format='d-M-Y H:i'/><br/>
</cms:pages>
Cheesypoof's code is generating both the breadcrumbs (list of all parent folders leading up to the current folder) as well as trying to find out the immediate parent of the current folder.

If only the breadcrumb would do, the code is simply
Code: Select all
<cms:breadcrumbs separator='&nbsp;>&nbsp;' include_template='1'/>

If, however the immediate parent folder needs to be shown separately, a minor modification of cheesypoof's code is as follows -
Code: Select all
<p>
    <a href="<cms:show k_template_link/>"><cms:show k_template_title/></a>
   
    <cms:set parent_directory=k_template_link scope='global'/>
    <cms:set current_name=k_folder_name/>
   
    <cms:parentfolders folder=current_name>

        &raquo;&nbsp;<a href="<cms:show k_folder_link/>"><cms:show k_folder_title/></a>

        <cms:if current_name != k_folder_name >
            <cms:set parent_directory=k_folder_link scope='global'/>
        </cms:if>

    </cms:parentfolders>
</p>

<p><a href="<cms:show parent_directory/>">Parent Directory (Up)</a></p>
Oops; using an ancestor check on a set of parent folders is obviously redundant. Much better algorithm KK. :)
Thank both of you guys, you really helped me a lot. :)

I think i can improve on this snippets both of you have provided to implement the functionality the way i wanted, the basics of navigation and display are working flawlessly and thats what I needed.

Thanks guys one more time :)
8 posts Page 1 of 1
cron