Quick update
What happened yesterday? Nothing. In the morning, I fired up my PC and discovered that my provider took down the internet. And since it was weekend, I had to wait until now to get it back. Thanks for the comments on my latest post, and sorry I didn't have one yesterday.
Working with document identifiers
This is always a tricky problem: DocumentUnids are solid but very long. Most of the developers will use @unique to create an unique key for each document. This is fine; @unique creates a key that's unique within the application. I use as much as three keys:
- DocumentUnid for relations like parent/child
- PageKey, computed when composed: @unique, for use in URLs
- FriendlyKey, a third key to use in URLs where the user can override the PageKey with a value that is human-readable.
PageKey and FriendlyKey however can create conflicts, and I have to make sure the FriendlyKey is always unique. What's even more annoying is: the FriendlyKeys have to be unique within the database, so across all the sites. I haven't figured that out completely. Time will bring answers I hope. Or could I create a folder for each site? That would help. Any suggestions?
The DwSession class
So far, I've done all my calculations that have to be done for every page in a single class. With the new templating idea, I realize that 99% of all the work will happen here. This will be one huge class. Let's see how Domino copes with that.
Next?
After solving the identifier problems, I will create the top navigation. This will implement making section documents as well. Here's how I calculate the top navigation with the active section marked:
Private Function pr_getNav As String
On Error Goto catch
Dim out As New stringbuffer(10)
Dim view As notesview
Dim ec As NotesViewEntryCollection
Dim entry As NotesViewEntry
Dim sHere As String, vTmp As Variant
If site Is Nothing Then Goto finally
sHere=doc.SectionUnid(0)
Set view=db.GetView("nav")
Set ec=view.GetAllEntriesByKey(doc.siteUnid(0))
If ec.Count=0 Then Goto finally
out.add |<ul class="nav">|
Set entry=ec.GetFirstEntry
While Not entry Is Nothing
vTmp=Split(entry.ColumnValues(2), "~")
If vTmp(2)=sHere Then
out.add |<li class="on"><a href="| &path & |pub/| & vTmp(1) & |">| & vTmp(0) & |</a></li>|
Else
out.add |<li><a href="| &path & |pub/| & vTmp(1) & |">| & vTmp(0) & |</a></li>|
End If
Set entry=ec.GetNextEntry(entry)
Wend
out.add |</ul>|
pr_getNav=out.collapse("")
Goto finally
catch:
pr_getNav="Error " & Err & " in dwSession.pr_getNav, line " & Erl & ": " & Error$
Resume finally
finally:
End Function
Comments
To add a comment, log in or register as new user. It's free and safe.