| Author |
Message |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 20/09/2010 17:42:22
|
GrahamButcher
User
![[Avatar]](/forum/images/avatar/43ec517d68b6edd3015b3edc9a11367b.jpg)
Joined: 26/08/2010 15:32:13
Messages: 23
Offline
|
Thought this might be of use to others and save them a lot of time hunting around for ages.
Two pages of commonly required functionality in Velocity, JSP, and java tag library.
Feel free to show me a better way as I'm new at this
| Filename |
UsefulInfoglueObjectsValuesFunctionality.pdf |
Download
|
| Description |
Some Useful code snipets |
| Filesize |
8 Kbytes
|
| Downloaded: |
217 time(s) |
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 24/09/2010 11:34:07
|
jaric
Admin
![[Avatar]](/forum/images/avatar/eccbc87e4b5ce2fe28308fd9f2a7baf3.jpg)
Joined: 02/11/2009 10:09:03
Messages: 107
Location: Uppsala
Offline
|
Great work, GrahamButcher!
I am thinking that we should put all user generated documents like this in one place.
|
Peter Jaric
Division for IT and Procurement
Uppsala University
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 28/03/2011 23:44:37
|
GrahamButcher
User
![[Avatar]](/forum/images/avatar/43ec517d68b6edd3015b3edc9a11367b.jpg)
Joined: 26/08/2010 15:32:13
Messages: 23
Offline
|
Thought I'd share this as I found it useful, in case anybody else might find it useful. As I'm a noob to java etc, I don't know how robust it is and I'm sure its very messy and could be made more efficient, but it seems to be working for me. Have tried it on versions 2.9.9.2 and the developer bundle (2.9.6 I think)
Background:
The infoglue tag, structure:childPages, didn't give me all I wanted. So I created my own version.
This childPages tag does the same as the structure:childPagess Tag but with extra properties in the returned list of pages and some different attributes. It will also recurse down a sitenode tree for as many levels as you specify as opposed to the 1 of structure:childContents.
Properties
The properties that each node has in the returned list are the same as those for the SiteNodeVO class plus these extra ones:
depth - The sub level depth of this node in relation to the start node
levelWidth - The maximum depth of all nodes in this collection - depth of this node + 1. So if the start node has just one sub node under it, then the start node will have a depth of 0 and a levelWidth of 2. The sub node will have a depth of 1 and a levelWidth of 1
navigationTitle - The value of the site nodes navigation title attribute
url - The URL of the site node.
firstChild - True if this is the first child of each level.
lastChild - True if this is the last child of each level.
childNumber - The number of the child. Zero is the first child in each level.
anyChildren - True if there are any sub nodes to this node.
depthDifference - The difference in depth between this node and the next one. If this node is depth 3 and the next is depth 4 then the difference will be -1
Some important differences between structure:childPages and this tag:
* This tag does not support the following attributes:
o propertyName (too complicated to figure out how to do it - could be added later)
o useInheritance
o useRepositoryInheritance
o useStructureInheritance
* This tag returns the start node as well as the child nodes.
* This tag will do any number of sub levels.
* This tag sorts the returned site nodes.
* This tag returns all the properties of a SiteNodeVO object.
* This tag does not return contentId and languageId properties in its returned site nodes.
Notes:
The start node in the returned list has an empty string for the navigation title and the url. This needs to be added, but haven't figured out how to do it yet.
Example
And finally, the source code:
The bit for the tld file:
The class that encapsulates SiteNodeVO and adds some more properties:
And the actual tag code:
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 31/03/2011 13:00:37
|
jaric
Admin
![[Avatar]](/forum/images/avatar/eccbc87e4b5ce2fe28308fd9f2a7baf3.jpg)
Joined: 02/11/2009 10:09:03
Messages: 107
Location: Uppsala
Offline
|
Thanks for sharing!
|
Peter Jaric
Division for IT and Procurement
Uppsala University
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 13/07/2011 08:20:50
|
bogeblad
Admin
Joined: 02/11/2009 11:10:04
Messages: 77
Offline
|
Hi Graham.
If you wish please clone the Infoglue 3.0 repo in github, implement this in 3.0 and push changes back. This way your splendid tag will be part of the core.
Regards
Mattias Bogeblad
|
Regards
Mattias Bogeblad, Lead architect Infoglue |
|
|
 |
|
|
|
|