### ### Separator ### ### Insert a span containing a | ### #macro (sep) | #end ### ### useravatar ### ### Display the avatar of a user, or a standard image if the user has no avatar ### ### @param username The name of the user whose avatar will be displayed ### #macro(useravatar $username) #if(!$picturelist) #set($picturelist = $xwiki.hashMap) #end #if(!$picturelist.containsKey($username)) #set($picture = "$username")) #set($profiledoc = $xwiki.getDocument($username)) #if(!$profiledoc.isNew()) #set($profileobj = $profiledoc.getObject("XWikiUsers", 0)) #if($profiledoc.attachmentList.size() != 0) #set($hasavatar = 0) #if($profileobj.avatar && $profileobj.avatar != "") #foreach ($attach in $profiledoc.attachmentList) #if($attach.filename == $profileobj.avatar) #set($hasavatar = 1) #end #end #end #if($hasavatar == 1) #set($pictureurl = $profiledoc.getAttachmentURL($profileobj.avatar)) #set($picture = ""))
          #set($picture = $picture.concat($username))
          #set($picture = $picture.concat("")) #end #end #end $!picturelist.put($username, $picture) #end $picturelist.get($username) #end ### ### mimetypeimg ### ### Display an icon according to the mimetype ### ### @param mime The reported mimetype of the file ### @param fname The name of the file ### #macro(mimetypeimg $mime $fname) #set($idx = $fname.lastIndexOf(".")) #set($idx = $idx + 1) #if(($idx != 0) && ($idx != -1)) #set($ext = $fname.substring($idx)) #else #set($ext = "") #end ##### images #if($mime.equals("image/svg")) [svg]#elseif($mime.equals("application/svg+xml")) [svg]#elseif($mime.startsWith("image/")) [img]##### text based #elseif($mime.equals("text/plain")) [text]#elseif($mime.equals("text/html")) [html]#elseif($mime.equals("text/css")) [css]#elseif($mime.startsWith("text/")) [text]##### documents #elseif($mime.equals("application/xml")) [xml]#elseif($mime.equals("application/pdf")) [pdf]#elseif($mime.equals("application/postscript")) [ps]#elseif($mime.equals("application/msword")) [doc]#elseif($mime.equals("application/powerpoint")) [ppt]#elseif($mime.equals("application/x-shockwave-flash")) [swf]##### archives #elseif($mime.equals("application/x-tar")) [tar]#elseif($mime.equals("application/zip")) [zip]#elseif($mime.equals("application/x-gzip")) [gz]#elseif($mime.equals("application/java-archive")) [jar]##### media #elseif($mime.startsWith("audio/")) [audio]#elseif($mime.startsWith("video/")) [video]##### octet-streams extensions #elseif($mime.equals("application/octet-stream")) #if($ext.equals("xls")) [xls]#elseif($ext.equals("bz") || $ext.equals("bz2") || $ext.equals("tbz")) [bz]#elseif($ext.equals("tgz")) [gz]#elseif($ext.equals("rar")) [rar]#elseif($ext.equals("odp") || $ext.equals("odt") || $ext.equals("odf") || $ext.equals("sxw") || $ext.equals("stw")) [odf]#else [bin]#end #elseif($mime.startsWith("application/")) [app]#end #end ### ### packName ### ### Display a shorter version of a string ### ### @param name The processed string ### #macro(packName $name) #if(!$maxnamelength) #set($maxnamelength = 25) #end #set($idx = $name.lastIndexOf(".")) #if(($idx != 0) && ($idx != -1)) #set($ext = $name.substring($idx)) #else #set($ext = "") #set($idx = $name.length()) #end #set($fname = $name.substring(0, $idx)) #if($fname.length() > $maxnamelength)$fname.substring(0, $maxnamelength)~$ext#else$name#end #end ### ### Panel header ### ### Generate the starting html code for a panel ### ### @param title The panel caption title ### #macro(panelheader $title)
$title
#end #macro(panelhiddenheader $title)
#end #macro(largepanelheader $title)
$title
## 
#end ### ### Panel footer ### ### Generate the ending html code for a panel ### #macro(panelfooter)
#end ### ### Display Panel ### ### Extract and display the panel code from the panel object ### #macro(displaypanel $name) #set($pobj = "") #set($paneldoc = $xwiki.getDocument($name)) #if($paneldoc.fullName==$name) #set($pobj = $paneldoc.getObject("Panels.PanelClass")) #if(!$pobj) ## discarded #else $!doc.display("content", "view", $pobj) #end #end #end #macro(displayPropName $prop) #if($msg.get("$class.getName()_$prop.name") == "$class.getName()_$prop.name") $prop.prettyName#else $msg.get($prop.name)#end #end ### ### Display Panel content ### ### #macro(displaypanelcontent $doc $obj) $doc.display("content", $obj) #end ### ### Toplevel Menu entry with subitems ### ### Generate a menu entry and start the subitem section ### ### @param actionurl The URL this entry points to ### @param linktext The menu item text ### #macro(xwikitopmenuentrystart $actionurl $linktext $id)
$linktext
#end ### ### Message box ### #macro(xwikimessageboxstart $title $message)
$title

$message

#end #macro(xwikimessageboxend)
#end #macro(xwikimessagebox $title $message $urlyes $urlno $msgyes $msgno) #xwikimessageboxstart($title $message)
#xwikimessageboxend() #end #macro(xwikimessageboxfield $fielddoc $fieldname $fieldtext $html)
$fieldtext
#if($fieldname!="") $fielddoc.display($fieldname, "edit") #end #if($html!="") $html #end
#end #macro(xwikimessageboxsubmit $submittext)
#end ### ### message ### #macro(warning $text)
$msg.get("warning"): $text
#end #macro(error $text)
$msg.get("error"): $text
#end #macro(info $text)
$text
#end #macro(message $text)
$text
#end #macro (floatingbox $text)
$text
#end #macro (startfloatingbox)
#end #macro (endfloatingbox)
#end ### ### CSS properties ### #macro(csscolorproperty $csspropname $fieldname) #set($objcolor = $colors.get($fieldname)) #if($objcolor && $objcolor != "") $csspropname: $objcolor; #end #end #macro(csscolorpropertyimportant $csspropname $fieldname) #set($objcolor = $colors.get($fieldname)) #if($objcolor && $objcolor != "") $csspropname: $objcolor !important; #end #end #macro(displayPropName $prop) #if($msg.get("$class.getName()_$prop.name") == "$class.getName()_$prop.name") $prop.prettyName#else $msg.get($prop.name)#end #end ### ### Display Panel content ### ### #macro(displaypanelcontent $doc $obj) $doc.display("content", $obj) #end