[xwiki-users] Get parts of a page...

2015-06-08 Thread Gerritjan Koekkoek
I know wiki has a nice macro to select a part of a page based on headers.

But headers can be changed and when you translate the page the page holding the 
macro wil have a ugly error.


{{include reference="DocumentToInclude" section="HMySection"}}


How could I do it based on the following wiki syntax:


(%class="lead")(((

Text to be included

)))

Text to be excluded


'Text to be included' and 'text to be excluded' can have any wiki-markup


I would like to create a macro that would look like

{{myGetSectionMacro reference="DocumentToInclude" onlyLeadText="true"}}


I could get the whole page by

{{myGetSectionMacro reference="DocumentToInclude" onlyLeadText="false"}}


I could get only 'Text to be excluded' by

{{myGetSectionMacro reference="DocumentToInclude" onlyLeadText="false" 
onlyRestText="true"}}

Any suggestion is welcome
Note that the used Class is a bootstrap class that will add markup to the 
section that will show it as a INTRO text...


Gerritjan Koekkoek
Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
Visit our website
Facebook
email



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


Re: [xwiki-users] Get parts of a page...

2015-06-08 Thread Thomas Mortagne
In your macro you could get the document and then use something like
what is described in
http://www.xwiki.org/xwiki/bin/view/ReleaseNotes/ReleaseNotesXWiki61RC1#HAccesstoBlockMatchersfromvelocityscripts
to extract the GroupBlock you want (i.e. the one with a parameter
"class" equals to "lead" from what I understood).

On Mon, Jun 8, 2015 at 9:31 AM, Gerritjan Koekkoek
 wrote:
> I know wiki has a nice macro to select a part of a page based on headers.
>
> But headers can be changed and when you translate the page the page holding 
> the macro wil have a ugly error.
>
>
> {{include reference="DocumentToInclude" section="HMySection"}}
>
>
> How could I do it based on the following wiki syntax:
>
>
> (%class="lead")(((
>
> Text to be included
>
> )))
>
> Text to be excluded
>
>
> 'Text to be included' and 'text to be excluded' can have any wiki-markup
>
>
> I would like to create a macro that would look like
>
> {{myGetSectionMacro reference="DocumentToInclude" onlyLeadText="true"}}
>
>
> I could get the whole page by
>
> {{myGetSectionMacro reference="DocumentToInclude" onlyLeadText="false"}}
>
>
> I could get only 'Text to be excluded' by
>
> {{myGetSectionMacro reference="DocumentToInclude" onlyLeadText="false" 
> onlyRestText="true"}}
>
> Any suggestion is welcome
> Note that the used Class is a bootstrap class that will add markup to the 
> section that will show it as a INTRO text...
>
>
> Gerritjan Koekkoek
> Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
> Visit our website
> Facebook
> email
>
>
>
> ___
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users



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


Re: [xwiki-users] Get parts of a page...

2015-06-08 Thread Gerritjan Koekkoek
Hi, 

this indeed looks very useful...
We run XWiki version 6.4 

From: users  on behalf of Thomas Mortagne 

Sent: 08 June 2015 10:17
To: XWiki Users
Subject: Re: [xwiki-users] Get parts of a page...

In your macro you could get the document and then use something like
what is described in
http://www.xwiki.org/xwiki/bin/view/ReleaseNotes/ReleaseNotesXWiki61RC1#HAccesstoBlockMatchersfromvelocityscripts
to extract the GroupBlock you want (i.e. the one with a parameter
"class" equals to "lead" from what I understood).

My script is:
#foreach($topicDefenitionDoc in $topicDefenitionDocs)
  #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
  
#set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
  == 
$topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) ==
  $topicDefenitionDocument.getXDOM().getBlocks("class:lead", "DESCENDANT")
#end

But the output I get is:
== Behavior ==
$topicDefenitionDocument.getXDOM().getBlocks("class:lead", "DESCENDANT")
== Early Intervention / Education ==
$topicDefenitionDocument.getXDOM().getBlocks("class:lead", "DESCENDANT")

...
What am I missing? I also tried:
$topicDefenitionDocument..getDocument().getXDOM().getBlocks("class:lead", 
"DESCENDANT")
Same result, as if methods/functions are not available?

On Mon, Jun 8, 2015 at 9:31 AM, Gerritjan Koekkoek
 wrote:
> I know wiki has a nice macro to select a part of a page based on headers.
>
> But headers can be changed and when you translate the page the page holding 
> the macro wil have a ugly error.
>
>
> {{include reference="DocumentToInclude" section="HMySection"}}
>
>
> How could I do it based on the following wiki syntax:
>
>
> (%class="lead")(((
>
> Text to be included
>
> )))
>
> Text to be excluded
>
>
> 'Text to be included' and 'text to be excluded' can have any wiki-markup
>
>
> I would like to create a macro that would look like
>
> {{myGetSectionMacro reference="DocumentToInclude" onlyLeadText="true"}}
>
>
> I could get the whole page by
>
> {{myGetSectionMacro reference="DocumentToInclude" onlyLeadText="false"}}
>
>
> I could get only 'Text to be excluded' by
>
> {{myGetSectionMacro reference="DocumentToInclude" onlyLeadText="false" 
> onlyRestText="true"}}
>
> Any suggestion is welcome
> Note that the used Class is a bootstrap class that will add markup to the 
> section that will show it as a INTRO text...
>
>
> Gerritjan Koekkoek
> Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
> Visit our website<http://www.cdlsworld.org>
> Facebook<https://www.facebook.com/gerritjan.koekkoek>
> email
>
>
>
> ___
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users



--
Thomas Mortagne
___
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] Get parts of a page...

2015-06-08 Thread Thomas Mortagne
On Mon, Jun 8, 2015 at 10:28 AM, Gerritjan Koekkoek
 wrote:
> Hi,
>
> this indeed looks very useful...
> We run XWiki version 6.4
> 
> From: users  on behalf of Thomas Mortagne 
> 
> Sent: 08 June 2015 10:17
> To: XWiki Users
> Subject: Re: [xwiki-users] Get parts of a page...
>
> In your macro you could get the document and then use something like
> what is described in
> http://www.xwiki.org/xwiki/bin/view/ReleaseNotes/ReleaseNotesXWiki61RC1#HAccesstoBlockMatchersfromvelocityscripts
> to extract the GroupBlock you want (i.e. the one with a parameter
> "class" equals to "lead" from what I understood).
>
> My script is:
> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>   #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>   
> #set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
>   == 
> $topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) 
> ==
>   $topicDefenitionDocument.getXDOM().getBlocks("class:lead", "DESCENDANT")
> #end
>
> But the output I get is:
> == Behavior ==
> $topicDefenitionDocument.getXDOM().getBlocks("class:lead", "DESCENDANT")
> == Early Intervention / Education ==
> $topicDefenitionDocument.getXDOM().getBlocks("class:lead", "DESCENDANT")
>
> ...
> What am I missing?

the "class" in $topicDefenitionDocument.getXDOM().getBlocks("class:lead",
"DESCENDANT") has nothing to do with css. This is the Java class of
the block you want to find so you are supposed to put GroupBlock there
as I suggested and then select the one in the list having the
parameter "class" equals to "lead".

> I also tried:
> $topicDefenitionDocument..getDocument().getXDOM().getBlocks("class:lead", 
> "DESCENDANT")
> Same result, as if methods/functions are not available?
>
> On Mon, Jun 8, 2015 at 9:31 AM, Gerritjan Koekkoek
>  wrote:
>> I know wiki has a nice macro to select a part of a page based on headers.
>>
>> But headers can be changed and when you translate the page the page holding 
>> the macro wil have a ugly error.
>>
>>
>> {{include reference="DocumentToInclude" section="HMySection"}}
>>
>>
>> How could I do it based on the following wiki syntax:
>>
>>
>> (%class="lead")(((
>>
>> Text to be included
>>
>> )))
>>
>> Text to be excluded
>>
>>
>> 'Text to be included' and 'text to be excluded' can have any wiki-markup
>>
>>
>> I would like to create a macro that would look like
>>
>> {{myGetSectionMacro reference="DocumentToInclude" onlyLeadText="true"}}
>>
>>
>> I could get the whole page by
>>
>> {{myGetSectionMacro reference="DocumentToInclude" onlyLeadText="false"}}
>>
>>
>> I could get only 'Text to be excluded' by
>>
>> {{myGetSectionMacro reference="DocumentToInclude" onlyLeadText="false" 
>> onlyRestText="true"}}
>>
>> Any suggestion is welcome
>> Note that the used Class is a bootstrap class that will add markup to the 
>> section that will show it as a INTRO text...
>>
>>
>> Gerritjan Koekkoek
>> Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
>> Visit our website<http://www.cdlsworld.org>
>> Facebook<https://www.facebook.com/gerritjan.koekkoek>
>> email
>>
>>
>>
>> ___
>> users mailing list
>> users@xwiki.org
>> http://lists.xwiki.org/mailman/listinfo/users
>
>
>
> --
> Thomas Mortagne
> ___
> 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



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


Re: [xwiki-users] Get parts of a page...

2015-06-08 Thread Gerritjan Koekkoek
From: users  on behalf of Thomas Mortagne 

Sent: 08 June 2015 10:46
To: XWiki Users
Subject: Re: [xwiki-users] Get parts of a page...

On Mon, Jun 8, 2015 at 10:28 AM, Gerritjan Koekkoek
 wrote:
> Hi,
>
> this indeed looks very useful...
> We run XWiki version 6.4
> 
> From: users  on behalf of Thomas Mortagne 
> 
> Sent: 08 June 2015 10:17
> To: XWiki Users
> Subject: Re: [xwiki-users] Get parts of a page...
>
> In your macro you could get the document and then use something like
> what is described in
> http://www.xwiki.org/xwiki/bin/view/ReleaseNotes/ReleaseNotesXWiki61RC1#HAccesstoBlockMatchersfromvelocityscripts
> to extract the GroupBlock you want (i.e. the one with a parameter
> "class" equals to "lead" from what I understood).
>
> My script is:
> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>   #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>   
> #set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
>   == 
> $topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) 
> ==
>   $topicDefenitionDocument.getXDOM().getBlocks("class:lead", 
> "DESCENDANT") 
I understand above line should be changed in:
#foreach($headerBlock in 
$topicDefenitionDocument.getXDOM().getBlocks("class:HeaderBlock", "DESCENDANT"))
  But how do is then inspect if the block has the 'class="lead" ?
  ...
