Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Replaced broken status macro

Rate Macrostatus

Devstatus
Statusinprogress

...

Target4.5

...

Introduces new templating in preparation for Magnolia 5.0. Implementation tracked

...

in SCRUM@jira.

Status
Table of Contents

Goals

  • improve the templating to make it more intuitive
  • prepare the new page editing
  • align JSP and FreeMarker templating
  • provide maximum possible backward compatibility

...

Type

Description

Structure

Context

list

  • collection of components
  • creates an area node which contains the components nodes
  • minimal and maximal number of components can be set
  • the area bar has an "add component" button
Code Block

page (mgnl:page)
  - main (mgnl:area)
    - component[0]
    - component[1]
    - component[2]
  • content: area node
  • components: list of components

single

  • an area which holds one and only one single paragraph
  • creates one single node which is the paragraph's node
    • no container node like for lists
  • optional single areas
    • allows the explicit creation and deletion of the paragraph
  • the area bar is the edit bar
    • the edit bar is not going to be rendered
Code Block

page (mgnl:page)
  - stage (mgnl:area)
    - title
    - component (mgnl:component)
      - title
  • content: area node
  • component: the component node

no-component

  • areas where no component can be added
  • examples: navigation, bread crumbs, ..
Code Block

page (mgnl:page)
  - navigation (mgnl:area)
    - levels
  • content: area node

...

Common attributes for passing the content to use

Attribute

Description

Default Value

content

a Node or ContentMap

 

workspace

the workspace used if the uuid or path is defind

same as of the current content

uuid

 

 

path

the path in the workspace

 

...

  • type list: replacement of the iterator tag and new bar
  • type single: combines the new and edit bar

Attribute

Description

Default Value

name

the area name, will work on def.areas[MAGNOLIA5:name ]

 

area

an area definition object

 

components

list of available components

by area definition

script

 

by area definition

placeholderScript

 

null, by area definition

type

list or single

list, by area definition

dialog

 

null, by area definition

inherit

 

false

Context

In addition to the 'normal' context objects the followings objects are provided

...

  • Renders a component
  • Similar to the former includeTemplate
  • Needs an existing node

Attribute

Description

Default Value

editable

if any editing elements should be shown. mainly useful if content is inherited

cmsfn.isFromCurrentPage()

template

name of the template definition to use

the template defined on the node

...

  • Renders an edit bar (or button)
  • Requires a node (is not a new bar)
  • Can edit any node (for instance data module content)

Attribute

Description

Default Value

dialog

name of the edit dialog

 

format

button or bar

bar

Code Block
html
html
[@cms.edit content=contact dialog="data/contact"/]

...

  • former attribute tag used for cms:render
  • ctx.name
  • attributes are removed after the rendering
    • former values are restored
Code Block

[#assign counter = counter +1]

[@cms.render] content=child]
    [@cms.context name="counter" value=counter/]
[/@cms.render]


# in the paragraph script
${ctx.counter}

...

  • Freemarker: cms context object provides functions
  • JSP: static class delegating to the context object
    • standard prefix cmsfn

Function

Description

asJCRNode(content)

to allow calls to the jcr API

asContent(node)

 

parent(content, [MAGNOLIA5:type])

if the type is passed the first matching ancestor is returned

children(content, [MAGNOLIA5:type])

 

uuid(content)

 

wrap(content)

add wrappers used in the renderer

link(content)

 

edit(content, propertyName)

adds editor markup attributes

decode(text)

decode content if the text is plain HTML code

....

 

Utils

  • other function libraries can be added
    • like cmsutil.*
  • cmsfn.* should just provide the essential functions

...

  • render the edit bars as before (where the cms:edit tag is)
  • new bar -> render them as before (no autocreation of areas)
  • no area bars

Inline (Magnolia 5)

  • annotated tags can be edited inline

    Code Block
    html
    html
    <h2 ${cmsfn.edit(content, "title"}>${content.title}</h2>
    

...