Re: [xwiki-users] showing/hiding annotations entry in contentmenu
On 11/16/2010 02:05 PM, Ricardo Rodriguez [eBioTIC.] wrote: >>> 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#HMinimalStyleSheeteXtension > > ...as an {{info}} block. Do you agree? Thanks! Sure, go ahead. -- Sergiu Dumitriu http://purl.org/net/sergiu/ ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] showing/hiding annotations entry in contentmenu
Marius Dumitru Florea wrote: > On 11/17/2010 09:24 AM, Ricardo Rodriguez [eBioTIC.] wrote: > >> Marius Dumitru Florea wrote: >> >>> On 11/16/2010 01:24 AM, Ricardo Rodriguez [eBioTIC.] wrote: >>> >>> Marius Dumitru Florea wrote: > On 11/15/2010 03:05 PM, 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:Howtoreferafilefromaskinextension >>> . >>> >>> 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. >> >> >> > In this particular case changing the JavaScript code that loads the > annotation feature is better IMO. > > I tried but failed to do that. > Ricardo, did you check > AnnotationCode.Script ? I can see these lines at the end of the second > JSX (named "Annotation Javascript -- Annotation application"): > > // if the action on the current document is not view, don't load > annotations > if (XWiki.contextaction != "view") { > return; > } > > I'm sure you can extend the test for your needs. > > Hope this helps, > Marius > > > > I think I get the point. Even though I'm not able to understand this script now or how to tweak it, I understand that this option blocks the loading process of the annotation feature. It is "cheaper" to do that as it stops a process not required for a given type of users. But, please, one more question. When is this script executed? Each time a document is loaded or even reloaded? >>> The JavaScript code of this extension is evaluated (loaded into >>> browser's memory) for each wiki page, and the code at the end of the >>> second JSX object is executed after a wiki page finished loading (in the >>> browser): >>> >>> document.observe('xwiki:dom:loaded', function() { >>> ... // code executed after the page finished loading. >>> }); >>> >>> Does this match your needs: >>> >>> document.observe('xwiki:dom:loaded', function() { >>> // if the action on the current document is not view, don't load >>> annotations >>> if (XWiki.contextaction != "view" || !XWiki.hasEdit) { >>> return; >>> } >>> ...// the rest of the code that loads the annotation feature. >>> }); >>> >>> >>> >> It works without a glitch (XE 2.7-SNAPSHOT.32908). I think it is more >> elegant than tweaking CSS and doesn't compromise performance. Thanks! >> >> >>> Note that XWiki.hasEdit is defined in javascript.vm . >>> >>> > > >> And this is the reason why I'm not forced to include xwikivars.vm in the >> modified JSX. Please, am I right? I could use !$hasEdit, but then I must >> include #template('xwikivars.vm'). I've tried and it seems to work fine. >> > > Exactly. > > >> Please, why don't directly use !$xwiki.hasAccessLevel('edit')? >> > > To avoid (re)evaluating/recomputing the edit right multiple times (it > may be costly). The value returned by $xwiki.hasAccessLevel('edit') is > cached in $hasEdit to speed up the page loading time. $hasEdit > (velocity, server-side) is also send to the client side in the value of > the "hasEdit" property of XWiki JavaScript object. > > Hope this helps, > Marius > > Far clear! Thanks! >> Thanks! >> >> >>> Hope this helps, >>> Marius >>> >>> >>> Thanks! >>> Raluca. >>> >>> On Mon, Nov 15, 2010 at 12:36 AM, Ricardo Rodriguez [eBioTIC.] >>> 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. > >
Re: [xwiki-users] showing/hiding annotations entry in contentmenu
On 11/17/2010 09:24 AM, Ricardo Rodriguez [eBioTIC.] wrote: > > > Marius Dumitru Florea wrote: >> On 11/16/2010 01:24 AM, Ricardo Rodriguez [eBioTIC.] wrote: >> >>> Marius Dumitru Florea wrote: >>> On 11/15/2010 03:05 PM, 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:Howtoreferafilefromaskinextension >> . >> >> 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. > > In this particular case changing the JavaScript code that loads the annotation feature is better IMO. >>> I tried but failed to do that. >>> >>> Ricardo, did you check AnnotationCode.Script ? I can see these lines at the end of the second JSX (named "Annotation Javascript -- Annotation application"): // if the action on the current document is not view, don't load annotations if (XWiki.contextaction != "view") { return; } I'm sure you can extend the test for your needs. Hope this helps, Marius >>> I think I get the point. Even though I'm not able to understand this >>> script now or how to tweak it, I understand that this option blocks the >>> loading process of the annotation feature. It is "cheaper" to do that as >>> it stops a process not required for a given type of users. >>> >>> But, please, one more question. When is this script executed? Each time >>> a document is loaded or even reloaded? >>> >> >> The JavaScript code of this extension is evaluated (loaded into >> browser's memory) for each wiki page, and the code at the end of the >> second JSX object is executed after a wiki page finished loading (in the >> browser): >> >> document.observe('xwiki:dom:loaded', function() { >> ... // code executed after the page finished loading. >> }); >> >> Does this match your needs: >> >> document.observe('xwiki:dom:loaded', function() { >> // if the action on the current document is not view, don't load >> annotations >> if (XWiki.contextaction != "view" || !XWiki.hasEdit) { >> return; >> } >> ...// the rest of the code that loads the annotation feature. >> }); >> >> > > It works without a glitch (XE 2.7-SNAPSHOT.32908). I think it is more > elegant than tweaking CSS and doesn't compromise performance. Thanks! > >> Note that XWiki.hasEdit is defined in javascript.vm . >> > > And this is the reason why I'm not forced to include xwikivars.vm in the > modified JSX. Please, am I right? I could use !$hasEdit, but then I must > include #template('xwikivars.vm'). I've tried and it seems to work fine. Exactly. > > Please, why don't directly use !$xwiki.hasAccessLevel('edit')? To avoid (re)evaluating/recomputing the edit right multiple times (it may be costly). The value returned by $xwiki.hasAccessLevel('edit') is cached in $hasEdit to speed up the page loading time. $hasEdit (velocity, server-side) is also send to the client side in the value of the "hasEdit" property of XWiki JavaScript object. Hope this helps, Marius > > Thanks! > >> Hope this helps, >> Marius >> >> >>> Thanks! >>> >>> >> Raluca. >> >> On Mon, Nov 15, 2010 at 12:36 AM, Ricardo Rodriguez [eBioTIC.] >> 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 pos
Re: [xwiki-users] showing/hiding annotations entry in contentmenu
Marius Dumitru Florea wrote: > On 11/16/2010 01:24 AM, Ricardo Rodriguez [eBioTIC.] wrote: > >> Marius Dumitru Florea wrote: >> >>> On 11/15/2010 03:05 PM, 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:Howtoreferafilefromaskinextension > . > > 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. >>> In this particular case changing the JavaScript code that loads the >>> annotation feature is better IMO. >>> >> I tried but failed to do that. >> >> >>> Ricardo, did you check >>> AnnotationCode.Script ? I can see these lines at the end of the second >>> JSX (named "Annotation Javascript -- Annotation application"): >>> >>> // if the action on the current document is not view, don't load annotations >>> if (XWiki.contextaction != "view") { >>> return; >>> } >>> >>> I'm sure you can extend the test for your needs. >>> >>> Hope this helps, >>> Marius >>> >>> >>> >> I think I get the point. Even though I'm not able to understand this >> script now or how to tweak it, I understand that this option blocks the >> loading process of the annotation feature. It is "cheaper" to do that as >> it stops a process not required for a given type of users. >> >> But, please, one more question. When is this script executed? Each time >> a document is loaded or even reloaded? >> > > The JavaScript code of this extension is evaluated (loaded into > browser's memory) for each wiki page, and the code at the end of the > second JSX object is executed after a wiki page finished loading (in the > browser): > > document.observe('xwiki:dom:loaded', function() { >... // code executed after the page finished loading. > }); > > Does this match your needs: > > document.observe('xwiki:dom:loaded', function() { >// if the action on the current document is not view, don't load > annotations >if (XWiki.contextaction != "view" || !XWiki.hasEdit) { > return; >} >...// the rest of the code that loads the annotation feature. > }); > > It works without a glitch (XE 2.7-SNAPSHOT.32908). I think it is more elegant than tweaking CSS and doesn't compromise performance. Thanks! > Note that XWiki.hasEdit is defined in javascript.vm . > And this is the reason why I'm not forced to include xwikivars.vm in the modified JSX. Please, am I right? I could use !$hasEdit, but then I must include #template('xwikivars.vm'). I've tried and it seems to work fine. Please, why don't directly use !$xwiki.hasAccessLevel('edit')? Thanks! > Hope this helps, > Marius > > >> Thanks! >> >> > Raluca. > > On Mon, Nov 15, 2010 at 12:36 AM, Ricardo Rodriguez [eBioTIC.] > 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 >>>
Re: [xwiki-users] showing/hiding annotations entry in contentmenu
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 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:Howtoreferafilefromaskinextension > . > > 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#HMinimalStyleSheeteXtension ...as an {{info}} block. Do you agree? Thanks! >>> > Raluca. > > On Mon, Nov 15, 2010 at 12:36 AM, Ricardo Rodriguez [eBioTIC.] >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 users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] showing/hiding annotations entry in contentmenu
On 11/16/2010 01:24 AM, Ricardo Rodriguez [eBioTIC.] wrote: > > > Marius Dumitru Florea wrote: >> On 11/15/2010 03:05 PM, 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:Howtoreferafilefromaskinextension . 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. >>> >> >> In this particular case changing the JavaScript code that loads the >> annotation feature is better IMO. > > I tried but failed to do that. > >> Ricardo, did you check >> AnnotationCode.Script ? I can see these lines at the end of the second >> JSX (named "Annotation Javascript -- Annotation application"): >> >> // if the action on the current document is not view, don't load annotations >> if (XWiki.contextaction != "view") { >> return; >> } >> >> I'm sure you can extend the test for your needs. >> >> Hope this helps, >> Marius >> >> > > I think I get the point. Even though I'm not able to understand this > script now or how to tweak it, I understand that this option blocks the > loading process of the annotation feature. It is "cheaper" to do that as > it stops a process not required for a given type of users. > > But, please, one more question. When is this script executed? Each time > a document is loaded or even reloaded? The JavaScript code of this extension is evaluated (loaded into browser's memory) for each wiki page, and the code at the end of the second JSX object is executed after a wiki page finished loading (in the browser): document.observe('xwiki:dom:loaded', function() { ... // code executed after the page finished loading. }); Does this match your needs: document.observe('xwiki:dom:loaded', function() { // if the action on the current document is not view, don't load annotations if (XWiki.contextaction != "view" || !XWiki.hasEdit) { return; } ...// the rest of the code that loads the annotation feature. }); Note that XWiki.hasEdit is defined in javascript.vm . Hope this helps, Marius > > Thanks! > Raluca. On Mon, Nov 15, 2010 at 12:36 AM, Ricardo Rodriguez [eBioTIC.] 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 > users@xwiki.org > http://lists.xwiki.org/mailman/listinfo/users > > ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users >>> >> ___ >> users mailing list >> users@xwiki.org >> http://lists.xwiki.org/mailman/listinfo/users >> > ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] showing/hiding annotations entry in contentmenu
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 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:Howtoreferafilefromaskinextension . 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. >> >> Raluca. On Mon, Nov 15, 2010 at 12:36 AM, Ricardo Rodriguez [eBioTIC.] 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 -- Sergiu Dumitriu http://purl.org/net/sergiu/ ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] showing/hiding annotations entry in contentmenu
Vincent Massol wrote: > On Nov 15, 2010, at 10:12 PM, Ricardo Rodriguez [eBioTIC.] wrote: > > >> 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:Howtoreferafilefromaskinextension > . > > 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 >> > > This is a design document for the future. This hasn't been really discussed > yet and it represents how Thomas and me see how the front end architecture > could be modeled in the future. > > Right now it's: > http://platform.xwiki.org/xwiki/bin/view/DevGuide/Architecture#HHTTPRequestAnalysis > > Thanks > -Vincent > Thanks! > >> Thanks! >> >> >> Thanks! > Raluca. > > On Mon, Nov 15, 2010 at 12:36 AM, Ricardo Rodriguez [eBioTIC.] > 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 >> > > ___ > users mailing list > users@xwiki.org > http://lists.xwiki.org/mailman/listinfo/users > > -- Ricardo Rodríguez CTO eBioTIC. Life Sciences, Data Modeling and Information Management Systems ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] showing/hiding annotations entry in contentmenu
Marius Dumitru Florea wrote: > On 11/15/2010 03:05 PM, 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:Howtoreferafilefromaskinextension >>> . >>> >>> 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. >> > > In this particular case changing the JavaScript code that loads the > annotation feature is better IMO. I tried but failed to do that. > Ricardo, did you check > AnnotationCode.Script ? I can see these lines at the end of the second > JSX (named "Annotation Javascript -- Annotation application"): > > // if the action on the current document is not view, don't load annotations > if (XWiki.contextaction != "view") { >return; > } > > I'm sure you can extend the test for your needs. > > Hope this helps, > Marius > > I think I get the point. Even though I'm not able to understand this script now or how to tweak it, I understand that this option blocks the loading process of the annotation feature. It is "cheaper" to do that as it stops a process not required for a given type of users. But, please, one more question. When is this script executed? Each time a document is loaded or even reloaded? Thanks! >>> Raluca. >>> >>> On Mon, Nov 15, 2010 at 12:36 AM, Ricardo Rodriguez [eBioTIC.] >>>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 users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users >>> ___ >>> users mailing list >>> users@xwiki.org >>> http://lists.xwiki.org/mailman/listinfo/users >>> >>> >> > ___ > users mailing list > users@xwiki.org > http://lists.xwiki.org/mailman/listinfo/users > -- Ricardo Rodríguez CTO eBioTIC. Life Sciences, Data Modeling and Information Management Systems ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] showing/hiding annotations entry in contentmenu
Raluca Stavro wrote: > Hi, > > On Mon, Nov 15, 2010 at 3:05 PM, 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:Howtoreferafilefromaskinextension >>> . >>> >>> 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! > > >>> Raluca. >>> >>> On Mon, Nov 15, 2010 at 12:36 AM, Ricardo Rodriguez [eBioTIC.] >>> 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 users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users >>> ___ >>> users mailing list >>> users@xwiki.org >>> http://lists.xwiki.org/mailman/listinfo/users >>> >>> >> -- >> Sergiu Dumitriu >> http://purl.org/net/sergiu/ >> ___ >> users mailing list >> users@xwiki.org >> http://lists.xwiki.org/mailman/listinfo/users >> >> > ___ > users mailing list > users@xwiki.org > http://lists.xwiki.org/mailman/listinfo/users > > -- Ricardo Rodríguez CTO eBioTIC. Life Sciences, Data Modeling and Information Management Systems ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] showing/hiding annotations entry in contentmenu
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:Howtoreferafilefromaskinextension >> . >> >> 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.] >> 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 Modeli
Re: [xwiki-users] showing/hiding annotations entry in contentmenu
On Nov 15, 2010, at 10:12 PM, Ricardo Rodriguez [eBioTIC.] wrote: > > > 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:Howtoreferafilefromaskinextension . 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 This is a design document for the future. This hasn't been really discussed yet and it represents how Thomas and me see how the front end architecture could be modeled in the future. Right now it's: http://platform.xwiki.org/xwiki/bin/view/DevGuide/Architecture#HHTTPRequestAnalysis Thanks -Vincent > Thanks! > > >> >>> Thanks! >>> Raluca. On Mon, Nov 15, 2010 at 12:36 AM, Ricardo Rodriguez [eBioTIC.] 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 ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] showing/hiding annotations entry in contentmenu
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:Howtoreferafilefromaskinextension >>> . >>> >>> 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.] >>> 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 users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] showing/hiding annotations entry in contentmenu
On 11/15/2010 03:05 PM, 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:Howtoreferafilefromaskinextension >> . >> >> 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. In this particular case changing the JavaScript code that loads the annotation feature is better IMO. Ricardo, did you check AnnotationCode.Script ? I can see these lines at the end of the second JSX (named "Annotation Javascript -- Annotation application"): // if the action on the current document is not view, don't load annotations if (XWiki.contextaction != "view") { return; } I'm sure you can extend the test for your needs. Hope this helps, Marius > >> Raluca. >> >> On Mon, Nov 15, 2010 at 12:36 AM, Ricardo Rodriguez [eBioTIC.] >>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 >>> users@xwiki.org >>> http://lists.xwiki.org/mailman/listinfo/users >>> >> ___ >> users mailing list >> users@xwiki.org >> http://lists.xwiki.org/mailman/listinfo/users >> > > ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] showing/hiding annotations entry in contentmenu
Hi, On Mon, Nov 15, 2010 at 3:05 PM, 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:Howtoreferafilefromaskinextension >> . >> >> 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. > >> Raluca. >> >> On Mon, Nov 15, 2010 at 12:36 AM, Ricardo Rodriguez [eBioTIC.] >> 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 >>> users@xwiki.org >>> http://lists.xwiki.org/mailman/listinfo/users >>> >> ___ >> users mailing list >> users@xwiki.org >> http://lists.xwiki.org/mailman/listinfo/users >> > > > -- > Sergiu Dumitriu > http://purl.org/net/sergiu/ > ___ > users mailing list > users@xwiki.org > http://lists.xwiki.org/mailman/listinfo/users > ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] showing/hiding annotations entry in contentmenu
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:Howtoreferafilefromaskinextension > . > > 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. > Raluca. > > On Mon, Nov 15, 2010 at 12:36 AM, Ricardo Rodriguez [eBioTIC.] > 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 >> users@xwiki.org >> http://lists.xwiki.org/mailman/listinfo/users >> > ___ > users mailing list > users@xwiki.org > http://lists.xwiki.org/mailman/listinfo/users > -- Sergiu Dumitriu http://purl.org/net/sergiu/ ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] showing/hiding annotations entry in contentmenu
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:Howtoreferafilefromaskinextension >> . >> >> 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! >> Raluca. >> >> On Mon, Nov 15, 2010 at 12:36 AM, Ricardo Rodriguez [eBioTIC.] >> 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 -- Sergiu Dumitriu http://purl.org/net/sergiu/ ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] showing/hiding annotations entry in contentmenu
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:Howtoreferafilefromaskinextension > . > > 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? Thanks! > Raluca. > > On Mon, Nov 15, 2010 at 12:36 AM, Ricardo Rodriguez [eBioTIC.] > 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 >> users@xwiki.org >> http://lists.xwiki.org/mailman/listinfo/users >> >> > ___ > users mailing list > users@xwiki.org > http://lists.xwiki.org/mailman/listinfo/users > > -- Ricardo Rodríguez CTO eBioTIC. Life Sciences, Data Modeling and Information Management Systems ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] showing/hiding annotations entry in contentmenu
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:Howtoreferafilefromaskinextension . Example of usage: #if(!$hasEdit) #body{ background-color: red; } #end Raluca. On Mon, Nov 15, 2010 at 12:36 AM, Ricardo Rodriguez [eBioTIC.] 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 > users@xwiki.org > http://lists.xwiki.org/mailman/listinfo/users > ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] showing/hiding annotations entry in contentmenu
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 users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] showing/hiding annotations entry in contentmenu
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 -- Ricardo Rodríguez CTO eBioTIC. Life Sciences, Data Modeling and Information Management Systems ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users