#end
> #end
>
> But the output I get is:
> == Behavior ==
> $topicDefenitionDocument.getXDOM().getBlocks("class:lead", "DESCENDANT")
> == Early Intervention / Education ==
> $topicDefenitionDocument.getXDOM().getBlocks("class:lead", "DESCENDANT")
>
> ...
> What am I missing?

the "class" in $topicDefenitionDocument.getXDOM().getBlocks("class:lead",
"DESCENDANT") has nothing to do with css. This is the Java class of
the block you want to find so you are supposed to put GroupBlock there
as I suggested and then select the one in the list having the
parameter "class" equals to "lead".

> I also tried:
> $topicDefenitionDocument..getDocument().getXDOM().getBlocks("class:lead", 
> "DESCENDANT")
> Same result, as if methods/functions are not available?
>
> On Mon, Jun 8, 2015 at 9:31 AM, Gerritjan Koekkoek
>  wrote:
>> I know wiki has a nice macro to select a part of a page based on headers.
>>
>> But headers can be changed and when you translate the page the page holding 
>> the macro wil have a ugly error.
>>
>>
>> {{include reference="DocumentToInclude" section="HMySection"}}
>>
>>
>> How could I do it based on the following wiki syntax:
>>
>>
>> (%class="lead")(((
>>
>> Text to be included
>>
>> )))
>>
>> Text to be excluded
>>
>>
>> 'Text to be included' and 'text to be excluded' can have any wiki-markup
>>
>>
>> I would like to create a macro that would look like
>>
>> {{myGetSectionMacro reference="DocumentToInclude" onlyLeadText="true"}}
>>
>>
>> I could get the whole page by
>>
>> {{myGetSectionMacro reference="DocumentToInclude" onlyLeadText="false"}}
>>
>>
>> I could get only 'Text to be excluded' by
>>
>> {{myGetSectionMacro reference="DocumentToInclude" onlyLeadText="false" 
>> onlyRestText="true"}}
>>
>> Any suggestion is welcome
>> Note that the used Class is a bootstrap class that will add markup to the 
>> section that will show it as a INTRO text...
>>
>>
>> Gerritjan Koekkoek
>> Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
>> Visit our website<http://www.cdlsworld.org>
>> Facebook<https://www.facebook.com/gerritjan.koekkoek>
>> email
>>
>>
>>
>> ___
>> users mailing list
>> users@xwiki.org
>> http://lists.xwiki.org/mailman/listinfo/users
>
>
>
> --
> Thomas Mortagne
> ___
> 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



--
Thomas Mortagne
___
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] Get parts of a page...

2015-06-08 Thread Thomas Mortagne
On Mon, Jun 8, 2015 at 10:52 AM, Gerritjan Koekkoek
 wrote:
> From: users  on behalf of Thomas Mortagne 
> 
> Sent: 08 June 2015 10:46
> To: XWiki Users
> Subject: Re: [xwiki-users] Get parts of a page...
>
> On Mon, Jun 8, 2015 at 10:28 AM, Gerritjan Koekkoek
>  wrote:
>> Hi,
>>
>> this indeed looks very useful...
>> We run XWiki version 6.4
>> 
>> From: users  on behalf of Thomas Mortagne 
>> 
>> Sent: 08 June 2015 10:17
>> To: XWiki Users
>> Subject: Re: [xwiki-users] Get parts of a page...
>>
>> In your macro you could get the document and then use something like
>> what is described in
>> http://www.xwiki.org/xwiki/bin/view/ReleaseNotes/ReleaseNotesXWiki61RC1#HAccesstoBlockMatchersfromvelocityscripts
>> to extract the GroupBlock you want (i.e. the one with a parameter
>> "class" equals to "lead" from what I understood).
>>
>> My script is:
>> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>>   #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>>   
>> #set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
>>   == 
>> $topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) 
>> ==
>>   $topicDefenitionDocument.getXDOM().getBlocks("class:lead", 
>> "DESCENDANT")
> I understand above line should be changed in:
> #foreach($headerBlock in 
> $topicDefenitionDocument.getXDOM().getBlocks("class:HeaderBlock", 
> "DESCENDANT"))
>   But how do is then inspect if the block has the 'class="lead" ?

Note that HeaderBlock is for headers and what you have in your example
in your first mail is a GroupBlock.

Now for the parameters I talked about see
http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/org/xwiki/rendering/xwiki-rendering-api/6.4.4/xwiki-rendering-api-6.4.4-javadoc.jar/!/org/xwiki/rendering/block/Block.html#getParameter%28java.lang.String%29

When you have the block you can as for the value of "class" parameter
using $headerBlock.getParameter('class')

>   ...
> #end
>> #end
>>
>> But the output I get is:
>> == Behavior ==
>> $topicDefenitionDocument.getXDOM().getBlocks("class:lead", "DESCENDANT")
>> == Early Intervention / Education ==
>> $topicDefenitionDocument.getXDOM().getBlocks("class:lead", "DESCENDANT")
>>
>> ...
>> What am I missing?
>
> the "class" in $topicDefenitionDocument.getXDOM().getBlocks("class:lead",
> "DESCENDANT") has nothing to do with css. This is the Java class of
> the block you want to find so you are supposed to put GroupBlock there
> as I suggested and then select the one in the list having the
> parameter "class" equals to "lead".
>
>> I also tried:
>> $topicDefenitionDocument..getDocument().getXDOM().getBlocks("class:lead", 
>> "DESCENDANT")
>> Same result, as if methods/functions are not available?
>>
>> On Mon, Jun 8, 2015 at 9:31 AM, Gerritjan Koekkoek
>>  wrote:
>>> I know wiki has a nice macro to select a part of a page based on headers.
>>>
>>> But headers can be changed and when you translate the page the page holding 
>>> the macro wil have a ugly error.
>>>
>>>
>>> {{include reference="DocumentToInclude" section="HMySection"}}
>>>
>>>
>>> How could I do it based on the following wiki syntax:
>>>
>>>
>>> (%class="lead")(((
>>>
>>> Text to be included
>>>
>>> )))
>>>
>>> Text to be excluded
>>>
>>>
>>> 'Text to be included' and 'text to be excluded' can have any wiki-markup
>>>
>>>
>>> I would like to create a macro that would look like
>>>
>>> {{myGetSectionMacro reference="DocumentToInclude" onlyLeadText="true"}}
>>>
>>>
>>> I could get the whole page by
>>>
>>> {{myGetSectionMacro reference="DocumentToInclude" onlyLeadText="false"}}
>>>
>>>
>>> I could get only 'Text to be excluded' by
>>>
>>> {{myGetSectionMacro reference="DocumentToInclude" onlyLeadText="false" 
>>> onlyRestText="true"}}
>>>
>>> Any suggestion is welcome
>>> Note that the used Class is a bootstrap c

Re: [xwiki-users] Get parts of a page...

2015-06-08 Thread Gerritjan Koekkoek
From: users  on behalf of Thomas Mortagne 

Sent: 08 June 2015 11:00
To: XWiki Users
Subject: Re: [xwiki-users] Get parts of a page...

On Mon, Jun 8, 2015 at 10:52 AM, Gerritjan Koekkoek
 wrote:
> From: users  on behalf of Thomas Mortagne 
> 
> Sent: 08 June 2015 10:46
> To: XWiki Users
> Subject: Re: [xwiki-users] Get parts of a page...
>
> On Mon, Jun 8, 2015 at 10:28 AM, Gerritjan Koekkoek
>  wrote:
>> Hi,
>>
>> this indeed looks very useful...
>> We run XWiki version 6.4

Is this functionality very costly from a performance perspective?
The loop i'm running will give me approx 25 pages
Now I have added the loop through all the Headerblocks and the server crashed 
(503 service not available)
Now retrying and the page load is very slow: Wating for many minutes now?

>> 
>> From: users  on behalf of Thomas Mortagne 
>> 
>> Sent: 08 June 2015 10:17
>> To: XWiki Users
>> Subject: Re: [xwiki-users] Get parts of a page...
>>
>> In your macro you could get the document and then use something like
>> what is described in
>> http://www.xwiki.org/xwiki/bin/view/ReleaseNotes/ReleaseNotesXWiki61RC1#HAccesstoBlockMatchersfromvelocityscripts
>> to extract the GroupBlock you want (i.e. the one with a parameter
>> "class" equals to "lead" from what I understood).
>>
>> My script is:
>> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>>   #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>>   
>> #set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
>>   == 
>> $topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) 
>> ==
>>   $topicDefenitionDocument.getXDOM().getBlocks("class:lead", 
>> "DESCENDANT")
> I understand above line should be changed in:
> #foreach($headerBlock in 
> $topicDefenitionDocument.getXDOM().getBlocks("class:HeaderBlock", 
> "DESCENDANT"))
>   But how do is then inspect if the block has the 'class="lead" ?

Note that HeaderBlock is for headers and what you have in your example
in your first mail is a GroupBlock.

Now for the parameters I talked about see
http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/org/xwiki/rendering/xwiki-rendering-api/6.4.4/xwiki-rendering-api-6.4.4-javadoc.jar/!/org/xwiki/rendering/block/Block.html#getParameter%28java.lang.String%29

When you have the block you can as for the value of "class" parameter
using $headerBlock.getParameter('class')

