ChadSmiley Blog Things about family, life, coding, and more

29Sep/069

Hi everyone!!!

Today was my first day in my new world and my dad asked me to introduce myself to everyone. My name is Carly Jo Schelfhout and my mother forced me into this world at 3:11 PM. It is much brighter and louder than what I am use to. :( I really like it though! My mommy and daddy have been very nice, they are always getting rid of that smell but I miss being wet and moist. My mommy wanted to make sure that I always had something to brag about to my brothers so she made me bigger!!! I was 10lb 3oz and my other brothers were 10lb 2oz and 10lb 1oz. The twins have a little disadvantage because they had to share mommy's belly so they were 7lb 13oz and 8lb 4oz. I am also 22in long but don't remember how long my brothers where. It does not really matter because I am the biggest!!!! I have not seen outside of our home yet because I was born where I was conceived, it is nice to be home. My mommy is awesome because she is feeding me and doing very well. Thanks daddy for everything so far. Thanks Calvin, Ezra, Josh, and Jared for welcoming me into your family. Almost forgot, thank you Jesus for creating me.

Love, Carly

Filed under: Family 9 Comments
28Sep/064

A Poll and BlogSphere Testing

I need some help in two areas:  a poll that I am interested in seeing the results and some testing.  If you take the poll then you will be helping me with my testing.  So please take the poll about how you wife/girlfriend likes to receive flowers.  My wife is the large number and less frequent. which means a couple of times a year.  Any feed back on the testing is always greatly appreciated.

Filed under: Family 4 Comments
20Sep/060

Open Audit 1.1.0

This was not my planed release for Open Audit that I talked about but it was needed. There are some minor enhancements and some fixes. Most of these came from Thilo, so keep the ideas coming.

Here is the run down of changes:
Version 1.1.0:
Some fixes and a few minor enhancements like a subform to make implementation easier. Also added more test configurations.
New Features:

  • Display the creator of the Audit
  • Added more help on the 'When' tab of the configuration
  • Added subform with 'Audit By Date' and 'Audit By Field' action buttons and LotusScript include to make implementation easier

Fixes:

  • Create 'Always' not working
  • View By Date showing time > 24, and date not sorting correctly
  • Initial values not being logged

Not Implemented:

  • Java audit class

Thanks Thilo for your efforts.

Filed under: Domino No Comments
12Sep/060

Open Audit – Featured OpenNTF Project

Open Audit is this months Featured OpenNTF Project. A new version is coming soon, with support for Java!

Open Audit will enable audits to be configure from both the form and field level. An audit is a trail of changes made to a field on a given document, currently only data will be saved with out formatting. An audit can be created for each form in a database and will also allow some fields to be audited. The audits can be kept for a fixed number of days or a set number of versions.
Filed under: Domino No Comments
9Sep/060

Only managers can unlock documents locked by other users – Solved

Technote (FAQ) - 1244520 states that you must have manager access to unlock a document. This is only true if you using standard Lotus features, I have been using Toolbar Functions and a LotusScript Document Locking Class to work with Lotus' document locking.

Filed under: Domino No Comments
9Sep/0612

Domino Document Locking Class 1.3

Here is an update to the Document Locking Class 1.1 and Document Locking Class , this update allows the unlocking overriding for Manager access (coded by Michael Sobczak) or overriding by group or role.

Public Sub new ( inDoc As Variant )
Public Sub SetCurrentUser ( user As String )
Public Function hasDocument ()
Public Sub setDocument ( inDoc As NotesDocument )
Public Sub setUIDocument ( inUIDoc As NotesUIDocument )
Public Property Get CurrentUser As String
Public Property Get toString As String
Public Property Get ShowPrompts As Boolean
Public Property Set ShowPrompts As Boolean
Public Function LockingEnabled () As Boolean
Public Function IsLockedByCurrentUser () As Boolean
Public Function IsDocumentLockedByCurrentUser (doc As NotesDocument ) As Boolean
Public Function IsUIDocumentLockedByCurrentUser ( uiDoc As NotesUIDocument ) As Boolean
Public Function LockedBy ( ) As String
Public Function IsLocked ( ) As Boolean
Public Function IsDocumentLocked ( doc As NotesDocument ) As Boolean
Public Function IsUIDocumentLocked ( uiDoc As NotesUIDocument ) As Boolean
Public Function Lock ( ) As Boolean
Public Function LockUIDocument (uiDoc As NotesUIDocument ) As Boolean
Public Function LockDocument ( doc As NotesDocument ) As Boolean
Public Function UnLock ( ) As Boolean
Public Function UnLockUIDocument ( uiDoc As NotesUIDocument ) As Boolean
Public Function UnLockDocument ( doc As NotesDocument ) As Boolean
Public Sub RoleGroupOverRide ( RoleGroup As String )

Domino Document Locking

%INCLUDE "LSCONST.LSS"
 
'/**
' * A rapper around the built-in document locking that is available in Notes/Domino 6.
' *	The purpose is to provide a better more consistant way of locking and unlocking documents.
' *	Will not lock a new document since it can not be locked.  Will only show warnings once.
' *
' *	@author	Chad Schelfhout		http://www.chadsmiley.com/
' *	@version	1.3
' *	@history
' *		1.0 Created
' *		1.1 Added ability to check the current user or a different user
' *		1.2 Added Manager override. by Michael Sobczak
' *		1.3 Added Role or Group override
' */
Class DominoDocumentLocking
 
	Private pUser As String
	Private pDoc As NotesDocument
	Private pToString As String 
	Private pShowPrompts As Boolean
	Private pDatabase_Locking_Not_Enabled As String
	Private pDatabase_Locking_Not_Enabled_Title As String
	Private pDocument_Locked As String
	Private pDocument_Locked_Title As String
	Private pEnabled As Boolean
	Private pAlreadyLocked As Boolean
	Private pRoleGroupOverRide As String
	'Flag used so user is only informed once that database locking is not enabled	
	Private pDatabasePrompted As Boolean
 
	Private db As NotesDatabase
 
	'/**
	' * Constructor
	' */
	Public Sub new( inDoc As Variant )
		pDatabase_Locking_Not_Enabled = "Database locking has not been enabled."
		pDatabase_Locking_Not_Enabled_Title = "Locking Not Enabled"
		pDocument_Locked = "Unable to lock, currently locked by: "
		pDocument_Locked_Title = "Document Locked"
		pDatabasePrompted = False
		pAlreadyLocked = False
		pShowPrompts = True
		pToString = ""
		If Not inDoc Is Nothing Then
			If Typename( inDoc ) = "NOTESDOCUMENT" Then
				Set pDoc = inDoc
			Elseif Typename( inDoc ) = "NOTESUIDOCUMENT" Then
				Set pDoc = inDoc.Document
			End If
		End If
 
		Dim Session As New NotesSession
		pUser = Session.UserName 
		'Msgbox "Current user is = " & pUser
 
		Set db = Session.CurrentDatabase
 
		If db.IsDocumentLockingEnabled Then
			pEnabled = True
		Else
			pEnabled = False
		End If
	End Sub
 
	'/**
	' * Determines if the document is locked 
	' */
	Private Function HasLock ( ) As Boolean
		If pDoc Is Nothing Then
			HasLock = True
		Else
			'if there is no text then it is not locked
			HasLock = Len( pDoc.LockHolders(0) ) > 0
		End If
	End Function
 
	'/**
	' * Gets the current user
	' */
	Private Property Get CurrentUser As String
		CurrentUser = pUser
	End Property
	'/**
	' * Gets the current user
	' */
	Public Sub SetCurrentUser( user As String )
		pUser = user
	End Sub
	'/**
	' * Determines if the document is locked but the current user.
	' */
	Private Function CurrentUserHasLock( ) As Boolean
		CurrentUserHasLock = HasLock ()
		If CurrentUserHasLock Then
			If pDoc.LockHolders(0) = pUser Then
				CurrentUserHasLock = True
			Else	'Not the current user.
				CurrentUserHasLock = False
			End If
		End If
	End Function
 
	'/**
	' * Determines if a document exists
	' */
	Public Function hasDocument()
		hasDocument = Not pDoc Is Nothing
	End Function
	'/**
	' * Sets the Document
	' */
	Public Sub setDocument( inDoc As NotesDocument )
		Set pDoc = inDoc	
	End Sub
	'/**
	' * Sets the document base on the UI document
	' */
	Public Sub setUIDocument( inUIDoc As NotesUIDocument )
		If inUIDoc Is Nothing Then
			Call setDocument( inUIDoc.Document )
		End If
	End Sub
 
	'/**
	' * Returns string of any messages
	' */
	Public Property Get toString As String
		toString = pToString
	End Property
 
	'/**
	' * Returns wether prompts are displayed
	' */
	Public Property Get ShowPrompts As Boolean
		ShowPrompts = pShowPrompts
	End Property
	'/**
	' * Sets wether prompts are displayed
	' */
	Public Property Set ShowPrompts As Boolean
		pShowPrompts = ShowPrompts
	End Property
 
	'/**
	' * Determines if database locking is enabled.
	' */
	Public Function LockingEnabled() As Boolean
		If Not pEnabled Then
			If Not pDatabasePrompted Then
				pToString = pDatabase_Locking_Not_Enabled
				If showPrompts Then
					Msgbox pToString , MB_ICONSTOP , pDatabase_Locking_Not_Enabled_Title
				End If
				pDatabasePrompted = True
			End If
		End If
		LockingEnabled = pEnabled
	End Function
 
	'/**
	' * Determines if the current document is locked by the current user.
	' */
	Public Function IsLockedByCurrentUser () As Boolean
		IsLockedByCurrentUser = LockingEnabled()
		If IsLockedByCurrentUser Then
			IsLockedByCurrentUser = CurrentUserHasLock( )
		Else	'Locking not enabled
			IsLockedByCurrentUser = False
		End If
	End Function	
	'/**
	' * Determines if the document is locked but the current user.
	' */
	Public Function IsDocumentLockedByCurrentUser (doc As NotesDocument ) As Boolean
		Call SetDocument( doc )
		IsDocumentLockedByCurrentUser = IsLockedByCurrentUser
	End Function
 
	'/**
	' * Determines if the UI document is locked but the current user.
	' */
	Public Function IsUIDocumentLockedByCurrentUser ( uiDoc As NotesUIDocument ) As Boolean
		Call setUIDocument( uiDoc )
		IsUIDocumentLockedByCurrentUser = IsLockedByCurrentUser(  )
	End Function
 
	'/**
	' * Returns who the document is locked by 
	' */
	Public Function LockedBy ( ) As String
		If hasDocument() Then
			LockedBy = pDoc.LockHolders(0)
		Else
			LockedBy = ""
		End If
	End Function
	'/**
	' * Determines if the currnet document is locked 
	' */
	Public Function IsLocked ( ) As Boolean
		isLocked = LockingEnabled()
		If isLocked Then
			isLocked = HasLock( )
		Else	'Locking is not enabled
			isLocked = False
		End If
	End Function
	'/**
	' * Determines if the the document is locked 
	' */
	Public Function IsDocumentLocked ( doc As NotesDocument ) As Boolean
		Call setDocument( doc ) 
		isDocumentLocked = IsLocked()
	End Function
	'/**
	' * Determines if the UI document is locked 
	' */
	Public Function IsUIDocumentLocked (uiDoc As NotesUIDocument ) As Boolean
		'Check to make sure that there is a document, If there is none it is a new document
		If ( uiDoc.Document Is Nothing ) Then
			IsUIDocumentLocked = False
		Else
			IsUIDocumentLocked= IsDocumentLocked( uiDoc.Document )
		End If
	End Function
 
	'/**
	' * Locks the current document
	' */
	Public Function Lock() As Boolean
 
		Me.Lock = LockingEnabled()
		If Me.Lock Then	'Check to make locking is enabled.
			If Not pAlreadyLocked Then	'Make sure that the document is not allready locked.
				If HasLock( ) Then
					'Msgbox "Document is currently locked"
					If CurrentUserHasLock( ) Then
						'Msgbox "Document is currently locked by the current user"
						'Since the current user has the document locked then we don't need to.
						pAlreadyLocked = True
						Me.Lock = True
					Else
						'Msgbox "Document is not currently locked by the current user"
						'Document is locked by someone else.  Let's display the name
						pToString = pDocument_Locked + pDoc.LockHolders(0)
						If showPrompts Then
							Msgbox pToString , MB_ICONSTOP, pDocument_Locked_Title 
						End If
						Me.Lock = False
					End If
				Else
					'Msgbox "Document is not locked"
					'Make sure that there is a document to lock, New documents can not be locked.
					If Not pDoc.IsNewNote Then
						Call pdoc.Lock
					End If
					pAlreadyLocked = True
					Me.Lock = True
 
				End If
			End If
		End If
 
	End Function
	'/**
	' * Locks the UI document
	' */
	Public Function LockUIDocument (uiDoc As NotesUIDocument ) As Boolean
		Call setUIDocument( uiDoc )
		LockUIDocument = Me.Lock()
	End Function
 
	'/**
	' * Locks the document
	' */
	Public Function LockDocument (doc As NotesDocument ) As Boolean
		Call setDocument ( doc ) 
		LockDocument = Me.Lock()
	End Function
 
	'/**
	' *  Unlocks the current document
	' */
	Public Function UnLock () As Boolean
 
		Me.UnLock = False
 
		If Not pDoc Is Nothing Then
			If Not pDoc.IsNewNote Then
				'Only unlock if the current user has it locked
				'or if the current user is defined as a Manager in the ACL.
				If ( CurrentUserHasLock () ) Then
					pDoc.UnLock
					Me.UnLock = True
				Elseif ( OverRideDocumentOwner() ) Then
					On Error Goto NotAuthor
					Call pDoc.RemoveItem( "$PWriters" )
					Call pDoc.RemoveItem( "$WritersDate" )
					Call pDoc.RemoveItem( "$Writers" )
					Call pDoc.Save( True, False , False )
					Me.UnLock = True
NotAuthor:
					pToString = Error
					If showPrompts Then
						Msgbox pToString , MB_ICONSTOP, pDocument_Locked_Title 
					End If
					Exit Function
				Else
					'Msgbox "Current user does not have the lock"
				End If
			Else
				'Msgbox "Current document is a new note"
			End If
		Else
			'Msgbox "Document is nothing"
		End If
 
	End Function
	'/**
	' *  Unlocks the UI document
	' */
	Public Function UnLockUIDocument (uiDoc As NotesUIDocument ) As Boolean
		Call setUIDocument( uiDoc )
		UnLockUIDocument = Me.UnLock()
	End Function
 
	'/**
	' * Unlocks the document
	' */
	Public Function UnLockDocument (doc As NotesDocument ) As Boolean
		Call setDocument( doc )
		UnLockDocument = Me.UnLock()
	End Function
 
	'/**
	'* Is User Database manager
	' */
	Private Function IsUserDbManager () As Boolean
		If ( db.CurrentAccessLevel = ACLLEVEL_MANAGER ) Then
			IsUserDbManager = True
		Else
			IsUserDbManager = False
		End If
	End Function
 
 
	'/**
	' * Role or Group Override
	' * The group or role will be used to determine if document can be unlocked
	' * even if the current user does not have the document locked.
	' */
	Public Sub RoleGroupOverRide( RoleGroup As String )
		pRoleGroupOverRide = RoleGroup
	End Sub
 
	'/**
	' * Determine if the role or group allows the unlocking to be overridden
	' */
	Private Function OverRideDocumentOwner () As Boolean
		OverRideDocumentOwner = IsUserDbManager
		If Not OverRideDocumentOwner Then
			Dim unl As Variant
			unl = Evaluate ( "@UserNamesList" )
			OverRideDocumentOwner = Not Isnull( Arraygetindex ( unl , pRoleGroupOverRide ) )
			If Not OverRideDocumentOwner Then
				OverRideDocumentOwner = Not Isnull( Arraygetindex ( unl , "["+pRoleGroupOverRide+"]" ) )
			End If
		End If
	End Function
End Class
Filed under: Domino 12 Comments