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.

842 lines
29 KiB

  1. <%@ Language=VBScript %>
  2. <% Option Explicit %>
  3. <%
  4. '-------------------------------------------------------------------------
  5. ' user_prop.asp : get's and set's the user properties.
  6. '
  7. ' Copyright (c) Microsoft Corporation. All rights reserved.
  8. '
  9. ' Date Description
  10. ' 15-jan-01 Creation date
  11. '-------------------------------------------------------------------------
  12. %>
  13. <!-- #include virtual="/admin/inc_framework.asp" -->
  14. <!-- #include file="inc_usersngroups.asp" -->
  15. <%
  16. '-------------------------------------------------------------------------
  17. ' Global Constants and Variables
  18. '-------------------------------------------------------------------------
  19. Dim rc 'framework variables
  20. Dim page 'framework variables
  21. Dim idTabGeneral 'framework variables
  22. '-------------------------------------------------------------------------
  23. ' Global Form Variables
  24. '-------------------------------------------------------------------------
  25. Dim F_strOldUserName 'Stores the Username from the previous form
  26. Dim F_strUserName 'Stores the Username from the client
  27. Dim F_strFullName 'Stores FullName of the user
  28. Dim F_strDescription 'Stores Description of the user
  29. Dim F_strIschecked 'Used to store checked/unchecked
  30. Dim F_blnIschecked 'Used to store values (1 or null )
  31. Dim F_strHomeDirectory 'Stores Home directory of the user
  32. Dim F_strOldHomeDirectory 'Stores previous Home directory of the user
  33. Dim F_strCheckboxClass 'Stores state of checkbox class.
  34. Dim F_strComputerName 'Stores the computer name
  35. Dim F_objComputer 'var for getting connection for user info
  36. Dim F_objUser 'var for getting user info
  37. ' Flag variable for setting disable property
  38. CONST CONST_UF_ACCOUNTDISABLE = &H0002
  39. Const CONST_NONUNIQUEUSERNAME_ERRNO = &H800708B0
  40. Const CONST_ADMINDISABLED_ERRNO = &H8007055B
  41. Const CONST_GROUP_EXISTS_ERRNO = &H80070560
  42. '------------------------------------------------------------------------
  43. 'Start of localization content
  44. '------------------------------------------------------------------------
  45. Dim L_NOINPUTDATA_TEXT
  46. Dim L_TABPROPSHEET_TEXT
  47. Dim L_TABLEHEADING_TEXT
  48. Dim L_GENERAL_TEXT
  49. Dim L_PAGETITLE_TEXT
  50. Dim L_USERNAME_TEXT
  51. Dim L_FULLNAME_TEXT
  52. Dim L_DESCRIPTION_TEXT
  53. Dim L_USERDISABLED_TEXT
  54. Dim L_ENTERNAME_ERRORMESSAGE
  55. Dim L_INVALIDCHARACTER_ERRORMESSAGE
  56. Dim L_UNIQUEUSERNAME_ERRORMESSAGE
  57. Dim L_ADSI_ERRORMESSAGE
  58. Dim L_GROUP_EXISTS_ERRORMESSAGE
  59. Dim L_ADMINDISABLED_ERRORMESSAGE
  60. Dim L_HOMEDIRECTORY_TEXT
  61. Dim L_HOMEDIRECTORY_ERRORMESSAGE
  62. Dim L_CREATEHOMEDIRECTORY_ERRORMESSAGE
  63. Dim L_CREATEHOMEDIRECTORY_EXISTMESSAGE
  64. L_NOINPUTDATA_TEXT = objLocMgr.GetString("usermsg.dll","&H4030002C", varReplacementStrings)
  65. L_TABPROPSHEET_TEXT = objLocMgr.GetString("usermsg.dll","&H4030002D", varReplacementStrings)
  66. L_TABLEHEADING_TEXT = objLocMgr.GetString("usermsg.dll","&H4030002E", varReplacementStrings)
  67. L_GENERAL_TEXT = objLocMgr.GetString("usermsg.dll","&H4030002F", varReplacementStrings)
  68. L_USERNAME_TEXT = objLocMgr.GetString("usermsg.dll","&H40300031", varReplacementStrings)
  69. L_FULLNAME_TEXT = objLocMgr.GetString("usermsg.dll","&H40300032", varReplacementStrings)
  70. L_DESCRIPTION_TEXT = objLocMgr.GetString("usermsg.dll","&H40300033", varReplacementStrings)
  71. L_ENTERNAME_ERRORMESSAGE = objLocMgr.GetString("usermsg.dll","&HC0300035", varReplacementStrings)
  72. L_UNIQUEUSERNAME_ERRORMESSAGE = objLocMgr.GetString("usermsg.dll","&HC0300036", varReplacementStrings)
  73. L_INVALIDCHARACTER_ERRORMESSAGE = objLocMgr.GetString("usermsg.dll","&HC0300037", varReplacementStrings)
  74. L_ADSI_ERRORMESSAGE = objLocMgr.GetString("usermsg.dll","&HC0300038", varReplacementStrings)
  75. L_GROUP_EXISTS_ERRORMESSAGE = objLocMgr.GetString("usermsg.dll","&HC0300039", varReplacementStrings)
  76. L_ADMINDISABLED_ERRORMESSAGE = objLocMgr.GetString("usermsg.dll","&HC030003A", varReplacementStrings)
  77. L_HOMEDIRECTORY_TEXT = objLocMgr.GetString("usermsg.dll","&H40300052", varReplacementStrings)
  78. L_HOMEDIRECTORY_ERRORMESSAGE = objLocMgr.GetString("usermsg.dll","&HC0300053", varReplacementStrings)
  79. L_CREATEHOMEDIRECTORY_ERRORMESSAGE = objLocMgr.GetString("usermsg.dll","&HC0300057", varReplacementStrings)
  80. L_CREATEHOMEDIRECTORY_EXISTMESSAGE = objLocMgr.GetString("usermsg.dll","&HC0300059", varReplacementStrings)
  81. '------------------------------------------------------------------------
  82. 'END of localization content
  83. '------------------------------------------------------------------------
  84. ' Create a Tabbed Property Page
  85. Dim aUser(0)
  86. Dim sUser
  87. Call OTS_GetTableSelectionCount("")
  88. Call OTS_GetTableSelection("", 1, sUser)
  89. Call SA_TraceOut(SA_GetScriptFileName, "Selected user: " + sUser)
  90. aUser(0) = sUser
  91. L_PAGETITLE_TEXT = GetLocString("usermsg.dll","&H40300030", aUser)
  92. rc = SA_CreatePage( L_PAGETITLE_TEXT, "", PT_TABBED, page )
  93. ' Add one tab
  94. rc = SA_AddTabPage( page, L_GENERAL_TEXT, idTabGeneral)
  95. ' Show the page
  96. rc = SA_ShowPage( page )
  97. '-------------------------------------------------------------------------
  98. 'Function: OnInitPage()
  99. 'Description: Called to signal first time processing for this page.
  100. ' Use this method to do first time initialization tasks
  101. 'Input Variables: PageIn,EventArg
  102. 'Output Variables: PageIn,EventArg
  103. 'Returns: True/False
  104. 'Global Variables: None
  105. '-------------------------------------------------------------------------
  106. Public Function OnInitPage(ByRef PageIn, ByRef EventArg)
  107. 'globally required
  108. GetComputerObject()
  109. Dim iItemCount
  110. Dim sessionItem
  111. '
  112. ' Get table selection count
  113. '
  114. iItemCount = OTS_GetTableSelectionCount("")
  115. F_strCheckboxClass = "FormField"
  116. If iItemCount > 1 Then
  117. '
  118. ' It's multiselection, only disable attribute can be changed
  119. '
  120. Dim x
  121. Dim itemKey
  122. F_strIschecked = "unchecked"
  123. L_USERDISABLED_TEXT = objLocMgr.GetString("usermsg.dll","&H40300056", varReplacementStrings)
  124. For x = 1 To iItemCount
  125. 'Retrieve each user's property
  126. If ( OTS_GetTableSelection("", x, itemKey) ) Then
  127. F_strUserName = replace(itemKey,"\'","'")
  128. 'Get the user object
  129. Set F_objUser = F_objComputer.GetObject("User",F_strUserName)
  130. If Err.number <> 0 Then
  131. Err.Clear
  132. Call ServeFailurePage(L_ADSI_ERRORMESSAGE ,1)
  133. Exit Function
  134. End If
  135. If F_objUser.UserFlags And CONST_UF_ACCOUNTDISABLE Then
  136. 'Making F_strIschecked=checked for gui display only
  137. F_strIschecked = "checked"
  138. Else
  139. F_strCheckboxClass = "FormFieldTriState"
  140. End If
  141. Set F_objUser = Nothing
  142. 'Restore the session value ???
  143. 'sessionItem = "Item" + CStr(x)
  144. 'Session(sessionItem) = itemKey
  145. End If
  146. Next
  147. F_strUserName = ""
  148. If F_strIschecked <> "checked" Then
  149. F_strCheckboxClass = "FormField"
  150. End If
  151. Else
  152. L_USERDISABLED_TEXT = objLocMgr.GetString("usermsg.dll","&H40300034", varReplacementStrings)
  153. '
  154. ' It's single selection
  155. '
  156. If F_strUserName = "" Then
  157. If ( OTS_GetTableSelection("", 1, itemKey) ) Then
  158. F_strUserName = replace(itemKey,"\'","'")
  159. ' making a copy for future reference
  160. F_strOldUserName= F_strUserName
  161. End If
  162. 'Restore the session value ???
  163. 'sessionItem = "Item" + CStr(1)
  164. 'Session(sessionItem) = itemKey
  165. End If
  166. Set F_objUser = F_objComputer.GetObject("User",F_strOldUserName)
  167. If Err.number <> 0 Then
  168. SetErrMsg L_USERNOTFOUND_ERRORMESSAGE
  169. Exit Function
  170. End If
  171. F_strFullName = F_objUser.FullName 'Get's the full name
  172. F_strDescription = F_objUser.Description 'Gets the description
  173. F_strHomeDirectory = F_objUser.HomeDirectory 'Gets home directory
  174. F_strOldHomeDirectory = F_strHomeDirectory 'Store home directory
  175. ' checking for disable property
  176. If F_objUser.UserFlags And CONST_UF_ACCOUNTDISABLE Then
  177. 'Making F_strIschecked=checked for gui display only
  178. F_strIschecked = "checked"
  179. Else
  180. 'Making F_strIschecked=unchecked for gui display only
  181. F_strIschecked = "unchecked"
  182. End If
  183. Set F_objUser = Nothing
  184. End If
  185. Set F_objComputer =Nothing
  186. OnInitPage = TRUE
  187. End Function
  188. '-------------------------------------------------------------------------
  189. 'Function: OnPostBackPage()
  190. 'Description: Called to signal that the page has been posted-back.
  191. 'Input Variables: PageIn,EventArg
  192. 'Output Variables: None
  193. 'Returns: True/False
  194. 'Global Variables: None
  195. '-------------------------------------------------------------------------
  196. Public Function OnPostBackPage(ByRef PageIn, ByRef EventArg)
  197. OnPostBackPage = TRUE
  198. End Function
  199. '-------------------------------------------------------------------------
  200. 'Function: OnServeTabbedPropertyPage()
  201. 'Description: Called when the page needs to be served.Use this
  202. ' method to serve content
  203. 'Input Variables: PageIn,EventArg,iTab,bIsVisible
  204. 'Output Variables: PageIn,EventArg
  205. 'Returns: True/False
  206. 'Global Variables: None
  207. ' TRUE to indicate not problems occured. FALSE to indicate errors.
  208. ' Returning FALSE will cause the page to be abandoned.
  209. '-------------------------------------------------------------------------
  210. Public Function OnServeTabbedPropertyPage(ByRef PageIn, _
  211. ByVal iTab, _
  212. ByVal bIsVisible, ByRef EventArg)
  213. Dim iItemCount
  214. iItemCount = OTS_GetTableSelectionCount("")
  215. If iItemCount > 1 Then
  216. Dim x
  217. Dim itemKey
  218. Dim sessionItem
  219. 'Here we have to restore the session again. ???
  220. For x = 1 To iItemCount
  221. If ( OTS_GetTableSelection("", x, itemKey) ) Then
  222. 'sessionItem = "Item" + CStr(x)
  223. 'Session(sessionItem) = itemKey
  224. End If
  225. Next
  226. ' Emit Web Framework required functions
  227. Call ServeMultiSelectionJScript()
  228. L_USERDISABLED_TEXT = GetLocString("usermsg.dll","40300056", "")
  229. 'Emit content for the requested tab
  230. Call ServeTab1(PageIn, bIsVisible, TRUE )
  231. Else
  232. ' Emit Web Framework required functions
  233. Call ServeCommonJavaScript()
  234. L_USERDISABLED_TEXT = GetLocString("usermsg.dll","40300034", "")
  235. ' Emit content for the requested tab
  236. Call ServeTab1(PageIn, bIsVisible, FALSE )
  237. End If
  238. OnServeTabbedPropertyPage = TRUE
  239. End Function
  240. '-------------------------------------------------------------------------
  241. 'Function: OnSubmitPage()
  242. 'Description: Called when the page has been submitted for processing.
  243. ' Use this method to process the submit request.
  244. 'Input Variables: PageIn,EventArg
  245. 'Output Variables: None
  246. 'Returns: True/False
  247. 'Global Variables: None
  248. '-------------------------------------------------------------------------
  249. Public Function OnSubmitPage(ByRef PageIn, ByRef EventArg)
  250. F_strUserName =Trim(Request.Form("txtUserName"))
  251. F_strOldUserName =Request.Form("hdnUsername")
  252. F_strFullName =Trim(Request.Form("txtfullName"))
  253. F_strDescription =Trim(Request.Form("txtDescription"))
  254. F_strHomeDirectory =Trim(Request.Form("txtHomeDirectory"))
  255. F_strOldHomeDirectory=Request.Form("hdnHomeDirectory")
  256. F_blnIschecked =Request.Form("chkuserDisabled")
  257. If F_blnIschecked=1 Then
  258. F_strIschecked = "checked"
  259. End if
  260. Dim iItemCount
  261. iItemCount = OTS_GetTableSelectionCount("")
  262. If( iItemCount > 1 ) Then
  263. OnSubmitPage = SetMultiSelectionProperty(iItemCount)
  264. Else
  265. OnSubmitPage = SetUserProperty()
  266. End If
  267. End Function
  268. '-------------------------------------------------------------------------
  269. 'Function: OnClosePage()
  270. 'Description: Called when the page is about closed.Use this method
  271. ' to perform clean-up processing
  272. 'Input Variables: PageIn,EventArg
  273. 'Output Variables: PageIn,EventArg
  274. 'Returns: True/False
  275. 'Global Variables: None
  276. '-------------------------------------------------------------------------
  277. Public Function OnClosePage(ByRef PageIn, ByRef EventArg)
  278. OnClosePage = TRUE
  279. End Function
  280. '-------------------------------------------------------------------------
  281. 'Function name: GetUserInformation
  282. 'Description: Get UserName from the system
  283. 'Input Variables: None
  284. 'Output Variables: None
  285. 'Returns: None
  286. 'Global Variables: None
  287. ' Out:F_objComputer 'User Name
  288. ' Out:F_objUsere 'Full Name
  289. ' In :L_ADSI_ERRORMESSAGE
  290. '
  291. ' If ADSI Error, calls ServeFailurePage with the error string
  292. ' L_ADSI_ERRORMESSAGE.
  293. '--------------------------------------------------------------------------
  294. Function GetComputerObject
  295. Err.Clear
  296. on Error resume next
  297. F_strComputerName=GetComputerName()
  298. Set F_objComputer = GetObject("WinNT://" & F_strComputerName)
  299. If Err.number <> 0 Then
  300. Err.Clear
  301. Call ServeFailurePage(L_ADSI_ERRORMESSAGE ,1)
  302. GetUserInformation=False
  303. Exit Function
  304. End If
  305. End function
  306. '-------------------------------------------------------------------------
  307. 'Function name: SetUserProperty
  308. 'Description: Setting the properties of the user
  309. 'Input Variables: None
  310. 'Output Variables: None
  311. 'Returns: (True / Flase )
  312. 'Global Variables: None
  313. ' In:F_strFullname 'Fullname
  314. ' In:F_strDescription 'Description
  315. ' In:F_blnIschecked 'Checked or not
  316. ' In:F_strUserName 'Username
  317. ' In:F_strOldUserName 'Username to retain
  318. ' In:L_ADSI_ERRORMESSAGE
  319. ' In:L_NONUNIQUEUSERNAME_ERRORMESSAGE
  320. '
  321. ' True ->If Implemented properly
  322. ' False->If Not Implemented
  323. ' Username allready exists, calls SetErrMsg with the error string
  324. ' L_NONUNIQUEUSERNAME_ERRORMESSAGE.
  325. ' If ADSI Error, calls SetErrMsg with the error string
  326. ' L_ADSI_ERRORMESSAGE.
  327. ' Const:CONST_UF_ACCOUNTDISABLE for setting disable property
  328. ' If administrator disabled Error,calls SetErrMsg with the error string
  329. ' L_ADMINDISABLED_ERRORMESSAGE
  330. '--------------------------------------------------------------------------
  331. Function SetUserProperty
  332. Err.Clear
  333. on Error resume next
  334. Dim objDummy 'Dummy object
  335. Dim objFileSystem
  336. Dim bReturn
  337. 'Function call to connectto user
  338. GetComputerObject()
  339. Set F_objUser = F_objComputer.GetObject("User",F_strOldUserName)
  340. If Err.number <> 0 Then
  341. Err.Clear
  342. Call ServeFailurePage(L_ADSI_ERRORMESSAGE ,1)
  343. Exit Function
  344. End If
  345. Set objFileSystem=createobject("scripting.FileSystemObject")
  346. If Err.number <> 0 Then
  347. SetErrMsg L_CREATEHOMEDIRECTORY_ERRORMESSAGE
  348. Exit Function
  349. End If
  350. 'Create home directory by settings.
  351. If ((F_strHomeDirectory <> F_strOldHomeDirectory) AND (F_strHomeDirectory <> "")) Then
  352. bReturn = CreateHomeDirectory( F_strHomeDirectory, objFileSystem )
  353. If( bReturn = CONST_CREATDIRECTORY_ERROR ) Then
  354. SetErrMsg L_CREATEHOMEDIRECTORY_ERRORMESSAGE
  355. Exit Function
  356. ElseIf( bReturn = CONST_CREATDIRECTORY_EXIST ) Then
  357. SetErrMsg L_CREATEHOMEDIRECTORY_EXISTMESSAGE
  358. Exit Function
  359. End If
  360. End If
  361. 'Setting the user info
  362. objDummy =F_objUser.Put("FullName",F_strFullName)
  363. objDummy =F_objUser.Put("Description",F_strDescription)
  364. objDummy =F_objUser.Put("HomeDirectory",F_strHomeDirectory)
  365. 'Setting the disable property
  366. SetDisableProperty()
  367. F_objUser.SetInfo()
  368. 'This is to change the Group name
  369. If ( F_strUserName <> F_strOldUserName ) Then
  370. F_objComputer.MoveHere F_objUser.AdsPath ,F_strUserName
  371. End If
  372. 'Set to Nothing
  373. Set F_objComputer =Nothing
  374. Set F_objUser =Nothing
  375. Set objFileSystem =Nothing
  376. 'Error Occurs,this Error validation takecare
  377. If Err.number <> 0 Then
  378. If Err.number = CONST_NONUNIQUEUSERNAME_ERRNO Then
  379. SetErrMsg L_UNIQUEUSERNAME_ERRORMESSAGE
  380. Elseif Err.Number = CONST_GROUP_EXISTS_ERRNO Then
  381. SetErrMsg L_GROUP_EXISTS_ERRORMESSAGE
  382. Elseif Err.Number = CONST_ADMINDISABLED_ERRNO then
  383. SetErrMsg L_ADMINDISABLED_ERRORMESSAGE
  384. Else
  385. SetErrMsg L_ADSI_ERRORMESSAGE
  386. End If
  387. 'This is to take care of old value to be replaced with new value in case of failure
  388. F_strUserName=F_strOldUserName
  389. SetUserProperty=False
  390. Exit Function
  391. End If
  392. If ((F_strHomeDirectory <> F_strOldHomeDirectory) AND (F_strHomeDirectory <> "")) Then
  393. Call SetHomeDirectoryPermission( F_strComputerName, F_strUsername, F_strHomeDirectory )
  394. End If
  395. SetUserProperty=True
  396. End Function
  397. '--------------------------------------------------------------------------
  398. 'Function name: GetDefaultHomeDirectory
  399. 'Description: Get default homedirectory of the user
  400. 'Input Variables: None
  401. 'Output Variables: None
  402. 'Returns: Default homedirectory of the user
  403. 'Global Variables:
  404. ' In:F_strUserName 'current user name
  405. '--------------------------------------------------------------------------
  406. Function GetDefaultHomeDirectory()
  407. Dim objReg
  408. Dim strDefaultHomeDir
  409. Set objReg = RegConnection()
  410. strDefaultHomeDir = GetRegKeyValue( objReg,_
  411. CONST_USERGROUP_KEYNAME,_
  412. CONST_USERDIR_VALUENAME,_
  413. CONST_STRING )
  414. If ( Len(strDefaultHomeDir) <= 0 ) Then
  415. strDefaultHomeDir = CONST_DEFAULTHOMEDIR
  416. End If
  417. GetDefaultHomeDirectory = strDefaultHomeDir + F_strUserName
  418. Set objReg = nothing
  419. End Function
  420. '--------------------------------------------------------------------------
  421. 'Function name: SetDisableProperty
  422. 'Description: Change the disable flage of the user
  423. 'Input Variables: None
  424. 'Output Variables: None
  425. 'Returns: None
  426. 'Global Variables:
  427. ' In:F_objUser 'Object of user
  428. ' In:F_blnIschecked 'Checked or not
  429. '--------------------------------------------------------------------------
  430. Function SetDisableProperty()
  431. Dim flagUserFlags 'Flage variable
  432. If F_blnIschecked=1 Then
  433. flagUserFlags = F_objUser.UserFlags OR CONST_UF_ACCOUNTDISABLE
  434. Else
  435. if ((F_objUser.UserFlags) = (F_objUser.UserFlags OR CONST_UF_ACCOUNTDISABLE)) Then
  436. flagUserFlags = F_objUser.UserFlags XOR CONST_UF_ACCOUNTDISABLE
  437. Else
  438. flagUserFlags = F_objUser.UserFlags
  439. End If
  440. End If
  441. F_objUser.Put "UserFlags", flagUserFlags
  442. End Function
  443. '-------------------------------------------------------------------------
  444. 'Function name: SetMultiSelectionProperty
  445. 'Description: Setting the properties of the selected users
  446. 'Input Variables: iItemCount
  447. 'Output Variables: None
  448. 'Returns: (True / Flase )
  449. 'Global Variables: None
  450. ' In:F_blnIschecked 'Checked or not
  451. ' In:L_ADSI_ERRORMESSAGE
  452. ' In:L_NONUNIQUEUSERNAME_ERRORMESSAGE
  453. '
  454. ' True ->If Implemented properly
  455. ' False->If Not Implemented
  456. ' Username allready exists, calls SetErrMsg with the error string
  457. ' L_NONUNIQUEUSERNAME_ERRORMESSAGE.
  458. ' If ADSI Error, calls SetErrMsg with the error string
  459. ' L_ADSI_ERRORMESSAGE.
  460. ' Const:CONST_UF_ACCOUNTDISABLE for setting disable property
  461. ' If administrator disabled Error,calls SetErrMsg with the error string
  462. ' L_ADMINDISABLED_ERRORMESSAGE
  463. '--------------------------------------------------------------------------
  464. Function SetMultiSelectionProperty(ByVal iItemCount)
  465. Err.Clear
  466. on Error resume next
  467. Dim x
  468. Dim itemKey
  469. Dim sessionItem
  470. SetMultiSelectionProperty = false
  471. GetComputerObject()
  472. For x = 1 To iItemCount
  473. If ( OTS_GetTableSelection("", x, itemKey) ) Then
  474. F_strUserName = replace(itemKey,"\'","'")
  475. Set F_objUser = F_objComputer.GetObject("User",F_strUserName)
  476. If Err.number <> 0 Then
  477. Err.Clear
  478. Call ServeFailurePage(L_ADSI_ERRORMESSAGE ,1)
  479. Exit Function
  480. End If
  481. SetDisableProperty()
  482. F_objUser.SetInfo()
  483. Set F_objUser = Nothing
  484. 'sessionItem = "Item" + CStr(x)
  485. 'Session(sessionItem) = itemKey
  486. If Err.number <> 0 Then
  487. If Err.Number = CONST_ADMINDISABLED_ERRNO then
  488. SetErrMsg L_ADMINDISABLED_ERRORMESSAGE & " " & "(" & F_strUserName & ")"
  489. Else
  490. SetErrMsg L_ADSI_ERRORMESSAGE& " " & "(" & F_strUserName & ")"
  491. End If
  492. Set F_objComputer =Nothing
  493. Exit Function
  494. End If
  495. End If
  496. Next
  497. Set F_objComputer =Nothing
  498. SetMultiSelectionProperty = true
  499. End Function
  500. '-------------------------------------------------------------------------
  501. 'Function: ServeTab1
  502. 'Description: Serves in getting the page for tab1
  503. 'Input Variables: PageIn,bIsVisible
  504. 'Output Variables: PageIn
  505. 'Returns: gc_ERR_SUCCESS
  506. 'Global Variables: L_(*)All
  507. ' F_(*) All
  508. '-------------------------------------------------------------------------
  509. Function ServeTab1(ByRef PageIn, ByVal bIsVisible, ByVal bIsMultiSelection )
  510. Dim strTableClass
  511. Dim strIfDisabled
  512. Dim strFormClass
  513. If ( bIsMultiSelection ) Then
  514. strTableClass = "TasksBodyDisabled"
  515. strIfDisabled = "disabled"
  516. strFormClass = "FormFieldDisabled"
  517. Else
  518. strTableClass = "TasksBody"
  519. strIfDisabled = ""
  520. strFormClass = "FormField"
  521. End If
  522. If ( bIsVisible ) Then%>
  523. <TABLE WIDTH=518 VALIGN=middle ALIGN=left BORDER=0 CELLSPACING=0
  524. CELLPADDING=2 class="<%=Server.HTMLEncode(strTableClass)%>">
  525. <tr>
  526. <td width=25% NOWRAP>
  527. <%=L_USERNAME_TEXT %>
  528. </td>
  529. <td NOWRAP>
  530. <input NAME="txtUserName" TYPE="text" SIZE="20" VALUE="<%=Server.HTMLEncode(F_strUserName)%>"
  531. <%=Server.HTMLEncode(strIfDisabled)%> class="<%=Server.HTMLEncode(strFormClass)%>"
  532. maxlength=20 OnKeyUp="JavaScript:makeDisable(txtUserName)">
  533. <input NAME="hdnUsername" TYPE="hidden" VALUE="<%=Server.HTMLEncode(F_strOldUserName)%>" >
  534. </td>
  535. </tr>
  536. <tr>
  537. <td width=25% NOWRAP>
  538. <%=L_FULLNAME_TEXT %>
  539. </td>
  540. <td NOWRAP>
  541. <input NAME="txtfullName" TYPE="text" SIZE="20" <%=Server.HTMLEncode(strIfDisabled)%>
  542. class="<%=Server.HTMLEncode(strFormClass)%>" VALUE="<%=Server.HTMLEncode(F_strFullName)%>">
  543. </td>
  544. </tr>
  545. <tr>
  546. <td width=25% NOWRAP>
  547. <%=L_DESCRIPTION_TEXT %>
  548. </td>
  549. <td>
  550. <input NAME="txtDescription" TYPE="text" SIZE="40" <%=Server.HTMLEncode(strIfDisabled)%>
  551. class="<%=Server.HTMLEncode(strFormClass)%>" VALUE="<%=Server.HTMLEncode(F_strDescription)%>" maxlength=300>
  552. </td>
  553. </tr>
  554. <tr>
  555. <td width=25% NOWRAP>
  556. <%=L_HOMEDIRECTORY_TEXT %>
  557. </td>
  558. <td>
  559. <input NAME="txtHomeDirectory" TYPE="text" SIZE="40" <%=Server.HTMLEncode(strIfDisabled)%>
  560. class="<%=Server.HTMLEncode(strFormClass)%>" VALUE="<%=Server.HTMLEncode(F_strHomeDirectory)%>" maxlength=300>
  561. <input NAME="hdnHomeDirectory" TYPE="hidden" VALUE="<%=Server.HTMLEncode(F_strOldHomeDirectory)%>" >
  562. </td>
  563. </tr>
  564. <tr>
  565. <td width=25% NOWRAP>
  566. </td>
  567. <td class="TasksBody">
  568. <input NAME="chkuserDisabled" class="<%=Server.HTMLEncode(F_strCheckboxClass)%>"
  569. TYPE="checkbox" <%=Server.HTMLEncode(F_strIschecked)%> value="1" onclick="checkboxClick()">
  570. <%=L_USERDISABLED_TEXT %>
  571. </td>
  572. </tr>
  573. </TABLE>
  574. <%
  575. End If
  576. ServeTab1 = gc_ERR_SUCCESS
  577. End Function
  578. '-------------------------------------------------------------------------
  579. 'Function: ServeMultiSelectionJScript
  580. 'Description: Serves in getting the page for tab1 in multiselect
  581. 'Input Variables: None
  582. 'Output Variables: None
  583. 'Returns: None
  584. 'Global Variables: L_(*)All
  585. ' F_(*) All
  586. '-------------------------------------------------------------------------
  587. Function ServeMultiSelectionJScript()
  588. %>
  589. <script language="JavaScript" src="<%=m_VirtualRoot%>inc_global.js">
  590. </script>
  591. <script language="JavaScript">
  592. function Init()
  593. {
  594. document.frmTask.chkuserDisabled.focus();
  595. document.frmTask.onkeypress = ClearErr
  596. EnableCancel();
  597. EnableOK();
  598. }
  599. function ValidatePage()
  600. {
  601. return true;
  602. }
  603. function SetData()
  604. {
  605. }
  606. // function to make the Ok button disable
  607. function makeDisable(objUsername)
  608. {
  609. }
  610. function checkboxClick()
  611. {
  612. document.frmTask.chkuserDisabled.className = "FormField";
  613. }
  614. </script>
  615. <%
  616. End Function
  617. '-------------------------------------------------------------------------
  618. 'Function: ServeCommonJavaScript
  619. 'Description: Serves in initialiging the values,setting the form
  620. ' data and validating the form values
  621. 'Input Variables: None
  622. 'Output Variables: None
  623. 'Returns: None
  624. 'Global Variables: L_PASSWORDNOTMATCH_ERRORMESSAGE
  625. '-------------------------------------------------------------------------
  626. Function ServeCommonJavaScript()
  627. %>
  628. <script language="JavaScript" src="<%=m_VirtualRoot%>inc_global.js">
  629. </script>
  630. <script language="JavaScript">
  631. // Init Function
  632. function Init()
  633. {
  634. document.frmTask.txtUserName.focus();
  635. document.frmTask.onkeypress = ClearErr
  636. EnableCancel();
  637. }
  638. // ValidatePage Function
  639. // Returns: True if the page is OK, false if error(s) exist.
  640. function ValidatePage()
  641. {
  642. var objUsername=document.frmTask.txtUserName;
  643. var strUsername=objUsername.value;
  644. //Blank Usename Validation
  645. if (Trim(strUsername)=="")
  646. {
  647. SA_DisplayErr("<%=Server.HTMLEncode(L_ENTERNAME_ERRORMESSAGE) %>");
  648. document.frmTask.onkeypress = ClearErr
  649. return false;
  650. }
  651. // Checks For Invalid Key Entry
  652. if(!isvalidchar("/[\/\*\?\"<>\|+=,;:\[\\]\\\\\]/",strUsername))
  653. {
  654. SA_DisplayErr("<% =Server.HTMLEncode(L_INVALIDCHARACTER_ERRORMESSAGE) %>");
  655. document.frmTask.txtUserName.focus()
  656. document.frmTask.onkeypress = ClearErr
  657. return false;
  658. }
  659. var objHomeDirectory = document.frmTask.txtHomeDirectory;
  660. var strHomeDirectory = Trim(objHomeDirectory.value);
  661. var bStringValid = false;
  662. //Blank HomeDirectory
  663. if( strHomeDirectory == "" )
  664. {
  665. return true;
  666. }
  667. do{
  668. if( !strHomeDirectory.match( /^[A-Za-z]:\\/ ) )
  669. break;
  670. if( strHomeDirectory.match( /\\{2,}/ ) )
  671. break;
  672. if( (strHomeDirectory.substr(2)).match( /[\/\*\?\|,;:"<>]/ ) )
  673. break;
  674. bStringValid = true;
  675. }while(false);
  676. if( !bStringValid )
  677. {
  678. SA_DisplayErr("<%=Server.HTMLEncode(L_HOMEDIRECTORY_ERRORMESSAGE) %>");
  679. objHomeDirectory.focus();
  680. document.frmTask.onkeypress = ClearErr;
  681. return false;
  682. }
  683. return true;
  684. }
  685. // function to make the Ok button disable
  686. function makeDisable(objUsername)
  687. {
  688. var strUsername=objUsername.value;
  689. if (Trim(strUsername)=="" )
  690. DisableOK();
  691. else
  692. EnableOK();
  693. }
  694. // SetData Function
  695. function SetData()
  696. {
  697. }
  698. function checkboxClick()
  699. {
  700. }
  701. </script>
  702. <%
  703. End Function
  704. %>