-- <<<- global theArpaNet global theArpanetServicePage := object (WebPage) title: "ARPANET" base: theSXPrefix contents object (WebHeading) level: 1 contents "ARPANET Map (circa 1986)" end "Here are the IMPS of the ARPANET in 1986!" object (WebParagraph) end object (WebMacro) func: (self stream props -> if ((not isDefined theArpanet) or (theArpanet == undefined)) do ( local lc := open LibraryContainer \ dir: theStartDir \ path: "arpanet.sxl" theArpaNet := lc[1] ) for imp in theArpanet collect as WebBulletedList ( object (WebLink) \ url: (anchorProps dialog: "arpanet" \ depth: 1 \ imp: imp.name) \ contents imp.name as String end ) ) end end function makeImpLink imp depth -> ( local impName := imp.name as String object (WebLink) url: (anchorProps dialog: "arpanet" \ imp: impName \ depth: depth) contents impName " IMP" end ) function makeImp imp depth maxDepth -> ( local link := makeImpLink imp maxDepth if (depth > maxDepth) then ( link ) else ( object (WebGroup) contents link " connects to:" (for i in imp collect as WebBulletedList ( makeImp i (depth + 1) maxDepth)) end ) ) global theArpanetDialogPage := object (WebPage) title: "ARPANET" base: theSXPrefix contents object (WebHeading) level: 1 contents "ARPANET IMP " object (WebProp) prop: @imp default: "Unknown" end end object (WebMacro) func: (self stream props -> local impName := (props[@imp] as NameClass) local imp := theArpanet[impName] if (imp == empty) then ( "There is no ARPANET IMP by the name of " + (impName as String) ) else ( local depth := 1 local maxDepth := getInt props[@depth] 1 if (maxDepth < 1) do (maxDepth := 1) if (maxDepth > 4) do (maxDepth := 4) object (WebGroup) contents (makeImp imp depth maxDepth) "Depth: " (for i := 1 to 4 collect as WebBold ( local label := ((i as String) + " ") if (i == maxDepth) then ( label ) else ( object (WebLink) url: (anchorProps dialog: "arpanet" \ imp: impName \ depth: i) contents label end))) end ) ) end end registerService theWebServer \ (new WebService \ name: "Arpanet" \ about: "Enter the ARPANET!" \ handler: (service request params -> HTML theArpanetServicePage)) registerDialog theWebServer \ (new WebDialog \ name: "Arpanet" \ handler: (dialog props params -> printHTML theArpanetDialogPage (new String) props)) -- >>>