[xwiki-users] How to suppress the rendering of the TOC macro inside an included page?

2010-11-16 Thread H.-Dirk Schmitt
Hello!

is there a way to suppress the rendering of the TOC macro inside an
included page?
Can I control the level of headlines for the included page (e.g. make
'=' to '===') ?

Best Regards,

H.-Dirk Schmitt
-- 


*
H.-Dirk Schmitt http://www.computer42.org *
Dipl. Math.

eMail:/dirk.schm...@computer42.org/
mobile:/+49 177 616 8564/
phone: /+49 2642 99 41 10/
fax: /+49 2642 99 41 15/

Kripper Str. 35, D-53489 Sinzig

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] How to suppress the rendering of the TOC macro inside an included page?

2010-11-16 Thread Vincent Massol
Hi,

On Nov 16, 2010, at 9:51 AM, H.-Dirk Schmitt wrote:

 Hello!
 
 is there a way to suppress the rendering of the TOC macro inside an
 included page?

Not really. Anything is possible but it would be complex. You'd need to 
overwrite the include macro to have a special handling.

Maybe this would help though:
http://jira.xwiki.org/jira/browse/XWIKI-4358

Thanks
-Vincent

 Can I control the level of headlines for the included page (e.g. make
 '=' to '===') ?
 
 Best Regards,
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] How to suppress the rendering of the TOC macro inside an included page?

2010-11-16 Thread Joris Dirks
On Tue, Nov 16, 2010 at 9:51 AM, H.-Dirk Schmitt d...@computer42.org wrote:
 Hello!

 is there a way to suppress the rendering of the TOC macro inside an
 included page?
 Can I control the level of headlines for the included page (e.g. make
 '=' to '===') ?

Yes, in your example:
{{toc depth=3 /}}

Please see: http://code.xwiki.org/xwiki/bin/view/Macros/TocMacro20
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] showing/hiding annotations entry in contentmenu

2010-11-16 Thread Marius Dumitru Florea
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.]
 ricardo.rodrig...@ebiotic.netwrote:

 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] component manager not initialized after install

2010-11-16 Thread Scott McMasters
Hi, Jerome, this is the only stack trace I have in my system log:

Exception thrown : javax.servlet.ServletException: Component manager has not
been initialized before lookup for
[org.xwiki.model.reference.DocumentReferenceResolver] for hint
[currentmixed]
at
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:535)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:433)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1143)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1084)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:129)
at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
at
com.xpn.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:152)
at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
at
com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68)
at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
at
org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:218)
at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
at
org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112)
at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:832)
at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:679)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:587)
at
com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:481)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3453)
at
com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:267)
at
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:815)
at
com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1466)
at
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:119)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)
at
com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
at
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196)
at
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:751)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)

Thanks again,

Scott


On Sun, Nov 14, 2010 at 12:59 AM, Jerome Velociter jer...@xwiki.com wrote:

 Hi Scott,

 Would you happen to have a full stack-trace you could point us to ?

 Can you see any nested error related to a DTMManager ?

 Thanks,
 Jerome.

 On Fri, Nov 12, 2010 at 8:37 PM, Scott McMasters
 scott.mcmast...@gmail.com wrote:
  Sorry, I forgot to include that it was version 2.5.1 of the Enterprise
  distribution.
 
  Thanks again,
 
  Scott McMasters
 
 
  On Fri, Nov 12, 2010 at 8:35 PM, Scott McMasters
  scott.mcmast...@gmail.comwrote:
 
  Hello,
 
  I installed 

Re: [xwiki-users] showing/hiding annotations entry in contentmenu

2010-11-16 Thread Ricardo Rodriguez [eBioTIC.]


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 Dumitriuser...@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: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.]
 ricardo.rodrig...@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

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Error on MapMacro

2010-11-16 Thread Ricardo Rodriguez [eBioTIC.]
Hi!

