[xwiki-devs] How can I dynamically create a panel?

Glenn Everitt Glenn.Everitt at compuware.com
Tue Apr 1 04:11:37 CEST 2008


I was trying to figure out how to dynamically create a panel so I was looking
at create.vm 
shown here:
    	#if($tocreate=="panel")
    		#set($docname=$title.replaceAll("/", "%2F"))
    		#if(!$template || $template == "")
    		#set($template="Panels.PanelTemplate")
    		#end
    		#set($newdoc=$xwiki.getDocument($docname))
    		#if($newdoc.isNew())
    		#set($pcontent = "#")
    		#set($pcontent =
$pcontent.concat("panelheader('${title}')${xwiki.getNl()}${xwiki.getNl()}#"))
    		#set($pcontent = $pcontent.concat("panelfooter()"))
    		#set($pcontent = $util.encodeURL($pcontent))
    		$response.sendRedirect($newdoc.getURL("inline",
"template=${template}&Panels.PanelClass_0_name=${title}&Panels.PanelClass_0_content=$pcontent"))
    		#else
    		$response.sendRedirect($newdoc.getURL("view",
"xpage=docalreadyexists"))
    		#end    		#end
 
.
.
and I quickly got lost.  It looks like you first create a document from in
panels space something like

        XWikiDocument doc = context.getWiki().getDocument("XWiki.MyPanell",
context);

Then it looks like $pcontent concatenates some calls to velocity macros
together.  Then it looks like it is url encoded so it can be passed as http
response. Then I am completely lost with the sendRedirect statement.  Does
it redirect to process the templates and then return the response?

Is there a better example for me to look at or perhaps someone generous
enough to provide me with even more help?  You guys have been very generous
with help and I would like to Thank you!  BTW congratulations on the "Big
News"

Glenn Everitt



-- 
View this message in context: http://www.nabble.com/How-can-I-dynamically-create-a-panel--tp16406339p16406339.html
Sent from the XWiki- Dev mailing list archive at Nabble.com.



More information about the devs mailing list