SlideShare a Scribd company logo
Upgrading a Plone 3 Theme for
 Plone 4: Beyond the Basics
What’s changed?
Tutorial on Plone.org will get you started
Plone 4 has a new theme:
        Sunburst
Plone 4 also includes
•  Plone Classic –       •  Plone Default –
   The default Plone 3      A barebones template
   theme                    with no styling
Updates to main_template.pt
•  Defines on the html tag have been modified
•  Some new defines have been added to the
   body tag
•  Viewlet managers formerly in content area
   have been moved to main_template
•  New slot called "content-core" has been
   added for the content body
Updates to template variables
•  Many global template variables are no longer
   available
   Good news: speed!
   Bad news: you must define them to use them

  NameError: name 'templateId' is
  not defined

•  Examples: template_id, toLocalizedTime, portal,
   isAnon, member . . . many more (see docs on
   Plone.org)
Moved viewlet managers / macros
•  Document title, description,
   abovecontenttitle, belowcontenttitle,
   abovecontentbody, belowcontentbody,
   relateditems - out of content templates and
   into main
•  Keywords in belowcontent, not in
   belowcontenttitle
•  Contenthistory a link in documentbyline, not
   in belowcontentbody
Review all your custom templates
  to see whether your theme is
             affected
Update the “based-on” declarations
     in Generic Setup profiles
•  Skin paths (skins.xml) and viewlet managers
   (viewlets.xml) should be based on “Plone
   Classic Theme” instead of “Plone Default”

 <order manager="plone.portaltop"
 skinname="UCLA Default Theme" based-
 on="Plone Classic Theme">
Update the theme specific interface
•  Subclass the interface from Plone Classic
   Theme (not IDefaultPloneLayer) in browser/
   interfaces.py

from plonetheme.classic.browser.interfaces
  import IThemeSpecific as IClassicTheme

class IThemeSpecific(IClassicTheme):
      """theme-specific layer"""
But, but …
•  What if I want my theme to be compatible
   with Plone 3 and Plone 4?
•  Why are my viewlets showing up all over?
•  What’s with the personal bar?
•  How do I deal with the new visual editor,
   TinyMCE?
•  Where are the CSS selectors I was using?
•  My overlays are whack!
Preserving Plone 3 compatibility
•  Add a dependency on plonetheme.classic – so
   imports don’t fail in your Plone 3 sites
•  In setup.py:
    install_requires=[
          'setuptools',
          # -*- Extra requirements: -*-
          'plonetheme.classic',
    ],
Plone 3 compatibility (cont.)
•  In configure.zcml:
  <includeDependencies package="." />


•  In profiles/default/metadata.xml:
  <dependencies>
    <dependency>profile-
  plonetheme.classic:default</dependency>
  </dependencies>
Viewlet changes
•  plone.personal_bar – in plone.portalheader
   instead of plone.portaltop
•  plone.site_actions – in plone.portalfooter
   instead of plone.portalheader
•  plone.path_bar – in plone.abovecontent
   instead of plone.portaltop
•  plone.abovecontent viewlet manager comes
   before plone.contentviews
Controlling viewlets
•  Use viewlets.xml to hide duplicate viewlets
•  Show them again on uninstall
•  Use conditional zcml to register viewlets as
   needed for Plone 3 or Plone 4
Conditional ZCML Example
<!-- Plone 3 condition check-->
<configure zcml:condition="not-installed plone.app.upgrade">
   <browser:viewlet
      name="plone.personal_bar”
      manager="plone.app.layout.viewlets.interfaces.IPortalTop"
      . . . />
</configure>
<!-- Plone 4 condition check-->
<configure zcml:condition="installed plone.app.upgrade">
  <browser:viewlet
      name="plone.personal_bar”
      manager="plone.app.layout.viewlets.interfaces.IPortalHeader"
      . . . />
</configure>
Adjust to the personal bar in Plone 4
•  Has the .actionMenu class – dropdown
   behavior and green styles
•  Is structured as definition list (dl) rather than
   unordered list (ul)
•  May need to write new styles, to:
   Render the options inline (old-fashioned way)
   Coordinate with your site design (avoid the
    green)
•  Includes Site Setup link – hurray!
TinyMCE in addition to Kupu
•  May need to define new styles for TinyMCE
   editor
•  Kupu had:
   .kupu-html body
•  TinyMCE has:
   body.mceContentBody
CSS changes
•  .documentContent and #region-content are
   gone – use #content, #content-core, or other
   selectors
•  .documentEditable comes later, after
   abovecontent viewlet and status messages
•  #content ul and #content li a override styles
   for .configlets – use #content ul.configlets
   and #content ul.configlets li a
Styling overlays
•  Target .pb-ajax and its children
Questions?

More Related Content

