Automatic titles and breadcrumb trail
I've decided to allow a maximum of 20 subsection levels per site. Normally you should only go a maximum of three levels deep, so 20 should be more than enough. I wanted the title and the breadcrumb trail to be generated by the application. Therefor, I keep track of the ParentUnid of each document. Then I collect the view entries in an array. Finally, I traverse the array in reverse to add the title and breadcrumb items to the StringBuffer class instances I've reserved for them:
The tree view
Because I've decided to do the document relations via the DocumentUnids, the 'byUnid' view is sorted by the DocumentUnids. Second column is the ParentUnid, next colums the other values I need:

The LotusScript
Private Sub pr_buildStructure
On Error Goto catch
Dim view As notesview
Dim entry As notesviewentry
Dim eList(20) As notesviewentry
Dim i As Integer, n As Integer
Dim tmp As Variant
Set view=db.GetView("byUnid")
Set entry=view.GetEntryByKey(doc.UniversalID)
While Not entry Is Nothing
n=n+1
Set eList(n)=entry
Set entry=view.GetEntryByKey(Cstr(entry.ColumnValues(1)))
Wend
For i=n To 1 Step -1
tmp=eList(i).ColumnValues
title.add tmp(2)
trail.add tmp(3) & |~| & tmp(4) & |~| & tmp(2)
Next
Goto finally
catch:
doError "Error " & Err & " in pr_buildStructure, line " & Erl & ": " & Error$
Resume finally
finally:
End Sub
Rendering the breadcrumb trail
Private Function pr_getTrail As String
Dim out As New stringbuffer(20)
Dim tmp As Variant,i As Integer, tmp2 As Variant
tmp=trail.getArray
For i=0 To Ubound(tmp)-1
tmp2=Split(tmp(i), "~")
out.add |<a href="| & path & |pub/| & tmp2(1) & |">|& tmp2(0) & |<a>|
Next
tmp2=Split(tmp(i), "~")
If tmp2(0)="" Then
out.add tmp2(2)
Else
out.add tmp2(0)
End If
pr_getTrail=out.collapse(SEPARATOR)
End Function
Next?
You can see my progress online. Next will be the subnavigation tree, the creation of pages and a basic page overview.
Comments
To add a comment, log in or register as new user. It's free and safe.