-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jean-Marc Orliaguet wrote:
> Olivier Grisel wrote:
>
>
>>Moving the discussion here to gain a wider audience. (quoting the all
>>history).
>>
>>Jean-Marc Orliaguet wrote:
>>
>>
>>>Olivier Grisel wrote:
>>>
>>>
>>>>Jean-Marc Orliaguet wrote:
>>>>
>>>>
>>>>>>CPS3/CPSPortlets/skins/cpsportlets_widgets_cps3/getNavigationItems.py
>>>>>>1.11 => 1.12 ===
>>>>>> if depth >= end_depth:
>>>>>> continue
>>>>>>
>>>>>>+ # filter out hidden folders
>>>>>>+ if object.get('hidden_folder', False):
>>>>>>+ continue
>>>>>>+
>>>>>
>>>>>maybe this should be made optional since getNavigationItems.py will be
>>>>>used to get folder contents items and they must be visible otherwise
>>>>>hidden folder will never be accessible for edition.
>>>>>
>>>>>I'll add an option to the Navigation Portlet's layout.
>>>>
>>>>
>>>>
>>>>Yes but usually, hidden_folders are only viewable with the 'manage
>>>>content' view of the folders, not the listing view.
>>>>
>>>>+ The TreeBox filters out the hidden_folder in a more clever way,
>>>>based on the current path of the object :
>>>>
>>>>"""
>>>> # now remove hidden_folder that are not in the current path
>>>> if not self.display_hidden_folder:
>>>> cur_url = current_url + '/'
>>>> hidden = [item for item in tree if
>>>>item.get('hidden_folder')]
>>>> if hidden:
>>>> hidden = [item for item in hidden
>>>> if not cur_url.startswith(item['rpath'] +
>>>>'/')]
>>>> if hidden:
>>>> items = []
>>>> for item in tree:
>>>> is_hidden = 0
>>>> for h in hidden:
>>>> if (item['rpath'] + '/').startswith(h['rpath']
>>>>+ '/'):
>>>> is_hidden = 1
>>>> break
>>>> if not is_hidden:
>>>> items.append(item)
>>>> tree = items
>>>>"""
>>>>
>>>>Furthermore, the navigation portlet lacks other features of the
>>>>TreeBox such as the 'display_managers' (computed by getFolderInfo),
>>>>'display_description' and 'authorized_only' options. The latter is a
>>>>restricted option that defaults to True.
>>>>
>>>>Finally, there is an identation problem with authorized folders whose
>>>>parents are unauthorized: for instance when a portal member is
>>>>connected, she can view her member's workspace but cannot view the
>>>>'workspaces' and 'members' folders. Therefor it gets depth 2 even
>>>>though it has no parent ... The TreeBox fixes this display problem
>>>>with the computation of a 'local_depth' parameter:
>>>>
>>>>"""
>>>> # compute relativ depth
>>>> # we need to copy items as we modify depth
>>>> items = deepcopy(tree)
>>>> if items:
>>>> local_depth = items[0]['depth']
>>>> items[0]['depth'] = 0
>>>> local_rpath = items[0]['rpath'] + '/'
>>>> for item in items[1:]:
>>>> if not (item['rpath'] + '/').startswith(local_rpath):
>>>> local_rpath = item['rpath'] + '/'
>>>> local_depth = item['depth']
>>>> item['depth'] = 0
>>>> else:
>>>> item['depth'] = item['depth'] - local_depth
>>>> tree = items
>>>>"""
>>>>
>>>>Thus it might be interesting to add the following options to the
>>>>navigation portlet's schema/layout and reuse/adapt the correspondig
>>>>code snippets from TreeBox.getTree(context) in the
>>>>getNavigationItems.py script.
>>>>
>>>>Summary of the missing options to add to the schema:
>>>>- 'authorized_only'
>>>>- 'display_hidden_folder'
>>>>- 'display_managers'
>>>>- 'display_description'
>>>>
>>>>+ the local_depth fix
>>>>
>>>>I can do it if you want, just let me know!
>>>>
>>
>>>Yes, if you wish! definitely.
>>>
>>>I'm checking in the 'display_hidden_folder' layout option in 2 minutes.
>>
>>
>>Tested, it looks alright to me.
>>
>>
>>>and to remember that navigation portlets are not cached in RAM so make
>>>sure that the code is ignored if the options are not selected. Shouldn't
>>>this be implemented in CPSNavigation by the way?
>>
>>
>>Yes, this is a problem since in the constructor or CPSNavigation,
>>'filter' (which corresponds to the 'authorized_only' option) is set to
>>1 (hardcoded).
>>
>>Furthermore I don't really know which options out of the previous list
>>should be part of the CPSNavigation filters set, esp. should the
>>local_depth fix be part of it? Same question applies for the
>>'display_hidden_folder' filter. I am not really aware of where and how
>>CPSNavigation is used elsewhere ...
>>
>>Somebody with more insight could please give me instructions on where
>>to put that code?
>>
>>Cheers,
>>
>>--
>>Olivier
>
>
>
> Hi!
>
> Just been thinking about it on the way home:
>
> it is not CPSPortlets' responsibility to know about the internals of
> CPS3 when it comes to navigation. Basically what CPSPortlets does (let's
> say for the Navigation Portlet) is:
>
> - gather information about what the user wants to be displayed (this is
> the layout/schema part)
> - filter out impossible configurations
> - ask CPSNavigation what items should be displayed according to the
> user's choices
> - generate the HTML code based on the data obtained from CPSNavigation
> and pass it to CPSSkins
> (make sure that the HTML code is formatted in the way that CPSSkins
> expects it to be - this is done in widget_portlet_navigation.pt)
> - store the HTML data in the RAM cache if possible
> - then CPSSkins takes responsibility for the layout / skinning
>
> the getNavigationItems.py is basically just a glue script between
> CPSPortlets and CPSNavigation
>
> if these scripts (getNavigationItems, getFolderItems,
> getBreadcrumbsItems) have grown in size it is mostly because the
> functionality is not implemented yet in CPSNavigation.
>
> but this is where the code should be: in python classes inside
> CPSNavigation, not in the CPSPortlets's python scripts, so that API
> changes and optimizations are implemented only once.
>
+1 definitely.
J.
> PS: the getContentItems.py has grown in size too... there is a need for
> a catalog interface especially for syndication.
>
you're right !
- --
Julien Anguenot | Nuxeo R&D (Paris, France)
CPS Plateform : http://www.cps-project.org
mail: anguenot at nuxeo.com; tel: +33 (0) 6 72 57 57 66
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iD8DBQFCVH2mGhoG8MxZ/pIRAoshAJ9NVQjVm2mvRBZk8vjIzoAC38jFnwCdEEYd
bwJts7dJx2n1HKQhz3mz2Gc=
=CUXA
-----END PGP SIGNATURE-----
_______________________________________________
cps-devel mailing list
http://lists.nuxeo.com/mailman/listinfo/cps-devel