asiri (SVN) wrote:
Author: asiri
Date: 2009-05-27 22:12:57 +0200 (Wed, 27 May 2009)
New Revision: 20576
Added:
platform/xwiki-applications/trunk/officeimporter/src/main/resources/XWiki/OfficeImporterSuggest.xml
Modified:
platform/xwiki-applications/trunk/officeimporter/src/main/resources/XWiki/OfficeImporter.xml
Log:
XAOFFICE-14: Improve the Office Importer Application User Experience
* Modularized the suggest mechanism by introducing XWiki.OfficeImporterSuggest page and
the use of plain.vm template.
Added:
platform/xwiki-applications/trunk/officeimporter/src/main/resources/XWiki/OfficeImporterSuggest.xml
===================================================================
---
platform/xwiki-applications/trunk/officeimporter/src/main/resources/XWiki/OfficeImporterSuggest.xml
(rev 0)
+++
platform/xwiki-applications/trunk/officeimporter/src/main/resources/XWiki/OfficeImporterSuggest.xml 2009-05-27
20:12:57 UTC (rev 20576)
@@ -0,0 +1,44 @@
+#if("" == "$!{request.xpage}")
+ #warning("This page contains the office importer auto-suggest script")
+#end
+#set($ok = $response.setContentType("text/xml"))
+#set($typeParam = "$!{request.type}")
+#set($numberParam = "$!{request.number}")
+#set($inputParam = "$!{request.input}")
+<results>
+#if("spaces" == $typeParam)
+ #set($number = $util.parseInt($numberParam))
+ #if($number == 0)#set($number = 10)#end
+ #set($matchingSpaces = $xwiki.searchSpacesNames("where lower(doc.space) like
'%$inputParam.toLowerCase()%'", $number, 0, []))
You should sanitize the inputParam, otherwise it will cause problems
with ' and %.
+ #foreach($space in $matchingSpaces)
+ <rs id="$velocityCount"
info="">$space</rs>
+ #end
+#end
+</results>
+</content>
+</xwikidoc>
--
Sergiu Dumitriu
http://purl.org/net/sergiu/