Hi all, When viewing a list of classes (both in the class editor and when attaching a class manually to a document via class list dropdown) the order of classes seems a bit random. Is there any way to select the sort order? The userlist property type also seems to be a bit random (in my case, selecting value or id makes no difference).
Just a quick guess: the list is probably stored as a Map that's implemented as a HashMap, suitable for fast random retrieval by key value of large lists, but ordered essentially randomly. You'd want it to be a SortedMap (of which I think TreeMap is the only implementation in java.util) for human-friendly visual selection of values, particularly if the list had more than maybe a dozen or so entries. I don't know whether that choice is made in the core code or in a template or class sheet (XWiki.ClassSheet), or whether you could re-order it there. If not, you might have to go the custom object class route (for which I've seen support in the database, but not in any of the forms) or, at last resort, actually change the core code. brain[sic] ________________________________ From: Esbach, Brandon [mailto:[email protected]] Sent: Wednesday, April 11, 2007 4:07 AM To: [email protected] Subject: [xwiki-users] Order of classes? Hi all, When viewing a list of classes (both in the class editor and when attaching a class manually to a document via class list dropdown) the order of classes seems a bit random. Is there any way to select the sort order? The userlist property type also seems to be a bit random (in my case, selecting value or id makes no difference).
Hi, I'm not sure if this is what you want, but in the case of the class page ( XWiki.XWikiClasses), you can make the list sorted by simply sorting the class list. Replace the bottom code of the page to something like this: 1.1 Existing Classes #set( $list = $xwiki.sort( $xwiki.classList ) ) #foreach ($classname in $list) * [$classname] #end Best regards Melv On 4/11/07, Esbach, Brandon <[email protected]> wrote:
Hi all,
When viewing a list of classes (both in the class editor and when attaching a class manually to a document via class list dropdown) the order of classes seems a bit random. Is there any way to select the sort order?
The userlist property type also seems to be a bit random (in my case, selecting value or id makes no difference).
-- You receive this message as a subscriber of the [email protected] list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Thanks, Wasn't aware there was an xwiki.sort function; will be useful elsewhere too. ________________________________ From: [email protected] [mailto:[email protected]] On Behalf Of Melv Ng Sent: 11 April 2007 21:24 To: [email protected] Subject: Re: [xwiki-users] Order of classes? Hi, I'm not sure if this is what you want, but in the case of the class page (XWiki.XWikiClasses), you can make the list sorted by simply sorting the class list. Replace the bottom code of the page to something like this: 1.1 Existing Classes #set( $list = $xwiki.sort( $xwiki.classList ) ) #foreach ($classname in $list) * [$classname] #end Best regards Melv On 4/11/07, Esbach, Brandon <[email protected]> wrote: Hi all, When viewing a list of classes (both in the class editor and when attaching a class manually to a document via class list dropdown) the order of classes seems a bit random. Is there any way to select the sort order? The userlist property type also seems to be a bit random (in my case, selecting value or id makes no difference). -- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto: [email protected] For general help: mailto: [email protected] <mailto:[email protected]> ?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Hi All, I would like whether someone help me on how to set the language or change the default document language with "Groovy". In some situations, when creating some of documents I don't need to specify language even language of content is different of that indicated on the top. Now for some documents, I need to create documents for which default language is different from that of XWiki. In fact, I tried to invoke 'XWikiContext.setLanguage("language")' but it seems that "saveDocument()" method don't work with "XWikiContext". I would like also to understand difference between "XWikiContext", "context.context" and "xwiki.api.Context"? If before saving any document we need to specify the "context" then how to modify this context. There are less methods are available for tuning this contex (I mean "context.context"). Many thanks in advance. Youcef
Hi Youcef, I can't really help you with your language issue, but I can give some indications on the different contexts. From Velocity : $context is the com.xpn.xwiki.api.Context class. It correspond to the request context exposed to xwiki users. $context.context (or $context.getContext()) is the com.xpn.xwiki.XWikiContext. That is the context not wrapped by the Api. Both class have more or less same methods exposed, but for most usages, you should use the $context. You may want also to be aware that contexts have a lifespan of one request. Cheers, Jérôme On 4/13/07, Youcef BEY <[email protected]> wrote:
Hi All,
I would like whether someone help me on how to set the language or change the default document language with "Groovy". In some situations, when creating some of documents I don't need to specify language even language of content is different of that indicated on the top.
Now for some documents, I need to create documents for which default language is different from that of XWiki.
In fact, I tried to invoke 'XWikiContext.setLanguage("language")' but it seems that "saveDocument()" method don't work with "XWikiContext". I would like also to understand difference between "XWikiContext", " context.context" and "xwiki.api.Context"? If before saving any document we need to specify the "context" then how to modify this context. There are less methods are available for tuning this contex (I mean " context.context").
Many thanks in advance.
Youcef
-- You receive this message as a subscriber of the [email protected] list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
-- Jerome Velociter Mobile : 0033 (0) 617 260 654 GTalk, MSN : [email protected] Skype : jerome.velociter
On Apr 13, 2007, at 2:39 PM, Jerome Velociter wrote:
Hi Youcef,
I can't really help you with your language issue, but I can give some indications on the different contexts.
From Velocity :
$context is the com.xpn.xwiki.api.Context class. It correspond to the request context exposed to xwiki users.
$context.context (or $context.getContext()) is the com.xpn.xwiki.XWikiContext. That is the context not wrapped by the Api.
This getContext() method will be removed in the future and should not be used. BTW it can only be used by users with programming rights. It's a privileged API.
Both class have more or less same methods exposed, but for most usages, you should use the $context. You may want also to be aware that contexts have a lifespan of one request.
Actually the context stores everything. There are objects that have a lifespan of the application and others that have a lifespan of the request (like the xwiki request and response object). Jerome is right in that the context is updated for each request. All this should go in the developer guide that I have proposed some time back on this list (but got nobody interested in helping out so far ;-)). Thanks -Vincent
On 4/13/07, Youcef BEY < [email protected]> wrote: Hi All,
I would like whether someone help me on how to set the language or change the default document language with "Groovy". In some situations, when creating some of documents I don't need to specify language even language of content is different of that indicated on the top.
Now for some documents, I need to create documents for which default language is different from that of XWiki.
In fact, I tried to invoke 'XWikiContext.setLanguage("language")' but it seems that "saveDocument()" method don't work with "XWikiContext". I would like also to understand difference between "XWikiContext", "context.context" and "xwiki.api.Context"? If before saving any document we need to specify the "context" then how to modify this context. There are less methods are available for tuning this contex (I mean "context.context").
Many thanks in advance.
Youcef
-- You receive this message as a subscriber of the xwiki- [email protected] mailing list. To unsubscribe: mailto: [email protected] For general help: mailto: [email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/ wws
-- Jerome Velociter Mobile : 0033 (0) 617 260 654 GTalk, MSN : [email protected] Skype : jerome.velociter
-- You receive this message as a subscriber of the xwiki- [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/ wws
Hi! In the same way, velocity SortTool seems to allow sorting objects by a property. I tried to use it to sort the blog categories like this (i just modified 2 lines): #set ($objects = $catdoc.getObjects("Blog.Categories")) #set ($objects = $xwiki.sort($objects, "name")) #foreach ($catobj in $objects) .... But it does not work. It still displays the categories in a "disorder". I know it's only available since velocity-tools 1.2 version, does it come from that? Or is it simply not available in XWiki environment ? Or am i wrong in how i wrote it? Thanks! (and sorry to digg up this old thread) -Nicolas- 2007/4/12, Esbach, Brandon <[email protected]>:
Thanks, Wasn't aware there was an xwiki.sort function; will be useful elsewhere too.
------------------------------ *From:* [email protected] [mailto:[email protected]] *On Behalf Of *Melv Ng *Sent:* 11 April 2007 21:24 *To:* [email protected] *Subject:* Re: [xwiki-users] Order of classes?
Hi,
I'm not sure if this is what you want, but in the case of the class page ( XWiki.XWikiClasses), you can make the list sorted by simply sorting the class list. Replace the bottom code of the page to something like this:
1.1 Existing Classes #set( $list = $xwiki.sort( $xwiki.classList ) ) #foreach ($classname in $list) * [$classname] #end
Best regards Melv
On 4/11/07, Esbach, Brandon <[email protected]> wrote:
Hi all,
When viewing a list of classes (both in the class editor and when attaching a class manually to a document via class list dropdown) the order of classes seems a bit random. Is there any way to select the sort order?
The userlist property type also seems to be a bit random (in my case, selecting value or id makes no difference).
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto: [email protected] For general help: mailto: [email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
-- You receive this message as a subscriber of the [email protected] list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Hi Nicolas, The velocity tools are not currently configured in XWiki. We need to either configure them or better allow the user to configure them. If someone submits a patch for this I could apply it :) Thanks -Vincent On Jul 3, 2007, at 1:29 PM, Nicolas Réau wrote:
Hi!
In the same way, velocity SortTool seems to allow sorting objects by a property. I tried to use it to sort the blog categories like this (i just modified 2 lines):
#set ($objects = $catdoc.getObjects(" Blog.Categories")) #set ($objects = $xwiki.sort($objects, "name")) #foreach ($catobj in $objects) ....
But it does not work. It still displays the categories in a "disorder". I know it's only available since velocity-tools 1.2 version, does it come from that? Or is it simply not available in XWiki environment ? Or am i wrong in how i wrote it?
Thanks!
(and sorry to digg up this old thread)
-Nicolas-
2007/4/12, Esbach, Brandon <[email protected]>: Thanks, Wasn't aware there was an xwiki.sort function; will be useful elsewhere too.
From: [email protected] [mailto:[email protected]] On Behalf Of Melv Ng Sent: 11 April 2007 21:24 To: [email protected] Subject: Re: [xwiki-users] Order of classes?
Hi,
I'm not sure if this is what you want, but in the case of the class page (XWiki.XWikiClasses), you can make the list sorted by simply sorting the class list. Replace the bottom code of the page to something like this:
1.1 Existing Classes #set( $list = $xwiki.sort( $xwiki.classList ) ) #foreach ($classname in $list) * [$classname] #end
Best regards Melv
On 4/11/07, Esbach, Brandon <[email protected]> wrote: Hi all,
When viewing a list of classes (both in the class editor and when attaching a class manually to a document via class list dropdown) the order of classes seems a bit random. Is there any way to select the sort order?
The userlist property type also seems to be a bit random (in my case, selecting value or id makes no difference).
participants (7)
-
Esbach, Brandon -
Jerome Velociter -
Melv Ng -
Nicolas Réau -
THOMAS, BRIAN M (ATTSI) -
Vincent Massol -
Youcef BEY