Yes Glad to do that, but I think I will wait until I finish, I still want to do some ordering and filtering so the Toolbar Class objects can support more than one toolbar. When I am done I will put up an example.
Ollie goldring, richard wrote: > > Mike, > > Can you document useful code snipets like this on the XWiki site? Thanks. > > Regards, > > Richard > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf > Of Mike Oliver > Sent: 22 May 2008 20:56 > To: users@xwiki.org > Subject: Re: [xwiki-users] Creating a Toolbar of my own > > > > Bingo we have a winner... > > #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')")) > > * <a href="/xwiki/bin/view/$itemdoc.display('GotoPage')"><img > src="$imgsrc"/></a> [$toolbar] <br> > > > Mike Oliver wrote: >> >> Ok almost there... >> >> This line works with the Click here link, but the img link doesn't. >> >> >> * <img src="$imgsrc"/> [Click here>$itemdoc.display('GotoPage')] >> [$toolbar] <br> >> >> >> Mike Oliver wrote: >>> >>> 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. >>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > -- > View this message in context: > http://www.nabble.com/Creating-a-Toolbar-of-my-own-tp17410485p17412204.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 > > Thales UK Ltd (Wells) DISCLAIMER: The information contained in this e-mail > is confidential. It may also be legally privileged. It is intended only > for > the stated addressee(s) and access to it by any other person is > unauthorised. If you are not an addressee, you must not disclose, copy, > circulate or in any other way use or rely on the information contained in > this e-mail. Such unauthorised use may be unlawful. We may monitor all > e-mail communications through our networks. If you have received this > e-mail > in error, please inform us immediately on +44 (0) 1749 672081 and delete > it > and all copies from your system. We accept no responsibility for changes > to > any e-mail which occur after it has been sent. Attachments to this e-mail > may contain software viruses which could damage your system. We therefore > recommend you virus-check all attachments before opening. A business of > Thales UK Ltd. Registered Office: 2 Dashwood Lang Road, The Bourne > Business > Park, Addlestone, Weybridge, Surrey KT15 2NX Registered in England No. > 868273 > _______________________________________________ > users mailing list > users@xwiki.org > http://lists.xwiki.org/mailman/listinfo/users > > -- View this message in context: http://www.nabble.com/Creating-a-Toolbar-of-my-own-tp17410485p17426387.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