∇ new ctx;p;s;d;a :Access Public :Implements Constructor :Base ctx map←⎕NEW #.apls_tools.SiteMap map.AvailableTo←'guest' map.Positions['left' 'right']←('{SectionMenu}')('snippets' 'news') map.AddSections 'products' 'support' 'downloads' 'about us' p s d a ← map.Sections['products' 'support' 'downloads' 'about us'] p.AddPages 'features' 'platforms' 'prices' 'third-party' 'licences' 'distributors' p.Pages[⊂'distributors'].Positions[⊂'right']←⊂'' p.Pages[⊂'prices'].Positions[⊂'right']←⊂'' s.AddPages 'faq' 'community' d.AddPages 'fonts' 'documentation' 'tutorials' 'applications' 'conference' 'articles' a.AddPages 'clients' 'direction' 'careers' 'contact us' a.Positions[⊂'right'] ← ⊂'contactdetails' ∇ ∇ z←Content filename :Access Public z←Include 'content/',filename,'.inc' ∇ ∇ html←Module layoutposition;div;ref;sctn;page;lnr :Access Public ⍝ returns markup of content assigned to layoutposition lnr ← {'
',⍵,'
'} div ← (layoutposition∘{'
',⍵,'
'})∘lnr ⍝ where in the site are we supposed to be? sctn page ← Context._Request._QueryString['sctn' 'page'] ⍝ should all these default up tree if undefined? ie ⍝ ref ← ⊃map.Sections[⊂sctn].Pages[⊂page] ref←map.Reference sctn page html ← { ⍵≡'':'' ⍝ undefined 2=≡⍵:div⊃,/Content¨⍵ ⍝ multiple items '{}'≡⍵[1,⍴⍵]:div⍎⊃↓/1 ¯1 ⍵ ⍝ expression div Content ⍵ ⍝ single item } ⊃ref.Positions[⊂layoutposition] ∇ ∇ html←AuthorisedContent :Access Public ⍝ returns markup of page content if user has access ref ← map.Reference Context._Request._QueryString['sctn' 'page'] :If USERPRIVILEGE ≥ ref.AvailableTo html←⊃,/Module¨'left' 'right' 'main' :Else html←'

Sorry, you do not have access to this page.

' :EndIf ∇ ∇ z←TabLi txt :Access Public :If (txt)('')≡respace¨Context._Request._QueryString['sctn' 'page'] z←txt :Else z←'',txt,'' :EndIf ∇ despace←{#.dfns.ss ⍵ ' ' '%20'} respace←{#.dfns.ss ⍵ '%20' ' '} ∇ html ← SectionMenu;section;page;ref :Access Public section page ← Context._Request._QueryString['sctn' 'page'] :If section≡'' ⍝ home page html ← '' :Else ref ← ⊃map.Sections[⊂section] lnks ← page∘{⍺≡⍵:⍵ ⋄ '',⍵,''}¨ref.ListChildren html ← {''}⊃,/{'
  • ',⍵,'
  • '}¨lnks :EndIf ∇
    Dyalog — the tool of thought for expert programming
    {AuthorisedContent}

    Valid XHTML 1.1