SlideShare a Scribd company logo
1 of 34
Download to read offline
Asko Soukka, asko.soukka@iki.fi
github.com/datakurre
Instant features with
advanced Plone themes
What if. . .
Case of the day: Wall of images
– Resource bundles
– Folderish content type
– Custom view template
for Wall of images with
Masonry.js layout
– Workflow for accepting
anonymous submissions
– Image content type for
anonymous submissions
– Add permission for
restricting anonymous
visitor submission
– Content rule for
thanking about
submission
– Review portlet for listing
the pending submissions
– i18n with l10n message
catalog
Python packages vs. theme?
Python packages
– One package for new JS
– Another for new types
– Customer specific
theming of components
in theme package
– Configuring everything in
policy package
– Restarting Plone
Advanced theme
– Everything in a single
zipped Plone theme
package
– Upload through Plone
control panel or using
npm package
plonetheme-upload
Plone customization features
– Configurable registry
– Structured content types
– Content type behaviors
– State based workflows
– Roles and permissions
– All types of portlets
– Content rules on events
– Restricted templates
– Restricted Python scripts
– Static frontend resources
– Diazo transform rules
– . . .
Plone customization features
– Configurable registry
– Structured content types
– Content type behaviors
– State based workflows
– Roles and permissions
– All types of portlets
– Content rules on events
– Restricted templates
– Restricted Python scripts
– Static frontend resources
– Diazo transform rules
– . . .
Restricted Python?
”Restricted Python provides a safety net for
programmers who don’t know the details of
the Zope/Plone security model.
It is important that you understand that the
safety net is not perfect: it is not adequate to
protect your site from coding by an untrusted
user.”
– Steve McMahon, collectice.ambidexterity README
Issues with Restricted Python
Not only ponies and unicorns...
– API is restrictedTraversed, not imported
– API is not always complete
– API is not always up-to-date
– API is scattered around the ecosystem
– plone.api is not currently designed or available by default
to be called from Restricted Python
Products.DocFinderTab
”through-the-web”
=
technical debt
Advanced Plone themes
– Theme with any supported customizations
– Editable using Plone theme editor
– Rollbacks with Zope2 undo form
– Zip-exportable and importable from theme editor
– Supports ”TTW” and ”file system" development
– Exports can be version controlled
– Exports can be acceptance tested
collective.themesitesetup
Theme activation or update
– Imports GS profile steps
– Updates DX models
– Registers permissions
– Registers l10m messages
– Copies resources into
portal_resources
Theme deactivation
– Imports GS profile steps
– Unregisters added
custom permissions
– Unregisters added
custom l10n messages
After ”TTW” development
– @@export-site-setup
collective.themefragments
View templates: ./fragments/foobar.pt
– Can be injected as fragments using Diazo rules
– Can be configured as a default view for any content type
– Can be used as a local view by setting layout attribute
Python scripts: ./fragments/foobar.py
– Can provide view methods for view templates with
matching base name (tal:define="data view/getData")
Faster iterations
=
More iterations
Let’s get our hands dirty. . .
Creating Wall of images
– Initial configuration was made through Plone site setup
– Configuration was exported into a new theme using the
export view ++theme++.../@@export-site-setup
– Theme was zip-exported from theming control panel
– Content type schemas were exported from Dexterity editor
– Development was completed on a regular file system
buildout using file system resources directory
Structure of Wall of images
./bundles/
./fragments/
./install/types/
./install/workflows/
./install/
./locales/LC_MESSAGES/*/
./models/
./index.html
./manifest.cfg
./preview.png
./rules.xml
./scripts.js
./styles.css
Custom frontend bundles 1/2
./bundles/imagesloaded.pkgd.min.css
./bundles/imagesloaded.pkgd.min.js
./bundles/masonry.pkgd.min.css
./bundles/masonry.pkgd.min.js
(function() { var require, define;
// ...
// AMD packaged JS distributions must be wrapped
// so that Plone require.js define is undefined
// during their load
// ...
})();
Custom frontend bundles 2/2
./install/registry.xml
<records prefix="plone.bundles/imagesloaded-js"
interface="...interfaces.IBundleRegistry">
<value key="depends">plone</value>
<value key="jscompilation">++theme++...js</value>
<value key="csscompilation">++theme++...css</value>
<value key="last_compilation">2017-10-06 00:00:00
</value>
<value key="compile">False</value>
<value key="enabled">True</value>
</records>
Custom content types 1/2
./install/types/wall_of_images.xml
./install/types/wall_of_images_image.xml
./install/types.xml
<object name="portal_types">
<object name="wall_of_images"
meta_type="Dexterity FTI"/>
<object name="wall_of_images_image"
meta_type="Dexterity FTI"/>
</object>
./models/wall_of_images.xml
./models/wall_of_images_image.xml
Custom content types 2/2
<model xmlns:...="..." i18n:domain="plone">
<schema>
<field
name="title" type="zope.schema.TextLine">
<title i18n:translate="">Title</title>
</field>
<field
name="image"
type="plone.namedfile.field.NamedBlobImage">
<title i18n:translate="">Image</title>
</field>
</schema>
</model>
Custom views 1/3
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:...="..."
lang="en"
metal:use-macro=".../macros/master"
i18n:domain="plone">
<body>
<metal:main fill-slot="main">
<metal:content-core define-macro="content-core">
</metal:content-core>
</metal:main>
</body>
</html>
Custom views 2/3
./fragments/wall-of-images.pt
<div class="wall-of-images container-fluid"
tal:define="items context/@@contentlisting">
<tal:image tal:repeat="item items">
<img tal:define="obj item/getObject;
scale_func obj/@@images;
scaled_image python:scale_func.scale('image',
scale='preview')"→
tal:replace="structure
python:scaled_image.tag()"→
tal:on-error="string:error" />
</tal:image>
</div>
Custom views 3/3
./install/types/wall_of_images.xml
...
<property name="default_view">
++themefragment++wall-of-images</property>
<property name="view_methods">
<element value="++themefragment++wall-of-images"/>
</property>
...
Any themefragment can be configured as content object view
by manually setting layout property of the content object.
Custom l10n messages
./locales/fi/LC_MESSAGES/plone.po
./locales/en/LC_MESSAGES/plone.po
msgid "Close from submissions"
msgstr "Sulje osallistuminen"
msgid "Open for submissions"
msgstr "Avaa osallistumiselle"
When theme is developed on file system, normal i18n tools
can be used for messages extraction and catalog
synchronization (e.g. i18ndude).
Custom permissions
./manifest.cfg
[theme:genericsetup]
permissions =
demotheme.addImage Wall of Images: Add Image
./install/types/wall_of_images_image.xml
<object name="wall_of_images_image" ...="..">
...
<property name="add_permission">
demotheme.addImage</property>
...
</object>
Custom workflows
./install/workflows.xml
./install/simple_publication_with_submission_workflow/
./install/wall_of_images_workflow/
<type type_id="wall_of_images">
<bound-workflow workflow_id="..."/>
</type>
<dc-workflow workflow_id="...">
...
<permission>Wall of Images: Add Image</permission>
...
</dc-workflow>
Custom content rules
./install/contentrules.xml
<contentrules>
<rule name="rule-image-thank-you"
title="Thank visitor from submission"
cascading="False"
description="Thanks visitor after submission"
event="...IObjectAddedEvent"
stop-after="False"
enabled="True">...</rule>
<assignment
name="rule-image-thank-you" bubbles="True"
enabled="True" location=""/>
</contentrules>
Final touch with Diazo-bundles
./manifest.cfg
production-css = /++theme++demotheme/styles.css
production-js = /++theme++demotheme/scripts.js
./scripts.js
jQuery(function($) {
$('.wall-of-images').imagesLoaded(function() {
$('.wall-of-images').masonry({
itemSelector: 'img',
percentPosition: true
});
});
});
Questions?Questions?
github.com/datakurre/ploneconf2017github.com/datakurre/ploneconf2017
What about Mosaic?
– Theme site setup can populate Mosaic site and content
layout resource directories from theme
– Theme fragment tile for Plone Mosaic can render selected
fragment with
– fragment-specific readable title
– fragment-specific XML schema based configuration form
– fragment-specific view permission
– fragment-specific caching rule
What about Webpack?
– Bundles in theme can be built with Webpack
– Diazo bundle in theme can be built with Webpack
– All frontend resources can be built with Webpack
– plonetheme.webpacktemplate
– plonetheme-webpack-plugin
– plonetheme-upload
Bonus: Custom JS widgets
./models/my_content_type.xml
...
<field name="focuspoint"
type="zope.schema.BytesLine">
<form:widget
type="z3c.form.browser.text.TextFieldWidget">
<klass>text-widget pat-focuspoint-widget</klass>
</form:widget>
<title i18n:translate="">Image focus point</title>
<required>false</required>
</field>
...

More Related Content

What's hot

HTML5 Server Sent Events/JSF JAX 2011 Conference
HTML5 Server Sent Events/JSF  JAX 2011 ConferenceHTML5 Server Sent Events/JSF  JAX 2011 Conference
HTML5 Server Sent Events/JSF JAX 2011 ConferenceRoger Kitain
 
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiGrâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiJérémy Derussé
 
Deview 2013 mobile browser internals and trends_20131022
Deview 2013 mobile browser internals and trends_20131022Deview 2013 mobile browser internals and trends_20131022
Deview 2013 mobile browser internals and trends_20131022NAVER D2
 
JWT - Sécurisez vos APIs
JWT - Sécurisez vos APIsJWT - Sécurisez vos APIs
JWT - Sécurisez vos APIsAndré Tapia
 
What is new in Notes & Domino Deleopment V10.x
What is new in Notes & Domino Deleopment V10.xWhat is new in Notes & Domino Deleopment V10.x
What is new in Notes & Domino Deleopment V10.xUlrich Krause
 
Spring5 hibernate5 security5 lab step by step
Spring5 hibernate5 security5 lab step by stepSpring5 hibernate5 security5 lab step by step
Spring5 hibernate5 security5 lab step by stepRajiv Gupta
 
Utiliser Webpack dans une application Symfony
Utiliser Webpack dans une application SymfonyUtiliser Webpack dans une application Symfony
Utiliser Webpack dans une application SymfonyAlain Hippolyte
 
Zend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZendCon
 
WebKit and Blink: open development powering the HTML5 revolution
WebKit and Blink: open development powering the HTML5 revolutionWebKit and Blink: open development powering the HTML5 revolution
WebKit and Blink: open development powering the HTML5 revolutionjuanjosanchezpenas
 

What's hot (12)

HTML5 Server Sent Events/JSF JAX 2011 Conference
HTML5 Server Sent Events/JSF  JAX 2011 ConferenceHTML5 Server Sent Events/JSF  JAX 2011 Conference
HTML5 Server Sent Events/JSF JAX 2011 Conference
 
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiGrâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
 
Deview 2013 mobile browser internals and trends_20131022
Deview 2013 mobile browser internals and trends_20131022Deview 2013 mobile browser internals and trends_20131022
Deview 2013 mobile browser internals and trends_20131022
 
JWT - Sécurisez vos APIs
JWT - Sécurisez vos APIsJWT - Sécurisez vos APIs
JWT - Sécurisez vos APIs
 
Rendering engine
Rendering engineRendering engine
Rendering engine
 
What is new in Notes & Domino Deleopment V10.x
What is new in Notes & Domino Deleopment V10.xWhat is new in Notes & Domino Deleopment V10.x
What is new in Notes & Domino Deleopment V10.x
 
JEE Programming - 01 Introduction
JEE Programming - 01 IntroductionJEE Programming - 01 Introduction
JEE Programming - 01 Introduction
 
Spring5 hibernate5 security5 lab step by step
Spring5 hibernate5 security5 lab step by stepSpring5 hibernate5 security5 lab step by step
Spring5 hibernate5 security5 lab step by step
 
Utiliser Webpack dans une application Symfony
Utiliser Webpack dans une application SymfonyUtiliser Webpack dans une application Symfony
Utiliser Webpack dans une application Symfony
 
Zend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZend_Tool: Practical use and Extending
Zend_Tool: Practical use and Extending
 
WebKit and Blink: open development powering the HTML5 revolution
WebKit and Blink: open development powering the HTML5 revolutionWebKit and Blink: open development powering the HTML5 revolution
WebKit and Blink: open development powering the HTML5 revolution
 
Dandelion 0.10.0
Dandelion 0.10.0Dandelion 0.10.0
Dandelion 0.10.0
 

Similar to Building instant features with advanced Plone themes

Speed up your asset imports for big projects - Unite Copenhagen 2019
Speed up your asset imports for big projects - Unite Copenhagen 2019Speed up your asset imports for big projects - Unite Copenhagen 2019
Speed up your asset imports for big projects - Unite Copenhagen 2019Unity Technologies
 
Présentation du générateur de site statique eleventy
Présentation du générateur de site statique eleventyPrésentation du générateur de site statique eleventy
Présentation du générateur de site statique eleventyGilles Vauvarin
 
Spring Roo Add-On Development & Distribution
Spring Roo Add-On Development & DistributionSpring Roo Add-On Development & Distribution
Spring Roo Add-On Development & DistributionStefan Schmidt
 
Pragmatische Plone Projekte
Pragmatische Plone ProjektePragmatische Plone Projekte
Pragmatische Plone ProjekteAndreas Jung
 
[Patel] SPFx: An ISV Insight into latest Microsoft's customization model
[Patel] SPFx: An ISV Insight into latest Microsoft's customization model[Patel] SPFx: An ISV Insight into latest Microsoft's customization model
[Patel] SPFx: An ISV Insight into latest Microsoft's customization modelEuropean Collaboration Summit
 
New in Plone 3.3. What to expect from Plone 4
New in Plone 3.3. What to expect from Plone 4New in Plone 3.3. What to expect from Plone 4
New in Plone 3.3. What to expect from Plone 4Quintagroup
 
Pragmatic plone projects
Pragmatic plone projectsPragmatic plone projects
Pragmatic plone projectsAndreas Jung
 
Build Automation of PHP Applications
Build Automation of PHP ApplicationsBuild Automation of PHP Applications
Build Automation of PHP ApplicationsPavan Kumar N
 
World Plone Day 2012 Taipei
World Plone Day 2012 TaipeiWorld Plone Day 2012 Taipei
World Plone Day 2012 TaipeiTsungWei Hu
 
Resource registries plone conf 2014
Resource registries plone conf 2014Resource registries plone conf 2014
Resource registries plone conf 2014Ramon Navarro
 
itPage LDC 09 Presentation
itPage LDC 09 PresentationitPage LDC 09 Presentation
itPage LDC 09 PresentationEric Landmann
 
Magento2 Basics for Frontend Development
Magento2 Basics for Frontend DevelopmentMagento2 Basics for Frontend Development
Magento2 Basics for Frontend DevelopmentKapil Dev Singh
 
Magento2 frontend development
Magento2   frontend developmentMagento2   frontend development
Magento2 frontend developmentKapil Dev Singh
 
Magento 2 View Layer Evolution
Magento 2 View Layer EvolutionMagento 2 View Layer Evolution
Magento 2 View Layer EvolutionSergii Shymko
 
Magento 1.x to Magento 2 Code Migration Tools
Magento 1.x to Magento 2 Code Migration ToolsMagento 1.x to Magento 2 Code Migration Tools
Magento 1.x to Magento 2 Code Migration ToolsSergii Shymko
 
Social Connections VI — IBM Connections Extensions and Themes Demystified
Social Connections VI — IBM Connections Extensions and Themes DemystifiedSocial Connections VI — IBM Connections Extensions and Themes Demystified
Social Connections VI — IBM Connections Extensions and Themes DemystifiedClaudio Procida
 
Build Python CMS The Plone Way
Build Python CMS The Plone WayBuild Python CMS The Plone Way
Build Python CMS The Plone WayTsungWei Hu
 
KubeCon 2017: Kubernetes from Dev to Prod
KubeCon 2017: Kubernetes from Dev to ProdKubeCon 2017: Kubernetes from Dev to Prod
KubeCon 2017: Kubernetes from Dev to ProdSubhas Dandapani
 

Similar to Building instant features with advanced Plone themes (20)

Speed up your asset imports for big projects - Unite Copenhagen 2019
Speed up your asset imports for big projects - Unite Copenhagen 2019Speed up your asset imports for big projects - Unite Copenhagen 2019
Speed up your asset imports for big projects - Unite Copenhagen 2019
 
Présentation du générateur de site statique eleventy
Présentation du générateur de site statique eleventyPrésentation du générateur de site statique eleventy
Présentation du générateur de site statique eleventy
 
Spring Roo Add-On Development & Distribution
Spring Roo Add-On Development & DistributionSpring Roo Add-On Development & Distribution
Spring Roo Add-On Development & Distribution
 
Pragmatische Plone Projekte
Pragmatische Plone ProjektePragmatische Plone Projekte
Pragmatische Plone Projekte
 
[Patel] SPFx: An ISV Insight into latest Microsoft's customization model
[Patel] SPFx: An ISV Insight into latest Microsoft's customization model[Patel] SPFx: An ISV Insight into latest Microsoft's customization model
[Patel] SPFx: An ISV Insight into latest Microsoft's customization model
 
New in Plone 3.3. What to expect from Plone 4
New in Plone 3.3. What to expect from Plone 4New in Plone 3.3. What to expect from Plone 4
New in Plone 3.3. What to expect from Plone 4
 
Pragmatic plone projects
Pragmatic plone projectsPragmatic plone projects
Pragmatic plone projects
 
Phing
PhingPhing
Phing
 
Build Automation of PHP Applications
Build Automation of PHP ApplicationsBuild Automation of PHP Applications
Build Automation of PHP Applications
 
World Plone Day 2012 Taipei
World Plone Day 2012 TaipeiWorld Plone Day 2012 Taipei
World Plone Day 2012 Taipei
 
Resource registries plone conf 2014
Resource registries plone conf 2014Resource registries plone conf 2014
Resource registries plone conf 2014
 
itPage LDC 09 Presentation
itPage LDC 09 PresentationitPage LDC 09 Presentation
itPage LDC 09 Presentation
 
Magento2 Basics for Frontend Development
Magento2 Basics for Frontend DevelopmentMagento2 Basics for Frontend Development
Magento2 Basics for Frontend Development
 
Magento2 frontend development
Magento2   frontend developmentMagento2   frontend development
Magento2 frontend development
 
Magento 2 View Layer Evolution
Magento 2 View Layer EvolutionMagento 2 View Layer Evolution
Magento 2 View Layer Evolution
 
ADF in action 1.2
ADF in action 1.2ADF in action 1.2
ADF in action 1.2
 
Magento 1.x to Magento 2 Code Migration Tools
Magento 1.x to Magento 2 Code Migration ToolsMagento 1.x to Magento 2 Code Migration Tools
Magento 1.x to Magento 2 Code Migration Tools
 
Social Connections VI — IBM Connections Extensions and Themes Demystified
Social Connections VI — IBM Connections Extensions and Themes DemystifiedSocial Connections VI — IBM Connections Extensions and Themes Demystified
Social Connections VI — IBM Connections Extensions and Themes Demystified
 
Build Python CMS The Plone Way
Build Python CMS The Plone WayBuild Python CMS The Plone Way
Build Python CMS The Plone Way
 
KubeCon 2017: Kubernetes from Dev to Prod
KubeCon 2017: Kubernetes from Dev to ProdKubeCon 2017: Kubernetes from Dev to Prod
KubeCon 2017: Kubernetes from Dev to Prod
 

More from Asko Soukka

Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
Embedding BPMN-driven business processes into Plone
Embedding BPMN-driven business processes into PloneEmbedding BPMN-driven business processes into Plone
Embedding BPMN-driven business processes into PloneAsko Soukka
 
Plone and Volto in a Jamstack project
Plone and Volto in a Jamstack projectPlone and Volto in a Jamstack project
Plone and Volto in a Jamstack projectAsko Soukka
 
Deploying Plone and Volto, the Hard Way
Deploying Plone and Volto, the Hard WayDeploying Plone and Volto, the Hard Way
Deploying Plone and Volto, the Hard WayAsko Soukka
 
How Plone Excels in GatsbyJS Content Mesh
How Plone Excels in GatsbyJS Content MeshHow Plone Excels in GatsbyJS Content Mesh
How Plone Excels in GatsbyJS Content MeshAsko Soukka
 
ZServer Reloaded with HTTP/2 and WebSocket Support
ZServer Reloaded with HTTP/2 and WebSocket SupportZServer Reloaded with HTTP/2 and WebSocket Support
ZServer Reloaded with HTTP/2 and WebSocket SupportAsko Soukka
 
Nix for Python developers
Nix for Python developersNix for Python developers
Nix for Python developersAsko Soukka
 
Acceptance testing plone sites and add ons with robot framework and selenium
Acceptance testing plone sites and add ons with robot framework and seleniumAcceptance testing plone sites and add ons with robot framework and selenium
Acceptance testing plone sites and add ons with robot framework and seleniumAsko Soukka
 
Plone, rabbit mq and messaging that just works
Plone, rabbit mq and messaging that just worksPlone, rabbit mq and messaging that just works
Plone, rabbit mq and messaging that just worksAsko Soukka
 

More from Asko Soukka (9)

Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
Embedding BPMN-driven business processes into Plone
Embedding BPMN-driven business processes into PloneEmbedding BPMN-driven business processes into Plone
Embedding BPMN-driven business processes into Plone
 
Plone and Volto in a Jamstack project
Plone and Volto in a Jamstack projectPlone and Volto in a Jamstack project
Plone and Volto in a Jamstack project
 
Deploying Plone and Volto, the Hard Way
Deploying Plone and Volto, the Hard WayDeploying Plone and Volto, the Hard Way
Deploying Plone and Volto, the Hard Way
 
How Plone Excels in GatsbyJS Content Mesh
How Plone Excels in GatsbyJS Content MeshHow Plone Excels in GatsbyJS Content Mesh
How Plone Excels in GatsbyJS Content Mesh
 
ZServer Reloaded with HTTP/2 and WebSocket Support
ZServer Reloaded with HTTP/2 and WebSocket SupportZServer Reloaded with HTTP/2 and WebSocket Support
ZServer Reloaded with HTTP/2 and WebSocket Support
 
Nix for Python developers
Nix for Python developersNix for Python developers
Nix for Python developers
 
Acceptance testing plone sites and add ons with robot framework and selenium
Acceptance testing plone sites and add ons with robot framework and seleniumAcceptance testing plone sites and add ons with robot framework and selenium
Acceptance testing plone sites and add ons with robot framework and selenium
 
Plone, rabbit mq and messaging that just works
Plone, rabbit mq and messaging that just worksPlone, rabbit mq and messaging that just works
Plone, rabbit mq and messaging that just works
 

Recently uploaded

(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 

Recently uploaded (20)

(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 

Building instant features with advanced Plone themes

  • 3. Case of the day: Wall of images – Resource bundles – Folderish content type – Custom view template for Wall of images with Masonry.js layout – Workflow for accepting anonymous submissions – Image content type for anonymous submissions – Add permission for restricting anonymous visitor submission – Content rule for thanking about submission – Review portlet for listing the pending submissions – i18n with l10n message catalog
  • 4. Python packages vs. theme? Python packages – One package for new JS – Another for new types – Customer specific theming of components in theme package – Configuring everything in policy package – Restarting Plone Advanced theme – Everything in a single zipped Plone theme package – Upload through Plone control panel or using npm package plonetheme-upload
  • 5. Plone customization features – Configurable registry – Structured content types – Content type behaviors – State based workflows – Roles and permissions – All types of portlets – Content rules on events – Restricted templates – Restricted Python scripts – Static frontend resources – Diazo transform rules – . . .
  • 6. Plone customization features – Configurable registry – Structured content types – Content type behaviors – State based workflows – Roles and permissions – All types of portlets – Content rules on events – Restricted templates – Restricted Python scripts – Static frontend resources – Diazo transform rules – . . .
  • 7. Restricted Python? ”Restricted Python provides a safety net for programmers who don’t know the details of the Zope/Plone security model. It is important that you understand that the safety net is not perfect: it is not adequate to protect your site from coding by an untrusted user.” – Steve McMahon, collectice.ambidexterity README
  • 8. Issues with Restricted Python Not only ponies and unicorns... – API is restrictedTraversed, not imported – API is not always complete – API is not always up-to-date – API is scattered around the ecosystem – plone.api is not currently designed or available by default to be called from Restricted Python
  • 9.
  • 12. Advanced Plone themes – Theme with any supported customizations – Editable using Plone theme editor – Rollbacks with Zope2 undo form – Zip-exportable and importable from theme editor – Supports ”TTW” and ”file system" development – Exports can be version controlled – Exports can be acceptance tested
  • 13. collective.themesitesetup Theme activation or update – Imports GS profile steps – Updates DX models – Registers permissions – Registers l10m messages – Copies resources into portal_resources Theme deactivation – Imports GS profile steps – Unregisters added custom permissions – Unregisters added custom l10n messages After ”TTW” development – @@export-site-setup
  • 14. collective.themefragments View templates: ./fragments/foobar.pt – Can be injected as fragments using Diazo rules – Can be configured as a default view for any content type – Can be used as a local view by setting layout attribute Python scripts: ./fragments/foobar.py – Can provide view methods for view templates with matching base name (tal:define="data view/getData")
  • 16. Let’s get our hands dirty. . .
  • 17. Creating Wall of images – Initial configuration was made through Plone site setup – Configuration was exported into a new theme using the export view ++theme++.../@@export-site-setup – Theme was zip-exported from theming control panel – Content type schemas were exported from Dexterity editor – Development was completed on a regular file system buildout using file system resources directory
  • 18. Structure of Wall of images ./bundles/ ./fragments/ ./install/types/ ./install/workflows/ ./install/ ./locales/LC_MESSAGES/*/ ./models/ ./index.html ./manifest.cfg ./preview.png ./rules.xml ./scripts.js ./styles.css
  • 19. Custom frontend bundles 1/2 ./bundles/imagesloaded.pkgd.min.css ./bundles/imagesloaded.pkgd.min.js ./bundles/masonry.pkgd.min.css ./bundles/masonry.pkgd.min.js (function() { var require, define; // ... // AMD packaged JS distributions must be wrapped // so that Plone require.js define is undefined // during their load // ... })();
  • 20. Custom frontend bundles 2/2 ./install/registry.xml <records prefix="plone.bundles/imagesloaded-js" interface="...interfaces.IBundleRegistry"> <value key="depends">plone</value> <value key="jscompilation">++theme++...js</value> <value key="csscompilation">++theme++...css</value> <value key="last_compilation">2017-10-06 00:00:00 </value> <value key="compile">False</value> <value key="enabled">True</value> </records>
  • 21. Custom content types 1/2 ./install/types/wall_of_images.xml ./install/types/wall_of_images_image.xml ./install/types.xml <object name="portal_types"> <object name="wall_of_images" meta_type="Dexterity FTI"/> <object name="wall_of_images_image" meta_type="Dexterity FTI"/> </object> ./models/wall_of_images.xml ./models/wall_of_images_image.xml
  • 22. Custom content types 2/2 <model xmlns:...="..." i18n:domain="plone"> <schema> <field name="title" type="zope.schema.TextLine"> <title i18n:translate="">Title</title> </field> <field name="image" type="plone.namedfile.field.NamedBlobImage"> <title i18n:translate="">Image</title> </field> </schema> </model>
  • 23. Custom views 1/3 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:...="..." lang="en" metal:use-macro=".../macros/master" i18n:domain="plone"> <body> <metal:main fill-slot="main"> <metal:content-core define-macro="content-core"> </metal:content-core> </metal:main> </body> </html>
  • 24. Custom views 2/3 ./fragments/wall-of-images.pt <div class="wall-of-images container-fluid" tal:define="items context/@@contentlisting"> <tal:image tal:repeat="item items"> <img tal:define="obj item/getObject; scale_func obj/@@images; scaled_image python:scale_func.scale('image', scale='preview')"→ tal:replace="structure python:scaled_image.tag()"→ tal:on-error="string:error" /> </tal:image> </div>
  • 25. Custom views 3/3 ./install/types/wall_of_images.xml ... <property name="default_view"> ++themefragment++wall-of-images</property> <property name="view_methods"> <element value="++themefragment++wall-of-images"/> </property> ... Any themefragment can be configured as content object view by manually setting layout property of the content object.
  • 26. Custom l10n messages ./locales/fi/LC_MESSAGES/plone.po ./locales/en/LC_MESSAGES/plone.po msgid "Close from submissions" msgstr "Sulje osallistuminen" msgid "Open for submissions" msgstr "Avaa osallistumiselle" When theme is developed on file system, normal i18n tools can be used for messages extraction and catalog synchronization (e.g. i18ndude).
  • 27. Custom permissions ./manifest.cfg [theme:genericsetup] permissions = demotheme.addImage Wall of Images: Add Image ./install/types/wall_of_images_image.xml <object name="wall_of_images_image" ...=".."> ... <property name="add_permission"> demotheme.addImage</property> ... </object>
  • 28. Custom workflows ./install/workflows.xml ./install/simple_publication_with_submission_workflow/ ./install/wall_of_images_workflow/ <type type_id="wall_of_images"> <bound-workflow workflow_id="..."/> </type> <dc-workflow workflow_id="..."> ... <permission>Wall of Images: Add Image</permission> ... </dc-workflow>
  • 29. Custom content rules ./install/contentrules.xml <contentrules> <rule name="rule-image-thank-you" title="Thank visitor from submission" cascading="False" description="Thanks visitor after submission" event="...IObjectAddedEvent" stop-after="False" enabled="True">...</rule> <assignment name="rule-image-thank-you" bubbles="True" enabled="True" location=""/> </contentrules>
  • 30. Final touch with Diazo-bundles ./manifest.cfg production-css = /++theme++demotheme/styles.css production-js = /++theme++demotheme/scripts.js ./scripts.js jQuery(function($) { $('.wall-of-images').imagesLoaded(function() { $('.wall-of-images').masonry({ itemSelector: 'img', percentPosition: true }); }); });
  • 32. What about Mosaic? – Theme site setup can populate Mosaic site and content layout resource directories from theme – Theme fragment tile for Plone Mosaic can render selected fragment with – fragment-specific readable title – fragment-specific XML schema based configuration form – fragment-specific view permission – fragment-specific caching rule
  • 33. What about Webpack? – Bundles in theme can be built with Webpack – Diazo bundle in theme can be built with Webpack – All frontend resources can be built with Webpack – plonetheme.webpacktemplate – plonetheme-webpack-plugin – plonetheme-upload
  • 34. Bonus: Custom JS widgets ./models/my_content_type.xml ... <field name="focuspoint" type="zope.schema.BytesLine"> <form:widget type="z3c.form.browser.text.TextFieldWidget"> <klass>text-widget pat-focuspoint-widget</klass> </form:widget> <title i18n:translate="">Image focus point</title> <required>false</required> </field> ...