Project description

A registry for linked Stylesheet files and Javascripts.

This registry is mainly aimed at solving the following usecases:

- Enable product authors to register stylesheets with their product installers without having to resort to override either header.pt or ploneCustom.css creating potential conflicts with other products.

- Enable more componentialization of the stylesheets provided with Plone (and other products) without having to increase the number of http requests for a Plone page.

- Enable condition checking on stylesheets. Great for variable look-and-feel for groups/roles/folders/departments/content-types/etc

- Enable inline dynamic stylesheets. For those style rules that should vary for each request. Mainly used for things like header-bar- backgroundimages, department colors etc.

- Enable developers to activate/deactivate their styles in a simpler way

id -- The id mentioned above. the Zope id of the stylesheet to be used.

expression -- A CMF expression to be evaluated to check if the stylesheetshould be included in output or not.

conditionalcomment -- A small string to be included in a conditional commentaround the resource. For example, entering simply 'IE' in the field willresult in a conditional comment of: <!--[if IE]>...<![endif]--> This behavioris currently only enabled for the CSS Registry. For more information see:http://msdn.microsoft.com/en-us/library/ms537512.aspx

media -- The media for which the stylesheet should apply, normally empty or'all'. other possible values are 'screen', 'print' etc.

rel -- Link relation. defaults to 'stylesheet', and should almost alwaysstay that way. For designating alternative stylesheets.

title -- the title for alternate stylesheets

rendering -- How to link the stylesheet from the html page:

- 'import' - the default. normal css import

- 'link' - works better for old browsers and is needed for alternate stylesheets

- 'inline' - render the stylesheet inline instead of linking it externally. Shouldn't be used at all! It isn't possible to create sites which validate if you do. For more information see: http://developer.mozilla.org/en/docs/Properly_Using_CSS_and_JavaScript_in_XHTML_Documents

compression -- Whether and how much the resource should be compressed:

- 'none' - the original content will not be changed

- 'safe' - the content will be compressed in a way which should be safe for any workarounds for browser bugs. Conditional code for Internet Explorer is preserved since ResourceRegistries 1.2.3 and 1.3.1.

- 'full' - the content will be compressed with some additional rules. For css all comments and most newlines are removed, this may break special browser hacks, so use with care. For javascript this encodes variables with special prefixes according to the rules described here (Special Characters): http://dean.edwards.name/packer/usage/ The source code needs to be written according to those rules, otherwise it's more than likely that it will break.

- 'safe-encode' - only available for javascript- 'full-encode' - only available for javascript Additionally encodes keywords. This heavily compresses the javascript, but it needs to be decoded on the fly in the browser on each load. Depending on the size of the scripts this could lead to timeouts in Firefox. Use with special care!

If several stylesheets listed directly after each other in the registry havethe same parameters and expression, they will be concatenated into a larger,composite, stylesheet on rendering. - This can be useful for splittingstylesheets into smaller components for overrideing, while preservingcacheability and minimising the number of http-requests to Plone.

This tool was started at the excellent SnowSprint 2005 - Organised byTelesis in the Austrian Alps. Thanks, Jodok! :)

* Removed the uppermost Save button from the ZMI pages for registries. Clicking this button before the registry page has finished loading could lead to data loss. [dunlapm, fschulze]

* Resources beginning with "http://" or "https://" are now valid and may be included as resources. Registries will automatically disable merging, caching, compression, and inline rendering of external resources. This closes http://dev.plone.org/plone/ticket/8312 [dunlapm, fschulze]

* Added option to have a conditional comment attached to a given resource. Currently the UI only supports this behavior with the CSS and JavaScript Registries, but the underpinnings for the KSS registry is in place. This closes http://dev.plone.org/plone/ticket/5521 [dunlapm, fschulze]

* Do not try to export the `cooked_expression` into the GenericSetup profiles. It is only an internal optimization and the value is reflected in the `expression` value. [hannosch]

* Store the cooked expressions as a real persistent expression object, instead of compiling the expression on every view. [hannosch]

* Added 'context' as an alias for 'object' in action expressions. [davisagli, hannosch]

1.4.3=====

* Fixed error where non-traversable resources could be registered. This closes http://dev.plone.org/plone/ticket/8153 [dunlapm]

* Properly encode the resource id. This fixes moving of resource without JS and removing recources which contain special chars like plus signs. Fixes http://dev.plone.org/plone/ticket/7482 [fschulze]

* Revert part of r7143: returning NotFound from a API call is never the right thing to do since it makes the publisher show a object-not-found page, hiding the real error. Restore the old behaviour and raise a ValueError instead. This fixes mysterious not-found errors from GenericSetup imports. [wichert]

* Added '/' to the strings that are filtered out in BaseRegistry.generateId(). This fixes #7048. [davconvent]

1.4.0=====

* Add support for automatic grouping mode to the GenericSetup export/import code. [wichert]

1.4.0-rc1=========

* Added a new automatic grouping mode feature. It is turned off by default. When enabled the resources will first be sorted into groups with the same merging-relevant settings and after that merged. In the groups the order of the resources in the registries will be preserved. [hannosch]

* Changed the exportimport handlers to only cook the resources once at the end and not after each new resource has been added. [hannosch]

1.4.0-beta5===========

* Fixed setting of cache headers when the registry is associated with a RAMCache. [fschulze]

