General Actions:
Log-in
Wiki:
CreativeIT
▼
:
Document Index
»
Space:
Main
▼
:
Document Index
»
Page:
WikiMap
Search
Page Actions:
Export
▼
:
Export as PDF
Export as RTF
Export as HTML
More actions
▼
:
Print preview
View Source
WikiMap
Wiki source code of
WikiMap
Last modified by
Hal Eden
on 2025/03/27 21:37
Content
·
Comments
(0)
·
Attachments
(9)
·
History
·
Information
Hide line numbers
1: #macro(flashmap $mapname) 2: <script type="text/javascript" 3: src="$doc.getAttachmentURL('flashobject.js')"> 4: </script> 5: <div id="flashcontent_$mapname"> 6: Flash plugin or Javascript are turned off. 7: Activate both and reload to view the mindmap 8: </div><script type="text/javascript"> 9: var fo = new 10: FlashObject("$doc.getAttachmentURL('visorFreemind.swf')","visorFreeMind", "100%", "450", 6, "#9999ff"); 11: fo.addParam("quality", "high"); 12: fo.addParam("bgcolor", "#f7fbff"); 13: fo.addVariable("openUrl", "_self"); 14: fo.addVariable("initLoadFile", "$doc.getAttachmentURL($mapname)"); 15: fo.addVariable("startCollapsedToLevel","1"); 16: fo.addVariable("startFit","true"); 17: fo.write("flashcontent_$mapname"); 18: </script> 19: #end 20: 21: #flashmap("sitemap.mm") 22: 23: <% 24: import java.io.StringReader 25: import java.util.HashMap 26: import com.xpn.xwiki.doc.XWikiAttachment 27: import groovy.xml.MarkupBuilder 28: 29: 30: def generateXmlForChildNode(nodeSpace, nodeName, xmlBuilder) 31: { 32: def fullNodeName = nodeSpace+"."+nodeName 33: def attachment = xwiki.getDocument(fullNodeName).getAttachmentURL("pageicon.png", "download", "width=50") 34: def nodeHtml = nodeName 35: 36: if (attachment) { 37: nodeHtml = "<html>"+nodeName+"<img src=\""+attachment+"\" width=\"50px\"></html>" 38: } 39: xmlBuilder.node(LINK:xwiki.getURL(fullNodeName, "view"), TEXT:nodeHtml, STYLE:"bubble") { 40: xmlBuilder.edge(STYLE:"sharp_bezier", WIDTH:"4") 41: def sql = "select distinct doc.web, doc.name, doc.parent from XWikiDocument as doc where doc.parent='" + xwiki.sqlfilter(fullNodeName) + "'" + "and doc.space='" + nodeSpace + "'" 42: def doclist = xwiki.search(sql) 43: for(item in doclist) { 44: generateXmlForChildNode(item[0], item[1], xmlBuilder) 45: } 46: } 47: } 48: 49: def generateXmlForChildNodeToDepth(nodeSpace, nodeName, maxDepth, xmlBuilder) 50: { 51: def fullNodeName = nodeSpace+"."+nodeName 52: def attachment = xwiki.getDocument(fullNodeName).getAttachmentURL("pageicon.png", "download", "width=50") 53: def nodeHtml = nodeName 54: 55: if (attachment) { 56: nodeHtml = "<html>"+nodeName+"<img src=\""+attachment+"\" width=\"50px\"></html>" 57: } 58: xmlBuilder.node(LINK:xwiki.getURL(fullNodeName, "view"), TEXT:nodeHtml, STYLE:"bubble") { 59: if (maxDepth > 0) { 60: xmlBuilder.edge(STYLE:"sharp_bezier", WIDTH:"4") 61: def sql = "select distinct doc.web, doc.name, doc.parent from XWikiDocument as doc where doc.parent='" + xwiki.sqlfilter(fullNodeName) + "'" + "and doc.space='" + nodeSpace + "'" 62: def doclist = xwiki.search(sql) 63: for(item in doclist) { 64: generateXmlForChildNodeToDepth(item[0], item[1], maxDepth - 1, xmlBuilder) 65: } 66: } 67: } 68: } 69: 70: def generateMap(firstNodeSpace, firstNodeName, xmlBuilder) 71: { 72: xmlBuilder.map() { 73: generateXmlForChildNodeToDepth(firstNodeSpace, firstNodeName,2, xmlBuilder) 74: } 75: } 76: 77: if (xwiki.hasAdminRights()) 78: { 79: println "[Update the Map>" + doc.fullName + "?update=1]" 80: 81: if (request.get("update") != null) 82: { 83: print "Start mindmap generation... " 84: 85: def writer = new StringWriter() 86: def xmlBuilder = new MarkupBuilder(writer) 87: generateMap("Main", "WebHome", xmlBuilder) 88: 89: def attachmentName = "sitemap.mm" 90: def attachment = doc.getDocument().getAttachment(attachmentName) 91: if (!attachment) 92: { 93: attachment = new XWikiAttachment(doc.getDocument(), attachmentName) 94: doc.getDocument().getAttachmentList().add(attachment) 95: } 96: attachment.setContent(writer.toString().getBytes()) 97: doc.getDocument().saveAttachmentContent(attachment, context.getContext()) 98: doc.save() 99: 100: println "done" 101: response.sendRedirect(xwiki.getURL(doc.getName(),"view")) 102: } 103: } 104: 105: %> 106: 107: 108:
Quick Links
Home
Index
What's New
Blog
Calendar
Photo Albums
Sandbox
Tags
Bulletin Board
My Recent Modifications
PamelaJennings
|
rwakkary
|
HaledenSands
|
ByronLahey