#macro( template $tname ) $xwiki.parseTemplate($tname) #end #macro( includeTopic $topic ) $xwiki.includeTopic($topic) #end #macro( includeMacros $topic ) $xwiki.includeForm($topic) #end #macro( includeForm $topic ) $xwiki.includeForm($topic) #end #macro( includeInContext $topic ) $xwiki.includeForm($topic) #end #macro( includeServlet $url) $xwiki.invokeServletAndReturnAsString($url) #end #macro(editactions) $msg.get("preview") | $msg.get("save") #end #macro( versions ) #foreach( $rev in $tdoc.getRecentRevisions(4) ) $rev | #end #if ($tdoc.realLanguage!="") $msg.get("diff") | #else $msg.get("history") | #end #end ## Display all queued Struts errors #macro (errorMarkup) #if ($errors.exist() ) #end #end ## Display all queued Struts errors for a particular property #macro (errorMarkupForProperty $property) #if ($errors.exist($property) ) #end #end #macro(jabber $id) jabber $id #end #macro(skype $id) #end #macro(yahoo $id) yahoo $id #end #macro(aim $id) #set($onurl = "http://${request.serverName}${xwiki.getSkinFile('aimonline.gif')}") #set($offurl = "http://${request.serverName}${xwiki.getSkinFile('aimoffline.gif')}") Online detector #end #macro(msn $id) #set($onurl = "${request.serverName}${xwiki.getSkinFile('msnonline.gif')}") #set($offurl = "${request.serverName}${xwiki.getSkinFile('msnoffline.gif')}") #end #macro(im $user) #set($userdoc = $xwiki.getDocument($user)) #set($userobj = $userdoc.getObject("XWiki.XWikiUsers")) #set($imtype = $userdoc.display("imtype","view",$userobj)) #set($imaccount = $userdoc.display("imaccount","view",$userobj)) #if($imtype=="Yahoo") #yahoo("$imaccount") #end #if($imtype=="AIM") #aim("$imaccount") #end #if($imtype=="MSN") #msn("$imaccount") #end #if($imtype=="Jabber") #jabber("$imaccount") #end #if($imtype=="Skype") #skype("$imaccount") #end #end #macro(sign $username) #if($username.indexOf(".")==-1) #set($username = "XWiki.${username}") #end #if($xwiki.exists("$username")) $xwiki.getUserName("$username") #else $xwiki.getUserName("xwiki:${username}") #end #end #macro(includeHelp $pagename) #if($xwiki.exists("xwiki:XWiki.${pagename}")) $xwiki.includeForm("xwiki:XWiki.${pagename}",false) #else #if($xwiki.exists("XWiki.${pagename}")) $xwiki.includeForm("XWiki.${pagename}",false) #end #end #end #macro(flickr $rss) {rss:feed=${rss}|full=1} #end #macro(flickrtag $tag) #flickr("http://www.flickr.com/services/feeds/photos_public.gne?tags=${tag}&format=rss_200") #end #macro(flickruser $id) #flickr("http://www.flickr.com/services/feeds/photos_public.gne?id=${id}&format=rss_200") #end #macro(flickrusertag $id $tag) #flickr("http://www.flickr.com/services/feeds/photos_public.gne?id=${id}&tags=${tag}&format=rss_200") #end #macro(map $address $cp $linktext) ${linktext} #end #macro(mindmap $mindmap $width $height) #if(!$width) #set($width="100%") #end #if(!$height) #set($height="600") #end #if(!$mindmap) #set($mindmap = "") #set($mmurl = "") #else #if($mindmap.startsWith("http")) #set($mmurl = $mindmap) #else #set($mmurl1 = $doc.getAttachmentURL($mindmap,"download")) #set($mmurl = "http://${request.serverName}${mmurl1}") #end #end #end #macro (toc $init $max $numbered) #set ($int = 0) #set ($boolean = false) #if ($init == "") #set ($init = 2) #else #set ($init = $int.valueOf($init)) #end #if ($max == "") #set ($max = 6) #else #set ($max = $int.valueOf($max)) #end #if ($numbered == "") #set ($numbered = false) #else #set ($numbered = $boolean.valueOf($numbered)) #set ($context.context.tocNumbered = $numbered) #end #set ($tocData = ${tdoc.getTOC($init, $max, $numbered)}) #set ($context.context.tocData = $tocData) #set ($lastLevel = $init - 1) #set ($depth = 0) #foreach ($tocEntry in $tocData.entrySet()) #set ($level = $tocEntry.value.level) #if ($level > $lastLevel) #set ($to = $lastLevel + 1) #set ($iter = [$level .. $to]) #foreach ($n in $iter) #set ($depth = $depth - 1) #end #end
  • $!tocEntry.value.numbering $tocEntry.value.text #set ($lastLevel = $level) #end #if ($depth > 0) #set ($levels = [1 .. $depth]) #foreach($level in $levels) #end #end #end #macro (exportPackage) #set($export = $request.get("export")) #if ($export == "1") #set($dateFormat = "dd MMM yyyy ? HH:mm") #set($diff = $request.get("diff")) #set($SpaceName = $request.get("SpaceName")) 1.1 Space : $SpaceName
    #set($docs = $xwiki.getSpaceDocsName($SpaceName)) #foreach ($doc in $docs) #if ($xwiki.hasAccessLevel("view", "${context.database}:${SpaceName}.${doc}")) #end #end
    NameExportDefault Action
    overwritemerge objectsskip
    [${doc}>${SpaceName}.${doc}]
    #if($SpaceName != "XWiki") 1.1 Space : XWiki #set($docs = $xwiki.getSpaceDocsName("XWiki")) #foreach ($doc in $docs) #if ($xwiki.hasAccessLevel("view", "${context.database}:XWiki.${doc}")) #end #end
    NameExportDefault Action
    overwritemerge objectsskip
    [${doc}>XWiki.${doc}]
    #end
    #elseif ($export == "2") #set($ToExport = $request.getParameterValues("ToExport")) $response.setContentType("application/zip") #set($export = $xwiki.export) #foreach ($itemexp in $ToExport) #set($defaultAction = $request.get("${itemexp}_default")) $export.add($itemexp, $defaultAction) #end $export.export() #else
    Select the space you want to export :
    #set($spaces = $xwiki.getSpaces())
    #end #end #macro (importPackage) #set($toexport = $request.get("export")) #if($toexport == "1") #set($appName = $request.get("App")) #set($alist = $doc.getAttachmentList()) #foreach ($oAttach in $alist) #if ($oAttach.getFilename() == $appName) #set($import = $xwiki.import) $import.importPackage($oAttach.getContent()) #set($docs = $import.getDocuments()) #foreach($docInfo in $docs) #set($right = "") #set($right = $request.get("$docInfo.getFullName()_default")) #if($right) $import.setDocumentAction($docInfo.getFullName(), $right) #end #end #set($ret = $import.install()) $import.getTestInstallToString($ret) #end #end #else #set($alist = $doc.getAttachmentList()) #if ($alist.size() == 0) Add the package in attachment #end #foreach ($oAttach in $alist) #set($import = $xwiki.import) 1.1 $oAttach.getFilename() $import.importPackage($oAttach.getContent()) 1.1.1 Infos Author : $import.getAuthor()
    Name : $import.getName()
    Description : $import.getDescription()
    Licence : $import.getLicence()
    Version : $import.getVersion()
    #set($canInstall = $import.testInstall()) install : $import.getTestInstallToString($canInstall) 1.1.1 Status of each Files #set($docs = $import.getDocuments())
    #foreach($docInfo in $docs) #if($import.getTestInstallToString($docInfo.isInstallable()) == "Already exist") #if ($import.getActionToString($docInfo.getDefaultAction()) == "overwrite") #else #end #if ($import.getActionToString($docInfo.getDefaultAction()) == "merge") #else #end #if ($import.getActionToString($docInfo.getDefaultAction()) == "skip") #else #end #else #end #end
    NameinfosAction
    overwritemerge objectsskip
    [$docInfo.getFullName()>$docInfo.getFullName()] __$import.getTestInstallToString($docInfo.isInstallable())__
    #if ($canInstall != 0) 1.1.1 You can install this application #else 1.1.1 You can't install this application. #end
    #end #end #end #macro(xwikiobjectfield $fielddoc $fieldname $fieldtext $action)
    $fieldtext
    #if($fieldname!="") $fielddoc.display($fieldname, $action) #end
    #end #macro(formfield $fieldtext $html)
    $fieldtext
    $html
    #end #macro(defaultDisplayObj $document $obj) #set($class = $obj.xWikiClass) #foreach($prop in $class.properties) #formfield(${prop.prettyName} $document.display($prop.getName(), "edit", $obj)) #end #end #macro(defaultViewDisplayObj $document $obj) #set($class = $obj.xWikiClass) #foreach($prop in $class.properties) #formfield(${prop.prettyName} $document.display($prop.getName(), "view", $obj)) #end #end ## ## Formats a date according to the ISO8601 standard ## #macro(formatdateISO $date) #set($tz = $xwiki.formatDate($date, "Z")) #set($tz = "${tz.substring(0, 3)}:${tz.substring(3)}") $xwiki.formatDate($date, "yyyy-MM-dd")T$xwiki.formatDate($date, "hh:mm:ss")$tz#end ## ## Formats a username like a fn (hCard microformat) ## #macro(userfn $username) #set($fn = $xwiki.getLocalUserName($username)) #if($fn.indexOf("= 0) #set($fn = $fn.replace("