>   ...
> #end
>> #end
>>
>> But the output I get is:
>> == Behavior ==
>> $topicDefenitionDocument.getXDOM().getBlocks("class:lead", "DESCENDANT")
>> == Early Intervention / Education ==
>> $topicDefenitionDocument.getXDOM().getBlocks("class:lead", "DESCENDANT")
>>
>> ...
>> What am I missing?
>
> the "class" in $topicDefenitionDocument.getXDOM().getBlocks("class:lead",
> "DESCENDANT") has nothing to do with css. This is the Java class of
> the block you want to find so you are supposed to put GroupBlock there
> as I suggested and then select the one in the list having the
> parameter "class" equals to "lead".
>
>> I also tried:
>> $topicDefenitionDocument..getDocument().getXDOM().getBlocks("class:lead", 
>> "DESCENDANT")
>> Same result, as if methods/functions are not available?
>>
>> On Mon, Jun 8, 2015 at 9:31 AM, Gerritjan Koekkoek
>>  wrote:
>>> I know wiki has a nice macro to select a part of a page based on headers.
>>>
>>> But headers can be changed and when you translate the page the page holding 
>>> the macro wil have a ugly error.
>>>
>>>
>>> {{include reference="DocumentToInclude" section="HMySection"}}
>>>
>>>
>>> How could I do it based on the following wiki syntax:
>>>
>>>
>>> (%class="lead")(((
>>>
>>> Text to be included
>>>
>>> )))
>>>
>>> Text to be excluded
>>>
>>>
>>> 'Text to be included' and 'text to be excluded' can have any wiki-markup
>>>
>>>
>>> I would like to create a macro that would look like
>>>
>>> {{myGetSectionMacro reference="DocumentToInclude" onlyLeadText="true"}}
>>>
>>>
>>> I could get the whole page by
>>>
>>> {{myGetSectio

Re: [xwiki-users] Get parts of a page...

2015-06-08 Thread Thomas Mortagne
On Mon, Jun 8, 2015 at 11:11 AM, Gerritjan Koekkoek
 wrote:
> From: users  on behalf of Thomas Mortagne 
> 
> Sent: 08 June 2015 11:00
> To: XWiki Users
> Subject: Re: [xwiki-users] Get parts of a page...
>
> On Mon, Jun 8, 2015 at 10:52 AM, Gerritjan Koekkoek
>  wrote:
>> From: users  on behalf of Thomas Mortagne 
>> 
>> Sent: 08 June 2015 10:46
>> To: XWiki Users
>> Subject: Re: [xwiki-users] Get parts of a page...
>>
>> On Mon, Jun 8, 2015 at 10:28 AM, Gerritjan Koekkoek
>>  wrote:
>>> Hi,
>>>
>>> this indeed looks very useful...
>>> We run XWiki version 6.4
>
> Is this functionality very costly from a performance perspective?
> The loop i'm running will give me approx 25 pages
> Now I have added the loop through all the Headerblocks and the server crashed 
> (503 service not available)
> Now retrying and the page load is very slow: Wating for many minutes now?

Loading 25 pages is slow whatever you do with them, then they are in
cache and it should be OK. I don't see how reading a XDOM could cause
a crash, you should look at the log and see what this 503 really mean.

>
>>> ________________
>>> From: users  on behalf of Thomas Mortagne 
>>> 
>>> Sent: 08 June 2015 10:17
>>> To: XWiki Users
>>> Subject: Re: [xwiki-users] Get parts of a page...
>>>
>>> In your macro you could get the document and then use something like
>>> what is described in
>>> http://www.xwiki.org/xwiki/bin/view/ReleaseNotes/ReleaseNotesXWiki61RC1#HAccesstoBlockMatchersfromvelocityscripts
>>> to extract the GroupBlock you want (i.e. the one with a parameter
>>> "class" equals to "lead" from what I understood).
>>>
>>> My script is:
>>> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>>>   #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>>>   
>>> #set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
>>>   == 
>>> $topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject)
>>>  ==
>>>   $topicDefenitionDocument.getXDOM().getBlocks("class:lead", 
>>> "DESCENDANT")
>> I understand above line should be changed in:
>> #foreach($headerBlock in 
>> $topicDefenitionDocument.getXDOM().getBlocks("class:HeaderBlock", 
>> "DESCENDANT"))
>>   But how do is then inspect if the block has the 'class="lead" ?
>
> Note that HeaderBlock is for headers and what you have in your example
> in your first mail is a GroupBlock.
>
> Now for the parameters I talked about see
> http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/org/xwiki/rendering/xwiki-rendering-api/6.4.4/xwiki-rendering-api-6.4.4-javadoc.jar/!/org/xwiki/rendering/block/Block.html#getParameter%28java.lang.String%29
>
> When you have the block you can as for the value of "class" parameter
> using $headerBlock.getParameter('class')
>
>>   ...
>> #end
>>> #end
>>>
>>> But the output I get is:
>>> == Behavior ==
>>> $topicDefenitionDocument.getXDOM().getBlocks("class:lead", "DESCENDANT")
>>> == Early Intervention / Education ==
>>> $topicDefenitionDocument.getXDOM().getBlocks("class:lead", "DESCENDANT")
>>>
>>> ...
>>> What am I missing?
>>
>> the "class" in $topicDefenitionDocument.getXDOM().getBlocks("class:lead",
>> "DESCENDANT") has nothing to do with css. This is the Java class of
>> the block you want to find so you are supposed to put GroupBlock there
>> as I suggested and then select the one in the list having the
>> parameter "class" equals to "lead".
>>
>>> I also tried:
>>> $topicDefenitionDocument..getDocument().getXDOM().getBlocks("class:lead", 
>>> "DESCENDANT")
>>> Same result, as if methods/functions are not available?
>>>
>>> On Mon, Jun 8, 2015 at 9:31 AM, Gerritjan Koekkoek
>>>  wrote:
>>>> I know wiki has a nice macro to select a part of a page based on headers.
>>>>
>>>> But headers can be changed and when you translate the page the page 
>>>> holding the macro wil have a ugly error.
>>>>
>>>>
>>>> {{include reference="DocumentToInclude" section="HMySection"}}
>>>>
>>>>
>>>

Re: [xwiki-users] Get parts of a page...

2015-06-08 Thread Gerritjan Koekkoek
I'm not sure what cased the 503, maybe because I did:
 #foreach($topicDefenitionDoc in $topicDefenitionDocs)
   #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
   
#set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
   == 
$topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) ==
   #foreach($headerBlock in 
$topicDefenitionDocument.getXDOM().getBlocks("class:HeaderBlock", 
""DESCENDANT"))
 $headerBlock -- to inspect what's inside
   #end
#end

I changed the inside of the loop to $velocityCount and indeed the numbers 
seemed to allign wel with number of headers inside the page

I've now changed class:HeaderBlock into class:GroupBlock
but now the $velocityCount equals 1 all the time wile my text is like:
== Behavior ==
Behavioral problems in people with CdLS are not inevitable. In fact, some 
people have no behavioral problems, while others are mild, have transient 
problems. Many problems are treatable. At the same time it is obviously the 
severity of behavioral problems in people who injure themselves or others deny.

Many behavior problems are a reaction to something in the body or the 
environment and they are cyclical (they come and go). Behavioral changes often 
occur in early childhood and the teenage years. Like most people, develop 
people with CdLS behavior for a certain reason, and it is important to first 
address the underlying causes of the behavior. If the source of the behavior is 
determined, one can try to recognize that resource and to avoid.

If the behavior follows a pattern (such as it is always at the same time, same 
place, or to a particular person) treatment will begin to investigate whether 
the situation can be changed. When the problem is that the environment does not 
provide sufficient structure or variation, that can be addressed. Discovering 
the reasons for behavior is the most difficult part of the treatment. Sometimes 
one can not eliminate the cause and one should look for ways to control the 
behavior. This can vary from moment to rest in your own room, distract the 
person to another activity to the use of protective clothing.

It remains important to always look at possible underlying medical problems. 
Gastrointestinal problems, muscle pain, ear infections, dental pain and 
epilepsy can cause irritability, self-injurious behavior or aggressive 
behavior. Even people who can communicate well, sometimes can not recognize the 
source of their discontent. Undetected disease (silent reflux) and tooth decay 
/ gum disease are the two most common causes of behavioral changes.

I would have expected the  velocity count to number to 4 )equal to number op 
tags in the text? but it counts only 1

Gerritjan Koekkoek
Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
Visit our website
Facebook
email





From: users  on behalf of Thomas Mortagne 

Sent: 08 June 2015 11:19
To: XWiki Users
Subject: Re: [xwiki-users] Get parts of a page...

On Mon, Jun 8, 2015 at 11:11 AM, Gerritjan Koekkoek
 wrote:
> From: users  on behalf of Thomas Mortagne 
> 
> Sent: 08 June 2015 11:00
> To: XWiki Users
> Subject: Re: [xwiki-users] Get parts of a page...
>
> On Mon, Jun 8, 2015 at 10:52 AM, Gerritjan Koekkoek
>  wrote:
>> From: users  on behalf of Thomas Mortagne 
>> 
>> Sent: 08 June 2015 10:46
>> To: XWiki Users
>> Subject: Re: [xwiki-users] Get parts of a page...
>>
>> On Mon, Jun 8, 2015 at 10:28 AM, Gerritjan Koekkoek
>>  wrote:
>>> Hi,
>>>
>>> this indeed looks very useful...
>>> We run XWiki version 6.4
>
> Is this functionality very costly from a performance perspective?
> The loop i'm running will give me approx 25 pages
> Now I have added the loop through all the Headerblocks and the server crashed 
> (503 service not available)
> Now retrying and the page load is very slow: Wating for many minutes now?

Loading 25 pages is slow whatever you do with them, then they are in
cache and it should be OK. I don't see how reading a XDOM could cause
a crash, you should look at the log and see what this 503 really mean.

>
>>> 
>>> From: users  on behalf of Thomas Mortagne 
>>> 
>>> Sent: 08 June 2015 10:17
>>> To: XWiki Users
>>> Subject: Re: [xwiki-users] Get parts of a page...
>>>
>>> In your macro you could get the document and then use something like
>>> what is described in
>>> http://www.xwiki.org/xwiki/bin/view/ReleaseNotes/ReleaseNotesXWiki61RC1#HAccesstoBlockMatchersfromvelocityscripts
>>> to extract the GroupBlock you want (i.e. the one with a parameter
>>> "

Re: [xwiki-users] Get parts of a page...

2015-06-11 Thread Gerritjan Koekkoek
A little progress, but what to do to inspect if paragraph has class lead to it 
and to display the paragraph remains unclear.

#foreach($topicDefenitionDoc in $topicDefenitionDocs)
  #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
  
#set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
  == 
$topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) ==
  
