Replacing Modification Date with Effective Date in Tabular View

I want to change my table view to show Effective Date instead of Modification Date. I went to the following files and don't see the table column for Modification Date so that I can replace it with Effective Date:

  • portal_view_customizations/plone.dexterity.interfaces.idexteritycontainer-tabular_view
  • plone/app/contenttypes/browser/templates/listing_tabular.pt

Am I missing something? Any help or advice would be most appreciated. Thank you.

I think I found the solution. The field in question is found at plone/app/contenttypes/browser/folder.py:

@property
def tabular_fields(self):
    ret = []
    ret.append('Title')
    if self.show_about:
        ret.append('Creator')
    ret.append('Type')
    if self.show_about:
        ret.append('ModificationDate')
    return ret

Replace ModificationDate with EffectiveDate would now show Effective Date in the tabular view. Now the one million dollar question is how do I insert this change into my product itself and not having to change the information in the plone.app.contentypes product itself. Any advice would be most appreciated. Thank you.

So I am getting this error:
ncdhhscontenttype/policiesmanuals/configure.zcml line 35.2, unbound prefix. Line 35 is where <browser:pages starts. Any help would be most appreciated:

 <configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
    xmlns:i18n="http://namespaces.zope.org/i18n"
    i18n_domain="ncdhhscontenttype.policiesmanuals">

  <i18n:registerTranslations directory="locales" />
  <includeDependencies package="." />
  <include package=".browser" />
  <genericsetup:registerProfile
      name="default"
      title="NCDHHS Content Types: Policies and Manuals"
      directory="profiles/default"
      description="Installs the ncdhhscontenttype.policiesmanuals add-on."
      provides="Products.GenericSetup.interfaces.EXTENSION"
      post_handler=".setuphandlers.post_install"
      />
  <genericsetup:registerProfile
      name="uninstall"
      title="NCDHHS Content Types: Policies and Manuals (uninstall)"
      directory="profiles/uninstall"
      description="Uninstalls the ncdhhscontenttype.policiesmanuals add-on."
      provides="Products.GenericSetup.interfaces.EXTENSION"
      post_handler=".setuphandlers.uninstall"
      />

  <!-- VIEWS FOR FOLDERS -->
  <include package="plone.app.contenttypes" />

  <browser:pages
      for="ncdhhscontenttype.policiesmanuals.folder.FolderView"
      permission="zope2.View">
   
    <browser:page
        name="tabular_view"
        template="templates/listing_tabular.pt"
        menu="plone_displayviews"
        title="Tabular view"
        />
  </browser:pages>

  <utility
      factory=".setuphandlers.HiddenProfiles"
      name="ncdhhscontenttype.policiesmanuals-hiddenprofiles" />

  <utility name="ncdhhscontenttype.policiesmanuals.vocabulary.agency_division"
    factory="ncdhhscontenttype.policiesmanuals.vocabulary.agency_division_vocab" />

  <utility name="ncdhhscontenttype.policiesmanuals.vocabulary.policy_program"
    factory="ncdhhscontenttype.policiesmanuals.vocabulary.policy_program_vocab" />

</configure>

you're missing the browser namespace at the top:

xmlns:browser="http://namespaces.zope.org/browser"
1 Like

Thanks so much, Chrissy. Yes, the error disappeared!!! Thank you!

However, I think I am not pulling in the information that I need from the folder.py file. What I really need is from line 158-168, line 165 in particular:
https://paste.ofcode.org/GGzSt5BYMqqJ4m3F9CDkRH

Can't help but feel that I am not declaring the "for" and the "class" under browser:pages right. Any advice would be most appreciated. Thanks so much.

Reuse and override the Folderview.
The template is the original listing_tabular.pt from p.a.c

<browser:page
  for="plone.app.contenttypes.interfaces.IFolder"
  layer="your.app.interfaces.IYourAppLayer"
  name="tabular_view"
  class=".views.CustomFolderView"
  template="templates/listing_tabular.pt"
  permission="zope2.View"
  menu="plone_displayviews"
  title="Tabular View" />
from plone.app.contenttypes.browser.folder import FolderView

""" Your custom Folderview """
class CustomFolderView(FolderView):
    
    def __init__(self, context, request):
        self.context = context
        self.request = request

    def __call__(self):        
        return super(CustomFolderView, self).__call__()

    @property
    def tabular_fields(self):
        ret = []
        ret.append('Title')
        if self.show_about:
            ret.append('Creator')
        ret.append('Type')
        ret.append('EffectiveDate')
        if self.show_about:
            ret.append('ModificationDate')
        return ret

Jan,

Thank you so much for your help. So this is what I did. All the files below are at the same level:

configure.zcml:

<browser:pages
for="plone.app.contenttypes.interfaces.IFolder"
layer="ncdhhscontenttype.policiesmanuals.interfaces.INcdhhscontenttypePoliciesmanualsLayer"
name="tabular_view"
class="ncdhhscontenttype.policiesmanuals.folder.CustomFolderView"
template="templates/listing_tabular.pt"
permission="zope2.View"
menu="plone_displayviews"
title="Tabular View"
/>

interfaces.py:

from ncdhhscontenttype.policiesmanuals import _
from zope import schema
from zope.interface import Interface
from zope.publisher.interfaces.browser import IDefaultBrowserLayer

class INcdhhscontenttypePoliciesmanualsLayer(IDefaultBrowserLayer):
"""Marker interface that defines a browser layer."""

class IForm(Interface):

title = schema.TextLine(
    title=_(u'Title'),
    required=True,
)

description = schema.Text(
    title=_(u'Description'),
    required=False,
)

folder.py:

from plone.app.contenttypes.browser.folder import FolderView

""" Your custom Folderview """
class CustomFolderView(FolderView):

def __init__(self, context, request):
    self.context = context
    self.request = request

def __call__(self):        
    return super(CustomFolderView, self).__call__()

@property
def tabular_fields(self):
    ret = []
    ret.append('Title')
    if self.show_about:
        ret.append('Creator')
    ret.append('Type')
    ret.append('EffectiveDate')
    if self.show_about:
        ret.append('ModificationDate')
    return ret

Errors:

ZopeXMLConfigurationError: File "/var/plone/sharedservices/zeocluster/src/ncdhhscontenttype.policiesmanuals/src/ncdhhscontenttype/policiesmanuals/configure.zcml", line 37.2
ConfigurationError: ('Unrecognized parameters:', 'name', 'title', 'menu', 'template')

Am I missing something? Do I need to do anything in the interface.py file? Any advice would be most appreciated.

Thanks so much!

Thanks to bjorn_again for letting me know that it should have been <browser:page instead of <browser:pages. Cheers!

I have also noticed something else. All my tabular views are behaving as it should now except for the tabular view under eea.facetednavigation = 11.7. Do they have their own thing going on there? I have searched their entire product and could not find a tabuler_view or a listing_tabular.pt file. They do not seem to have its own tabular view which makes this so strange. Have you all come across this problem?