[xwiki-users] Panel aware of page
Is there a way that a panel can be aware of the current page context so I can enable and disable graphics based on which page is currently active? -- View this message in context: http://www.nabble.com/Panel-aware-of-page-tp17458341p17458341.html Sent from the XWiki- Users mailing list archive at Nabble.com.
#if($doc.name = "SpaceName.PageName")<Some graphics here> #else <Some other graphics here> #end Is that what you would need ? Guillaume On Sun, May 25, 2008 at 5:57 PM, Vincent Massol <[email protected]> wrote:
On May 25, 2008, at 4:16 PM, Mike Oliver wrote:
Is there a way that a panel can be aware of the current page context so I can enable and disable graphics based on which page is currently active?
$doc?
Thanks -Vincent _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Guillaume Lerouge wrote:
#if($doc.name = "SpaceName.PageName")<Some graphics here>
You meant #if($doc.fullName == "SpaceName.PageName"), right?
#else <Some other graphics here> #end
Is that what you would need ?
Guillaume
On Sun, May 25, 2008 at 5:57 PM, Vincent Massol <[email protected]> wrote:
On May 25, 2008, at 4:16 PM, Mike Oliver wrote:
Is there a way that a panel can be aware of the current page context so I can enable and disable graphics based on which page is currently active? $doc?
-- Sergiu Dumitriu http://purl.org/net/sergiu/
Bingo we have a winner, yes that's what I was looking for. Sergiu Dumitriu-2 wrote:
Guillaume Lerouge wrote:
#if($doc.name = "SpaceName.PageName")<Some graphics here>
You meant #if($doc.fullName == "SpaceName.PageName"), right?
#else <Some other graphics here> #end
Is that what you would need ?
Guillaume
On Sun, May 25, 2008 at 5:57 PM, Vincent Massol <[email protected]> wrote:
On May 25, 2008, at 4:16 PM, Mike Oliver wrote:
Is there a way that a panel can be aware of the current page context so I can enable and disable graphics based on which page is currently active? $doc?
-- Sergiu Dumitriu http://purl.org/net/sergiu/ _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- View this message in context: http://www.nabble.com/Panel-aware-of-page-tp17458341p17474026.html Sent from the XWiki- Users mailing list archive at Nabble.com.
Hmmm, so why doesn't this work? I get results from the query, and build the display. I want the panel where this resides to have an UpIcon and a DownIcon for all pages where the panel is displayed except when the panel is displayed on the current page where I want both the UpIcon and DownIcon the same as the DownIcon. Currently the if statement always evaluates false. #set ($hql = ", BaseObject as obj, LongProperty prop where obj.name=doc.fullName and obj.className='XWiki.ToolbarClass' and obj.name<>'XWiki.ToolbarClassTemplate' and obj.id=prop.id.id and prop.id.name='Order' order by prop.value") #set ($toolbars= $xwiki.searchDocuments($hql)) #if ($toolbars.size() > 0) #foreach ($toolbar in $toolbars) #set ($itemdoc = $xwiki.getDocument($toolbar)) #set ($itemobject = $itemdoc.getObject('XWiki.ToolbarClass')) #if($doc.fullName == $itemdoc.fullName ) #set ($imgsrc0 = $xwiki.getAttachmentURL("$itemdoc","$itemdoc.display('DownIcon')")) #set ($imgsrc1 = $xwiki.getAttachmentURL("$itemdoc","$itemdoc.display('DownIcon')")) #else #set ($imgsrc0 = $xwiki.getAttachmentURL("$itemdoc","$itemdoc.display('UpIcon')")) #set ($imgsrc1 = $xwiki.getAttachmentURL("$itemdoc","$itemdoc.display('DownIcon')")) #end ... Mike Oliver wrote:
Bingo we have a winner, yes that's what I was looking for.
Sergiu Dumitriu-2 wrote:
Guillaume Lerouge wrote:
#if($doc.name = "SpaceName.PageName")<Some graphics here>
You meant #if($doc.fullName == "SpaceName.PageName"), right?
#else <Some other graphics here> #end
Is that what you would need ?
Guillaume
On Sun, May 25, 2008 at 5:57 PM, Vincent Massol <[email protected]> wrote:
On May 25, 2008, at 4:16 PM, Mike Oliver wrote:
Is there a way that a panel can be aware of the current page context so I can enable and disable graphics based on which page is currently active? $doc?
-- Sergiu Dumitriu http://purl.org/net/sergiu/ _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- View this message in context: http://www.nabble.com/Panel-aware-of-page-tp17458341p17474647.html Sent from the XWiki- Users mailing list archive at Nabble.com.
Hi Mike, Hmmm, so why doesn't this work? I get results from the query, and build the
display. I want the panel where this resides to have an UpIcon and a DownIcon for all pages where the panel is displayed except when the panel is displayed on the current page where I want both the UpIcon and DownIcon the same as the DownIcon.
Currently the if statement always evaluates false.
#set ($hql = ", BaseObject as obj, LongProperty prop where obj.name=doc.fullName and obj.className='XWiki.ToolbarClass' and obj.name<>'XWiki.ToolbarClassTemplate' and obj.id=prop.id.id and prop.id.name='Order' order by prop.value") #set ($toolbars= $xwiki.searchDocuments($hql)) #if ($toolbars.size() > 0) #foreach ($toolbar in $toolbars) #set ($itemdoc = $xwiki.getDocument($toolbar)) #set ($itemobject = $itemdoc.getObject('XWiki.ToolbarClass')) #if($doc.fullName == $itemdoc.fullName ) #set ($imgsrc0 = $xwiki.getAttachmentURL("$itemdoc","$itemdoc.display('DownIcon')")) #set ($imgsrc1 = $xwiki.getAttachmentURL("$itemdoc","$itemdoc.display('DownIcon')")) #else #set ($imgsrc0 = $xwiki.getAttachmentURL("$itemdoc","$itemdoc.display('UpIcon')")) #set ($imgsrc1 = $xwiki.getAttachmentURL("$itemdoc","$itemdoc.display('DownIcon')")) #end ...
There's 2 #if and only 1 #end in your code, is it closed at a later stage ? Guillaume
Yes here is the full contents of the panel #panelheader("Data Tools") #set ($hql = ", BaseObject as obj, LongProperty prop where obj.name=doc.fullName and obj.className='XWiki.ToolbarClass' and obj.name<>'XWiki.ToolbarClassTemplate' and obj.id=prop.id.id and prop.id.name='Order' order by prop.value") #set ($toolbars= $xwiki.searchDocuments($hql)) #if ($toolbars.size() > 0) #foreach ($toolbar in $toolbars) #set ($itemdoc = $xwiki.getDocument($toolbar)) #set ($itemobject = $itemdoc.getObject('XWiki.ToolbarClass')) #if($doc.fullName == $itemdoc.fullName ) #set ($imgsrc0 = $xwiki.getAttachmentURL("$itemdoc","$itemdoc.display('DownIcon')")) #set ($imgsrc1 = $xwiki.getAttachmentURL("$itemdoc","$itemdoc.display('DownIcon')")) #else #set ($imgsrc0 = $xwiki.getAttachmentURL("$itemdoc","$itemdoc.display('UpIcon')")) #set ($imgsrc1 = $xwiki.getAttachmentURL("$itemdoc","$itemdoc.display('DownIcon')")) #end #set ($alttip = $itemdoc.display('Description')) #set ($panelft = $itemdoc.display('Panel')) #set ($imgref = "document." + $itemdoc.display('Title') + ".src") #if ( $panelft == 'DataTools') <SCRIPT TYPE="text/javascript" LANGUAGE="javascript"> <!-- function $itemdoc.display('Title')_up(imgtag) { imgtag.src="$imgsrc0"; } function $itemdoc.display('Title')_down(imgtag) { imgtag.src="$imgsrc1"; } //--> </SCRIPT> <div align="right"> [$itemdoc.display('Title')>$toolbar] /xwiki/bin/view/$itemdoc.display('GotoPage') $imgsrc0 </div> #end #end #else #info("There are no Toolbar documents in this wiki!") #end #panelfooter() Guillaume Lerouge wrote:
Hi Mike,
Hmmm, so why doesn't this work? I get results from the query, and build the
display. I want the panel where this resides to have an UpIcon and a DownIcon for all pages where the panel is displayed except when the panel is displayed on the current page where I want both the UpIcon and DownIcon the same as the DownIcon.
Currently the if statement always evaluates false.
#set ($hql = ", BaseObject as obj, LongProperty prop where obj.name=doc.fullName and obj.className='XWiki.ToolbarClass' and obj.name<>'XWiki.ToolbarClassTemplate' and obj.id=prop.id.id and prop.id.name='Order' order by prop.value") #set ($toolbars= $xwiki.searchDocuments($hql)) #if ($toolbars.size() > 0) #foreach ($toolbar in $toolbars) #set ($itemdoc = $xwiki.getDocument($toolbar)) #set ($itemobject = $itemdoc.getObject('XWiki.ToolbarClass')) #if($doc.fullName == $itemdoc.fullName ) #set ($imgsrc0 = $xwiki.getAttachmentURL("$itemdoc","$itemdoc.display('DownIcon')")) #set ($imgsrc1 = $xwiki.getAttachmentURL("$itemdoc","$itemdoc.display('DownIcon')")) #else #set ($imgsrc0 = $xwiki.getAttachmentURL("$itemdoc","$itemdoc.display('UpIcon')")) #set ($imgsrc1 = $xwiki.getAttachmentURL("$itemdoc","$itemdoc.display('DownIcon')")) #end ...
There's 2 #if and only 1 #end in your code, is it closed at a later stage ?
Guillaume _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- View this message in context: http://www.nabble.com/Panel-aware-of-page-tp17458341p17475639.html Sent from the XWiki- Users mailing list archive at Nabble.com.
Solved, The line below #if($doc.fullName == $itemdoc.fullName ) was comparing apples to oranges. the itemdoc had a property that wasused to create the link and it was called GotoPage so #if($doc.fullName == $gotoprop.value ) and now the icons get toggled properly. Mike Oliver wrote:
Hmmm, so why doesn't this work? I get results from the query, and build the display. I want the panel where this resides to have an UpIcon and a DownIcon for all pages where the panel is displayed except when the panel is displayed on the current page where I want both the UpIcon and DownIcon the same as the DownIcon.
Currently the if statement always evaluates false.
#set ($hql = ", BaseObject as obj, LongProperty prop where obj.name=doc.fullName and obj.className='XWiki.ToolbarClass' and obj.name<>'XWiki.ToolbarClassTemplate' and obj.id=prop.id.id and prop.id.name='Order' order by prop.value") #set ($toolbars= $xwiki.searchDocuments($hql)) #if ($toolbars.size() > 0) #foreach ($toolbar in $toolbars) #set ($itemdoc = $xwiki.getDocument($toolbar)) #set ($itemobject = $itemdoc.getObject('XWiki.ToolbarClass')) #if($doc.fullName == $itemdoc.fullName ) #set ($imgsrc0 = $xwiki.getAttachmentURL("$itemdoc","$itemdoc.display('DownIcon')")) #set ($imgsrc1 = $xwiki.getAttachmentURL("$itemdoc","$itemdoc.display('DownIcon')")) #else #set ($imgsrc0 = $xwiki.getAttachmentURL("$itemdoc","$itemdoc.display('UpIcon')")) #set ($imgsrc1 = $xwiki.getAttachmentURL("$itemdoc","$itemdoc.display('DownIcon')")) #end ...
Mike Oliver wrote:
Bingo we have a winner, yes that's what I was looking for.
Sergiu Dumitriu-2 wrote:
Guillaume Lerouge wrote:
#if($doc.name = "SpaceName.PageName")<Some graphics here>
You meant #if($doc.fullName == "SpaceName.PageName"), right?
#else <Some other graphics here> #end
Is that what you would need ?
Guillaume
On Sun, May 25, 2008 at 5:57 PM, Vincent Massol <[email protected]> wrote:
On May 25, 2008, at 4:16 PM, Mike Oliver wrote:
Is there a way that a panel can be aware of the current page context so I can enable and disable graphics based on which page is currently active? $doc?
-- Sergiu Dumitriu http://purl.org/net/sergiu/ _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- View this message in context: http://www.nabble.com/Panel-aware-of-page-tp17458341p17516147.html Sent from the XWiki- Users mailing list archive at Nabble.com.
participants (4)
-
Guillaume Lerouge -
Mike Oliver -
Sergiu Dumitriu -
Vincent Massol