Package: redturtle.subsites
ContentsIntroductionBefore installingWhat is a subsite ?You really need a subsite?Subsite sometimes is only matter of themeCreate a subsite Plone themeA full example availableThe theme’s interfaceOther theme’s componentsLogo viewletMark a Plone Folder as a SubsiteApply the theme (AKA get a Subsite)RequestHeaderDifferent domain (or subdomain) how-toSubsite inside a subpath how-toAdditional productsDependenciesTODOCreditsAuthorsChangelog2.1.0 (2014-10-10)2.0.0 (2011-07-29)1.0.3 (2009-01-28)1.0.2 (2008-12-11)1.0.1 (2008-12-05)1.0.0 (2008-11-18)IntroductionThis subsite product add to Plone some minimalisticsubsitefeature.Before installingThis product try to perform the task adding minimal code to Plone but also need that part of the work
will be done by other software, in that caseApache.So, if you are looking for a complete and self-contained subsite product for Plone, let try other products (likeLineage) before this.What is a subsite ?In this documenta subsite is a section of your Plone sitethat:need (commonly) a different theme appliedthe visitor surf the subsite accessing something likedomain.com/subsite,subsite.comorsubdomain.domain.comthe visitor can be not aware that he’s visiting a subsection of a bigger sitesite contributors (commonly) access the site through aback-end.domain.comdomainsite contributors (can) see a different Plone themesite contributors (commonly) see the whole site, not only the subsite (as far as they use the back-end URL)Note that this approach is not limited to a single subsite, but you can have more than once. All subsites are
edited using aback-end URL, then visited using somefront-end URLsNote also that you can continue having front-end contributors, but they are limited to the subsite when move
in and out of folders, using TinyMCE, and so on. Again, they could not know that are inside Plone subsite.You really need a subsite?If youdont’need a Plone site where…you can create an internal link to a content inside another subsiteyou can create a collection that take contents from more that a subsitewhen you use the site search, you want to find also documents outside the subsite…probably youdon’t need a subsitebut simply need a Zope instance with multiple Plone site inside it!But if one of the behavior above are true, keep reading.Subsite sometimes is only matter of themeIf the concept of subsite inside your organization don’t require “isolation” (of navigation, of breadcrumb,
portal tabs, TinyMCE use, …) probably you only need the Apache + Plone magic described there, not this
(or other) subsite product.Create a subsite Plone themeAs already noted, this product will do pretty much anything without Apache in front of Plone, and you’ll need
to customize your Apache rewrite rules.All is based on some behavior already inside Plone, like the power to apply a Plone theme adding an HTTP header
that Plone will handle in a special way.Also you will play no more with the Plone “Default theme” option under the “Theme settings” site setup section,
or simply you will use this option only for the back-end theme.A full example availableWe also provide a fullPlone subsite example theme, that use all that follow.The theme’s interfaceYou need to create (or customize) the Plone theme that you want to apply to the subsite. Pleasenotethat
even if you don’t plan to see a different theme for the front-end, you still need to create an empty theme.Commonly this theme must be installed in your Plone site, but it must not register himself as Plone default theme
(so don’t use thedefault_skin=xxxattribute in your skins.xml Generic Setup file).The only important part of the theme is the interface declaration.
Commonly Plone themes have a file likeplone_theme.mysite/plone_theme/mysite/browser/interfaces.py.The file looks like this:fromplone.theme.interfacesimportIDefaultPloneLayerclassIThemeSpecific(IDefaultPloneLayer):"""Marker interface that defines a Zope 3 browser layer.
    """You need to change the interface as follow:fromredturtle.subsites.frontend.browserimportIFrontendLayerclassIThemeSpecific(IFrontendLayer):"""Marker interface that defines a Zope 3 browser layer.
    """See alsohttps://github.com/RedTurtle/example.rtsubsites_theme/blob/master/example/rtsubsites_theme/browser/interfaces.pyOther theme’s componentsAfter previous step you can continue adding element (JavaScript files, CSS, images, templates) normally. If you
