Issue Details (XML | Word | Printable)

Key: XWIKI-259
Type: Task Task
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Phung Hai Nam
Reporter: Ludovic Dubost
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XWiki Core

Add a macro button in the WYSIWYG allowing to insert from a configurable list of macros

Created: 03/May/06 10:27   Updated: 05/Jan/07 11:36
Component/s: None
Affects Version/s: None
Fix Version/s: 1.0 B2

File Attachments: 1. Zip Archive TaskMacroButton.zip (399 kB)


Date of First Response: 23/May/06 10:34
Resolution Date: 05/Jan/07 11:36


 Description  « Hide

2/ Add a macro button in the WYSIWYG allowing to insert from a configurable list of macros (this list would come from the preferences field macros_mapping.
You can see the test for macro mapping here:
http://svn.forge.objectweb.org/cgi-bin/viewcvs.cgi/xwiki/xwiki/trunk/src/test/java/com/xpn/xwiki/test/MacroMappingRenderTest.java?view=auto&rev=943

For example

In macros_mapping put:

hello=velocity:hello4:first_name,last_name
sign=velocity:sign:user

In XWiki.VelocityMacros put

#macro(hello $first_name $last_name)
Hello $name
#end

#macro(sign $user)
Signature by $user
#end

Then in the WYSIWYG Interface you should have a button to insert a Macro. This button should popup a window allowing to choose which macro.
The window should show "hello" and "sign". When you choose "sign" then the popup should ask you to fill in first_name and last_name.
When you click ok the following text should be included in the document

{sign:first_name=ludovic|last_name=dubost}

If you click inside this macro and click again on the macro button you should have the form for this macro pre-filled.



 All   Comments   Change History   FishEye      Sort Order: Ascending order - Click to sort in descending order
Phung Hai Nam added a comment - 23/May/06 10:34
In this package I added the macros plugin to editor
You can install it and check it

Ludovic Dubost added a comment - 25/May/06 10:28
This looks good. Here are a few remarks:

1/ The separator between variables in the {} macro should be | and not ,
2/ Macros should be reeditable (from the cursor you should look for the first { on the left and a } on the right. This should allow to find the macro content in most cases.
3/ We should make sure xwiki.macromapping=1 in xwiki.cfg to show the button
4/ The window is a little small of the macro has 3 or more parameters

Here is a list of macro definitions for macros.vm

skype=velocity:skype:id
yahoo=velocity:yahoo:id
jabber=velocity:jabber:id
aim=velocity:aim:id
msn=velocity:msn:id
flickr=velocity:flickr:rssfeed
flickrtag=velocity:flickrtag:tag
flickruser=velocity:flickruser:userid
flickrusertag=velocity:flickrusertag:userid,tag
viamichelin=velocity:map:address,codepostal,texte
mindmap=velocity:mindmap:url,width,height
toc=velocity:toc:initlevel,maxlevel,numbered
includeForm=velocity:includeForm:topic
includeTopic=velocity:includeTopic:topic
includeMacros=velocity:includeMacros:topic
code=radeox:code:type:content


Phung Hai Nam added a comment - 05/Jan/07 11:36
This bug has been fixed !