Thank you, now I'm starting to understand a little more about cps and cpsskins.
The code you provided is very helpful.
I'm wondering if it's better to create new scripts and page templates to obtain what I need
or modify the existing code.
If I understood right what is in charge of showing folder contents in a base CPS installation
is a navigation portlet (Folder contents) which calls the render method folder_contents_detailed.
I found the code in portal_skins/cpsportlets_widgets/widget_portlet_navigation

<tal:block condition="python: display == 'folder_contents_detailed'">
<tal:block define="
cpsmcat nocall:here/translation_service;
base_url utool/getBaseUrl;
items python: context.getFolderContents();
format string:one_column;
no_form python:1;">
<metal:block use-macro="here/content_lib_ display_contents/macros/display_contents" />
</tal:block>
</tal:block>

Let me see if I understood well, getFolderContents get a list of the object in the folder and then the macro display_contents is in charge of building the html code
Is it possible to add a sort_by parameter to this code?
Or add the sorting parameter, as you suggested,  in portal_layouts and portal_schemas.

I believe that adding sorting and direction parameters directly to the section would be a nice improvement for cps... something like the existing hidden_folder
This could be a fast and simple way to have different sorting and direction based on each section.

Thank you
C.


curios-one wrote:
>Thank you very much Jean-Marc,
>I would really appreciate if you could send me the code.
>
>  
>
OK, see the attached files. They do more than you need, there is a field 
called 'alphabetical_order' on the section which is either True or False.
then it is passed to getFolderItems():
    sort_by = alphabetic_order and 'title' or ''
    folderItems = context.getFolderItems(context_obj=context_obj, 
show_docs=1,
                  max_title_words=10, display_hidden_folders=0,
                  display_valid_docs=1, sort_by=sort_by)
you can sort by 'date', 'title', 'author',  and invert the sorting order 
with 'sort_direction' = 'desc' or 'asc'
see:
CPSPortlets/skins/cpsportlets_widgets/getFolderItems.py
>I also have another question, how is used getCustomDisplayParams.py?
>
>  
>
this one belongs to CPSDefault, I'm not sure about what it does.
>Thanks again
>C.
>  
>
you're welcome /JM

Gli affari migliori del Web? Solo su Lycos Shopping!

_______________________________________________
cps-users mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/cps-users

Reply via email to