img chenyg2000

Adding new icon to toolbar with script

发表于2004/10/12 14:21:00  793人阅读

From LDD(http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/d2afd020da55b8e985256e4c002850c7?OpenDocument&Highlight=0,bookmark,bar)
My goal is to distribute the news entry with a button that I will send to my users.

1. The first part of the button copy the outline in the outline "UserToolBar" of the local "bookmark.nsf". This add the tool bar with the actions.

2. To import the gif I have created a public network share on which I have put the DXL exportation of my image. Then I import this file in the bookmark.nsf. (be careful of the version of the DTD used in your designer client and the one available in the target client... it should be the same)

The solution isn't smart but it works... I will improve it with time.


Sub Click(Source As Button)
' Function.....: Code permettant de déployer l'outline des dictionnaires dans un bookmark.nsf local
' Date...........: 02.03.2004
' Author........: Pierre Koerber
' Desc..........:
' Return........: Rien
Dim dbBook As NotesDatabase
Dim thisDatabase As notesdatabase
Dim db As notesdatabase
Dim se As New notessession

' --- From where Am I ?
Set thisDatabase = se.CurrentDatabase

' --- Get the local bookmark database
Set db = se.getDatabase("","bookmark.nsf")
If db Is Nothing Then
Msgbox "Impossible to locate... local bookmark "
Exit Sub
End If

' -- Importation des images, stockées sous forme DXL dans un share.
Call importDXL("//frorg06s/notes6/dxl/image.dxl", db)
Print "Images importées.... "

' --- Get the template database
Set dbBook = se.GetDatabase(thisDatabase.server,"Informatique/lotus/orgCommonDesign.nsf")
If dbBook Is Nothing Then
Msgbox "Impossible to locate... source bookmark "
Exit Sub
End If

' -- Get the source outline
Dim outlineSource As NotesOutline
Dim outlineEntrySource As NotesOutlineEntry

' -- This is the source outline
Set outlineSource = dbBook.GetOutline("OrgamolDictionnaireToolBar")

If outlineSource Is Nothing Then
Msgbox "OrgamolDictionnaireTool bar not found !"
Exit Sub
End If

Dim outlineDest As NotesOutline
Dim outlineEntryDest As NotesOutlineEntry

' -- Get the userToolbar outline
Set outlineDest = db.getoutline("UserToolbar")
' -- Get the first entry of the source
Set outlineEntrySource = outlinesource.GetFirst()

' -- Check if it exists.

' --- Create each entries in the dest.
While Not(outlineEntrySource Is Nothing)
Set outlineEntryDest = outlineDest.CreateEntryFrom(outlineEntrySource)
Set outlineEntrySource = outlineSource.GetNext(outlineEntrySource )

' --- Save the outline
Call outlineDest.save()
Print "Toolbar importée.... "
End Sub

Function importDXL(szFileName As String, pDb As notesdatabase)
' Function.....: Fonction ouvrant un fichier DXL et important ce flux en tant que code dans la base courrante.
' Date...........: 02.03.2004
' Author........: Pierre Koerber
' Desc..........:
' Return........: Rien
Dim db As notesdatabase
Dim session As New NotesSession

If pDb Is Nothing Then
Set db = session.currentdatabase
Set db = pDb
End If

REM Open dxl file named after current database
Dim stream As NotesStream
Set stream = session.CreateStream
If Not stream.Open(szFileName) Then
Messagebox "Cannot open " & szFileName,, "Error"
Exit Function
End If
If stream.Bytes = 0 Then
Messagebox "File did not exist or was empty",, szFileName
Exit Function
End If

REM Create new database named current database + "Copy"

REM Import DXL into new database
Dim importer As NotesDXLImporter
Set importer = session.CreateDXLImporter(stream, db)
importer.ReplaceDBProperties = True
importer.ReplicaRequiredForReplaceOrUpdate = False
importer.DesignImportOption = DXLIMPORTOPTION_CREATE
Call importer.Process

End Function
0 0


取 消