Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

367 lines
9.5 KiB

  1. <%@ Language=VBScript %>
  2. <% Option Explicit %>
  3. <%
  4. '------------------------------------------------------------------------
  5. ' nfsclientgroups_new.asp: New ClientGroups Page
  6. '
  7. ' Copyright (c) Microsoft Corporation. All rights reserved.
  8. '
  9. ' Date Description
  10. ' 27-09-2000 Creation date
  11. '------------------------------------------------------------------------
  12. %>
  13. <!-- #include virtual="/admin/inc_framework.asp" -->
  14. <!-- #include file="loc_NFSSvc.asp" -->
  15. <!-- #include file="inc_NFSSvc.asp" -->
  16. <%
  17. Err.Clear
  18. On Error Resume Next
  19. '------------------------------------------------------------------------
  20. ' Form Variables
  21. '------------------------------------------------------------------------
  22. Dim F_groupname 'to get the group name from form
  23. Dim F_groupMembers 'to get the members in the list box from form
  24. '-------------------------------------------------------------------------
  25. ' End of Form Variables
  26. '-------------------------------------------------------------------------
  27. '-------------------------------------------------------------------------
  28. ' Create the page and Event handler
  29. '-------------------------------------------------------------------------
  30. Dim page
  31. Dim rc
  32. rc = SA_CreatePage(L_TASKTITLE_NEW_TEXT, "", PT_PROPERTY, page)
  33. If rc = 0 Then
  34. SA_ShowPage( page )
  35. End If
  36. Public Function OnInitPage( ByRef PageIn, ByRef EventArg)
  37. OnInitPage = True
  38. End Function
  39. Public Function OnPostBackPage( ByRef PageIn, ByRef EventArg)
  40. OnPostBackPage = True
  41. SetVariablesFromForm()
  42. End Function
  43. Public Function OnServePropertyPage( ByRef PageIn, ByRef EventArg)
  44. Call ServeCommonJavaScript()
  45. %>
  46. <TABLE WIDTH=518 VALIGN=middle ALIGN=left BORDER=0 CELLSPACING=0
  47. CELLPADDING=2>
  48. <TR>
  49. <TD class="TasksBody" colspan=4>
  50. <%=L_DESCRIPTION_TEXT%>
  51. </TD>
  52. </TR>
  53. <TR><TD class="TasksBody" colspan=4>&nbsp;</TD></TR>
  54. <TR>
  55. <TD class="TasksBody" NOWRAP>
  56. <%=L_GROUPNAME_TEXT%>
  57. </TD>
  58. <TD class="TasksBody" NOWRAP width="132">
  59. <input type="text" name="txtgroupname" style="width:132"
  60. maxlength="25" class=FormField onkeyup="CheckInput(this);"
  61. value="<%=F_groupname%>">
  62. </TD>
  63. <TD class="TasksBody">
  64. </TD>
  65. <TD class="TasksBody" nowrap>
  66. <%=L_CLIENTNAME_TEXT%>
  67. </TD>
  68. </TR>
  69. <TR height="22">
  70. <TD class="TasksBody" NOWRAP rowspan="2">
  71. <%=L_MEMBERS_TEXT%>
  72. </TD>
  73. <TD class="TasksBody" NOWRAP rowspan= 2">
  74. <select name="lstMembers" style="width:132"
  75. class=FormField Size="5">
  76. <%=DisplayMembers()%>
  77. </select>
  78. </TD>
  79. <TD class="TasksBody" NOWRAP align="center" valign="top" width="110">
  80. <% Call SA_ServeOnClickButtonEx(L_MEMBERSADDBTN_TEXT, "", "AddMemberstoListbox()", 50, 0, "DISABLED","btnmembersadd") %>
  81. </TD>
  82. <TD class="TasksBody" NOWRAP valign="top" rowspan="2">
  83. <input type="text" name="txtmembersadd" style="width:160"
  84. maxlength="25" class=FormField
  85. onkeyup="EnableAddBtn()">
  86. </TD>
  87. </TR>
  88. <TR>
  89. <TD class="TasksBody" NOWRAP align="center" valign="top" width="110">
  90. <% Call SA_ServeOnClickButtonEx(L_MEMBERSREMOVEBTN_TEXT, "", "DeletefromListbox()", 50, 0,"DISABLED" ,"btnmembersremove") %>
  91. </TD>
  92. </TR>
  93. </TABLE>
  94. <input type="hidden" name="HdnGroupMembers" value=<%=F_groupMembers%>>
  95. <%
  96. OnServePropertyPage = True
  97. End Function
  98. Public Function OnSubmitPage( ByRef PageIn, ByRef EventArg)
  99. OnSubmitPage = AddGroups
  100. End Function
  101. Public Function OnClosePage( ByRef PageIn, ByRef EventArg)
  102. OnClosePage = True
  103. End Function
  104. Function ServeCommonJavaScript()
  105. %>
  106. <script language = "JavaScript" src = "<%=m_VirtualRoot%>inc_global.js">
  107. </script>
  108. <script language = "JavaScript">
  109. var objForm = eval("document.frmTask")
  110. var intSelTab = objForm.TabSelected.value
  111. function Init()
  112. {
  113. var strReturnurl=location.href;
  114. var tempCnt=strReturnurl.indexOf("&ReturnURL=");
  115. var straction=strReturnurl.substring(0,tempCnt);
  116. objForm.txtgroupname.focus();
  117. objForm.action = straction;
  118. objForm.Method.value = "";
  119. //Disabling the ok button if group name is empty
  120. if((objForm.txtgroupname.value) == "")
  121. {
  122. DisableOK();
  123. }
  124. //Disabling the remove button
  125. if(objForm.lstMembers.length==0)
  126. {
  127. objForm.btnmembersremove.disabled=true;
  128. }
  129. else
  130. {
  131. objForm.btnmembersremove.disabled=false;
  132. }
  133. }
  134. function ValidatePage()
  135. {
  136. return true;
  137. }
  138. function SetData()
  139. {
  140. updateHiddenvariables();
  141. }
  142. //function to enable add button
  143. function EnableAddBtn()
  144. {
  145. if(Trim(objForm.txtmembersadd.value)!="")
  146. {
  147. objForm.btnmembersadd.disabled=false;
  148. }
  149. else
  150. objForm.btnmembersadd.disabled=true;
  151. }
  152. //Function to enable or disable OK button
  153. function CheckInput(objText)
  154. {
  155. if(Trim(objText.value) !="")
  156. {
  157. EnableOK();
  158. }
  159. else
  160. {
  161. DisableOK();
  162. }
  163. }
  164. //Function to add members to the listbox
  165. function AddMemberstoListbox()
  166. {
  167. var i;
  168. var txtNewMember = Trim(objForm.txtmembersadd.value);
  169. //If the member has exist in members list, display error
  170. for(i=0;i < objForm.lstMembers.length;i++)
  171. {
  172. if(objForm.lstMembers.options[i].value.toUpperCase()==
  173. txtNewMember.toUpperCase())
  174. {
  175. DisplayErr(txtNewMember+"<%=Server.HTMLEncode(L_MEMBEREXIST_ERRORMESSAGE)%>");
  176. objForm.txtmembersadd.select();
  177. objForm.txtmembersadd.focus();
  178. return;
  179. }
  180. }
  181. //Adds the member to the list box
  182. if(!addToListBox(objForm.lstMembers,objForm.
  183. btnmembersremove,txtNewMember,
  184. txtNewMember))
  185. {
  186. DisplayErr("<%=Server.HTMLEncode(L_DUPLICATEMEMBER_ERRORMESSAGE)%>");
  187. objForm.onkeypress = ClearErr;
  188. objForm.txtmembersadd.value = "";
  189. objForm.btnmembersadd.disabled=true;
  190. return false;
  191. }
  192. objForm.txtmembersadd.value = "";
  193. objForm.btnmembersadd.disabled=true;
  194. }
  195. //function to remove from the list box
  196. function DeletefromListbox()
  197. {
  198. removeListBoxItems(objForm.lstMembers,objForm.
  199. btnmembersremove);
  200. }
  201. //function to update hidden variables
  202. function updateHiddenvariables()
  203. {
  204. var strleng=objForm.lstMembers.length;
  205. var strMembers="";
  206. for (i=0;i<strleng;i++)
  207. {
  208. if (i==0)
  209. strMembers=objForm.lstMembers.options[i].value;
  210. else
  211. strMembers= strMembers + "," +
  212. objForm.lstMembers.options[i].value;
  213. }
  214. objForm.HdnGroupMembers.value=strMembers;
  215. }
  216. //Function for focus when raises the errmsg
  217. function setFocus(objErr)
  218. {
  219. objErr.focus();
  220. objErr.select();
  221. }
  222. </script>
  223. <%
  224. End Function
  225. '-------------------------------------------------------------------------
  226. 'Function Name: SetVariablesFromForm
  227. 'Description: Serves in Getting the data from Client
  228. 'Input Variables: None
  229. 'Output Variables: None
  230. 'Returns: None
  231. 'Global Variables: In: F_groupMembers
  232. ' In: F_groupname
  233. ' Out:None
  234. '-------------------------------------------------------------------------
  235. Function SetVariablesFromForm
  236. Err.Clear
  237. On Error Resume Next
  238. F_groupMembers=Request.Form("HdnGroupMembers")
  239. F_groupname=Request.Form("txtgroupname")
  240. End Function
  241. '-------------------------------------------------------------------------
  242. 'Function Name: Addgroups
  243. 'Description: Serves in adding the new groups and memebers
  244. 'Input Variables: None
  245. 'Output Variables: None
  246. 'Returns: None
  247. 'Global Variables: In: L_*
  248. ' Out:None
  249. '-------------------------------------------------------------------------
  250. Function AddGroups
  251. Err.Clear
  252. On Error Resume Next
  253. AddGroups=False
  254. 'enters into the loop only when group name is not empty.
  255. If not F_groupname="" then
  256. Dim ObjClientGroups
  257. Dim Member
  258. Dim intGroupsCount
  259. Dim intGroup
  260. Dim nRetValue
  261. Call SA_MungeURL(mstrReturnURL, "PKey",F_groupname)
  262. nRetValue = NFS_CreateGroup( F_groupname )
  263. If Not HandleError( nRetValue ) Then
  264. Exit Function
  265. End If
  266. ' Add Members to group
  267. If F_groupMembers<>"" Then
  268. nRetValue = NFS_AddMembersToGroup( F_groupname, F_groupMembers )
  269. Call SA_TraceOut( " nRetValue: " , nRetValue )
  270. If Not HandleError( nRetValue ) Then
  271. Call NFS_DeleteGroup( F_groupname )
  272. Exit Function
  273. End If
  274. End if
  275. AddGroups=True
  276. else
  277. SetErrMsg L_GROUPNAMEBLANK_ERRORMESSAGE
  278. end if
  279. End Function
  280. '-------------------------------------------------------------------------
  281. 'Function name: DisplayMembers
  282. 'Description: Serves in Displaying the Members from the form in the
  283. ' list box.
  284. 'Input Variables: None
  285. 'Output Variables: None
  286. 'Returns: None
  287. 'Global Variables: In:F_groupMembers -Group members in the list box
  288. '-------------------------------------------------------------------------
  289. Function DisplayMembers
  290. Err.Clear
  291. On Error Resume Next
  292. Dim strMembers
  293. Dim intMembers
  294. Dim intMembersCount
  295. strMembers = Split(F_groupMembers,",")
  296. intMembersCount = ubound(strMembers)
  297. 'for displaying each member in the list box
  298. For intMembers=0 to intMembersCount
  299. If strMembers(intMembers) = g_strMemberAtFault then
  300. Response.Write "<option value="&strMembers(intMembers)& _
  301. " selected>" & strMembers(intMembers)&"</option>"
  302. else
  303. Response.Write "<option value="&strMembers(intMembers)& _
  304. ">" & strMembers(intMembers)&"</option>"
  305. end if
  306. next
  307. End Function
  308. %>