$topicDefenitionDocument.display('topicDescription','view',$topicDefenitionObject)
  #foreach($ParagraphBlock in 
$topicDefenitionDocument.getDocument().getXDOM().getBlocks("class:ParagraphBlock",
 "DESCENDANT"))
#if($velocityCount == 1)
  $ParagraphBlock.self
#end
$velocityCount
  #end
#end
  #else

Will give me a correct count of all html  parts
One of these, usually the first is enclosed by a 
I would like to display this text only
$ParagraphBlock.self 
But it does only show:
$ParagraphBlock.self  

as if method in this context is not valid

Second I have no idea how to inspect the  that holds the 
first 

My output currently looks as follows:

Behavior
Behavioral problems in people with CdLS are not inevitable. In fact, some 
people have no behavioral problems, while others are mild, have transient 
problems. Many problems are treatable. At the same time it is obviously the 
severity of behavioral problems in people who injure themselves or others deny.
Many behavior problems are a reaction to something in the body or the 
environment and they are cyclical (they come and go). Behavioral changes often 
occur in early childhood and the teenage years. Like most people, develop 
people with CdLS behavior for a certain reason, and it is important to first 
address the underlying causes of the behavior. If the source of the behavior is 
determined, one can try to recognize that resource and to avoid.

If the behavior follows a pattern (such as it is always at the same time, same 
place, or to a particular person) treatment will begin to investigate whether 
the situation can be changed. When the problem is that the environment does not 
provide sufficient structure or variation, that can be addressed. Discovering 
the reasons for behavior is the most difficult part of the treatment. Sometimes 
one can not eliminate the cause and one should look for ways to control the 
behavior. This can vary from moment to rest in your own room, distract the 
person to another activity to the use of protective clothing.

It remains important to always look at possible underlying medical problems. 
Gastrointestinal problems, muscle pain, ear infections, dental pain and 
epilepsy can cause irritability, self-injurious behavior or aggressive 
behavior. Even people who can communicate well, sometimes can not recognize the 
source of their discontent. Undetected disease (silent reflux) and tooth decay 
/ gum disease are the two most common causes of behavioral changes.


$ParagraphBlock.self
1
2
3
4 

Gerritjan Koekkoek
Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
Visit our website
Facebook
email





From: Gerritjan Koekkoek
Sent: 08 June 2015 18:45
To: XWiki Users
Subject: Re: [xwiki-users] Get parts of a page...

I'm not sure what cased the 503, maybe because I did:
 #foreach($topicDefenitionDoc in $topicDefenitionDocs)
   #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
   
#set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
   == 
$topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) ==
   #foreach($headerBlock in 
$topicDefenitionDocument.getXDOM().getBlocks("class:HeaderBlock", 
""DESCENDANT"))
 $headerBlock -- to inspect what's inside
   #end
#end

I changed the inside of the loop to $velocityCount and indeed the numbers 
seemed to allign wel with number of headers inside the page

I've now changed class:HeaderBlock into class:GroupBlock
but now the $velocityCount equals 1 all the time wile my text is like:
== Behavior ==
Behavioral problems in people with CdLS are not inevitable. In fact, some 
people have no behavioral problems, while others are mild, have transient 
problems. Many problems are treatable. At the same time it is obviously the 
severity of behavioral problems in people who injure themselves or others deny.

Many behavior problems are a reaction to something in the body or the 
environment and they are cyclical (they come and go). Behavioral changes often 
occur in early childhood and the teenage years. Like most people, develop 
people with CdLS behavior for a certain reason, and it is important to first 
address the underlying causes of the behavior. If the source of the behavior is 
determined, one can try to recognize that resource and to 

Re: [xwiki-users] Get parts of a page...

2015-06-11 Thread Thomas Mortagne
On Thu, Jun 11, 2015 at 12:58 PM, Gerritjan Koekkoek
 wrote:
> A little progress, but what to do to inspect if paragraph has class lead to 
> it and to display the paragraph remains unclear.
>
> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>   #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>   
> #set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
>   == 
> $topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) 
> ==
>   
> $topicDefenitionDocument.display('topicDescription','view',$topicDefenitionObject)
>   #foreach($ParagraphBlock in 
> $topicDefenitionDocument.getDocument().getXDOM().getBlocks("class:ParagraphBlock",
>  "DESCENDANT"))
> #if($velocityCount == 1)
>   $ParagraphBlock.self
> #end
> $velocityCount
>   #end
> #end
>   #else
>
> Will give me a correct count of all html  parts
> One of these, usually the first is enclosed by a 
> I would like to display this text only
> $ParagraphBlock.self
> But it does only show:
> $ParagraphBlock.self

There is no such method in Block so not sure what you expect "self" to
do. If you want to render a block you can use rendering service, see
http://extensions.xwiki.org/xwiki/bin/view/Extension/Rendering+Module.

>
> as if method in this context is not valid
>
> Second I have no idea how to inspect the  that holds the 
> first 
>
> My output currently looks as follows:
>
> Behavior
> Behavioral problems in people with CdLS are not inevitable. In fact, some 
> people have no behavioral problems, while others are mild, have transient 
> problems. Many problems are treatable. At the same time it is obviously the 
> severity of behavioral problems in people who injure themselves or others 
> deny.
> Many behavior problems are a reaction to something in the body or the 
> environment and they are cyclical (they come and go). Behavioral changes 
> often occur in early childhood and the teenage years. Like most people, 
> develop people with CdLS behavior for a certain reason, and it is important 
> to first address the underlying causes of the behavior. If the source of the 
> behavior is determined, one can try to recognize that resource and to avoid.
>
> If the behavior follows a pattern (such as it is always at the same time, 
> same place, or to a particular person) treatment will begin to investigate 
> whether the situation can be changed. When the problem is that the 
> environment does not provide sufficient structure or variation, that can be 
> addressed. Discovering the reasons for behavior is the most difficult part of 
> the treatment. Sometimes one can not eliminate the cause and one should look 
> for ways to control the behavior. This can vary from moment to rest in your 
> own room, distract the person to another activity to the use of protective 
> clothing.
>
> It remains important to always look at possible underlying medical problems. 
> Gastrointestinal problems, muscle pain, ear infections, dental pain and 
> epilepsy can cause irritability, self-injurious behavior or aggressive 
> behavior. Even people who can communicate well, sometimes can not recognize 
> the source of their discontent. Undetected disease (silent reflux) and tooth 
> decay / gum disease are the two most common causes of behavioral changes.
>
>
> $ParagraphBlock.self
> 1
> 2
> 3
> 4
>
> Gerritjan Koekkoek
> Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
> Visit our website
> Facebook
> email
>
>
>
>
> 
> From: Gerritjan Koekkoek
> Sent: 08 June 2015 18:45
> To: XWiki Users
> Subject: Re: [xwiki-users] Get parts of a page...
>
> I'm not sure what cased the 503, maybe because I did:
>  #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>#set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>
> #set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
>== 
> $topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) 
> ==
>#foreach($headerBlock in 
> $topicDefenitionDocument.getXDOM().getBlocks("class:HeaderBlock", 
> ""DESCENDANT"))
>  $headerBlock -- to inspect what's inside
>#end
> #end
>
> I changed the inside of the loop to $velocityCount and indeed the numbers 
> seemed to allign wel with number of headers inside the page
>
> I've now changed class:HeaderBlock into class:GroupBlock
> but now the $velocityC

Re: [xwiki-users] Get parts of a page...

2015-06-11 Thread Gerritjan Koekkoek



From: users  on behalf of Thomas Mortagne 

Sent: 11 June 2015 13:51
To: XWiki Users
Subject: Re: [xwiki-users] Get parts of a page...

On Thu, Jun 11, 2015 at 12:58 PM, Gerritjan Koekkoek
 wrote:
> A little progress, but what to do to inspect if paragraph has class lead to 
> it and to display the paragraph remains unclear.
>
> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>   #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>   
> #set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
>   == 
> $topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) 
> ==
>   
> $topicDefenitionDocument.display('topicDescription','view',$topicDefenitionObject)
>   #foreach($ParagraphBlock in 
> $topicDefenitionDocument.getDocument().getXDOM().getBlocks("class:ParagraphBlock",
>  "DESCENDANT"))
> #if($velocityCount == 1)
>   $ParagraphBlock.self
> #end
> $velocityCount
>   #end
> #end
>   #else
>
> Will give me a correct count of all html  parts
> One of these, usually the first is enclosed by a 
> I would like to display this text only
> $ParagraphBlock.self
> But it does only show:
> $ParagraphBlock.self

There is no such method in Block so not sure what you expect "self" to
do. 
I read something in this page which reminds me of my days in XSLT...
http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/org/xwiki/rendering/xwiki-rendering-api/6.4.4/xwiki-rendering-api-6.4.4-javadoc.jar/!/org/xwiki/rendering/block/Block.Axes.html
Self is mentioned as last search option...

If you want to render a block you can use rendering service, see
http://extensions.xwiki.org/xwiki/bin/view/Extension/Rendering+Module.
OK

>
> as if method in this context is not valid
>
> Second I have no idea how to inspect the  that holds the 
> first 
Any Idea how to evaluate if paragraph is insight this div?

