Halli hallo,
ich hab hier im Forum schon einiges über "About Database" Dokument anzeigen lassen gelesen.
Jedoch geht es da lediglich um das "About Database" Dokument der AKTUELLEN Datenbank.
Ich habe eine Datenbank, in der mehrere Datenbanken per Server und Dateiname, "registriert" sind. Jetzt soll noch ein Button rein, der das "About Database" Dokument einer ausgewählten Datenbank öffnent.
Ich habe jetzt was "Halblebiges" für einen Agenten gefunden:
Sub Initialize
Dim db As NotesDatabase
Dim db_check As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim doc_about As NotesDocument
Dim doc_tmp As NotesDocument
Dim s As NotesSession
Dim uiws As NotesUIWorkspace
' ### initialize ###
On Error Goto errorhandler
Set s = New NotesSession
Set db = s.CurrentDatabase
' ### show the about database document of the selected databases ###
Set dc = db.UnprocessedDocuments
If dc.Count = 0 Then Goto terminate
Set doc = dc.GetFirstDocument
Do Until doc Is Nothing
' get the about database document from the selected database
Set db_check = s.GetDatabase(doc.DBServer(0), doc.DBFilePath(0), False)
Set doc_about = db_check.GetDocumentByID("FFFF0002")
If doc_about Is Nothing Then Goto nextdoc
' create a temporary document to show the content
Set doc_tmp = db.CreateDocument
Call doc_about.CopyAllItems(doc_tmp)
doc_tmp.Form = "AboutDatabase"
' show temporary document
Set uiws = New NotesUIWorkspace
Call uiws.EditDocument(False, doc_tmp, True)
nextdoc:
Set doc = dc.GetNextDocument(doc)
Loop
' ### terminate ###
terminate:
Set uiws = Nothing
Set doc_tmp = Nothing
Set doc_about = Nothing
Set db_check = Nothing
Set doc = Nothing
Set dc = Nothing
Set db = Nothing
Set s = Nothing
Exit Sub
' ### error handling ###
errorhandler:
Messagebox "Module: " & "ShowAboutDatabase (Agent)" & Chr(10) & _
"Procedure: " & "Initialize" & Chr(10) & _
"Error: " & Error() & Chr(10) & _
"Code: " & Err() & Chr(10) & _
"Line: " & Erl & Chr(10), _
MB_OK + MB_ICONSTOP, _
db.Title
Stop
Resume terminate
End Sub
ABER!!! Wenn das Corpus Delicti Bilder enthält, die in der Quelldatenbank enthalten sind, werde diese nicht angezeigt.
Gibt es andere Wege oder Lösungen, wie ich das richtige, echte und unkopierte Dokument anzeigen lasse kann, ohne die Datenbank extra zu öffnen?
Gruß
Johnson
Das war mich schon klar. Und so habe ich es auch gemacht.
Das eignetliche Problem besteht darin, dass Bilder, die in dem About Datebase Dokument einer Datenbank "A" enthalten sind nicht dargestellt werden.
z.B. Kannst du mit folgendem Agenten das About Database Dokument deiner Mail-DB öffnen:
(! Zum Anzeigen muss noch eine Maske "AboutDatabase" erstellt werden, die ein RichTextFeld "Body" (Computed) enthält, das als Value den Inhalt von "$Body" anzeigen soll.)
Option Public
Option Declare
%INCLUDE "lsconst.lss"
Sub Initialize
Dim db As NotesDatabase
Dim db_check As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc_tmp As NotesDocument
Dim doc_about As NotesDocument
Dim s As NotesSession
Dim uiws As NotesUIWorkspace
' ### initialize ###
On Error Goto errorhandler
Set s = New NotesSession
Set db = s.CurrentDatabase
' ### show the about database document of the selected databases ###
' get the about database document from the selected database
Set db_check = New NotesDatabase("", "")
Call db_check.OpenMail
Set doc_about = db_check.GetDocumentByID("FFFF0002")
If doc_about Is Nothing Then
Messagebox {The database } & db_check.Title & { has no "About Database" dokument!}, MB_OK + MB_ICONSTOP, db.Title
Goto terminate
End If
' create a temporary document to show the content
Set doc_tmp = db.CreateDocument
Call doc_about.CopyAllItems(doc_tmp)
doc_tmp.Form = "AboutDatabase"
' show temporary document
Set uiws = New NotesUIWorkspace
Call uiws.EditDocument(False, doc_tmp, True)
' ### terminate ###
terminate:
Set uiws = Nothing
Set doc_tmp = Nothing
Set doc_about = Nothing
Set db_check = Nothing
Set dc = Nothing
Set db = Nothing
Set s = Nothing
Exit Sub
' ### error handling ###
errorhandler:
Messagebox "Module: " & "ShowAboutDatabase (Agent)" & Chr(10) & _
"Procedure: " & "Initialize" & Chr(10) & _
"Error: " & Error() & Chr(10) & _
"Code: " & Err() & Chr(10) & _
"Line: " & Erl & Chr(10), _
MB_OK + MB_ICONSTOP, _
db.Title
Stop
Resume terminate
End Sub
Das About Database Dokument wird auch geöffnet. Alles wunderbar. Jedoch fehlt in der Überschrift das Bildchen. In diesem Fall mag das nicht so wichtig sein, aber es gibt Applikationen, die z.B. ein Bild der Datenbankstruktur oder Organigramme enthalten.
Ein Kollege hat es anders gelöst.
@PostedCommand([FileOpenDatabase];DBServer:DBFilePath;"";"";"";"1");
@PostedCommand([HelpAboutDatabase]);
@PostedCommand([FileOpenDatabase];DBServer:DBFilePath;"";"";"";"1");
@PostedCommand([FileCloseWindow])
Aber Formelsprache hat mich dabei nicht wirklich überzeugt, denn ich muss die Datenbank erst öffnen...
>:D Ich hab's!!!
Das Feld "Body" meiner Maske "AboutDocument" bekommt jetzt nicht mehr den Inhalt von "$Body" sonder einen DocLink auf das About Dokument. Die Maske selbst soll den ersten DocLink aufführen (Maskeneingeschaft).
Den Code habe ich umgestellt:
Sub Initialize
Dim db As NotesDatabase
Dim db_check As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc_tmp As NotesDocument
Dim doc_about As NotesDocument
Dim rti_body As NotesRichTextItem
Dim s As NotesSession
Dim uiws As NotesUIWorkspace
' ### initialize ###
On Error Goto errorhandler
Set s = New NotesSession
Set db = s.CurrentDatabase
' ### show the about database document of the selected databases ###
' get the about database document from the selected database
Set db_check = New NotesDatabase("", "")
Call db_check.OpenMail
Set doc_about = db_check.GetDocumentByID("FFFF0002")
If doc_about Is Nothing Then
Messagebox {The database } & db_check.Title & { has no "About Database" dokument!}, MB_OK + MB_ICONSTOP, db.Title
Goto terminate
End If
' create a temporary document and add a document link to the about database document
Set doc_tmp = db.CreateDocument
doc_tmp.Form = "AboutDatabase"
Set rti_body = doc_tmp.CreateRichTextItem("Body")
Call rti_body.AppendDocLink(doc_about, db_check.Title)
Call rti_body.Update
' show temporary document
Set uiws = New NotesUIWorkspace
Call uiws.EditDocument(False, doc_tmp, True)
' ### terminate ###
terminate:
Set uiws = Nothing
Set rti_body = Nothing
Set doc_tmp = Nothing
Set doc_about = Nothing
Set db_check = Nothing
Set dc = Nothing
Set db = Nothing
Set s = Nothing
Exit Sub
' ### error handling ###
errorhandler:
Messagebox "Module: " & "ShowAboutDatabase (Agent)" & Chr(10) & _
"Procedure: " & "Initialize" & Chr(10) & _
"Error: " & Error() & Chr(10) & _
"Code: " & Err() & Chr(10) & _
"Line: " & Erl & Chr(10), _
MB_OK + MB_ICONSTOP, _
db.Title
Stop
Resume terminate
End Sub
Und siehe da? Das Dokument wird so geöffnet, wie ich es haben wollte. Hehehe. Notes bietet doch immer irgend eine Lösung für das eigentlich simpelste Problem.
;)