Sergiu Dumitriu wrote:
On 11/15/2010 01:15 PM, Ricardo Rodriguez [eBioTIC.] wrote:
Hi Raluca!
Raluca Stavro wrote:
Hello Ricardo,
Yes, you can use velocity code inside SSX and JSX objects. What you need to do is to set the 'Parse content' property to 'Yes'. You can take a look at the SSX documentation: http://code.xwiki.org/xwiki/bin/view/Plugins/SkinExtensionsPlugin#HTip:Howto... .
Example of usage: #if(!$hasEdit) #body{ background-color: red; } #end
Thanks! It is great to be able to use Velocity inside SSX and JSX!
But I'm facing some problems. Please, see this:
#set( $fruit = "orange" ) /* Menu */ .actionmenu #tmAnnotations { background-image: #imgURL('note') !important; /* Padding, margin and bg-position are adjusted in order to give this element the 'tab' look when active and the settings panel is displayed */ background-position: 0 1px; padding-right: 5px !important; padding-top: 0 !important; padding-bottom: 4px; margin-right: 5px !important; margin-top: 2px !important; #if($fruit == "apple")visibility:hidden;#end }
This evaluates correctly. But I'm not able to get this working:
#if($isGuest)visibility:hidden;#end
or
#if(!$hasEdit)visibility:hidden;#end
I've never get visibility:hidden; in. Those same expressions work fine in a simple XWiki 1.0 syntax doc. I get visibility:hidden; printed out when expected.
Please, do you know why these two expressions don't work inside a XWiki.StyleSheetExtension object?
These variables are defined in xwikivars.vm, which is parsed when rendering a document with the surrounding UI. You can either use the API code that was used to set those variables, or you can add this line at the top:
#template('xwikivars.vm')
Thanks, Sergiu. I clearly keeps failing at getting a clear general idea about how XWiki produces the output of a document. Time ago I started to create a kind of "flowchart" showing the relationships among templates, templates and actions and actions. Please, could you tell me if this is an good actual starting point to understanding this process? http://dev.xwiki.org/xwiki/bin/view/Design/FrontEndArchitecture Thanks!
Thanks!
Raluca.
On Mon, Nov 15, 2010 at 12:36 AM, Ricardo Rodriguez [eBioTIC.] <[email protected]> wrote:
Ricardo Rodriguez [eBioTIC.] wrote:
Hi,
I see how to control edit, export, action and watch appearance in contentmenu div by tweaking contentmenu.vm. But, please, how could I get the same control over Annotations entry in the same are?
I want to show annotations only to users with edit rights in a given doc.
Thanks!
Ricardo
The object of type XWiki.StyleSheetExtension in AnnotationCode.Style holds the code that seems to control how the action menu entry is shown.
Currently, to hide the annotation icon on this menu will be enough for me.
I can add visibility:hidden; to the concerned .actionmenu elements, but this also hides them for users with edit rights.
Please, is it possible to add ##if($hasEdit)...#else...#end structures in a SSE? My bet is that this is not possible: this extensions holds CSS code, not a script. So, please, how could I introduce conditional structures to control how page elements are show?
I guess I must tweak AnnotationCode.Script but, please, how?
Any help will be welcome! Thanks.
Best,
Ricardo
-- Ricardo RodrÃguez CTO eBioTIC. Life Sciences, Data Modeling and Information Management Systems