|
From: creecode <icr...@us...> - 2006-03-07 05:39:30
|
Update of /cvsroot/frontierkernel/odbs/frontierRoot/system/verbs/apps/Manila/windowTypes/types/manilaTemplate/scripts/siteStructure In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6874 Modified Files: xmlToOutline outlineToXml Log Message: replace calls to verbs at extensions.latinToMac with string.(latin/mac)To(Latin/Mac) verbs Index: outlineToXml =================================================================== RCS file: /cvsroot/frontierkernel/odbs/frontierRoot/system/verbs/apps/Manila/windowTypes/types/manilaTemplate/scripts/siteStructure/outlineToXml,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** outlineToXml 26 Mar 2005 19:42:27 -0000 1.1.1.1 --- outlineToXml 7 Mar 2006 05:39:26 -0000 1.2 *************** *** 1,3 **** ! FrontierVcsFile:1:scpt:system.verbs.apps.Manila.windowTypes.types.manilaTemplate.scripts.siteStructure.outlineToXml ! on outlineToXml (adrOutline) { ÇChanges: Ç2/11/04; 1:58:45 AM by JES ÇAdded support for redirects from within a Manila site structure. Ç12/22/01; 3:53:29 AM by JES ÇCall latinToMac.macToLatin instead of playlist.convertToLatin. Ç12/19/01; 2:46:03 PM by JES ÇAdded some msg calls to let the user know that we're building the site structure XML. This is important for large site structure outlines, like the DocServer site structure outline. Ç7/22/01; 12:32:07 AM by JES ÇEncode xml entities in name and description attributes. Ç3/18/01; 4:23:29 PM by PBS ÇClose <category> tags that don't contain any stories or other categories. Fixes the bug reported on this page: http://radio.userland.com/discuss/msgReader$5625?mode=day Ç12/31/00; 5:18:02 PM by JES ÇOn Macs, convert opml text from Mac to latin. ÇFri, Dec 8, 2000 at 1:07:34 PM by JES ÇBug fix: Always add non-empty descriptions for categories, not just when the category doesn't have an associated message number. ÇTuesday, September 19, 2000 at 2:24:04 PM by PBS ÇGet description attributes and add to XML text. ÇWed, Aug 23, 2000 at 2:26:50 AM by PBS ÇCreated. Turn a fancy site structure editor into its plain XML text representation. Return XML text. This is just like an outline renderer -- it's a special case of outline renderer. local (xmlText = "<hierarchy>\r"); local (localOutline = adrOutline^); //use a copy so as not to make the screen go nuts local (oldTarget = target.set (@localOutline)); op.setDisplay (false); //it's faster op.firstSummit (); op.fullexpand (); local (level = 1); on add (s) { xmlText = xmlText + string.filledString ('\t', level) + s + "\r"}; on getDescription (adrAtts) { //PBS 09/19/00: get description attribute if not defined (adrAtts^.description) { return ("")}; return (string.trimWhiteSpace (adrAtts^.description))}; on visit (message="Building site structure XML: ") { loop { local (ctSubs = op.countSubs (1)); local (flHasSubs = ctSubs > 0); local (s = ""); local (linetext = op.getLineText ()); local (atts); op.attributes.getAll (@atts); case atts.type { "manilaSiteStructureMessage" { if string.lower (linetext) != "index" { //special case local (msgNum = atts.msgNum); local (name = atts.name); local (pathname = string.trimWhiteSpace (linetext)); msg (message + pathname + "..."); local (description = getDescription (@atts)); if string.lower (name) == "untitled" { name = pathname}; if description == "" { //it's already been white-space-trimmed add ("<story msgNum=\"" + msgNum + "\" name=\"" + name + "\"" + " pathname=\"" + pathName + "\"/>")} else { //PBS 09/19/00: add description to XML add ("<story msgNum=\"" + msgNum + "\" name=\"" + name + "\"" + " pathname=\"" + pathName + "\"><description>" + description + "</description></story>")}}}; "manilaSiteStructureCategory" { local (name = atts.name); local (pathname = string.trimWhiteSpace (linetext)); local (description = getDescription (@atts)); if string.lower (name) == "untitled" { name = pathname}; local (msgNum); local (cursor = op.getCursor ()); bundle { //look ahead for index item if op.go (right, 1) { loop { local (linetext = op.getLineText ()); if string.lower (linetext) == "index" { local (atts); op.attributes.getAll (@atts); msgNum = atts.msgNum; break}; if not (op.go (down, 1)) { break}}; op.setCursor (cursor)}}; if msgNum != nil { add ("<category msgNum=\"" + msgNum + "\" name=\"" + name + "\"" + " pathname=\"" + pathName + "\">")} else { add ("<category name=\"" + name + "\"" + " pathname=\"" + pathName + "\">")}; if description != "" { //it's already been white-space-trimmed //12/08/00 JES: always add non-empty descriptions, not just when msgNum == nil. add ("<description>" + description + "</description>")}; //PBS 09/19/00: add description if flHasSubs { op.go (right, 1); level++; visit (message + pathname + "/"); add ("</category>"); level--; op.go (left, 1)} else { //PBS 03/18/01: close off categories that don't contain anything add ("</category>")}}; "manilaSiteStructureRedirect" { local (url = atts.url); local (pathname = string.trimWhiteSpace (linetext)); msg (message + pathname + "..."); add ("<redirect pathname=\"" + pathName + "\" url=\"" + url + "\"/>")}}; if not (op.go (down, 1)) { break}}}; visit (); try {target.set (oldTarget)}; xmlText = xmlText + "</hierarchy>"; if system.environment.isMac { xmltext = latinToMac.macToLatin (xmlText)}; return (xmlText)}; Çbundle //test code Çwp.newTextObject (outlineToXml (window.frontmost ()), @workspace.xtext) \ No newline at end of file --- 1,120 ---- ! FrontierVcsFile:2:scpt:system.verbs.apps.Manila.windowTypes.types.manilaTemplate.scripts.siteStructure.outlineToXml ! on outlineToXml (adrOutline) { ! «Changes ! «2/28/06; 1:03:16 PM by TAC ! «replace latinToMac.macToLatin with string.macToLatin ! «2/11/04; 1:58:45 AM by JES ! «Added support for redirects from within a Manila site structure. ! «2001 ! «12/22/01; 3:53:29 AM by JES ! «Call latinToMac.macToLatin instead of playlist.convertToLatin. ! «12/19/01; 2:46:03 PM by JES ! «Added some msg calls to let the user know that we're building the site structure XML. This is important for large site structure outlines, like the DocServer site structure outline. ! «7/22/01; 12:32:07 AM by JES ! «Encode xml entities in name and description attributes. ! «3/18/01; 4:23:29 PM by PBS ! «Close <category> tags that don't contain any stories or other categories. Fixes the bug reported on this page: http://radio.userland.com/discuss/msgReader$5625?mode=day ! «2000 ! «12/31/00; 5:18:02 PM by JES ! «On Macs, convert opml text from Mac to latin. ! «Fri, Dec 8, 2000 at 1:07:34 PM by JES ! «Bug fix: Always add non-empty descriptions for categories, not just when the category doesn't have an associated message number. ! «Tuesday, September 19, 2000 at 2:24:04 PM by PBS ! «Get description attributes and add to XML text. ! «Wed, Aug 23, 2000 at 2:26:50 AM by PBS ! «Created. Turn a fancy site structure editor into its plain XML text representation. Return XML text. This is just like an outline renderer -- it's a special case of outline renderer. ! ! local (xmlText = "<hierarchy>\r"); ! ! local (localOutline = adrOutline^); //use a copy so as not to make the screen go nuts ! local (oldTarget = target.set (@localOutline)); ! op.setDisplay (false); //it's faster ! op.firstSummit (); ! op.fullexpand (); ! local (level = 1); ! ! on add (s) { ! xmlText = xmlText + string.filledString ('\t', level) + s + "\r"}; ! ! on getDescription (adrAtts) { //PBS 09/19/00: get description attribute ! if not defined (adrAtts^.description) { ! return ("")}; ! return (string.trimWhiteSpace (adrAtts^.description))}; ! ! on visit (message="Building site structure XML: ") { ! loop { ! local (ctSubs = op.countSubs (1)); ! local (flHasSubs = ctSubs > 0); ! local (s = ""); ! local (linetext = op.getLineText ()); ! local (atts); ! op.attributes.getAll (@atts); ! case atts.type { ! "manilaSiteStructureMessage" { ! if string.lower (linetext) != "index" { //special case ! local (msgNum = atts.msgNum); ! local (name = atts.name); ! local (pathname = string.trimWhiteSpace (linetext)); ! msg (message + pathname + "..."); ! local (description = getDescription (@atts)); ! if string.lower (name) == "untitled" { ! name = pathname}; ! if description == "" { //it's already been white-space-trimmed ! add ("<story msgNum=\"" + msgNum + "\" name=\"" + name + "\"" + " pathname=\"" + pathName + "\"/>")} ! else { //PBS 09/19/00: add description to XML ! add ("<story msgNum=\"" + msgNum + "\" name=\"" + name + "\"" + " pathname=\"" + pathName + "\"><description>" + description + "</description></story>")}}}; ! "manilaSiteStructureCategory" { ! local (name = atts.name); ! local (pathname = string.trimWhiteSpace (linetext)); ! local (description = getDescription (@atts)); ! if string.lower (name) == "untitled" { ! name = pathname}; ! local (msgNum); ! local (cursor = op.getCursor ()); ! bundle { //look ahead for index item ! if op.go (right, 1) { ! loop { ! local (linetext = op.getLineText ()); ! if string.lower (linetext) == "index" { ! local (atts); ! op.attributes.getAll (@atts); ! msgNum = atts.msgNum; ! break}; ! if not (op.go (down, 1)) { ! break}}; ! op.setCursor (cursor)}}; ! if msgNum != nil { ! add ("<category msgNum=\"" + msgNum + "\" name=\"" + name + "\"" + " pathname=\"" + pathName + "\">")} ! else { ! add ("<category name=\"" + name + "\"" + " pathname=\"" + pathName + "\">")}; ! if description != "" { //it's already been white-space-trimmed //12/08/00 JES: always add non-empty descriptions, not just when msgNum == nil. ! add ("<description>" + description + "</description>")}; //PBS 09/19/00: add description ! if flHasSubs { ! op.go (right, 1); ! level++; ! visit (message + pathname + "/"); ! add ("</category>"); ! level--; ! op.go (left, 1)} ! else { //PBS 03/18/01: close off categories that don't contain anything ! add ("</category>")}}; ! "manilaSiteStructureRedirect" { ! local (url = atts.url); ! local (pathname = string.trimWhiteSpace (linetext)); ! msg (message + pathname + "..."); ! add ("<redirect pathname=\"" + pathName + "\" url=\"" + url + "\"/>")}}; ! if not (op.go (down, 1)) { ! break}}}; ! visit (); ! ! try {target.set (oldTarget)}; ! ! xmlText = xmlText + "</hierarchy>"; ! ! if system.environment.isMac { ! xmltext = string.macToLatin (xmlText)}; ! ! return (xmlText)} ! «bundle //test code ! «wp.newTextObject (outlineToXml (window.frontmost ()), @workspace.xtext) \ No newline at end of file Index: xmlToOutline =================================================================== RCS file: /cvsroot/frontierkernel/odbs/frontierRoot/system/verbs/apps/Manila/windowTypes/types/manilaTemplate/scripts/siteStructure/xmlToOutline,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** xmlToOutline 26 Mar 2005 19:42:27 -0000 1.1.1.1 --- xmlToOutline 7 Mar 2006 05:39:26 -0000 1.2 *************** *** 1,3 **** ! FrontierVcsFile:1:scpt:system.verbs.apps.Manila.windowTypes.types.manilaTemplate.scripts.siteStructure.xmlToOutline ! on xmlToOutline (xmltext, adrOutline) { ÇChanges: Ç2/11/04; 1:53:08 AM by JES ÇAdded support for redirects from within a Manila site structure. Ç12/28/01; 6:23:53 PM by JES ÇFixed a bug where site structure outlines would not open on Windows. Ç12/19/01; 2:27:03 PM by JES ÇAdded some msg calls, so the user has some indication that the outline is being built. This is important for large site structure outlines, like the DocServer site structure outline. Ç7/22/01; 12:31:40 AM by JES ÇDecode xml entities in name and description attributes. Ç12/31/00; 5:11:47 PM by JES ÇOn Macs, convert latin opml text to Mac text. ÇTuesday, September 19, 2000 at 2:11:18 PM by PBS ÇGet descriptions and add as attributes. If an item has no description, then description attribute is "". ÇWed, Aug 23, 2000 at 1:45:20 AM by PBS ÇCreated. Build a site structure outline. This script over-rides the plain XML that Pike gives us. Çlocal (adrOutline = @adrTable^.outline) //the actual window local (adrinfo); window.attributes.getOne ("adrSiteInfo", @adrinfo, adrOutline); local (siteUrl = nameOf (adrinfo^)); bundle { //if port 80, pull the port out of the siteUrl local (parts = string.urlSplit (siteUrl)); if parts[2] contains ":" { if string.nthField (parts[2], ':', 2) == "80" { siteUrl = parts[1] + string.nthField (parts[2], ':', 1) + "/" + parts[3]}}}; local (t); new (tableType, @t); if system.environment.isMac { //12/31/00 JES: convert to Mac text xml.compile (latinToMac.convert (xmltext), @t)} else { xml.compile (xmltext, @t)}; new (outlineType, adrOutline); local (oldTarget = target.set (adrOutline)); on getDescription (adrTable) { //PBS 09/19/00: get an item's description local (adrItem); for adrItem in adrTable { local (itemName = xml.convertToDisplayName (nameOf (adrItem^))); if string.lower (itemName) == "description" { return (adrItem^)}}; return ("")}; on doTable (adrTable, flGoneRight, message="Building site structure outline: ") { local (dir = down); if not flGoneRight { dir = right}; local (adrItem); for adrItem in adrTable { if typeOf (adrItem^) != tableType { continue}; local (itemName = xml.convertToDisplayName (nameOf (adrItem^))); local (lowerName = string.lower (itemName)); case lowerName { "story" { local (atts); new (tableType, @atts); atts.siteUrl = siteUrl; atts.type = "manilaSiteStructureMessage"; atts.msgNum = adrItem^.["/atts"].msgNum; atts.name = adrItem^.["/atts"].name; atts.description = getDescription (adrItem); local (linetext = adrItem^.["/atts"].pathName); msg (message + linetext + "..."); if (sizeOf (adrOutline^) == 1) and (op.getLineText () == "") { op.setLineText (linetext)} else { op.insert (linetext, dir)}; dir = down; op.attributes.addGroup (@atts)}; "category" { local (atts); new (tableType, @atts); atts.siteUrl = siteUrl; atts.type = "manilaSiteStructureCategory"; local (linetext = adrItem^.["/atts"].pathName); if defined (adrItem^.["/atts"].name) { atts.name = adrItem^.["/atts"].name} else { atts.name = adrItem^.["/atts"].pathName}; atts.description = getDescription (adrItem); if (sizeOf (adrOutline^) == 1) and (op.getLineText () == "") { op.setLineText (linetext)} else { op.insert (linetext, dir)}; op.attributes.addGroup (@atts); dir = down; if defined (adrItem^.["/atts"].msgNum) { local (atts); new (tableType, @atts); atts.siteUrl = siteUrl; atts.type = "manilaSiteStructureMessage"; atts.msgNum = adrItem^.["/atts"].msgNum; atts.name = adrItem^.["/atts"].name; linetext = "index"; op.insert (linetext, right); op.attributes.addGroup (@atts); doTable (adrItem, true, message + linetext + "/")} else { doTable (adrItem, false, message + linetext + "/")}}; "redirect" { local (atts); new (tableType, @atts); atts.siteUrl = siteUrl; atts.type = "manilaSiteStructureRedirect"; atts.url = adrItem^.["/atts"].url; local (linetext = adrItem^.["/atts"].pathName); if (sizeOf (adrOutline^) == 1) and (op.getLineText () == "") { op.setLineText (linetext)} else { op.insert (linetext, dir)}; dir = down; op.attributes.addGroup (@atts)}}}; op.go (left, 1)}; doTable (@t [1], true); msg (""); try {target.set (oldTarget)}; return (true)} \ No newline at end of file --- 1,128 ---- ! FrontierVcsFile:2:scpt:system.verbs.apps.Manila.windowTypes.types.manilaTemplate.scripts.siteStructure.xmlToOutline ! on xmlToOutline (xmltext, adrOutline) { ! «Changes ! «2/28/06; 12:14:56 PM by TAC ! «replace extensions.latinToMac.convert with string.latinToMac ! «2/11/04; 1:53:08 AM by JES ! «Added support for redirects from within a Manila site structure. ! «2001 ! «12/28/01; 6:23:53 PM by JES ! «Fixed a bug where site structure outlines would not open on Windows. ! «12/19/01; 2:27:03 PM by JES ! «Added some msg calls, so the user has some indication that the outline is being built. This is important for large site structure outlines, like the DocServer site structure outline. ! «7/22/01; 12:31:40 AM by JES ! «Decode xml entities in name and description attributes. ! «2000 ! «12/31/00; 5:11:47 PM by JES ! «On Macs, convert latin opml text to Mac text. ! «9/19/00; 2:11:18 PM by PBS ! «Get descriptions and add as attributes. If an item has no description, then description attribute is "". ! «8/23/00; 1:45:20 AM by PBS ! «Created. Build a site structure outline. This script over-rides the plain XML that Pike gives us. ! ! «local (adrOutline = @adrTable^.outline) //the actual window ! ! local (adrinfo); ! window.attributes.getOne ("adrSiteInfo", @adrinfo, adrOutline); ! local (siteUrl = nameOf (adrinfo^)); ! bundle { //if port 80, pull the port out of the siteUrl ! local (parts = string.urlSplit (siteUrl)); ! if parts[2] contains ":" { ! if string.nthField (parts[2], ':', 2) == "80" { ! siteUrl = parts[1] + string.nthField (parts[2], ':', 1) + "/" + parts[3]}}}; ! ! local (t); ! new (tableType, @t); ! if system.environment.isMac { //12/31/00 JES: convert to Mac text ! xml.compile (string.latinToMac (xmltext), @t)} ! else { ! xml.compile (xmltext, @t)}; ! new (outlineType, adrOutline); ! local (oldTarget = target.set (adrOutline)); ! ! on getDescription (adrTable) { //PBS 09/19/00: get an item's description ! local (adrItem); ! for adrItem in adrTable { ! local (itemName = xml.convertToDisplayName (nameOf (adrItem^))); ! if string.lower (itemName) == "description" { ! return (adrItem^)}}; ! return ("")}; ! ! on doTable (adrTable, flGoneRight, message="Building site structure outline: ") { ! local (dir = down); ! if not flGoneRight { ! dir = right}; ! local (adrItem); ! for adrItem in adrTable { ! if typeOf (adrItem^) != tableType { ! continue}; ! local (itemName = xml.convertToDisplayName (nameOf (adrItem^))); ! local (lowerName = string.lower (itemName)); ! case lowerName { ! "story" { ! local (atts); ! new (tableType, @atts); ! atts.siteUrl = siteUrl; ! atts.type = "manilaSiteStructureMessage"; ! atts.msgNum = adrItem^.["/atts"].msgNum; ! atts.name = adrItem^.["/atts"].name; ! atts.description = getDescription (adrItem); ! local (linetext = adrItem^.["/atts"].pathName); ! msg (message + linetext + "..."); ! if (sizeOf (adrOutline^) == 1) and (op.getLineText () == "") { ! op.setLineText (linetext)} ! else { ! op.insert (linetext, dir)}; ! dir = down; ! op.attributes.addGroup (@atts)}; ! "category" { ! local (atts); ! new (tableType, @atts); ! atts.siteUrl = siteUrl; ! atts.type = "manilaSiteStructureCategory"; ! local (linetext = adrItem^.["/atts"].pathName); ! if defined (adrItem^.["/atts"].name) { ! atts.name = adrItem^.["/atts"].name} ! else { ! atts.name = adrItem^.["/atts"].pathName}; ! atts.description = getDescription (adrItem); ! if (sizeOf (adrOutline^) == 1) and (op.getLineText () == "") { ! op.setLineText (linetext)} ! else { ! op.insert (linetext, dir)}; ! op.attributes.addGroup (@atts); ! dir = down; ! if defined (adrItem^.["/atts"].msgNum) { ! local (atts); ! new (tableType, @atts); ! atts.siteUrl = siteUrl; ! atts.type = "manilaSiteStructureMessage"; ! atts.msgNum = adrItem^.["/atts"].msgNum; ! atts.name = adrItem^.["/atts"].name; ! linetext = "index"; ! op.insert (linetext, right); ! op.attributes.addGroup (@atts); ! doTable (adrItem, true, message + linetext + "/")} ! else { ! doTable (adrItem, false, message + linetext + "/")}}; ! "redirect" { ! local (atts); ! new (tableType, @atts); ! atts.siteUrl = siteUrl; ! atts.type = "manilaSiteStructureRedirect"; ! atts.url = adrItem^.["/atts"].url; ! local (linetext = adrItem^.["/atts"].pathName); ! if (sizeOf (adrOutline^) == 1) and (op.getLineText () == "") { ! op.setLineText (linetext)} ! else { ! op.insert (linetext, dir)}; ! dir = down; ! op.attributes.addGroup (@atts)}}}; ! op.go (left, 1)}; ! doTable (@t [1], true); ! msg (""); ! ! try {target.set (oldTarget)}; ! ! return (true)} \ No newline at end of file |