diff options
Diffstat (limited to 'fedoratheme/kindofblue/browser')
-rw-r--r-- | fedoratheme/kindofblue/browser/__init__.py | 1 | ||||
-rw-r--r-- | fedoratheme/kindofblue/browser/configure.zcml | 53 | ||||
-rw-r--r-- | fedoratheme/kindofblue/browser/images/README.txt | 56 | ||||
-rw-r--r-- | fedoratheme/kindofblue/browser/interfaces.py | 8 | ||||
-rw-r--r-- | fedoratheme/kindofblue/browser/stylesheets/README.txt | 61 | ||||
-rw-r--r-- | fedoratheme/kindofblue/browser/stylesheets/main.css | 2 | ||||
-rw-r--r-- | fedoratheme/kindofblue/browser/viewlet.pt | 1 | ||||
-rw-r--r-- | fedoratheme/kindofblue/browser/viewlets.py | 21 |
8 files changed, 203 insertions, 0 deletions
diff --git a/fedoratheme/kindofblue/browser/__init__.py b/fedoratheme/kindofblue/browser/__init__.py new file mode 100644 index 0000000..792d600 --- /dev/null +++ b/fedoratheme/kindofblue/browser/__init__.py @@ -0,0 +1 @@ +# diff --git a/fedoratheme/kindofblue/browser/configure.zcml b/fedoratheme/kindofblue/browser/configure.zcml new file mode 100644 index 0000000..acb6fce --- /dev/null +++ b/fedoratheme/kindofblue/browser/configure.zcml @@ -0,0 +1,53 @@ +<configure + xmlns="http://namespaces.zope.org/zope" + xmlns:browser="http://namespaces.zope.org/browser" + i18n_domain="fedoratheme.kindofblue"> + + <!-- 'kindofblue' Zope 3 browser layer + Register views, viewlets and resources for this layer to make sure + they only apply to the 'kindofblue' theme. + You can also use this layer to override default Plone browser views + and viewlets only within the 'kindofblue' theme. + --> + <interface + interface=".interfaces.IThemeSpecific" + type="zope.publisher.interfaces.browser.IBrowserSkinType" + name="kindofblue" + /> + + <!-- Viewlets registration --> +<!-- EXAMPLE (UNCOMMENT TO MAKE AVAILABLE): + <browser:viewlet + name="fedoratheme.someviewlet" + manager="plone.app.layout.viewlets.interfaces.IPortalFooter" + class=".viewlets.SomeViewlet" + layer=".interfaces.IThemeSpecific" + permission="zope2.View" + /> +--> + + <!-- Zope 3 browser resources --> + + <!-- Resource directory for images + See fedoratheme/kindofblue/browser/images/README.txt + for more information about registering images as Zope 3 browser + resources. + --> + <browser:resourceDirectory + name="fedoratheme.kindofblue.images" + directory="images" + layer=".interfaces.IThemeSpecific" + /> + + <!-- Resource directory for stylesheets + See fedoratheme/kindofblue/browser/stylesheets/README.txt + for more information about registering stylesheets as Zope 3 browser + resources. + --> + <browser:resourceDirectory + name="fedoratheme.kindofblue.stylesheets" + directory="stylesheets" + layer=".interfaces.IThemeSpecific" + /> + +</configure> diff --git a/fedoratheme/kindofblue/browser/images/README.txt b/fedoratheme/kindofblue/browser/images/README.txt new file mode 100644 index 0000000..c673c50 --- /dev/null +++ b/fedoratheme/kindofblue/browser/images/README.txt @@ -0,0 +1,56 @@ +README for the 'browser/images/' directory +========================================== + +This folder is a Zope 3 Resource Directory acting as a repository for images. + +Its declaration is located in 'browser/configure.zcml': + + <!-- Resource directory for images --> + <browser:resourceDirectory + name="fedoratheme.kindofblue.images" + directory="images" + layer=".interfaces.IThemeSpecific" + /> + +An image placed in this directory (e.g. 'logo.png') can be accessed from +this relative URL: + + "++resource++fedoratheme.kindofblue.images/logo.png" + +Note that it might be better to register each of these resources separately if +you want them to be overridable from zcml directives. + +The only way to override a resource in a resource directory is to override the +entire directory (all elements have to be copied over). + +A Zope 3 browser resource declared like this in 'browser/configure.zcml': + + <browser:resource + name="logo.png" + file="images/logo.png" + layer=".interfaces.IThemeSpecific" + /> + +can be accessed from this relative URL: + + "++resource++logo.png" + +Notes +----- + +* Whatever the way they are declared (in bulk inside a resource directory or + as separate resources), images registered as Zope 3 browser resources don't + have all the attributes that Zope 2 image objects have (i.e. the 'title' + property and the 'tag()' and 'get_size()' methods). + This means that if you want the html tag of your image to be auto-generated + (this is the case by default for the portal logo), you should store it in a + directory that is located in the 'skins/' folder of your package, registered + as a File System Directory View in the 'portal_skins' tool, and added to the + layers of your skin. + +* Customizing/overriding images that are originally accessed from the + 'portal_skins' tool (e.g. Plone default logo and icons) can be done inside + that tool only. There is no known way to do it with Zope 3 browser + resources. + Vice versa, there is no known (easy) way to override a Zope 3 browser + resource from a skin layer in 'portal_skins'. diff --git a/fedoratheme/kindofblue/browser/interfaces.py b/fedoratheme/kindofblue/browser/interfaces.py new file mode 100644 index 0000000..21c5af5 --- /dev/null +++ b/fedoratheme/kindofblue/browser/interfaces.py @@ -0,0 +1,8 @@ +from plone.theme.interfaces import IDefaultPloneLayer + +class IThemeSpecific(IDefaultPloneLayer): + """Marker interface that defines a Zope 3 browser layer. + If you need to register a viewlet only for the + "kindofblue" theme, this interface must be its layer + (in kindofblue/viewlets/configure.zcml). + """ diff --git a/fedoratheme/kindofblue/browser/stylesheets/README.txt b/fedoratheme/kindofblue/browser/stylesheets/README.txt new file mode 100644 index 0000000..4bfb295 --- /dev/null +++ b/fedoratheme/kindofblue/browser/stylesheets/README.txt @@ -0,0 +1,61 @@ +README for the 'browser/stylesheets/' directory +=============================================== + +This folder is a Zope 3 Resource Directory acting as a repository for +stylesheets. + +Its declaration is located in 'browser/configure.zcml': + + <!-- Resource directory for stylesheets --> + <browser:resourceDirectory + name="fedoratheme.kindofblue.stylesheets" + directory="stylesheets" + layer=".interfaces.IThemeSpecific" + /> + +A stylesheet placed in this directory (e.g. 'main.css') can be accessed from +this relative URL: + + "++resource++fedoratheme.kindofblue.stylesheets/main.css" + +Note that it might be better to register each of these resources separately if +you want them to be overridable from zcml directives. + +The only way to override a resource in a resource directory is to override the +entire directory (all elements have to be copied over). + +A Zope 3 browser resource declared like this in 'browser/configure.zcml': + + <browser:resource + name="main.css" + file="stylesheets/main.css" + layer=".interfaces.IThemeSpecific" + /> + +can be accessed from this relative URL: + + "++resource++main.css" + +Notes +----- + +* Stylesheets registered as Zope 3 resources might be flagged as not found in + the 'portal_css' tool if the layer they are registered for doesn't match the + default skin set in 'portal_skins'. + This can be confusing but it must be considered as a minor bug in the CSS + registry instead of a lack in the way Zope 3 resources are handled in + Zope 2. + +* There might be a way to interpret DTML from a Zope 3 resource view. + Although, if you need to use DTML for setting values in a stylesheet (the + same way as in default Plone stylesheets where values are read from + 'base_properties'), it is much easier to store it in a directory that is + located in the 'skins/' folder of your package, registered as a File System + Directory View in the 'portal_skins' tool, and added to the layers of your + skin. + +* Customizing/overriding stylesheets that are originally accessed from the + 'portal_skins' tool (e.g. Plone default stylesheets) can be done inside that + tool only. There is no known way to do it with Zope 3 browser resources. + Vice versa, there is no known way to override a Zope 3 browser resource from + a skin layer in 'portal_skins'. diff --git a/fedoratheme/kindofblue/browser/stylesheets/main.css b/fedoratheme/kindofblue/browser/stylesheets/main.css new file mode 100644 index 0000000..b287a75 --- /dev/null +++ b/fedoratheme/kindofblue/browser/stylesheets/main.css @@ -0,0 +1,2 @@ +/* Stylesheet for the 'kindofblue' Plone theme */ + diff --git a/fedoratheme/kindofblue/browser/viewlet.pt b/fedoratheme/kindofblue/browser/viewlet.pt new file mode 100644 index 0000000..6d37130 --- /dev/null +++ b/fedoratheme/kindofblue/browser/viewlet.pt @@ -0,0 +1 @@ +<div tal:content="view/computed_value"/> diff --git a/fedoratheme/kindofblue/browser/viewlets.py b/fedoratheme/kindofblue/browser/viewlets.py new file mode 100644 index 0000000..1524333 --- /dev/null +++ b/fedoratheme/kindofblue/browser/viewlets.py @@ -0,0 +1,21 @@ +from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile +from plone.app.layout.viewlets.common import ViewletBase + +# Sample code for a basic viewlet (In order to use it, you'll have to): +# - Un-comment the following useable piece of code (viewlet python class). +# - Rename the vielwet template file ('browser/viewlet.pt') and edit the +# following python code accordingly. +# - Edit the class and template to make them suit your needs. +# - Make sure your viewlet is correctly registered in 'browser/configure.zcml'. +# - If you need it to appear in a specific order inside its viewlet manager, +# edit 'profiles/default/viewlets.xml' accordingly. +# - Restart Zope. +# - If you edited any file in 'profiles/default/', reinstall your package. +# - Once you're happy with your viewlet implementation, remove any related +# (unwanted) inline documentation ;-p + +#class MyViewlet(ViewletBase): +# render = ViewPageTemplateFile('viewlet.pt') +# +# def update(self): +# self.computed_value = 'any output' |