Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Disabling fields on workspace profile
Bowman
Hi all,
I'm looking for a way to disable all the profile fields on the workspace properties screen, but still keep the group security button enabled. We want users to be able to edit the workspace security to add other users/groups but not et them edit the client or matter values.
I have been looking at a similar thread (called 'Disable c1 and c2') and have ran the code supplied in it and have the same problem described in that thread. The new Properties menu command works great if the user looks at the properties on the workspace under Worksite Explorer, but if the user looks at the properties of a workspace shortcut i get an error saying the object is invalid.
Is there any way of getting this command to work for both the workspace and workspace shortcuts? For a workspace shortcut i would expect to see the shortcut properties screen first and then if the user clicks on the workspace properties screen it would show the workspace properties with the custom fields disabled.
Also, i noticed you can get the the workspace properties from a number of locations including some of the integration dialogs. Is it possible to disabled c1 and c2 from these screens also?
Are there nrs files we can use now to disabled these fields?
Thanks in advance.
Find more posts tagged with
Comments
jny
If you want to disable the c1/c2 fields everywhere the edit workspace profile dialog is displayed, then you should use editworkspace.nrs script. Having said that, these fields cannot be disabled via scripting but here's a workaround script you can use:
[editworkspace.nrs]
==============================
' Set the AttributeIDs of the fields being used in the script as
' constants since enums cannot be used in VB Script
Const nrCustom1 = 25
Const nrCustom2 = 26
Dim c2
Sub IManEditWorkspaceCmd_OnInitDialog(dlg)
'Initial values
c2 = dlg.IManWorkspace.GetAttributeByID(nrCustom2)
dlg.SetAttributeValueByID nrCustom1, dlg.IManWorkspace.GetAttributeByID(nrCustom1), False
dlg.SetAttributeValueByID nrCustom2, dlg.IManWorkspace.GetAttributeByID(nrCustom2), False
End Sub
Sub IManEditWorkspaceCmd_PreOnOK(dlg)
dim curC2, sWarning, sTitle
sWarning = " field is read-only and cannot be modified. The original value will be restored. " & _
"Any changes made in the subsequent re-file dialog will not take effect."
sTitle = "Read-only Fields Violation."
curC2 = dlg.GetAttributeByID(nrCustom2)
if c2 <> curC2 then
dlg.SetAttributeValueByID nrCustom2, c2, false
MsgBox "CUSTOM2 " & sWarning, vbExclamation, sTitle
end if
End Sub
==============================
The event wrapper can be used for the workspace shortcut. I added additional code to check whether it's a shortcut. If so, resolve the shortcut, then add the actual workspace object in the specified contextitems, like so:
Private Sub ICommand_Execute()
Dim objIMan As imanobject
Dim shortcut As IManFolderShortcut
Dim ws As IManWorkspace
Set objIMan = mContext("SelectedContentsContainer")
If objIMan.ObjectType.ObjectType = imTypeFolderShortcut Then
' resolve it.
Set shortcut = objIMan
Set ws = shortcut.Resolve
With mContext
.Add "SelectedContentsContainer", ws
.Add "SelectedFolderObject", ws
.Add "SelectedIManObject", ws
.Add "SelectedNRTFolder", ws
End With
End If
' Call the execute method of the original command.
mOrigCmd.Execute
End Sub
Please note that the event wrapper cannot be used for the integration dialog though...only for FileSite/DeskSite.
Attached is the zip file that has the script and the event wrapper.
Bowman
The nrs script works brilliantly!
The script seems also to work when i go to the workspace properties via a shortcut in Filesite or the integration dialogs so there was i didn't need to use the event wrapper.
Many thanks.
PS: Is there a list somewhere of all the nrs files we can use? I didn't previously know about this nrs file and i have looked through all the Worksite support sites and SDK documentation.
jny
You should be able to find all available sample NRS scripts by navigating to to the iScripts folder under your WorkSite iToolkit installed path, e.g. "C:\iToolkits\8.2\iToolKit\iScripts".
The documentation on NRS Scripting is in the "Visual Basic Scripting for WorkSite Dialogs.pdf" manual which is stored in the iHelp folder under the same installed path.
Bowman
Another question related to this. Are there nrs scripts that you can use to disable fields in the profile screen when the user looks at the properties of a folder under a workspace?
The c1 and c2 values of a folder under a workspace can still be edited currently even though we have stopped the user from editing the c1 and c2 in the workspace profile. We want to stop this.
Or is another way to write a wrapper around the folder properties screen that can disable/remove tabs from the folder properties screen?
Thanks.
Migrateduser
Hi bowman, I have used nrs to make fields in the profile read only if you are not a member of the nrtadmin, maybe is usefull for your porpuse, you will only have to change the name of the group you want to check and the enum of the fields you want to make read only.
Hope it helps
Javi
EditProf.nrs
===========
Const nrtCustom25 = 49
Sub EditProfileDlg_OnInitDialog(dlg)
dim sess, db, usr, grp, grps, sgrps
set db = dlg.GetAttributeByID(0)
set sess = db.Session
set usr = db.GetUser(sess.UserID)
set grps = usr.Groups
dim isAdmin
isAdmin = "False"
for each grp in grps
sGrps = grp.Name
If sGrps = "NRTADMIN" Then
isAdmin = "True"
End if
next
If isAdmin = "False" Then
dlg.SetAttributeValueByID nrtCustom25,,false
End if
End Sub
jny
There isn't NRS scripting support for the folder properties dialog. You may, however, write a custom ICommand command to replace the exisiting one. In the custom command, invoke an instance of the FolderACLCmd, which is the command that brings up the folder properties dialog, and catch its events to validate the profile change. If changed, revert back to the original values -- basically, the same logical implemenation approach as the one inside the editworkspace.nrs script.
Attached is a sample VB ICommand code project for further detail and clarification.
Bowman
Thanks for for the responses. I will try this out.