Testing the new web interface
Building new web functionality on an existing application that has been filled with code for two years is quite a challenge...
Switching between old and new
Since both read as edit mode are entirely done with webqueryopen agents, I didn't want to disturb the way the pages are rendered now. So I switch to the new agent only when creating a new BlogEntry or editing one. This is the formula for the form webqueryopen:
a:=Query_String_Decoded;
@Command([ToolsRunMacro]; @If(@Begins(a; "readform") | @Contains(a; "edit"); "dsb-admin-wqopen" ;"blogentry-wqopen"))
So this is my first BlogEntry entered with the new web interface.
Quick admin views
I also added a series of admin views that display the different documents and allow to quickly edit them. It's a quick and dirty solution, but for now it works. I use a new technique now, making 'normal' subroutines, but passing my WebSession object so that the function can use this directly:
Sub getAdminView(Byval sView As String, ws As WebSession)
On Error Goto catch
Dim view As NotesView
Dim ec As notesViewEntryCollection
Dim entry As notesViewEntry
Dim sKey As String, sLink As String
Dim tmp As Variant
If sView="users" And Not ws.isOwner Then
ws.add |<p>Sorry... Users can only be viewed by the owner(s).</p>|
Exit Sub
End If
sKey="BlogEntry"
Select Case sView
Case "comments"
sKey="Comment"
Case "users"
sKey="User"
Case "pages"
sKey="Page"
End Select
Set view=ws.db.getView("admintable")
Set ec=view.GetAllEntriesByKey(sKey)
If ec.Count=0 Then
ws.add |No entries found.|
Exit Sub
End If
ws.add |<table border="1">|
ws.add |<tr><th>Date</th><th>Subject</th>
<th>Status</th></tr>|
Set entry=ec.GetFirstEntry
While Not entry Is Nothing
tmp=entry.columnvalues
sLink=ws.path & |0/| & entry.UniversalID
ws.add |<tr>|
ws.add |<td>| & tmp(1) & |</td>|
ws.add |<td><a href="| & slink & |?open&edit">| & tmp(2) & |</a></td>|
ws.add |<td>| & tmp(3) & |</td>|
ws.add |</tr>|
Set entry=ec.GetNextEntry(entry)
Wend
ws.add |</table>|
Goto finally
catch:
ws.add "Error " & Err & " in getAdminContent, line " & Erl & ": " & Error$
Resume finally
finally:
End Sub
Next?
When you are logged in as a registered user, you can see that the rich text is still very basic. I have to add inserting files, images, highlighted code fragments, youtube movies etc. I also have to pass the site css to it so that all the tags already get their final presentation while editing.
Comments
To add a comment, log in or register as new user. It's free and safe.