Muzi, There is a script that's used to check the name (located at http://yourdomainname/xwiki/bin/view/XWiki/XWikiCommonJavascript), if you edit the page and look for function "updateName" you can update it to remove certain characters from a filename before creating. I would consider removing it altogether (just add to the list of replace strings). When creating pages, this should usually run before the form submit to correct any odd characters (so any special classes you use should call this too). The "topic" create panel, afaik, already calls this appropriately. -----Original Message----- From: xwiki xwiki [mailto:[email protected]] Sent: 06 June 2007 09:24 To: [email protected] Subject: RE: [xwiki-users] how to find out incorrect named pages Hi Brandon, thanks, it really works, now I know the escaping in this script is ' :) but the problem was not totaly solved, the script of navagation panel can ran, but the malnamed pages getting cluttering the page, for example someone name a page called "2007.3 something" it will go listed into 2007 space, and "abcd --a new way to go" will result in an opening of striked string and mess up the whole page. now I disable the navagation panel since I find the loading speed is quite slow. but considering that the naming in xwiki is not transparent for scripting, thinking a way to have name filter/check or a blacklist macro to restirict from naming it. like using condom to solve inherited disease :) any idea? cheers, Muzi p.s. following is the modified navagation panel script, if someone want use it and it's problem with some doc name: simply add following line: #set($space = $space.replace("'", "''")) just one line before this line: #set($sqlQuery = "doc.web='$space' order by doc.name" ) On Jun 05, 2007 08:50 PM, "Esbach, Brandon" <[email protected]> wrote:
Hi,
It's technically Monday here (yesterday was a bank holiday), so hopefully I understand the question correctly!
Easiest way would be to escape the "'" itself when used in the relevant place. You can escape "'" with a double quote using the .replace() string command. For example: #set($t_sSQLQuery="this is ${t_sUserName}'s query") #set($t_sSQLQuery=$t_sSQLQuery.replace("'", "''")) This is not the shortest way - but it is the more flexible way to do this; and ensures
you can still update your query along the way if needed.
Thus, your snippet #set ($query = "where doc.name like '%--%'") Would become #set($docname="document'sname") #set($docname=$docname.replace("'", "''") #set ($query = "where doc.name like '%${docname}%'")
**In case you missed it, "${velocity_variable_without_the_dollar_sign}" is the formal method of accessing a variable's value; it allows you to
build up strings using variables directly as demonstrated above.
-----Original Message----- From: xwiki xwiki [mailto:[email protected]] Sent: 05 June 2007 13:37 To: [email protected] Subject: [xwiki-users] how to find out incorrect named pages
Hi,
here I have a problem with a xwiki 1.0 which upgraded from an existing
xwiki 0.9.840 which someone named a page like: "Jon's Pages" conflict with the navagation panel's sql statement.
I did a velocity script but I don't find it support "[ ]" wildcard noted in this reference manual:
http://manuals.sybase.com:80/onlinebooks/group-as/asg1250e/refman/%40e bt -link;pt=26021?target=%25N%15_26195_START_RESTART_N%25
since I just want to select where name not like mywhitelisted characters.
the blacklisted characters should be those used by xwiki syntax, and those symbol used in sql statement like "'" """
any one know how to use the wildcard to done that?
or any other solutions?
Thx in advance!
I already have this:
#set ($query = "where doc.name like '%--%'")
{table} Page Name | Author | date #foreach ($item in $xwiki.searchDocuments("${query}")) ##if ($xwiki.hasAccessLevel("view", $context.user, "${context.database}:${item}")) #set($bentrydoc = $xwiki.getDocument($item)) [${bentrydoc.web}.$bentrydoc.name] | $xwiki.getLocalUserName($bentrydoc.author) | $xwiki.formatDate($bentrydoc.date, $dateFormat) ##end #end {table}
Muzi