Problem / doubt about enable faceted navigable custom content types

21 views
Skip to first unread message

Hugo Alberto Rodríguez Peña

unread,
May 26, 2011, 12:21:52 PM5/26/11
to eea-facete...@googlegroups.com
hello i am working with your great product, but i having a big problem i'm unable  to make a custom content type faceted navigable is there any way to do this?? does the content type needs to fulfil any requirements?

Alin Voinea

unread,
May 27, 2011, 3:08:49 AM5/27/11
to eea-facete...@googlegroups.com, Hugo Alberto Rodríguez Peña
Hi,

If you're using eea.facetednavigation from trunk (http://svn.plone.org/svn/collective/eea.facetednavigation/trunk/) all you have to do is to mark your custom content with this interface: IPossibleFacetedNavigable like this:

my.package/my/package/configure.zcml
  <class class="my.package.content.MyCustomContent">
    <implements interface="eea.facetednavigation.interfaces.IPossibleFacetedNavigable" />
  </class>
Cheers,
Alin


On 05/26/2011 07:21 PM, Hugo Alberto Rodríguez Peña wrote:
hello i am working with your great product, but i having a big problem i'm unable  to make a custom content type faceted navigable is there any way to do this?? does the content type needs to fulfil any requirements?
--
You received this message because you are subscribed to the Google Groups "EEA Faceted Navigation (Unofficial discussion group)" group.
To post to this group, send email to eea-facete...@googlegroups.com.
To unsubscribe from this group, send email to eea-facetednavig...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/eea-facetednavigation?hl=en.

HRodriguez

unread,
Jun 6, 2011, 1:28:00 PM6/6/11
to EEA Faceted Navigation (Unofficial discussion group)
I did what you told me but still not working, i am sorry i forgot to
point that iam using plone 3.3.5 and now faceted 3.11

Thank you

