Sergiu Dumitriu wrote:
On 11/16/2010 12:06 AM, Ricardo Rodriguez [eBioTIC.]
wrote:
Raluca Stavro wrote:
Hi,
On Mon, Nov 15, 2010 at 3:05 PM, Sergiu Dumitriu<sergiu(a)xwiki.com> 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:Howt…
> .
>
> 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.
You are right, Sergiu. Another solution would be to use different ssx
objects from different documents (supposing that the SSX are being
used on demand). For example:
* Space1.Page1 having an SSX object - for common styles
* Space2.Page2 having another SSX object - for users that have edit rights
In the velocity code (a template or a page in wiki mode), you can do this:
$xwiki.ssx.use('Space1.Page1')## common styles
#if($hasEdit)
$xwiki.ssx.use('Space2.Page2')## styles for users that have edit rights
#end
Raluca.
OK! Please, one question here. I see in AnnotationCode.Script two
XWiki.JavaScriptExtension objects. AnnotationCode.Style has only one
XWiki.StyleSheetExtension object and you are proposing two documents,
each of them holding one SSX object. So, I understand that only one SSX
could be hold by a document or at least only one SSX can be addressed by
each document. Am I right?
Thanks!
A document can have as many ssx or jsx object as it needs, but a skin
extension is identified by the name of the document, so in the end an
extension is a document. The content of a skin extension is the
concatenation of the objects in that document, so it's impossible to
write two different extensions in a single document, only different
parts of the same extension.
I would like to add this paragraph to...
http://platform.xwiki.org/xwiki/bin/view/DevGuide/SkinExtensionsTutorial#HM…
...as an {{info}} block. Do you agree? Thanks!
>
>>> Raluca.
>>>
>>> On Mon, Nov 15, 2010 at 12:36 AM, Ricardo Rodriguez [eBioTIC.]
>>> <ricardo.rodriguez(a)ebiotic.net> 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