Sergiu Dumitriu wrote:
On 11/15/2010 09:18 AM, 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
This is problematic, since the extension is cached on the clientside (browser cache). So if a user visits the wiki once unauthenticated, after he logs in the same CSS file (already parsed) is used, so nothing will change in the UI.
To load the re-parsed CSS, either refresh the browser cache, or you can set the Cache property of the extension to "Forbid", which is bad for performance.
I adopted this solution here sacrificing performance as I need the described behaviour (Annotation shown only for registered users). But I still get see some weird thing I've not been able to consistently reproduce yet. I'm using a XE/XEM 2.4.30451 in production and a XE 2.7-SNAPSHOT.32908 as trial environment. I'll keep this thread updated or open new ones as required when I gather more information! An example: Working with a virtual wiki. I've modified AnnotationCode.Style (XWiki.StyleSheetExtension) this way... ## Defining global variables; added by Ricardo Rodriguez on November the 15th to apply conditional rules to CSS #template('xwikivars.vm') /* 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($isGuest)visibility:hidden;#end } .actionmenu #tmAnnotations a { padding-top: 0 !important; } .actionmenu .active { background-color: $theme.pageContentBackgroundColor; ##$theme.backgroundSecondaryColor; } .actionmenu .active a { color: $theme.menuSelectedEntryLinkColor !important; } I never see "Annotations" in the right side of the action bar when browsing the site as Guest. When I log in, Annotations appears. And it persists consistently throughout the site for all spaces but those set as exceptions in the Annotations configuration panel. BUT, if I reload a page, any page, Annotations disappears. I cleaned the cache, restarted the browser, restarted the computer,... Nothing. By reloading the page several times, it ends appearing again. But I'm not able to find a pattern. ONE "FUNNY" THING: if Firebug Console is on, the reload is OK. Annotations persists. Those are the errors logged by Firebug: ***** xpected end of value but found ':'. Error in parsing value for 'text-transform'. Declaration dropped. [Break on this error] .actionmenu #tmAnnotations{background-...ontent blockquote{margin-bottom:10px;} Style?language=en (line 1) Unknown property 'border-radius'. Declaration dropped. [Break on this error] border-radius: 1.2em; colibri.css (line 205) Unknown property 'border-radius'. Declaration dropped. [Break on this error] border-radius: 1.2em; ***** XE 2.7-SNAPSHOT.32908 doesn't show this behaviour. Please, any idea? I don't know if this relates with any know issue or it relates with any error on my side. Any idea will be welcome! 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
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Ricardo RodrÃguez CTO eBioTIC. Life Sciences, Data Modeling and Information Management Systems