don’t need that the new theme doesn’t looks like the default site theme, you theme is already finished.Logo viewletThe logo viewlet provided with the product is customized, to take always the default logo from the subsite URL.If you need to customize the logo viewlet in your theme, please think about extend the redturtle.subsites ones:fromProducts.Five.browser.pagetemplatefileimportViewPageTemplateFilefromredturtle.subsites.frontend.viewlets.logoimportLogoViewletasBaseLogoViewletclassLogoViewlet(BaseLogoViewlet):# do something hereSee alsohttps://github.com/RedTurtle/example.rtsubsites_theme/blob/master/example/rtsubsites_theme/browser/logo.pyRemember: you need to perform this task only if you need to customize the logo viewlet.Mark a Plone Folder as a SubsiteThe first and only Plone task for obtain a subsite is to choose a Folder that must be the subsite.Go to the folder through ZMI and apply a new additional marker interface.
From the “Interfaces” tab find theredturtle.subsites.backend.interfaces.ISubsiteRootfrom the
“Available Marker Interfaces” section and add it.You can remove the marker from this same page.Apply the theme (AKA get a Subsite)We will show now what to add to your Apache configuration and transform all this in the subsite environment
we need.RequestHeaderStarting from redturtle.subsites 2.1 whay our need is simple aRequestHeaderadditional configuration.Note that this only works if therequest_varnameofportal_skinstool will be changed fromplone_skintoHTTP_PLONE_SKIN. You can do this manually from ZMI (REQUEST variable namefield) or through Generic Setup
(seehttps://github.com/RedTurtle/example.rtsubsites_theme/blob/master/example/rtsubsites_theme/profiles/default/skins.xml).You need to write something like this:RequestHeader append plone_skin "The name of the Theme"Different domain (or subdomain) how-toWhen your subsite domain is something likesubsite.com(orsubdomain.mycompany.com) the configuration is quite
simple. You will provide to your Apache asubsite.com.conffile with something like this inside:<VirtualHost host:80>
    ServerName subsite.com
    ServerAlias www.subsite.com
    ServerAdmin ...

    ...

    RewriteEngine On

    RequestHeader append plone_skin "The name of the Theme"

    RewriteRule ^/(.*) \
    "http://127.0.0.1:8080/VirtualHostBase/http/%{SERVER_NAME}:80/Plone/VirtualHostRoot/subsite/$1" [L,P]
    ProxyPassReverse / http://127.0.0.1:8080/

    ...

</VirtualHost>Subsite inside a subpath how-toIf you already have a Plone site at mycompany.com, and visitinghttp://mycompany.com/subsiteyou need a subsite,
the configuration is complex because you need to handle both in the same.conffile:<VirtualHost host:80>
    ServerName mycompany.com
    ServerAlias www.mycompany.com
    ServerAdmin ...

    ...

    RewriteEngine On

    SetEnvIf Request_URI "^/subsite(.*)" SUBSITE
    RequestHeader append plone_skin "The name of the Theme" env=SUBSITE

    RewriteRule ^/(.*) \
    "http://127.0.0.1:8080/VirtualHostBase/http/%{SERVER_NAME}:80/Plone/VirtualHostRoot/$1" [L,P]
    ProxyPassReverse / http://127.0.0.1:8080/

    ...

</VirtualHost>Additional productsIf you like also to manage portal tab of your subsites in a different way that isn’t the standard Plone
behavior, take a look atcollective.navroottabs. With this you will be able also to customize different
portal tabs for your subsites.DependenciesTested on Plone 4.3.TODOAs we removedp4a.subtyper, the subsite marker can only be given through ZMI access. This will probably
change in the future.CreditsDeveloped with the support ofRete Civica Mo-Net - Comune di Modena;
Rete Civica Mo-Net supports thePloneGov initiative.AuthorsThis product was developed by RedTurtle Technology team.Changelog2.1.0 (2014-10-10)Removed old deprecated code [keul]Added skinswitcher, now handle skin switch in Plone and not Apache.
This will fix issue with Plone 4.1.5 and up [keul]Added MANIFEST file [keul]2.0.0 (2011-07-29)First public releasePlone 4 (maybe also 3.3 but not 3.2 or lower for sure) compatibility [keul]z3c.autoincude support [keul]Bye bye p4a.subtyper [keul]Changed logo viewlet: Plone 3.3 and above already refer to INavigationRoot [keul]Removed the getNavigationRoot patch, as ticket #8787 has been closed [keul]Now also JavaScript registry refer to subsite root, this fix JavaScript errors in the
frontend [keul]1.0.3 (2009-01-28)The traversal adapter was raising a lot of conflict error because all of the requests
were trying to apply the INavigationRoot on the subsite [keul]1.0.2 (2008-12-11)Applied a monkey patch for fixing a bug in the getNavigationRoot method of plone.
Seehttps://dev.plone.org/plone/ticket/8787[keul]1.0.1 (2008-12-05)Added support to browser layer CSS [amleczko]1.0.0 (2008-11-18)Initial release