[xwiki-devs] For Each loop help
== 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)) #if($results.empty) No Shift Logs has been created yet! #else #foreach ($item in $results) #if($doc.title != "ShiftLogSheet") #set($ShiftLog = $xwiki.getDocument($item)) * [[${ShiftLog.display("question").replace("<p>", "").replace("</p>", "")}>>${item}]] $xwiki.getDocument($doc.getAuthor()).getObject('XWiki.XWikiUsers').getPr operty('email').getValue() #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: [email protected] 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. ============================================================================================
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').getPr 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: [email protected] 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 [email protected] http://lists.xwiki.org/mailman/listinfo/devs
$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.getAuthor( )).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: [email protected] [mailto:[email protected]] On Behalf Of Marius Dumitru Florea Sent: Tuesday, July 13, 2010 12:30 AM To: [email protected] 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').get 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: [email protected] 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 [email protected] http://lists.xwiki.org/mailman/listinfo/devs
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
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-j... Good luck. 2010/7/13 Sales, G. (Grant) <[email protected]>
$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.getAuthor( )).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: [email protected] [mailto:[email protected]] On Behalf Of Marius Dumitru Florea Sent: Tuesday, July 13, 2010 12:30 AM To: [email protected] 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').get 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: [email protected] 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 [email protected] http://lists.xwiki.org/mailman/listinfo/devs
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Farouk Korteby
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: [email protected] [mailto:[email protected]] 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) <[email protected]>
$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: [email protected] [mailto:[email protected]] On Behalf
Of Marius Dumitru Florea Sent: Tuesday, July 13, 2010 12:30 AM To: [email protected] 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: [email protected] 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 [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Farouk Korteby _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
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 : http://platform.xwiki.org/xwiki/bin/view/Main/XWikiSyntax#HTables 2010/7/13 Sales, G. (Grant) <[email protected]>
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: [email protected] [mailto:[email protected]] 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) <[email protected]>
$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: [email protected] [mailto:[email protected]] On Behalf
Of Marius Dumitru Florea Sent: Tuesday, July 13, 2010 12:30 AM To: [email protected] 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: [email protected] 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 [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Farouk Korteby _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Farouk Korteby
I know how to make a table, I was just hoping for something like the xwiki.org's FAQ page. How it has two columns, one for answered questions and one for unanswered questions. But maybe I need to filter by a field (like active or inactive, a check box in my template for the shift logs) for each column. Not really sure unless I can see the code for xwiki.org's FAQ page. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of farouk korteby Sent: Tuesday, July 13, 2010 09:41 AM To: XWiki Developers Subject: Re: [xwiki-devs] For Each loop help 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 : http://platform.xwiki.org/xwiki/bin/view/Main/XWikiSyntax#HTables 2010/7/13 Sales, G. (Grant) <[email protected]>
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: [email protected] [mailto:[email protected]] 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.St ri ng,%20java.lang.String,%20boolean%29
Good luck.
2010/7/13 Sales, G. (Grant) <[email protected]>
$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.getAut ho 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: [email protected] [mailto:[email protected]] On Behalf
Of Marius Dumitru Florea Sent: Tuesday, July 13, 2010 12:30 AM To: [email protected] 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: [email protected] 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 [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Farouk Korteby _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Farouk Korteby _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
I guess this is good macro : http://code.xwiki.org/xwiki/bin/view/Macros/LiveTableMacro <http://code.xwiki.org/xwiki/bin/view/Macros/LiveTableMacro>You can do every-things with http://platform.xwiki.org/xwiki/bin/view/DevGuide/LiveTable 2010/7/13 Sales, G. (Grant) <[email protected]>
I know how to make a table, I was just hoping for something like the xwiki.org's FAQ page. How it has two columns, one for answered questions and one for unanswered questions.
But maybe I need to filter by a field (like active or inactive, a check box in my template for the shift logs) for each column. Not really sure unless I can see the code for xwiki.org's FAQ page.
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of farouk korteby Sent: Tuesday, July 13, 2010 09:41 AM To: XWiki Developers Subject: Re: [xwiki-devs] For Each loop help
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 : http://platform.xwiki.org/xwiki/bin/view/Main/XWikiSyntax#HTables
2010/7/13 Sales, G. (Grant) <[email protected]>
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: [email protected] [mailto:[email protected]] 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.St ri ng,%20java.lang.String,%20boolean%29
Good luck.
2010/7/13 Sales, G. (Grant) <[email protected]>
$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.getAut ho 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: [email protected] [mailto:[email protected]] On Behalf
Of Marius Dumitru Florea Sent: Tuesday, July 13, 2010 12:30 AM To: [email protected] 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: [email protected] 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 [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Farouk Korteby _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Farouk Korteby _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Farouk Korteby
participants (4)
-
farouk korteby -
farouk korteby -
Marius Dumitru Florea -
Sales, G. (Grant)