Re: [xwiki-users] Set Parent in XWiki 8.0

2016-03-29 Thread Vincent Massol

> On 29 Mar 2016, at 13:47, Vincent Massol  wrote:
> 
> Hi,
> 
> If want you want is "to get all Documents in den Space "Book" (old model). It 
> shows all documents, even the nested ones. How can i query recursively 
> starting with the parent document "Book.WebHome”?”, then the following should 
> be enough:
> 
> {{velocity}}
> #set ($xwql = "where doc.space like 'Sandbox' or doc.space like 'Sandbox.%'")
> #foreach ($item in $services.query.xwql($xwql).addFilter('unique').execute())
>  * $item
> #end
> {{/velocity}}

You can also check 
http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module for more 
examples.

Thanks
-Vincent
> 
> Thanks
> -Vincent
> 
>> On 27 Mar 2016, at 15:32, Matthias Wegner  wrote:
>> 
>> Hi All,
>> 
>> i tested and tried and found a solution which gives my needed result. Now i
>> get the nested content of a space in nice order and with correct headings.
>> Looks a bit ugly, but works:
>> 
>> {{velocity}}
>> 
>> #macro(display $idoc)
>> #set($depth = $idoc.getSpace().toString().length() -
>> $idoc.getSpace().toString().replace(".", "").length() )
>> #if($depth==1)
>>   ##* $depth $idoc.getSpace()
>>= [[$idoc.getTitle()>>${idoc.getSpace()}.${idoc.getName()}]]=
>> #elseif($depth==2)
>>   ##** $depth $idoc.getSpace()
>>== [[$idoc.getTitle()>>${idoc.getSpace()}.${idoc.getName()}]]==
>> #elseif($depth==3)
>>   ##*** $depth $idoc.getSpace()
>>=== [[$idoc.getTitle()>>${idoc.getSpace()}.${idoc.getName()}]]===
>> #elseif($depth==4)
>>   ## $depth $idoc.getSpace()
>> [[$idoc.getTitle()>>${idoc.getSpace()}.${idoc.getName()}]]
>> #elseif($depth==5)
>>   ##* $depth $idoc.getSpace()
>>=
>> [[$idoc.getTitle()>>${idoc.getSpace()}.${idoc.getName()}]]=
>> #end
>> ^^$idoc.getSpace(), Level: $depth^^
>> {{include document="${idoc.getSpace()}.${idoc.getName()}"
>> context="new"/}}
>> #getChildren($idoc)
>> #foreach ($i in $children)
>>#display($i)
>> #end
>> #end
>> 
>> #macro(getChildren $document)
>> #set($depthParent = $document.getSpace().toString().length() -
>> $document.getSpace().toString().replace(".", "").length() )
>> #set($children = [])
>>  #set($q = "where doc.space like '%${document.getSpace()}.%' and not
>> doc.name='WebPreferences' and not doc.space='${document.getSpace()}' order
>> by doc.title asc")
>>  #set($r = $xwiki.searchDocuments($q, 0, 0))
>>  #foreach ($i in $r)
>> #set( $idoc = $xwiki.getDocument($i))
>> #set($depthChild = $idoc.getSpace().toString().length() -
>> $idoc.getSpace().toString().replace(".", "").length() )
>> #if($depthChild == ($depthParent + 1))
>> #set($dummy = $children.add($idoc))
>> #end
>>  #end
>> #end
>> 
>> #set($hql = "where doc.space like '%${doc.getSpace()}%' and not
>> doc.name='WebPreferences' and not doc.space='${doc.getSpace()}' order by
>> doc.title asc")
>> #set($chapters = $xwiki.searchDocuments($hql, 0, 0))
>> #foreach ($item in $chapters)
>> #set( $d = $xwiki.getDocument($item))
>> #if($d.getSpace().equals("${doc.getSpace()}.${d.getSpace().substring($mathtool.add($d.getSpace().lastIndexOf('.'),1),$d.getSpace().length())}"))
>>   #display($d)
>> #end
>> #end
>> 
>> {{/velocity}}
>> 
>> 
>> 
>> --
>> View this message in context: 
>> http://xwiki.475771.n2.nabble.com/Set-Parent-in-XWiki-8-0-tp7598643p7598671.html
>> Sent from the XWiki- Users mailing list archive at Nabble.com.

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Set Parent in XWiki 8.0

