Ok proding right along I got the icon attached to the toolbar page to
display for each in the toolbars list, but the link on the image doesn't
work.
Here is the latest...
#set ($hql = ", BaseObject as obj where obj.name=doc.fullName
and obj.className='XWiki.ToolbarClass' and
obj.name<>'XWiki.ToolbarClassTemplate'")
#set ($toolbars= $xwiki.searchDocuments($hql))
#if ($toolbars.size() > 0)
#foreach ($toolbar in $toolbars)
#set ($itemdoc = $xwiki.getDocument($toolbar))
#set ($itemobject = $itemdoc.getObject('XWiki.ToolbarClass'))
#set ($imgsrc =
$xwiki.getAttachmentURL("$itemdoc","$itemdoc.display('UpIcon')"))
* [<img src="$imgsrc"/> >
$itemdoc.display('GotoPage')]
[$toolbar] <br>
#the following is just to show what's in the properties using a couple
different methods, I tried both above.
$itemdoc.display('UpIcon') | $itemdoc.display('DownIcon') |
$itemdoc.display('GotoPage') | $itemobject.getProperty('GotoPage').value
<br>
#end
#else
#info("There are no Toolbar documents in this wiki!")
#end
Mike Oliver wrote:
Ok first problem solved the img link had the arguments in the wrong order
so
<mg
src="$xwiki.getAttachmentURL("AEBtn0.jpg","Toolbar.AdvancedEditorButton")"
/> was bad and
<mg
src="$xwiki.getAttachmentURL("Toolbar.AdvancedEditorButton","AEBtn0.jpg")"
/> was good.
Now the question is, given the desire to show in the dashboard now and
eventually in a panel later the icons named in the properties of the
toolbar classes, how do I loop through the toolbars and build the displa
from the properties?
Mike Oliver wrote:
I am making good progress on a new Class that has properties, style
sheet and template that I created after following the Todo Tutorial.
The ToolbarClass has the following properties
Type/Name/SampleContent
String/Title/Advanced Editor
TextArea/Description/This button takes you to the advanced editor page
String/UpIcon/AEBtn0.jpg
String/DownIcon/AEBtn1.jpg
String/DisabledIcon/AEBtn2.jpg
String/GotoPage/Tools.AdvancedEditor
Also following the Todo Tutorial I created the Toolbar Space Web Home
page dashboard with
#set ($hql = ", BaseObject as obj where obj.name=doc.fullName
and obj.className='XWiki.ToolbarClass' and
obj.name<>'XWiki.ToolbarClassTemplate'")
#set ($toolbars= $xwiki.searchDocuments($hql))
#if ($toolbars.size() > 0)
#foreach ($toolbar in $toolbars)
* [$toolbar]
#end
#else
#info("There are no Toolbar documents in this wiki!")
#end
And I added the Comments object to the ToolbarClassTemplate
and then added a couple of document and attached the UPIcon and DownIcon
images as attachments.
Going to the Web Home of the I see the list of the two document with the
ToolbarClass object on them so cool beans just as the tutorial
instructed with the names changed and bingo we have a winner.
Now the tricky part, I want to show the attached images in the dashboard
for each document, where the property of the Toolbar object for UpIcon
is used to identifiy which attachment to display.
I tried
#set ($hql = ", BaseObject as obj where obj.name=doc.fullName
and obj.className='XWiki.ToolbarClass' and
obj.name<>'XWiki.ToolbarClassTemplate'")
#set ($toolbars= $xwiki.searchDocuments($hql))
#if ($toolbars.size() > 0)
#foreach ($toolbar in $toolbars)
* <<mg
src="$xwiki.getAttachmentURL("AEBtn0.jpg","Toolbar.AdvancedEditorButton")"
/> [$toolbar]
#end
#else
#info("There are no Toolbar documents in this wiki!")
#end
where I know that AEBtn0.jpg is the attached image but that doesn't
show.
Eventually I want to use the string in the UpIcon property to identify
the image to display but unless I can get the attachement to display on
another page I cannot proceed.