Tuesday, August 26, 2008
Monday, August 25, 2008
Workaround: ViewRefreshFields does not trigger WQO
A form I'm working on gets a combobox (or select list, if you prefer) generated by a WebQueryOpen agent. The content of the combobox is generated on the basis of another field.
I use one combobox to select a db, then the second shows documents in the selected db.
When I select a db, I want to generate the select list with documents in the selected db. I first considered running ViewRefreshFields, but WQO-agents don't get triggered by this.
It seems that running agents with the ToolsRunMacro @Command keeps the form as it was before the running of the agent.
The workaround, then, is quite simple. Add a hidden button (style="display:none") on the form. OnClick on the button, run the agent generating HTML (and ViewRefreshFields, if you need to refresh the form). Onchange in the db-combobox, click the button.
If you've used a similar approach, and found weaknesses with it, please let me know in a comment.
I use one combobox to select a db, then the second shows documents in the selected db.
When I select a db, I want to generate the select list with documents in the selected db. I first considered running ViewRefreshFields, but WQO-agents don't get triggered by this.
It seems that running agents with the ToolsRunMacro @Command keeps the form as it was before the running of the agent.
The workaround, then, is quite simple. Add a hidden button (style="display:none") on the form. OnClick on the button, run the agent generating HTML (and ViewRefreshFields, if you need to refresh the form). Onchange in the db-combobox, click the button.
document.getElementById('your-id-in-the-button').click()
If you've used a similar approach, and found weaknesses with it, please let me know in a comment.
Labels:
fgoto,
random tip
Friday, August 22, 2008
Fun with the WebBrowser Control pt 3
I've come a little farther in my experimentation.
Today's flash show offline DHTML. The flash doesn't do the FX justice btw. When I'm done tinkering, you'll get to see the real deal.
I put the mootools framework JS inside a RichText-item on a document. Fetch the js as a string. Write the string and some HTML to the WebBrowser-control. Hey Presto! Offline DHTML.
My brain is fried right now, so no more programming today.. :)
Today's flash show offline DHTML. The flash doesn't do the FX justice btw. When I'm done tinkering, you'll get to see the real deal.
I put the mootools framework JS inside a RichText-item on a document. Fetch the js as a string. Write the string and some HTML to the WebBrowser-control. Hey Presto! Offline DHTML.
My brain is fried right now, so no more programming today.. :)
Labels:
Lotus Notes,
Microsoft Web Browser
Wednesday, August 20, 2008
Fun with the WebBrowser Control pt 2
Getting to know the object more and more.
Today's flash shows capturing events from the browser-control, and picking values from the document inside the control.
This resource from Microsoft has helped me along somewhat. Only a fraction of the methods/events/properties documented is available in Notes though.
The demoapp is still not ready, as I'm still not finished investigating possibilities.. :)
Today's flash shows capturing events from the browser-control, and picking values from the document inside the control.
This resource from Microsoft has helped me along somewhat. Only a fraction of the methods/events/properties documented is available in Notes though.
The demoapp is still not ready, as I'm still not finished investigating possibilities.. :)
Labels:
Lotus Notes,
Microsoft Web Browser
Tuesday, August 19, 2008
Getting relative dbpath on localhost
Update, 25.08.08: It appears I'm not the only one struggling with this issue. Jack Ratcliff had a similar issue. The difference being that he didn't have a document to process.
Since all databases are required to have one view, and all design-elements basically are NotesDocuments, it's easy to rewrite the code to work without needing a "real document".
If for some reason you're not working in a HTTP-environment, use this instead of @WebDbName:
@ReplaceSubstring( @DbName[2] ; "\\" ; "/" )
--
Today, I had to make a multi-db search agent for web localhost compatible. When printing the path to the db, I had used NotesDatabase.FilePath. The problem with this is that it returns the filesystem path to the db when running locally. E.g. c:\lotus\notes\data\db.nsf
I could use NotesDatabase.ReplicaID, but I prefer somewhat readable URLs.
My solution was using evaluate @DbName[2] (the path to the database), with a document from the db I was currently processing. Without the document as second argument, evaluate would return the path to the search database.
Since all databases are required to have one view, and all design-elements basically are NotesDocuments, it's easy to rewrite the code to work without needing a "real document".
Function WebFilePath( db As NotesDatabase ) As String
Dim view As NotesView
Set view = db.Views(0)
Dim viewDoc As NotesDocument
Set viewDoc = db.GetDocumentByUNID( view.UniversalID )
WebFilePath = Join( Evaluate( |@WebDbName|, viewDoc ) )
End Function
If for some reason you're not working in a HTTP-environment, use this instead of @WebDbName:
@ReplaceSubstring( @DbName[2] ; "\\" ; "/" )
--
Today, I had to make a multi-db search agent for web localhost compatible. When printing the path to the db, I had used NotesDatabase.FilePath. The problem with this is that it returns the filesystem path to the db when running locally. E.g. c:\lotus\notes\data\db.nsf
I could use NotesDatabase.ReplicaID, but I prefer somewhat readable URLs.
My solution was using evaluate @DbName[2] (the path to the database), with a document from the db I was currently processing. Without the document as second argument, evaluate would return the path to the search database.
Function printPath(resultDoc As NotesDocument) As String
Dim dbpath As String
dbpath = Join( Evaluate( |
@ReplaceSubstring(@DbName[2];"\\";"/")|,resultDoc))
printPath= "/" + dbpath + "/0/" + resultDoc .UniversalID
End Function
Labels:
random tip
Friday, August 8, 2008
Fun with the WebBrowser control
I'm messing around with the WebBrowser Control again.. :)
I planned on getting a demoapp together today, but I had to find a workaround for showing/hiding the layer holding the webbrowser, and that took most of my time. Hide-when doesn't work properly with the WebBrowser-object.
At least I want to show some fruits of my labor. A small flash animation showing scripting between Notes and the control/putting the WebBrowser control inside a layer.
The promt/messagebox in the demo are Notes'. You can tell from how they look, compared to the browser's alert/prompt.
I'll probably post a demoapp/more info when I have something more useful..
I planned on getting a demoapp together today, but I had to find a workaround for showing/hiding the layer holding the webbrowser, and that took most of my time. Hide-when doesn't work properly with the WebBrowser-object.
At least I want to show some fruits of my labor. A small flash animation showing scripting between Notes and the control/putting the WebBrowser control inside a layer.
The promt/messagebox in the demo are Notes'. You can tell from how they look, compared to the browser's alert/prompt.
I'll probably post a demoapp/more info when I have something more useful..
Labels:
Lotus Notes,
Microsoft Web Browser