* For compatibility with GenericSetup conventions, the import steps now support 'insert-before' and 'insert-after' as aliases for 'position-before' and 'position-after', while 'insert-top' and 'insert-bottom' are aliases for 'position-top' and 'position-bottom', respectively. [mj]

1.3.6=====

* Invalidate cache when cooking resources if the registry is assigned to a RAMCache or similar cache manager.

* Fixed string replacement during packing when several resources got packed in different threads at once, which resulted in exchanged strings. [fschulze]

1.3.5=====

* Fixed string protection for strings which mix single and double quotes. [fschulze]

* Made packer.py usable as a standalone commandline tool. [fschulze]

* Fixed several issues in 'full' compression. [fschulze]

* Extended the GenericSetup import step to support positioning of resources: the 'position-before' and 'position-after' attributes cause the resource to be positioned before or after resource named in the attribute. 'position-top' and 'position-bottom' move a resource to the top or bottom. [mj]

1.3.4=====

* Improved IE conditional compilation protection, it now works in "full" compression. [fschulze]

* Improved regular expression for strings. [fschulze]

* Fixed order of oneline and multiline comment removal in javascript packer. [fschulze]

* Added keyword encoding for javascript. This greatly reduces the file size of javascript files, but adds a small performance hit on the client for the decoding. [fschulze]

1.2===

* Added compression for CSS and Javascript resources. [fschulze]

* Added better labels and a short explanation to the debugmode-checkbox in the forms. [elvix]

* Renamed 'TAL condition' to 'Condition' in the forms, as it has nothing to do with TAL at all (it is a CMF/TALES expression) It should include a link to CMF Expressions help [elvix]

1.1===

* Fixed cooking of resources to ensure that uncookable resources are not merged. [elro]

* Fixed tests for unauthorized to accept a 401 as an unauthorized error. [elro]

* Fixed setDebugMode to recook resources after being changed. [elro]

1.1b1=====

* Added checkbox to configure cacheability of resources. [fschulze]

* Made registries cacheable. This is most useful with the RAMCacheManager. Just associate portal_css and portal_javascripts with the RAMCache. [fschulze]

* Apply magic id to all resources when not in debug mode, so invalidation works. [fschulze]

* Made skin aware. This now depends on getCurrentSkinName added in CMF 1.5.5. [elro]

1.0.5=====

* Fixed encoding of javascripts. [fschulze]

1.0.4=====

* Fixed reordering of resources with javascript. [fschulze]

1.0.3=====

* Fixed typo in the migration external method which lead to portal_javascripts not being migrated. [fschulze]

* Small fixes to UI. [limi]

1.0.2=====

* Fix for bug #4392, where merging FSfiles could mess up http-status headers and cause weird hanging in browsers. [plonista][fschulze][elvix]

1.0.1=====

* Don't filter resources in merged overview in ZMI. [fschulze]

* Improved management UI. [limi, fschulze]

* Fixed reinstall bug due to improper resource id lookup. [alecm]

1.0===

* Moved directory with skin layer for Plone 2.0.5 compatibility to product root, so it doesn't interfere with Plone 2.1. The version check on install time didn't seem to be enough. [fschulze]

* getTitle and getMedia will return None now if they are empty, this removes empty title and media attributes from the generated HTML.

* Fixed reordering of resources in ZMI when javascript is enabled. [fschulze, jenner]

* Fixed submitting changes in ZMI for stylesheets on IE. [fschulze]

0.95====

* Added getResource function. This allows to change properties of each resource. After that, a call to cookResources is needed. [fschulze]

* Added getResourceIds function. [fschulze]

* Added test for context dependancy to inline css rendering. [dom]

* Now uses restrictedTraverse() rather than getattr() for returning resources, to provide support for resources held within the ZODB. [dom]

* Added a "is merging allowed?" option ("cookable" property) to determine where a resource can be merged (default True). This was added because objects in the ZODB may have variable permissions but be merged together. Whilst the objects are checked at each REQUEST, a new REQUEST won't actually be made each time because of the cache headers set on merged resources. If this worries you, the simplest solution is not to merge such resources, hence this option. [dom]

* Added renameResource function with tests. [fschulze]

* In Plone 2.1 plone_javascripts.js was removed, fixed tests by using jstest.js from our own skin. [dom]

0.9===

* Fixed function of enabled checkbox when adding css/javascript from ZMI. Added title field to the 'add stylesheet' part in the ZMI. [fschulze]

* Added migration script for old instances. Just create a external method with id 'migrate_resourceregistries', Module Name 'ResourceRegistries.migrate' and Function Name 'migrate' and click on the 'Test' tab. [fschulze]

* Refactored the two registries to use one common base class. [fschulze]

* Refactored moving functions, so we have more possibilities. The API reflects the IOrderedContainer one. [fschulze]

* Fix order of javascripts, the topmost in the management screen also needs to be the topmost in the resulting source. [fschulze]

* Added debugmode where scripts are not concatenated. This will let things like the javascript console point to the right line-number. And makes it easier to develop, because there is no caching of the scripts. [fschulze]

* Fixed cooking of stylesheets so that composite stylesheets get correct media settings. Thanks a lot to Denis Mishunoff[spliter] for discovery, investigation and suggested fix [elvix]

* Fixed some security declarations. [fschulze]

* Made moving of stylesheets and javascripts in ZMI possible without javascript being enabled in the browser. [fschulze]