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
Show line numbers
#macro(flashmap $mapname) <script type="text/javascript" src="$doc.getAttachmentURL('flashobject.js')"> </script> <div id="flashcontent_$mapname"> Flash plugin or Javascript are turned off. Activate both and reload to view the mindmap </div><script type="text/javascript"> var fo = new FlashObject("$doc.getAttachmentURL('visorFreemind.swf')","visorFreeMind", "100%", "450", 6, "#9999ff"); fo.addParam("quality", "high"); fo.addParam("bgcolor", "#f7fbff"); fo.addVariable("openUrl", "_self"); fo.addVariable("initLoadFile", "$doc.getAttachmentURL($mapname)"); fo.addVariable("startCollapsedToLevel","1"); fo.addVariable("startFit","true"); fo.write("flashcontent_$mapname"); </script> #end #flashmap("sitemap.mm") <% import java.io.StringReader import java.util.HashMap import com.xpn.xwiki.doc.XWikiAttachment import groovy.xml.MarkupBuilder def generateXmlForChildNode(nodeSpace, nodeName, xmlBuilder) { def fullNodeName = nodeSpace+"."+nodeName def attachment = xwiki.getDocument(fullNodeName).getAttachmentURL("pageicon.png", "download", "width=50") def nodeHtml = nodeName if (attachment) { nodeHtml = "<html>"+nodeName+"<img src=\""+attachment+"\" width=\"50px\"></html>" } xmlBuilder.node(LINK:xwiki.getURL(fullNodeName, "view"), TEXT:nodeHtml, STYLE:"bubble") { xmlBuilder.edge(STYLE:"sharp_bezier", WIDTH:"4") def sql = "select distinct doc.web, doc.name, doc.parent from XWikiDocument as doc where doc.parent='" + xwiki.sqlfilter(fullNodeName) + "'" + "and doc.space='" + nodeSpace + "'" def doclist = xwiki.search(sql) for(item in doclist) { generateXmlForChildNode(item[0], item[1], xmlBuilder) } } } def generateXmlForChildNodeToDepth(nodeSpace, nodeName, maxDepth, xmlBuilder) { def fullNodeName = nodeSpace+"."+nodeName def attachment = xwiki.getDocument(fullNodeName).getAttachmentURL("pageicon.png", "download", "width=50") def nodeHtml = nodeName if (attachment) { nodeHtml = "<html>"+nodeName+"<img src=\""+attachment+"\" width=\"50px\"></html>" } xmlBuilder.node(LINK:xwiki.getURL(fullNodeName, "view"), TEXT:nodeHtml, STYLE:"bubble") { if (maxDepth > 0) { xmlBuilder.edge(STYLE:"sharp_bezier", WIDTH:"4") def sql = "select distinct doc.web, doc.name, doc.parent from XWikiDocument as doc where doc.parent='" + xwiki.sqlfilter(fullNodeName) + "'" + "and doc.space='" + nodeSpace + "'" def doclist = xwiki.search(sql) for(item in doclist) { generateXmlForChildNodeToDepth(item[0], item[1], maxDepth - 1, xmlBuilder) } } } } def generateMap(firstNodeSpace, firstNodeName, xmlBuilder) { xmlBuilder.map() { generateXmlForChildNodeToDepth(firstNodeSpace, firstNodeName,2, xmlBuilder) } } if (xwiki.hasAdminRights()) { println "[Update the Map>" + doc.fullName + "?update=1]" if (request.get("update") != null) { print "Start mindmap generation... " def writer = new StringWriter() def xmlBuilder = new MarkupBuilder(writer) generateMap("Main", "WebHome", xmlBuilder) def attachmentName = "sitemap.mm" def attachment = doc.getDocument().getAttachment(attachmentName) if (!attachment) { attachment = new XWikiAttachment(doc.getDocument(), attachmentName) doc.getDocument().getAttachmentList().add(attachment) } attachment.setContent(writer.toString().getBytes()) doc.getDocument().saveAttachmentContent(attachment, context.getContext()) doc.save() println "done" response.sendRedirect(xwiki.getURL(doc.getName(),"view")) } } %>
Quick Links
Home
Index
What's New
Blog
Calendar
Photo Albums
Sandbox
Tags
Bulletin Board
My Recent Modifications
PamelaJennings
|
rwakkary
|
HaledenSands
|
ByronLahey