Wiki source code of Macros

Last modified by Ludovic Dubost on 2009/02/23 01:15

Show last authors
1 ###
2 ### Display Panel
3 ###
4 ### Extract and display the panel code from the panel object
5 ###
6 #macro(displaypanel $name)
7 #set ($pobj = "")
8 ## Since Velocity does not do any assignment if the RHS is null we need to reset the paneldoc
9 ## as otherwise the previously set panel will be displayed. getDocument() returns null if the
10 ## user doesn't have the right to view a document.
11 #set ($paneldoc = "")
12 #set ($paneldoc = $xwiki.getDocument($name))
13 #if ($paneldoc != "")
14 #set ($pobj = $paneldoc.getObject("Panels.PanelClass"))
15 #if (!$pobj)
16 ## discarded
17 #else
18 #set($gadgeturl = $!paneldoc.display("gadgeturl", "view", $pobj))
19 #set($gadgetprefs = $!paneldoc.display("gadgetprefs", "view", $pobj))
20 #if($gadgeturl && $gadgeturl != "")
21 #set($sgadgeturl = $xwiki.getURLEncoded($gadgeturl))
22 <center>
23 <script src="http://www.gmodules.com/ig/ifr?url=
24 ${sgadgeturl}&amp;synd=open&amp;&amp;title=&amp;lang=${context.language}&amp;country=ALL&amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js&amp;${gadgetprefs}"></script>
25 </center>
26 #else
27 $!doc.display("content", "view", $pobj)
28 #end
29 #end
30 #end
31 #end
32
33 #macro(displaygadget $gadgeturl $params $width $height)
34 <div class="gadget" style="float: left; margin: 10px;">
35 #if($gadgeturl && $gadgeturl != "")
36 #set($sgadgeturl = $xwiki.getURLEncoded($gadgeturl))
37 #if(!$width || $width=="")
38 #set($width = "300")
39 #end
40 #if(!$height || $height=="")
41 #set($height = "200")
42 #end
43 <script src="http://www.gmodules.com/ig/ifr?url=
44 ${sgadgeturl}&amp;synd=open&amp;w=${width}&amp;h=${height}&amp;${params}&amp;title=&amp;lang=${context.language}&amp;country=ALL&amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js"></script>
45 #end
46 </div>
47 #end