PPT
Architecture of Drupal - Drupal Camp
ODP
Custom module and theme development in Drupal7
KEY
Theme guru's (Moodle 2 Edition)
PDF
TYPO3 best practice - showing a useful TYPO3 backend
ODP
Drupal 7 install with modules and themes
PPT
Introduction to Cakephp
PDF
Introduction to CakePHP
PPTX
Drupal Theme Development
Architecture of Drupal - Drupal Camp
Custom module and theme development in Drupal7
Theme guru's (Moodle 2 Edition)
TYPO3 best practice - showing a useful TYPO3 backend
Drupal 7 install with modules and themes
Introduction to Cakephp
Introduction to CakePHP
Drupal Theme Development

What's hot (20)

KEY
Doing Things the WordPress Way
PDF
I use drupal / 我是 OO 師,我用 Drupal
PDF
Drupal 7 Theme System
PPT
Fronteers - Drupal 7 ux
PPTX
WordPress Structure and Best Practices
PDF
MuleSoft ESB Shared Library
PPT
Introduction to Module Development (Drupal 7)
PDF
Your first d8 module
PPTX
Debugging in drupal 8
PDF
Installing AtoM with Ansible
PDF
Brisbane Drupal meetup - 2016 Mar - Build module in Drupal 8
PDF
How To Write Your First Firefox Extension
PDF
Plone Theming in a Nutshell
PDF
Intro to TAL
PDF
Introduction to Drupal (7) Theming
PPTX
DrupalTour Lviv — Theming in Drupal8 (Ivan Tibezh, InternetDevels)
PDF
How to Get Started Theming Plone
PPT
Local Drupal MultiSite Set-up
PDF
Word press templates
PPT
PSD to a Drupal Theme (using a base theme)
Doing Things the WordPress Way
I use drupal / 我是 OO 師,我用 Drupal
Drupal 7 Theme System
Fronteers - Drupal 7 ux
WordPress Structure and Best Practices
MuleSoft ESB Shared Library
Introduction to Module Development (Drupal 7)
Your first d8 module
Debugging in drupal 8
Installing AtoM with Ansible
Brisbane Drupal meetup - 2016 Mar - Build module in Drupal 8
How To Write Your First Firefox Extension
Plone Theming in a Nutshell
Intro to TAL
Introduction to Drupal (7) Theming
DrupalTour Lviv — Theming in Drupal8 (Ivan Tibezh, InternetDevels)
How to Get Started Theming Plone
Local Drupal MultiSite Set-up
Word press templates
PSD to a Drupal Theme (using a base theme)
Ad

Viewers also liked (7)

KEY
Jumpstart Your Development with ZopeSkel
PDF
OOTB Presentation
ODP
Troubleshooting Plone
PDF
Melhores Práticas para o Desenvolvimento com Plone 4
PDF
How not to develop with Plone
PDF
Building Content Types with Dexterity
PDF
Leveraging Plone for Search Engine Optimization (SEO)
Jumpstart Your Development with ZopeSkel
OOTB Presentation
Troubleshooting Plone
Melhores Práticas para o Desenvolvimento com Plone 4
How not to develop with Plone
Building Content Types with Dexterity
Leveraging Plone for Search Engine Optimization (SEO)
Ad

Similar to Upgrading a Plone 3 Theme for Plone 4: Beyond the Basics (20)

PDF
David Convent - Theme It Yourself
PPT
New in Plone 3.3. What to expect from Plone 4
ODP
Plone for python programmers
PDF
PloneNG: What's new in Plone 4.2, 4.3, and beyond
PPTX
Pragmatic plone projects
PPTX
Pragmatische Plone Projekte
PDF
Frequently asked questions answered frequently - but now for the last time
PPT
Simplifying Plone
PPT
Contextual Tour of Plone - (a top open source web content management system)
ODP
Introduction to Plone (PyCon Ireland 2010)
PDF
vienna.info: Realising the official Viennese tourism website with Plone.
PDF
Pimp my Plone
ODP
Plone Intranet under the hood
PDF
Plone Futures
PDF
Plone Futures, Plone Conference 2016 Keynote by Eric Steele
PDF
Plone 5 theming unleashed
PDF
Plone 5 theming
PDF
Plone 5 theming
KEY
What's new in Plone 4
PDF
Plone Conference 2010 – Where we go from here
David Convent - Theme It Yourself
New in Plone 3.3. What to expect from Plone 4
Plone for python programmers
PloneNG: What's new in Plone 4.2, 4.3, and beyond
Pragmatic plone projects
Pragmatische Plone Projekte
Frequently asked questions answered frequently - but now for the last time
Simplifying Plone
Contextual Tour of Plone - (a top open source web content management system)
Introduction to Plone (PyCon Ireland 2010)
vienna.info: Realising the official Viennese tourism website with Plone.
Pimp my Plone
Plone Intranet under the hood
Plone Futures
Plone Futures, Plone Conference 2016 Keynote by Eric Steele
Plone 5 theming unleashed
Plone 5 theming
Plone 5 theming
What's new in Plone 4
Plone Conference 2010 – Where we go from here

Recently uploaded (20)

