|
<< Click to Display Table of Contents >> Navigation: Programming Mechworks PDM > DBWCommandShell > Event Scripts > Project > OnChangeCurrentProject.LST script file |
This script is executed when the user changes the current project throught the Tree/Grid user interface.
Options→Projects
@OLD_PROJECT_UNIQUE_ID |
the old Current Project UniqueID |
|---|---|
@OLD_PROJECT_ID |
the old Current Project ID |
@NEW_PROJECT_UNIQUE_ID |
the new Current Project UniqueID |
@NEW_PROJECT_ID |
the new Current Project ID |
@PARENT_PROJECT_ID |
When passed, it means that the change of the current project is temporarily applied for inserting the document under its "natural" parent project (e.g. in a drag&drop operation) |
@OKCHANGEPROJECT |
0: deny the change of Current Project |
This script shows how to avoid that for a specific DBWArm group the project beginning with "Pr" may become a Current Project.
Sub main()
DBWInit(TRUE)
oldProjectUniqueId = DBWInput("@OLD_PROJECT_UNIQUE_ID")
oldProjectID = DBWInput("@OLD_PROJECT_ID")
newProjectUniqueId = DBWInput("@NEW_PROJECT_UNIQUE_ID")
newProjectID = DBWInput("@NEW_PROJECT_ID")
'DBWMsgBox "oldUid=" & oldProjectUniqueId & vbcrlf &_
'"oldId=" & oldProjectID & vbcrlf &_
'"newUid=" & newProjectUniqueId & vbcrlf &_
'"newID=" & newProjectID
okChangeProject = "1"
myDBWArmGroup = DBWGetUserGroup()
If myDBWArmGroup = "RestrictedUsers" then
If Left(newProjectID,2)="Pr" Then
okChangeProject = "0"
DBWMsgBox "Projects beginning with Pr can not be a Current Project"
End If
End if
DBWOutput "@OKCHANGEPROJECT",okChangeProject,ForAppending
End Sub