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.

756 lines
22 KiB

  1. <script language="javascript">
  2. //
  3. // Copyright (c) Microsoft Corporation. All rights reserved.
  4. //
  5. //function to allow only numbers
  6. function checkkeyforNumbers(obj)
  7. {
  8. if (!(window.event.keyCode >=48 && window.event.keyCode <=57))
  9. {
  10. window.event.keyCode = 0;
  11. obj.focus();
  12. }
  13. }
  14. //Function to limit maximum user allowed to 32767
  15. function checkUserLimit(obj)
  16. {
  17. var intNoofUsers=obj.value;
  18. if (intNoofUsers > 32767)
  19. {
  20. obj.value=10;
  21. obj.focus();
  22. }
  23. }
  24. //Function to add a domain user
  25. function addDomainMember(objDomainUser)
  26. {
  27. var strText,strValue
  28. var objListBox,objForm
  29. var strAccesslist
  30. var strUser
  31. var strDomain
  32. var strTemp
  33. var strAccesslist
  34. var reExp
  35. strDomain= ""
  36. strUser=""
  37. reExp =/\\/
  38. objListBox = eval("document.frmTask.lstDomainMembers")
  39. objForm= eval("document.frmTask")
  40. // Checks For Invalid charecters in username
  41. // Checks For Invalid charecters in username
  42. if(!checkKeyforValidCharacters(objDomainUser.value))
  43. {
  44. DisplayErr('<%=Server.HTMLEncode(SA_EscapeQuotes(L_DOMUSERINVALIDCHARACTER_ERRORMESSAGE))%>');
  45. document.frmTask.onkeypress = ClearErr
  46. return false;
  47. }
  48. strText =objForm.txtDomainUser.value;
  49. strValue =objForm.txtDomainUser.value;
  50. if(!checkKeyforValidCharacters(strValue))
  51. {
  52. DisplayErr('<%=Server.HTMLEncode(SA_EscapeQuotes(L_DOMUSERINVALIDCHARACTER_ERRORMESSAGE))%>');
  53. document.frmTask.onkeypress = ClearErr
  54. return false;
  55. }
  56. //Checking for the domain\user format
  57. if((strValue.match( /[^(\\| )]{1,}\\[^(\\| )]{1,}/ ) ))
  58. {
  59. if(!addToListBox(objForm.lstPermittedMembers,objForm.btnAddDomainMember,strText,strValue))
  60. {
  61. DisplayErr('<%=Server.HTMLEncode(SA_EscapeQuotes(L_DUPLICATEMEMBER_ERRORMESSAGE))%>');
  62. document.frmTask.onkeypress = ClearErr
  63. return false;
  64. }
  65. objForm.txtDomainUser.value =""
  66. objForm.btnAddDomainMember.disabled = true;
  67. if(objListBox.length != 0 )
  68. {
  69. objForm.btnRemoveMember.disabled = false;
  70. }
  71. }
  72. else
  73. {
  74. DisplayErr('<%=Server.HTMLEncode(SA_EscapeQuotes(L_INVALIDDOMAINUSER_ERRORMESSAGE))%>');
  75. document.frmTask.onkeypress = ClearErr
  76. return false;
  77. }
  78. strTemp = strValue.split("\\")
  79. strDomain = strTemp[0];
  80. strUser = strTemp[1];
  81. if(strValue.search(reExp) == -1)
  82. {
  83. if(typeof(strUser) == "undefined")
  84. {
  85. strUser =strDomain;
  86. strDomain ="";
  87. }
  88. }
  89. strAccesslist = objForm.hdnUserAccessMaskMaster.value;
  90. //Making a Accessmask list with a record for each user by , seperated and each record by '*' separation
  91. strAccesslist = strAccesslist + "*" + strDomain + "," + strUser + "," + "1179817" + "," + "0" + "," + "a";
  92. objForm.hdnUserAccessMaskMaster.value = strAccesslist;
  93. if(objForm.lstPermittedMembers.length != 0)
  94. {
  95. objForm.lstDenypermissions.disabled = false
  96. objForm.lstAllowpermissions.disabled = false
  97. }
  98. setUsermask('<%=G_strLocalmachinename%>');
  99. }
  100. //To check for Invalid Characters
  101. function checkKeyforValidCharacters(strName)
  102. {
  103. var nLength = strName.length;
  104. for(var i=0; i<nLength;i++)
  105. {
  106. charAtPos = strName.charCodeAt(i);
  107. if(charAtPos == 47 || charAtPos ==58 || charAtPos == 42 || charAtPos == 63 || charAtPos == 34 || charAtPos == 60 || charAtPos == 62 || charAtPos == 124 || charAtPos == 91 || charAtPos == 93 || charAtPos == 59 || charAtPos == 43 || charAtPos == 61 || charAtPos == 44 )
  108. {
  109. return false
  110. }
  111. }
  112. return true
  113. }
  114. // Adds the member to the listbox
  115. function addMember()
  116. {
  117. var strText
  118. var strValue
  119. var objListBox
  120. var objForm
  121. var strUser
  122. var strDomain
  123. var strTemp
  124. var strAccesslist
  125. var reExp
  126. var nIdx
  127. strDomain= ""
  128. strUser=""
  129. reExp =/\\/
  130. objForm= eval("document.frmTask")
  131. objListBox = eval("document.frmTask.lstDomainMembers")
  132. ClearErr()
  133. if(objListBox.selectedIndex == -1)
  134. {
  135. DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_SELECTMEMBER_ERRORMESSAGE))%>");
  136. document.frmTask.onkeypress = ClearErr
  137. return false
  138. }
  139. strAccesslist = objForm.hdnUserAccessMaskMaster.value;
  140. // code added for adding multiple entries into a list box
  141. for(nIdx =0 ; nIdx <objListBox.length ; nIdx++)
  142. {
  143. if(objListBox.options[nIdx].selected)
  144. {
  145. strText = objListBox.options[nIdx].text
  146. strValue = objListBox.options[nIdx].value
  147. addToListBox(objForm.lstPermittedMembers,objForm.btnRemoveMember,strText,strValue)
  148. strTemp = strValue.split("\\")
  149. strDomain = strTemp[0];
  150. strUser = strTemp[1];
  151. if(strValue.search(reExp) == -1)
  152. {
  153. if(typeof(strUser) == "undefined")
  154. {
  155. strUser =strDomain;
  156. strDomain ="";
  157. }
  158. }
  159. //Making a Accessmask list with a record for each user by , seperated and each record by '*' separation
  160. strAccesslist = strAccesslist + "*" + strDomain + "," + strUser + "," + "1179817" + "," + "0" + "," + "a";
  161. objForm.hdnUserAccessMaskMaster.value = strAccesslist;
  162. }
  163. }
  164. objListBox.selectedIndex = -1
  165. if(objForm.lstPermittedMembers.length != 0)
  166. {
  167. objForm.lstDenypermissions.disabled = false
  168. objForm.lstAllowpermissions.disabled = false
  169. }
  170. setUsermask('<%=G_strLocalmachinename%>');
  171. }
  172. //Deletes the member in the listbox
  173. function removeMember()
  174. {
  175. var objForm
  176. var strValue
  177. var strUserarray
  178. var strAccesslist
  179. var strUser
  180. var strDomain
  181. var strTemp
  182. var reExp
  183. var j
  184. var tempEachuser
  185. var tempUser
  186. var tempDomain
  187. strDomain= "";
  188. strUser="";
  189. reExp =/\\/;
  190. objForm= eval("document.frmTask");
  191. strAccesslist = objForm.hdnUserAccessMaskMaster.value;
  192. strUserarray = strAccesslist.split("*");
  193. strValue = objForm.lstPermittedMembers.options[objForm.lstPermittedMembers.selectedIndex].value
  194. removeListBoxItems(objForm.lstPermittedMembers,objForm.btnRemoveMember)
  195. strTemp = strValue.split("\\")
  196. strDomain = strTemp[0];
  197. strUser = strTemp[1];
  198. if(strValue.search(reExp) == -1)
  199. {
  200. if(typeof(strUser) == "undefined")
  201. {
  202. strUser =strDomain;
  203. strDomain ="";
  204. }
  205. }
  206. for (var j = 0; j < strUserarray.length; j++)
  207. {
  208. tempEachuser = strUserarray[j].split(",");
  209. tempUser = tempEachuser[1];
  210. tempDomain = tempEachuser[0];
  211. if((strUser == tempUser) && (strDomain == tempDomain))
  212. {
  213. reExp ="*" + strUserarray[j];
  214. strAccesslist = strAccesslist.replace(reExp,"");
  215. document.frmTask.hdnUserAccessMaskMaster.value = strAccesslist;
  216. }
  217. }
  218. if(objForm.lstPermittedMembers.length == 0)
  219. {
  220. objForm.lstDenypermissions.disabled = true
  221. objForm.lstAllowpermissions.disabled = true
  222. }
  223. setUsermask('<%=G_strLocalmachinename%>');
  224. }
  225. // Sets the user permissions( read,change,fullcontrol etc) on select of the user
  226. function setUsermask(strMachinename)
  227. {
  228. var temp;
  229. var strUser
  230. var strDomain;
  231. var reExp = /\\/;
  232. var strEachuser;
  233. var strTempeachuser;
  234. var acevalue1;
  235. var acevalue2;
  236. var acetype1;
  237. var acetype2;
  238. //Hard coding the Accessmask values
  239. var Allow = 0;
  240. var Deny = 1;
  241. var Read = 1179817;
  242. var Change = 1245462;
  243. var Fullcontrol = 2032127;
  244. var Change_read = 1245631;
  245. var strValue =document.frmTask.lstPermittedMembers.value;
  246. var strArrayuser = document.frmTask.hdnUserAccessMaskMaster.value ;
  247. strDomain= "";
  248. strUser="";
  249. strArrayuser = strArrayuser.split("*");
  250. strTemp = strValue.split("\\")
  251. strDomain = strTemp[0];
  252. strUser = strTemp[1];
  253. if(strValue.search(reExp) == -1)
  254. {
  255. if(typeof(strUser) == "undefined")
  256. {
  257. strUser =strDomain;
  258. strDomain ="";
  259. }
  260. }
  261. for(var i = strArrayuser.length-1; i >= 0; i--)
  262. {
  263. acetype1 = acetype2 = acevalue1 = acevalue2 = -1;
  264. strEachuser = strArrayuser[i].split(",");
  265. //Get the accessmask value of the user
  266. if(strUser == strEachuser[1] && strDomain == strEachuser[0])
  267. {
  268. acevalue1 = strEachuser[2];
  269. acetype1 = strEachuser[3];
  270. if(strEachuser[4] == "p")
  271. {
  272. //If two objects were found Then get the second accessmask value.
  273. for(var j = i-1; j >= 0; j--)
  274. {
  275. strTempeachuser = strArrayuser[j].split(",");
  276. if((strEachuser[0] == strTempeachuser[0]) && (strEachuser[1] == strTempeachuser[1]))
  277. {
  278. acevalue2 = strTempeachuser[2];
  279. acetype2 = strTempeachuser[3];
  280. break;
  281. }
  282. }
  283. }
  284. break;
  285. }
  286. }
  287. //To set the display according to accessmask value.
  288. //Allow Fullcontol - Deny None
  289. if((acetype1 == Allow) && (acevalue1 == Fullcontrol))
  290. {
  291. document.frmTask.lstAllowpermissions.options[0].selected =true
  292. document.frmTask.lstDenypermissions.options[4].selected =true
  293. }
  294. //Allow Fullcontol - Deny None
  295. if((acetype1 == Allow) && (acevalue1 == Fullcontrol) && (acetype2 == -1) && (acevalue2 == -1))
  296. {
  297. document.frmTask.lstAllowpermissions.options[0].selected =true
  298. document.frmTask.lstDenypermissions.options[4].selected =true
  299. }
  300. //Allow Fullcontol - Deny None
  301. if((acetype1 == 0) && (acevalue1 == 1179817) && (acetype2 == 0) && (acevalue2 ==2032127))
  302. {
  303. document.frmTask.lstAllowpermissions.options[0].selected =true
  304. document.frmTask.lstDenypermissions.options[4].selected =true
  305. }
  306. //Allow None - Deny Fullcintrol
  307. if((acetype1 == Deny) && (acevalue1 == Fullcontrol) && (acetype2 == -1) && (acevalue2 == -1))
  308. {
  309. document.frmTask.lstAllowpermissions.options[4].selected =true
  310. document.frmTask.lstDenypermissions.options[0].selected =true
  311. }
  312. //Allow Read - Deny None
  313. if(((acetype1 == Allow) && (acevalue1 == Read || acevalue1 ==1966313) && (acetype2 == -1) && (acevalue2 == -1)))
  314. {
  315. document.frmTask.lstAllowpermissions.options[2].selected =true
  316. document.frmTask.lstDenypermissions.options[4].selected =true
  317. }
  318. //Allow Read - Deny None
  319. if((acetype1 == 0) && (acevalue1 == 1179817) && (acetype2 == 1) && (acevalue2 ==786496 ))
  320. {
  321. document.frmTask.lstAllowpermissions.options[2].selected =true
  322. document.frmTask.lstDenypermissions.options[4].selected =true
  323. }
  324. //Allow Change - Deny None
  325. if((acetype1 == Allow) && (acevalue1 == Change) && (acetype2 == -1) && (acevalue2 == -1))
  326. {
  327. document.frmTask.lstAllowpermissions.options[1].selected =true
  328. document.frmTask.lstDenypermissions.options[4].selected =true
  329. }
  330. //Allow None - Deny Read
  331. if((acetype1 == Deny ) && (acevalue1 == Read ) && (acetype2 == -1) && (acevalue2 == -1))
  332. {
  333. document.frmTask.lstAllowpermissions.options[4].selected =true
  334. document.frmTask.lstDenypermissions.options[2].selected =true
  335. }
  336. //Allow None - Deny Read
  337. if((acetype1 == 0) && (acevalue1 == 786496) && (acetype2 == 1) && (acevalue2 == 1179817))
  338. {
  339. document.frmTask.lstAllowpermissions.options[4].selected =true
  340. document.frmTask.lstDenypermissions.options[2].selected =true
  341. }
  342. //Allow None - Deny Change
  343. if((acetype1 == Deny) && (acevalue1 == Change) && (acetype2 == -1) && (acevalue2 == -1))
  344. {
  345. document.frmTask.lstAllowpermissions.options[4].selected =true
  346. document.frmTask.lstDenypermissions.options[1].selected =true
  347. }
  348. //Allow Read - Deny Change
  349. if(((acetype1 == Allow) && (acevalue1 == Read || acevalue1==1966313 )) && ((acetype2 == Deny) && (acevalue2 == Change)))
  350. {
  351. document.frmTask.lstAllowpermissions.options[2].selected =true
  352. document.frmTask.lstDenypermissions.options[1].selected =true
  353. }
  354. //Allow Change - Deny Read
  355. if(((acetype1 == Allow) && (acevalue1 == Change || acevalue1==2031958)) && ((acetype2 == Deny) && (acevalue2 == Read)))
  356. {
  357. document.frmTask.lstAllowpermissions.options[1].selected =true
  358. document.frmTask.lstDenypermissions.options[2].selected =true
  359. }
  360. //Allow Change_read - Deny None
  361. if((acetype1 == Allow) && (acevalue1 == Change_read ) && (acetype2 == -1) && (acevalue2 == -1))
  362. {
  363. document.frmTask.lstAllowpermissions.options[3].selected =true
  364. document.frmTask.lstDenypermissions.options[4].selected =true
  365. }
  366. //Allow None - Deny Change_read
  367. if((acetype1 == Deny) && (acevalue1 == Change_read ) && (acetype2 == -1) && (acevalue2 == -1))
  368. {
  369. document.frmTask.lstAllowpermissions.options[4].selected =true
  370. document.frmTask.lstDenypermissions.options[3].selected =true
  371. }
  372. //Allow None - Deny Change_read
  373. if((acetype1 == 0) && (acevalue1 == 786496 ) && (acetype2 == 1) && (acevalue2 == 1245631))
  374. {
  375. document.frmTask.lstAllowpermissions.options[4].selected =true
  376. document.frmTask.lstDenypermissions.options[3].selected =true
  377. }
  378. //If both selected values are NONE
  379. if(acevalue1 == 0 ||(acetype1==0 && acevalue1==786496 && (acetype2 == -1) && (acevalue2 == -1)))
  380. {
  381. document.frmTask.lstAllowpermissions.options[4].selected =true
  382. document.frmTask.lstDenypermissions.options[4].selected =true
  383. }
  384. }
  385. //Function to set the values selected in ALLOW listbox
  386. function setAllowaccess(strMachine,objUserselected)
  387. {
  388. AlterAccessmask(strMachine,objUserselected,0);
  389. }
  390. //Function to set the values selected in DENY listbox
  391. function setDenyaccess(strMachine,objUserselected)
  392. {
  393. AlterAccessmask(strMachine,objUserselected,1);
  394. }
  395. //Function to set the accessmask in the string and to select the choice
  396. function AlterAccessmask(strMachine,objUserselected,allowType)
  397. {
  398. var temp;
  399. var reExp;
  400. var strUser;
  401. var tempUser;
  402. var strDomain;
  403. var tempDomain;
  404. var strValue;
  405. var strUserarray;
  406. var tempEachuser;
  407. var tempAcetype;
  408. var tempStatus;
  409. var tempAppend;
  410. var tempAccessmask;
  411. var removeString;
  412. var strAccesslist;
  413. var selectedAllow;
  414. var acetype1;
  415. var acetype2;
  416. var Accessmask;
  417. var Accessmask1;
  418. var Accessmask2;
  419. var flagPair = 0; //Flag to say two objects has to be created
  420. var intEnd = objUserselected.length ;
  421. var objAllow = document.frmTask.lstAllowpermissions;
  422. var objDeny = document.frmTask.lstDenypermissions;
  423. //checking for invalid combibation
  424. //In Allow type
  425. if ( allowType == 0)
  426. {
  427. selectedAllow =objAllow.value;
  428. if ((selectedAllow == 4) || (objAllow.value == objDeny.value))
  429. objDeny.options[4].selected =true;
  430. if (((objDeny.value ==2) || (objDeny.value ==3)) && (selectedAllow == 1))
  431. objDeny.options[4].selected =true;
  432. if ((selectedAllow == 1) && ( objDeny.value == 4))
  433. objDeny.options[4].selected =true;
  434. if ((selectedAllow == 2) && (( objDeny.value == 4 ||objDeny.value == 1)))
  435. {
  436. objAllow.options[2].selected =true;
  437. objDeny.options[1].selected =true;
  438. flagPair =1;
  439. }
  440. if ((selectedAllow == 3) && ( objDeny.value == 1 || objDeny.value == 4))
  441. {
  442. objAllow.options[1].selected =true;
  443. objDeny.options[2].selected =true;
  444. flagPair =1;
  445. }
  446. if ((selectedAllow == 3) && ( objDeny.value == 4))
  447. {
  448. objAllow.options[1].selected =true;
  449. objDeny.options[2].selected =true;
  450. flagPair =1;
  451. }
  452. }
  453. //In Deny type
  454. else
  455. {
  456. selectedAllow = objDeny.value;
  457. if ((selectedAllow == 4) || (objAllow.value == objDeny.value))
  458. objAllow.options[4].selected =true;
  459. if (((objAllow.value ==2) || (objAllow.value ==3)) && (selectedAllow == 1))
  460. objAllow.options[4].selected =true;
  461. if ((selectedAllow == 1) && ( objAllow.value == 4))
  462. objAllow.options[4].selected =true;
  463. if ((selectedAllow == 2) && ( objAllow.value == 4 || objAllow.value == 1))
  464. {
  465. objAllow.options[1].selected =true;
  466. objDeny.options[2].selected =true;
  467. flagPair =1;
  468. }
  469. if ((selectedAllow == 3) && ( objAllow.value == 1 || objAllow.value == 4 ))
  470. {
  471. objAllow.options[2].selected =true;
  472. objDeny.options[1].selected =true;
  473. flagPair =1;
  474. }
  475. if ((selectedAllow == 3) && ( objAllow.value == 4))
  476. {
  477. objAllow.options[2].selected =true;
  478. objDeny.options[1].selected =true;
  479. flagPair =1;
  480. }
  481. } //End If For (allowType == 0)
  482. if (((objAllow.value == 2) && (objDeny.value ==3)) || ((objAllow.value == 3) && (objDeny.value ==2)))
  483. {
  484. flagPair = 1;
  485. if(objAllow.value ==2)
  486. {
  487. //allow READ deny CHANGE
  488. Accessmask1= "1245462";
  489. acetype1 ="1";
  490. Accessmask2= "1179817";
  491. acetype2 ="0";
  492. }
  493. if(objAllow.value==3)
  494. {
  495. //allow CHANGE deny READ
  496. Accessmask1= "1179817";
  497. acetype1 ="1";
  498. Accessmask2= "1245462";
  499. acetype2 ="0";
  500. }
  501. }
  502. //if anyone of the option is "none"
  503. if(selectedAllow == 0)
  504. {
  505. if(allowType ==0)
  506. {
  507. selectedAllow =objDeny.value;
  508. allowType=1;
  509. }
  510. else
  511. {
  512. selectedAllow =objAllow.value;
  513. allowType=0;
  514. }
  515. }
  516. //Assign the Accessmask according to the selected type
  517. switch(selectedAllow)
  518. {
  519. case "4":
  520. Accessmask = "2032127"
  521. break;
  522. case "3" :
  523. Accessmask = "1245462"
  524. break;
  525. case "2" :
  526. Accessmask = "1179817"
  527. break;
  528. case "1" :
  529. Accessmask = "1245631"
  530. break;
  531. default :
  532. Accessmask ="0"
  533. break;
  534. }
  535. //If both the options selected are none
  536. if ((objAllow.value==0) && (objDeny.value==0))
  537. Accessmask ="0";
  538. //Get the name of the selected user
  539. for ( var i=0; i < intEnd; i++)
  540. {
  541. if ( objUserselected.options[i].selected )
  542. {
  543. strValue =objUserselected.options[i].value;
  544. reExp = /\\/;
  545. strAccesslist =document.frmTask.hdnUserAccessMaskMaster.value;
  546. //Split the Accessmask List By '*'
  547. strUserarray = strAccesslist.split("*");
  548. //Split the selected Option value
  549. strTemp = strValue.split("\\")
  550. strDomain = strTemp[0];
  551. strUser = strTemp[1];
  552. if(strValue.search(reExp) == -1)
  553. {
  554. if(typeof(strUser) == "undefined")
  555. {
  556. strUser =strDomain;
  557. strDomain ="";
  558. }
  559. }
  560. //Traverse the Accessmask list
  561. for (var j = strUserarray.length-1;j >= 1; j--)
  562. {
  563. tempEachuser =strUserarray[j].split(",");
  564. tempUser =tempEachuser[1];
  565. tempDomain =tempEachuser[0];
  566. tempAccessmask =tempEachuser[2];
  567. tempAcetype =tempEachuser[3];
  568. tempStatus =tempEachuser[4];
  569. if((strUser == tempUser) && (strDomain == tempDomain))
  570. {
  571. //Remove the User string in the main string
  572. removeString = "*" + strUserarray[j];
  573. reExp ="*" + strUserarray[j];
  574. strAccesslist = strAccesslist.replace(reExp,"");
  575. //If two objects were found delete the second user Record
  576. if (tempStatus == "p")
  577. continue;
  578. if(flagPair != 1)
  579. strAccesslist = strAccesslist + "*" + strDomain + "," + strUser + "," + Accessmask+ "," + allowType + "," + "a";
  580. }
  581. }
  582. //Concat to the main AccessList ,two records for the User with 'a-alone' and 'p-paired'
  583. if( flagPair == 1)
  584. {
  585. strAccesslist = strAccesslist + "*" + strDomain + "," + strUser + "," + Accessmask1+ "," + acetype1 + "," + "a";
  586. strAccesslist = strAccesslist + "*" + strDomain + "," + strUser + "," + Accessmask2+ "," + acetype2 + "," + "p";
  587. }
  588. document.frmTask.hdnUserAccessMaskMaster.value =strAccesslist;
  589. break;
  590. }
  591. }
  592. }
  593. //function to store the share caching property
  594. function storeCacheProp()
  595. {
  596. var objForm
  597. var intCacheValue
  598. objForm= eval("document.frmTask")
  599. intCacheValue = objForm.lstCacheOptions.value
  600. objForm.hdnCacheValue.value = intCacheValue;
  601. }
  602. //function to enable/diable cache listbox
  603. function EnableorDisableCacheProp(objCheckbox)
  604. {
  605. var objForm
  606. objForm= eval("document.frmTask")
  607. if (objCheckbox.checked)
  608. {
  609. objForm.lstCacheOptions.disabled =false;
  610. objForm.hdnCacheValue.value = "0"
  611. }
  612. else
  613. {
  614. objForm.lstCacheOptions.disabled =true;
  615. }
  616. }
  617. //function ables or disables the uservalue textbox based on the radio button selection
  618. function allowUserValueEdit(objRadio)
  619. {
  620. if(objRadio.value == "y" )
  621. document.frmTask.txtAllowUserValue.disabled = true;
  622. else
  623. {
  624. document.frmTask.txtAllowUserValue.disabled = false;
  625. document.frmTask.txtAllowUserValue.focus();
  626. }
  627. }
  628. //To check for Invalid Characters
  629. function checkKeyforValidCharacters(strName)
  630. {
  631. var nLength = strName.length;
  632. for(var i=0; i<nLength;i++)
  633. {
  634. charAtPos = strName.charCodeAt(i);
  635. if(charAtPos == 47 || charAtPos ==58 || charAtPos == 42 || charAtPos == 63 || charAtPos == 34 || charAtPos == 60 || charAtPos == 62 || charAtPos == 124 || charAtPos == 91 || charAtPos == 93 || charAtPos == 59 || charAtPos == 43 || charAtPos == 61 || charAtPos == 44 )
  636. {
  637. return false
  638. }
  639. }
  640. return true
  641. }
  642. //To check for Invalid Characters
  643. function checkKeyforValidCharacters(strName)
  644. {
  645. var nLength = strName.length;
  646. for(var i=0; i<nLength;i++)
  647. {
  648. charAtPos = strName.charCodeAt(i);
  649. if(charAtPos == 47 || charAtPos ==58 || charAtPos == 42 || charAtPos == 63 || charAtPos == 34 || charAtPos == 60 || charAtPos == 62 || charAtPos == 124 || charAtPos == 91 || charAtPos == 93 || charAtPos == 59 || charAtPos == 43 || charAtPos == 61 || charAtPos == 44 )
  650. {
  651. return false
  652. }
  653. }
  654. return true
  655. }
  656. </script>