Code to display in html table
#set($hql = "<query here>")
#set($results = $xwiki.searchDocuments($hql, 5, 0))
### html table code
|=doc name|=author
#foreach ($item in $results)
|$item |$xwiki.getUserName($item.getAuthor())
#end
more options in :
2010/7/13 Sales, G. (Grant) <Grant.Sales(a)us.ing.com>
Thanks, That actually worked the way I wanted. Less
code too.
Any idea how I can make the output into two columns?
-----Original Message-----
From: devs-bounces(a)xwiki.org [mailto:devs-bounces@xwiki.org] On Behalf
Of farouk korteby
Sent: Tuesday, July 13, 2010 09:26 AM
To: XWiki Developers
Subject: Re: [xwiki-devs] For Each loop help
I guess it's better :
*#set($userObj =
$xwiki.getDocument($ShiftLog.getAuthor()).getObject('XWiki.XWikiUsers'))
*
*[[$userObj.get('email')>>mailto:$userObj.get('email')]]*
This API could help you :
http://platform.xwiki.org/xwiki/bin/download/DevGuide/API/xwiki-core-2.3
.2-javadoc.jar/com/xpn/xwiki/api/XWiki.html#getUserName%28java.lang.Stri
ng,%20java.lang.String,%20boolean%29
Good luck.
2010/7/13 Sales, G. (Grant) <Grant.Sales(a)us.ing.com>
$xwiki.getDocument($ShiftLog.getAuthor()).getObject('XWiki.XWikiUsers').
> getProperty('email').getValue()"
> That worked great!
> I didn't know that I needed to
call the $ShiftLog
> And yes, if $doc.title !=
ShiftLogSheet makes it so my sheet doesn't
> display in the results. Or at least I think, I copied the coded from
>
xwiki.org it's the FAQ application code.
> If there was a way to make that a link to open outlook that would be
> nice.
> Like
> <a href="mailto:
$xwiki.getDocument($ShiftLog.getAuthor()).getObject('XWiki.XWikiUsers').
>
getProperty('email').getValue()">$xwiki.getDocument($ShiftLog.getAutho
> r(
>
)).getObject('XWiki.XWikiUsers').getProperty('email').getValue()</a>
> But that is HTML and too complicated
to intigrate into the velocity
> code.
> Is there an easy way to format
the results into two columns.
> On the left being the doc names and on the right being the author.
> ~thanks, Grant
> -----Original Message-----
> From: devs-bounces(a)xwiki.org [mailto:devs-bounces@xwiki.org] On Behalf
> Of Marius Dumitru Florea
> Sent: Tuesday, July 13, 2010 12:30 AM
> To: devs(a)xwiki.org
> Subject: Re: [xwiki-devs] For Each loop help
> Hi Grant,
> On 07/12/2010 05:28 PM, Sales, G.
(Grant) wrote:
> > == Shift Turnover Logs ==
>
> > {{velocity}}
> > #set($sql = ", BaseObject as obj where obj.name=doc.fullName and
> > obj.className='ShiftLog.ShiftLogClass' and
> > obj.name<>'ShiftLog.ShiftLogTemplate' order by doc.creationDate
> > desc")
> > ##set($sql = ", BaseObject
as obj where obj.name=doc.fullName and
> > obj.className='ShiftLog.ShiftLogClass' and
> > obj.name<>'ShiftLog.ShiftLogTemplate'")
> > #set($results = $xwiki.searchDocuments($sql))
> I suppose $results contains the
expected items, right? You can test by
> displaying $item in the following loop.
> > #if($results.empty)
> > No Shift Logs has been created yet!
> > #else
> > #foreach ($item in $results)
> > #if($doc.title !=
"ShiftLogSheet")
> Are you sure you want to test the
$doc.title? $doc is the current
> document (e.g. the document containing this velocity code). This test
> is not affected by the loop and thus executing it in each loop doesn't
> seem right. Maybe you should test $item (a document name) or
> $ShiftLog.title .
> > #set($ShiftLog =
$xwiki.getDocument($item))
>
> > *
[[${ShiftLog.display("question").replace("<p>",
> > "").replace("</p>", "")}>>${item}]]
> >
$xwiki.getDocument($doc.getAuthor()).getObject('XWiki.XWikiUsers').g
> > et
> > Pr
> > operty('email').getValue()
> This line displays the same thing in
all the loops. Maybe you wanted
> to write $ShiftLog.getAuthor() instead of $doc.getAuthor() ?
> Hope this helps,
> Marius
> > #end
> > #end
> > #end
> > {{/velocity}}
> > )))
> > )))
>
> > All I want to do is display
who edited the file last. All this is
> > currently doing is showing who made the Shift Log.WebHome
>
> > Thanks, Grant
>
>
>
>
> > Grant Sales
> > Security Operations Analyst
> > ING
> > 111 Washington Ave South
> > Minneapolis, MN 55401
> > Tel: 612.342.7889
> > Fax: 612.342.3428
> > Cell: 320.761.0966
> > Email: grant.sales(a)us.ing.com
> >
www.ing-usa.com
> > ING. Your future. Made easier. (r)
>
>
>
> >
---------------------------------------------------------
>
> > NOTICE: The information
contained in this electronic mail message is
> confidential and intended only for certain recipients. If you are not
an intended recipient, you are hereby notified
that any disclosure,
reproduction, distribution or other use of this communication and any
attachments is strictly prohibited. If you have received this
communication in error, please notify the sender by reply transmission
> and delete the message without copying or disclosing it.
>
> >
====================================================================
> > == ======================
> > _______________________________________________
> > devs mailing list
> > devs(a)xwiki.org
> >
http://lists.xwiki.org/mailman/listinfo/devs
> _______________________________________________
> devs mailing list
> devs(a)xwiki.org
>
http://lists.xwiki.org/mailman/listinfo/devs
> _______________________________________________
> devs mailing list
> devs(a)xwiki.org
>
http://lists.xwiki.org/mailman/listinfo/devs
--
Farouk Korteby
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs