General Actions:
Log-in
Wiki:
CreativeIT
▼
:
Document Index
»
Space:
Main
▼
:
Document Index
»
Page:
WikiMap2
Search
Page Actions:
Export
▼
:
Export as PDF
Export as RTF
Export as HTML
More actions
▼
:
Print preview
View Source
Welcome to the CreativeIT wiki!
Wiki source code of
Welcome to the CreativeIT wiki!
Last modified by
Hal Eden
on 2009/04/17 11:07
Content
·
Comments
(0)
·
Attachments
(4)
·
History
·
Information
Hide line numbers
1: = Welcome to the CreativeIT wiki! = 2: 3: Please join and contribute to this community resource. 4: 5: == Map of the wiki == 6: 7: {{velocity}}#macro(flashmap $mapname) 8: {{html wiki=true}}<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", "#ffffff"); fo.addVariable("openUrl", "_self"); fo.addVariable("initLoadFile", "$doc.getAttachmentURL($mapname)"); fo.addVariable("startCollapsedToLevel","1"); fo.addVariable("startFit","true"); fo.write("flashcontent_$mapname"); </script>{{/html}} 9: #end 10: 11: #flashmap("sitemap.mm"){{/velocity}} 12: 13: {{groovy}} 14: import java.io.StringReader 15: import java.util.HashMap 16: import com.xpn.xwiki.doc.XWikiAttachment 17: import groovy.xml.MarkupBuilder 18: 19: 20: def generateXmlForChildNode(nodeSpace, nodeName, xmlBuilder) 21: { 22: def fullNodeName = nodeSpace+"."+nodeName 23: def attachment = xwiki.getDocument(fullNodeName).getAttachmentURL("pageicon.png", "download", "width=50") 24: def nodeHtml = nodeName 25: 26: if (attachment) { 27: nodeHtml = "<html>"+nodeName+"<img src=\""+attachment+"\" width=\"50px\"></html>" 28: } 29: xmlBuilder.node(LINK:xwiki.getURL(fullNodeName, "view"), TEXT:nodeHtml, STYLE:"bubble") { 30: xmlBuilder.edge(STYLE:"sharp_bezier", WIDTH:"4") 31: def sql = "select distinct doc.web, doc.name, doc.parent from XWikiDocument as doc where doc.parent='" + xwiki.sqlfilter(fullNodeName) + "'" + "and doc.space='" + nodeSpace + "'" 32: def doclist = xwiki.search(sql) 33: for(item in doclist) { 34: generateXmlForChildNode(item[0], item[1], xmlBuilder) 35: } 36: } 37: } 38: 39: def generateMap(firstNodeSpace, firstNodeName, xmlBuilder) 40: { 41: xmlBuilder.map() { 42: generateXmlForChildNode(firstNodeSpace, firstNodeName, xmlBuilder) 43: } 44: } 45: 46: if (xwiki.hasAdminRights()) 47: { 48: println "[Update the Map>" + doc.fullName + "?update=1]" 49: 50: if (request.get("update") != null) 51: { 52: print "Start mindmap generation... " 53: 54: def writer = new StringWriter() 55: def xmlBuilder = new MarkupBuilder(writer) 56: generateMap("Main", "WebHome", xmlBuilder) 57: 58: def attachmentName = "sitemap.mm" 59: def attachment = doc.getDocument().getAttachment(attachmentName) 60: if (!attachment) 61: { 62: attachment = new XWikiAttachment(doc.getDocument(), attachmentName) 63: doc.getDocument().getAttachmentList().add(attachment) 64: } 65: attachment.setContent(writer.toString().getBytes()) 66: doc.getDocument().saveAttachmentContent(attachment, context.getContext()) 67: doc.save() 68: 69: println "done" 70: response.sendRedirect(xwiki.getURL(doc.getName(),"view")) 71: } 72: } 73: 74: {{/groovy}}
Quick Links
Home
Index
What's New
Blog
Calendar
Photo Albums
Sandbox
Tags
Bulletin Board
My Recent Modifications
PamelaJennings
|
rwakkary
|
HaledenSands
|
ByronLahey