General Actions:
Log-in
Wiki:
Courses
▼
:
Document Index
»
Space:
DSSF2008
▼
:
Document Index
»
Page:
SiteMap
Search
DSSF2008
:
Flash Sitemap
Page Actions:
Export
▼
:
Export as PDF
Export as RTF
Export as HTML
More actions
▼
:
Print preview
View Source
Flash Sitemap
Wiki source code of
Flash Sitemap
Last modified by
Hal Eden
on 2010/08/20 11:06
Content
·
Comments
(0)
·
Attachments
(8)
·
History
·
Information
Hide line numbers
1: 2: 1 Flash Sitemap 3: #macro(flashmap $mapname) 4: <script type="text/javascript" 5: src="$doc.getAttachmentURL('flashobject.js')"> 6: </script> 7: <div id="flashcontent_$mapname"> 8: Flash plugin or Javascript are turned off. 9: Activate both and reload to view the mindmap 10: </div><script type="text/javascript"> 11: var fo = new 12: FlashObject("$doc.getAttachmentURL('visorFreemind.swf')","visorFreeMind", "100%", "600", 6, "#9999ff"); 13: fo.addParam("quality", "high"); 14: fo.addParam("bgcolor", "#ffffff"); 15: fo.addVariable("openUrl", "_blank"); 16: fo.addVariable("initLoadFile", "$doc.getAttachmentURL($mapname, "download")"); 17: fo.addVariable("startCollapsedToLevel","1"); 18: fo.addVariable("startFit","true") 19: fo.write("flashcontent_$mapname"); 20: </script> 21: #end 22: 23: #flashmap("sitemap.mm") 24: 25: 1 Sitemap 26: 27: <% 28: import java.io.StringReader 29: import java.util.HashMap 30: import com.xpn.xwiki.doc.XWikiAttachment 31: import groovy.xml.MarkupBuilder 32: 33: 34: def generateXmlForChildNode(nodeSpace, nodeName, xmlBuilder) 35: { 36: def fullNodeName = nodeSpace+"."+nodeName 37: def attachExists = xwiki.getDocument(fullNodeName).getAttachment("pageicon.png") 38: def attachment = xwiki.getDocument(fullNodeName).getAttachmentURL("pageicon.png", "download", "width=50") 39: def nodeHtml = nodeName 40: 41: if (attachExists!=null) { 42: nodeHtml = "<html>"+nodeName+"<img src=\""+attachment+"\" width=\"50px\"></html>" 43: } 44: 45: 46: xmlBuilder.node(LINK:xwiki.getURL(fullNodeName, "view"), TEXT:nodeHtml, STYLE:"bubble") { 47: xmlBuilder.edge(STYLE:"sharp_bezier", WIDTH:"4") 48: def sql = "select distinct doc.web, doc.name, doc.parent from XWikiDocument as doc where doc.parent='" + xwiki.sqlfilter(fullNodeName) + "'" + "and doc.space='" + nodeSpace + "'" 49: def doclist = xwiki.search(sql) 50: for(item in doclist) { 51: generateXmlForChildNode(item[0], item[1], xmlBuilder) 52: } 53: } 54: } 55: 56: def generateMap(firstNodeSpace, firstNodeName, xmlBuilder) 57: { 58: xmlBuilder.map() { 59: generateXmlForChildNode(firstNodeSpace, firstNodeName, xmlBuilder) 60: } 61: } 62: 63: if (xwiki.hasAdminRights()) 64: { 65: println "[Update the Map>" + doc.fullName + "?update=1]" 66: 67: if (request.get("update") != null) 68: { 69: print "Start mindmap generation... " 70: 71: def writer = new StringWriter() 72: def xmlBuilder = new MarkupBuilder(writer) 73: generateMap("DSSF2008", "WebHome", xmlBuilder) 74: 75: def attachmentName = "sitemap.mm" 76: def attachment = doc.getDocument().getAttachment(attachmentName) 77: if (!attachment) 78: { 79: attachment = new XWikiAttachment(doc.getDocument(), attachmentName) 80: doc.getDocument().getAttachmentList().add(attachment) 81: } 82: 83: attachment.setContent(writer.toString().getBytes()) 84: doc.getDocument().saveAttachmentContent(attachment, context.getContext()) 85: doc.save() 86: 87: println "done" 88: response.sendRedirect(xwiki.getURL(doc.getName(),"view")) 89: } 90: } 91: 92: %> 93: 94: #if ($doc.getAttachmentList().size() > 0) 95: #mindmap("sitemap.mm" "100%" "500") 96: #end 97: 98: 99: 1 Current Users 100: #flashmap("usermap.mm") 101: 102: <% 103: if (xwiki.hasAdminRights()) 104: { 105: println "[Update the User Map>" + doc.fullName + "?updateum=1]" 106: 107: if (request.get("updateum") != null) 108: { 109: print "Start mindmap generation... " 110: 111: def sql = ", BaseObject as obj where obj.name=doc.fullName and obj.className='XWiki.XWikiUsers'" 112: def writer = new StringWriter() 113: def xmlBuilder = new MarkupBuilder(writer) 114: def hgapcount = 0 115: def totalCount = xwiki.searchDocuments(sql).size()+0 116: 117: xmlBuilder.map () { 118: xmlBuilder.node (TEXT:"Users"){ 119: for (item in xwiki.searchDocuments(sql)){ 120: def userdoc = xwiki.getDocument(item) 121: def attachCount = userdoc.attachmentList.size() 122: def attachIndex = attachCount - 1 123: def nodeURL = userdoc.getURL() 124: def nodeHtml = userdoc.getName() 125: /* def obj = userdoc.getObject("XWiki.XWikiUsers") 126: def lastname = obj.get("last_name") 127: def firstname = obj.get('first_name') 128: nodeHtml = firstname + ' ' + lastname */ 129: 130: if(attachCount >0){ 131: def attach = userdoc.attachmentList.get(0) 132: def attachURL = userdoc.getAttachmentURL(attach.filename,"download") + "?width=30" 133: nodeHtml = "<html>"+userdoc.getName()+"<img src=\""+attachURL+"\" width=\"30px\"></html>" 134: } 135: def angle = (Math.floor(hgapcount/2.0))/(totalCount/2)*Math.PI 136: if (angle < Math.PI/2) { 137: angle = angle*(1.0+Math.abs(Math.cos(angle))*0.333) 138: } else { 139: angle = Math.PI - (Math.PI-angle)*(1.0+Math.abs(Math.cos(angle))*0.333) 140: } 141: def hgap = 350*Math.sin(angle) 142: xmlBuilder.node(LINK:nodeURL, TEXT:nodeHtml, STYLE:"bubble", HGAP:hgap) { 143: xmlBuilder.edge(STYLE:"sharp_bezier", WIDTH:"2") 144: } 145: hgapcount=hgapcount+1 146: } 147: } 148: } 149: def attachmentName = "usermap.mm" 150: def attachment = doc.getDocument().getAttachment(attachmentName) 151: if (!attachment){ 152: attachment = new XWikiAttachment(doc.getDocument(), attachmentName) 153: doc.getDocument().getAttachmentList().add(attachment) 154: } 155: 156: attachment.setContent(writer.toString().getBytes()) 157: doc.getDocument().saveAttachmentContent(attachment, context.getContext()) 158: doc.save() 159: 160: println "done" 161: response.sendRedirect(xwiki.getURL(doc.getName(),"view")) 162: } 163: } 164: 165: %> 166: 1 Current Users (by group) 167: #flashmap("groupmap.mm") 168: 169: <% 170: if (xwiki.hasAdminRights()) 171: { 172: println "[Update the Group Map>" + doc.fullName + "?updategm=1]" 173: 174: if (request.get("updategm") != null) 175: { 176: print "Start mindmap generation... " 177: 178: def sql = ", BaseObject as obj where obj.name=doc.fullName and obj.className='XWiki.XWikiGroups'" 179: def writer = new StringWriter() 180: def xmlBuilder = new MarkupBuilder(writer) 181: 182: xmlBuilder.map () { 183: xmlBuilder.node (TEXT:"Groups"){ 184: for (item in xwiki.searchDocuments(sql)) { 185: def groupdoc = xwiki.getDocument(item) 186: xmlBuilder.node(TEXT:groupdoc.getName(), STYLE:"bubble"){ 187: def users = groupdoc.getObjects("XWiki.XWikiGroups") 188: for (user in users) { 189: def hgapcount = 0 190: def totalCount = users.size() 191: def userName = xwiki.getUserName(user.getProperty("member").value) 192: userName = user.getProperty("member").value 193: def userdoc = xwiki.getDocument(userName) 194: if (userdoc != null){ 195: def attachCount = userdoc.attachmentList.size() 196: def attachIndex = attachCount - 1 197: def nodeURL = userdoc.getURL() 198: def nodeHtml = xwiki.getUserName(userName, false) 199: def obj = userdoc.getObject("XWiki.XWikiUsers") 200: if (obj != null) { 201: def lastname = obj.get("last_name") 202: def firstname = obj.get('first_name') 203: nodeHtml = firstname + ' ' + lastname 204: } 205: 206: if (attachCount >0){ 207: def attach = userdoc.attachmentList.get(0) 208: def attachURL = userdoc.getAttachmentURL(attach.filename,"download") + "?width=30" 209: nodeHtml = "<html>"+nodeHtml+"<img src=\""+attachURL+"\" ></html>" 210: } 211: def angle = (Math.floor(hgapcount/2.0))/(totalCount/2)*Math.PI 212: if (angle < Math.PI/2) { 213: angle = angle*(1.0+Math.abs(Math.cos(angle))*0.333) 214: } else { 215: angle = Math.PI - (Math.PI-angle)*(1.0+Math.abs(Math.cos(angle))*0.333) 216: } 217: def hgap = 350*Math.sin(angle) 218: xmlBuilder.node(LINK:nodeURL, TEXT:nodeHtml, STYLE:"bubble", HGAP:hgap) { 219: xmlBuilder.edge(STYLE:"sharp_bezier", WIDTH:"2") 220: } 221: } 222: hgapcount=hgapcount+1 223: } 224: } 225: } 226: } 227: } 228: def attachmentName = "groupmap.mm" 229: def attachment = doc.getDocument().getAttachment(attachmentName) 230: if (!attachment){ 231: attachment = new XWikiAttachment(doc.getDocument(), attachmentName) 232: doc.getDocument().getAttachmentList().add(attachment) 233: } 234: 235: attachment.setContent(writer.toString().getBytes()) 236: doc.getDocument().saveAttachmentContent(attachment, context.getContext()) 237: doc.save() 238: 239: println "done" 240: response.sendRedirect(xwiki.getURL(doc.getName(),"view")) 241: } 242: } 243: 244: %>
Course Pages
Home
Roster
Assignments
Schedule and Syllabus
Course Announcement
Lecture Material
Relevant Resources
Questionnaires
Independent Research Projects
Blog
Recently Visited
pittssm
Search
Search query
Recently Modified
MSC Final Project ...
MakeShiftCrew Proj...
Embedding Content
Human-Centered Com...
Assignment12KyleMa...
See More Changes
Recent Comments
Recently Created
WebPreferences
|
RatingStats
|
palen
|
ksiek
|
kena