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.

305 lines
9.7 KiB

  1. function RemoveClause( TableName, ClauseToRemove )
  2. {
  3. var I; //standard loop counter
  4. eval( "document.all." + TableName + ClauseToRemove+".style.display='none'" ) ;
  5. eval( "document.all." + TableName + "sField"+ClauseToRemove+".selectedIndex=0" ) ;
  6. eval( "document.all." + TableName + "tbSearchValue"+ClauseToRemove+".value=''" ) ;
  7. ClearCompareField( TableName, ClauseToRemove );
  8. }
  9. function AddClause( TableName )
  10. {
  11. for ( var i=1 ; i< 9 ; i++ )
  12. {
  13. if ( eval( "document.all." + TableName + i+".style.display") == 'none' )
  14. {
  15. eval( "document.all." + TableName + i+".style.display='block'" ) ;
  16. return;
  17. }
  18. }
  19. }
  20. function ClearCompareField( TableName, iFieldNumber )
  21. {
  22. var lenCompareOptions = new Number( eval("document.all." + TableName + "sCompare"+iFieldNumber+".options.length" ) )
  23. //alert ( lenCompareOptions )
  24. for ( var i=0 ; i <= lenCompareOptions ; i++ )
  25. {
  26. eval("document.all." + TableName + "sCompare"+iFieldNumber+".options.remove(0)");
  27. eval("document.all." + TableName +"tbSearchValue"+iFieldNumber+".style.visibility='hidden'");
  28. }
  29. }
  30. function FillInCompareField( TableName, iFieldNumber, fieldname )
  31. {
  32. var field //the field we are workikng on
  33. //make sure the comparison field has nothing in it
  34. if ( eval("document.all." + TableName + "sCompare"+iFieldNumber+".length == 0" ) )
  35. {
  36. for ( field in CompareOperators )
  37. {
  38. var Element=document.createElement("OPTION");
  39. Element.text=CompareOperators[field].Text;
  40. Element.value=CompareOperators[field].Sign ;
  41. eval("document.all." + TableName + "sCompare"+iFieldNumber+".add( Element )" );
  42. eval("document.all." + TableName + "tbSearchValue"+iFieldNumber+".style.visibility='visible'");
  43. }
  44. }
  45. ClearValueTB ( TableName, iFieldNumber )
  46. }
  47. function ValidateCompare ( TableName, cIndex, CompareValue )
  48. {
  49. if ( CompareValue == "IS NOT NULL" | CompareValue == "IS NULL" )
  50. {
  51. eval("document.all." + TableName + "tbSearchValue"+cIndex+".style.visibility='hidden'");
  52. eval("document.all." + TableName + "tbSearchValue"+cIndex+".value=''");
  53. }
  54. else
  55. {
  56. eval("document.all." + TableName + "tbSearchValue"+cIndex+".style.visibility='visible'");
  57. eval("document.all." + TableName + "tbSearchValue"+cIndex+".value=''");
  58. }
  59. }
  60. function ClearValueTB ( TableName, cIndex )
  61. {
  62. eval("document.all." + TableName + "tbSearchValue" + cIndex + ".value=\"\"" )
  63. }
  64. function ShowAdvQuery ()
  65. {
  66. document.all.divAdvancedQuery.style.display='block'
  67. document.all.divTheQuery.style.display='none'
  68. }
  69. function VerifySaveQuery()
  70. {
  71. if( document.all.tbDescription.value == "" )
  72. alert("You must enter a description in order to save this query! " )
  73. else
  74. {
  75. document.all.SaveQuery.value="1"
  76. document.all.submit()
  77. }
  78. }
  79. function VerifySearchData ( TableName, svValue, field )
  80. {
  81. var fieldVal = eval( "document.all." + TableName + "sField" + field + ".selectedIndex" )
  82. var fieldType = new String( eval( TableName + "Fields[" + fieldVal + "].ValType" ) )
  83. var fieldName = new String( eval( TableName + "Fields[" + fieldVal + "].Text" ) )
  84. if ( fieldType == "Number" )
  85. {
  86. if ( isNaN( svValue ) )
  87. {
  88. alert("This field requires a number as input: " + fieldName )
  89. return false
  90. }
  91. }
  92. return true
  93. }
  94. function VerifyCorrectDataTypes()
  95. {
  96. for ( var i=1 ; i < 9 ; i++ )
  97. {
  98. var field = eval( "document.all.sField" + i + ".value" )
  99. alert( field )
  100. }
  101. }
  102. function SaveQuery( TableName, Page, Params )
  103. {
  104. var Description = eval( "document.all." + TableName + "SaveDescription.value" )
  105. var Param1 = eval( "document.all." + TableName + "Top.value" )
  106. var Param2 = encodeURIComponent(BuildWhereClause( TableName ) )
  107. var Param3 = eval( "document.all." + TableName + "OrderBy.value")
  108. var Param4 = eval("document.all." + TableName + "SortDirection.value")
  109. if ( String(Params) == "undefined" || String(Params) == "" )
  110. Params=""
  111. else
  112. Params += "&"
  113. //alert ( Page + "?" + Params + "SP=CUSTOM&Param1=" + Param1 + "&Param2=" + Param2 + "&Param3=" + Param3 + "&Param4=" + Param4)
  114. var FinalParam= Page + "?" + Params + "SP=CUSTOM&Param1=" + Param1 + "&Param2=" + Param2 + "&Param3=" + Param3 + "&Param4=" + Param4
  115. var URL = "Global_GetRS.asp?SP=DBGPortal_SaveCustomQuery&DBConn=CRASHDB3&Param0=<%=GetShortUserAlias()%>&Param1=" + Description + "&Param2=" + escape( FinalParam )
  116. //alert( URL )
  117. rdsSaveQuery.URL = URL
  118. rdsSaveQuery.Refresh()
  119. //try and update the left nav
  120. alert("Your query has been saved! You can run your saved query from the left nav under the heading 'Custom Queries'." )
  121. }
  122. function RefreshLeftNav()
  123. {
  124. try
  125. {
  126. window.parent.parent.frames("SepLeftNav").window.location.reload()
  127. }
  128. catch( err )
  129. {
  130. alert("Could not update the left nav bar. Please refresh your left nav by right clicking anywhere within the left nav and clicking refresh.")
  131. }
  132. }
  133. function ExecuteQuery( TableName, NewWindow, Page, Params )
  134. {
  135. var Param1 = eval( "document.all." + TableName + "Top.value" )
  136. var Param2 = encodeURIComponent(BuildWhereClause( TableName ) )
  137. var Param3 = eval( "document.all." + TableName + "OrderBy.value")
  138. var Param4 = eval("document.all." + TableName + "SortDirection.value")
  139. if ( String(Params) == "undefined" || String(Params) == "" )
  140. Params=""
  141. else
  142. Params += "&"
  143. if ( NewWindow )
  144. window.open( Page + "?" + Params + "SP=CUSTOM&Param1=" + Param1 + "&Param2=" + Param2 + "&Param3=" + Param3 + "&Param4=" + Param4)
  145. else
  146. window.navigate( Page + "?" + Params + "SP=CUSTOM&Param1=" + Param1 + "&Param2=" + Param2 + "&Param3=" + Param3 + "&Param4=" + Param4)
  147. }
  148. function CreateCrashQuery( TableName, NewWindow )
  149. {
  150. //var QueryEnd=new String()
  151. //var Query = new String()
  152. //var WhereClause = new String()
  153. //var Param1 = eval( "document.all." + TableName + "Top.value" )
  154. //var Param3 = eval( "document.all." + TableName + "OrderBy.value")
  155. //var Param4 = eval("document.all." + TableName + "SortDirection.value")
  156. //Query = "SELECT TOP " + eval( "document.all." + TableName + "Top.value")
  157. //Query += " Path, BuildNo, EntryDate, IncidentID, Email, Description, Comments, Repro, TrackID, iBucket from dbgportal_crashdata "
  158. //QueryEnd = " order by " + eval( "document.all." + TableName + "OrderBy.value") + " " + eval("document.all." + TableName + "SortDirection.value")
  159. //var WhereClause = BuildWhereClause( TableName )
  160. //var Query = encodeURIComponent( Query + " " + WhereClause + QueryEnd )
  161. //if ( NewWindow )
  162. //window.open( "DBGPortal_DisplayCrashQuery.asp?SP=CUSTOM&Param1=" + eval( "document.all." + TableName + "Top.value") + "&Param2=" + WhereClause + "&Param3=" + Param3 + "&Param4=" + Param4)
  163. //else
  164. //window.navigate( "DBGPortal_DisplayCrashQuery.asp?SP=CUSTOM&Param1=" + eval( "document.all." + TableName + "Top.value" ) + "&Param2=" + WhereClause + "&Param3=" + Param3 + "&Param4=" + Param4)
  165. }
  166. function CreateAdvancedQuery( TableName, NewWindow )
  167. {
  168. //eval( "document.all." + TableName + "Top.value" )
  169. /*var Query = "SELECT TOP " + eval( "document.all." + TableName + "Top.value") + " BTI.iBucket, BTI.BucketID, FollowUP, [Crash Count], BugID, SolutionID FROM "
  170. Query += "(SELECT TOP 100 PERCENT sBucket, Count(sBucket) as [Crash Count] FROM CrashInstances "
  171. Query += "GROUP BY sBucket "
  172. Query += "ORDER BY [Crash Count] DESC) as one "
  173. Query += "INNER JOIN BucketToInt as BTI on sBucket=BTI.iBucket "
  174. Query += "LEFT JOIN FollowUPIds as F on BTI.iFollowUP = F.iFollowUP "
  175. Query += "LEFT JOIN Solutions.dbo.Solvedbuckets as SOL on BTI.BucketId = SOL.strBucket "
  176. Query += "LEFT JOIN RaidBugs as R on BTI.iBucket = R.iBucket "
  177. */
  178. //var Query = "SELECT TOP " + eval( "document.all." + TableName + "Top.value") + " iBucket, BucketID, FollowUP, CrashCount, BugID, SolutionID FROM "
  179. //Query += "DBGPortal_BucketData "
  180. //var QueryEnd = " order by " + eval( "document.all." + TableName + "OrderBy.value") + " " + eval("document.all." + TableName + "SortDirection.value" )
  181. //var WhereClause = BuildWhereClause( TableName )
  182. ///var Query = encodeURIComponent( Query + " " + WhereClause + QueryEnd )
  183. //if ( NewWindow )
  184. //window.open( "DBGPortal_DisplayQuery.asp?SP=CUSTOM&CustomQuery=" + Query + "&Platform=&QueryType=&Param1=" + Top + "&Param2=" + WhereClause )
  185. //else
  186. //window.navigate( "DBGPortal_DisplayQuery.asp?SP=CUSTOM&CustomQuery=" + Query + "&Platform=&QueryType=&Param1=" + eval( "document.all." + TableName + "Top.value" ) + "&Param2=" + WhereClause )
  187. }
  188. function BuildWhereClause( TableName )
  189. {
  190. var WhereClause = ""
  191. for ( var i=1 ; i < 9 ; i++ )
  192. {
  193. var conjuction = eval ("document.all." + TableName + "sConjunction" + i + ".value" )
  194. var field = eval( "document.all." + TableName + "sField" + i + ".value" )
  195. var UserValue = eval("document.all." + TableName + "tbSearchValue" + i + ".value" )
  196. if ( eval( "document.all." + TableName + "sCompare" + i + ".value" ) == "CONTAINS" )
  197. {
  198. var op = "LIKE '%" + UserValue + "%'"
  199. UserValue = ""
  200. }
  201. else if ( eval( "document.all." + TableName + "sCompare" + i + ".value" ) == "DNCONTAINS" )
  202. {
  203. var op = "NOT LIKE '%" + UserValue + "%'"
  204. UserValue = ""
  205. }
  206. else
  207. {
  208. var op = eval( "document.all." + TableName + "sCompare" + i + ".value" )
  209. }
  210. if ( UserValue != "" )
  211. {
  212. if( !VerifySearchData( TableName, UserValue, i ) )
  213. return false
  214. UserValue = "'" + UserValue + "'"
  215. }
  216. if ( field != "" )
  217. {
  218. if ( WhereClause != "" )
  219. WhereClause += conjuction + " " + field + " " + op + " " + UserValue + " "
  220. else
  221. WhereClause = "WHERE " + field + " " + op + " " + UserValue + " "
  222. }
  223. }
  224. return WhereClause
  225. }