Source code of Windows XP (NT5)
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.

512 lines
16 KiB

  1. <% option explicit
  2. Response.Buffer = TRUE
  3. Dim AuthUser,pos,FileSys,InStream,BugID,Conn,Comm,RS
  4. Dim FldArray,i,FldLinks,dTitle,Desc,fCreate,st,wi,c,fSt
  5. Dim mx,mxc,fn,fname,ColTot,ibase,inext,ff,fbase,coln,colh,ColNb
  6. Response.Expires = 0
  7. rem get user name
  8. AuthUser = Request.ServerVariables("AUTH_USER")
  9. pos=instr(1,AuthUser,"\")
  10. if pos>0 then
  11. AuthUser = mid(AuthUser,pos+1)
  12. end if
  13. %>
  14. <!--#include virtual="/scripts/raid/cache.asp"-->
  15. <!--#include virtual="/aspsamp/samples/adovbs.inc"-->
  16. <!--
  17. display detailed view of bug
  18. QueryString : bugid=bug# | CREATE for new bug
  19. -->
  20. <html>
  21. <head>
  22. <style type="text/css">
  23. .act {color:menutext; background:menu; cursor:default}
  24. #bug {font-size:8pt}
  25. .vis {}
  26. .unvis {display:none}
  27. .inp {font-size:8pt; height:18; width:70; color:black; background:menu}
  28. .inpenab {font-size:8pt; height:18; width:70;}
  29. .titl {background:menu}
  30. .titlenab {}
  31. .bact {height:23; width:24}
  32. </style>
  33. <script language="JavaScript">
  34. //
  35. // Globals
  36. //
  37. var AuthUser = "<%=AuthUser%>";
  38. var updAct = "";
  39. var updDate = "";
  40. var updState = "";
  41. //
  42. // CurrentDate()
  43. //
  44. // returns current date as string using format MM/DD/YY if year < 2000 otherwise MM/DD/YYYY
  45. //
  46. function CurrentDate() {
  47. var now = new Date();
  48. m = new String(now.getMonth()+1);
  49. if ( m.length == 1 )
  50. m = "0"+ m;
  51. d = new String(now.getDate());
  52. if ( d.length == 1 )
  53. d = "0"+ d;
  54. v = now.getYear();
  55. if ( v < 100 )
  56. y = new String(v);
  57. else
  58. y = new String( v + 1900 );
  59. return m + "/" + d + "/" + y;
  60. }
  61. //
  62. // ckdigit()
  63. //
  64. // returns true if event.keyCode is digit, otherwise false
  65. //
  66. function ckdigit() {
  67. if ( event.keyCode<48 || event.keyCode>57 ) {
  68. return false;
  69. }
  70. return true;
  71. }
  72. //
  73. // ckdotdigit()
  74. //
  75. // returns true if event.keyCode is digit or '.', otherwise false
  76. //
  77. function ckdotdigit() {
  78. if ( (event.keyCode<48 || event.keyCode>57) && event.keyCode!=46 ) {
  79. return false;
  80. }
  81. return true;
  82. }
  83. //
  84. // bsetf()
  85. //
  86. // Update Status, AssignedTo & date & by fields associated to selected operation
  87. //
  88. // returns nothing
  89. //
  90. function bsetf(aState,aVerb,aDate,aBy,aTo) {
  91. bug.Status.value = aState;
  92. bug.Status.disabled = false;
  93. bug.item(aDate).disabled = false;
  94. bug.item(aDate).className = "inpenab";
  95. bug.item(aDate).value = CurrentDate();
  96. bug.item(aBy).disabled = false;
  97. bug.item(aBy).className = "inpenab";
  98. bug.item(aBy).value = AuthUser;
  99. bug.AssignedTo.disabled = false;
  100. bug.AssignedTo.className = "inpenab";
  101. bug.AssignedTo.value = aTo;
  102. updState = aState;
  103. updAct = aBy;
  104. updDate = aDate;
  105. updVerb = aVerb;
  106. }
  107. //
  108. // bchange()
  109. //
  110. // Enabled specified fields, update Changedxxx fields
  111. //
  112. // returns nothing
  113. //
  114. function bchange( flist ) {
  115. for ( i = 0 ; i < bug.length ; ++i )
  116. if ( flist == "" || flist.indexOf(","+bug.elements[i].id+",") != -1 ) {
  117. bug.elements[i].disabled = false;
  118. bug.elements[i].className = "inpenab";
  119. for ( j = 0 ; j < checkfields.length ; ++j ) {
  120. //
  121. // if field is checked ( i.e. has an associated list of allowed values )
  122. // then we have to generate an <option> element and select the current value
  123. //
  124. if ( checkfields[j] == bug.elements[i].id ) {
  125. s = "<select class=\"inpenab\" name=\"" + checkfields[j] + "\" id=\"" + checkfields[j] + "\">";
  126. for ( k = 0 ; k < checks[j].length ; ++k ) {
  127. s = s + "<option value=\"" + checks[j][k] + "\""
  128. if ( bug.elements[i].value == checks[j][k] )
  129. s = s + " SELECTED";
  130. s = s + ">" + checks[j][k];
  131. }
  132. s = s + "</select>";
  133. bug.elements[i].parentElement.innerHTML = s;
  134. break;
  135. }
  136. }
  137. }
  138. bug.upd.disabled = false;
  139. bug.ChangedDate.value = CurrentDate();
  140. bug.ChangedBy.value = AuthUser;
  141. bug.ChangedBy.disabled = false;
  142. bug.desc.className = "vis";
  143. }
  144. //
  145. // bresolve()
  146. //
  147. // handle resolve bug action
  148. //
  149. // returns nothing
  150. //
  151. function bresolve() {
  152. bchange(",ResolvedDate,ResolvedBy,Resolution,FixedRev,Cause,CodeChange,");
  153. bsetf( "Resolved", "Resolved", "ResolvedDate", "ResolvedBy", bug.OpenedBy.value );
  154. }
  155. //
  156. // bactivate()
  157. //
  158. // handle activate bug action
  159. //
  160. // returns nothing
  161. //
  162. function bactivate() {
  163. bchange(",AssignedTo,IssueType,Severity,Priority,Accessibility,ChangedBy,OpenedBy,Source,SourceID,BetaID,HowFound,Lang,LangSup,Component,SubComp,Owner,Processor,NumCPU,Software,Urgency,Regression,ShowStop,SubStatus,CustPri,TrackingNumber,VendorNm,CCList,IsPerf,");
  164. bsetf( "Active", "Activated", "ChangedDate", "ChangedBy", AuthUser );
  165. bug.Status.value = "Active";
  166. bug.Title.disabled = false;
  167. bug.Title.className = "titlenab";
  168. }
  169. //
  170. // bclose()
  171. //
  172. // handle close bug action
  173. //
  174. // returns nothing
  175. //
  176. function bclose() {
  177. bchange(",Accessibility,BetaID,ClosedDate,ClosedBy,KBArticle,SR,Component,SubComp,Owner,Processor,NumCPU,Software,Urgency,Regression,SubStatus,CustPri,TrackingNumber,VendorNM,CCList,IsPerf,Class");
  178. bsetf( "Closed", "Closed", "ClosedDate", "ClosedBy", "Closed");
  179. bug.AssignedTo.onkeypress = new Function("return false;");
  180. }
  181. //
  182. // bassign()
  183. //
  184. // handle assign to bug action
  185. //
  186. // returns nothing
  187. //
  188. function bassign() {
  189. bchange(",AssignedTo,");
  190. updState = "Assigned";
  191. updAct = AuthUser;
  192. updDate = CurrentDate();
  193. updVerb = "Assigned";
  194. }
  195. //
  196. // doupd()
  197. //
  198. // update bug in database
  199. //
  200. // returns nothing
  201. //
  202. function doupd()
  203. {
  204. //
  205. // check for mandatory fields
  206. //
  207. for ( i = 0 ; i < bug.length ; ++i )
  208. if ( bug.elements[i].disabled == false &&
  209. bug.elements[i].value == "" &&
  210. FldForced.indexOf(","+bug.elements[i].id+",") != -1 )
  211. {
  212. alert( "The " + bug.elements[i].id + " field is mandatoy" );
  213. return;
  214. }
  215. //
  216. // update description
  217. // the addition to this field is sent to server in the 'desc' field. The server
  218. // will concatenate the content of existing description with this field to update
  219. // the description field.
  220. //
  221. s = "===== " + updVerb + " by " + bug.item(updAct).value + " on " + bug.item(updDate).value + " ; AssignedTo = " + bug.AssignedTo.value
  222. if ( updState == "Opened" )
  223. s = s + "; Priority = " + bug.Priority.value;
  224. s = s + " =====\r\n";
  225. bug.desc.value = s + bug.desc.value;
  226. document.all.bug.submit();
  227. }
  228. //
  229. // dolink()
  230. //
  231. // display linked info : attachments, files in a new window
  232. //
  233. // returns nothing
  234. //
  235. function dolink( linktype ) {
  236. window.open( "link.asp?BugID=" + bug.bugid.value + "&Type=" + linktype );
  237. }
  238. </script>
  239. <%
  240. rem add content of cached file for possible values of checked fields
  241. IncludeItemCache
  242. if Request.QueryString("BugID") = "" then
  243. BugID = Session("BugID")
  244. else
  245. BugID = Request.QueryString("BugID")
  246. end if
  247. Response.Write "<title>[Bug " & BugID & " - Windows NT Bugs]</title></head>"
  248. Set Conn = Server.CreateObject("ADODB.Connection")
  249. Set Comm = Server.CreateObject("ADODB.Command")
  250. Set RS = Server.CreateObject("ADODB.Recordset")
  251. Conn.Open Session("DSN")
  252. Set Comm.ActiveConnection = Conn
  253. RS.CursorType = adOpenStatic
  254. Set RS.Source = Comm
  255. FldArray = Application("fld" & Application("dbCache")(Session("DBSOURCE")))
  256. Dim fdict
  257. Set fdict = CreateObject("Scripting.Dictionary")
  258. rem generates list of mandatory fields
  259. Response.Write "<script language=" & chr(34) & "JavaScript" & chr(34) & "> var FldForced = " & chr(34)
  260. mx = UBound(FldArray,2)
  261. for i = 0 to mx
  262. if FldArray(7,i) < 12 and FldArray(8,i) then
  263. Response.Write "," & FldArray(0,i)
  264. end if
  265. fdict.Add FldArray(0,i), i
  266. next
  267. Response.Write "," & chr(34) & ";</script>"
  268. rem check for links ( related bugs, file attachments ) associated with this bug
  269. Dim LinkType(10)
  270. mx = UBound(LinkType)
  271. for i = 0 to mx
  272. LinkType(i) = "loff"
  273. next
  274. if BugID<>"CREATE" then
  275. Comm.CommandText = "Select Type from links where BugID=" & BugID
  276. RS.Open
  277. if NOT RS.EOF then
  278. FldLinks = RS.GetRows()
  279. mx = UBound(FldLinks,2)
  280. mxc = UBound(LinkType)
  281. for i = 0 to mx
  282. if FldLinks(0,i) < mxc then
  283. LinkType( FldLinks(0,i) ) = "lon"
  284. end if
  285. next
  286. end if
  287. RS.Close
  288. end if
  289. coln = Array("Status","Opened","Resolved","Closed","Project")
  290. colh = Array(200,200,200,200,200)
  291. ColNb = Array(8,9,6,4,16)
  292. ColTot = ColNb(0)+ColNb(1)+ColNb(2)+ColNb(3)+ColNb(4)
  293. fname = "Status,AssignedTo,IssueType,Severity,Priority,Accessibility,ChangedDate,ChangedBy,"
  294. fname = fname & "OpenedDate,OpenedBy,OpenedRev,Source,SourceID,BetaID,HowFound,Lang,LangSup,"
  295. fname = fname & "ResolvedDate,ResolvedBy,Resolution,FixedRev,Cause,CodeChange,"
  296. fname = fname & "ClosedDate,ClosedBy,KBArticle,SR,"
  297. fname = fname & "Component,SubComp,Owner,Processor,NumCPU,Software,Urgency,Regression,ShowStop,SubStatus,CustPri,TrackingNumber,VendorNm,CCList,IsPerf,Class,Title,Description"
  298. if BugID <> "CREATE" then
  299. Comm.CommandText = "Select " & fname & " from bugs where BugID=" & BugID
  300. fname = fname & ","
  301. Set RS.Source = Comm
  302. RS.CursorType = adOpenStatic
  303. RS.Open
  304. dTitle = RS(ColTot)
  305. Desc = Rs(ColTot+1)
  306. fCreate = FALSE
  307. else
  308. fname = fname & ","
  309. dTitle = ""
  310. Desc = ""
  311. fCreate = TRUE
  312. end if
  313. Response.Write "<body bgcolor=#c0c0c0>"
  314. Response.Write "<form id=" & chr(34) & "bug" & chr(34) & " method=POST action=" & chr(34) & "/scripts/raid/upd.asp" & chr(34) & ">"
  315. st = "position:absolute; left:10; top:0"
  316. Response.Write "<div style=" & chr(34) & st & chr(34) & ">"
  317. if fCreate then
  318. Response.Write "<input class= " & chr(34) & "titlenab" & chr(34)
  319. else
  320. Response.Write "<input class= " & chr(34) & "titl" & chr(34) & " disabled"
  321. end if
  322. Response.Write " id=" & chr(34) & "Title" & chr(34) & " name=" & chr(34) & "Title" & chr(34) & " size=80 value=" & chr(34) & dTitle & chr(34) & "></input>"
  323. Response.Write "<input type=hidden name=" & chr(34) & "action" & chr(34) & " id=" & chr(34) & "action" & chr(34) & "></input>"
  324. Response.Write "<input type=hidden name=" & chr(34) & "bugid" & chr(34) & " id=" & chr(34) & "bugid" & chr(34) & " value=" & chr(34) & BugID & chr(34) &"></input>"
  325. Response.Write "</div>"
  326. rem iterates through columns, access RAID once for each column because
  327. rem ADO can't handle all the fields in RAID at once.
  328. wi=154
  329. mxc = UBound(ColNb)
  330. ibase = 1
  331. fbase = 0
  332. for c = 0 to mxc
  333. fSt = TRUE
  334. for ff = 1 to colNb(c)
  335. inext = instr(ibase,fname,",")
  336. i = fdict.Item(mid(fname,ibase,inext-ibase))
  337. if true then
  338. if fSt then
  339. rem position fieldset
  340. st = "position:absolute; left:" & FldArray(2,i)*1.12-4 & "; top:" & FldArray(3,i)*2.4-24 & ";width:" & wi
  341. Response.Write "<fieldset style=" & chr(34) & st & chr(34) & ">"
  342. Response.Write "<legend>" & coln(c) & "</legend><table width=20 cellpading=0 cellspacing=0 nowrap>"
  343. fSt = FALSE
  344. end if
  345. rem check if field validation function necessary
  346. if FldArray(0,i) = "Status" then
  347. fn = " onkeypress=" & chr(34) & "return false;" & chr(34)
  348. ElseIf FldArray(7,i) = 2 then
  349. rem numeric fields
  350. fn = " onkeypress=" & chr(34) & "return ckdigit();" & chr(34)
  351. ElseIf FldArray(7,i) = 9 then
  352. rem Rev fields
  353. fn = " onkeypress=" & chr(34) & "return ckdotdigit();" & chr(34)
  354. else
  355. fn = ""
  356. end if
  357. rem associate title to each field name
  358. rem all fields are initialy disabled
  359. if instr(1,FldArray(6,i),chr(34)) then
  360. rem Response.Write "<tr><td>" & FldArray(6,i) & "</td>"
  361. Response.Write "<tr><td width=95 nowrap" & ">" & FldArray(1,i) & ":</td>"
  362. else
  363. Response.Write "<tr><td title=" & chr(34) & FldArray(6,i) & chr(34) & " width=95 nowrap" & ">" & FldArray(1,i) & ":</td>"
  364. end if
  365. rem display current value
  366. Response.Write "<td><input " & fn & " type=text name=" & chr(34) & FldArray(0,i) & chr(34) & " id=" & chr(34) & FldArray(0,i) & chr(34) & " value=" & chr(34)
  367. if fCreate then
  368. if FldArray(0,i) = "OpenedRev" then
  369. Response.Write Application("cnfg" & Application("dbCache")(Session("DBSOURCE")))(1,0) & "0000"
  370. end if
  371. Response.Write chr(34) & "disabled class=" & chr(34) & "inp" & chr(34)
  372. else
  373. Response.Write RS(fbase) & chr(34) & " disabled class=" & chr(34) & "inp" & chr(34)
  374. end if
  375. Response.Write "></input></td></tr>"
  376. end if
  377. ibase = inext + 1
  378. fbase = fbase + 1
  379. next
  380. Response.Write "</table></fieldset>"
  381. next
  382. if NOT fCreate then
  383. Rs.Close
  384. end if
  385. %>
  386. <div style="position:absolute; top:360">
  387. <button onclick="bactivate()" title="Activate"><img width=16 height=15 src="doact.gif"></button>
  388. <button onclick="bresolve()" title="Resolve"><img width=16 height=15 src="dores.gif"></button>
  389. <button onclick="bclose()" title="Close"><img width=16 height=15 src="doclo.gif"></button>
  390. <button onclick="bassign()" title="Assign"><img width=16 height=15 src="doass.gif"></button>
  391. &nbsp;&nbsp;
  392. <button id="upd" onclick="doupd()" title="Save bug" disabled><img width=16 height=15 src="doupd.gif"></button>
  393. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  394. <table style="position:relative; top:-25; left:140"><tbody>
  395. <tr>
  396. <td><b>Links:</b></td>
  397. <td><button onclick="dolink(6)" title="Dependent bug links"><img src="l1.gif"></button></td>
  398. <td><button onclick="dolink(0)" title="Duplicate bug links"><img src="l2.gif"></button></td>
  399. <td><button onclick="dolink(1)" title="Related bug links"><img src="l3.gif"></button></td>
  400. <td><button onclick="dolink(3)" title="Attached files"><img src="l4.gif"></button></td>
  401. <td><button onclick="dolink(4)" title="Linked files"><img src="l5.gif"></button></td>
  402. </tr>
  403. <tr align=center>
  404. <td></td>
  405. <td><img src="<%=LinkType(6)%>.gif"></td>
  406. <td><img src="<%=LinkType(0)%>.gif"></td>
  407. <td><img src="<%=LinkType(1)%>.gif"></td>
  408. <td><img src="<%=LinkType(3)%>.gif"></td>
  409. <td><img src="<%=LinkType(4)%>.gif"></td>
  410. </tr>
  411. </tbody></table>
  412. </div>
  413. <div style="position:absolute; top:395">
  414. <%
  415. rem textarea for existing bug description
  416. rem we want to prevent modifications to this filed can't disable it
  417. rem because this would also disable scroll bar - we just prevent keypress events
  418. if fCreate then
  419. Response.Write "<textarea rows=12"
  420. else
  421. Response.Write "<textarea cols=90 rows=12 onkeypress=" & chr(34) & "return false;" & chr(34) & ">"
  422. Response.Write Desc
  423. Response.Write "</textarea>"
  424. Response.Write "<textarea rows=4 class=" & chr(34) & "unvis" & chr(34)
  425. end if
  426. %>
  427. name="desc" id="desc" cols=90>
  428. </textarea>
  429. <script FOR=window EVENT=onload() language="JavaScript">
  430. <%
  431. if fCreate then
  432. Response.Write "bchange(',IssueType,Severity,Priority,OpenedRev,Source,SourceID,HowFound,Lang,LangSup,Accessibility,BetaID,SR,Component,SubComp,Owner,Processor,NumCPU,Software,Urgency,Regression,SubStatus,CustPri,TrackingNumber,VendorNM,CCList,IsPerf,Class,ShowStop,VendorNm,');"
  433. Response.Write "bsetf( 'Active', 'Opened', 'OpenedDate', 'OpenedBy', '" & AuthUser & "' );"
  434. end if
  435. %>
  436. </script>
  437. </form>
  438. </body>
  439. </html>