Domino 9 und frühere Versionen > ND7: Entwicklung

About Database Dokument von Datenbanken anzeigen

(1/3) > >>

Johnson:
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:


--- Code: ---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

--- Ende Code ---

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

koehlerbv:
Hallo Stefan,

ich sag mal nur: db.GetDocumentByID ("FFFF0002").

Von diesem Prinzip ausgehend geht so einiges. Deswegen Dokumente zu kopieren ist nicht der Bringer ...  ;)

Bernhard

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.)


--- Code: ---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
--- Ende Code ---

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.

koehlerbv:
Ich hätte mir mal Deinen Code genauer ansehen sollen, Johnson - Du machst das ja schon so wie ich dummerweise erneut vorgeschlagen habe. Sorry.

Warum kopierst Du eigentlich überhaupt das Dokument und öffnest nicht gleich das Original? Was passiert, wenn Du das ganze Dokument kopierst (unter der Massgabe, dass Du in der Ziel-DB bereits ein HelpAbout-Dokument hast, wird dabei ja auch eine neue NoteID vergeben)?

Bernhard

Johnson:
Das Dokument direkt zu öffnen, war meine erste Lösung, als ich das Backend-Dokument hatte.
Dann kommt allerdings die Fehlermeldung: "Notes Error - The linked document cannot be found in the view"  :-\

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln