General Actions:
Log-in
Register
Wiki:
games
▼
:
Document Index
»
Space:
Main
▼
:
Document Index
»
Page:
LivetableGenerator
Search
en
Page Actions:
Export
▼
:
Export as PDF
Export as RTF
Export as HTML
More actions
▼
:
Print preview
View Source
Wiki Home
»
LivetableGenerator
Wiki source code of
LivetableGenerator
Last modified by
Adam Hattrell
on 2011/11/02 20:04
Content
·
Comments
(0)
·
Annotations
(0)
·
Attachments
(0)
·
History
·
Information
Hide line numbers
1: {{velocity}} 2: #if(!$request.classname) 3: #set($dclass = "XWiki.XWikiUsers") 4: {{html}} 5: <form action =""> 6: Generate LiveTable for class: <select name="classname"> 7: #set($classes = $xwiki.classList) 8: #foreach($classn in $classes) 9: <option value="${classn}" #if($dclass==$classn) selected #end>$classn</option> 10: #end 11: </select> 12: <input type="submit" value="Go" /> 13: </form> 14: {{/html}} 15: #else 16: #set($classname = $request.classname) 17: #set($classdoc = $xwiki.getDocument($classname)) 18: #set($classx = $classdoc.getxWikiClass()) 19: #set($props = $classx.getProperties()) 20: 21: ~{~{velocity}} 22: \#set($columns = [ "doc.title" #foreach($prop in $props) ,"${prop.name}" #end]) 23: \#set($columnsProperties = { 24: #foreach($prop in $props) 25: #if($prop.classType.endsWith("ListClass")) 26: #set($type = "list") 27: #else 28: #set($type = "text") 29: #end 30: #set($sortable = "true") 31: #set($filterable = "true") 32: ~ ~ ~ ~ ~ "${prop.name}" : { "type" : "${type}", "link" : "view", "size" : 10, "filterable" : $filterable, "sortable": $sortable }, 33: #end 34: #foreach($propname in [ "_avatar", "_images", "_attachments", "_actions" ]) 35: ~ ~ ~ ~ ~ "${propname}" : { "type" : "none", "link" : "none", "html" : "true", "sortable":false }, 36: #end 37: #foreach($propname in [ "name", "space", "fullName", "author", "date", "creator", "creationDate" ]) 38: ~ ~ ~ ~ ~ "doc.${propname}" : { "type" : "text", "link" : "view", "size" : "10", "filterable" : true, "sortable": true }, 39: #end 40: ~ ~ ~ ~ ~ "doc.title" : { "type" : "text", "link" : "view", "size" : "20", "filterable" : true, "sortable": true } 41: }) 42: 43: #set($shortname = $classdoc.name.replaceAll("Class", "").toLowerCase()) 44: 45: \#set($options = { 46: "className":"${classname}", 47: "translationPrefix" : "${shortname}.livetable.", 48: "tagCloud" : true, 49: "rowCount": 15, 50: "maxPages" : 10, 51: "selectedColumn" : "doc.title", 52: "defaultOrder" : "asc" 53: }) 54: 55: \#livetable("${shortname}" $columns $columnsProperties $options) 56: ~{~{/velocity}} 57: 58: == Translations 59: 60: #foreach($prop in $props) 61: ${shortname}.livetable.${prop.name}=${prop.prettyName} 62: #end 63: ${shortname}.livetable.doc.title=Title 64: ${shortname}.livetable.doc.name=Name 65: ${shortname}.livetable.doc.space=Space 66: ${shortname}.livetable.doc.fullname=Full name 67: ${shortname}.livetable.doc.author=Author 68: ${shortname}.livetable.doc.creator=Creator 69: ${shortname}.livetable.doc.date=Update date 70: ${shortname}.livetable.doc.creationDate=Creation date 71: ${shortname}.livetable._avatar=Avatar 72: ${shortname}.livetable._images=Images 73: ${shortname}.livetable._attachments=Attachments 74: ${shortname}.livetable._actions=Actions 75: ${shortname}.livetable.emptyvalue=- 76: 77: == How to customize the property definitions == 78: 79: |=Name|=Descriptions|=Default value 80: |displayName|The name to display as a column header for this column (wins over the translationPrefix table option) (Note: available starting with XE 2.3)|None 81: |filterable|Should the column present a filter on its header?|true 82: |sortable|Should the column be available as a sort key?|true 83: |type|For filterable columns, the type of filter for the column. Also allows to hide a column. Possible values in hidden, text, list, number.|None (no type) 84: |size|The size of the filter field. CSS might override this value to make the field 100%.|None 85: |link|The type of link to use for the field value, in view, field, none. "view" links to the page corresponding to the row. "field" links to the page corresponding to the field value (for DBListClass). "hidden" hides the column. "none" has not link.|None(no link) 86: |html|Should the returned value be treated as HTML and injected as is in the row ?|false 87: |class|Specifies the full name of the XWiki class for the type of data to display in the table. Used by the filtering options in the live table header, when the $options hash has resultPage key instead of className.|None 88: 89: == How to customize the live table options == 90: 91: |=Name|=Description 92: |doc.name|The name of the document (for example, **WebHome**, in Sandbox.WebHome). 93: |doc.title|The title of the document. 94: |doc.space|The space of the document (for example, **Sandbox**, in Sandbox.WebHome). 95: |doc.fullName|The full name of the document (for example **Sandbox.WebHome**). 96: |doc.creationDate|The date at which the document was created. 97: |doc.creator|The username of the user that created the document. 98: |doc.author|The username of the last author of the document. 99: |doc.date|The date at which the document has been last modified. 100: |propertyName|Any property of an XWiki Class the table is bound to. (See the className parameter of the $option argument for more information on how to bind a table to a XWiki Class). 101: |_images|A special column to display all images attached to the retrieved document. 102: |_attachments|A special column to display links to all attachments of the retrieved document. 103: |_actions|A special column to display a list of actions that can be performed by administrators on the matched documents. 104: |_avatar|A special column to display the user avatar. Works only for a table bound to the XWiki.XWikiUsers XWiki class. 105: 106: #end 107: {{/velocity}}