>
> My output currently looks as follows:
>
> Behavior
> Behavioral problems in people with CdLS are not inevitable. In fact, some 
> people have no behavioral problems, while others are mild, have transient 
> problems. Many problems are treatable. At the same time it is obviously the 
> severity of behavioral problems in people who injure themselves or others 
> deny.
> Many behavior problems are a reaction to something in the body or the 
> environment and they are cyclical (they come and go). Behavioral changes 
> often occur in early childhood and the teenage years. Like most people, 
> develop people with CdLS behavior for a certain reason, and it is important 
> to first address the underlying causes of the behavior. If the source of the 
> behavior is determined, one can try to recognize that resource and to avoid.
>
> If the behavior follows a pattern (such as it is always at the same time, 
> same place, or to a particular person) treatment will begin to investigate 
> whether the situation can be changed. When the problem is that the 
> environment does not provide sufficient structure or variation, that can be 
> addressed. Discovering the reasons for behavior is the most difficult part of 
> the treatment. Sometimes one can not eliminate the cause and one should look 
> for ways to control the behavior. This can vary from moment to rest in your 
> own room, distract the person to another activity to the use of protective 
> clothing.
>
> It remains important to always look at possible underlying medical problems. 
> Gastrointestinal problems, muscle pain, ear infections, dental pain and 
> epilepsy can cause irritability, self-injurious behavior or aggressive 
> behavior. Even people who can communicate well, sometimes can not recognize 
> the source of their discontent. Undetected disease (silent reflux) and tooth 
> decay / gum disease are the two most common causes of behavioral changes.
>
>
> $ParagraphBlock.self
> 1
> 2
> 3
> 4
>
> Gerritjan Koekkoek
> Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
> Visit our website
> Facebook
> email
>
>
>
>
> 
> From: Gerritjan Koekkoek
> Sent: 08 June 2015 18:45
> To: XWiki Users
> Subject: Re: [xwiki-users] Get parts of a page...
>
> I'm not sure what cased the 503, maybe because I did:
>  #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>#set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>
> #set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
>== 
> $topicDefenitionDocument.display('topicTi

Re: [xwiki-users] Get parts of a page...

2015-06-11 Thread Gerritjan Koekkoek
I almost have it right I think:
#foreach($topicDefenitionDoc in $topicDefenitionDocs)
  #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
  
#set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
  == 
$topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) ==
  
##$topicDefenitionDocument.display('topicDescription','view',$topicDefenitionObject)
  #foreach($ParagraphBlock in 
$topicDefenitionDocument.getDocument().getXDOM().getBlocks("class:ParagraphBlock",
 "DESCENDANT"))
#if($velocityCount == 1)
  #set ($blockParent = $ParagraphBlock.getParent())
  #set ($leadParagraph = $services.rendering.render($ParagraphBlock, 
"xwiki/2.1"))
  #if($blockParent.getParameter('class') == 'lead')
   (%class="lead"%)((($leadParagraph)))
  #else
   $leadParagraph
  #end
#end
  #end

The one issue I have left is the translation.
The $topicDefenitionsDocs are in the $context.language

But the Blocks are in the default language?
How can I get the blocks in the $context.language

Gerritjan Koekkoek
Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
Visit our website
Facebook
email





From: users  on behalf of Thomas Mortagne 

Sent: 11 June 2015 13:51
To: XWiki Users
Subject: Re: [xwiki-users] Get parts of a page...

On Thu, Jun 11, 2015 at 12:58 PM, Gerritjan Koekkoek
 wrote:
> A little progress, but what to do to inspect if paragraph has class lead to 
> it and to display the paragraph remains unclear.
>
> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>   #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>   
> #set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
>   == 
> $topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) 
> ==
>   
> $topicDefenitionDocument.display('topicDescription','view',$topicDefenitionObject)
>   #foreach($ParagraphBlock in 
> $topicDefenitionDocument.getDocument().getXDOM().getBlocks("class:ParagraphBlock",
>  "DESCENDANT"))
> #if($velocityCount == 1)
>   $ParagraphBlock.self
> #end
> $velocityCount
>   #end
> #end
>   #else
>
> Will give me a correct count of all html  parts
> One of these, usually the first is enclosed by a 
> I would like to display this text only
> $ParagraphBlock.self
> But it does only show:
> $ParagraphBlock.self

There is no such method in Block so not sure what you expect "self" to
do. If you want to render a block you can use rendering service, see
http://extensions.xwiki.org/xwiki/bin/view/Extension/Rendering+Module.

>
> as if method in this context is not valid
>
> Second I have no idea how to inspect the  that holds the 
> first 
>
> My output currently looks as follows:
>
> Behavior
> Behavioral problems in people with CdLS are not inevitable. In fact, some 
> people have no behavioral problems, while others are mild, have transient 
> problems. Many problems are treatable. At the same time it is obviously the 
> severity of behavioral problems in people who injure themselves or others 
> deny.
> Many behavior problems are a reaction to something in the body or the 
> environment and they are cyclical (they come and go). Behavioral changes 
> often occur in early childhood and the teenage years. Like most people, 
> develop people with CdLS behavior for a certain reason, and it is important 
> to first address the underlying causes of the behavior. If the source of the 
> behavior is determined, one can try to recognize that resource and to avoid.
>
> If the behavior follows a pattern (such as it is always at the same time, 
> same place, or to a particular person) treatment will begin to investigate 
> whether the situation can be changed. When the problem is that the 
> environment does not provide sufficient structure or variation, that can be 
> addressed. Discovering the reasons for behavior is the most difficult part of 
> the treatment. Sometimes one can not eliminate the cause and one should look 
> for ways to control the behavior. This can vary from moment to rest in your 
> own room, distract the person to another activity to the use of protective 
> clothing.
>
> It remains important to always look at possible underlying medical problems. 
> Gastrointestinal problems, muscle pain, ear infections, dental pain and 
> epilepsy can cause irritability, self-injurious behavior or aggressive 
> behavior. Even people who can communi

Re: [xwiki-users] Get parts of a page...

2015-06-11 Thread Thomas Mortagne
On Thu, Jun 11, 2015 at 4:37 PM, Gerritjan Koekkoek
 wrote:
> I almost have it right I think:
> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>   #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>   
> #set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
>   == 
> $topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) 
> ==
>   
> ##$topicDefenitionDocument.display('topicDescription','view',$topicDefenitionObject)
>   #foreach($ParagraphBlock in 
> $topicDefenitionDocument.getDocument().getXDOM().getBlocks("class:ParagraphBlock",
>  "DESCENDANT"))
> #if($velocityCount == 1)
>   #set ($blockParent = $ParagraphBlock.getParent())
>   #set ($leadParagraph = $services.rendering.render($ParagraphBlock, 
> "xwiki/2.1"))
>   #if($blockParent.getParameter('class') == 'lead')
>(%class="lead"%)((($leadParagraph)))
>   #else
>$leadParagraph
>   #end
> #end
>   #end
>
> The one issue I have left is the translation.
> The $topicDefenitionsDocs are in the $context.language
>
> But the Blocks are in the default language?
> How can I get the blocks in the $context.language

In document API you have getTranslatedDocument() which return the
right document from current locale point of view on which you can then
call getXDOM().

>
> Gerritjan Koekkoek
> Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
> Visit our website
> Facebook
> email
>
>
>
>
> 
> From: users  on behalf of Thomas Mortagne 
> 
> Sent: 11 June 2015 13:51
> To: XWiki Users
> Subject: Re: [xwiki-users] Get parts of a page...
>
> On Thu, Jun 11, 2015 at 12:58 PM, Gerritjan Koekkoek
>  wrote:
>> A little progress, but what to do to inspect if paragraph has class lead to 
>> it and to display the paragraph remains unclear.
>>
>> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>>   #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>>   
>> #set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
>>   == 
>> $topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) 
>> ==
>>   
>> $topicDefenitionDocument.display('topicDescription','view',$topicDefenitionObject)
>>   #foreach($ParagraphBlock in 
>> $topicDefenitionDocument.getDocument().getXDOM().getBlocks("class:ParagraphBlock",
>>  "DESCENDANT"))
>> #if($velocityCount == 1)
>>   $ParagraphBlock.self
>> #end
>> $velocityCount
>>   #end
>> #end
>>   #else
>>
>> Will give me a correct count of all html  parts
>> One of these, usually the first is enclosed by a 
>> I would like to display this text only
>> $ParagraphBlock.self
>> But it does only show:
>> $ParagraphBlock.self
>
> There is no such method in Block so not sure what you expect "self" to
> do. If you want to render a block you can use rendering service, see
> http://extensions.xwiki.org/xwiki/bin/view/Extension/Rendering+Module.
>
>>
>> as if method in this context is not valid
>>
>> Second I have no idea how to inspect the  that holds the 
>> first 
>>
>> My output currently looks as follows:
>>
>> Behavior
>> Behavioral problems in people with CdLS are not inevitable. In fact, some 
>> people have no behavioral problems, while others are mild, have transient 
>> problems. Many problems are treatable. At the same time it is obviously the 
>> severity of behavioral problems in people who injure themselves or others 
>> deny.
>> Many behavior problems are a reaction to something in the body or the 
>> environment and they are cyclical (they come and go). Behavioral changes 
>> often occur in early childhood and the teenage years. Like most people, 
>> develop people with CdLS behavior for a certain reason, and it is important 
>> to first address the underlying causes of the behavior. If the source of the 
>> behavior is determined, one can try to recognize that resource and to avoid.
>>
>> If the behavior follows a pattern (such as it is always at the same time, 
>> same place, or to a particular person) treatment will begin to investigate 
>> whether the situation can be changed. When the problem is that the 
>> environment does not pr

Re: [xwiki-users] Get parts of a page...

2015-06-11 Thread Gerritjan Koekkoek
I tied to replace getDocument() in this line with getTranslatedDocument()...
#foreach($ParagraphBlock in 
$topicDefenitionDocument.getDocument().getXDOM().getBlocks("class:ParagraphBlock",
 "DESCENDANT"))

But the $ParagraphBlock is empty???

Gerritjan Koekkoek
Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
Visit our website
Facebook
email





From: users  on behalf of Thomas Mortagne 

Sent: 11 June 2015 19:46
To: XWiki Users
Subject: Re: [xwiki-users] Get parts of a page...

On Thu, Jun 11, 2015 at 4:37 PM, Gerritjan Koekkoek
 wrote:
> I almost have it right I think:
> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>   #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>   
> #set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
>   == 
> $topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) 
> ==
>   
> ##$topicDefenitionDocument.display('topicDescription','view',$topicDefenitionObject)
>   #foreach($ParagraphBlock in 
> $topicDefenitionDocument.getDocument().getXDOM().getBlocks("class:ParagraphBlock",
>  "DESCENDANT"))
> #if($velocityCount == 1)
>   #set ($blockParent = $ParagraphBlock.getParent())
>   #set ($leadParagraph = $services.rendering.render($ParagraphBlock, 
> "xwiki/2.1"))
>   #if($blockParent.getParameter('class') == 'lead')
>(%class="lead"%)((($leadParagraph)))
>   #else
>$leadParagraph
>   #end
> #end
>   #end
>
> The one issue I have left is the translation.
> The $topicDefenitionsDocs are in the $context.language
>
> But the Blocks are in the default language?
> How can I get the blocks in the $context.language

