> Hey folks,
> 
> I'm from Germany, so already sorry for my bloody english.
> 

Lets see if I can beat that :p

> I use the xe.panels.navigation for the navigation on my xWiki. Now the
> following: I created pages, which has an difference between the url and the
> name of the site.
> 
> For example:
> Title - Page one
> Adress - /xwiki/bin/main/different-page-one
> 
> This now causes problems in the alphabetical order of the navigation, due to
> the fact, that the order is being set by the adress "name".. My questions
> is: Can I change this behavior? So that the following code will sort the
> pages not by their url name but by their Page name?
> 

Which XWiki version do you use? I see there are some changes in 7.2 which might 
be relevant (or maybe they are not ;)

Anyway, I think the confusing concepts here are page name and page title.

The page name is the one that actually shows up in the URL, and that you can 
change by the "Rename" action for the page.
Sorting by page name is possible (and as far as I understand this is the 
default behaviour of the documentTree macro used in the panel).

The page title is the one displayed as headline on the page itself.

Sorting is done by page name instead of page title for the same reason why 
sorting on live table entries by title is not possible; see:

 
http://www.xwiki.org/xwiki/bin/view/FAQ/Why+is+it+not+possible+to+filter+on+doc+title+in+a+Livetable


I can only suggest the following less than perfect options:

* If you do not mind that the results are sorted by the title "as stored in the 
DB" instead of the "displayed title",
  or at least your users find this slightly less confusing, then you can edit 
the sort order:

  see  "#macro (getDocumentsQuery)" in XWiki.DocumentTreeMacros

  change the "order by doc.name" to "order by doc.title".


* If you know that pages will not have so many children that you need paging,
  instead of using the sort order from the DB, you can sort them differently in 
memory on the server.

  for this see #macro (getChildren $nodeId $return) (in 
XWiki.DocumentTreeMacros, too)

  replace the last line:

    #setVariable("$return" $children)

  with:

    #setVariable("$return" $sorttool.sort($children, "text"))

  this will go quite wrong when a page has more than 10 child pages and the 
other children need to be fetched later
  (i.e. paging will still work, but the next chunk of pages will not be "sorted 
as expected")


(Note: we recently here got the same problem with a multi-language wiki, as 
there the pages looked as "sorted at random" in all but the default language;
we used the first option, because most users do not create pages with velocity 
content in the title, and they find it ok if some page which are "preinstalled 
by the system" behave a bit magic :p )

anyway, that is just want come to my mind.

anyone else has better ideas ?

Clemens




> The code:
> 
> {{velocity}}
> #panelheader($services.localization.render('xe.panels.navigation'))
> ## Escape special characters in macro parameter values.
> #set ($openToDoc = $doc.documentReference.toString().replaceAll('([~"])',
> '~$1'))
> {{documentTree showSpaces="false" showTranslations="false"
> showAttachments="false" showDocumentTitle="true"
>   showChildDocuments="true" finder="true" compact="false"
> openTo="document:$openToDoc" root="space:xwiki:Main"/}}
> #panelfooter()
> {{/velocity}}
> 
> Changing the adresses or url's is not a possible solution, due to the
> unflexibility of a partner we are working with. Is there a possible change
> or do I have to put up a manual navigation?
> 
> 
> 
> --
> View this message in context: 
> http://xwiki.475771.n2.nabble.com/xWiki-Change-Navigation-scheme-tp7596292.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
> 
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to