PPTX
Big Data Technologies - Introduction.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPT
Teaching material agriculture food technology
Big Data Technologies - Introduction.pptx
sap open course for s4hana steps from ECC to s4
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Understanding_Digital_Forensics_Presentation.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Chapter 3 Spatial Domain Image Processing.pdf
Encapsulation theory and applications.pdf
Network Security Unit 5.pdf for BCA BBA.
Programs and apps: productivity, graphics, security and other tools
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Per capita expenditure prediction using model stacking based on satellite ima...
Teaching material agriculture food technology

Upgrading a Plone 3 Theme for Plone 4: Beyond the Basics

  • 1. Upgrading a Plone 3 Theme for Plone 4: Beyond the Basics
  • 3. Tutorial on Plone.org will get you started
  • 4. Plone 4 has a new theme: Sunburst
  • 5. Plone 4 also includes •  Plone Classic – •  Plone Default – The default Plone 3 A barebones template theme with no styling
  • 6. Updates to main_template.pt •  Defines on the html tag have been modified •  Some new defines have been added to the body tag •  Viewlet managers formerly in content area have been moved to main_template •  New slot called "content-core" has been added for the content body
  • 7. Updates to template variables •  Many global template variables are no longer available  Good news: speed!  Bad news: you must define them to use them NameError: name 'templateId' is not defined •  Examples: template_id, toLocalizedTime, portal, isAnon, member . . . many more (see docs on Plone.org)
  • 8. Moved viewlet managers / macros •  Document title, description, abovecontenttitle, belowcontenttitle, abovecontentbody, belowcontentbody, relateditems - out of content templates and into main •  Keywords in belowcontent, not in belowcontenttitle •  Contenthistory a link in documentbyline, not in belowcontentbody
  • 9. Review all your custom templates to see whether your theme is affected
  • 10. Update the “based-on” declarations in Generic Setup profiles •  Skin paths (skins.xml) and viewlet managers (viewlets.xml) should be based on “Plone Classic Theme” instead of “Plone Default” <order manager="plone.portaltop" skinname="UCLA Default Theme" based- on="Plone Classic Theme">
  • 11. Update the theme specific interface •  Subclass the interface from Plone Classic Theme (not IDefaultPloneLayer) in browser/ interfaces.py from plonetheme.classic.browser.interfaces import IThemeSpecific as IClassicTheme class IThemeSpecific(IClassicTheme): """theme-specific layer"""
  • 12. But, but … •  What if I want my theme to be compatible with Plone 3 and Plone 4? •  Why are my viewlets showing up all over? •  What’s with the personal bar? •  How do I deal with the new visual editor, TinyMCE? •  Where are the CSS selectors I was using? •  My overlays are whack!
  • 13. Preserving Plone 3 compatibility •  Add a dependency on plonetheme.classic – so imports don’t fail in your Plone 3 sites •  In setup.py: install_requires=[ 'setuptools', # -*- Extra requirements: -*- 'plonetheme.classic', ],
  • 14. Plone 3 compatibility (cont.) •  In configure.zcml: <includeDependencies package="." /> •  In profiles/default/metadata.xml: <dependencies> <dependency>profile- plonetheme.classic:default</dependency> </dependencies>
  • 15. Viewlet changes •  plone.personal_bar – in plone.portalheader instead of plone.portaltop •  plone.site_actions – in plone.portalfooter instead of plone.portalheader •  plone.path_bar – in plone.abovecontent instead of plone.portaltop •  plone.abovecontent viewlet manager comes before plone.contentviews
  • 16. Controlling viewlets •  Use viewlets.xml to hide duplicate viewlets •  Show them again on uninstall •  Use conditional zcml to register viewlets as needed for Plone 3 or Plone 4
  • 17. Conditional ZCML Example <!-- Plone 3 condition check--> <configure zcml:condition="not-installed plone.app.upgrade"> <browser:viewlet name="plone.personal_bar” manager="plone.app.layout.viewlets.interfaces.IPortalTop" . . . /> </configure> <!-- Plone 4 condition check--> <configure zcml:condition="installed plone.app.upgrade"> <browser:viewlet name="plone.personal_bar” manager="plone.app.layout.viewlets.interfaces.IPortalHeader" . . . /> </configure>
  • 18. Adjust to the personal bar in Plone 4 •  Has the .actionMenu class – dropdown behavior and green styles •  Is structured as definition list (dl) rather than unordered list (ul) •  May need to write new styles, to:  Render the options inline (old-fashioned way)  Coordinate with your site design (avoid the green) •  Includes Site Setup link – hurray!
  • 19. TinyMCE in addition to Kupu •  May need to define new styles for TinyMCE editor •  Kupu had: .kupu-html body •  TinyMCE has: body.mceContentBody
  • 20. CSS changes •  .documentContent and #region-content are gone – use #content, #content-core, or other selectors •  .documentEditable comes later, after abovecontent viewlet and status messages •  #content ul and #content li a override styles for .configlets – use #content ul.configlets and #content ul.configlets li a
  • 21. Styling overlays •  Target .pb-ajax and its children