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.

169 lines
4.3 KiB

  1. <meta http-equiv="Content-Type" content="text/html; charset=<%=GetCharSet()%>">
  2. <script language="javascript">
  3. //
  4. // Copyright (c) Microsoft Corporation. All rights reserved.
  5. //
  6. function fnSetselectedindex(objHdnVar,objListBox)
  7. {
  8. objHdnVar.value =objListBox.selectedIndex;
  9. }
  10. function IsExistsInMappings(strMappings, objListbox)
  11. {
  12. var intIdx,arrTemp;
  13. for(intIdx = 0; intIdx < objListbox.length; intIdx++)
  14. {
  15. if(objListbox.options[intIdx].value !="")
  16. {
  17. arrTemp = objListbox.options[intIdx].value.split(":");
  18. if(arrTemp[1].toUpperCase() == strMappings.toUpperCase())
  19. {
  20. return intIdx;
  21. }
  22. }
  23. }
  24. return -1;
  25. }
  26. function fnbRemove(objListBox,btnRemove,btnPrimary)
  27. {
  28. // Clear any error present
  29. ClearErr();
  30. if(objListBox.value != "")
  31. {
  32. removeListBoxItems(objListBox, btnRemove);
  33. }
  34. // set the status of other fields accordingly,
  35. // if the header is only remaining in the list box
  36. if(objListBox.length == 1)
  37. {
  38. btnRemove.disabled = true;
  39. btnPrimary.disabled = true;
  40. objListBox.selectedIndex = -1;
  41. }
  42. }
  43. function fnbAdd(lstBox,strText,strName,strValue)
  44. {
  45. var listVal;
  46. var Obj;
  47. var intIdx;
  48. listVal= strText;
  49. if (Trim(listVal) =="" )
  50. {
  51. DisplayErr("<%=Server.HTMLEncode(L_INVALIDENTRY_ERRORMESSAGE)%>");
  52. document.frmTask.onkeypress = ClearErr;
  53. document.frmTask.onmousedown = ClearErr ;
  54. return false;
  55. }
  56. if (isDuplicate(strValue,lstBox))
  57. {
  58. DisplayErr("<%=Server.HTMLEncode(L_DUPLICATEENTRY_ERRORMESSAGE)%>");
  59. document.frmTask.onkeypress = ClearErr;
  60. document.frmTask.onmousedown = ClearErr;
  61. return false;
  62. }
  63. lstBox.options[lstBox.length] = new Option(listVal,strValue,false,false);
  64. intIdx =0;
  65. lstBox.options[lstBox.length -1].selected = true;
  66. while (intIdx < lstBox.length -1)
  67. {
  68. lstBox.options[intIdx].selected = false;
  69. intIdx++;
  70. }
  71. Obj = eval("document.frmTask.btnRemove"+strName);
  72. Obj.disabled = false;
  73. return true;
  74. }
  75. function ClearErr()
  76. {
  77. if (IsIE())
  78. document.all("divErrMsg").innerHTML = "";
  79. document.frmTask.onkeypress = null;
  80. document.frmTask.onmousedown = null;
  81. }
  82. function isDuplicate(strValue,lstBox)
  83. {
  84. var intIndex;
  85. for(intIndex =0; intIndex < lstBox.length ; intIndex++)
  86. {
  87. if (strValue.toUpperCase() == (lstBox.options[intIndex].text).
  88. toUpperCase())
  89. return true;
  90. }
  91. return false;
  92. }
  93. function changeValue(lstBox,strValue,strNewValue)
  94. {
  95. var intIndex;
  96. for(intIndex =0; intIndex < lstBox.length ; intIndex++)
  97. {
  98. if (strValue.toUpperCase() ==
  99. (lstBox.options[intIndex].text).toUpperCase())
  100. lstBox.options[intIndex].text = strNewValue;
  101. }
  102. }
  103. function addSpaces(intNumber)
  104. {
  105. var str,intIdx;
  106. str ="";
  107. for (intIdx = 0 ; intIdx < intNumber;intIdx++)
  108. {
  109. str = str + " ";
  110. }
  111. return str;
  112. }
  113. function addMinimumColumnGap(inputString, STR_CONTD, toWidth)
  114. {
  115. var INT_MIN_COL_GAP = STR_CONTD.length + 1;
  116. var STR_SPACE = " ";
  117. var MIN_COL_GAP = "";
  118. if(inputString.length >= toWidth)
  119. {
  120. MIN_COL_GAP = STR_SPACE;
  121. }
  122. else
  123. {
  124. for(i=0;i < INT_MIN_COL_GAP;i++)
  125. {
  126. MIN_COL_GAP += STR_SPACE;
  127. }
  128. }
  129. return MIN_COL_GAP;
  130. }
  131. function packString(inputString, STR_CONTD, toWidth, blnPadAfterText)
  132. {
  133. var returnString = inputString;
  134. var STR_SPACE = " ";
  135. var intPaddingLength = 0;
  136. var strGapAfterColumn = "";
  137. if(blnPadAfterText == true)
  138. {
  139. strGapAfterColumn = addMinimumColumnGap(inputString,
  140. STR_CONTD, toWidth);
  141. }
  142. if(inputString.length < toWidth)
  143. {
  144. intPaddingLength = parseInt((toWidth-inputString.length));
  145. for(i=0;i < intPaddingLength;i++)
  146. {
  147. returnString += STR_SPACE ;
  148. }
  149. }
  150. else
  151. {
  152. returnString = returnString.substr(0,toWidth);
  153. returnString += STR_CONTD;
  154. }
  155. returnString+= strGapAfterColumn;
  156. return returnString;
  157. }
  158. </script>