2016-03-29 Thread Vincent Massol
Hi,

If want you want is "to get all Documents in den Space "Book" (old model). It 
shows all documents, even the nested ones. How can i query recursively starting 
with the parent document "Book.WebHome”?”, then the following should be enough:

{{velocity}}
#set ($xwql = "where doc.space like 'Sandbox' or doc.space like 'Sandbox.%'")
#foreach ($item in $services.query.xwql($xwql).addFilter('unique').execute())
  * $item
#end
{{/velocity}}

Thanks
-Vincent

> On 27 Mar 2016, at 15:32, Matthias Wegner  wrote:
> 
> Hi All,
> 
> i tested and tried and found a solution which gives my needed result. Now i
> get the nested content of a space in nice order and with correct headings.
> Looks a bit ugly, but works:
> 
> {{velocity}}
> 
> #macro(display $idoc)
> #set($depth = $idoc.getSpace().toString().length() -
> $idoc.getSpace().toString().replace(".", "").length() )
>  #if($depth==1)
>##* $depth $idoc.getSpace()
> = [[$idoc.getTitle()>>${idoc.getSpace()}.${idoc.getName()}]]=
>  #elseif($depth==2)
>##** $depth $idoc.getSpace()
> == [[$idoc.getTitle()>>${idoc.getSpace()}.${idoc.getName()}]]==
>  #elseif($depth==3)
>##*** $depth $idoc.getSpace()
> === [[$idoc.getTitle()>>${idoc.getSpace()}.${idoc.getName()}]]===
>  #elseif($depth==4)
>## $depth $idoc.getSpace()
>  [[$idoc.getTitle()>>${idoc.getSpace()}.${idoc.getName()}]]
>  #elseif($depth==5)
>##* $depth $idoc.getSpace()
> =
> [[$idoc.getTitle()>>${idoc.getSpace()}.${idoc.getName()}]]=
>  #end
>  ^^$idoc.getSpace(), Level: $depth^^
>  {{include document="${idoc.getSpace()}.${idoc.getName()}"
> context="new"/}}
>  #getChildren($idoc)
>  #foreach ($i in $children)
> #display($i)
>  #end
> #end
> 
> #macro(getChildren $document)
> #set($depthParent = $document.getSpace().toString().length() -
> $document.getSpace().toString().replace(".", "").length() )
>  #set($children = [])
>   #set($q = "where doc.space like '%${document.getSpace()}.%' and not
> doc.name='WebPreferences' and not doc.space='${document.getSpace()}' order
> by doc.title asc")
>   #set($r = $xwiki.searchDocuments($q, 0, 0))
>   #foreach ($i in $r)
>  #set( $idoc = $xwiki.getDocument($i))
>  #set($depthChild = $idoc.getSpace().toString().length() -
> $idoc.getSpace().toString().replace(".", "").length() )
>  #if($depthChild == ($depthParent + 1))
>  #set($dummy = $children.add($idoc))
>  #end
>   #end
> #end
> 
> #set($hql = "where doc.space like '%${doc.getSpace()}%' and not
> doc.name='WebPreferences' and not doc.space='${doc.getSpace()}' order by
> doc.title asc")
> #set($chapters = $xwiki.searchDocuments($hql, 0, 0))
> #foreach ($item in $chapters)
>  #set( $d = $xwiki.getDocument($item))
> #if($d.getSpace().equals("${doc.getSpace()}.${d.getSpace().substring($mathtool.add($d.getSpace().lastIndexOf('.'),1),$d.getSpace().length())}"))
>#display($d)
>  #end
> #end
> 
> {{/velocity}}
> 
> 
> 
> --
> View this message in context: 
> http://xwiki.475771.n2.nabble.com/Set-Parent-in-XWiki-8-0-tp7598643p7598671.html
> Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Set Parent in XWiki 8.0

2016-03-27 Thread Matthias Wegner
Hi All,

i tested and tried and found a solution which gives my needed result. Now i
get the nested content of a space in nice order and with correct headings.
Looks a bit ugly, but works:

{{velocity}}

#macro(display $idoc)
 #set($depth = $idoc.getSpace().toString().length() -
$idoc.getSpace().toString().replace(".", "").length() )
  #if($depth==1)
