Hi Ozren, On Sun, Jan 29, 2012 at 11:20 PM, Ozren Lasić <[email protected]> wrote:
Hi,
In order to customize WYSIWYSG editor only on some pages I have made following changes in wysiwyg_storeConfig macro:
#macro(wysiwyg_storeConfig $parameters $editedDocument $fieldId $full) ... #if($xcontext.contains('wysiwyg_overriding_parameters')) #set($ok = $parameters.putAll($xcontext.putAll('wysiwyg_overriding_parameters'))) #end ... #end
Part of sheet for these pages looks like this:
#set($overriding_parameters = $util.hashMap) #set($ok = $overriding_parameters.put('plugins', ...)) #set($ok = $overriding_parameters.put('menu', ...)) #set($ok = $overriding_parameters.put('toolbar', ...)) #set($ok = $xcontext.put('wysiwyg_overriding_parameters', $overriding_parameters))
This is good enough for editors on previously created pages. Editors look (in inline mode) just the way I want. But, on new pages editors always use default configuration.
To test these unexpected result I added following two lines in the sheet:
#set($ok = $xcontext.put('foo', 'bar')) $xcontext.get('foo')
On new pages $xcontext.get('foo') is displayed, and on existing ones it is bar.
The reason is that $xcontext.get() requires programming rights [1] which are checked against the content author of the page, and since the page is new it doesn't have a content author, so programming rights are not granted. Instead of modifying the wysiwyg_storeConfig Velocity macro from macros.vm you could put the custom configuration code directly in your sheet, as indicated at [2]. Hope this helps, Marius [1] http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/org... [2] http://extensions.xwiki.org/xwiki/bin/view/Extension/WYSIWYG+Editor+Module#H...
(Version 3.1)
Thanks, Ozren
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users