In document API you have getTranslatedDocument() which return the
right document from current locale point of view on which you can then
call getXDOM().

>
> Gerritjan Koekkoek
> Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
> Visit our website
> Facebook
> email
>
>
>
>
> 
> From: users  on behalf of Thomas Mortagne 
> 
> Sent: 11 June 2015 13:51
> To: XWiki Users
> Subject: Re: [xwiki-users] Get parts of a page...
>
> On Thu, Jun 11, 2015 at 12:58 PM, Gerritjan Koekkoek
>  wrote:
>> A little progress, but what to do to inspect if paragraph has class lead to 
>> it and to display the paragraph remains unclear.
>>
>> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>>   #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>>   
>> #set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
>>   == 
>> $topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) 
>> ==
>>   
>> $topicDefenitionDocument.display('topicDescription','view',$topicDefenitionObject)
>>   #foreach($ParagraphBlock in 
>> $topicDefenitionDocument.getDocument().getXDOM().getBlocks("class:ParagraphBlock",
>>  "DESCENDANT"))
>> #if($velocityCount == 1)
>>   $ParagraphBlock.self
>> #end
>> $velocityCount
>>   #end
>> #end
>>   #else
>>
>> Will give me a correct count of all html  parts
>> One of these, usually the first is enclosed by a 
>> I would like to display this text only
>> $ParagraphBlock.self
>> But it does only show:
>> $ParagraphBlock.self
>
> There is no such method in Block so not sure what you expect "self" to
> do. If you want to render a block you can use rendering service, see
> http://extensions.xwiki.org/xwiki/bin/view/Extension/Rendering+Module.
>
>>
>> as if method in this context is not valid
>>
>> Second I have no idea how to inspect the  that holds the 
>> first 
>>
>> My output currently looks as follows:
>>
>> Behavior
>> Behavioral problems in people with CdLS are not inevitable. In fact, some 
>> people have no behavioral problems, while others are mild, have transient 
>> problems. Many problems are treatable. At the same time it is obviously the 
>> severity of behavioral problems in people who injure themselves or others 
>> deny.
>> Many behavior problems are a reaction to something in the body or the 
>> environment and they are cyclical (they come and go). Behavioral changes 
>> often occur in early childhood and the teenage years. Like 

Re: [xwiki-users] Get parts of a page...

2015-06-12 Thread Thomas Mortagne
On Thu, Jun 11, 2015 at 8:18 PM, Gerritjan Koekkoek
 wrote:
> I tied to replace getDocument() in this line with getTranslatedDocument()...

getTranslatedDocument() is a Document API so you should not remove
getDocument(). In other words you get the translated version of that
document so it's getDocument().getTranslatedDocument().

> #foreach($ParagraphBlock in 
> $topicDefenitionDocument.getDocument().getXDOM().getBlocks("class:ParagraphBlock",
>  "DESCENDANT"))
>
> But the $ParagraphBlock is empty???
>
> Gerritjan Koekkoek
> Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
> Visit our website
> Facebook
> email
>
>
>
>
> 
> From: users  on behalf of Thomas Mortagne 
> 
> Sent: 11 June 2015 19:46
> To: XWiki Users
> Subject: Re: [xwiki-users] Get parts of a page...
>
> On Thu, Jun 11, 2015 at 4:37 PM, Gerritjan Koekkoek
>  wrote:
>> I almost have it right I think:
>> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>>   #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>>   
>> #set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
>>   == 
>> $topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) 
>> ==
>>   
>> ##$topicDefenitionDocument.display('topicDescription','view',$topicDefenitionObject)
>>   #foreach($ParagraphBlock in 
>> $topicDefenitionDocument.getDocument().getXDOM().getBlocks("class:ParagraphBlock",
>>  "DESCENDANT"))
>> #if($velocityCount == 1)
>>   #set ($blockParent = $ParagraphBlock.getParent())
>>   #set ($leadParagraph = $services.rendering.render($ParagraphBlock, 
>> "xwiki/2.1"))
>>   #if($blockParent.getParameter('class') == 'lead')
>>(%class="lead"%)((($leadParagraph)))
>>   #else
>>$leadParagraph
>>   #end
>> #end
>>   #end
>>
>> The one issue I have left is the translation.
>> The $topicDefenitionsDocs are in the $context.language
>>
>> But the Blocks are in the default language?
>> How can I get the blocks in the $context.language
>
> In document API you have getTranslatedDocument() which return the
> right document from current locale point of view on which you can then
> call getXDOM().
>
>>
>> Gerritjan Koekkoek
>> Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
>> Visit our website
>> Facebook
>> email
>>
>>
>>
>>
>> 
>> From: users  on behalf of Thomas Mortagne 
>> 
>> Sent: 11 June 2015 13:51
>> To: XWiki Users
>> Subject: Re: [xwiki-users] Get parts of a page...
>>
>> On Thu, Jun 11, 2015 at 12:58 PM, Gerritjan Koekkoek
>>  wrote:
>>> A little progress, but what to do to inspect if paragraph has class lead to 
>>> it and to display the paragraph remains unclear.
>>>
>>> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>>>   #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>>>   
>>> #set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
>>>   == 
>>> $topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject)
>>>  ==
>>>   
>>> $topicDefenitionDocument.display('topicDescription','view',$topicDefenitionObject)
>>>   #foreach($ParagraphBlock in 
>>> $topicDefenitionDocument.getDocument().getXDOM().getBlocks("class:ParagraphBlock",
>>>  "DESCENDANT"))
>>> #if($velocityCount == 1)
>>>   $ParagraphBlock.self
>>> #end
>>> $velocityCount
>>>   #end
>>> #end
>>>   #else
>>>
>>> Will give me a correct count of all html  parts
>>> One of these, usually the first is enclosed by a 
>>> I would like to display this text only
>>> $ParagraphBlock.self
>>> But it does only show:
>>> $ParagraphBlock.self
>>
>> There is no such method in Block so not sure what you expect "self" to
>> do. If you want to render a block you can use rendering service, see
>> http://extensions.xwiki.org/xwiki/bin/view/Extension/Rendering+Module.
>>
>>>
>>> as if method in this context is not valid
>>>
>>>

Re: [xwiki-users] Get parts of a page...

2015-06-12 Thread Gerritjan Koekkoek
I did as you described.
But nope...

Can it be related to the object I have the .getDocument() method on?
I use XWQL executed with a .addFilter("current language")

On the collection of document-references I get from that query I have a foreach 
loop.
#foreach($topicDefenitionDoc in $topicDefenitionDocs)

Then I set the variable: 
#set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))

And that variable I use in the 'Block' statement
#foreach($ParagraphBlock in 
$topicDefenitionDocument.getDocument().getTranslatedDocument().getXDOM().getBlocks("class:ParagraphBlock",
 "DESCENDANT"))

So I basicly do the getDocument.getTranslatedDocument on a object that is 
already filtered for current language
When I remove the getTranslatedDocument() it works, but only gives me the 
default document language and not the current language
When I add the  getTranslatedDocument() I get empty output

Gerritjan Koekkoek
Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
Visit our website
Facebook
email





From: users  on behalf of Thomas Mortagne 

Sent: 12 June 2015 09:38
To: XWiki Users
Subject: Re: [xwiki-users] Get parts of a page...

On Thu, Jun 11, 2015 at 8:18 PM, Gerritjan Koekkoek
 wrote:
> I tied to replace getDocument() in this line with getTranslatedDocument()...

getTranslatedDocument() is a Document API so you should not remove
getDocument(). In other words you get the translated version of that
document so it's getDocument().getTranslatedDocument().

> #foreach($ParagraphBlock in 
> $topicDefenitionDocument.getDocument().getXDOM().getBlocks("class:ParagraphBlock",
>  "DESCENDANT"))
>
> But the $ParagraphBlock is empty???
>
> Gerritjan Koekkoek
> Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
> Visit our website
> Facebook
> email
>
>
>
>
> ____
> From: users  on behalf of Thomas Mortagne 
> 
> Sent: 11 June 2015 19:46
> To: XWiki Users
> Subject: Re: [xwiki-users] Get parts of a page...
>
> On Thu, Jun 11, 2015 at 4:37 PM, Gerritjan Koekkoek
>  wrote:
>> I almost have it right I think:
>> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>>   #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>>   
>> #set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
>>   == 
>> $topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) 
>> ==
>>   
>> ##$topicDefenitionDocument.display('topicDescription','view',$topicDefenitionObject)
>>   #foreach($ParagraphBlock in 
>> $topicDefenitionDocument.getDocument().getXDOM().getBlocks("class:ParagraphBlock",
>>  "DESCENDANT"))
>> #if($velocityCount == 1)
>>   #set ($blockParent = $ParagraphBlock.getParent())
>>   #set ($leadParagraph = $services.rendering.render($ParagraphBlock, 
>> "xwiki/2.1"))
>>   #if($blockParent.getParameter('class') == 'lead')
>>(%class="lead"%)((($leadParagraph)))
>>   #else
>>$leadParagraph
>>   #end
>> #end
>>   #end
>>
>> The one issue I have left is the translation.
>> The $topicDefenitionsDocs are in the $context.language
>>
>> But the Blocks are in the default language?
>> How can I get the blocks in the $context.language
>
> In document API you have getTranslatedDocument() which return the
> right document from current locale point of view on which you can then
> call getXDOM().
>
>>
>> Gerritjan Koekkoek
>> Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
>> Visit our website
>> Facebook
>> email
>>
>>
>>
>>
>> 
>> From: users  on behalf of Thomas Mortagne 
>> 
>> Sent: 11 June 2015 13:51
>> To: XWiki Users
>> Subject: Re: [xwiki-users] Get parts of a page...
>>
>> On Thu, Jun 11, 2015 at 12:58 PM, Gerritjan Koekkoek
>>  wrote:
>>> A little progress, but what to do to inspect if paragraph has class lead to 
>>> it and to display the paragraph remains unclear.
>>>
>>> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>>>   #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>>>   
>>> #set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
>>>   == 
>>> $topicDefenitionDocument.display('topicTitle',&#

Re: [xwiki-users] Get parts of a page...

2015-06-12 Thread Thomas Mortagne
On Fri, Jun 12, 2015 at 10:56 AM, Gerritjan Koekkoek
 wrote:
> I did as you described.
> But nope...
>
> Can it be related to the object I have the .getDocument() method on?
> I use XWQL executed with a .addFilter("current language")
>
> On the collection of document-references I get from that query I have a 
> foreach loop.
> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>
> Then I set the variable: 
> #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>
> And that variable I use in the 'Block' statement
> #foreach($ParagraphBlock in 
> $topicDefenitionDocument.getDocument().getTranslatedDocument().getXDOM().getBlocks("class:ParagraphBlock",
>  "DESCENDANT"))
>
> So I basicly do the getDocument.getTranslatedDocument on a object that is 
> already filtered for current language