On May 27, 2:08 am, Alin Voinea <alin.voi...@gmail.com> wrote:
> Hi,
>
> If you're using eea.facetednavigation from trunk
> (http://svn.plone.org/svn/collective/eea.facetednavigation/trunk/) all
> you have to do is to mark your custom content with this interface:
> IPossibleFacetedNavigable like this:
>
> *my.package/my/package/configure.zcml*
>
>    <class class="my.package.content.MyCustomContent">
>
>      <implements interface="eea.facetednavigation.interfaces.IPossibleFacetedNavigable" />
>
>    </class>
>
> Cheers,
> Alin
>

Alin Voinea

unread,
Jun 7, 2011, 3:40:50 AM6/7/11
to eea-facete...@googlegroups.com, HRodriguez
Hi,

Yes, in Plone 3 you have to do more than that, as Plone 3 version of eea.facetednavigation is still using p4a.subtyper.


1. Add a descriptor:

..my.package/my/package/descriptors.py

from zope import interface
from eea.facetednavigation.interfaces import IFacetedNavigable
from p4a.subtyper.interfaces import IPortalTypedFolderishDescriptor
class FacetedNavigableDescriptor(object):
    """ My descriptor """

    interface.implements(IPortalTypedFolderishDescriptor)
    title = u'Faceted Navigable'
    description = u'Faceted navigable'
    type_interface = IFacetedNavigable
    for_portal_type = 'MyCustomContent'



2. Register it and make your content Faceted Navigable:

..my.package/my/package/configure.zcml

   <class class="my.package.content.MyCustomContent">
     <implements interface="eea.facetednavigation.interfaces.IPossibleFacetedNavigable" />
   </class>
   
   <utility
     name="my.package.MyCustomContentFacetedNavigable"
     factory=".descriptors.FacetedNavigableDescriptor" />



Cheers,
Alin

HRodriguez

unread,
Jun 12, 2011, 1:25:47 AM6/12/11
to EEA Faceted Navigation (Unofficial discussion group)
>.< ok i felling a little dumb now i still cant it happen

i have a contentype named CVArticleFolder and i have this

in my descriptor.py

from zope import interface
from eea.facetednavigation.interfaces import IFacetedNavigable
from p4a.subtyper.interfaces import IPortalTypedFolderishDescriptor

class FacetedNavigableDescriptor(object):
""" My descriptor """

interface.implements(IPortalTypedFolderishDescriptor)
title = u'Faceted Navigable'
description = u'Faceted navigable'
type_interface = IFacetedNavigable
for_portal_type = 'CVArticleFolder'

and in the configure.zcml

<class
class="UNAM.imateCVct.content.folders.CVArticleFolder">
<implements
interface="eea.facetednavigation.interfaces.IPossibleFacetedNavigable" /
>
</class>

<utility
name="UNAM.imateCVct.content.folders.CVArticleFolder"
factory=".descriptors.FacetedNavigableDescriptor" />

what am i doing wrong??
On Jun 7, 2:40 am, Alin Voinea <alin.voi...@gmail.com> wrote:
> Hi,
>
> Yes, in Plone 3 you have to do more than that, as Plone 3 version of
> eea.facetednavigation is still using p4a.subtyper.
>
> 1. Add a descriptor:
>
> *..my.package/my/package/descriptors.py
>
> *
>
> from zope import interface
> from eea.facetednavigation.interfaces import IFacetedNavigable
> from p4a.subtyper.interfaces import IPortalTypedFolderishDescriptor
>
> class FacetedNavigableDescriptor(object):
>      """ My descriptor """
>
>      interface.implements(IPortalTypedFolderishDescriptor)
>      title = u'Faceted Navigable'
>      description = u'Faceted navigable'
>      type_interface = IFacetedNavigable
>      for_portal_type = 'MyCustomContent'
>
> 2. Register it and make your content Faceted Navigable:
>
> *..my.package/my/package/configure.zcml*

Alin Voinea

unread,
Jun 14, 2011, 3:58:57 AM6/14/11
to eea-facete...@googlegroups.com, HRodriguez
Hmm, strange, it should work... Can you also paste here the code from:

UNAM.imateCVct.content.folders.py

and

UNAM.imateCVct.profiles.default.types.CVArticleFolder.xml


Cheers,
Alin

Hugo Alberto Rodríguez Peña

unread,
Jun 16, 2011, 4:56:12 PM6/16/11
to alin....@gmail.com, eea-facete...@googlegroups.com
the code in folders.py have lots of other folder definitios so i paste the code that is involve with CVArticleFolder or will be to much code to be readed here.

###LOTS OF IMPORTS ###

BaseFolderSchema = folder.ATFolderSchema.copy()

BaseFolderSchema['title'].storage = atapi.AnnotationStorage()
BaseFolderSchema['title'].widget.label = _(u"Título")
BaseFolderSchema['title'].widget.label_msgid = "lab_title_basefolder"
BaseFolderSchema['title'].widget.description_msgid = "des_title_basefolder"
BaseFolderSchema['title'].widget.i18n_domain = "UNAM.imateCVct"

BaseFolderSchema['description'].storage = atapi.AnnotationStorage()
BaseFolderSchema['description'].widget.label = _(u"Descripción")
BaseFolderSchema['description'].widget.label_msgid = "lab_desc_basefolder"
BaseFolderSchema['description'].widget.description = _(u"Breve resumen del contenido")
BaseFolderSchema['description'].widget.description_msgid = "des_desc_basefolder"
BaseFolderSchema['description'].widget.i18n_domain = "UNAM.imateCVct"

finalizeATCTSchema(BaseFolderSchema, folderish=True, moveDiscussion=False)

RootFolderSchema = atapi.Schema((
    atapi.StringField('login',
        searchable=0,
        widget=atapi.SelectionWidget(label="Dueño(a) del currículum",
           label_msgid="label_login_cur",
           description="",
           description_msgid="help_login_cur",
           i18n_domain='UNAM.imateCVct',
           visible={'view': 'invisible', 'edit': 'visible'},
           format='select',
           ),
        default_method="getDefaultUser",
        vocabulary='getListAllUsers',
        accessor='Login',
       ),
))


class CVBaseFolder(folder.ATFolder):
    """
    """
    implements(ICVBaseFolder)
    security = ClassSecurityInfo()

    portal_type = "CVBaseFolder"
    _at_rename_after_creation = True
    schema = BaseFolderSchema
    import_report=''

    title = atapi.ATFieldProperty('title')
    descripcion = atapi.ATFieldProperty('description')


    #LOTS OF METHODS DEFINITIONS#

class importExportClass:
    implements(ICVimportExport)
    security = ClassSecurityInfo()

    security.declareProtected('View', 'isImportExportable')
    def isImportExportable(self):
        return True


class CVArticleFolder(importExportClass, CVBaseFolder):
    """Articles folder
    It can contains many articles
    """
    implements(ICVPublicationFolder)
    contains('UNAM.imateCVct.interfaces.ICVArticle')
    archetype_name = "Folder Articulos"



atapi.registerType(CVArticleFolder, PROJECTNAME)


the code inside CVArticleFolder.xml is

<?xml version="1.0" encoding="UTF-8"?>
<object name="CVArticleFolder"
   meta_type="Factory-based Type Information with dynamic views"
   i18n:domain="UNAM.imateCVct" xmlns:i18n="http://xml.zope.org/namespaces/i18n">
 <property name="title" i18n:translate="">Folder Articulos</property>
 <property name="description"
     i18n:translate="">Folder de Articulos</property>
 <property name="content_icon">++resource++cvfolder_icon.gif</property>
 <property name="content_meta_type">CVArticleFolder</property>
 <property name="product">UNAM.imateCVct</property>
 <property name="factory">addCVArticleFolder</property>
 <property name="immediate_view">atct_edit</property>
 <property name="global_allow">False</property>
 <property name="filter_content_types">True</property>
 <property name="allowed_content_types">
    <element value="CVArticle" />
</property>
 <property name="allow_discussion">False</property>
 <property name="default_view">view</property>
 <property name="view_methods">
  <element value="view"/>
  <element value="folder_tabular_view"/>
  <element value="folder_listing"/>
 </property>
 <alias from="(Default)" to="(dynamic view)"/>
 <alias from="edit" to="atct_edit"/>
 <alias from="sharing" to="@@sharing"/>
 <alias from="view" to="(selected layout)"/>
 <action title="View" action_id="view" category="object" condition_expr=""
    url_expr="string:${object_url}" visible="True">
  <permission value="View"/>
 </action>
 <action title="Edit" action_id="edit" category="object" condition_expr=""
    url_expr="string:${object_url}/edit" visible="True">
  <permission value="Edit CV Folder"/>
 </action>
 <action title="Elegir vista" action_id="selectview" category="document_actions" condition_expr=""
    url_expr="string:${object_url}/summary" visible="True">
  <permission value="View"/>
 </action>
 <action title="Exportar" action_id="export" category="document_actions" condition_expr="python:object.isImportExportable()"
    url_expr="string:${object_url}/export" visible="True">
  <permission value="View"/>
 </action>
 <action title="Importar" action_id="import" category="document_actions" condition_expr="python:object.isImportExportable()"
    url_expr="string:${object_url}/import" visible="True">
  <permission value="Add portal content"/>
 </action>

</object>


thank you =)

2011/6/14 Alin Voinea <alin....@gmail.com>
Reply all
Reply to author
Forward
0 new messages