Das Notes Forum
Domino 9 und frühere Versionen => Entwicklung => Thema gestartet von: Felix am 29.04.02 - 16:03:13
-
Hallo zusammen,
habe eine DB gefunden die Feiertage im Kalender von Notes 4.6.x eintragen soll. Ich habe das verwendete Script auf die Tage in 2002 geändert und bekomme beim ausführen immer die Fehlermeldung "zu viele Fenster offen" !! Kann jemand weiterhelfen ??
Felix
Das Script des Buttons:
REM Quick and dirty code to add business holidays to the user's calendar
REM This code will add your business holidays to the user's calendar by using front end classes and allowing the form's built in funtionality to handle the validation
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As New NotesDatabase ("","")
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim userName As New notesname(session.username)
Dim dbfilename As String
Dim dbserver As String
Dim value As Integer
Call db.OpenMail
dbfilename=db.filepath
dbserver = db.server
value = Messagebox ("Möchten Sie die Feiertage 2002 " + Chr(10) + "zu Ihrem Kallender hinzufügen?", (4+32+0+0), "Add HolidaysTo Calendar")
If (value = 6) Then
'*****************Do this chunk of code for each holiday in the year**************************
Set uidoc = ws.ComposeDocument (dbserver,dbfilename,"Appointment")
Call uidoc.FieldSetText("Subject","Neujahr")
Call uidoc.FieldSetText("StartDate","01.01.2002")
Call uidoc.FieldSetText("AppointmentType","2")
Call uidoc.Save()
Call uidoc.Close()
'****************************************************************************************************
'*****************Do this chunk of code for each holiday in the year**************************
Set uidoc = ws.ComposeDocument (dbserver,dbfilename,"Appointment")
Call uidoc.FieldSetText("Subject","Heilige Dreikönige")
Call uidoc.FieldSetText("StartDate","06.01.2002")
Call uidoc.FieldSetText("AppointmentType","2")
Call uidoc.Save()
Call uidoc.Close()
'****************************************************************************************************
'*****************Do this chunk of code for each holiday in the year**************************
Set uidoc = ws.ComposeDocument (dbserver,dbfilename,"Appointment")
Call uidoc.FieldSetText("Subject","Karfreitag")
Call uidoc.FieldSetText("StartDate","29.03.2002")
Call uidoc.FieldSetText("AppointmentType","2")
Call uidoc.Save()
Call uidoc.Close()
'****************************************************************************************************
'*****************Do this chunk of code for each holiday in the year**************************
Set uidoc = ws.ComposeDocument (dbserver,dbfilename,"Appointment")
Call uidoc.FieldSetText("Subject","Ostersonntag")
Call uidoc.FieldSetText("StartDate","31.03.2002")
Call uidoc.FieldSetText("AppointmentType","2")
Call uidoc.Save()
Call uidoc.Close()
'****************************************************************************************************
'*****************Do this chunk of code for each holiday in the year**************************
Set uidoc = ws.ComposeDocument (dbserver,dbfilename,"Appointment")
Call uidoc.FieldSetText("Subject","Ostermontag")
Call uidoc.FieldSetText("StartDate","01.04.2002")
Call uidoc.FieldSetText("AppointmentType","2")
Call uidoc.Save()
Call uidoc.Close()
'****************************************************************************************************
'*****************Do this chunk of code for each holiday in the year**************************
Set uidoc = ws.ComposeDocument (dbserver,dbfilename,"Appointment")
Call uidoc.FieldSetText("Subject","Tag der Arbeit")
Call uidoc.FieldSetText("StartDate","01.05.2002")
Call uidoc.FieldSetText("AppointmentType","2")
Call uidoc.Save()
Call uidoc.Close()
'****************************************************************************************************
'*****************Do this chunk of code for each holiday in the year**************************
Set uidoc = ws.ComposeDocument (dbserver,dbfilename,"Appointment")
Call uidoc.FieldSetText("Subject","Christi Himmelfahrt")
Call uidoc.FieldSetText("StartDate","09.05.2002")
Call uidoc.FieldSetText("AppointmentType","2")
Call uidoc.Save()
Call uidoc.Close()
'****************************************************************************************************
'*****************Do this chunk of code for each holiday in the year**************************
Set uidoc = ws.ComposeDocument (dbserver,dbfilename,"Appointment")
Call uidoc.FieldSetText("Subject","Pfinstsonntag")
Call uidoc.FieldSetText("StartDate","19.05.2002")
Call uidoc.FieldSetText("AppointmentType","2")
Call uidoc.Save()
Call uidoc.Close()
'****************************************************************************************************
'*****************Do this chunk of code for each holiday in the year**************************
Set uidoc = ws.ComposeDocument (dbserver,dbfilename,"Appointment")
Call uidoc.FieldSetText("Subject","Pfinstmontag")
Call uidoc.FieldSetText("StartDate","20.05.2002")
Call uidoc.FieldSetText("AppointmentType","2")
Call uidoc.Save()
Call uidoc.Close()
'****************************************************************************************************
'*****************Do this chunk of code for each holiday in the year**************************
Set uidoc = ws.ComposeDocument (dbserver,dbfilename,"Appointment")
Call uidoc.FieldSetText("Subject","Tag der deutschen Einheit")
Call uidoc.FieldSetText("StartDate","03.10.2002")
Call uidoc.FieldSetText("AppointmentType","2")
Call uidoc.Save()
Call uidoc.Close()
'****************************************************************************************************
'*****************Do this chunk of code for each holiday in the year**************************
Set uidoc = ws.ComposeDocument (dbserver,dbfilename,"Appointment")
Call uidoc.FieldSetText("Subject","Allerheiligen")
Call uidoc.FieldSetText("StartDate","01.11.2002")
Call uidoc.FieldSetText("AppointmentType","2")
Call uidoc.Save()
Call uidoc.Close()
'****************************************************************************************************
'*****************Do this chunk of code for each holiday in the year**************************
Set uidoc = ws.ComposeDocument (dbserver,dbfilename,"Appointment")
Call uidoc.FieldSetText("Subject","Weihnachten")
Call uidoc.FieldSetText("StartDate","24.12.2002")
Call uidoc.FieldSetText("AppointmentType","2")
Call uidoc.Save()
Call uidoc.Close()
'****************************************************************************************************
'*****************Do this chunk of code for each holiday in the year**************************
Set uidoc = ws.ComposeDocument (dbserver,dbfilename,"Appointment")
Call uidoc.FieldSetText("Subject","1. Weihnachtsfeiertag")
Call uidoc.FieldSetText("StartDate","25.12.2002")
Call uidoc.FieldSetText("AppointmentType","2")
Call uidoc.Save()
Call uidoc.Close()
'****************************************************************************************************
'*****************Do this chunk of code for each holiday in the year**************************
Set uidoc = ws.ComposeDocument (dbserver,dbfilename,"Appointment")
Call uidoc.FieldSetText("Subject","2. Weihnachtsfeiertag")
Call uidoc.FieldSetText("StartDate","26.12.2002")
Call uidoc.FieldSetText("AppointmentType","2")
Call uidoc.Save()
Call uidoc.Close()
'****************************************************************************************************
'*****************Do this chunk of code for each holiday in the year**************************
Set uidoc = ws.ComposeDocument (dbserver,dbfilename,"Appointment")
Call uidoc.FieldSetText("Subject","Silvester")
Call uidoc.FieldSetText("StartDate","31.12.2002")
Call uidoc.FieldSetText("AppointmentType","2")
Call uidoc.Save()
Call uidoc.Close()
'****************************************************************************************************
Messagebox ("Kalender wurde mit den Feiertagen 2002 upgedatet.")
Else
Messagebox ("Calendar not changed.")
End If
End Sub
-
Hi,
versuch mal statts der vielen uidoc einfach mit backend doc zu arbeiten. Falls Du eine Mailschablone vom Lotus Client 5 hast, dort ist ein Agent drin der das gleiche macht.
-
Danke für die Antwort,
das stellt sich mir die Frage wie nutze ich das Backend ??
Bin nicht der versierte Programmierer
Felix
-
kannst du nicht die Dokumente aus der DB markieren + kopieren und über den AdminClient unter \Konfiguration\Verschiedenes\Feiertage einfügen.
Ich glaube das geht auch.
Gruss
Andreas
-
Hallo Andysun,
leider besteht nicht die Möglichkeit (oder doch) bei 700 DAUS das händisch durchzuführen.
Gruss Felix ;D ;D ;D
-
das nimmst du doch am Server vor.
Schau dir doch mal diese Option auf dem Server an.
Ich hatte nämlich auch mal eine DB, die allen Feiertagen gespeichert hatte und die konnte man gut über den Server einbinden.
Gruss
Andreas
-
so da stehe ich wohl auf der Leitung !!!!!
Auf dem Server (5.0.9a) sind selbstverständlich unter Verschiedenes/Feiertage die Einträge enthalten.
Aber dort kommt der User ja nicht hin.
Oder was verwendest du dann ??? ??? ???
Felix
-
Es gibt im MailFile ein Option.
Öffne das MailFile/ gehe in den Kalender ,
unter Werkzeuge/ findest du "Feiertage importieren".
Jetzt schaut er auf dem Server nach und du kannst das entsprechende Land auswählen.
Gruss
Andy
-
ja die Option gibt es unter 5x aber
wie meine Frage s.o. lautet, hätte ich die Info gerne bezogen auf Notes 46x Client.
Felix
-
grrrgrrrrrr, ups.
ach , wer lesen kann ist klar im Vorteil.
Tut mir wirklich leid, hab dich ganz schön wuschig gemacht, oder ?
Gruss
Andy
-
ja du, ich dachte schon wo ist denn diese DB hab ich was übersehen. 8)
Aber es wäre nett wenn mir doch jemand helfen könnte
Felix :'(
-
Hi,
der Code hier ist vom Mailtemplate Version 5
Option Declare
Use "Common"
REM Declarations
'//DNT//
Const strPUBLIC_NAB_FILENAME$ = "names.nsf"
Const strdBMasterHoliday$ = "pubnames.ntf"
Const strPicklistResource$ = "(ListResource)"
Const strListLabel$ = "ListLabel"
Const strMailHolidayView$ = "($RepeatLookup)"
Const strSelectedItems$ = "SelectedItems"
Const strPublicNABHolidayView$ = "($Holidays)"
Const HOLIDAY_STRING = 600
'//End DNT//
Class cBaseImportHolidays As BaseApplication
Public m_dbCurrentDatabase As notesdatabase
Public m_dbMasterHoliday As notesdatabase
m_uiws As NotesUIWorkspace
m_cStringTable As HolidayImportStringTable
m_noteHolidayProfile As notesdocument
m_noteCursorDoc As notesdocument
m_noteDoItemsExist As notesdocument
m_viewMailHoliday As notesview
m_viewHolidayGroup As notesview
m_entrycollection As notesviewentrycollection
m_viewEntry As notesdocument
m_notePublicHolidayDoc As notesdocument
m_collLocalHolidayDocs As notesdocumentcollection
m_noteHolidayDoc As notesdocument
m_vColumnValues As Variant
m_vAPPTUNID As Variant
m_vModified As Variant
m_vLocatedInPublicNAB As Variant
m_vUserForcedLocalDeletion As Variant
m_vDeletedByAgent As Variant
m_vCategories As Variant
m_vReturnValue As Variant
m_vTempAPPTUNID As Variant
Public m_strMailServerName As String
m_strTempAPPTUNID As String
m_strServerName As String
m_nAdded As Integer
m_nUpdated As Integer
m_nDeleted As Integer
m_nMB_OK As Integer
m_nSuccess As Integer
m_nHolidayEntry As Integer
Declare Property Get SelectedCategories
'//Constructor//
Sub new()
Set Me.m_session = cBaseImportHolidays..session
Set Me.m_uiws = New notesuiworkspace
Set Me.m_cStringTable = New HolidayImportStringTable
Set Me.m_uiws = New notesuiworkspace
Set Me.m_dbCurrentDatabase = Me.m_session.currentdatabase
Me.m_dbCurrentDatabase.Delayupdates = True
Set Me.m_noteCursorDoc = Me.m_dbCurrentDatabase.createdocument
If Me.m_noteCursorDoc Is Nothing Then
Call DisplayWarn(Me.m_cStringTable.GetString(HOLIDAY_STRING+6, Null) , MB_OK , Me.m_cStringTable.GetString(HOLIDAY_STRING+1, Null))
End
End If
Me.m_strServerName$ = fGetMailServerName()
If Me.m_dbMasterHoliday Is Nothing Then
Set Me.m_dbMasterHoliday = New notesdatabase(Me.m_strServerName$ , strPUBLIC_NAB_FILENAME)
End If
If Not Me.m_dbMasterHoliday.IsOpen Then
Call DisplayWarn(Me.m_cStringTable.GetString(HOLIDAY_STRING+7, Null) & Chr(13) &_
Me.m_strServerName$ &" " & strPUBLIC_NAB_FILENAME, MB_OK , Me.m_cStringTable.GetString(HOLIDAY_STRING+1, Null))
End
Else
Set Me.m_viewHolidayGroup = Me.m_dbMasterHoliday.getview(strPublicNABHolidayView$)
Set Me.m_viewMailHoliday = Me.m_dbCurrentDatabase.getview(strMailHolidayView$)
Call GetProfileNote()
If Not CheckIntegrity() Then
Print("Das Profildokument ist beschädigt, oder die Daten sind nicht korrekt")
End If
If Me.m_viewHolidayGroup Is Nothing Then
Call DisplayWarn(Me.m_cStringTable.GetString(HOLIDAY_STRING+9, Null) & Chr(13) &_
Me.m_cStringTable.GetString(HOLIDAY_STRING+8, Null) & Chr(13) &_
Me.m_strServerName$ &"!!" & strPUBLIC_NAB_FILENAME, MB_OK , Me.m_cStringTable.GetString(HOLIDAY_STRING+1, Null))
End
Else
Set Me.m_noteDoItemsExist = Me.m_viewHolidayGroup.getfirstdocument
If Me.m_noteDoItemsExist Is Nothing Then
Call ScanForDeletes()
Call WriteNoteItemsToProfile()
Call DisplayWarn(Me.m_cStringTable.GetString(HOLIDAY_STRING+11, Null) & Chr(13) & Cstr((Me.m_nAdded - Me.m_nUpdated))_
& Me.m_cStringTable.GetString(HOLIDAY_STRING+12, Null) & Chr(13) & Cstr(Me.m_nUpdated) & Me.m_cStringTable.GetString(HOLIDAY_STRING+13, Null)_
& Chr(13) & Cstr(Me.m_nDeleted) & Me.m_cStringTable.GetString(HOLIDAY_STRING+15, Null),MB_OK ,Me.m_cStringTable.GetString(HOLIDAY_STRING+1, Null))
End
End If
End If
End If
End Sub
Sub GetProfileNote()
Set Me.m_noteHolidayProfile = Me.m_dbCurrentDatabase.GetProfileDocument("HolidayProfile")
If Not Me.m_noteHolidayProfile.HasItem("LastImported") Then
Call ReadItemsFromViewIntoProfile()
Else
Call ReadItemsFromProfile()
End If
End Sub
Sub ReadItemsFromProfile()
Dim n As Integer
If Me.m_noteHolidayProfile.APPTUNID(0) = "" Then
Exit Sub
End If
Me.m_vAPPTUNID = Me.m_noteHolidayProfile.APPTUNID
Me.m_vModified = Me.m_noteHolidayProfile.Modified
Me.m_vUserForcedLocalDeletion = Me.m_noteHolidayProfile.UserForcedLocalDeletion
'convert to integers so we can store them off later
For n = 0 To Ubound(Me.m_vUserForcedLocalDeletion)
Me.m_vUserForcedLocalDeletion(n) = Cint(Me.m_vUserForcedLocalDeletion(n))
Next
Me.m_vDeletedByAgent = Me.m_noteHolidayProfile.DeletedByAgent
'convert to integers so we can store them off later
For n = 0 To Ubound(Me.m_vDeletedByAgent)
Me.m_vDeletedByAgent(n) = Cint(Me.m_vDeletedByAgent(n))
Next
Redim Me.m_vLocatedInPublicNAB(Ubound(Me.m_vAPPTUNID))
Forall tmpFlags In Me.m_vLocatedInPublicNAB
tmpFlags = False 'always set to false when loading
End Forall
End Sub
Function UpdateEntryInProfile(IndexNumber As Integer)
If Not IndexNumber => 0 Then
If Isarray(Me.m_vAPPTUNID) Then
Me.m_nHolidayEntry = Ubound(Me.m_vAPPTUNID) + 1
Redim Preserve Me.m_vAPPTUNID(Me.m_nHolidayEntry)
Redim Preserve Me.m_vModified(Me.m_nHolidayEntry)
Redim Preserve Me.m_vUserForcedLocalDeletion(Me.m_nHolidayEntry)
Redim Preserve Me.m_vDeletedByAgent(Me.m_nHolidayEntry)
Redim Preserve Me.m_vLocatedInPublicNAB(Me.m_nHolidayEntry)
Else
Me.m_nHolidayEntry = 0
Redim Me.m_vAPPTUNID(Me.m_nHolidayEntry)
Redim Me.m_vModified(Me.m_nHolidayEntry)
Redim Me.m_vUserForcedLocalDeletion(Me.m_nHolidayEntry)
Redim Me.m_vDeletedByAgent(Me.m_nHolidayEntry)
Redim Me.m_vLocatedInPublicNAB(Me.m_nHolidayEntry)
End If
Else
Me.m_nHolidayEntry = IndexNumber
Me.m_nUpdated = Me.m_nUpdated + 1
End If
Me.m_vAPPTUNID(Me.m_nHolidayEntry) = Me.m_noteHolidayDoc.ColumnValues(1)
Me.m_vModified(Me.m_nHolidayEntry) = Me.m_noteHolidayDoc.LastModified
Me.m_vLocatedInPublicNAB(Me.m_nHolidayEntry) = True 'always set to true when updating or adding
Me.m_vUserForcedLocalDeletion(Me.m_nHolidayEntry) = 0
Me.m_vDeletedByAgent(Me.m_nHolidayEntry) = 0
Exit Function
End Function
Function MarkEntryDeleted(Index As Integer)
Me.m_vDeletedByAgent(Index) = 1
Me.m_nDeleted = Me.m_nDeleted + 1
End Function
Sub ScanForDeletes()
On Error Goto TRAP
Dim n As Integer
If Isarray(Me.m_vAPPTUNID) Then
For n = 0 To Ubound(Me.m_vAPPTUNID)
If Not Cint(Me.m_vDeletedByAgent(n)) = 1 Then
If Not Me.m_vLocatedInPublicNAB(n) Then
Set Me.m_notePublicHolidayDoc = Me.m_dbMasterHoliday.Getdocumentbyunid(Me.m_vAPPTUNID(n))
If Me.m_notePublicHolidayDoc Is Nothing Then
Call RemoveAllDocumentsByAPPTUNID(Cstr(Me.m_vAPPTUNID(n)))
Call MarkEntryDeleted(n)
Else
If Not Me.m_notePublicHolidayDoc.LastModified = Me.m_vModified(n) Then
Call RemoveAllDocumentsByAPPTUNID(Cstr(Me.m_vAPPTUNID(n)))
Call CreateEntryInMailFile()
Call UpdateEntryInProfile(n)
End If
End If
End If
End If
Next
End If
Exit Sub
TRAP:
Select Case Err
Case 200
Resume Next
Case 4091
If Not Me.m_notePublicHolidayDoc Is Nothing Then
Delete Me.m_notePublicHolidayDoc
End If
Resume Next
Case Else
Messagebox(Cstr(Err) & ": " & Error$)
End Select
End Sub
Sub WriteNoteItemsToProfile()
'let's do a quick integrity check before we save....
If CheckIntegrity Then
Call Me.m_noteHolidayProfile.ReplaceItemValue("APPTUNID", Me.m_vAPPTUNID)
Call Me.m_noteHolidayProfile.ReplaceItemValue("Modified",Me.m_vModified)
Call Me.m_noteHolidayProfile.ReplaceItemValue("UserForcedLocalDeletion",Me.m_vUserForcedLocalDeletion)
Call Me.m_noteHolidayProfile.ReplaceItemValue("DeletedByAgent",Me.m_vDeletedByAgent)
Call Me.m_noteHolidayProfile.ReplaceItemValue("LastImported",Now())
Call Me.m_noteHolidayProfile.Save(True,False,True)
Else
Print("Das Profildokument ist beschädigt, oder die Daten sind nicht korrekt")
End If
End Sub
Function CheckIntegrity() As Integer
On Error Goto TRAP
CheckIntegrity = False
Dim n As Integer
n = Ubound(Me.m_vAPPTUNID)
If (n = Ubound(Me.m_vModified)) Then
If (n = Ubound(Me.m_vUserForcedLocalDeletion)) Then
If (n = Ubound(Me.m_vDeletedByAgent)) Then
CheckIntegrity = True
End If
End If
End If
Exit Function
TRAP:
Select Case Err
Case 13
CheckIntegrity = True 'structure is not initialized this is OK on new objects
Resume Next
Case Else
Messagebox(Cstr(Err) & ": " & Error$)
End Select
End Function
Sub ReadItemsFromViewIntoProfile()
Set Me.m_viewEntry = Me.m_viewMailHoliday.GetFirstdocument
Do While Not Me.m_viewEntry Is Nothing
Me.m_vColumnValues = Me.m_viewEntry.Columnvalues(11)
If Instr(Me.m_vColumnValues,"h") Then
If Not Me.m_strTempAPPTUNID = Me.m_viewEntry.Columnvalues(0) Then
If Isarray(Me.m_vAPPTUNID) Then
Me.m_nHolidayEntry = Ubound(Me.m_vAPPTUNID) + 1
Redim Preserve Me.m_vAPPTUNID(Me.m_nHolidayEntry)
Redim Preserve Me.m_vModified(Me.m_nHolidayEntry)
Redim Preserve Me.m_vUserForcedLocalDeletion(Me.m_nHolidayEntry)
Redim Preserve Me.m_vDeletedByAgent(Me.m_nHolidayEntry)
Redim Preserve Me.m_vLocatedInPublicNAB(Me.m_nHolidayEntry)
Else
Me.m_nHolidayEntry = 0
Redim Me.m_vAPPTUNID(Me.m_nHolidayEntry)
Redim Me.m_vModified(Me.m_nHolidayEntry)
Redim Me.m_vUserForcedLocalDeletion(Me.m_nHolidayEntry)
Redim Me.m_vDeletedByAgent(Me.m_nHolidayEntry)
Redim Me.m_vLocatedInPublicNAB(Me.m_nHolidayEntry)
End If
Me.m_vAPPTUNID(Me.m_nHolidayEntry) = Me.m_viewEntry.Columnvalues(0)
Me.m_vModified(Me.m_nHolidayEntry) = Me.m_viewEntry.Columnvalues(12)
Me.m_vUserForcedLocalDeletion(Me.m_nHolidayEntry) = 0
Me.m_vDeletedByAgent(Me.m_nHolidayEntry) = 0
Me.m_vLocatedInPublicNAB(Me.m_nHolidayEntry) = 0
Me.m_nHolidayEntry = Me.m_nHolidayEntry + 1
End If
End If
Me.m_vTempAPPTUNID = Me.m_viewEntry.Columnvalues(0)
If Isarray(Me.m_vTempAPPTUNID) Then
Me.m_strTempAPPTUNID = Me.m_vTempAPPTUNID(0)
Else
Me.m_strTempAPPTUNID = Me.m_viewEntry.Columnvalues(0)
End If
Set Me.m_viewEntry = Me.m_viewMailHoliday.GetNextdocument(Me.m_viewEntry)
Loop
End Sub
Sub GetImportItems
Call Me.m_noteCursorDoc.replaceitemvalue(strListLabel, Me.m_cStringTable.GetString(HOLIDAY_STRING+5, Null))
Call Me.m_noteCursorDoc.replaceitemvalue("ViewName" , strPublicNABHolidayView$)
Call Me.m_noteCursorDoc.replaceitemvalue("ServerName",fGetMailServerName())
Call Me.m_noteCursorDoc.replaceitemvalue("PublicNABFileName" ,strPUBLIC_NAB_FILENAME )
Call Me.m_noteCursorDoc.replaceitemvalue("LastImported",Me.m_noteHolidayProfile.LastImported)
Me.m_nMB_OK = Me.m_uiws.DialogBox( strPicklistResource , True , True , False, False, False, False, Me.m_cStringTable.GetString(HOLIDAY_STRING+1, Null),Me.m_noteCursorDoc,True,False)
If Me.m_nMB_OK Then
If Me.m_noteCursorDoc.HasItem(strSelectedItems$) Then
Me.m_vCategories = Me.m_noteCursorDoc.getitemvalue(strSelectedItems$)
End If
Else
End
End If
End Sub
Function CopyToDB
Me.m_nSuccess = fCopyToDB()
If Me.m_nSuccess Then
'now let's scan for notes that have been deleted in the public address book...
Call ScanForDeletes()
Call WriteNoteItemsToProfile()
Messagebox(Cstr((Me.m_nAdded - Me.m_nUpdated)) & Me.m_cStringTable.GetString(HOLIDAY_STRING+12, Null) & Chr(13) &_
Cstr(Me.m_nUpdated) & Me.m_cStringTable.GetString(HOLIDAY_STRING+13, Null) & Chr(13) &_
Cstr(Me.m_nDeleted) & Me.m_cStringTable.GetString(HOLIDAY_STRING+15, Null))
Else
Messagebox(Me.m_cStringTable.GetString(HOLIDAY_STRING+16, Null))
End If
End Function
Function RemoveAllDocumentsByAPPTUNID(APPTUNID As String)
Dim noteMasterToDelete As notesdocument
Dim collRepeatingNotesToDelete As notesdocumentcollection
Set collRepeatingNotesToDelete = Me.m_viewMailHoliday.getalldocumentsbykey(APPTUNID,True)
If collRepeatingNotesToDelete.count > 0 Then
Set noteMasterToDelete = collRepeatingNotesToDelete.GetFirstDocument
If noteMasterToDelete.Isresponse Then
Set noteMasterToDelete = Me.m_dbCurrentDatabase.GetDocumentByUNID(noteMasterToDelete.ParentDocumentUNID)
End If
Call collRepeatingNotesToDelete.RemoveAll(True)
End If
If Not noteMasterToDelete Is Nothing Then
Call noteMasterToDelete.remove(True)
End If
End Function
Function fCopyToDB() As Integer
Dim retLastUpdated As String
Dim retIndexNumber As Integer
If Me.m_vCategories(0) = "" Then
fCopyToDB = False
Else
Forall categories In Me.m_vCategories
Set Me.m_noteHolidayDoc = Me.m_viewHolidayGroup.getdocumentbykey(categories , True)
TOP:
If IsHolidayInProfile(Cstr(Me.m_noteHolidayDoc.ColumnValues(1)), retIndexNumber) Then
If Not (Me.m_noteHolidayDoc.LastModified = Me.m_vModified(retIndexNumber))_
Or Me.m_vDeletedByAgent(retIndexNumber) Then
'the master doc is modified or has been readded to the collection
Call RemoveAllDocumentsByAPPTUNID(Cstr(Me.m_noteHolidayDoc.ColumnValues(1)))
Call CreateEntryInMailFile()
Call UpdateEntryInProfile(retIndexNumber)
Else
' let's set the flag so there's no deletion scan for this item...
Me.m_vLocatedInPublicNAB(retIndexNumber) = True
End If
Else ' it's new and we just add the record and the item to memory
Call CreateEntryInMailFile()
Call UpdateEntryInProfile(True) 'true is a new entry
End If
Set Me.m_noteHolidayDoc = Me.m_viewHolidayGroup.getnextdocument(Me.m_noteHolidayDoc)
If Not Me.m_noteHolidayDoc Is Nothing Then
If Not Isnull(Arraygetindex(Me.m_noteHolidayDoc.ColumnValues,Cstr(categories) , 1)) Then
Goto TOP
End If
End If
End Forall
fCopyToDB = True
End If
End Function
Function IsHolidayInProfile(APPTUNID As String, retIndexNumber As Integer) As Integer
Dim tmpIndex As Variant
If Isarray(Me.m_vAPPTUNID) Then
tmpIndex = Arraygetindex(Me.m_vAPPTUNID,APPTUNID, 1)
If Not Isnull(tmpIndex) Then
retIndexNumber = Cint(tmpIndex)
IsHolidayInProfile = True
Exit Function
Else
retIndexNumber = Cint(-1)
IsHolidayInProfile = False
End If
Else
retIndexNumber = Cint(-1)
IsHolidayInProfile = False
End If
End Function
Function CreateEntryInMailFile()
Me.m_nAdded = Me.m_nAdded + 1
Set Me.m_notePublicHolidayDoc = New NotesDocument(Me.m_dbCurrentDatabase)
Call Me.m_noteHolidayDoc.CopyAllItems(Me.m_notePublicHolidayDoc)
Dim noteCalanderDoc As New NotesCSEventOwnerDocument(1)
Dim vDates As Variant
Call Me.m_notePublicHolidayDoc.ReplaceItemValue("OrgRepeat","1")
Call Me.m_notePublicHolidayDoc.ReplaceItemValue("Form","Appointment")
Call Me.m_notePublicHolidayDoc.ReplaceItemValue("AppointmentType","1")
Call Me.m_notePublicHolidayDoc.ReplaceItemValue("$CSFlags","h")
Call Me.m_notePublicHolidayDoc.ReplaceItemValue("StartDate",m_notePublicHolidayDoc.getitemvalue("RepeatStartDate"))
Call Me.m_notePublicHolidayDoc.ReplaceItemValue("EndDate",m_notePublicHolidayDoc.getitemvalue("RepeatStartDate"))
Call noteCalanderDoc.Init(Me.m_notePublicHolidayDoc)
Call noteCalanderDoc.SetViewIcon()
Call noteCalanderDoc.UpdateDateTimeItems()
vDates = noteCalanderDoc.GenerateRepeatDates()
Call Me.m_notePublicHolidayDoc.ReplaceItemValue("RepeatDates", vDates)
Call noteCalanderDoc.CreateRepeatHierarchy()
Call noteCalanderDoc.MarkTempItems()
Call Me.m_notePublicHolidayDoc.save(True,True,False)
End Function
Function fGetMailServerName() As String
Me.m_vReturnValue = Evaluate(|@LocationGetInfo([HomeServer])|)
If Me.m_vReturnValue(0) = "" Then
Call DisplayWarn(Me.m_cStringTable.GetString(HOLIDAY_STRING+10, Null) , MB_OK , Me.m_cStringTable.GetString(HOLIDAY_STRING+1, Null))
End
Else
fGetMailServerName = Me.m_vReturnValue(0)
End If
End Function
End Class
Class HolidayImportStringTable
Sub new
End Sub
Function GetString(nIndex As Integer, vData As Variant) As String
Select Case nIndex
Case HOLIDAY_STRING+1
GetString = "Feiertage importieren"
Case HOLIDAY_STRING+5
GetString = "Bitte wählen Sie die zu importierenden 'Feiertag'-Gruppen."
Case HOLIDAY_STRING+6
GetString = "Um fortzufahren, benötigen Sie mindestens Autorenzugriff auf diese Datenbank."
Case HOLIDAY_STRING+7
GetString = "Das öffentliche Adreßbuch konnte nicht geöffnet werden"
Case HOLIDAY_STRING+8
GetString = "Zum Ausführen dieser Funktion ist ein Domino Adreßbuch der Version 5.0 oder höher erforderlich."
Case HOLIDAY_STRING+9
GetString = "Erforderliche Ansicht im Adreßbuch nicht gefunden."
Case HOLIDAY_STRING+10
GetString = "Für Ihre aktuelle Arbeitsumgebung wurde kein Mail-Server angegeben."
Case HOLIDAY_STRING+11
GetString = "Im öffentlichen Adreßbuch sind keine Elemente definiert."
Case HOLIDAY_STRING+12
GetString = " Feiertagsdokument(e) hinzugefügt"
Case HOLIDAY_STRING+13
GetString = " Feiertagsdokument(e) aktualisiert."
Case HOLIDAY_STRING+15
GetString = " Feiertagsdokument(e) gelöscht."
Case HOLIDAY_STRING+16
GetString = "Es wurde keine Gruppe ausgewählt."
End Select
End Function
End Class
REM Initialize
Sub Initialize
Dim ImportOperation As New cBaseImportHolidays()
Call ImportOperation.GetImportItems
Call ImportOperation.CopyToDB
End Sub
-
Hi doliman,
den von Version 5 habe ich schon ausprobiert der funzt nicht.
Der Client ist 46x
Gruss Felix