##* $depth $idoc.getSpace()
 = [[$idoc.getTitle()>>${idoc.getSpace()}.${idoc.getName()}]]=
  #elseif($depth==2)
##** $depth $idoc.getSpace()
 == [[$idoc.getTitle()>>${idoc.getSpace()}.${idoc.getName()}]]==
  #elseif($depth==3)
##*** $depth $idoc.getSpace()
 === [[$idoc.getTitle()>>${idoc.getSpace()}.${idoc.getName()}]]===
  #elseif($depth==4)
## $depth $idoc.getSpace()
  [[$idoc.getTitle()>>${idoc.getSpace()}.${idoc.getName()}]]
  #elseif($depth==5)
##* $depth $idoc.getSpace()
 =
[[$idoc.getTitle()>>${idoc.getSpace()}.${idoc.getName()}]]=
  #end
  ^^$idoc.getSpace(), Level: $depth^^
  {{include document="${idoc.getSpace()}.${idoc.getName()}"
context="new"/}}
  #getChildren($idoc)
  #foreach ($i in $children)
 #display($i)
  #end
#end

#macro(getChildren $document)
#set($depthParent = $document.getSpace().toString().length() -
$document.getSpace().toString().replace(".", "").length() )
  #set($children = [])
   #set($q = "where doc.space like '%${document.getSpace()}.%' and not
doc.name='WebPreferences' and not doc.space='${document.getSpace()}' order
by doc.title asc")
   #set($r = $xwiki.searchDocuments($q, 0, 0))
   #foreach ($i in $r)
  #set( $idoc = $xwiki.getDocument($i))
  #set($depthChild = $idoc.getSpace().toString().length() -
$idoc.getSpace().toString().replace(".", "").length() )
  #if($depthChild == ($depthParent + 1))
  #set($dummy = $children.add($idoc))
  #end
   #end
#end

#set($hql = "where doc.space like '%${doc.getSpace()}%' and not
doc.name='WebPreferences' and not doc.space='${doc.getSpace()}' order by
doc.title asc")
#set($chapters = $xwiki.searchDocuments($hql, 0, 0))
#foreach ($item in $chapters)
  #set( $d = $xwiki.getDocument($item))
#if($d.getSpace().equals("${doc.getSpace()}.${d.getSpace().substring($mathtool.add($d.getSpace().lastIndexOf('.'),1),$d.getSpace().length())}"))
#display($d)
  #end
#end

{{/velocity}}



--
View this message in context: 
http://xwiki.475771.n2.nabble.com/Set-Parent-in-XWiki-8-0-tp7598643p7598671.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Set Parent in XWiki 8.0

2016-03-25 Thread Personal
Thank you Matthias! I know it wasn’t intentional but I am working on a similar 
issue and your code example was extremely useful.

Regards,

Jesse Bright

> On Mar 25, 2016, at 3:10 PM, Matthias Wegner  wrote:
> 
> Hi Vincent,
> 
> thanks, now it is clear and works. But i used a query like
> 
> #set($hql = "where doc.parent='Book.WebHome' and not 
> doc.name='WebPreferences' order by doc.title asc")
> #set($chapters = $xwiki.searchDocuments($hql, 0, 0))
> 
> to get all Documents in den Space "Book" (old model). It shows all 
> documents, even the nested ones. How can i query recursively starting 
> with the parent document "Book.WebHome"?
> 
> Regards,
> Matthias
> 
> 
> 
> Am 25.03.2016 um 14:17 schrieb vmassol [via XWiki]:
>> Hi Matthias,
>> i used a query like
>>> On 25 Mar 2016, at 13:21, Matthias Wegner <[hidden email] 
>> > wrote:
>>> 
>>> Hi Users,
>>> 
>>> i added over 500 Pages to the new XWiki and now want to sort it in 
>> depth.
>>> But i cant find the "Change Parent" Symbol in Edit-Mode. Where can i 
>> change
>>> the Parent of a Page?
>> 
>> See 
>> http://platform.xwiki.org/xwiki/bin/view/Features/PageEditing#HSettingthepageparent
>> 
>> This page should lead you to 
>> http://platform.xwiki.org/xwiki/bin/view/Features/ContentOrganization/ which 
>> in turn should lead you to 
>> http://platform.xwiki.org/xwiki/bin/view/Features/ContentOrganization/NestedPagesMigration/
>> 
>> Thanks
>> -Vincent
>> 
>>> Regards,
>>> Matthias
>> 
>> ___
>> users mailing list
>> [hidden email] 
>> http://lists.xwiki.org/mailman/listinfo/users 
>> 
>> 
>> 
>> 
>> If you reply to this email, your message will be added to the 
>> discussion below:
>> http://xwiki.475771.n2.nabble.com/Set-Parent-in-XWiki-8-0-tp7598643p7598644.html
>>  
>> 
>>  
>> 
>> To unsubscribe from Set Parent in XWiki 8.0, click here 
>> >  
>> >.
>> NAML 
>> >  
>> >
>>  
>> 
> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://xwiki.475771.n2.nabble.com/Set-Parent-in-XWiki-8-0-tp7598643p7598667.html
>  
> 
> Sent from the XWiki- Users mailing list archive at Nabble.com 
> .
> ___
> users mailing list
> users@xwiki.org 
> http://lists.xwiki.org/mailman/listinfo/users 
> 
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Set Parent in XWiki 8.0

