I wrote a simple Layout DXL that basically shows me the locked state of every object in shareable edit mode. However its a bit limited. I know if things are locked, and I know if the current user has a lock.
Atomic007 - Fri Jul 13 13:54:21 EDT 2012 |
Re: Find out who has lock for sections in shareable edit mode? I know Doors knows who has the lock if you click a locked item, just wish it was exposed in DXL. |
Re: Find out who has lock for sections in shareable edit mode? Here is some unfinished work I did a few years ago. I have a nagging memory that you could not find out if someone else ALSO had the module open Shared.
string LockModes[] = {"0-lockRemoved", "1-lockShare", "2-lockWrite"}
string BuildLockInfo(Lock lck)
{ // build a string summarizing the lock
Item itm = lck.item
string NameFull = fullName(itm)
string UserLock = lck.user
string ResourceLock = lck.resourceName
string Computer = lck.host
int ProcessID = lck.connectionId
string ID = lck.id
int Mode = lck.lockMode
Date DateLock = lck.date
return("User: " UserLock " \t" Computer " \t'" ResourceLock "'("NameFull ") \t" LockModes[Mode] " \t" ProcessID "\t" DateLock "")
} // end BuildLockInfo()
Lock lockItem
string UserLock, ResourceLock, ErrMess
LockList llist = getLocksInFolder(folder ("/"), true, true)
for lockItem in llist do
{ print BuildLockInfo(lockItem) "\n"
}
delete(llist)
void PrintLocksInModule(ModName_ mn)
{
LockList lcklst = getLocksInModule(mn,false)
Lock lck
string s, NameUser, lt, scnResTemp = ""
int i
User usr
print "before loop\n"
for lck in lcklst do
{
print "in loop\n"
s = lck.user
i = lck.lockMode
if (i == lockShare) lt = "Shareable"
elseif (i == lockWrite) lt = "Exclusive"
elseif (i == lockRemoved) lt = "Removed"
else lt = "Bad LockMode Found: [" i "]"
if (existsUser(s))
{
usr = find(s)
NameUser = usr.fullName
if (NameUser == null)
NameUser = "No FullName"
}
scnResTemp = scnResTemp s "\t\t" NameUser "\t\t\t" lt "\n"
}
print "[" scnResTemp "]\n"
} // end PrintLocksInModule()
Module mCurr = current
ModName_ mn = module(fullName(mCurr))
PrintLocksInModule(mn)
|
Re: Find out who has lock for sections in shareable edit mode? Try this:
Object curObj = current
string lockErrorMsg = lock (curObj)
if (!null lockErrorMsg) print lockErrorMsg "\n"
else print "Lock succeeded\n"
I obtained the following successive results:
Item /My_Project/My_Formal_Module locked (unshared) by Jane Doe@computerName1 at 08/01/14 10:25:02
Lock succeeded
section already locked
Item /My_Project/My_Formal_Module locked (unshared) by John Smith@computerName2 at 08/01/14 11:03:59
|