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.

891 lines
26 KiB

  1. //-------------------------------------------------------------------------------
  2. // onload
  3. // This function will be executed when viewer window is first loaded.
  4. //--------------------------------------------------------------------------------
  5. function window.onunload () {
  6. close() ;
  7. }
  8. function handleScroll(){
  9. // this is to prevent cascading events
  10. if(fScrollChange== true)
  11. return;
  12. else
  13. {
  14. fScrollChange = true;
  15. pageInRange();
  16. fScrollChange = false;
  17. }
  18. }
  19. function cacheAway()
  20. {
  21. var k = 0;
  22. var d = new Date();
  23. var numberToGet = Math.min (DATA_SIZE, (numEELRecords - INDEX_NEXT_TOP)) ;
  24. var numberGot = 0;
  25. var i,j;
  26. for (i = 0; i < numberToGet; i++)
  27. {
  28. try {
  29. kalpaxml.wmiGetNextObject();
  30. } catch (e) {
  31. // try to update count.
  32. // BUGBUG! what query to use?
  33. // BUGBUG! logic for updating number of records since we cannot get it from
  34. // WMI yet.
  35. numEELRecords = kalpaxml.wmiGetCount ("") ;
  36. setScrollBarParameters () ;
  37. if (true == fScrollChange)
  38. scrollBar.value = Math.max(numEELRecords - PAGE_SIZE,0);
  39. numberGot = i;
  40. convertCacheDateTime(numberGot);
  41. return;
  42. }
  43. for(j = 0; j < numColumns; j++)
  44. {
  45. if( (j!=typePos)&&(j!=classificationPos)&&(j!=valuePos ) )
  46. {
  47. cache[k++] = kalpaxml.wmiGetPropertyText(arrayProp[j]);
  48. }
  49. else
  50. {
  51. if(j==classificationPos)
  52. {
  53. cache[k++] = valNumClassification [kalpaxml.wmiGetPropertyText(arrayProp[j])];
  54. }
  55. else
  56. if(j==typePos)
  57. {
  58. if(viewingNTEventLog == true)
  59. {
  60. var temp = kalpaxml.wmiGetPropertyText(arrayProp[j]);
  61. cache[k++] = "<IMG align='left' src=" + valNTImageSrc[temp] + "></IMG>" + temp;
  62. }
  63. else
  64. {
  65. var temp = kalpaxml.wmiGetPropertyText(arrayProp[j]);
  66. cache[k++] = "<IMG align='left' src=" + valImageSrc[temp] + "></IMG>" + valType[temp];
  67. }
  68. }
  69. else
  70. {
  71. cache[k++] = valNumLogType[kalpaxml.wmiGetPropertyText(arrayProp[j])]
  72. }
  73. }
  74. }
  75. //this is for drillDown - we always put the RecordNumber for EEL case
  76. //and RecordNumber+LogType in NT Case;
  77. if(fRecordPresent == false)
  78. {
  79. record[INDEX_NEXT_TOP + i] = kalpaxml.wmiGetPropertyText("RecordNumber");
  80. }
  81. if(fLogTypePresent == false && viewingNTEventLog)
  82. {
  83. logfilearray[INDEX_NEXT_TOP + i] = kalpaxml.wmiGetPropertyText("Logfile");
  84. }
  85. }
  86. numberGot = i;
  87. convertCacheDateTime(numberGot);
  88. }
  89. function convertCacheDateTime(numberGot)
  90. {
  91. var i,j;
  92. for(j=0;j<numColumns;j++)
  93. {
  94. if(arrayProp[j].indexOf("Time")!=-1)
  95. {
  96. for (i = 0; i < numberGot; i++)
  97. cache[i*numColumns+j] = convertDateTime(cache[i*numColumns+j])
  98. }
  99. }
  100. }
  101. function convertDateTime(dateTimeStr)
  102. {
  103. hours = dateTimeStr.substring(8,10) * 1;
  104. gmtTime = dateTimeStr.substring (22,24) ;
  105. gmtTimeHours = ((gmtTime - (gmtTime)%6)/6) ;
  106. gmtTimeMins = gmtTime - (gmtTimeHours * 6);
  107. return(dateTimeStr.substring(4,6)+"/"+dateTimeStr.substring(6,8)+"/"+dateTimeStr.substring(2,4)+ " " + arrHours[hours]+":"+dateTimeStr.substring(10,12)+":"+dateTimeStr.substring(12,14)+" "+arrAMPM[hours]+
  108. " GMT"+dateTimeStr.substring(21,22)+gmtTimeHours+":"+gmtTimeMins+"0");
  109. }
  110. function fillUpTableFromCache(startRow,numRows,cachePosition)
  111. {
  112. //startTimer();
  113. var i,j;
  114. for(i=startRow;i<numRows;i++)
  115. {
  116. for(j = 0; j < numColumns; j++)
  117. {
  118. if(j==typePos)
  119. {
  120. TABLEBODY1.rows(i).cells(j).innerHTML = cache[cachePosition++] ;
  121. }
  122. else
  123. TABLEBODY1.rows(i).cells(j).innerText = cache[cachePosition++] ;
  124. }
  125. }
  126. if(fRecordPresent == false)
  127. {
  128. for(i=startRow;i<numRows;i++)
  129. TABLEBODY1.rows(i).cells(RECORDNUMBER_INDEX).innerText = record[INDEX_NEXT_TOP+i];
  130. }
  131. if(fLogTypePresent == false) {
  132. for(i=startRow;i<numRows;i++)
  133. TABLEBODY1.rows(i).cells(LOGFILE_INDEX).innerText = logfilearray[INDEX_NEXT_TOP+i];
  134. }
  135. // endTimer();
  136. /*
  137. //Is the code below better optimised - reduced number of comparisions
  138. //versus rewriting into the cells??
  139. for(i=startRow;i<numRows;i++)
  140. {
  141. for(j = 0; j < numColumns; j++)
  142. TABLEBODY1.rows(i).cells(j).innerText = cache[cachePosition++] ;
  143. }
  144. for(i=startRow;i<numRows;i++)
  145. {
  146. TABLEBODY1.rows(i).cells(typePos).innerHTML = cache[cachePosition++] ;
  147. }
  148. if(fRecordPresent == false)
  149. {
  150. for(i=startRow;i<numRows;i++)
  151. TABLEBODY1.rows(i).cells(RECORDNUMBER_INDEX).innerText = record[INDEX_NEXT_TOP+i];
  152. }
  153. */
  154. }
  155. function getCount(queryCount)
  156. {
  157. var cnt=-1;
  158. try {
  159. cnt = kalpaxml.wmiGetCount(queryCount);;
  160. } catch (e) {
  161. //errorMessage = e.description;
  162. }
  163. return(cnt);
  164. }
  165. function getDrillDownNode(strRecordNumber, strLogFile) {
  166. var query;
  167. var wqlStr;
  168. var nt = false ;
  169. if (viewingNTEventLog == true)
  170. {
  171. query = "(RecordNumber=" + "'"+ strRecordNumber + "') and (Logfile=" + "'" + strLogFile + "')";
  172. //wqlStr = "SELECT Message, Data, Type FROM Win32_NTLogEvent WHERE (" + query + ")";
  173. wqlStr = "SELECT * FROM Win32_NTLogEvent WHERE (" + query + ")";
  174. nt = true ;
  175. }
  176. else
  177. {
  178. query = "(RecordNumber=" + "'"+ strRecordNumber + "')";
  179. wqlStr = "SELECT OriginalEvent, Priority, Severity, Type FROM Microsoft_EELEntry WHERE (" + query + ")";
  180. }
  181. var rs;
  182. try {
  183. s = kalpaxml.wmiGetDetailsText (wqlStr) ;
  184. } catch (e) {
  185. return (null);
  186. }
  187. if (nt) {
  188. xmlStr = toDrillDownXMLNT (s) ;
  189. } else {
  190. xmlStr = toDrillDownXML (s) ;
  191. }
  192. xmlStr = "<INSTANCE>" + xmlStr + "</INSTANCE>" ;
  193. drillDownTemp.loadXML (xmlStr) ;
  194. var node = drillDownTemp.selectSingleNode("INSTANCE");
  195. return (node);
  196. }
  197. function toDrillDownXML (s) {
  198. var start,end;
  199. //Saving the value as it will be required later
  200. sT=s;
  201. //The next three lines get the part required by drilldown part.
  202. //The remaining is type, priority and severity.
  203. start = s.indexOf ("instance") ;
  204. end = s.indexOf ("Priority", start) ;
  205. s= s.slice (start, end-1) ;
  206. // replace new line
  207. a = s.replace (/[\s\n]/g," ") ;
  208. b = a.replace (/(\s\S)*\s(\w+)\s*=\s*(instance of)\s*(\w+)(\s*{ )/g,
  209. "$1<PROPERTY.OBJECT NAME=\"$2\"><VALUE.OBJECT><INSTANCE CLASSNAME=\"$4\">")
  210. c = b.replace (/\s*(\w+)(\s*=\s*)"*([\w\s]*)"*;/g,"<PROPERTY NAME=\"$1\"><VALUE>$3</VALUE></PROPERTY>") ;
  211. d = c.replace (/};/g, "</INSTANCE></VALUE.OBJECT></PROPERTY.OBJECT>") ;
  212. //Getting the part which contains priority, type and severity fields
  213. start = sT.indexOf ("Priority") ;
  214. end = sT.indexOf ("Type", start) ;
  215. g= sT.slice (start, end+9) ;
  216. h = g.replace (/[\s\n]/g," ") ;
  217. //Getting the Severity value
  218. start = h.indexOf ("Sev") ;
  219. end = h.indexOf ("Typ") ;
  220. d=d+"<PROPERTY NAME=\""+h.slice(start,start+8)+"\" CLASSORIGIN=\"Microsoft_EELEntry\" TYPE=\"uint16\"><VALUE>"+h.slice(end-4,end-3)+"</VALUE></PROPERTY>";
  221. //Getting priority value
  222. start = h.indexOf ("Pri") ;
  223. end = h.indexOf ("Sev") ;
  224. d=d+"<PROPERTY NAME=\""+h.slice(start,start+8)+"\" CLASSORIGIN=\"Microsoft_EELEntry\" TYPE=\"uint16\"><VALUE>"+h.slice(end-4,end-3)+"</VALUE></PROPERTY>";
  225. //Getting type value
  226. start = h.indexOf ("Ty") ;
  227. end = h.indexOf ("}") ;
  228. d=d+"<PROPERTY NAME=\""+h.slice(start,start+4)+"\" CLASSORIGIN=\"Microsoft_EELEntry\" TYPE=\"uint8\"><VALUE>"+h.slice(start+7,start+8)+"</VALUE></PROPERTY>";
  229. return d ;
  230. }
  231. function toDrillDownXMLNT (s) {
  232. var start,end;
  233. //Next 4 lines get the value of the type field
  234. start = s.indexOf ("Type = \"") ;
  235. end = s.indexOf ("\";", start) ;
  236. sT = s.slice (start+8, end) ;
  237. sType=valType1[sT];
  238. //Next 3 lines get the value of the TimeGenerated field
  239. start = s.indexOf ("TimeGenerated = \"") ;
  240. end = s.indexOf ("\";", start) ;
  241. sTG = s.slice (start+17, end) ;
  242. sTimeGenerated = convertDateTime(sTG);
  243. //Next 3 lines get the value of the User field
  244. start = s.indexOf ("User = \"") ;
  245. end = s.indexOf ("\";", start) ;
  246. if( start != -1 ){
  247. sUser = s.slice (start+8, end) ;
  248. }else {
  249. sUser="";
  250. }
  251. //Next 3 lines get the value of the ComputerName field
  252. start = s.indexOf ("ComputerName = \"") ;
  253. end = s.indexOf ("\";", start) ;
  254. sComputerName = s.slice (start+16, end) ;
  255. //Next 3 lines get the value of the SourceName field
  256. start = s.indexOf ("SourceName = \"") ;
  257. end = s.indexOf ("\";", start) ;
  258. sSourceName = s.slice (start+14, end) ;
  259. //Next 3 lines get the value of the Category field
  260. start = s.indexOf ("Category = ") ;
  261. end = s.indexOf (";", start) ;
  262. sCategory = s.slice (start+11, end) ;
  263. //Next three lines get the part which is for the drilldown
  264. start = s.indexOf("inst");
  265. end = s.indexOf("Ty");
  266. s = s.slice(start,end -1);
  267. s=s+"};" ;
  268. // replace new line
  269. a = s.replace (/[\s\n]/g," ") ;
  270. a = s.replace (/\\n/g, "") ;
  271. // find the message part.
  272. start = a.indexOf ("Message = \"") ;
  273. end = a.indexOf ("\";", start) ;
  274. message = a.slice (start+11, end) ;
  275. // find data.
  276. data = "" ;
  277. ds = a.indexOf ("Data = {") ;
  278. if (ds !=-1) {
  279. de = a.indexOf ("}", ds) ;
  280. data = a.slice (ds+8,de) + ",";
  281. }
  282. if (data != "") {
  283. //break it up into <VALUE> nodes as we want.
  284. datax = data.replace(/\s*(\d+),/g,"<VALUE>$1.</VALUE>") ;
  285. } else{
  286. datax = "";
  287. }
  288. datax = "<PROPERTY NAME=\"Data\"><VALUE>"+datax+"</VALUE></PROPERTY>" ;
  289. // build the xml
  290. s1 = "<PROPERTY NAME=\"Type\"><VALUE>"+sType+"</VALUE></PROPERTY>"
  291. +"<PROPERTY NAME=\"TimeGenerated\"><VALUE>"+sTimeGenerated+"</VALUE></PROPERTY>"
  292. +"<PROPERTY NAME=\"User\"><VALUE>"+sUser+"</VALUE></PROPERTY>"
  293. +"<PROPERTY NAME=\"ComputerName\"><VALUE>"+sComputerName+"</VALUE></PROPERTY>"
  294. +"<PROPERTY NAME=\"SourceName\"><VALUE>"+sSourceName+"</VALUE></PROPERTY>"
  295. +"<PROPERTY NAME=\"Category\"><VALUE>"+sCategory+"</VALUE></PROPERTY>"
  296. +"<PROPERTY.OBJECT NAME=\"Details Data\">"
  297. +"<VALUE.OBJECT>"
  298. +"<INSTANCE CLASSNAME=\"Message and Data\" NAME=\"NT\">"
  299. +"<VALUE>1</VALUE>"
  300. +"<PROPERTY NAME=\"Message\">"
  301. +"<VALUE>"+message+"</VALUE></PROPERTY>"
  302. +datax
  303. +"</INSTANCE></VALUE.OBJECT></PROPERTY.OBJECT>" ;
  304. return s1 ;
  305. }
  306. //-----------------------------------------------------------------------------
  307. // Respositions the forward only enumerator to the required position
  308. //-----------------------------------------------------------------------------
  309. function positionEnumerator (index) {
  310. try {
  311. kalpaxml.wmiGoTo(index);
  312. } catch (e) {
  313. // the failure will be caught in the
  314. // cacheAway function
  315. }
  316. }
  317. //-----------------------------------------------------------------------------
  318. // pageInRange ()
  319. //
  320. // displays the page in specified range
  321. //-----------------------------------------------------------------------------
  322. function pageInRange() {
  323. //This function is called when you scroll and when you resize
  324. if(fMadeConnection == false)
  325. return;
  326. var prev_INDEX_NEXT_TOP = INDEX_NEXT_TOP;
  327. INDEX_NEXT_TOP = scrollBar.value;
  328. if( (numEELRecords<PAGE_SIZE) )
  329. {
  330. // fix this
  331. for(i=0;i<numEELRecords;i++)
  332. {
  333. TABLEBODY1.rows(i).style.display = "";
  334. }
  335. for(i=numEELRecords;i<PAGE_SIZE;i++)
  336. {
  337. TABLEBODY1.rows(i).style.display = "none";
  338. }
  339. }
  340. if( ( ( INDEX_NEXT_TOP + PAGE_SIZE > INDEX_DATA + DATA_SIZE) && (INDEX_NEXT_TOP + PAGE_SIZE <= numEELRecords) ) || ( INDEX_NEXT_TOP < INDEX_DATA) )
  341. {
  342. // should we let this code be as it is
  343. // that should be done if the strategy is always to straddle,
  344. // which seems to be the best thing to do
  345. // check with AmitC
  346. // we do not have the required data with us
  347. // now get the appropriate data page
  348. if (INDEX_NEXT_TOP + DATA_SIZE > numEELRecords)
  349. INDEX_DATA = numEELRecords - DATA_SIZE;
  350. else
  351. INDEX_DATA = Math.max(INDEX_NEXT_TOP - Math.floor(DATA_SIZE/2),0);
  352. var tmpINDEX_NEXT_TOP = INDEX_NEXT_TOP;
  353. INDEX_NEXT_TOP = INDEX_DATA;
  354. // BUGBUG! Trying to counter the fact that we don't have the right count
  355. var tmp = numEELRecords ;
  356. positionEnumerator( INDEX_NEXT_TOP );
  357. getNextDataPage ();
  358. if (tmp != numEELRecords) {
  359. // This means we just realized that we did not have the right count.
  360. // we have adjusted the scroll bar params, but values like INDEX_NEXT_TOP are wrong.
  361. // we will call getNextDataPage again with a corrected INDEX_NEXT_TOP
  362. tmpINDEX_NEXT_TOP = scrollBar.value;
  363. INDEX_NEXT_TOP = Math.max(tmpINDEX_NEXT_TOP - Math.floor(DATA_SIZE/2),0);
  364. INDEX_DATA = INDEX_NEXT_TOP;
  365. positionEnumerator( INDEX_NEXT_TOP );
  366. getNextDataPage () ;
  367. }
  368. INDEX_NEXT_TOP = tmpINDEX_NEXT_TOP;
  369. }
  370. else
  371. {
  372. //optimise for
  373. //a)resizing - put data into table only for OLD_PAGE_SIZE to new PAGE_SIZE;
  374. //b)scroll by 1 - try using insertCell and deleteCell - this will give the required effect as well
  375. //the function fillUpTableFromCache
  376. // is very generic for doing that
  377. if(INDEX_NEXT_TOP+PAGE_SIZE>numEELRecords)
  378. {
  379. INDEX_NEXT_TOP = Math.max(numEELRecords - PAGE_SIZE,0);
  380. }
  381. fillUpTableFromCache(0,PAGE_SIZE,(INDEX_NEXT_TOP-INDEX_DATA)* numColumns);
  382. }
  383. if(numEELRecords > 0)
  384. {
  385. if(selectedRecord == selectedRow+INDEX_NEXT_TOP)
  386. {
  387. highlightRow();
  388. //TABLEBODY1.rows(selectedRow-1).cells(0).focus();
  389. }
  390. else
  391. {
  392. if (selectedRow != -1)
  393. for (j=0; j < TABLE1.rows(selectedRow).cells.length; j++)
  394. TABLE1.rows(selectedRow).cells(j).style.background="rgb(255,255,255)" ;
  395. }
  396. }
  397. getCurrentRecords();
  398. }
  399. function startTimer()
  400. {
  401. date0 = new Date();
  402. }
  403. function endTimer()
  404. {
  405. date1 = new Date();
  406. alert("Time for your function - " + (date1.getTime() - date0.getTime() )/1000 + "seconds")
  407. }
  408. //-------------------------------------------------------------------------
  409. // viewEELPrelude ()
  410. //
  411. // Called from the task frame
  412. //-------------------------------------------------------------------------
  413. function viewEELPrelude ( actionId, classView, machineName, query, nameSpace, sortFields, queryCols ) {
  414. // build name space
  415. if (machineName != "") {
  416. machineName = "\\\\" + machineName + "\\" ;
  417. }
  418. nameSpace = machineName + nameSpace;
  419. // make sure queryCols has the key, else append it.
  420. if (queryCols.indexOf ("RecordNumber") == -1)
  421. queryCols = queryCols + ", RecordNumber" ;
  422. if(actionId == "NT")
  423. {
  424. if (queryCols.indexOf ("Logfile") == -1)
  425. queryCols = queryCols + ", Logfile" ;
  426. }
  427. var query = buildQuery( actionId, classView, query, queryCols );
  428. return viewEEL( machineName, nameSpace, query, actionId );
  429. }
  430. //------------------------------------------------------------------------
  431. //
  432. //
  433. //
  434. //------------------------------------------------------------------------
  435. function buildQuery( actionId, classview, query, queryCols ) {
  436. var s1;
  437. // BUGBUG : handle the case when query is empty string
  438. if( actionId == "EEL" )
  439. {
  440. s1 = "SELECT " + queryCols + " FROM Microsoft_EELEntry ";
  441. queryCount = "SELECT __NAMESPACE FROM Microsoft_EELEntry ";
  442. }
  443. else if( actionId == "NT" )
  444. {
  445. if (classview != "All") {
  446. if (query != "")
  447. query = query + ' and (LogFile= "' + classview +'")';
  448. else
  449. query = '(LogFile= "' + classview +'")';
  450. }
  451. s1 = "SELECT " + queryCols + " FROM Win32_NTLogEvent";
  452. queryCount = "SELECT __NAMESPACE FROM Win32_NTLogEvent";
  453. }
  454. if (query != "")
  455. {
  456. s1 = s1 + " WHERE (" + query + ")" ;
  457. queryCount = queryCount + " WHERE (" + query + ")" ;
  458. }
  459. return s1;
  460. }
  461. //-------------------------------------------------------------------------------
  462. // viewEEL
  463. // This function will be executed when a EEL viewing task is selected from tasks.
  464. //--------------------------------------------------------------------------------
  465. function viewEEL (machineName, namespace, query, actionId) {
  466. //this is required as the rows might have display off for a small query
  467. // if that's not the spec, then remove the lines as display will always be
  468. // on - check with AmitC
  469. // optimise this by remembering which row onwards the
  470. // display is off!
  471. for(i=0;i<PAGE_SIZE;i++)
  472. TABLEBODY1.rows(i).style.display = "";
  473. if (getEELData (machineName, namespace, query, actionId) == false) {
  474. numEELRecords = 0;
  475. setScrollBarParameters();
  476. return false;
  477. }
  478. var result = "true";
  479. setScrollBarParameters();
  480. scrollBar.value = 0 ;
  481. return (result);
  482. }
  483. //-----------------------------------------------------------------------------
  484. // getEELData ()
  485. //
  486. // This function is called when a new batch of EEL data is
  487. // to be obtained. Currently it loads all of the eeldata using the XML adapter. The
  488. // xmlData is loaded into the eelData XML island
  489. //-----------------------------------------------------------------------------
  490. function getEELData (machineName, namespace, query, actionId) {
  491. curNameSpace = namespace ;
  492. curQuery = query ;
  493. curMachine = machineName ;
  494. try {
  495. kalpaxml.wmiConnect (namespace );
  496. } catch (e) {
  497. if ( e.description != "")
  498. setErrorMessage(e.description, e.number);
  499. else if (namespace.indexOf("\\EMM") != -1)
  500. setErrorMessage(L_NoEELSetup_TEXT , "");
  501. else if (namespace.indexOf("\\cimv2") != -1)
  502. setErrorMessage(L_NoNTSetup_TEXT , "");
  503. return false;
  504. }
  505. try {
  506. if (actionId == "EEL") {
  507. kalpaxml.wmiQuery (query,Q_NO_FLAGS) ;
  508. } else {
  509. kalpaxml.wmiQuery (query,Q_NO_FLAGS) ;
  510. }
  511. } catch (e) {
  512. setErrorMessage(e.description, e.number);
  513. return false;
  514. }
  515. // Don't get count for NT - that call takes for ever.
  516. if (actionId == "EEL") {
  517. numEELRecords = getCount(queryCount) ;
  518. } else {
  519. numEELRecords = maxNTRecords; //getCount(queryCount)
  520. }
  521. if(numEELRecords == -1)
  522. return false;
  523. viewingNTEventLog = false ;
  524. if (actionId == "NT") {
  525. viewingNTEventLog = true ;
  526. }
  527. // initialize the current cursor positions on a fresh load.
  528. INDEX_TOP = 0;
  529. INDEX_NEXT_TOP = 0 ;
  530. // BUGBUG : When the context of query changes from NT Log events to EELs,
  531. // /Actions needs to be deleted. The following code needs to be put in a
  532. // place that would result in least number of deletions
  533. // I guess the above is taken care of now
  534. if(previousConnectionType != actionId)
  535. {
  536. fSelectionChanged = true;
  537. if(previousConnectionType != "")
  538. {
  539. if(actionId == "EEL")
  540. {
  541. ntCustomizeCols = eelData.XMLDocument.selectSingleNode("/CIM").cloneNode(true);
  542. eelData.loadXML(eelCustomizeCols.xml);
  543. }
  544. else
  545. {
  546. eelCustomizeCols = eelData.XMLDocument.selectSingleNode("/CIM").cloneNode(true);
  547. eelData.loadXML(ntCustomizeCols.xml);
  548. }
  549. }
  550. //attack customizeEELData later;
  551. }
  552. var eelDataItem;
  553. if(1)
  554. {
  555. if(selectedRow != -1)
  556. {
  557. //unselect the selected row
  558. var tempCount = TABLE1.rows(selectedRow).cells.length;
  559. for (j=0; j < tempCount; j++)
  560. TABLE1.rows(selectedRow).cells(j).style.background="rgb(255,255,255)" ;
  561. }
  562. if ( (customizationNeedsRefresh == true) || (fSelectionChanged == true) || ( fHeaderNeedsRefresh == true ) )
  563. {
  564. setArrPos();
  565. }
  566. // turn off the flags
  567. fSelectionChanged = false;
  568. fHeaderNeedsRefresh = false;
  569. customizationNeedsRefresh = false;
  570. selectedRow = FIRST_DATA_ROW_INDEX ;
  571. selectedRecord = FIRST_DATA_ROW_INDEX ;
  572. selectedRecordIndex = FIRST_DATA_ROW_INDEX ;
  573. // keep this line here
  574. // this is because setHeaderFields should not be called
  575. // the first time
  576. previousConnectionType = actionId;
  577. }
  578. positionEnumerator( INDEX_TOP );
  579. var i,j;
  580. var tableRows = TABLEBODY1.rows.length;
  581. var eelDataItem;
  582. valuePos = null;
  583. classificationPos = null;
  584. typePos = null;
  585. if (viewingNTEventLog == true) {
  586. //do the conversions for nt
  587. typeNode = headerFields.selectSingleNode("PROPERTY[@NAME='Type']/nodeColPosition");
  588. if( (typeNode) )
  589. {
  590. typePos = typeNode.text * 1;
  591. }
  592. else
  593. typePos = null;
  594. }
  595. else
  596. {
  597. // do the conversions for EEL
  598. valueNode = headerFields.selectSingleNode("PROPERTY[@NAME='LogType']/nodeColPosition");
  599. if ( (valueNode) )
  600. {
  601. valuePos = valueNode.text * 1;
  602. }
  603. else
  604. valuePos = null;
  605. classifNode = headerFields.selectSingleNode("PROPERTY[@NAME='Classification']/nodeColPosition");
  606. if( (classifNode) )
  607. {
  608. classificationPos = (classifNode.text)*1;
  609. }
  610. else
  611. classificationPos = null;
  612. typeNode = headerFields.selectSingleNode("PROPERTY[@NAME='Type']/nodeColPosition");
  613. if( (typeNode) )
  614. {
  615. typePos = (typeNode.text) * 1;
  616. }
  617. else
  618. typePos = null;
  619. }
  620. // now get the next page of data
  621. getNextDataPage () ;
  622. return true ;
  623. }
  624. //-----------------------------------------------------------------------------
  625. // getNextDataPage ()
  626. //
  627. // Gets a page of data from the cache into the eelData island, based on the current cursor
  628. // position for the top of the page.
  629. //-----------------------------------------------------------------------------
  630. function getNextDataPage () {
  631. kalpaxml.wmiSetCursor(1);
  632. var bRet = true;
  633. cacheAway();
  634. fillUpTableFromCache(0,PAGE_SIZE,0);
  635. //TABLE1.rows(2).focus();
  636. doChooseColumns();
  637. // get the EEL Data
  638. if(numEELRecords<PAGE_SIZE)
  639. {
  640. for(i=numEELRecords;i<PAGE_SIZE;i++)
  641. {
  642. TABLEBODY1.rows(i).style.display = "none";
  643. }
  644. doChooseColumns();
  645. bRet = false;
  646. }
  647. if(0)
  648. {
  649. // BUGBUG! logic for updating number of records since we cannot get it from
  650. // WMI yet.
  651. numEELRecords = enumPosition;
  652. setScrollBarParameters () ;
  653. scrollBar.value = Math.max(numEELRecords - PAGE_SIZE,0);
  654. }
  655. //should we have an else instead of the return being used before
  656. //else
  657. kalpaxml.wmiRestoreCursor();
  658. return bRet;
  659. }
  660. //-----------------------------------------------------------------------------
  661. // setChooseAction ('0'|'1')
  662. //
  663. // sets the choose action field value to zero or 1.
  664. //-----------------------------------------------------------------------------
  665. function setChooseAction (val) {
  666. chooseActionField.value = val ;
  667. }
  668. //-----------------------------------------------------------------------------
  669. // getChooseAction ()
  670. //
  671. // gets the choose action field value
  672. //-----------------------------------------------------------------------------
  673. function getChooseAction () {
  674. return chooseActionField.value ;
  675. }
  676. function getQualifierValueArray(connectionOn,attributeName, qualifierName) {
  677. var qualifierNode = null;
  678. if (connectionOn == "EEL") {
  679. qualifierNode = eelEntrySchema.selectSingleNode("CLASS/PROPERTY[@NAME='" + attributeName + "']/QUALIFIER[@NAME='" + qualifierName + "']") ;
  680. } else if (connectionOn == "NT") {
  681. qualifierNode = ntSchema.selectSingleNode("CLASS/PROPERTY[@NAME='" + attributeName + "']/QUALIFIER[@NAME='" + qualifierName + "']") ;
  682. }
  683. if (qualifierNode == null) return null;
  684. return qualifierNode;
  685. }
  686. function getErrorMessage() {
  687. return errorMessage;
  688. }
  689. function setErrorMessage(message, number) {
  690. errorMessage = message;
  691. return true;
  692. }
  693. function getCurrentRecords() {
  694. if(numEELRecords == 0) {
  695. recordStatus.style.visibility = "hidden";
  696. return;
  697. }
  698. recordStatus.style.visibility = "visible";
  699. var top = INDEX_NEXT_TOP + 1;
  700. var bottom = Math.min(INDEX_NEXT_TOP + PAGE_SIZE,numEELRecords);
  701. var str = top + "-" + bottom + L_Of_Text + numEELRecords;
  702. recordStatus.innerText = L_RecordStatus_TEXT + str;
  703. }
  704. function startUpConnectionFromMMC(argv) {
  705. CONNECTIONTBODY.style.display = 'none';
  706. CONNECTIONTHEAD.style.display = 'none';
  707. calcPageSize();
  708. setScrollBarParameters();
  709. MachineName.value = argv[0];
  710. mmcEventLogType = argv[1];
  711. if(mmcEventLogType == "EEL")
  712. {
  713. eventLogType[0].checked = true;
  714. mmcEventType = "All";
  715. selectEEL();
  716. }
  717. else
  718. {
  719. mmcEventType = argv[2];
  720. eventLogType[1].checked = true;
  721. selectNT();
  722. }
  723. makeConnection(mmcEventType);
  724. }
  725. function close()
  726. {
  727. updateHeadersOnClose();
  728. }
  729. function updateHeadersOnClose()
  730. {
  731. //save back the information
  732. //alert(ntCols.xml);
  733. //alert(eelCols.xml);
  734. /*
  735. if(ntCols != null)
  736. {
  737. ntCols1 = NTcolOrder.XMLDocument.selectSingleNode("/ColumnFormat") ;
  738. ntCols2 = NTcolOrder.XMLDocument.selectSingleNode("/ColumnFormat/Instance") ;
  739. ntCols1.removeChild(ntCols2);
  740. ntCols3 = ntCols.selectSingleNode("CIM/Actions")
  741. ntCols1.appendChild(ntCols3);
  742. ntCols.save(NTcolOrder);
  743. }
  744. repeat code for EEL;
  745. */
  746. }
  747. <!-- ******************************************************** -->
  748. <!-- -->
  749. <!-- Copyright (c) 1999-2000 Microsoft Corporation -->
  750. <!-- -->
  751. <!-- wmi.js -->
  752. <!-- -->
  753. <!-- Build Type : 32 Bit Free -->
  754. <!-- Build Number : 0707 -->
  755. <!-- Build Date : 07/07/2000 -->
  756. <!-- ******************************************************* -->