2016-03-25 Thread Matthias Wegner
Hi Vincent,

thanks, now it is clear and works. But i used a query like

#set($hql = "where doc.parent='Book.WebHome' and not 
doc.name='WebPreferences' order by doc.title asc")
#set($chapters = $xwiki.searchDocuments($hql, 0, 0))

to get all Documents in den Space "Book" (old model). It shows all 
documents, even the nested ones. How can i query recursively starting 
with the parent document "Book.WebHome"?

Regards,
Matthias



Am 25.03.2016 um 14:17 schrieb vmassol [via XWiki]:
> Hi Matthias,
>  i used a query like
> > On 25 Mar 2016, at 13:21, Matthias Wegner <[hidden email] 
> > wrote:
> >
> > Hi Users,
> >
> > i added over 500 Pages to the new XWiki and now want to sort it in 
> depth.
> > But i cant find the "Change Parent" Symbol in Edit-Mode. Where can i 
> change
> > the Parent of a Page?
>
> See 
> http://platform.xwiki.org/xwiki/bin/view/Features/PageEditing#HSettingthepageparent
>
> This page should lead you to 
> http://platform.xwiki.org/xwiki/bin/view/Features/ContentOrganization/ which 
> in turn should lead you to 
> http://platform.xwiki.org/xwiki/bin/view/Features/ContentOrganization/NestedPagesMigration/
>
> Thanks
> -Vincent
>
> > Regards,
> > Matthias
>
> ___
> users mailing list
> [hidden email] 
> http://lists.xwiki.org/mailman/listinfo/users
>
>
> 
> If you reply to this email, your message will be added to the 
> discussion below:
> http://xwiki.475771.n2.nabble.com/Set-Parent-in-XWiki-8-0-tp7598643p7598644.html
>  
>
> To unsubscribe from Set Parent in XWiki 8.0, click here 
> .
> NAML 
> 
>  
>





--
View this message in context: 
http://xwiki.475771.n2.nabble.com/Set-Parent-in-XWiki-8-0-tp7598643p7598667.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Set Parent in XWiki 8.0

2016-03-25 Thread Vincent Massol
Hi Matthias,

> On 25 Mar 2016, at 13:21, Matthias Wegner  wrote:
> 
> Hi Users,
> 
> i added over 500 Pages to the new XWiki and now want to sort it in depth.
> But i cant find the "Change Parent" Symbol in Edit-Mode. Where can i change
> the Parent of a Page?

See 
http://platform.xwiki.org/xwiki/bin/view/Features/PageEditing#HSettingthepageparent

This page should lead you to 
http://platform.xwiki.org/xwiki/bin/view/Features/ContentOrganization/ which in 
turn should lead you to 
http://platform.xwiki.org/xwiki/bin/view/Features/ContentOrganization/NestedPagesMigration/

Thanks
-Vincent

> Regards,
> Matthias

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


[xwiki-users] Set Parent in XWiki 8.0

2016-03-25 Thread Matthias Wegner
Hi Users,

i added over 500 Pages to the new XWiki and now want to sort it in depth.
But i cant find the "Change Parent" Symbol in Edit-Mode. Where can i change
the Parent of a Page?

Regards,
Matthias



--
View this message in context: 
http://xwiki.475771.n2.nabble.com/Set-Parent-in-XWiki-8-0-tp7598643.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users