[xwiki-users] xWiki - Change Navigation scheme
Hey folks, I'm from Germany, so already sorry for my bloody english. 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? 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.h... Sent from the XWiki- Users mailing list archive at Nabble.com.
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+... 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.h... Sent from the XWiki- Users mailing list archive at Nabble.com. _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Hey Clemens, thank you for your help. The first workaround worked liked a charm for me.. Now the thing is, that I want to set up a second navigation. I now set up a {{tree}} element and everything seems to work fine, but the only problem I have with it, is that the actual site is not displayed in the tree element. So for instance this is my tree menu: - AM 1 --point 1.1 (hidden in normal) - AM 2 --point 2.1 (hidden in normal) - AM 3 -- point 3.1 (hidden in normal) And now I want the following behaviour: If I go to the page AM 1 > point 1.1 the tree should remark that and the page should be "blue" und the tree should show the underpoints. I hope it is understandable what I mean. In German: Die aktuelle Seite sollte auch in der zweiten Tree-Navigation als gerade geöffnet erscheinen und es sollten sich auch nur dann alle jeweiligen Unterpunkte öffnen, eben wie im Navigationspanel. Where can I see what xWiki Version I'm using? Feeling like a total noob, but haven't set up this xwiki Eric -- View this message in context: http://xwiki.475771.n2.nabble.com/xWiki-Change-Navigation-scheme-tp7596292p7... Sent from the XWiki- Users mailing list archive at Nabble.com.
On 5 Oct 2015 at 10:41:07, prettymuchcoverseverything ([email protected](mailto:[email protected])) wrote:
Hey Clemens,
thank you for your help. The first workaround worked liked a charm for me..
Now the thing is, that I want to set up a second navigation. I now set up a {{tree}} element and everything seems to work fine, but the only problem I have with it, is that the actual site is not displayed in the tree element.
So for instance this is my tree menu:
- AM 1 --point 1.1 (hidden in normal) - AM 2 --point 2.1 (hidden in normal) - AM 3 -- point 3.1 (hidden in normal)
And now I want the following behaviour: If I go to the page AM 1 > point 1.1 the tree should remark that and the page should be "blue" und the tree should show the underpoints. I hope it is understandable what I mean. In German:
Die aktuelle Seite sollte auch in der zweiten Tree-Navigation als gerade geöffnet erscheinen und es sollten sich auch nur dann alle jeweiligen Unterpunkte öffnen, eben wie im Navigationspanel.
Where can I see what xWiki Version I'm using? Feeling like a total noob, but haven't set up this xwiki
In the page footer or using a REST call. For example: http://playground.xwiki.org/xwiki/rest/ (replace playground.xwiki.org by your server!). Thanks -Vincent
Eric
Thank you Vincent :) It is the version 7.1.1 :) Maybe the tree-idea is the wrong way to create a second manual navigation? Like to hear your ideas and thoughts to that. -- View this message in context: http://xwiki.475771.n2.nabble.com/xWiki-Change-Navigation-scheme-tp7596292p7... Sent from the XWiki- Users mailing list archive at Nabble.com.
On Mon, Oct 5, 2015 at 11:41 AM, prettymuchcoverseverything <[email protected]> wrote:
Hey Clemens,
thank you for your help. The first workaround worked liked a charm for me..
Now the thing is, that I want to set up a second navigation. I now set up a {{tree}} element and everything seems to work fine, but the only problem I have with it, is that the actual site is not displayed in the tree element.
So for instance this is my tree menu:
- AM 1 --point 1.1 (hidden in normal) - AM 2 --point 2.1 (hidden in normal) - AM 3 -- point 3.1 (hidden in normal)
I suppose this is a static tree http://extensions.xwiki.org/xwiki/bin/view/Extension/Tree+Macro#HStaticTree . You can use the "openTo" parameter like this: {{tree openTo="j1_3"}} * Grandparent ** Parent *** Child {{/tree}} but you need to pass the node id. In my example I used the automatically generated node id, which is not something stable. Best is to set an id for each tree node. Unfortunately you can't use (only) wiki syntax for this because XWiki 2.1 syntax doesn't support parameters for list items. You'll have to use HTML which is a lot more verbose. {{tree openTo="foo"}} {{velocity}} {{html}} <ul> <li> <a href="$xwiki.getURL('Space.Page')">$doc.parent</a> <ul> <li id="foo"> <a>$doc.name</a> </li> </ul> </li> </ul> {{/html}} {{/velocity}} {{/tree}} Hope this helps, Marius
And now I want the following behaviour: If I go to the page AM 1 > point 1.1 the tree should remark that and the page should be "blue" und the tree should show the underpoints. I hope it is understandable what I mean. In German:
Die aktuelle Seite sollte auch in der zweiten Tree-Navigation als gerade geöffnet erscheinen und es sollten sich auch nur dann alle jeweiligen Unterpunkte öffnen, eben wie im Navigationspanel.
Where can I see what xWiki Version I'm using? Feeling like a total noob, but haven't set up this xwiki
Eric
-- View this message in context: http://xwiki.475771.n2.nabble.com/xWiki-Change-Navigation-scheme-tp7596292p7... Sent from the XWiki- Users mailing list archive at Nabble.com. _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
On Mon, Oct 5, 2015 at 11:53 AM, prettymuchcoverseverything <[email protected]> wrote:
Thank you Vincent :)
It is the version 7.1.1 :)
Maybe the tree-idea is the wrong way to create a second manual navigation? Like to hear your ideas and thoughts to that.
There is also http://extensions.xwiki.org/xwiki/bin/view/Extension/Menu+Application#HVerti... but it doesn't support opening the menu to the current page as you wish.
-- View this message in context: http://xwiki.475771.n2.nabble.com/xWiki-Change-Navigation-scheme-tp7596292p7... Sent from the XWiki- Users mailing list archive at Nabble.com. _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
participants (4)
-
Clemens Klein-Robbenhaar -
Marius Dumitru Florea -
prettymuchcoverseverything -
vincent@massol.net