Re: [xwiki-users] Private Wiki vs Login Page
Meanwhile we solved the issue: - No view permissions for XWikiGuest on wiki level - Edit startpage.vm: #if ($xcontext.user != 'XWiki.XWikiGuest') #if($displayMainMenu) #template("menus_view.vm") #end #end - Some more minor tweaks in login.vm What is left are six errors in the browser debug window: Failed to load resource: the server responded with a status of 401 (Unauthorized) http://wiki.fra.shift.agency/xwiki/bin/login/XWiki/XWikiLogin?srid=N214sE8S…%2Fbin%2Fssx%2FAnnotationCode%2FSettings%3Flanguage%3Dde%26srid%3DN214sE8S Failed to load resource: the server responded with a status of 401 (Unauthorized) http://wiki.fra.shift.agency/xwiki/bin/login/XWiki/XWikiLogin?srid=4Y4kLi2D…i%2Fbin%2Fjsx%2FCKEditor%2FEditMenuEntry%3Flanguage%3Dde%26srid%3D4Y4kLi2D Failed to load resource: the server responded with a status of 401 (Unauthorized) http://wiki.fra.shift.agency/xwiki/bin/login/XWiki/XWikiLogin?srid=lMahZtTx…ki%2Fbin%2Fjsx%2FAnnotationCode%2FScript%3Flanguage%3Dde%26srid%3DlMahZtTx Failed to load resource: the server responded with a status of 401 (Unauthorized) http://wiki.fra.shift.agency/xwiki/bin/login/XWiki/XWikiLogin?srid=bQAoWhzJ…%2Fbin%2Fjsx%2FAnnotationCode%2FSettings%3Flanguage%3Dde%26srid%3DbQAoWhzJ Failed to load resource: the server responded with a status of 401 (Unauthorized) http://wiki.fra.shift.agency/xwiki/bin/login/XWiki/XWikiLogin?srid=OV83gKnm…iki%2Fbin%2Fssx%2FAnnotationCode%2FStyle%3Flanguage%3Dde%26srid%3DOV83gKnm Failed to load resource: the server responded with a status of 401 (Unauthorized) http://wiki.fra.shift.agency/xwiki/bin/login/XWiki/XWikiLogin?srid=N214sE8S…%2Fbin%2Fssx%2FAnnotationCode%2FSettings%3Flanguage%3Dde%26srid%3DN214sE8S Failed to load resource: the server responded with a status of 401 (Unauthorized) I think we have to write our one login page without ressources from inside the wiki. What do you think? Thanks again for your very valuable support! Tobias -- View this message in context: http://xwiki.475771.n2.nabble.com/Private-Wiki-vs-Login-Page-tp7595071p7595130.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] Get parts of a page...
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.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 >> privi
Re: [xwiki-users] Get parts of a page...
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 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 >>
[xwiki-users] The future of the Spaces macro in the context of Nested Spaces/Documents
Hi guys, The wiki home page displays, by default, the list of spaces that exist in the wiki (hidden or not, depending on the user profile settings). This is done using the http://extensions.xwiki.org/xwiki/bin/view/Extension/Spaces+Macro . As we have started to work on adding support for nested spaces/documents, we need to review the purpose of this macro. Is it still relevant to display a list of spaces when there is a tree hierarchy? It only makes sense if you want to display just the list of direct children of a given node. I see the following options: (1) Display the list of top level nodes (space/document) on the wiki home page. No tree. The rationale is that loading the tree (even if done lazy) is more expensive that displaying a static list of links. For this we can extend the Spaces Macro with a parameter to specify the parent node. When this parameter is not specified the macro will list the top level nodes. (In the context of nested documents we could introduce a new macro Document List instead) (2) Display the tree hierarchy on the wiki home page, using http://extensions.xwiki.org/xwiki/bin/view/Extension/Document+Tree+Macro .Of course, the tree will be lazy loaded, and only the top level nodes are displayed initially. If we do this then we can probably deprecate the Spaces Macro and advice the users to use the Document Tree Macro instead. WDYT? Thanks, Marius ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] basic auth in url
Hi, Can I create link with login and password inside? I want to avoid logging process :) Greetings, Maciek. ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
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 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 (cd
Re: [xwiki-users] Get parts of a page...
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 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
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 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)) == $topicDe
Re: [xwiki-users] Get parts of a page...
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','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: >>> $Paragra
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','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