Abstract:
Recently, a user wants to implement the following functions. If the user belongs to the owner group, some fields can be edited in the new and edit screens of a list, if the user does not belong to the owner group, only these fields can be read-only. The user uses Shared Hosting Environment and can only be developed through the client.
Solution:
First, let's assume that you already know how to modify NewForm through Designer. aspx and EditForm. the aspx screen hides the default list item to edit the Web Part, and adds a new list item to edit the Web Part to learn how to manipulate fields in the added Web Part.
After completing these steps, we only use the default Title field as an example. We only need to call <xsl: if test = "ddwrt: IfHasRights (33554432) "> you can determine the user's identity to determine whether the field is displayed. The parameter in IfHasRights is called PermissionMark, and all reference values will be given later.
<xsl:if test="ddwrt:IfHasRights(33554432)"> <td width="75%" class="ms-vb"> <SharePoint:FormField runat="server" id="ff1{$Pos}" ControlMode="New" FieldName="Title" __designer:bind="{ddwrt:DataBind('i',concat('ff1',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Title')}" /> <SharePoint:FieldDescription runat="server" id="ff1description{$Pos}" FieldName="Title" ControlMode="Edit" /> </td></xsl:if>
The above only mentions the core content, and some trivial work needs to be done:
1. How to Write Else statements in XSL (<xsl: choose> should be used)
2. This field value is displayed when it does not belong to the owner group (<xsl: value-of select = "$ Title"> should be used)
Some interesting things can be investigated:
1. How to pass the variable from JavaScript to the XSL variable (so we can also consider a complicated solution, such as returning the user's group information through WebService before making a judgment)
The following are all available permissionmasks:
ViewListItems-1
AddListItems-2
EditListItems-4
DeleteListItems-8
ApproveItems-16
OpenItems-32
ViewVersions-64
DeleteVersions-128
CancelCheckout-256
PersonalViews-512
Manage elists-2048
ViewFormPages-4096
Open-65536
ViewPages-131072
AddAndCustomizePages-1, 262144
ApplyThemeAndBorder-524288.
Applystylesheet-1048576
ViewUsageData-2097152
CreateSSCSite-4194314
ManageSubwebs-8388608
CreateGroups-16777216
Manage ermissions-33554432
BrowseDirectories-67108864
BrowseUserInfo-134217728
AddDelPrivateWebParts-268435456
UpdatePersonalWebParts-536870912
ManageWeb-1073741824
UseRemoteAPIs-137438953472
Manage ERTs-274877906944
CreateAlerts-549755813888.
EditMyUserInfo-1099511627776
EnumeratePermissions-4611686018427387904
FullMask-9223372036854775807