Hi Lewis, On Mar 14, 2009, at 9:18 AM, Lewis Denizen wrote:
Thanks Vincent (and sorry for the late reply!) - inlined my reply:
On Sun, Mar 1, 2009 at 4:41 AM, Vincent Massol <[email protected]> wrote:
Same here, the image syntax doesn't support relative paths.
I guess we could improve the link and image syntax to support paths starting with "/" and then consider them as paths relative to the context root. However it wouldn't work for relative paths such as "../../some/path".
Right now we could easily add a XWiki API to get an absolute URL from a relative one.
Note that you can still use the old syntax using the {{velocity}} {{html}}<a href="..."...{{/html}}{{/velocity}} but that's not very nice and it would be nice if it could be written using the new syntax but was made to avoid using HTML... :)
Would recognizing references starting with "/" a good solution for you? What do others think?
I guess checking for "/" at the beginning would work, or maybe some way of flagging it as a relative path would be even better (maybe something like [[image:img.png||relative=true]]). Not sure how feasible this is, or if it would make sense to do so...
See the vote I've sent on this: http://tinyurl.com/c737ve This won't be in 1.8 final but will be in 1.9M1.
This is not correct. The html macro must contain HTML. This is not the
case in your example. You need this:
{{velocity}} * this works - [[image: http://localhost:8080/$xwiki.getSkinFile('icons/black-file.png<http://localhost:8080/$xwiki.getSkinFile%28%27icons/black-file.png
') ]] * this doesn't work - {{html}}<img src="$xwiki.getSkinFile('icons/ black-file.png')"/>{{/html}} {{/velocity}}
It seems that the HTML Macro's final filter parses this last test case as 1 BulletedListBlock and 1 XMLBlock, but I'm not sure if this the expected behavior. If this is the expected behavior, the more need to get the [[image:]] tag working...
Thanks again for the great job!
Hm... kind of makes sense but, what does the wiki=true flag do, then...?
It means that HTML element content can contain wiki syntax as in: <element>text with wiki syntax here</element>
It's also a bit problematic for me since I have the following (posting everything, since this might be useful for others as well):
------------------------------------------------------------------
{{velocity}}#set($serverClassFullName = "Server.ServerClass"){{/ velocity}} {{velocity}}#set($serverDocumentSQL = "select distinct doc from Document as doc, doc.object(${serverClassFullName}) as obj where obj.name <> '${serverClassFullName}Template'"){{/velocity}} {{velocity}}#set($serverDocuments = $xwiki.queryManager.xwql($serverDocumentSQL).execute()){{/velocity}}
There are currently {{velocity}}**${serverDocuments.size()}**{{/ velocity}} document(s) containing Server objects.
{{velocity}}
Why do you repeat the velocity macro several times? You can wrap all the macros into one single velocity macro.
{{html}}
This one can also be in the top level velocity macro.
<table id="serverList" class="grid sortable filterable doOddEven"> <tr class="sortHeader"> <th class="selectFilter">Space</th> <th>Class</th> <th>Server</th> <th class="unsortable noFilter">Link</th> </tr>
Note that in the future we've planned to add filterable/sortable tables in the new table syntax directly.
#foreach($serverDocument in $serverDocuments) #set($serverObjectSQL = "select obj.hostname, obj.prettyName, obj.urlRoot, obj.hostName from Document as doc, doc.object(${serverClassFullName}) as obj where doc.id = ${serverDocument.id}") #set($serverObjects = $xwiki.queryManager.xwql($serverObjectSQL).execute()) <tr> <td>${serverDocument.space}</td> <td>${serverDocument.name}</td> <td> #foreach($serverObject in $serverObjects) #set($server = $listtool.get($serverObject, 0)) #set($serverPrettyName = $listtool.get($serverObject , 1)) #set($serverURLRoot = $listtool.get($serverObject, 2)) #set($serverHostName = $listtool.get($serverObject , 3)) * ${serverPrettyName} - <a href="${serverURLRoot}"><img src="$xwiki.getSkinFile('icons/black-file.png')" alt="Root URL" title="Root URL" /></a> <a href="${serverHostName}"><img src="$xwiki.getSkinFile('icons/black-rss-mini.png')" alt="Host Name" title="Host Name" /></a> #end </td> <td>[[${serverDocument.name}>>${serverDocument}]]</td> </tr> #end </table> {{/html}} {{/velocity}}
This looks good.
------------------------------------------------------------------
This will list out all the properties of Server.ServerClass for all documents that contain a Server.ServerClass object in it. I got this to work by replacing the XWiki list syntax with:
<td> <ul> #foreach($serverObject in $serverObjects) #set($server = $listtool.get($serverObject, 0)) #set($serverPrettyName = $listtool.get($serverObject , 1)) #set($serverURLRoot = $listtool.get($serverObject, 2)) #set($serverHostName = $listtool.get($serverObject , 3)) <li>${serverPrettyName} - <a href="${serverURLRoot}"><img src="$xwiki.getSkinFile('icons/black-file.png')" alt="Root URL" title="Root URL" /></a> <a href="${serverHostName}"><img src="$xwiki.getSkinFile('icons/black-rss-mini.png')" alt="Host Name" title="Host Name" /></a></li> #end </ul> </td>
It should work fine with the "*" as in the first example. If you could reduce your example to the strict minimum and create a jira issue for it that would be great.
... but again, not the most ideal. I also tried ending the {{html}} tag in the middle of the table, but that just became really weird. I guess custom tables like these still have to be written out in pure HTML :-(
You'll be able to write them in HTML once we have the sortable/ filterable stuff in for table in wiki syntax. I hope we'll have time for that in 1.9.
But, the new XWQL engine works veeeeeery nice :-D
cool :) -Vincent
Thanks again for the help :-)
-- Lewis