Adding a content type/configlet (coding)


#1

Hello, everyone. I’ve been trying to analyze the python files of senaite. Basically, I want to be able to add a content type viewable through {portal_url}/@@overview-controlpanel AND {portal_url}/@@lims-setup (ListingView included).

So far, I’ve been able to deduce that I need the following files in order to add my custom content type:

  1. /interfaces/init.py for the interface
  2. /controlpanel/contents.py supposing that my content type’s name is Content and that we have Contents as the folderish
  3. /content/content.py for defining the content item or basecontent
  4. /profiles/default/types.xml for registering the content types (folderish and content item)
  5. I need to add the xml files for the content types in /profiles/default/types
  6. factorytool.xml

I’ve been messing with rolemap.xml, profiles.zcml, permissions.py, permissions.zcml, and workflows.xml as well. But decided to just use an existing permission. Right now, I just want to add a type in @@lims-setup and upon clicking the link, will eventually redirect me to the listings of that content type.

As of now, I haven’t look into the @@lims-setup since I’m days stuck with @@overview-control panel. I managed to add a configlet. See the Contents configlet along with Containers and Container Types configlets (Left). But whenever I click, it gives me “page doesn’t seem to exist” (Right).

8a8e11aa1510959235031050437fa74b497d7ad2_2_690x491

My controlpanel.xml looks like this:

<configlet title="Contents" action_id="senaite.contents"
appId="senaite.databox" category="senaite" condition_expr=""
icon_expr="string:++resource++bika.lims.images/container.png"
url_expr="string:$portal_url/@@folder_view"
visible="True"
i18n:attributes="title">
<permission>senaite.core: Manage Bika</permission>
</configlet>

The url says {portal_url}/bika_setup/contents since that was my initial url_expr. But upon reading Manage Settings with Registry, Control Panels and Vocabularies, I followed the said instruction. I know there’s something with bika_setup/[your_content_type] but I couldn’t piece it together.

My configure.zcml inside controlpanel directory looks like this:

<browser:page
  for="senaite.databox.interfaces.IContents"
  name="folder_view"
  class=".contents.ContentsView"
  permission="senaite.core.permissions.ManageBika"
  layer="senaite.databox.interfaces.IContents"
/>

Was there something that I missed? How do I get redirected to the content type listings upon clicking the configlet at @@overview-controlpanel?

Also, how do I make the content type appear under @@lims-setup? (since it’s not displaying there) Does it have something to do with senaite/lims/controlpanel/browser/views/setupview.py?

Any help would be much appreciated. Thank you!


#2

Update:

Based on controlpanel.py inside /bika/lims/monkey directory, I should use “bika” as category, so that my configlet will appear under LIMS Configuration in @@overview-controlpanel