It has nothing to do with your query, you get the default language
because you call $xwiki.getDocument with the name of the document
only. But I did not seen that your initial code was actually wrong,
calling getDocument() twice is useless so the issue does not come from
getTranslatedDocument(), it comes fro your second getDocument() (which
by the way only work for you because you have the right to use
privileged API which you really don't need here).

> When I remove the getTranslatedDocument() it works, but only gives me the 
> default document language and not the current language
> When I add the  getTranslatedDocument() I get empty output
>
> Gerritjan Koekkoek
> Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
> Visit our website
> Facebook
> email
>
>
>
>
> ____________________
> From: users  on behalf of Thomas Mortagne 
> 
> Sent: 12 June 2015 09:38
> To: XWiki Users
> Subject: Re: [xwiki-users] Get parts of a page...
>
> On Thu, Jun 11, 2015 at 8:18 PM, Gerritjan Koekkoek
>  wrote:
>> I tied to replace getDocument() in this line with getTranslatedDocument()...
>
> getTranslatedDocument() is a Document API so you should not remove
> getDocument(). In other words you get the translated version of that
> document so it's getDocument().getTranslatedDocument().
>
>> #foreach($ParagraphBlock in 
>> $topicDefenitionDocument.getDocument().getXDOM().getBlocks("class:ParagraphBlock",
>>  "DESCENDANT"))
>>
>> But the $ParagraphBlock is empty???
>>
>> Gerritjan Koekkoek
>> Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
>> Visit our website
>> Facebook
>> email
>>
>>
>>
>>
>> 
>> From: users  on behalf of Thomas Mortagne 
>> 
>> Sent: 11 June 2015 19:46
>> To: XWiki Users
>> Subject: Re: [xwiki-users] Get parts of a page...
>>
>> On Thu, Jun 11, 2015 at 4:37 PM, Gerritjan Koekkoek
>>  wrote:
>>> I almost have it right I think:
>>> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>>>   #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>>>   
>>> #set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
>>>   == 
>>> $topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject)
>>>  ==
>>>   
>>> ##$topicDefenitionDocument.display('topicDescription','view',$topicDefenitionObject)
>>>   #foreach($ParagraphBlock in 
>>> $topicDefenitionDocument.getDocument().getXDOM().getBlocks("class:ParagraphBlock",
>>>  "DESCENDANT"))
>>> #if($velocityCount == 1)
>>>   #set ($blockParent = $ParagraphBlock.getParent())
>>>   #set ($leadParagraph = 
>>> $services.rendering.render($ParagraphBlock, "xwiki/2.1"))
>>>   #if($blockParent.getParameter('class') == 'lead')
>>>(%class="lead"%)((($leadParagraph)))
>>>   #else
>>>$leadParagraph
>>>   #end
>>> #end
>>>   #end
>>>
>>> The one issue I have left is the translation.
>>> The $topicDefenitionsDocs are in the $context.language
>>>
>>> But the Blocks are in the default language?
>>> How can I get the blocks in the $context.language
>>
>> In document API you have getTranslatedDocument() which return the
>> right document from current locale point of view on which you can then
>> call getXDOM().
>>
>>>
>>> Gerritjan Koekkoek
>>

Re: [xwiki-users] Get parts of a page...

2015-06-12 Thread Gerritjan Koekkoek
I think I do need the block api!
The goal is to inspect the first block for having a "class: 'lead'"
But maybe I do not need the second getDocument()?
As you can see in the code below my original code did not loop through all the 
blocks
I got the page content by (now commented out)
$topicDefenitionDocument.display('topicDescription','view',$topicDefenitionObject)
If I could add .getXDOM().getBlocks("class:ParagraphBlock", "DESCENDANT")) to 
the object in the above?

The title of the page I was able to get without the privileged API, like you 
stated.
But the blocks of all class:ParagraphBlock I do need to inspect for the 
class:'lead'

I do get translated titles when I switch the language 
But the blocks retrieved are only in default language?

My current code including the query:
Note the line that works, but will give me 
#foreach($t in $topicList)
  #set($topicDefenitionDocs = 
$services.query.xwql("$topicDefenitionQry2").bindValue("topicreference",$t).addFilter("currentlanguage").execute())
  #if($topicDefenitionDocs != [])
#foreach($topicDefenitionDoc in $topicDefenitionDocs)
  #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
  
#set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
  == 
$topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) ==
  
##$topicDefenitionDocument.display('topicDescription','view',$topicDefenitionObject)
  #foreach($ParagraphBlock in 
$topicDefenitionDocument.getDocument().getTranslatedDocument().getXDOM().getBlocks("class:ParagraphBlock",
 "DESCENDANT"))
#if($velocityCount == 1)
  #set ($blockParent = $ParagraphBlock.getParent())
  #set ($leadParagraph = $services.rendering.render($ParagraphBlock, 
"xwiki/2.1"))
  #if($blockParent.getParameter('class') == 'lead')
   (%class="lead"%)((($leadParagraph)))
  #else
   $leadParagraph
  #end
    #end
      #end
    #end
  #else
$t
  #end
#end
__
From: users  on behalf of Thomas Mortagne 

Sent: 12 June 2015 11:10
To: XWiki Users
Subject: Re: [xwiki-users] Get parts of a page...

On Fri, Jun 12, 2015 at 10:56 AM, Gerritjan Koekkoek
 wrote:
> I did as you described.
> But nope...
>
> Can it be related to the object I have the .getDocument() method on?
> I use XWQL executed with a .addFilter("current language")
>
> On the collection of document-references I get from that query I have a 
> foreach loop.
> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>
> Then I set the variable: 
> #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>
> And that variable I use in the 'Block' statement
> #foreach($ParagraphBlock in 
> $topicDefenitionDocument.getDocument().getTranslatedDocument().getXDOM().getBlocks("class:ParagraphBlock",
>  "DESCENDANT"))
>
> So I basicly do the getDocument.getTranslatedDocument on a object that is 
> already filtered for current language

It has nothing to do with your query, you get the default language
because you call $xwiki.getDocument with the name of the document
only. 
But I did not seen that your initial code was actually wrong,
calling getDocument() twice is useless so the issue does not come from
getTranslatedDocument(), it comes fro your second getDocument() (which
by the way only work for you because you have the right to use
privileged API which you really don't need here).

> When I remove the getTranslatedDocument() it works, but only gives me the 
> default document language and not the current language
> When I add the  getTranslatedDocument() I get empty output
>
> Gerritjan Koekkoek
> Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
> Visit our website
> Facebook
> email
>
>
>
>
> 
> From: users  on behalf of Thomas Mortagne 
> 
> Sent: 12 June 2015 09:38
> To: XWiki Users
> Subject: Re: [xwiki-users] Get parts of a page...
>
> On Thu, Jun 11, 2015 at 8:18 PM, Gerritjan Koekkoek
>  wrote:
>> I tied to replace getDocument() in this line with getTranslatedDocument()...
>
> getTranslatedDocument() is a Document API so you should not remove
> getDocument(). In other words you get the translated version of that
> document so it's getDocument().getTranslatedDocument().
>
>> #foreach($ParagraphBlock in 
>> $topicDefenitionDocument.getDocument().getXDOM().getBlocks("class:ParagraphBlock",
>>  "DESCENDANT"))
>>
>> But the $ParagraphBlock is empty???
>>
>> Gerritjan Ko

Re: [xwiki-users] Get parts of a page...

2015-06-12 Thread Thomas Mortagne
On Fri, Jun 12, 2015 at 12:07 PM, Gerritjan Koekkoek
 wrote:
> I think I do need the block api!
> The goal is to inspect the first block for having a "class: 'lead'"
> But maybe I do not need the second getDocument()?
> As you can see in the code below my original code did not loop through all 
> the blocks
> I got the page content by (now commented out)
> $topicDefenitionDocument.display('topicDescription','view',$topicDefenitionObject)
> If I could add .getXDOM().getBlocks("class:ParagraphBlock", "DESCENDANT")) to 
> the object in the above?
>
> The title of the page I was able to get without the privileged API, like you 
> stated.
> But the blocks of all class:ParagraphBlock I do need to inspect for the 
> class:'lead'
>
> I do get translated titles when I switch the language
> But the blocks retrieved are only in default language?

Did you tried ? getTranslatedDocument() give you the exact same kind
of object you got before calling it, just that it's not the same
document so you do have getXDOM() API too.

