espenmn
(Espen)
October 9, 2023, 3:37pm
1
Would it be possible to install ( profiles/default and / or setuphandlers.py)
Collective.collectionfilter
Make a Collection, set criterias
"Lock" view (display) for everybody, also admins
Enable different 'Collectionfilter' portlets on the collection.
1 and maybe 2 is pretty straightforwars (metadata.xml and types.xml)
About 3, I assume it should be possible to change 'Change View Template' permissions, or do I (really) have to make a new workflow for this ?
About 4: I have no idea how this could work, where is this info saved?
Strangely enough the Collection critereas are not saved in 'content export' either:
cd path/to/setuptoolexport/structure/mycollection
vi .data
query:
sort_on:
sort_reversed: False
limit: 1000
item_count: 30
customViewFields: Title||Creator||Type||ModificationDate
allow_discussion:
id: my-id
exclude_from_nav: False
title: My Collection
description:
subjects:
language: en-us
effective:
expires:
creators: admin
contributors:
rights:
relatedItems:
Portal-Type: Collection
yurj
(Yuri)
October 10, 2023, 6:24am
2
about 3, you can just configure the type to have only 1 display view.
petschki
(Peter Mathis)
October 10, 2023, 11:15am
3
For 4. you can use genericsetup: provide a XML file portlets.xml
in your profile folder which looks like this:
<?xml version="1.0" encoding="utf-8"?>
<portlets>
<!-- Assign a context portlets -->
<assignment category="context"
key="/path/to/your/collection"
manager="plone.leftcolumn"
name="my-portlet"
type="portlets.Navigation"
/>
...
</portlets>
espenmn
(Espen)
October 10, 2023, 12:30pm
4
This probably has to run after setuphandlers, but is possible if it is put in another profile and run from there (for example having 'profile-beforedefault in metadate)
<dependency>my-addon:beforedefault</dependency>
My main confusion is how to add the critereas to the portlet.
espenmn
(Espen)
October 10, 2023, 12:31pm
5
This is for 'Collection', so cant do that.
petschki
(Peter Mathis)
October 10, 2023, 1:20pm
6
This is the code, that imports <property />
nodes inside the <assignment />
node https://github.com/plone/plone.app.portlets/blob/master/plone/app/portlets/exportimport/portlets.py#L161 ... the following (untested!) snipped should set the values to the collectionfilter
portlet:
<assignment category="context"
key="/path/to/your/collection"
manager="plone.leftcolumn"
name="my-portlet"
type="collective.collectionfilter.portlets.CollectionFilter">
<property name="title">My Filter portlet</property>
<property name="group_by">Subject</property>
<property name="show_count">True</property>
</assignment>
Note: you do not need to set the target_collection
if your portlet context is the collection anyways.
espenmn
(Espen)
October 10, 2023, 2:09pm
7
Thanks, works great (except from the title which seems to be 'header' in this case.
<!-- Assign a collection filter portlet -->
<assignment category="context"
key="/path/to/collection"
manager="plone.rightcolumn"
name="collectionfilterone"
type="collective.collectionfilter.portlets.CollectionFilter">
<property name="header">My Header</property>
<property name="group_by">Subject</property>
<property name="show_count">True</property>
</assignment>