Re: [xwiki-users] Display Blog of specific Category on Main.WebHome

2014-01-16 Thread Marius Dumitru Florea
On Wed, Jan 15, 2014 at 10:26 PM, PSwamy pree...@comdata.com wrote:
 Well, I tried something using Xwiki Query Manager. Code below -

 {{velocity}}
 #set($resultDocuments = $services.query.xwql(from
 doc.object(Blog.BlogPostClass) as blog where blog.published = '1' and
 :category member of blog.category and blog.hidden = '0' and doc.web =
 'Blog').execute())
 #foreach($resultDocument in $resultDocuments)
 $resultDocument
 #end
 {{/velocity}}

 I get this below error. What is programming right and how do I enable this
 right?

I don't get this error. I get another one, because you didn't bind the
parameter value. So adding

.bindValue('category', 'Blog.News')

before executing the query fixes the problem for me. See
http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module#HXWiki-specificextensionsinXWQLoverJPQL
for what a short form query is. As for what Programming Right is, it
controls whether users can use protected APIs  Groovy code in wiki
pages.

Hope this helps,
Marius


 Caused by: org.xwiki.query.QueryException: Full form statements requires
 programming right. Query statement = [select doc.fullName where from
 doc.object(Blog.BlogPostClass) as blog where blog.published = '1' and
 :category member of blog.category and blog.hidden = '0' and doc.web =
 'Blog'] at
 org.xwiki.query.internal.SecureQueryExecutorManager.execute(SecureQueryExecutorManager.java:88)
 at org.xwiki.query.internal.DefaultQuery.execute(DefaultQuery.java:248) at
 org.xwiki.query.internal.ScriptQuery.execute(ScriptQuery.java:236)



 --
 View this message in context: 
 http://xwiki.475771.n2.nabble.com/Display-Blog-of-specific-Category-on-Main-WebHome-tp7588653p7588665.html
 Sent from the XWiki- Users mailing list archive at Nabble.com.
 ___
 users mailing list
 users@xwiki.org
 http://lists.xwiki.org/mailman/listinfo/users
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Display Blog of specific Category on Main.WebHome

2014-01-16 Thread PSwamy
Thank you all for your input. Here is a snippet of code that solves my
problem. 

{{include document=Blog.BlogCode/}}
{{velocity filter=none}}
{{html clean=false wiki=true}}
#set($blogDoc = $xwiki.getDocument(Blog.Webhome))
#getBlogEntries($blogDoc $entries) 

#foreach ($entryDoc in $xwiki.wrapDocs($entries))
   #getEntryObject($entryDoc $entryObj)
   #if($entryObj.getxWikiClass().getName() == $blogPostClassname)
#set($categories = $entryObj.getProperty('category').value)
#set($first = true)
#if($categories.size()  0)
   #foreach($category in $categories)
 ## Do not indent
 #set($categoryDoc = $!xwiki.getDocument($category))
 #set($result =
$!categoryDoc.getObject(${blogCategoryClassname}).getProperty('name').value.trim())
 #if($result == 'Category1234')
   #displayEntry($entryDoc $entryObj true true)
 #end
   #end
#end
   #end
#end
{{/html}}
{{/velocity}}



--
View this message in context: 
http://xwiki.475771.n2.nabble.com/Display-Blog-of-specific-Category-on-Main-WebHome-tp7588653p7588688.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] Display Blog of specific Category on Main.WebHome

2014-01-15 Thread Kaisen
I'm not known in the velocity scripts but I implement the Blog entries as a RSS 
feed. Maybe that helps you in a other way.

Regards Kai

Send from a smartphone

 Am 15.01.2014 um 21:26 schrieb PSwamy pree...@comdata.com:
 
 Well, I tried something using Xwiki Query Manager. Code below -
 
 {{velocity}} 
 #set($resultDocuments = $services.query.xwql(from
 doc.object(Blog.BlogPostClass) as blog where blog.published = '1' and
 :category member of blog.category and blog.hidden = '0' and doc.web =
 'Blog').execute()) 
 #foreach($resultDocument in $resultDocuments) 
 $resultDocument 
 #end 
 {{/velocity}} 
 
 I get this below error. What is programming right and how do I enable this
 right?
 
 Caused by: org.xwiki.query.QueryException: Full form statements requires
 programming right. Query statement = [select doc.fullName where from
 doc.object(Blog.BlogPostClass) as blog where blog.published = '1' and
 :category member of blog.category and blog.hidden = '0' and doc.web =
 'Blog'] at
 org.xwiki.query.internal.SecureQueryExecutorManager.execute(SecureQueryExecutorManager.java:88)
 at org.xwiki.query.internal.DefaultQuery.execute(DefaultQuery.java:248) at
 org.xwiki.query.internal.ScriptQuery.execute(ScriptQuery.java:236)
 
 
 
 --
 View this message in context: 
 http://xwiki.475771.n2.nabble.com/Display-Blog-of-specific-Category-on-Main-WebHome-tp7588653p7588665.html
 Sent from the XWiki- Users mailing list archive at Nabble.com.
 ___
 users mailing list
 users@xwiki.org
 http://lists.xwiki.org/mailman/listinfo/users
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


[xwiki-users] Display Blog of specific Category on Main.WebHome

2014-01-14 Thread preethi
Hi All, I want to display Blog of specific category on the main page. I want
to keep the existing content (an image and mostly text) and also include a
section for blog roll tagged as 'News'. Is there a way to display/include
the latest blog entry tagged to a certain category? Thanks in advance for
your time.

-Priti



--
View this message in context: 
http://xwiki.475771.n2.nabble.com/Display-Blog-of-specific-Category-on-Main-WebHome-tp7588653.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