>
> My current code including the query:
> Note the line that works, but will give me
> #foreach($t in $topicList)
>   #set($topicDefenitionDocs = 
> $services.query.xwql("$topicDefenitionQry2").bindValue("topicreference",$t).addFilter("currentlanguage").execute())
>   #if($topicDefenitionDocs != [])
> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>   #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>   
> #set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
>   == 
> $topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) 
> ==
>   
> ##$topicDefenitionDocument.display('topicDescription','view',$topicDefenitionObject)
>   #foreach($ParagraphBlock in 
> $topicDefenitionDocument.getDocument().getTranslatedDocument().getXDOM().getBlocks("class:ParagraphBlock",
>  "DESCENDANT"))
> #if($velocityCount == 1)
>   #set ($blockParent = $ParagraphBlock.getParent())
>   #set ($leadParagraph = $services.rendering.render($ParagraphBlock, 
> "xwiki/2.1"))
>   #if($blockParent.getParameter('class') == 'lead')
>(%class="lead"%)((($leadParagraph)))
>   #else
>$leadParagraph
>   #end
> #end
>   #end
> #end
>   #else
> $t
>   #end
> #end
> __
> From: users  on behalf of Thomas Mortagne 
> 
> Sent: 12 June 2015 11:10
> To: XWiki Users
> Subject: Re: [xwiki-users] Get parts of a page...
>
> On Fri, Jun 12, 2015 at 10:56 AM, Gerritjan Koekkoek
>  wrote:
>> I did as you described.
>> But nope...
>>
>> Can it be related to the object I have the .getDocument() method on?
>> I use XWQL executed with a .addFilter("current language")
>>
>> On the collection of document-references I get from that query I have a 
>> foreach loop.
>> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>>
>> Then I set the variable: 
>> #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>>
>> And that variable I use in the 'Block' statement
>> #foreach($ParagraphBlock in 
>> $topicDefenitionDocument.getDocument().getTranslatedDocument().getXDOM().getBlocks("class:ParagraphBlock",
>>  "DESCENDANT"))
>>
>> So I basicly do the getDocument.getTranslatedDocument on a object that is 
>> already filtered for current language
>
> It has nothing to do with your query, you get the default language
> because you call $xwiki.getDocument with the name of the document
> only.
> But I did not seen that your initial code was actually wrong,
> calling getDocument() twice is useless so the issue does not come from
> getTranslatedDocument(), it comes fro your second getDocument() (which
> by the way only work for you because you have the right to use
> privileged API which you really don't need here).
>
>> When I remove the getTranslatedDocument() it works, but only gives me the 
>> default document language and not the current language
>> When I add the  getTranslatedDocument() I get empty output
>>
>> Gerritjan Koekkoek
>> Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
>> Visit our website
>> Facebook
>> email
>>
>>
>>
>>
>> 
>> From: users  on behalf of Thomas Mortagne 
>> 
>> Sent: 

Re: [xwiki-users] Get parts of a page...

2015-06-12 Thread Gerritjan Koekkoek
When I add .getTranslatedDocument to the first getDocument it works not as 
expected
In default language I do not notice difference, but when changing the language 
the lines that inspect the xObject fail

Maybe it is important to mention that i'm not looking at ordinary XWiki pages, 
but pages created with appWithinMinutes.
We used the virtual fields Title and Content because they have the advantage 
that we can translate the title and content without translating the other 
object-fields.

So getDocument is done before getObject and basically I want to inspect the 
blocks inside the virtual content-field

Gerritjan Koekkoek
Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
Visit our website
Facebook
email





From: users  on behalf of Thomas Mortagne 

Sent: 12 June 2015 12:18
To: XWiki Users
Subject: Re: [xwiki-users] Get parts of a page...

On Fri, Jun 12, 2015 at 12:07 PM, Gerritjan Koekkoek
 wrote:
> I think I do need the block api!
> The goal is to inspect the first block for having a "class: 'lead'"
> But maybe I do not need the second getDocument()?
> As you can see in the code below my original code did not loop through all 
> the blocks
> I got the page content by (now commented out)
> $topicDefenitionDocument.display('topicDescription','view',$topicDefenitionObject)
> If I could add .getXDOM().getBlocks("class:ParagraphBlock", "DESCENDANT")) to 
> the object in the above?
>
> The title of the page I was able to get without the privileged API, like you 
> stated.
> But the blocks of all class:ParagraphBlock I do need to inspect for the 
> class:'lead'
>
> I do get translated titles when I switch the language
> But the blocks retrieved are only in default language?

Did you tried ? getTranslatedDocument() give you the exact same kind
of object you got before calling it, just that it's not the same
document so you do have getXDOM() API too.

>
> My current code including the query:
> Note the line that works, but will give me
> #foreach($t in $topicList)
>   #set($topicDefenitionDocs = 
> $services.query.xwql("$topicDefenitionQry2").bindValue("topicreference",$t).addFilter("currentlanguage").execute())
>   #if($topicDefenitionDocs != [])
> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>   #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>   
> #set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
>   == 
> $topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) 
> ==
>   
> ##$topicDefenitionDocument.display('topicDescription','view',$topicDefenitionObject)
>   #foreach($ParagraphBlock in 
> $topicDefenitionDocument.getDocument().getTranslatedDocument().getXDOM().getBlocks("class:ParagraphBlock",
>  "DESCENDANT"))
> #if($velocityCount == 1)
>   #set ($blockParent = $ParagraphBlock.getParent())
>   #set ($leadParagraph = $services.rendering.render($ParagraphBlock, 
> "xwiki/2.1"))
>   #if($blockParent.getParameter('class') == 'lead')
>    (%class="lead"%)((($leadParagraph)))
>   #else
>$leadParagraph
>   #end
> #end
>   #end
> #end
>   #else
> $t
>   #end
> #end
> __
> From: users  on behalf of Thomas Mortagne 
> 
> Sent: 12 June 2015 11:10
> To: XWiki Users
> Subject: Re: [xwiki-users] Get parts of a page...
>
> On Fri, Jun 12, 2015 at 10:56 AM, Gerritjan Koekkoek
>  wrote:
>> I did as you described.
>> But nope...
>>
>> Can it be related to the object I have the .getDocument() method on?
>> I use XWQL executed with a .addFilter("current language")
>>
>> On the collection of document-references I get from that query I have a 
>> foreach loop.
>> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>>
>> Then I set the variable: 
>> #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>>
>> And that variable I use in the 'Block' statement
>> #foreach($ParagraphBlock in 
>> $topicDefenitionDocument.getDocument().getTranslatedDocument().getXDOM().getBlocks("class:ParagraphBlock",
>>  "DESCENDANT"))
>>
>> So I basicly do the getDocument.getTranslatedDocument on a object that is 
>> already filtered for current language
>
> It has nothing to do with your query, you get the default language
> because you call $xwiki.getDocument with the name of the docume

Re: [xwiki-users] Get parts of a page...

2015-06-12 Thread Thomas Mortagne
On Fri, Jun 12, 2015 at 12:39 PM, Gerritjan Koekkoek
 wrote:
> When I add .getTranslatedDocument to the first getDocument it works not as 
> expected
> In default language I do not notice difference, but when changing the 
> language the lines that inspect the xObject fail

The xobjects are located in the default language only.

>
> Maybe it is important to mention that i'm not looking at ordinary XWiki 
> pages, but pages created with appWithinMinutes.
> We used the virtual fields Title and Content because they have the advantage 
> that we can translate the title and content without translating the other 
> object-fields.
>
> So getDocument is done before getObject and basically I want to inspect the 
> blocks inside the virtual content-field
>
> Gerritjan Koekkoek
> Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
> Visit our website
> Facebook
> email
>
>
>
>
> 
> From: users  on behalf of Thomas Mortagne 
> 
> Sent: 12 June 2015 12:18
> To: XWiki Users
> Subject: Re: [xwiki-users] Get parts of a page...
>
> On Fri, Jun 12, 2015 at 12:07 PM, Gerritjan Koekkoek
>  wrote:
>> I think I do need the block api!
>> The goal is to inspect the first block for having a "class: 'lead'"
>> But maybe I do not need the second getDocument()?
>> As you can see in the code below my original code did not loop through all 
>> the blocks
>> I got the page content by (now commented out)
>> $topicDefenitionDocument.display('topicDescription','view',$topicDefenitionObject)
>> If I could add .getXDOM().getBlocks("class:ParagraphBlock", "DESCENDANT")) 
>> to the object in the above?
>>
>> The title of the page I was able to get without the privileged API, like you 
>> stated.
>> But the blocks of all class:ParagraphBlock I do need to inspect for the 
>> class:'lead'
>>
>> I do get translated titles when I switch the language
>> But the blocks retrieved are only in default language?
>
> Did you tried ? getTranslatedDocument() give you the exact same kind
> of object you got before calling it, just that it's not the same
> document so you do have getXDOM() API too.
>
>>
>> My current code including the query:
>> Note the line that works, but will give me
>> #foreach($t in $topicList)
>>   #set($topicDefenitionDocs = 
>> $services.query.xwql("$topicDefenitionQry2").bindValue("topicreference",$t).addFilter("currentlanguage").execute())
>>   #if($topicDefenitionDocs != [])
>> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>>   #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc))
>>   
>> #set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName))
>>   == 
>> $topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) 
>> ==
>>   
>> ##$topicDefenitionDocument.display('topicDescription','view',$topicDefenitionObject)
>>   #foreach($ParagraphBlock in 
>> $topicDefenitionDocument.getDocument().getTranslatedDocument().getXDOM().getBlocks("class:ParagraphBlock",
>>  "DESCENDANT"))
>> #if($velocityCount == 1)
>>   #set ($blockParent = $ParagraphBlock.getParent())
>>       #set ($leadParagraph = $services.rendering.render($ParagraphBlock, 
>> "xwiki/2.1"))
>>   #if($blockParent.getParameter('class') == 'lead')
>>(%class="lead"%)((($leadParagraph)))
>>   #else
>>$leadParagraph
>>   #end
>> #end
>>   #end
>> #end
>>   #else
>> $t
>>   #end
>> #end
>> __
>> From: users  on behalf of Thomas Mortagne 
>> 
>> Sent: 12 June 2015 11:10
>> To: XWiki Users
>> Subject: Re: [xwiki-users] Get parts of a page...
>>
>> On Fri, Jun 12, 2015 at 10:56 AM, Gerritjan Koekkoek
>>  wrote:
>>> I did as you described.
>>> But nope...
>>>
>>> Can it be related to the object I have the .getDocument() method on?
>>> I use XWQL executed with a .addFilter("current language")
>>>
>>> On the collection of document-references I get from that query I have a 
>>> foreach loop.
>>> #foreach($topicDefenitionDoc in $topicDefenitionDocs)
>>>
>>> Then I set the variable: 
>>> #set($topicDefenitionDocument=$xwiki.getD