[xwiki-users] Help with custom display
Hi, I'm pretty confused with the documentation around xWiki and struggle to find infos on the "custom display" field in the property editor. A simple example could clarify my questions: how do you (for example) use the "custom display" field to display the content of the Textarea Propety in bold, red? Thx in advance for your answers -- View this message in context: http://www.nabble.com/Help-with-custom-display-tp16277592p16277592.html Sent from the XWiki- Users mailing list archive at Nabble.com.
Hi! javacupix wrote:
I'm pretty confused with the documentation around xWiki and struggle to find infos on the "custom display" field in the property editor. A simple example could clarify my questions: how do you (for example) use the "custom display" field to display the content of the Textarea Propety in bold, red?
I guess this feature is not documented yet. Please, have you get something about it? Documentation must be improve and I am sure your help will be welcome by the community! Thanks for your help, Ricardo -- View this message in context: http://www.nabble.com/Help-with-custom-display-tp16277592p16300773.html Sent from the XWiki- Users mailing list archive at Nabble.com.
Ok, I got it, you can use Velocity Scripting in the Custom Display Property to render the display in the way you want it... For example here is the code to a "custom display" so the value of the property is displayed in bold and red. $doc.getValue("DataName") Where DataName is the name of my property... actually it's really easy to do what you want if you understand the xwiki javadoc (http://platform.xwiki.org/xwiki/bin/download/DevGuide/API/xwiki%2Dcore%2D1.3...) -- View this message in context: http://www.nabble.com/Help-with-custom-display-tp16277592p16302208.html Sent from the XWiki- Users mailing list archive at Nabble.com.
javacupix wrote:
Ok, I got it, you can use Velocity Scripting in the Custom Display Property to render the display in the way you want it...
For example here is the code to a "custom display" so the value of the property is displayed in bold and red. <b><font color=red>$doc.getValue("DataName")</font></b>
Where DataName is the name of my property... actually it's really easy to do what you want if you understand the xwiki javadoc (http://platform.xwiki.org/xwiki/bin/download/DevGuide/API/xwiki%2Dcore%2D1.3...)
Indeed, you can put some velocity script in there. The core will also make available the following variables: - $name = the name of the displayed field - $prefix = a prefix for the form field - $object = the displayed object - $type = the intended display mode (view, edit, hidden, search...) - $value = the property value So, your example could be rewritten as: <b>$value</b> which works only in view mode, or: #if($type == "view") <b>$value</b> #else ## some markup to display in edit mode #end -- Sergiu Dumitriu http://purl.org/net/sergiu/
Thanks! Don't you think is worth a FAQ entry for this issue? I will create one based on your example if you don't mind. Thanks! Best, Ricardo javacupix wrote:
Ok, I got it, you can use Velocity Scripting in the Custom Display Property to render the display in the way you want it...
For example here is the code to a "custom display" so the value of the property is displayed in bold and red. <b><font color=red>$doc.getValue("DataName")</font></b>
Where DataName is the name of my property... actually it's really easy to do what you want if you understand the xwiki javadoc (http://platform.xwiki.org/xwiki/bin/download/DevGuide/API/xwiki%2Dcore%2D1.3...)
-- View this message in context: http://www.nabble.com/Help-with-custom-display-tp16277592p16303342.html Sent from the XWiki- Users mailing list archive at Nabble.com.
Sure, feel free to use it, as I consider myself as a big noob in the xwiki universe I wasn't sure about giving it a FAQ entry [Ricardo Rodríguez] wrote:
Thanks! Don't you think is worth a FAQ entry for this issue? I will create one based on your example if you don't mind. Thanks!
Best,
Ricardo
javacupix wrote:
Ok, I got it, you can use Velocity Scripting in the Custom Display Property to render the display in the way you want it...
For example here is the code to a "custom display" so the value of the property is displayed in bold and red. <b><font color=red>$doc.getValue("DataName")</font></b>
Where DataName is the name of my property... actually it's really easy to do what you want if you understand the xwiki javadoc (http://platform.xwiki.org/xwiki/bin/download/DevGuide/API/xwiki%2Dcore%2D1.3...)
-- View this message in context: http://www.nabble.com/Help-with-custom-display-tp16277592p16304010.html Sent from the XWiki- Users mailing list archive at Nabble.com.
Thanks to Sergui who pointed out the different states (edit, view,...) I made the following changes to my code so that you still be able to edit a property with a custom display so here it is for the String property type. I'm wondering if there is such a thing like $object.getEditor() but couldn't find it in the jdoc. #if(type == "view") <b>$value</b> #elseif($type == "edit") <input type='text' name='$prefix$name' value='$value' /> #end On Wed, Mar 26, 2008 at 4:41 PM, javacupix <[email protected]> wrote:
Sure, feel free to use it, as I consider myself as a big noob in the xwiki universe I wasn't sure about giving it a FAQ entry
[Ricardo Rodríguez] wrote:
Thanks! Don't you think is worth a FAQ entry for this issue? I will
create
one based on your example if you don't mind. Thanks!
Best,
Ricardo
-- View this message in context: http://www.nabble.com/Help-with-custom-display-tp16277592p16304010.html Sent from the XWiki- Users mailing list archive at Nabble.com.
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Hi, Thanks to Sergui who pointed out the different states (edit, view,...) I
made the following changes to my code so that you still be able to edit a property with a custom display so here it is for the String property type. I'm wondering if there is such a thing like $object.getEditor() but couldn't find it in the jdoc.
There's 2 things available : - #if( $context.action == 'edit') (you could replace edit with delete, addobject, inline ...) - #if( $!request.editor == 'wiki') (you could replace wiki with wysiwyg, object, class ...) Is this what you were lookig for ? Guillaume
Yes, this is what I was looking for, but how do I bring up the editor? For example in the case of a Wysiwyg edit. On 3/26/08, Guillaume Lerouge <[email protected]> wrote:
Hi,
Thanks to Sergui who pointed out the different states (edit, view,...) I
made the following changes to my code so that you still be able to edit a property with a custom display so here it is for the String property type. I'm wondering if there is such a thing like $object.getEditor() but couldn't find it in the jdoc.
There's 2 things available :
- #if( $context.action == 'edit') (you could replace edit with delete, addobject, inline ...) - #if( $!request.editor == 'wiki') (you could replace wiki with wysiwyg, object, class ...)
Is this what you were lookig for ?
Guillaume
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
JavaCupiX wrote:
Yes, this is what I was looking for, but how do I bring up the editor? For example in the case of a Wysiwyg edit.
You shouldn't... You should call $doc.display($name, "edit", $object)
On 3/26/08, Guillaume Lerouge <[email protected]> wrote:
Hi,
Thanks to Sergui who pointed out the different states (edit, view,...) I
made the following changes to my code so that you still be able to edit a property with a custom display so here it is for the String property type. I'm wondering if there is such a thing like $object.getEditor() but couldn't find it in the jdoc.
There's 2 things available :
- #if( $context.action == 'edit') (you could replace edit with delete, addobject, inline ...) - #if( $!request.editor == 'wiki') (you could replace wiki with wysiwyg, object, class ...)
Is this what you were lookig for ?
Guillaume
-- Sergiu Dumitriu http://purl.org/net/sergiu/
Thanks a lot... I start getting the whole thing On 3/26/08, Sergiu Dumitriu <[email protected]> wrote:
JavaCupiX wrote:
Yes, this is what I was looking for, but how do I bring up the editor? For example in the case of a Wysiwyg edit.
You shouldn't... You should call $doc.display($name, "edit", $object)
On 3/26/08, Guillaume Lerouge <[email protected]> wrote:
Hi,
Thanks to Sergui who pointed out the different states (edit, view,...) I
made the following changes to my code so that you still be able to edit a property with a custom display so here it is for the String property type. I'm wondering if there is such a thing like $object.getEditor() but couldn't find it in the jdoc.
There's 2 things available :
- #if( $context.action == 'edit') (you could replace edit with delete, addobject, inline ...) - #if( $!request.editor == 'wiki') (you could replace wiki with wysiwyg, object, class ...)
Is this what you were lookig for ?
Guillaume
-- Sergiu Dumitriu http://purl.org/net/sergiu/ _______________________________________________
users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Hi! JavaCupiX wrote:
Thanks a lot... I start getting the whole thing Thus, please, could you create this FAQ entry? I am afraid that I am far beyond you are! Thanks.
Cheers, Ricardo -- Ricardo Rodríguez Your EPEC Network ICT Team
@Sergui : I tried this #if($type == "view") <b>$value</b> #else $doc.display($name, $type, $object) #endif but it get a nasty "Error number 4001 in 4: Error while parsing velocity page.... Invocation of method 'display' threw exception java.lang.stackOverflowError"... I tried the other display methods but got the same error each time, any idea what's wrong? @Ricardo: sure I will, when my puzzle is solved :) On Wed, Mar 26, 2008 at 9:27 PM, [Ricardo Rodriguez] Your EPEC Network ICT Team <[email protected]> wrote:
Hi!
JavaCupiX wrote:
Thanks a lot... I start getting the whole thing Thus, please, could you create this FAQ entry? I am afraid that I am far beyond you are! Thanks.
Cheers,
Ricardo
-- Ricardo Rodríguez Your EPEC Network ICT Team
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
On Thu, Mar 27, 2008 at 10:23 AM, JavaCupiX <[email protected]> wrote:
@Sergui : I tried this
#if($type == "view") <b>$value</b> #else $doc.display($name, $type, $object) #endif
but it get a nasty "Error number 4001 in 4: Error while parsing velocity page.... Invocation of method 'display' threw exception java.lang.stackOverflowError"... I tried the other display methods but got the same error each time, any idea what's wrong?
Hi, What you get here is a nasty infinite loop since $doc.display will call your custom displayer in the #else, custom displayer who calls display, who calls the .. :) -- Jean-Vincent Drean
Right... but what should I do to avoid this loop and still get the editor to display my object? On Thu, Mar 27, 2008 at 10:31 AM, Jean-Vincent Drean <[email protected]> wrote:
On Thu, Mar 27, 2008 at 10:23 AM, JavaCupiX <[email protected]> wrote:
@Sergui : I tried this
#if($type == "view") <b>$value</b> #else $doc.display($name, $type, $object) #endif
but it get a nasty "Error number 4001 in 4: Error while parsing velocity page.... Invocation of method 'display' threw exception java.lang.stackOverflowError"... I tried the other display methods but got the same error each time, any idea what's wrong?
Hi,
What you get here is a nasty infinite loop since $doc.display will call your custom displayer in the #else, custom displayer who calls display, who calls the .. :)
-- Jean-Vincent Drean _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
As Sergiu said you shouldn't have to write a custom displayer to get the wysiwyg editor when editing your prop, in the textarea props you have the option "editor" which can be set to "Wysiwyg". On Thu, Mar 27, 2008 at 11:20 AM, JavaCupiX <[email protected]> wrote:
Right... but what should I do to avoid this loop and still get the editor to display my object?
On Thu, Mar 27, 2008 at 10:31 AM, Jean-Vincent Drean <[email protected]> wrote:
On Thu, Mar 27, 2008 at 10:23 AM, JavaCupiX <[email protected]> wrote:
@Sergui : I tried this
#if($type == "view") <b>$value</b> #else $doc.display($name, $type, $object) #endif
but it get a nasty "Error number 4001 in 4: Error while parsing velocity page.... Invocation of method 'display' threw exception java.lang.stackOverflowError"... I tried the other display methods but got the same error each time, any idea what's wrong?
Hi,
What you get here is a nasty infinite loop since $doc.display will call your custom displayer in the #else, custom displayer who calls display, who calls the .. :)
-- Jean-Vincent Drean
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- -- Jean-Vincent Drean
Yes Jean Vincent that is absolutly clear to me, but my problem is about using the "custom display" field of a property without messing up the editing possibility of that data I started with #if($type == "view") <b>$value</b> #elseif($type == "edit") ## some markup to display in edit mode #end and the question is: what should I put at the " ## some markup to display in edit mode" line, <input type='text' name='$prefix$name' value='$value' /> (seems a crappy solution), $doc.display($name, $type, $object) (brings me to the infinite loop problem)? Thanks for all your answers and help, On Thu, Mar 27, 2008 at 11:41 AM, Jean-Vincent Drean <[email protected]> wrote:
As Sergiu said you shouldn't have to write a custom displayer to get the wysiwyg editor when editing your prop, in the textarea props you have the option "editor" which can be set to "Wysiwyg".
On Thu, Mar 27, 2008 at 11:20 AM, JavaCupiX <[email protected]> wrote:
Right... but what should I do to avoid this loop and still get the editor to display my object?
On Thu, Mar 27, 2008 at 10:31 AM, Jean-Vincent Drean <[email protected]> wrote:
On Thu, Mar 27, 2008 at 10:23 AM, JavaCupiX <[email protected]> wrote:
@Sergui : I tried this
#if($type == "view") <b>$value</b> #else $doc.display($name, $type, $object) #endif
but it get a nasty "Error number 4001 in 4: Error while parsing velocity page.... Invocation of method 'display' threw exception java.lang.stackOverflowError"... I tried the other display methods but got the same error each time, any idea what's wrong?
Hi,
What you get here is a nasty infinite loop since $doc.display will call your custom displayer in the #else, custom displayer who calls display, who calls the .. :)
-- Jean-Vincent Drean
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- -- Jean-Vincent Drean _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Considering your example I'd suggest, in the page content (or sheet if you are writing one) : #if ($context.action == "view") <b> #end $doc.display("test") #if ($context.action == "view") </b> #end On Thu, Mar 27, 2008 at 2:21 PM, JavaCupiX <[email protected]> wrote:
Yes Jean Vincent that is absolutly clear to me, but my problem is about using the "custom display" field of a property without messing up the editing possibility of that data
I started with
#if($type == "view") <b>$value</b> #elseif($type == "edit")
## some markup to display in edit mode #end
and the question is: what should I put at the " ## some markup to display in edit mode" line, <input type='text' name='$prefix$name' value='$value' /> (seems a crappy solution), $doc.display($name, $type, $object) (brings me to the infinite loop problem)?
Thanks for all your answers and help,
On Thu, Mar 27, 2008 at 11:41 AM, Jean-Vincent Drean <[email protected]> wrote:
As Sergiu said you shouldn't have to write a custom displayer to get the wysiwyg editor when editing your prop, in the textarea props you have the option "editor" which can be set to "Wysiwyg".
On Thu, Mar 27, 2008 at 11:20 AM, JavaCupiX <[email protected]> wrote:
Right... but what should I do to avoid this loop and still get the editor to display my object?
On Thu, Mar 27, 2008 at 10:31 AM, Jean-Vincent Drean <[email protected]> wrote:
On Thu, Mar 27, 2008 at 10:23 AM, JavaCupiX <[email protected]> wrote:
@Sergui : I tried this
#if($type == "view") <b>$value</b> #else $doc.display($name, $type, $object) #endif
but it get a nasty "Error number 4001 in 4: Error while parsing velocity page.... Invocation of method 'display' threw exception java.lang.stackOverflowError"... I tried the other display methods but got the same error each time, any idea what's wrong?
Hi,
What you get here is a nasty infinite loop since $doc.display will call your custom displayer in the #else, custom displayer who calls display, who calls the .. :)
-- Jean-Vincent Drean
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- -- Jean-Vincent Drean _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- -- Jean-Vincent Drean
Ok, I will edit the sheet and won't use the "custom display" thing... thanks for your help. On Thu, Mar 27, 2008 at 3:28 PM, Jean-Vincent Drean <[email protected]> wrote:
Considering your example I'd suggest, in the page content (or sheet if you are writing one) :
#if ($context.action == "view") <b> #end $doc.display("test") #if ($context.action == "view") </b> #end
On Thu, Mar 27, 2008 at 2:21 PM, JavaCupiX <[email protected]> wrote:
Yes Jean Vincent that is absolutly clear to me, but my problem is about using the "custom display" field of a property without messing up the editing possibility of that data
I started with
#if($type == "view") <b>$value</b> #elseif($type == "edit")
## some markup to display in edit mode #end
and the question is: what should I put at the " ## some markup to display in edit mode" line, <input type='text' name='$prefix$name' value='$value' /> (seems a crappy solution), $doc.display($name, $type, $object) (brings me to the infinite loop problem)?
Thanks for all your answers and help,
On Thu, Mar 27, 2008 at 11:41 AM, Jean-Vincent Drean <[email protected]> wrote:
As Sergiu said you shouldn't have to write a custom displayer to get the wysiwyg editor when editing your prop, in the textarea props you have the option "editor" which can be set to "Wysiwyg".
On Thu, Mar 27, 2008 at 11:20 AM, JavaCupiX <[email protected]> wrote:
Right... but what should I do to avoid this loop and still get the editor to display my object?
On Thu, Mar 27, 2008 at 10:31 AM, Jean-Vincent Drean <[email protected]
wrote:
On Thu, Mar 27, 2008 at 10:23 AM, JavaCupiX <[email protected]
wrote:
@Sergui : I tried this
#if($type == "view") <b>$value</b> #else $doc.display($name, $type, $object) #endif
but it get a nasty "Error number 4001 in 4: Error while parsing velocity page.... Invocation of method 'display' threw exception java.lang.stackOverflowError"... I tried the other display methods but got the same error each time, any idea what's wrong?
Hi,
What you get here is a nasty infinite loop since $doc.display will call your custom displayer in the #else, custom displayer who calls display, who calls the .. :)
-- Jean-Vincent Drean
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- -- Jean-Vincent Drean _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- -- Jean-Vincent Drean _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
participants (7)
-
[Ricardo Rodriguez] Your EPEC Network ICT Team -
[Ricardo Rodríguez] -
Guillaume Lerouge -
JavaCupiX -
javacupix -
Jean-Vincent Drean -
Sergiu Dumitriu