Gerritjan Koekkoek wrote:
 Hello
 I've imported the MapMacro into my test XWIKI.
 If I go to the page imported XWiki/MapMacro the 2 examples show each 2 errors.
 1. Failed to execute the [code] macro 
 2. Not a inline macro

 In the details of error 1 I see a out-of-memory error, i'm running on Mac OS 
 X 10.6.5, Tomcat 6.0.29, mySQL 5.1.50 and XWiki 2.5.1.32531
   

Perhaps you having two different errors. Please, check:

http://jira.xwiki.org/jira/browse/XWIKI-4048

and

http://www.xwiki.org/xwiki/bin/view/FAQ/HowToSolveAJavaHeapMemoryError


It is working for me in a XE 2.7-SNAPSHOT.32908 (Mac OS X 10.5.8, Tomcat 
6.0.18, MySQL 5.1.51)

with

export CATALINA_OPTS=-Xmx256m -Xms256m
export JAVA_OPTS=-Xmx256m -Xms256m

 Details on error 1;
 org.xwiki.rendering.macro.MacroExecutionException: Failed to highlight 
 content at 
 org.xwiki.rendering.internal.macro.code.CodeMacro.parseContent(CodeMacro.java:101)
  at 
 org.xwiki.rendering.internal.macro.code.CodeMacro.parseContent(CodeMacro.java:47)
  at 
 org.xwiki.rendering.macro.box.AbstractBoxMacro.execute(AbstractBoxMacro.java:124)
  at 
 org.xwiki.rendering.macro.box.AbstractBoxMacro.execute(AbstractBoxMacro.java:55)
  at 
 org.xwiki.rendering.internal.transformation.MacroTransformation.transformOnce(MacroTransformation.java:172)
  at 
 org.xwiki.rendering.internal.transformation.MacroTransformation.transform(MacroTransformation.java:117)
  at 
 org.xwiki.rendering.internal.transformation.DefaultTransformationManager.performTransformations(DefaultTransformationManager.java:85)
  at 
 com.xpn.xwiki.doc.XWikiDocument.performSyntaxConversion(XWikiDocument.java:7405)
  at 
 com.xpn.xwiki.doc.XWikiDocument.performSyntaxConversion(XWikiDocument.java:7355)
  at 
 com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:831) at 
 com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:782) at 
 com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:874) at 
 com.xpn.xwiki.api.Document.getRenderedContent(Document.java:537) at 
 sun.reflect.GeneratedMethodAccessor388.invoke(Unknown Source) at 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597) at 
 org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:389)
  at 
 org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:378)
  at 
 org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270) 
 at 
 org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:252)
  at 
 org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:493)
  at 
 org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71)
  at org.apache.velocity.runtime.parser.node.ASTSetDirect
 ive.render(ASTSetDirective.java:142) at 
 org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at 
 org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
  at 
 org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106)
  at 
 org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
  at 
 org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:196)
  at 
 org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:161)
  at 
 com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:116)
  at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:1862) at 
 com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1800) at 
 com.xpn.xwiki.api.XWiki.parseTemplate(XWiki.java:896) at 
 sun.reflect.GeneratedMethodAccessor155.invoke(Unknown Source) at 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597) at 
 org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:389)
  at 
 org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:378)
  at 
 org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270) 
 at 
 org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:252)
   at 
 org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:332)
  at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) 
 at 
 org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:212)
  at 
 org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:247)
  at 
 org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
  at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) 
 at 
 org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
  at 

Re: [xwiki-users] showing/hiding annotations entry in contentmenu

2010-11-16 Thread Ricardo Rodriguez [eBioTIC.]


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.]
 ricardo.rodrig...@ebiotic.netwrote:

   
 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

2010-11-16 Thread Marius Dumitru Florea
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.]
 ricardo.rodrig...@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

 ___
 users mailing list
 users@xwiki.org
 http://lists.xwiki.org/mailman/listinfo/users