[MAGNOLIA-1482] Templates stored in repository Created: 25/Apr/07  Updated: 23/May/16  Resolved: 26/Jan/09

Status: Closed
Project: Magnolia
Component/s: templating
Affects Version/s: None
Fix Version/s: 4.0

Type: New Feature Priority: Major
Reporter: Magnolia International Assignee: Magnolia International
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to MAGNOLIA-6677 Remove FTL 5sec cache in Developer mode Closed
relation
is related to MAGNOLIA-2170 Webapp should be markable as read-only Closed
is related to MAGNOLIA-2186 Provide support for freemarker (page)... Closed
is related to MAGNOLIA-2583 Provide a custom MultiTemplateLoader Closed
is related to MGNLINTEMPL-1 templates in separate workspace (free... Closed
supersession
is superseded by MGNLINTEMPL-1 templates in separate workspace (free... Closed
Template:
Acceptance criteria:
Empty
Date of First Response:

 Description   

At the moment, templates (ie. paragraph or pages) are stored on the filesystem (jsp) or the classpath (freemarker)

Having them on the repo (a specific workspace) would allow

  • activating them (no more manual files copying)
  • editing them within Magnolia

This seems pretty easy to implement for freemarker templates (implement a new freemarker.cache.TemplateLoader), with one warning though: since freemarker caches the result of its template parsing, loading the templates should probably occur in an acl-unaware way, i.e we should not try to restrict who/what can render certain templates. (of course, it's a different story for editing them through the admin interface, where we definitely want to use ACLs to determine who can view the templates source and modify them)

Doing the same thing for JSPs seems rather cumbersome (one could imagine writing the repo content to the filesystem on creation/activation of node), and I'm not sure we should encourage this.



 Comments   
Comment by Magnolia International [ 12/Sep/08 ]

one thing i'd love to see here is an import function that lets one import a template from fs OR classpath into the repo, to apply customizations as needed.

Comment by Magnolia International [ 06/Oct/08 ]

note for later: loaders like the WebappContextTemplateLoader could be wrapped in a "LazyWebappContextTemplateLoader" - so no need for checking the state of the template loaders for each call in FreemarkerHelper, and actual working observation/reloading/changing of the TLs

Comment by Jan Haderka [ 06/Oct/08 ]

How do you think it should work? There is no setServletContext() method on WebappContextTemplateLoader would it be safe to assume servlet context never changes and cache instance of the WCTL with the SC as it was when loaded first time? This might not work when server decides to temporarily increase number of instances of default servlet due to load and discard them later.

Comment by Magnolia International [ 06/Oct/08 ]

How do you think it should work? There is no setServletContext() method on WebappContextTemplateLoader

.. which is why you have a lazy wrapper, which will only instanciate the wrapped WebappContextTemplateLoader once a WebappCtx is available.

SC never "changes", afaik, you can keep that reference.

I don't see the connection with an increase of the number of servlets made by the container behind the scenes.

Comment by Jan Haderka [ 07/Oct/08 ]

You are right of course ... dunno what I was thinking.
WebappTL is now loaded via c2b as well and TLs are configured at startup (and reloaded on change).

Comment by Jan Haderka [ 08/Oct/08 ]

To summarize the security related implementation details:

  • security will be checked normally for editing the templates
  • to serve the templates (loader.findTemplate()) will use SystemContext to ensure user do not need to login to get output of rendered template. This does NOT expose the source of templates to end users!
  • we can't just assign read privileges to everybody for templates workspace by default, since due to caching of templates we can't guarantee changing permissions for given user will make template invisible to that user.
Comment by Magnolia International [ 10/Dec/08 ]

Also see MGNLINTEMPL

Comment by Magnolia International [ 20/Jan/09 ]

I might try to put in some improvements for 4.0, if not, I'll split another issue for 4.1

Comment by Magnolia International [ 26/Jan/09 ]

This is MGNLINTEMPL-1.
Also see MAGNOLIA-2583.

Generated at Mon Feb 12 03:27:20 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.