Skip to content

Commit

Permalink
XWIKI-8152: Documents Macro shouldn't accept any content
Browse files Browse the repository at this point in the history
XWIKI-8153: Allow passing the list of columns to use for the Documents macro
  • Loading branch information
vmassol committed Aug 19, 2012
1 parent 2ba9572 commit eed04f7
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 6 deletions.
Expand Up @@ -12,8 +12,8 @@
<customClass/> <customClass/>
<contentAuthor>xwiki:XWiki.Admin</contentAuthor> <contentAuthor>xwiki:XWiki.Admin</contentAuthor>
<creationDate>1329065296000</creationDate> <creationDate>1329065296000</creationDate>
<date>1329123052000</date> <date>1345365384000</date>
<contentUpdateDate>1329123052000</contentUpdateDate> <contentUpdateDate>1345365384000</contentUpdateDate>
<version>1.1</version> <version>1.1</version>
<title>Documents Macro</title> <title>Documents Macro</title>
<template/> <template/>
Expand Down Expand Up @@ -139,8 +139,17 @@
<guid>27ec7479-a26b-4b03-a6ec-576f00eecbf3</guid> <guid>27ec7479-a26b-4b03-a6ec-576f00eecbf3</guid>
<property> <property>
<code>{{velocity}} <code>{{velocity}}
#set($collist = ['doc.name', 'doc.space', 'doc.date', 'doc.author']) #if ("$!xcontext.macro.params.columns" != "")
#set ($collist = [])
#foreach ($colname in $xcontext.macro.params.columns.split(','))
#set ($discard = $collist.add($colname.trim()))
#end
#else
#set($collist = ['doc.name', 'doc.space', 'doc.date', 'doc.author'])
#end
#set($colprops = { #set($colprops = {
'doc.title' : { 'type' : 'text' , 'size' : 30, 'link' : 'view' },
'doc.fullName' : { 'type' : 'text' , 'size' : 30, 'link' : 'view' },
'doc.name' : { 'type' : 'text' , 'size' : 30, 'link' : 'view' }, 'doc.name' : { 'type' : 'text' , 'size' : 30, 'link' : 'view' },
'doc.space' : { 'type' : 'text', 'link' : 'space' }, 'doc.space' : { 'type' : 'text', 'link' : 'space' },
'doc.date' : { 'type' : 'date' }, 'doc.date' : { 'type' : 'date' },
Expand Down Expand Up @@ -177,7 +186,7 @@
<contentDescription/> <contentDescription/>
</property> </property>
<property> <property>
<contentType>Optional</contentType> <contentType>No content</contentType>
</property> </property>
<property> <property>
<defaultCategory>Content</defaultCategory> <defaultCategory>Content</defaultCategory>
Expand Down Expand Up @@ -528,15 +537,81 @@
<name>parent</name> <name>parent</name>
</property> </property>
</object> </object>
<object>
<class>
<name>XWiki.WikiMacroParameterClass</name>
<customClass/>
<customMapping/>
<defaultViewSheet/>
<defaultEditSheet/>
<defaultWeb/>
<nameField/>
<validationScript/>
<defaultValue>
<disabled>0</disabled>
<name>defaultValue</name>
<number>4</number>
<prettyName>Parameter default value</prettyName>
<size>30</size>
<unmodifiable>0</unmodifiable>
<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
</defaultValue>
<description>
<disabled>0</disabled>
<name>description</name>
<number>2</number>
<prettyName>Parameter description</prettyName>
<rows>5</rows>
<size>40</size>
<unmodifiable>0</unmodifiable>
<classType>com.xpn.xwiki.objects.classes.TextAreaClass</classType>
</description>
<mandatory>
<disabled>0</disabled>
<displayFormType>select</displayFormType>
<displayType>yesno</displayType>
<name>mandatory</name>
<number>3</number>
<prettyName>Parameter mandatory</prettyName>
<unmodifiable>0</unmodifiable>
<classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
</mandatory>
<name>
<disabled>0</disabled>
<name>name</name>
<number>1</number>
<prettyName>Parameter name</prettyName>
<size>30</size>
<unmodifiable>0</unmodifiable>
<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
</name>
</class>
<name>XWiki.DocumentsMacro</name>
<number>5</number>
<className>XWiki.WikiMacroParameterClass</className>
<guid>48fedb20-7177-4998-b377-feae7128b0eb</guid>
<property>
<defaultValue/>
</property>
<property>
<description>Specifies the list of columns to display (e.g. "doc.name,doc.space"). If not specified then the default column list of used ("doc.name,doc.space,doc.date,doc.author")</description>
</property>
<property>
<mandatory>0</mandatory>
</property>
<property>
<name>columns</name>
</property>
</object>
<content>Example: <content>Example:


{{box}} {{box}}
{{{ {{{
{{documents count="5" actions="false" space="Main" parent="Main.WebHome"/}} {{documents count="5" actions="false" space="Main" parent="Main.WebHome" columns="doc.title"/}}
}}} }}}
{{/box}} {{/box}}


Generates: Generates:


{{documents count="5" actions="false" space="Main" parent="Main.WebHome"/}}</content> {{documents count="5" actions="false" space="Main" parent="Main.WebHome" columns="doc.title"/}}</content>
</xwikidoc> </xwikidoc>
Expand Up @@ -2884,6 +2884,8 @@ platform.index.doc.name=Page
platform.index.doc.space=Space platform.index.doc.space=Space
platform.index.doc.date=Date platform.index.doc.date=Date
platform.index.doc.author=Last Author platform.index.doc.author=Last Author
platform.index.doc.title=Page
platform.index.doc.fullName=Page
platform.index._actions=Actions platform.index._actions=Actions
platform.index.emptyvalue= platform.index.emptyvalue=


Expand Down

0 comments on commit eed04f7

Please sign in to comment.