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.

2582 lines
85 KiB

  1. function customize() {
  2. taskDiv.style.display="none";
  3. tableDiv.style.display="none";
  4. drillDownDiv.style.display="none";
  5. scrollBar.style.display = "none";
  6. customizeDiv.style.display="";
  7. doChooseColumnButton.disabled = true;
  8. cancelChooseColumnButton.disabled = true;
  9. doSortButton.disabled = true;
  10. cancelSortButton.disabled = true;
  11. }
  12. function backToViewer() {
  13. if(customizeDiv.style.display!="none") {
  14. customizeDiv.style.display="none";
  15. taskDiv.style.display="";
  16. tableDiv.style.display="";
  17. drillDownDiv.style.display="";
  18. scrollBar.style.display = "";
  19. return window.setTimeout("postBackToViewer()", 0);
  20. }
  21. }
  22. function postBackToViewer() {
  23. if ((connectionOn == "EEL" && eventLogType[1].checked) ||
  24. (connectionOn == "NT" && eventLogType[0].checked)) {
  25. customizationNeedsRefresh = false;
  26. return ;
  27. }
  28. if(eventLogType[0].checked == true)
  29. {
  30. selectedFieldsForSortDiv.innerHTML = selectedSortEEL;
  31. AvailableFieldsForSortDiv.innerHTML = availableSortEEL;
  32. selectedFieldsForChooseColumnOrderDiv.innerHTML = selectedChooseEEL;
  33. AvailableFieldsForChooseColumnOrderDiv.innerHTML = availableChooseEEL;
  34. }
  35. else
  36. {
  37. selectedFieldsForSortDiv.innerHTML = selectedSortNT;
  38. AvailableFieldsForSortDiv.innerHTML = availableSortNT;
  39. selectedFieldsForChooseColumnOrderDiv.innerHTML = selectedChooseNT;
  40. AvailableFieldsForChooseColumnOrderDiv.innerHTML = availableChooseNT;
  41. }
  42. updateSortOrderType();
  43. if (customizationNeedsRefresh == true) {
  44. if((connectionOn != "0") && (numEELRecords != 0))
  45. executeQuery("true");
  46. else
  47. {
  48. customizationNeedsRefresh = false;
  49. setArrPos();
  50. }
  51. }
  52. }
  53. function clearSortStatesInHeader(nodeToUpdate) {
  54. // select all the property nodes.
  55. var nodePropertyList = nodeToUpdate.selectNodes ("/CIM/Actions/INSTANCE/PROPERTY") ;
  56. var tempCnt = nodePropertyList.length;
  57. for (pos=0; pos < tempCnt; pos++)
  58. {
  59. node = nodePropertyList.item (pos);
  60. node.setAttribute("Sort","none");
  61. }
  62. }
  63. //-----------------------------------------------------------------------------
  64. // doSnglSortBy ()
  65. // This function does single column sorting of the main table.
  66. // The name of the column is passed in as a parameter.
  67. // This function will modify the "order-by" clause in the xsl file and reappply the
  68. // modified one.
  69. //-----------------------------------------------------------------------------
  70. function doSingleClickSorting () {
  71. if (window.event.ctrlKey || window.event.shiftKey || window.event.altKey)
  72. return;
  73. var id = window.event.srcElement.id;
  74. if(id == "")
  75. id = window.event.srcElement.parentElement.id;
  76. var sortPrefix = "";
  77. // find the sorting order of new sorting
  78. sortNode = getDataNode().selectSingleNode ("CIM/Actions/INSTANCE/PROPERTY[nodeColPosition='" + (id - 1) + "']") ;
  79. if (sortNode.getAttribute("Sort") == "ascending")
  80. sortPrefix = "-";
  81. var name = sortNode.getAttribute("NAME");
  82. clearSortStatesInHeader(getDataNode());
  83. if (sortPrefix == "-")
  84. sortNode.setAttribute("Sort","descending");
  85. else
  86. sortNode.setAttribute("Sort","ascending");
  87. sortOrderValue = sortPrefix + name;
  88. updateSortingSelectionInCustamization(name, sortPrefix);
  89. performSortingOnData(sortOrderValue);
  90. fHeaderNeedsRefresh = true;
  91. if ((connectionOn == "0") || (numEELRecords == 0))
  92. {
  93. setArrPos();
  94. }
  95. else
  96. executeQuery("true");
  97. }
  98. //-----------------------------------------------------------------------------
  99. // doChooseColumns ()
  100. //
  101. // This function lets user choose the columns to be displayed.
  102. // BUGBUG : need to rename this functions as it is doing
  103. // more than choosing columns
  104. //-----------------------------------------------------------------------------
  105. function doChooseColumns () {
  106. highlightRow () ;
  107. }
  108. //-----------------------------------------------------------------------------
  109. // selectRow ()
  110. //
  111. // Click a table element to select the row
  112. //-----------------------------------------------------------------------------
  113. function selectRow (e) {
  114. if(connectionOn == 0)return;
  115. event.cancelBubble = true ;
  116. // if the row is not a data row then return
  117. if (TABLE1.rows(e.parentNode.rowIndex).style.dataRow == "0")
  118. return ;
  119. // if there is a currently selected row, we need to clear it (or return if it is same)
  120. if (selectedRow != -1) {
  121. if (selectedRow == e.parentNode.rowIndex) {
  122. // we may have gone to a new page so don't return
  123. //return ;
  124. } else {
  125. // now clear the highlight in old row.
  126. for (j=0; j < TABLE1.rows(selectedRow).cells.length; j++) {
  127. TABLE1.rows(selectedRow).cells(j).style.background="rgb(255,255,255)" ;
  128. }
  129. }
  130. }
  131. selectedRow = e.parentNode.rowIndex ;
  132. if(numEELRecords - scrollBar.value < PAGE_SIZE)
  133. selectedRow = Math.min(selectedRow,numEELRecords - scrollBar.value);
  134. selectedRecord = scrollBar.value + selectedRow;
  135. selectedRecordIndex = selectedRow;
  136. highlightRow () ;
  137. }
  138. function ignoreEvent () {
  139. window.event.cancelBubble = true ;
  140. window.event.returnValue = false;
  141. return false ;
  142. }
  143. //-----------------------------------------------------------------------------
  144. // doDrillDown ()
  145. //
  146. // Dbl Click a table element to do drill down
  147. //-----------------------------------------------------------------------------
  148. function doDrillDown () {
  149. // now get the value of the eventId, I am assuming that this gives us unique element.
  150. // BUGBUG! Localization??
  151. // if seleted row is beyond the table, clear out drill down
  152. if (selectedRow == -1) {
  153. // pass it to the drill down pane.
  154. showDrillDown (null) ;
  155. return ;
  156. }
  157. kalpaxml.wmiSetCursor(1);
  158. if (highlightRowstart == false)
  159. {
  160. drillDownKey = "" ;
  161. var testRowIndex = selectedRow - 1;
  162. if (actionId == "EEL")
  163. {
  164. drillDownNode = getDrillDownNode(TABLEBODY1.rows(testRowIndex).cells(RECORDNUMBER_INDEX).innerText,"");
  165. }
  166. else
  167. {
  168. drillDownNode = getDrillDownNode(TABLEBODY1.rows(testRowIndex).cells(RECORDNUMBER_INDEX).innerText,TABLEBODY1.rows(testRowIndex).cells(LOGFILE_INDEX).innerText);
  169. }
  170. if( drillDownNode == null ){
  171. //BUGBUG : set appropriate error ?
  172. showDrillDown (null) ;
  173. kalpaxml.wmiRestoreCursor();
  174. return ;
  175. }
  176. // now query the node which we drill down on.
  177. // get the number of PROPERTY.OBJECT nodes this has
  178. nodes = drillDownNode.selectNodes (".//PROPERTY.OBJECT") ;
  179. num = nodes.length ;
  180. // nothing to do if there isn't any embedded objects.
  181. if (num == 0)
  182. {
  183. showDrillDown (null) ;
  184. kalpaxml.wmiRestoreCursor();
  185. return ;
  186. }
  187. maxSet = false ;
  188. for (i=0; i<drillDownNode.attributes.length; i++) {
  189. if ("max" == drillDownNode.attributes[i].name) {
  190. maxSet = true ;
  191. break ;
  192. }
  193. };
  194. // if the attribute was not set, create the max and cur attributes
  195. if (!maxSet) {
  196. var attribMax = getDataNode().createNode (2, "max", "") ;
  197. attribMax.nodeTypedValue = "" + (num-1) ;
  198. var attribCur = getDataNode().createNode (2, "cur", "") ;
  199. attribCur.nodeTypedValue = "0" ;
  200. var attribInit = getDataNode().createNode (2, "init", "") ;
  201. attribInit.nodeTypedValue = "0" ;
  202. // attach the attribute to the drill down node.
  203. var y = drillDownNode.attributes ;
  204. y.setNamedItem (attribMax) ;
  205. y.setNamedItem (attribCur) ;
  206. y.setNamedItem (attribInit) ;
  207. // also add a level atteribute to each PROPERTY.OBJECT node
  208. var tempCnt = nodes.length
  209. for (i=0; i< tempCnt; i++) {
  210. node = nodes.item (i) ;
  211. var attribLevel = getDataNode().createNode (2, "lev", "") ;
  212. attribLevel.nodeTypedValue = "" + i ;
  213. y = node.attributes ;
  214. y.setNamedItem (attribLevel) ;
  215. }
  216. }
  217. // clone it
  218. drillDownNode = drillDownNode.cloneNode (true) ;
  219. // pass it to the drill down pane.
  220. showDrillDown (drillDownNode) ;
  221. }
  222. kalpaxml.wmiRestoreCursor();
  223. calcPageSize();
  224. setScrollBarParameters();
  225. }
  226. //-----------------------------------------------------------------------------
  227. // highlightRow ()
  228. //
  229. // highlights the selected row.
  230. //-----------------------------------------------------------------------------
  231. function highlightRow () {
  232. if (selectedRow == -1)
  233. return ;
  234. // if selectedRow is beyond the table, show nothing
  235. if (selectedRow >= TABLE1.rows.length) {
  236. doDrillDown () ;
  237. return ;
  238. }
  239. //var temp = TABLE1.rows(selectedRow).cells.length;
  240. for (j=0; j < numColumns ; j++) {
  241. TABLE1.rows(selectedRow).cells(j).style.background="rgb(198,231,247)" ;
  242. }
  243. // now do drill down
  244. if (highlightRowstart == false)
  245. doDrillDown () ;
  246. }
  247. //-----------------------------------------------------------------------------
  248. // makeConnection()
  249. //
  250. // connect to the machine and executes the default query
  251. //-----------------------------------------------------------------------------
  252. function makeConnection(classView) {
  253. kalpaxml.wmiSetCursor(1);
  254. // classView is passed in as a parameter
  255. scrollBar.value = 0;
  256. tableIsEmpty = false;
  257. //WhiteSpaceDiv.style.display = "none";
  258. errorMessageDiv.innerText = "";
  259. if (eventLogType[0].checked) {
  260. actionId = "EEL";
  261. nameSpace = "root\\EMM";
  262. }else {
  263. actionId = "NT";
  264. nameSpace = "root\\cimv2";
  265. }
  266. var query = "";
  267. if(MachineName.value == "")
  268. MachineName.value = "localhost";
  269. machineName = getMachineName();
  270. if (viewEELPrelude(actionId, classView, machineName, query, nameSpace,sortFieldValue, getSelectedFieldsForQuery()) == false)
  271. {
  272. fMadeConnection = false;
  273. handleErrorConditionInConnection(actionId);
  274. kalpaxml.wmiRestoreCursor();
  275. return false;
  276. }
  277. // for displaying status
  278. var eventLogTypeName;
  279. //why is the below not localised
  280. if (eventLogType[0].checked == true)
  281. eventLogTypeName = " for Enterprise Event Log";
  282. else
  283. eventLogTypeName = " for NT Event Log";
  284. taskDiv.document.all.NoConnectionSetup.innerText=L_NoConnectionSet_TEXT + " " + L_lt_TEXT + "\\\\" + machineName + "\\" + nameSpace+ L_gt_TEXT + eventLogTypeName;
  285. getCurrentRecords();
  286. searchStatus.innerText = L_SearchStatusMessage_TEXT +
  287. " " + L_LastUpdatedAtMessage_TEXT + " " + getCurrentTime() + ".";
  288. searchStatus.title="";
  289. mostRecentSearchStatus = searchStatus.innerText;
  290. if (connectionOn != actionId)
  291. {
  292. clearQuery();
  293. populateSavedQueriesName(actionId);
  294. }
  295. if(actionId == "EEL")
  296. {
  297. EventTypeSelectionDiv.style.visibility = "hidden";
  298. eventTypeName.style.visibility = "hidden";
  299. connectionOn = actionId;
  300. //bugbug - do we NEED to call this
  301. selectEEL();
  302. }
  303. else
  304. {
  305. EventTypeSelectionDiv.style.visibility = "visible";
  306. eventTypeName.style.visibility = "visible";
  307. connectionOn = actionId;
  308. selectNT();
  309. }
  310. fMadeConnection = true;
  311. // TABLEBODY1.rows(selectedRow - 1).cells(0).focus();
  312. refreshButton.disabled = true;
  313. previousQuery = "";
  314. kalpaxml.wmiRestoreCursor();
  315. }
  316. //-----------------------------------------------------------------------------
  317. // executeQuery()
  318. //
  319. //-----------------------------------------------------------------------------
  320. function executeQuery(refreshingSearch) {
  321. if(executeQueryInProgress == true)
  322. return;
  323. if ((connectionOn == "0") || (connectionOn == "EEL" && eventLogType[1].checked) ||
  324. (connectionOn == "NT" && eventLogType[0].checked)) {
  325. return false;
  326. }
  327. executeQueryInProgress = true;
  328. kalpaxml.wmiSetCursor(1);
  329. searchStatus.innerText=L_SearchInProgressMessage_TEXT;
  330. if(refreshingSearch != "true")
  331. addAndToSearchCriteria();
  332. return window.setTimeout("postExecuteQuery('" + refreshingSearch +"')",0);
  333. }
  334. function postExecuteQuery(refreshingSearch) {
  335. tableIsEmpty = false;
  336. //WhiteSpaceDiv.style.display = "none";
  337. errorMessageDiv.innerText = "";
  338. scrollBar.value = 0;
  339. machineName = getMachineName();
  340. if (connectionOn == "EEL"){
  341. nameSpace = "root\\EMM";
  342. classView = "All";
  343. } else {
  344. nameSpace = "root\\cimv2";
  345. classView = EventTypeSelection.options(EventTypeSelection.selectedIndex).id;
  346. }
  347. var query = "";
  348. if(refreshingSearch == "true") {
  349. query = previousQuery;
  350. classView = "All";
  351. }
  352. else {
  353. query = getSearchCriteria();
  354. queryToDisplay = getDisplayableSearchCriteria();
  355. if (connectionOn == "NT"){
  356. if (queryToDisplay != "")
  357. queryToDisplay = " and \n" + queryToDisplay;
  358. queryToDisplay = "(LogType equals '" + EventTypeSelection.options(EventTypeSelection.selectedIndex).text + "') " + queryToDisplay;
  359. }
  360. }
  361. if (viewEELPrelude(connectionOn, classView, machineName, query, nameSpace, sortFieldValue, getSelectedFieldsForQuery()) == false) {
  362. numEELRecords=0;
  363. }
  364. if(numEELRecords == 0 )
  365. zeroSearchRecords();
  366. else
  367. searchStatus.innerHTML=L_CurrentSearchLastUpdated_TEXT + " " + getCurrentTime() + " " ;
  368. searchStatus.title = queryToDisplay;
  369. getCurrentRecords();
  370. previousQuery = query;
  371. if((connectionOn == "NT") && (classView != "All"))
  372. previousQuery = "(Logfile = '" + classView + "') and" + previousQuery;
  373. if(previousQuery != "")
  374. refreshButton.disabled = false;
  375. else
  376. refreshButton.disabled = true;
  377. kalpaxml.wmiRestoreCursor();
  378. executeQueryInProgress = false;
  379. }
  380. //-----------------------------------------------------------------------------
  381. // refreshSearch()
  382. // for reruning the latest search
  383. //-----------------------------------------------------------------------------
  384. function refreshSearch() {
  385. return executeQuery("true");
  386. }
  387. //-----------------------------------------------------------------------------
  388. // showHideConnection()
  389. // for making the connection display a collapsable one
  390. //-----------------------------------------------------------------------------
  391. function showHideConnection() {
  392. if (taskDiv.document.all.CONNECTIONTBODY.style.display == "") {
  393. taskDiv.document.all.ConnectionImage.src = "images/arrowrgt.gif"
  394. taskDiv.document.all.CONNECTIONTBODY.style.display="none";
  395. taskDiv.document.all.ConnectionImage.title = L_ConnectionArrowRightImageTitle_TEXT;
  396. }
  397. else {
  398. taskDiv.document.all.ConnectionImage.src = "images/downgif.gif"
  399. taskDiv.document.all.CONNECTIONTBODY.style.display="";
  400. taskDiv.document.all.ConnectionImage.title = L_ConnectionArrowDownImageTitle_TEXT;
  401. }
  402. window.onresize () ;
  403. }
  404. //-----------------------------------------------------------------------------
  405. // showHideSearch()
  406. // for making the search display a collapsable one
  407. //-----------------------------------------------------------------------------
  408. function showHideSearch() {
  409. if (connectionOn == "0") {
  410. searchStatus.innerText=L_NoConnectionIsSetMessage_TEXT;
  411. return false;
  412. }
  413. if ( (taskDiv.document.all.SEARCHDIV.style.display == "")){
  414. taskDiv.document.all.SearchImage.src = "images/arrowrgt.gif"
  415. taskDiv.document.all.SEARCHDIV.style.display="none";
  416. taskDiv.document.all.SearchImage.title = L_SearchArrowRightImageTitle_TEXT;
  417. }
  418. else {
  419. taskDiv.document.all.SearchImage.src = "images/downgif.gif"
  420. taskDiv.document.all.SEARCHDIV.style.display="";
  421. taskDiv.document.all.SearchImage.title = L_SearchArrowDownImageTitle_TEXT;
  422. highlightSearchRow(0);
  423. }
  424. window.onresize () ;
  425. }
  426. //-----------------------------------------------------------------------------
  427. // showHideTableView()
  428. // for making the table view a collapsable one
  429. //-----------------------------------------------------------------------------
  430. function showHideTableView() {
  431. if ( (customizeDiv.document.all.tableViewBodyDiv.style.display == "")){
  432. taskDiv.document.all.tableViewCollapseImg.src = "images/arrowrgt.gif"
  433. taskDiv.document.all.tableViewBodyDiv.style.display="none";
  434. taskDiv.document.all.tableViewCollapseImg.title = L_TableViewImageRightImageTitle_TEXT;
  435. }
  436. else {
  437. taskDiv.document.all.tableViewCollapseImg.src = "images/downgif.gif"
  438. taskDiv.document.all.tableViewBodyDiv.style.display="";
  439. taskDiv.document.all.tableViewCollapseImg.title = L_TableViewImageDownImageTitle_TEXT;
  440. }
  441. //window.onresize () ;
  442. }
  443. function enableSearch() {
  444. if (mostRecentSearchStatus != "empty") {
  445. searchStatus.innerText = mostRecentSearchStatus;
  446. mostRecentSearchStatus = "empty";
  447. }
  448. searchEnabled = "true";
  449. EventTypeSelection.disabled = false;
  450. FieldInput.disabled=false;
  451. OperatorType.disabled = false;
  452. valueInput.disabled = false;
  453. addOrButton.disabled = false;
  454. addAndButton.disabled = false;
  455. executeButton.disabled = false;
  456. removeButton.disabled = false;
  457. clearButton.disabled = false;
  458. savedSearches.disabled = false;
  459. saveButton.disabled = false;
  460. saveAs.disabled = false;
  461. if(previousQuery != "")
  462. refreshButton.disabled = false;
  463. EventTypeSelection.title = L_EventTypeSelectionTitle_TEXT;
  464. FieldInput.title=L_FieldInputTitle_TEXT;
  465. OperatorType.title = L_OperatorTypeTitle_TEXT;
  466. valueInput.title = L_ValueInputTitle_TEXT;
  467. valueInput.title = L_ValueInputTitle_TEXT;
  468. addOrButton.title = L_AddORToSearchButtonTitle_TEXT;
  469. addAndButton.title = L_AddANDToSearchButtonTitle_TEXT;
  470. executeButton.title = L_ExecuteButtonTitle_TEXT;
  471. removeButton.title = L_RemoveButtonTitle_TEXT;
  472. clearButton.title = L_ClearButtonTitle_TEXT;
  473. return;
  474. }
  475. //-----------------------------------------------------------------------------
  476. // addOrToSearchCriteria()
  477. //
  478. // For adding to currently entered search criteria
  479. // The new search condition is 'or'ed with most recently entered search condition
  480. //-----------------------------------------------------------------------------
  481. function addOrToSearchCriteria() {
  482. if (getValueInputValue() == "")
  483. return false;
  484. var inputFieldValue = getValueInputValue();
  485. inputFieldValue = inputFieldValue + " OR ";
  486. while((orPositionInValue = inputFieldValue.indexOf(" ")) != -1) {
  487. inputFieldValue = inputFieldValue.substr(0,orPositionInValue) + inputFieldValue.substr(orPositionInValue+1,inputFieldValue.length);
  488. }
  489. while((orPositionInValue = inputFieldValue.indexOf(" or ")) != -1) {
  490. inputFieldValue = inputFieldValue.substr(0,orPositionInValue) + " OR " + inputFieldValue.substr(orPositionInValue+4,inputFieldValue.length);
  491. }
  492. while((orPositionInValue = inputFieldValue.indexOf(" OR OR ")) != -1) {
  493. inputFieldValue = inputFieldValue.substr(0,orPositionInValue) + inputFieldValue.substr(orPositionInValue+3,inputFieldValue.length);
  494. }
  495. valueInput.focus();
  496. setValueInputValue(inputFieldValue);
  497. FieldInput.disabled=true;
  498. OperatorType.disabled = true;
  499. while((orPositionInValue = inputFieldValue.indexOf(" OR ")) != -1) {
  500. inputFieldValue = inputFieldValue.substr(0,orPositionInValue) + " \n" + inputFieldValue.substr(orPositionInValue+4,inputFieldValue.length);
  501. }
  502. SearchTable.rows(curSearchRowSelected).cells(0).innerText = FieldInput.options(FieldInput.selectedIndex).text;
  503. SearchTable.rows(curSearchRowSelected).cells(1).innerText = OperatorType.options(OperatorType.selectedIndex).text;
  504. SearchTable.rows(curSearchRowSelected).cells(2).innerText = insertORsInSearchValue(inputFieldValue) + " OR ";
  505. }
  506. //-----------------------------------------------------------------------------
  507. // addAndToSearchCriteria()
  508. // For adding to currently entered search criteria
  509. //-----------------------------------------------------------------------------
  510. function addAndToSearchCriteria() {
  511. if ((getValueInputValue() == "") || (getValueInputValue() == L_DDMMYY_TEXT))
  512. return false;
  513. var inputFieldValue = getValueInputValue();
  514. while((orPositionInValue = inputFieldValue.indexOf(" ")) != -1) {
  515. inputFieldValue = inputFieldValue.substr(0,orPositionInValue) + inputFieldValue.substr(orPositionInValue+1,inputFieldValue.length);
  516. }
  517. while((orPositionInValue = inputFieldValue.indexOf(" or ")) != -1) {
  518. inputFieldValue = inputFieldValue.substr(0,orPositionInValue) + " OR " + inputFieldValue.substr(orPositionInValue+4,inputFieldValue.length);
  519. }
  520. while((orPositionInValue = inputFieldValue.indexOf(" OR OR ")) != -1) {
  521. inputFieldValue = inputFieldValue.substr(0,orPositionInValue) + inputFieldValue.substr(orPositionInValue+3,inputFieldValue.length);
  522. }
  523. setValueInputValue(inputFieldValue);
  524. while((orPositionInValue = inputFieldValue.indexOf(" OR ")) != -1) {
  525. inputFieldValue = inputFieldValue.substr(0,orPositionInValue) + " \n" + inputFieldValue.substr(orPositionInValue+4,inputFieldValue.length);
  526. }
  527. if (SearchTable.rows.length <= (currentSearchTableRow+1)) {
  528. newRow = SearchTable.insertRow();
  529. newRow.attachEvent('onclick', searchRowSelected);
  530. for ( i = 0; i < 3; i++) {
  531. var newCell = newRow.insertCell();
  532. newCell.className = "searchTableDataAlignLeft";
  533. newCell.innerHTML = "<BR/>";
  534. }
  535. }
  536. SearchTable.rows(curSearchRowSelected).cells(0).innerText = FieldInput.options(FieldInput.selectedIndex).text;
  537. SearchTable.rows(curSearchRowSelected).cells(1).innerText = OperatorType.options(OperatorType.selectedIndex).text;
  538. SearchTable.rows(curSearchRowSelected).cells(2).innerText = insertORsInSearchValue(inputFieldValue);
  539. if (currentSearchTableRow >= searchFieldsCount)
  540. increaseSearchFieldSize();
  541. searchFieldNames[curSearchRowSelected] = FieldInput.selectedIndex;
  542. searchFieldOperators[curSearchRowSelected] = OperatorType.selectedIndex;
  543. if ((getValueInputValue().indexOf(" OR ") != -1) &&
  544. (getValueInputValue().substr(getValueInputValue().length-4,getValueInputValue().length).indexOf(" OR ") != -1))
  545. searchFieldValues[curSearchRowSelected] = getValueInputValue().substr(0,getValueInputValue().length-4);
  546. else
  547. searchFieldValues[curSearchRowSelected] = getValueInputValue();
  548. if (curSearchRowSelected == currentSearchTableRow) currentSearchTableRow++;
  549. highlightSearchRow(currentSearchTableRow);
  550. FieldInput.disabled=false;
  551. OperatorType.disabled = false;
  552. setValueInputValue("");
  553. }
  554. //-----------------------------------------------------------------------------
  555. //increaseSearchFieldSize()
  556. //
  557. // For scaling up search conditions table (maintained internally) when the
  558. // number of search conditions exceeded the expected
  559. //-----------------------------------------------------------------------------
  560. function increaseSearchFieldSize() {
  561. // 3 is added in below code to handle the case when numEELColumns is 0
  562. var newSize = searchFieldsCount + numEELColumns + 3;
  563. var tempValues = new Array (newSize);
  564. // searchFieldNames
  565. for( i = 0; i < searchFieldsCount; i++) {
  566. tempValues[i] = searchFieldNames[i];
  567. }
  568. searchFieldNames = new Array (newSize);
  569. for( i = 0; i < searchFieldsCount; i++) {
  570. searchFieldNames[i] = tempValues[i];
  571. }
  572. // searchFieldOperators
  573. for( i = 0; i < searchFieldsCount; i++) {
  574. tempValues[i] = searchFieldOperators[i];
  575. }
  576. searchFieldOperators = new Array (newSize);
  577. for( i = 0; i < searchFieldsCount; i++) {
  578. searchFieldOperators[i] = tempValues[i];
  579. }
  580. // searchFieldValues
  581. for( i = 0; i < searchFieldsCount; i++) {
  582. tempValues[i] = searchFieldValues[i];
  583. }
  584. searchFieldValues = new Array (newSize);
  585. for( i = 0; i < searchFieldsCount; i++) {
  586. searchFieldValues[i] = tempValues[i];
  587. }
  588. searchFieldsCount = newSize;
  589. }
  590. //-----------------------------------------------------------------------------
  591. //insertORsInSearchValue(value)
  592. //
  593. // for converting the input string into displayable format
  594. //-----------------------------------------------------------------------------
  595. function insertORsInSearchValue(value) {
  596. var s1 = "";
  597. cloneValue = value +" \n";
  598. valueSeperatorIndex = cloneValue.indexOf("\n");
  599. while( valueSeperatorIndex != -1) {
  600. if (cloneValue.substr(0,valueSeperatorIndex-1) != "") {
  601. if ( s1 != "")
  602. s1 = s1 + " OR\n" + cloneValue.substr(0,valueSeperatorIndex-1);
  603. else
  604. s1 = cloneValue.substr(0,valueSeperatorIndex-1);
  605. }
  606. cloneValue = cloneValue.substr(valueSeperatorIndex+1, cloneValue.length);
  607. valueSeperatorIndex = cloneValue.indexOf("\n");
  608. }
  609. return s1;
  610. }
  611. //-----------------------------------------------------------------------------
  612. // getSearchCriteria()
  613. //
  614. // for forming the search query expression from the search conditions entered by user
  615. //-----------------------------------------------------------------------------
  616. function getSearchCriteria() {
  617. var inputValue = "";
  618. var subvalue = "";
  619. var s1 = "";
  620. for ( i = 0; i < currentSearchTableRow; i++) {
  621. var ithFieldHasValueMap = false;
  622. if ((connectionOn =="EEL") && getQualifierValueArray(connectionOn,FieldInput.options(searchFieldNames[i]).value , "Values") != null ) {
  623. ithFieldHasValueMap = true;
  624. }
  625. inputValue = searchFieldValues[i] + "\n";
  626. while((orPositionInValue = inputValue.indexOf(" OR ")) != -1) {
  627. inputValue = inputValue.substr(0,orPositionInValue) + "\n" + inputValue.substr(orPositionInValue+4,inputValue.length);
  628. }
  629. s1 = s1 + "(";
  630. valueSeperatorIndex = inputValue.indexOf("\n");
  631. s3 = "";
  632. while( valueSeperatorIndex != -1) {
  633. subvalue = inputValue.substr(0,valueSeperatorIndex);
  634. inputValue = inputValue.substr(valueSeperatorIndex+1, inputValue.length);
  635. if(ithFieldHasValueMap == true)
  636. subvalue = convertValueToValueMap(FieldInput.options(searchFieldNames[i]).value, subvalue);
  637. if ( (subvalue != "") && (subvalue != "\n") && (subvalue != " ")) {
  638. switch (SearchTable.rows(i).cells(1).innerText) {
  639. case L_Contains_TEXT:
  640. s2 = "(" + FieldInput.options(searchFieldNames[i]).value + " LIKE '%" + subvalue + "%' ) ";
  641. break ;
  642. case L_NotContains_TEXT:
  643. s2 = "not ( (" + FieldInput.options(searchFieldNames[i]).value + " LIKE '%" + subvalue + "%' )) ";
  644. break ;
  645. case L_StartsWith_TEXT:
  646. s2 = "(" + FieldInput.options(searchFieldNames[i]).value + " LIKE '" + subvalue + "%' ) ";
  647. break ;
  648. case L_Equals_TEXT :
  649. if(subvalue.toLowerCase() != 'null')
  650. s2 = "(" + FieldInput.options(searchFieldNames[i]).value + " " +" = '" + subvalue + "') ";
  651. else
  652. s2 = "(" + FieldInput.options(searchFieldNames[i]).value + " " +" = " + subvalue + ") ";
  653. break ;
  654. case L_NotEquals_TEXT:
  655. if(subvalue.toLowerCase() != 'null')
  656. s2 = "not (" + "(" + FieldInput.options(searchFieldNames[i]).value + " " +" = '" + subvalue + "' ) )";
  657. else
  658. s2 = "not (" + "(" + FieldInput.options(searchFieldNames[i]).value + " " +" = " + subvalue + " ) )";
  659. break ;
  660. case L_GreaterThan_TEXT:
  661. s2 = "(" + FieldInput.options(searchFieldNames[i]).value + " " +" > " + subvalue + " ) ";
  662. break ;
  663. case L_LesserThan_TEXT:
  664. s2 = "(" + FieldInput.options(searchFieldNames[i]).value + " " +" < " + subvalue + " ) ";
  665. break ;
  666. case L_DatedOn_TEXT:
  667. s2 = "((" + FieldInput.options(searchFieldNames[i]).value + " " +" > '" + subvalue + "' ) " + " and " +
  668. "(" + FieldInput.options(searchFieldNames[i]).value + " " +" < '" + subvalue + " " + L_LastSecInDay_TEXT+ "' ) )";
  669. break ;
  670. case L_DatedAfter_TEXT:
  671. s2 = "(" + FieldInput.options(searchFieldNames[i]).value + " " +" > '" + subvalue + "' ) ";
  672. break ;
  673. case L_DatedBefore_TEXT:
  674. s2 = "(" + FieldInput.options(searchFieldNames[i]).value + " " +" < '" + subvalue + "' ) ";
  675. break ;
  676. }
  677. if ( s3 == "")
  678. s3 = s2;
  679. else
  680. s3 = s3 + " or " + s2;
  681. }
  682. valueSeperatorIndex = inputValue.indexOf("\n");
  683. }
  684. s1 = s1 + s3 + ")";
  685. if ( i != (currentSearchTableRow-1))
  686. s1 = s1+ " and ";
  687. }
  688. return s1;
  689. }
  690. //-----------------------------------------------------------------------------
  691. // getDisplayableSearchCriteria()
  692. //
  693. // for forming the search query expression from the search conditions entered by user
  694. //-----------------------------------------------------------------------------
  695. function getDisplayableSearchCriteria() {
  696. var inputValue = "";
  697. var subvalue = "";
  698. var s1 = "";
  699. for ( i = 0; i < currentSearchTableRow; i++) {
  700. inputValue = searchFieldValues[i] + "\n";
  701. while((orPositionInValue = inputValue.indexOf(" OR ")) != -1) {
  702. inputValue = inputValue.substr(0,orPositionInValue) + "\n" + inputValue.substr(orPositionInValue+4,inputValue.length);
  703. }
  704. s1 = s1 + "(";
  705. valueSeperatorIndex = inputValue.indexOf("\n");
  706. s3 = "";
  707. while( valueSeperatorIndex != -1) {
  708. subvalue = inputValue.substr(0,valueSeperatorIndex);
  709. inputValue = inputValue.substr(valueSeperatorIndex+1, inputValue.length);
  710. if ( (subvalue != "") && (subvalue != "\n") && (subvalue != " ")) {
  711. if (FieldInput.options(searchFieldNames[i]).className != "integer")
  712. s2 = "(" + FieldInput.options(searchFieldNames[i]).text + " " + SearchTable.rows(i).cells(1).innerText + " '" + subvalue + "') ";
  713. else
  714. s2 = "(" + FieldInput.options(searchFieldNames[i]).text + " " + SearchTable.rows(i).cells(1).innerText + " " + subvalue + ") ";
  715. }
  716. if ( s3 != "")
  717. s3 = s3 + " or ";
  718. s3 = s3 + s2;
  719. valueSeperatorIndex = inputValue.indexOf("\n");
  720. }
  721. s1 = s1 + s3 + ")";
  722. if ( i != (currentSearchTableRow-1))
  723. s1 = s1+ " and \n";
  724. }
  725. return s1;
  726. }
  727. //-----------------------------------------------------------------------------
  728. // displayOperatorType()
  729. // To display operator corresponding to a field
  730. //-----------------------------------------------------------------------------
  731. function displayOperatorType() {
  732. // At first, decide whether the field has any value map
  733. // if so, display drop down menu
  734. var previousValueInputIsAValueMap = currentValueInputIsAValueMap;
  735. if (FieldInput.options.length == 0)
  736. return;
  737. if (getQualifierValueArray(connectionOn,FieldInput.options(FieldInput.selectedIndex).value, "Values") != null) {
  738. ValueInputDiv.innerHTML = prepareDropDownMenuForValueMap();
  739. valueInput.selectedIndex = -1;
  740. currentValueInputIsAValueMap = true;
  741. } else {
  742. if(previousValueInputIsAValueMap == true)
  743. ValueInputDiv.innerHTML = nonValueMapValueInputStr;
  744. currentValueInputIsAValueMap = false;
  745. }
  746. var fieldType = FieldInput.options(FieldInput.selectedIndex).className;
  747. if ((previousFielDInputType == fieldType) && (previousValueInputIsAValueMap == currentValueInputIsAValueMap))
  748. return false;
  749. if (previousFielDInputType == "datetime")
  750. dateValueFocussed();
  751. valueInput.title = "";
  752. for (i = OperatorType.options.length; i != -1; i--) {
  753. OperatorType.options.remove(OperatorType.options(i));
  754. }
  755. if (currentValueInputIsAValueMap == true){
  756. OperatorType.options.add(createOption("Equals",L_Equals_TEXT));
  757. OperatorType.options.add(createOption("NotEquals",L_NotEquals_TEXT));
  758. } else if (fieldType == "string") {
  759. OperatorType.options.add(createOption("Equals",L_Equals_TEXT));
  760. OperatorType.options.add(createOption("NotEquals",L_NotEquals_TEXT));
  761. OperatorType.options.add(createOption("Contains",L_Contains_TEXT));
  762. OperatorType.options.add(createOption("NotContains",L_NotContains_TEXT));
  763. OperatorType.options.add(createOption("StartsWith",L_StartsWith_TEXT));
  764. } else if (fieldType == "datetime") {
  765. OperatorType.options.add(createOption("DatedAfter",L_DatedAfter_TEXT));
  766. OperatorType.options.add(createOption("DatedBefore",L_DatedBefore_TEXT));
  767. OperatorType.options.add(createOption("DatedOn",L_DatedOn_TEXT));
  768. valueInput.title = L_ValueInputTitle_TEXT;
  769. setValueInputValue(L_DDMMYY_TEXT);
  770. valueInput.style.color='gray';
  771. valueInput.attachEvent('onfocus', dateValueFocussed);
  772. } else if (fieldType == "integer"){
  773. OperatorType.options.add(createOption("Equals",L_Equals_TEXT));
  774. OperatorType.options.add(createOption("NotEquals",L_NotEquals_TEXT));
  775. OperatorType.options.add(createOption("GreaterThan",L_GreaterThan_TEXT));
  776. OperatorType.options.add(createOption("LessThan",L_LesserThan_TEXT));
  777. }
  778. previousFielDInputType = fieldType;
  779. return true;
  780. }
  781. function createOption(value, text) {
  782. var oOption = document.createElement("OPTION");
  783. oOption.value=value;
  784. oOption.text=text;
  785. return oOption;
  786. }
  787. function dateValueFocussed() {
  788. valueInput.style.color='black';
  789. valueInput.detachEvent('onfocus', dateValueFocussed);
  790. setValueInputValue("");
  791. }
  792. //-----------------------------------------------------------------------------
  793. // clearQuery()
  794. //
  795. // for clearing a latest query entered by user
  796. //-----------------------------------------------------------------------------
  797. function clearQuery() {
  798. firstOrInRow = "1";
  799. currentSearchTableRow = 0;
  800. i = 4;
  801. tableLength = SearchTable.rows.length;
  802. for (i = tableLength-1; i > 3; i--) {
  803. SearchTable.deleteRow(i);
  804. }
  805. for ( i = 0 ; i < 4; i++) {
  806. for ( j = 0; j < 3; j++)
  807. SearchTable.rows(i).cells(j).innerHTML = "<BR/>";
  808. }
  809. if(FieldInput.options.length != 0)
  810. FieldInput.options(0).selected = "true";
  811. if(OperatorType.options.length)
  812. OperatorType.options(0).selected = "true";
  813. setValueInputValue("");
  814. clearSearchCriteriaRow(curSearchRowSelected);
  815. curSearchRowSelected = "-1";
  816. highlightSearchRow(0);
  817. FieldInput.disabled=false;
  818. displayOperatorType();
  819. OperatorType.disabled = false;
  820. }
  821. //-----------------------------------------------------------------------------
  822. // searchRowSelected()
  823. //
  824. // for selecting a row in the search table displayed to user
  825. //-----------------------------------------------------------------------------
  826. function searchRowSelected() {
  827. rowNumber = event.srcElement.parentElement.rowIndex;
  828. if (rowNumber == curSearchRowSelected)
  829. return false;
  830. if (rowNumber > currentSearchTableRow)
  831. return false;
  832. if ( curSearchRowSelected < currentSearchTableRow)
  833. addAndToSearchCriteria();
  834. else if ( curSearchRowSelected == currentSearchTableRow)
  835. removeSearchCondition();
  836. highlightSearchRow(rowNumber);
  837. FieldInput.options(searchFieldNames[rowNumber]).selected = "true";
  838. displayOperatorType();
  839. OperatorType.options(searchFieldOperators[rowNumber]).selected = "true";
  840. setValueInputValue( searchFieldValues[rowNumber]);
  841. if (rowNumber == currentSearchTableRow) {
  842. setValueInputValue("");
  843. }
  844. }
  845. function highlightSearchRow(rowNumber) {
  846. if (rowNumber > currentSearchTableRow)
  847. return false;
  848. // clear current row
  849. clearSearchCriteriaRow(curSearchRowSelected);
  850. curSearchRowSelected = rowNumber;
  851. // select new row
  852. for (j=0; j < SearchTable.rows(rowNumber).cells.length; j++) {
  853. SearchTable.rows(rowNumber).cells(j).style.background="rgb(198,231,247)" ;
  854. }
  855. }
  856. //-----------------------------------------------------------------------------
  857. // clearSearchCriteriaRow(rowNumber)
  858. //
  859. //
  860. //-----------------------------------------------------------------------------
  861. function clearSearchCriteriaRow(rowNumber) {
  862. if ((rowNumber != "-1") && (rowNumber < SearchTable.rows.length))
  863. for (j=0; j < SearchTable.rows(rowNumber).cells.length; j++) {
  864. SearchTable.rows(rowNumber).cells(j).style.background="rgb(255,255,255)" ;
  865. }
  866. }
  867. //-----------------------------------------------------------------------------
  868. // removeSearchCondition()
  869. // for removing the currently selected search condition from search conditions table
  870. //-----------------------------------------------------------------------------
  871. function removeSearchCondition() {
  872. if ((currentSearchTableRow < curSearchRowSelected) || (curSearchRowSelected == "-1")) {
  873. return false;
  874. }
  875. FieldInput.disabled=false;
  876. OperatorType.disabled = false;
  877. valueInput.disabled = false;
  878. if (currentSearchTableRow == curSearchRowSelected) {
  879. for ( j = 0; j < 3; j++)
  880. SearchTable.rows(currentSearchTableRow).cells(j).innerHTML = "<BR/>";
  881. setValueInputValue("");
  882. return;
  883. }
  884. for ( i = curSearchRowSelected ; i < (currentSearchTableRow-1); i++) {
  885. searchFieldNames[i] = searchFieldNames[i+1];
  886. searchFieldOperators[i] = searchFieldOperators[i+1];
  887. searchFieldValues[i] = searchFieldValues[i+1];
  888. }
  889. for ( i = curSearchRowSelected ; i < (currentSearchTableRow); i++) {
  890. for ( j = 0; j < 3; j++)
  891. SearchTable.rows(i).cells(j).innerHTML = SearchTable.rows(i+1).cells(j).innerHTML;
  892. }
  893. if (SearchTable.rows.length > 4)
  894. SearchTable.deleteRow(SearchTable.rows.length-1);
  895. else {
  896. for ( j = 0; j < 3; j++)
  897. SearchTable.rows(currentSearchTableRow-1).cells(j).innerHTML = "<BR/>";
  898. }
  899. clearSearchCriteriaRow(curSearchRowSelected);
  900. if (curSearchRowSelected > 0) {
  901. curSearchRowSelected = curSearchRowSelected-1;
  902. }
  903. currentSearchTableRow--;
  904. if ( (currentSearchTableRow > 0) && (curSearchRowSelected >= 0) ) {
  905. FieldInput.options(searchFieldNames[curSearchRowSelected]).selected = "true";
  906. displayOperatorType();
  907. OperatorType.options(searchFieldOperators[curSearchRowSelected]).selected = "true";
  908. setValueInputValue( searchFieldValues[curSearchRowSelected]);
  909. }
  910. else {
  911. FieldInput.options(0).selected = "true";
  912. displayOperatorType();
  913. setValueInputValue("");
  914. }
  915. highlightSearchRow(curSearchRowSelected);
  916. }
  917. function getCurrentTime() {
  918. var d, currentDate = "";
  919. d = new Date();
  920. currentDate += (d.getMonth() + 1) + "/";
  921. return (d.getHours() + ":"+ d.getMinutes() + ":" + d.getSeconds() + " " + currentDate + d.getDate() + "/" + d.getYear());
  922. }
  923. function hideDrillDown() {
  924. drillDownDiv.style.height = 0;
  925. highlightRowstart=true;
  926. window.onresize () ;
  927. // give focus back to table body. However, this function may get called
  928. // when we have no data (to hide the drilldown that may have been on). So we
  929. // check to make sure we have a valid selectedRow.
  930. if ((selectedRow >= 0) && (selectedRow < TABLEBODY1.rows.length))
  931. {
  932. TABLEBODY1.focus();
  933. }
  934. }
  935. function startDrillDown(e) {
  936. highlightRowstart=false;
  937. selectRow(e);
  938. }
  939. function showDrillDown (nodeToShow) {
  940. if (nodeToShow == null) {
  941. drillDownDiv.innerHTML = "<SPAN></SPAN>" ;
  942. return ;
  943. }
  944. drillDownSelectIndexStack = new Stack();
  945. // first remove the old root if there is one.
  946. node = eelNode.XMLDocument.selectSingleNode("/INSTANCE");
  947. if (node != null) {
  948. eelNode.XMLDocument.removeChild (node) ;
  949. }
  950. // now append the passed in node
  951. eelNode.XMLDocument.appendChild (nodeToShow) ;
  952. // find and stash away the node which is the @cur one
  953. navigateNode = eelNode.XMLDocument.selectSingleNode("//@cur");
  954. initNode = eelNode.XMLDocument.selectSingleNode("//@init");
  955. // show the result.
  956. if( actionId == "EEL" ){
  957. result = eelNode.transformNode (eelDrillDownView.documentElement) ;
  958. }
  959. else {
  960. result = eelNode.transformNode (ntDrillDownView.documentElement) ;
  961. }
  962. // BUGBUG! hard coded heights. Need to figure out a better way to do this.
  963. drillDownDiv.style.height = drillDownViewHeight;
  964. drillDownDiv.innerHTML = result ;
  965. //window.onresize () ;
  966. }
  967. function Stack(){this.initStack();}
  968. function Stack_initStack(){this.A = new Array();}
  969. function Stack_IsEmpty(){return this.A.length == 0;}
  970. function Stack_length(){return this.A.length;}
  971. function Stack_Top(){return this.A[this.A.length - 1];}
  972. function Stack_Pop(){
  973. var N=this.A.length-1;
  974. var X=this.A[N]; this.A.length=N;
  975. return X;
  976. }
  977. // classical push, pushes one item only
  978. function Stack_Push(A){var N=this.A.length; this.A.length=N+1; this.A[N]=A;}
  979. // more powerful push, so S.push(A,B,C) pushes A, then B, then C
  980. function stk_push(){
  981. for(var i=0;i<stk_push.arguments.length;i++)
  982. this.A[this.A.length]=stk_push.arguments[i];
  983. }
  984. function Stack_toString(C){if(!C)C=","; return this.A.join(C);}
  985. function Stack_toArray(C){return this.A;} // somewhat dangerous; returns a _reference_
  986. // we can use functions as arguments, for instance to find stuff within a stack:
  987. function Stack_indexOf(X,f){
  988. for(var i=this.A.length-1;i>=0;i--)
  989. if(f(X,this.A[i])) return i;
  990. return -1;
  991. }
  992. // Now we install all of them as properties of the prototype:
  993. Stack.prototype.initStack = Stack_initStack;
  994. Stack.prototype.isEmpty = Stack_IsEmpty;
  995. Stack.prototype.top = Stack_Top;
  996. Stack.prototype.pop = Stack_Pop;
  997. Stack.prototype.length = Stack_length;
  998. // Stack.prototype.push = Stack_Push;
  999. // commented out in favor of the more powerful one
  1000. Stack.prototype.push = stk_push;
  1001. Stack.prototype.toString = Stack_toString;
  1002. Stack.prototype.toArray = Stack_toArray;
  1003. Stack.prototype.indexOf = Stack_indexOf;
  1004. /*
  1005. function navigateUp () {
  1006. val = new Number (navigateNode.value) ;
  1007. val += 1 ;
  1008. navigateNode.value = val.toString () ;
  1009. // show the result.
  1010. result = eelNode.transformNode (drillDownView.documentElement) ;
  1011. drillDownDiv.innerHTML = result ;
  1012. }
  1013. */
  1014. function navigatePrevious () {
  1015. val = new Number (drillDownSelectIndexStack.pop()) ;
  1016. drillDownIndexBeforeChange = val;
  1017. if( drillDownSelectIndexStack.isEmpty() ) {
  1018. initNode.value = "0" ;
  1019. }
  1020. navigateNode.value = val.toString();
  1021. // show the result.
  1022. if( actionId == "EEL" ){
  1023. result = eelNode.transformNode (eelDrillDownView.documentElement) ;
  1024. }
  1025. else {
  1026. result = eelNode.transformNode (ntDrillDownView.documentElement) ;
  1027. }
  1028. drillDownDiv.innerHTML = result ;
  1029. }
  1030. function navigateDirect () {
  1031. drillDownSelectIndexStack.push(drillDownIndexBeforeChange);
  1032. val = new Number (drillDownSelect.selectedIndex) ;
  1033. drillDownIndexBeforeChange = val;
  1034. initNode.value = "1";
  1035. navigateNode.value = val.toString();
  1036. // show the result.
  1037. if( actionId == "EEL" ){
  1038. result = eelNode.transformNode (eelDrillDownView.documentElement) ;
  1039. }
  1040. else {
  1041. result = eelNode.transformNode (ntDrillDownView.documentElement) ;
  1042. }
  1043. drillDownDiv.innerHTML = result ;
  1044. }
  1045. function navigateDown () {
  1046. drillDownSelectIndexStack.push(drillDownIndexBeforeChange);
  1047. initNode.value = "1";
  1048. val = new Number (navigateNode.value) ;
  1049. val -= 1 ;
  1050. drillDownIndexBeforeChange = val;
  1051. navigateNode.value = val.toString () ;
  1052. // show the result.
  1053. if( actionId == "EEL" ){
  1054. result = eelNode.transformNode (eelDrillDownView.documentElement) ;
  1055. }
  1056. else {
  1057. result = eelNode.transformNode (ntDrillDownView.documentElement) ;
  1058. }
  1059. drillDownDiv.innerHTML = result ;
  1060. }
  1061. function highlightButton(btn) {
  1062. btn.style.border='1 outset rgb(214,222,222)';
  1063. }
  1064. function removeHighlightButton(btn) {
  1065. btn.style.border='0';
  1066. }
  1067. function addSortField() {
  1068. var firstSelectedPosition = AvailableFieldsForSort.selectedIndex;
  1069. if (firstSelectedPosition == -1) return;
  1070. i = 0;
  1071. while ( i < AvailableFieldsForSort.options.length) {
  1072. if ( AvailableFieldsForSort.options(i).selected == true) {
  1073. selectedIndex = i;
  1074. } else {
  1075. i++;
  1076. selectedIndex = -1;
  1077. continue;
  1078. }
  1079. var newOption = customizeDiv.document.createElement("OPTION");
  1080. newOption.id= AvailableFieldsForSort.options(selectedIndex).id;
  1081. newOption.text=AvailableFieldsForSort.options(selectedIndex).text;
  1082. newOption.selected = "true";
  1083. newOption.value = "ascending";
  1084. if(selectedFieldsForSort.selectedIndex != -1)
  1085. selectedFieldsForSort.options(selectedFieldsForSort.selectedIndex).selected = false;
  1086. selectedFieldsForSort.add(newOption);
  1087. updateSortOrderType();
  1088. AvailableFieldsForSort.remove(selectedIndex);
  1089. }
  1090. doSortButton.disabled = false;
  1091. cancelSortButton.disabled = false;
  1092. resetSortButton.disabled = false;
  1093. if (firstSelectedPosition >= AvailableFieldsForSort.length) {
  1094. if (firstSelectedPosition == 0)
  1095. return;
  1096. else
  1097. firstSelectedPosition = AvailableFieldsForSort.length - 1;
  1098. }
  1099. AvailableFieldsForSort.options(firstSelectedPosition).selected = true;
  1100. }
  1101. function removeSortField() {
  1102. var firstSelectedPosition = selectedFieldsForSort.selectedIndex;
  1103. if (firstSelectedPosition === -1) {
  1104. return;
  1105. }
  1106. i = 0;
  1107. while ( i < selectedFieldsForSort.options.length) {
  1108. if ( selectedFieldsForSort.options(i).selected == true) {
  1109. selectedIndex = i;
  1110. } else {
  1111. i++;
  1112. selectedIndex = -1;
  1113. continue;
  1114. }
  1115. var newOption = customizeDiv.document.createElement("OPTION");
  1116. newOption.id= selectedFieldsForSort.options(selectedIndex).id;
  1117. newOption.text=selectedFieldsForSort.options(selectedIndex).text;
  1118. newOption.selected = "true";
  1119. var positionToInsert = 0;
  1120. for (positionToInsert = 0; positionToInsert < AvailableFieldsForSort.options.length; positionToInsert++) {
  1121. if (AvailableFieldsForSort.options(positionToInsert).text > newOption.text)
  1122. break;
  1123. }
  1124. if(AvailableFieldsForSort.selectedIndex != -1)
  1125. AvailableFieldsForSort.options(AvailableFieldsForSort.selectedIndex).selected = false;
  1126. AvailableFieldsForSort.add(newOption,positionToInsert);
  1127. selectedFieldsForSort.remove(selectedIndex);
  1128. }
  1129. doSortButton.disabled = false;
  1130. cancelSortButton.disabled = false;
  1131. resetSortButton.disabled = false;
  1132. if (firstSelectedPosition >= selectedFieldsForSort.length) {
  1133. if (firstSelectedPosition == 0)
  1134. return;
  1135. else
  1136. firstSelectedPosition = selectedFieldsForSort.length - 1;
  1137. }
  1138. selectedFieldsForSort.options(firstSelectedPosition).selected = true;
  1139. updateSortOrderType();
  1140. }
  1141. function doSorting() {
  1142. if(eventLogType[0].checked == true)
  1143. {
  1144. selectedSortEEL = selectedFieldsForSortDiv.innerHTML;
  1145. availableSortEEL = AvailableFieldsForSortDiv.innerHTML;
  1146. }
  1147. else
  1148. {
  1149. selectedSortNT = selectedFieldsForSortDiv.innerHTML;
  1150. availableSortNT = AvailableFieldsForSortDiv.innerHTML;
  1151. }
  1152. var sortFieldsListLength = selectedFieldsForSort.options.length;
  1153. sortOrderValue = "";
  1154. for ( i = 0; i < sortFieldsListLength; i++) {
  1155. if (selectedFieldsForSort.options(i).value == "ascending")
  1156. sortPrefix = "";
  1157. else
  1158. sortPrefix = "-";
  1159. if (sortOrderValue != "")
  1160. sortOrderValue = sortOrderValue + "; " ;
  1161. sortOrderValue = sortOrderValue + sortPrefix + selectedFieldsForSort.options(i).id ;
  1162. }
  1163. customizationNeedsRefresh = true;
  1164. clearSortStatesInHeader(getDataNode());
  1165. setSortStatesInHeader();
  1166. performSortingOnData(sortOrderValue);
  1167. doSortButton.disabled = true;
  1168. cancelSortButton.disabled = true;
  1169. resetSortButton.disabled = false;
  1170. }
  1171. function performSortingOnData(sortOrderValue) {
  1172. sortFieldValue = sortOrderValue;
  1173. return true;
  1174. }
  1175. function setSortStatesInHeader() {
  1176. var temp = selectedFieldsForSort.options.length
  1177. var i = 0;
  1178. var nodeToUpdate = "";
  1179. if(connectionOn != "0") {
  1180. if((connectionOn == "NT") && (eventLogType[0].checked == true))
  1181. nodeToUpdate = eelCustomizeCols;
  1182. else if((connectionOn == "EEL") && (eventLogType[1].checked == true))
  1183. nodeToUpdate = ntCustomizeCols;
  1184. else nodeToUpdate = getDataNode().selectSingleNode("/CIM");
  1185. }else
  1186. nodeToUpdate = getDataNode().selectSingleNode("/CIM");
  1187. node = nodeToUpdate.selectNodes ("Actions/INSTANCE/PROPERTY");
  1188. var len = node.length;
  1189. for( i = 0;i<len;i++)
  1190. node.item(i).setAttribute("Sort","none");
  1191. for ( i = 0; i < temp ; i++) {
  1192. node = nodeToUpdate.selectSingleNode ("Actions/INSTANCE/PROPERTY[@NAME='"+selectedFieldsForSort.options(i).id+"']");
  1193. if (node == null ) continue;
  1194. node.setAttribute("Sort", selectedFieldsForSort.options[i].value);
  1195. }
  1196. }
  1197. function cancelSortingSelection() {
  1198. if(eventLogType[0].checked == true)
  1199. {
  1200. selectedFieldsForSortDiv.innerHTML = selectedSortEEL;
  1201. AvailableFieldsForSortDiv.innerHTML = availableSortEEL;
  1202. }
  1203. else
  1204. {
  1205. selectedFieldsForSortDiv.innerHTML = selectedSortNT;
  1206. AvailableFieldsForSortDiv.innerHTML = availableSortNT;
  1207. }
  1208. resetSortButton.disabled=false;
  1209. updateSortOrderType();
  1210. }
  1211. function resetSortFields() {
  1212. if(eventLogType[0].checked == true)
  1213. {
  1214. selectedFieldsForSortDiv.innerHTML = resetSelectedSortColumnsEEL;
  1215. AvailableFieldsForSortDiv.innerHTML = resetAvailableSortColumnsEEL;
  1216. }
  1217. else
  1218. {
  1219. selectedFieldsForSortDiv.innerHTML = resetSelectedSortColumnsNT;
  1220. AvailableFieldsForSortDiv.innerHTML = resetAvailableSortColumnsNT;
  1221. }
  1222. updateSortOrderType();
  1223. doSortButton.disabled=false;
  1224. resetSortButton.disabled=true;
  1225. cancelSortButton.disabled=false;
  1226. }
  1227. function clearSortingSelectionInCustamization() {
  1228. var sortFieldsListLength = selectedFieldsForSort.options.length;
  1229. for ( i = 0; i < sortFieldsListLength; i++) {
  1230. selectedFieldsForSort.options(i).selected = true;
  1231. }
  1232. removeSortField();
  1233. }
  1234. function moveSortingFieldUp() {
  1235. var selectedIndex = selectedFieldsForSort.selectedIndex;
  1236. var numberOfFieldsSelected = 0;
  1237. if (selectedIndex < 1) return;
  1238. for ( i = 1; i < selectedFieldsForSort.options.length; i++) {
  1239. if (selectedFieldsForSort.options(i).selected == true) {
  1240. numberOfFieldsSelected++;
  1241. lastSelectedField=i;
  1242. }
  1243. }
  1244. var newOption = taskDiv.document.createElement("OPTION");
  1245. newOption.id= selectedFieldsForSort.options(selectedIndex-1).id;
  1246. newOption.text=selectedFieldsForSort.options(selectedIndex-1).text;
  1247. newOption.selected = false;
  1248. newOption.value = selectedFieldsForSort.options(lastSelectedField-1).value;
  1249. selectedFieldsForSort.add(newOption,lastSelectedField+1);
  1250. selectedFieldsForSort.remove(selectedIndex - 1);
  1251. updateSortOrderType();
  1252. doSortButton.disabled = false;
  1253. cancelSortButton.disabled = false;
  1254. resetSortButton.disabled = false;
  1255. }
  1256. function moveSortingFieldDown() {
  1257. var selectedIndex = selectedFieldsForSort.selectedIndex;
  1258. var numberOfFieldsSelected = 0;
  1259. if (selectedIndex == -1) return;
  1260. for ( i = 0; i < selectedFieldsForSort.options.length; i++) {
  1261. if (selectedFieldsForSort.options(i).selected == true) {
  1262. numberOfFieldsSelected++;
  1263. lastSelectedField = i;
  1264. }
  1265. }
  1266. if (lastSelectedField < selectedFieldsForSort.options.length-1){
  1267. var newOption = taskDiv.document.createElement("OPTION");
  1268. newOption.id= selectedFieldsForSort.options(lastSelectedField+1).id;
  1269. newOption.text=selectedFieldsForSort.options(lastSelectedField+1).text;
  1270. newOption.selected = false;
  1271. newOption.value = selectedFieldsForSort.options(lastSelectedField+1).value;
  1272. selectedFieldsForSort.add(newOption,selectedIndex);
  1273. selectedFieldsForSort.remove(lastSelectedField+2);
  1274. }
  1275. updateSortOrderType();
  1276. doSortButton.disabled = false;
  1277. cancelSortButton.disabled = false;
  1278. resetSortButton.disabled = false;
  1279. }
  1280. function disableUpDownSort() {
  1281. numberOfFieldsSelected = 0;
  1282. for (i = 0; i < selectedFieldsForSort.options.length; i++) {
  1283. if (selectedFieldsForSort.options(i).selected == true) {
  1284. if (numberOfFieldsSelected ==0) previousField=i;
  1285. if ((i-previousField)>1) {
  1286. ChooseColumnDiv.document.all.item("moveSortFieldUpButton").disabled = true;
  1287. ChooseColumnDiv.document.all.item("moveDownSortFieldButton").disabled = true;
  1288. return;
  1289. }
  1290. numberOfFieldsSelected++;
  1291. previousField=i;
  1292. }
  1293. }
  1294. ChooseColumnDiv.document.all.item("moveSortFieldUpButton").disabled = false;
  1295. ChooseColumnDiv.document.all.item("moveDownSortFieldButton").disabled = false;
  1296. updateSortOrderType();
  1297. }
  1298. function updateSortingSelectionInCustamization(name, sortPrefix) {
  1299. clearSortingSelectionInCustamization();
  1300. for (i = 0; i < AvailableFieldsForSort.options.length; i++) {
  1301. if (AvailableFieldsForSort.options(i).id == name) {
  1302. AvailableFieldsForSort.options(AvailableFieldsForSort.selectedIndex).selected = false;
  1303. AvailableFieldsForSort.options(i).selected = true;
  1304. break;
  1305. }
  1306. }
  1307. addSortField();
  1308. AvailableFieldsForSort.options(AvailableFieldsForSort.selectedIndex).selected = false;
  1309. AvailableFieldsForSort.options(0).selected = true;
  1310. if (sortPrefix == "-") {
  1311. selectedFieldsForSort.options(0).value = "descending";
  1312. SortOrderType[1].checked = true;
  1313. }
  1314. else {
  1315. selectedFieldsForSort.options(0).value = "ascending";
  1316. SortOrderType[0].checked = true;
  1317. }
  1318. if(eventLogType[0].checked == true)
  1319. {
  1320. selectedSortEEL=selectedFieldsForSortDiv.innerHTML;
  1321. availableSortEEL=AvailableFieldsForSortDiv.innerHTML;
  1322. }
  1323. else
  1324. {
  1325. selectedSortNT=selectedFieldsForSortDiv.innerHTML;
  1326. availableSortNT=AvailableFieldsForSortDiv.innerHTML;
  1327. }
  1328. }
  1329. function descendingSelected() {
  1330. if (selectedFieldsForSort.selectedIndex == -1)
  1331. return;
  1332. selectedFieldsForSort.options(selectedFieldsForSort.selectedIndex).value = "descending";
  1333. doSortButton.disabled = false ;
  1334. cancelSortButton.disabled = false ;
  1335. }
  1336. function ascendingSelected() {
  1337. if (selectedFieldsForSort.selectedIndex == -1)
  1338. return;
  1339. selectedFieldsForSort.options(selectedFieldsForSort.selectedIndex).value = "ascending";
  1340. doSortButton.disabled = false ;
  1341. cancelSortButton.disabled = false ;
  1342. }
  1343. function addChooseColumnOrderField() {
  1344. var firstSelectedPosition = AvailableFieldsForChooseColumnOrder.selectedIndex;
  1345. if (firstSelectedPosition === -1) return;
  1346. i = 0;
  1347. while ( i < AvailableFieldsForChooseColumnOrder.options.length) {
  1348. if ( AvailableFieldsForChooseColumnOrder.options(i).selected == true) {
  1349. selectedIndex = i;
  1350. } else {
  1351. i++;
  1352. selectedIndex = -1;
  1353. continue;
  1354. }
  1355. var newOption = taskDiv.document.createElement("OPTION");
  1356. newOption.id= AvailableFieldsForChooseColumnOrder.options(selectedIndex).id;
  1357. newOption.text=AvailableFieldsForChooseColumnOrder.options(selectedIndex).text;
  1358. newOption.selected = "true";
  1359. if(selectedFieldsForChooseColumnOrder.selectedIndex != -1)
  1360. selectedFieldsForChooseColumnOrder.options(selectedFieldsForChooseColumnOrder.selectedIndex).selected = false;
  1361. selectedFieldsForChooseColumnOrder.add(newOption);
  1362. AvailableFieldsForChooseColumnOrder.remove(selectedIndex);
  1363. }
  1364. doChooseColumnButton.disabled = false;
  1365. cancelChooseColumnButton.disabled = false;
  1366. resetChooseColumnButton.disabled = false;
  1367. if (firstSelectedPosition >= AvailableFieldsForChooseColumnOrder.length) {
  1368. if (firstSelectedPosition == 0)
  1369. return;
  1370. else
  1371. firstSelectedPosition = AvailableFieldsForChooseColumnOrder.length - 1;
  1372. }
  1373. AvailableFieldsForChooseColumnOrder.options(firstSelectedPosition).selected = "true";
  1374. }
  1375. function removeChooseColumnOrderField() {
  1376. var firstSelectedPosition = selectedFieldsForChooseColumnOrder.selectedIndex;
  1377. if (firstSelectedPosition === -1)
  1378. return;
  1379. i = 0;
  1380. while ( i < selectedFieldsForChooseColumnOrder.options.length) {
  1381. if ( selectedFieldsForChooseColumnOrder.options(i).selected == true) {
  1382. selectedIndex = i;
  1383. } else {
  1384. i++;
  1385. selectedIndex = -1;
  1386. continue;
  1387. }
  1388. var newOption = taskDiv.document.createElement("OPTION");
  1389. newOption.id= selectedFieldsForChooseColumnOrder.options(selectedIndex).id;
  1390. newOption.text=selectedFieldsForChooseColumnOrder.options(selectedIndex).text;
  1391. newOption.selected = "true";
  1392. var positionToInsert = 0;
  1393. for (positionToInsert = 0; positionToInsert < AvailableFieldsForChooseColumnOrder.options.length; positionToInsert++) {
  1394. if (AvailableFieldsForChooseColumnOrder.options(positionToInsert).text > newOption.text)
  1395. break;
  1396. }
  1397. if(AvailableFieldsForChooseColumnOrder.selectedIndex != -1)
  1398. AvailableFieldsForChooseColumnOrder.options(AvailableFieldsForChooseColumnOrder.selectedIndex).selected = false;
  1399. AvailableFieldsForChooseColumnOrder.add(newOption,positionToInsert);
  1400. selectedFieldsForChooseColumnOrder.remove(selectedIndex);
  1401. }
  1402. if (selectedFieldsForChooseColumnOrder.options.length == 0)
  1403. doChooseColumnButton.disabled = true;
  1404. else
  1405. doChooseColumnButton.disabled = false;
  1406. cancelChooseColumnButton.disabled = false;
  1407. resetChooseColumnButton.disabled = false;
  1408. if (firstSelectedPosition >= selectedFieldsForChooseColumnOrder.length) {
  1409. if (firstSelectedPosition == 0)
  1410. return;
  1411. else
  1412. firstSelectedPosition = selectedFieldsForChooseColumnOrder.length - 1;
  1413. }
  1414. selectedFieldsForChooseColumnOrder.options(firstSelectedPosition).selected = "true";
  1415. }
  1416. function doChooseColumnOrdering() {
  1417. var i;
  1418. var field;
  1419. updateSelectedFieldsForQuery();
  1420. if (getDataNode().selectSingleNode("/CIM/Actions/INSTANCE") == null)
  1421. return false;
  1422. customizationNeedsRefresh = true;
  1423. updateChooseColumnOrderingInHeader();
  1424. resetChooseColumnButton.disabled=false;
  1425. doChooseColumnButton.disabled = true;
  1426. cancelChooseColumnButton.disabled = true;
  1427. if(eventLogType[0].checked == true)
  1428. {
  1429. selectedChooseEEL = selectedFieldsForChooseColumnOrderDiv.innerHTML;
  1430. availableChooseEEL= AvailableFieldsForChooseColumnOrderDiv.innerHTML;
  1431. }
  1432. else
  1433. {
  1434. selectedChooseNT = selectedFieldsForChooseColumnOrderDiv.innerHTML;
  1435. availableChooseNT= AvailableFieldsForChooseColumnOrderDiv.innerHTML;
  1436. }
  1437. }
  1438. function updateChooseColumnOrderingInHeader() {
  1439. var i;
  1440. var field;
  1441. if ((connectionOn == "0") && (selectedFieldsForChooseColumnOrder.options.length == 0)) return;
  1442. var nodeToUpdate = ""
  1443. for (i = 0; i < selectedFieldsForChooseColumnOrder.options.length; i++) {
  1444. field = selectedFieldsForChooseColumnOrder.options(i).id;
  1445. var node=null;
  1446. if(connectionOn != "0") {
  1447. if((connectionOn == "NT") && (eventLogType[0].checked == true))
  1448. node = eelCustomizeCols.selectSingleNode("Actions/INSTANCE/PROPERTY[@NAME='"+field+"']");
  1449. else if((connectionOn == "EEL") && (eventLogType[1].checked == true)) {
  1450. node = ntCustomizeCols.selectSingleNode("Actions/INSTANCE/PROPERTY[@NAME='"+field+"']") ;
  1451. } else
  1452. node = getDataNode().selectSingleNode("/CIM/Actions/INSTANCE/PROPERTY[@NAME='"+field+"']") ;
  1453. } else
  1454. node = getDataNode().selectSingleNode("/CIM/Actions/INSTANCE/PROPERTY[@NAME='"+field+"']") ;
  1455. if (node == null) continue;
  1456. node.setAttribute("show", "true");
  1457. var nodeColPosition = getDataNode().createElement ("nodeColPosition") ;
  1458. nodeColPosition.text = i;
  1459. // if ( i < 10)
  1460. // nodeColPosition.text = "0" + nodeColPosition.text;
  1461. if (node.childNodes.item(0) != null)
  1462. node.removeChild(node.childNodes.item(0));
  1463. node.appendChild(nodeColPosition);
  1464. }
  1465. var count = i;
  1466. for (i = 0; i < AvailableFieldsForChooseColumnOrder.options.length; i++) {
  1467. field = AvailableFieldsForChooseColumnOrder.options(i).id ;
  1468. if(connectionOn != "0") {
  1469. if((connectionOn == "NT") && (eventLogType[0].checked == true))
  1470. node = eelCustomizeCols.selectSingleNode("Actions/INSTANCE/PROPERTY[@NAME='"+field+"']");
  1471. else if((connectionOn == "EEL") && (eventLogType[1].checked == true))
  1472. node = ntCustomizeCols.selectSingleNode("Actions/INSTANCE/PROPERTY[@NAME='"+field+"']") ;
  1473. else
  1474. node = getDataNode().selectSingleNode("/CIM/Actions/INSTANCE/PROPERTY[@NAME='"+field+"']") ;
  1475. } else
  1476. node = getDataNode().selectSingleNode("/CIM/Actions/INSTANCE/PROPERTY[@NAME='"+field+"']") ;
  1477. if (node == null) continue;
  1478. node.setAttribute("show", "false");
  1479. var nodeColPosition = getDataNode().createElement ( "nodeColPosition") ;
  1480. nodeColPosition.text = count + i;
  1481. if ( (count +i) < 10)
  1482. nodeColPosition.text = "0" + nodeColPosition.text ;
  1483. if (node.childNodes.item(0) != null)
  1484. node.removeChild(node.childNodes.item(0));
  1485. node.appendChild(nodeColPosition);
  1486. }
  1487. }
  1488. function resetChooseColumns() {
  1489. //clearChooseColumnOrderingSelectionInCustamization();
  1490. if(eventLogType[0].checked == true)
  1491. {
  1492. selectedFieldsForChooseColumnOrderDiv.innerHTML = resetSelectedChooseColumnsEEL;
  1493. AvailableFieldsForChooseColumnOrderDiv.innerHTML = resetAvailableChooseColumnsEEL;
  1494. }
  1495. else
  1496. {
  1497. selectedFieldsForChooseColumnOrderDiv.innerHTML = resetSelectedChooseColumnsNT;
  1498. AvailableFieldsForChooseColumnOrderDiv.innerHTML = resetAvailableChooseColumnsNT;
  1499. }
  1500. doChooseColumnButton.disabled=false;
  1501. cancelChooseColumnButton.disabled=false;
  1502. resetChooseColumnButton.disabled=true;
  1503. }
  1504. function clearChooseColumnOrderingSelectionInCustamization() {
  1505. var chooseColumnOrderFieldsListLength = AvailableFieldsForChooseColumnOrder.options.length;
  1506. for ( i = 0; i < chooseColumnOrderFieldsListLength; i++) {
  1507. AvailableFieldsForChooseColumnOrder.options(i).selected = true;
  1508. }
  1509. addChooseColumnOrderField();
  1510. }
  1511. function moveChooseColumnOrderFieldUp() {
  1512. var selectedIndex = selectedFieldsForChooseColumnOrder.selectedIndex;
  1513. var numberOfFieldsSelected = 0;
  1514. if (selectedIndex < 1){
  1515. return;
  1516. }
  1517. for ( i = 1; i < selectedFieldsForChooseColumnOrder.options.length; i++) {
  1518. if (selectedFieldsForChooseColumnOrder.options(i).selected == true) {
  1519. numberOfFieldsSelected++;
  1520. lastSelectedField=i;
  1521. }
  1522. }
  1523. var newOption = taskDiv.document.createElement("OPTION");
  1524. newOption.id= selectedFieldsForChooseColumnOrder.options(selectedIndex-1).id;
  1525. newOption.text=selectedFieldsForChooseColumnOrder.options(selectedIndex-1).text;
  1526. newOption.selected = false;
  1527. selectedFieldsForChooseColumnOrder.add(newOption,lastSelectedField+1);
  1528. selectedFieldsForChooseColumnOrder.remove(selectedIndex - 1);
  1529. doChooseColumnButton.disabled = false;
  1530. cancelChooseColumnButton.disabled = false;
  1531. resetChooseColumnButton.disabled = false;
  1532. }
  1533. function moveChooseColumnOrderFieldDown() {
  1534. var selectedIndex = selectedFieldsForChooseColumnOrder.selectedIndex;
  1535. var numberOfFieldsSelected = 0;
  1536. if (selectedIndex == -1) return;
  1537. for ( i = 0; i < selectedFieldsForChooseColumnOrder.options.length; i++) {
  1538. if (selectedFieldsForChooseColumnOrder.options(i).selected == true) {
  1539. numberOfFieldsSelected++;
  1540. lastSelectedField = i;
  1541. }
  1542. }
  1543. if (lastSelectedField < selectedFieldsForChooseColumnOrder.options.length-1){
  1544. var newOption = taskDiv.document.createElement("OPTION");
  1545. newOption.id= selectedFieldsForChooseColumnOrder.options(lastSelectedField+1).id;
  1546. newOption.text=selectedFieldsForChooseColumnOrder.options(lastSelectedField+1).text;
  1547. newOption.selected = false;
  1548. selectedFieldsForChooseColumnOrder.add(newOption,selectedIndex);
  1549. selectedFieldsForChooseColumnOrder.remove(lastSelectedField+2);
  1550. }
  1551. doChooseColumnButton.disabled = false;
  1552. cancelChooseColumnButton.disabled = false;
  1553. resetChooseColumnButton.disabled = false;
  1554. }
  1555. function disableUpDownChooseColumn() {
  1556. numberOfFieldsSelected = 0;
  1557. for (i = 0; i < selectedFieldsForChooseColumnOrder.options.length; i++) {
  1558. if (selectedFieldsForChooseColumnOrder.options(i).selected == true) {
  1559. if (numberOfFieldsSelected ==0) previousField=i;
  1560. if ((i-previousField)>1) {
  1561. ChooseColumnDiv.document.all.item("moveChooseColumnFieldUpButton").disabled = true;
  1562. ChooseColumnDiv.document.all.item("moveChooseColumnFieldDownButton").disabled = true;
  1563. return;
  1564. }
  1565. numberOfFieldsSelected++;
  1566. previousField=i;
  1567. }
  1568. }
  1569. moveChooseColumnFieldUpButton.disabled=false;
  1570. moveChooseColumnFieldDownButton.disabled=false;
  1571. }
  1572. function cancelChooseColumnOrderingSelection() {
  1573. if(eventLogType[0].checked == true)
  1574. {
  1575. selectedFieldsForChooseColumnOrderDiv.innerHTML = selectedChooseEEL;
  1576. AvailableFieldsForChooseColumnOrderDiv.innerHTML = availableChooseEEL;
  1577. }
  1578. else
  1579. {
  1580. selectedFieldsForChooseColumnOrderDiv.innerHTML = selectedChooseNT;
  1581. AvailableFieldsForChooseColumnOrderDiv.innerHTML = availableChooseNT;
  1582. }
  1583. resetChooseColumnButton.disabled=false;
  1584. }
  1585. function hideByteDisplay() {
  1586. drillDownDiv.document.all.dataInByteSpan.style.display= "none";
  1587. drillDownDiv.document.all.dataInByteSpan.style.visibility = "hidden";
  1588. drillDownDiv.document.all.dataInWordSpan.style.display= "inline" ;
  1589. drillDownDiv.document.all.dataInWordSpan.style.visibility = "visible";
  1590. drillDownDiv.document.all.dataInAsciiSpan.style.visibility = "hidden";
  1591. }
  1592. function hideWordDisplay() {
  1593. drillDownDiv.document.all.dataInWordSpan.style.visibility = "hidden";
  1594. drillDownDiv.document.all.dataInWordSpan.style.display = "none";
  1595. drillDownDiv.document.all.dataInByteSpan.style.display= "inline" ;
  1596. drillDownDiv.document.all.dataInByteSpan.style.visibility = "visible";
  1597. drillDownDiv.document.all.dataInAsciiSpan.style.visibility = "visible";
  1598. }
  1599. function prepareValuesList(attributeName, qualifierName) {
  1600. var qualifierValue = getQualifierValueArray(connectionOn,attributeName, "Values");
  1601. if (qualifierValue == null) return false;
  1602. qualifierArrayValues = qualifierValue.selectNodes("VALUE.ARRAY/VALUE");
  1603. //optionsStr = "<OPTION style=\"display:hidden\" id=" + qualifierArrayValues.length + ">" + "" + "</OPTION>";
  1604. optionsStr = "";
  1605. for ( i = 0; i < qualifierArrayValues.length; i++) {
  1606. optionsStr = optionsStr + "<OPTION id=\"" + i + "\" onlosecapture=\"valueMapValueSelected()\">" + qualifierArrayValues.item(i).text + "</OPTION>";
  1607. }
  1608. return optionsStr;
  1609. }
  1610. function convertValueToValueMap(attributeName, valuesValue) {
  1611. if (prevValueMapsAttrName != attributeName) {
  1612. attrValueMap = getQualifierValueArray(connectionOn,attributeName,"ValueMap" );
  1613. attrValues = getQualifierValueArray(connectionOn,attributeName,"Values" );
  1614. prevValueMapsAttrName = attributeName;
  1615. }
  1616. valueNodes = attrValues.selectNodes("VALUE.ARRAY/VALUE");
  1617. for (valueIndex = 0; valueIndex < valueNodes.length; valueIndex++) {
  1618. if (valueNodes.item(valueIndex).text == valuesValue)
  1619. break
  1620. }
  1621. if ( valueIndex == valueNodes.length) return -1;
  1622. if (attrValueMap == null) return valueIndex;
  1623. returnValue = attrValueMap.selectNodes("VALUE.ARRAY/VALUE").item(valueIndex).text;
  1624. return returnValue;
  1625. }
  1626. function prepareDropDownMenuForValueMap() {
  1627. attributeName = FieldInput.options(FieldInput.selectedIndex).value;
  1628. selectStr = "<select class=\"ValueInputClass\" name=\"valueInput\" onclick=\"valueMapValueSelected()\">";
  1629. valueMapMenu = selectStr + prepareValuesList(attributeName,"Values") + "</select>";
  1630. valueMapInputValue = "";
  1631. return valueMapMenu;
  1632. }
  1633. function valueMapValueSelected() {
  1634. return;
  1635. }
  1636. function setValueInputValue(valueInputValue) {
  1637. if (valueInput.type != "select-one")
  1638. valueInput.value = valueInputValue;
  1639. else {
  1640. valueMapInputValue = valueInputValue;
  1641. valueInput.selectedIndex = -1;
  1642. }
  1643. }
  1644. function getValueInputValue() {
  1645. if (valueInput.type != "select-one") {
  1646. var valueWithOutBlanks = removeBlankCharacters(valueInput.value, "LEADING_AND_TRAILING");
  1647. return valueWithOutBlanks;
  1648. }
  1649. else {
  1650. if (valueMapInputValue == "") {
  1651. if(valueInput.selectedIndex != -1)
  1652. return valueInput.options(valueInput.selectedIndex).text;
  1653. else
  1654. return "";
  1655. }
  1656. else if ( (valueInput.selectedIndex != -1)){
  1657. return valueMapInputValue + " OR " + valueInput.options(valueInput.selectedIndex).text;
  1658. } else
  1659. return valueMapInputValue;
  1660. }
  1661. }
  1662. function handleErrorConditionInConnection(connectionOn) {
  1663. // empty the table
  1664. NoConnectionSetup.innerText = L_NoConnectionSetup_TEXT;
  1665. searchStatus.innerText = L_NoConnectionSetup_TEXT;
  1666. selectedRow = -1;
  1667. clearDrillDown();
  1668. if (actionId == "EEL")
  1669. emptyTable("EEL",getErrorMessage());
  1670. else
  1671. emptyTable("NT",getErrorMessage());
  1672. }
  1673. function handleErrorConditionInSearch(connectionOn) {
  1674. if (actionId == "EEL")
  1675. emptyTable("EEL",getErrorMessage());
  1676. else
  1677. emptyTable("NT",getErrorMessage());
  1678. }
  1679. function saveQuery() {
  1680. saveAs.value = removeBlankCharacters(saveAs.value, "LEADING_AND_TRAILING");
  1681. if (saveAs.value == "") return;
  1682. loadQueryDisabled = true;
  1683. addAndToSearchCriteria();
  1684. // prepare xml node
  1685. queryElement = savedQueries.createElement("Query");
  1686. queryElement.setAttribute("name", saveAs.value);
  1687. queryElement.setAttribute("version", getEELSchemaVersion());
  1688. queryElement.setAttribute("time", getCurrentTime());
  1689. if (connectionOn == "NT") {
  1690. eventTypeElement = savedQueries.createElement("EventType");
  1691. eventTypeElement.setAttribute("value",EventTypeSelection.options(EventTypeSelection.selectedIndex).id);
  1692. queryElement.appendChild(eventTypeElement);
  1693. }
  1694. for ( i=0; i < currentSearchTableRow; i++) {
  1695. searchConditionElement = savedQueries.createElement("SearchCondition");
  1696. fieldElement = savedQueries.createElement("Field");
  1697. fieldElement.setAttribute("value",searchFieldNames[i]);
  1698. fieldElement.setAttribute("name",SearchTable.rows(i).cells(0).innerText );
  1699. operatorElement = savedQueries.createElement("Operator");
  1700. operatorElement.setAttribute("value",searchFieldOperators[i]);
  1701. operatorElement.setAttribute("name",SearchTable.rows(i).cells(1).innerText );
  1702. valueElement = savedQueries.createElement("Value");
  1703. valueElement.setAttribute("value",searchFieldValues[i]);
  1704. valueElement.setAttribute("name",SearchTable.rows(i).cells(2).innerText );
  1705. searchConditionElement.appendChild(fieldElement);
  1706. searchConditionElement.appendChild(operatorElement);
  1707. searchConditionElement.appendChild(valueElement);
  1708. queryElement.appendChild(searchConditionElement);
  1709. }
  1710. // attach node to file
  1711. if (connectionOn == "EEL") {
  1712. node = savedQueries.XMLDocument.selectSingleNode("EELViewerQueries/EELQueries");
  1713. }
  1714. else if (connectionOn == "NT") {
  1715. node = savedQueries.XMLDocument.selectSingleNode("EELViewerQueries/NTQueries");
  1716. }
  1717. if (node == null) return;
  1718. duplicateChild = node.selectSingleNode("Query[@name='" + saveAs.value + "']");
  1719. if (duplicateChild != null) {
  1720. node.replaceChild(queryElement, duplicateChild);
  1721. }
  1722. else {
  1723. // add the entry to Saved Queries menu
  1724. savedSearchName = createOption(" ",saveAs.value);
  1725. savedSearchName.selected = true;
  1726. for (i=0; i<savedSearches.options.length; i++) {
  1727. if (savedSearches.options(i).text > saveAs.value)
  1728. break;
  1729. }
  1730. if (i == savedSearches.options.length) {
  1731. savedSearches.options.add(savedSearchName);
  1732. node.appendChild(queryElement);
  1733. }
  1734. else {
  1735. savedSearches.options.add(savedSearchName,i);
  1736. node.insertBefore(queryElement, node.childNodes.item(i-1));
  1737. }
  1738. }
  1739. savedSearches.focus();
  1740. saveSavedQueriesXML();
  1741. loadQueryDisabled = false;
  1742. }
  1743. function loadQuery() {
  1744. if (loadQueryDisabled == true)
  1745. return;
  1746. saveAs.value = savedSearches.options(savedSearches.selectedIndex).text;
  1747. if (savedSearches.options(savedSearches.selectedIndex).text == "")
  1748. return;
  1749. clearQuery();
  1750. if (connectionOn == "EEL")
  1751. selectedQueryNode = savedQueries.XMLDocument.selectSingleNode("EELViewerQueries/EELQueries/Query[@name='" + savedSearches.options(savedSearches.selectedIndex).text + "']" );
  1752. else
  1753. selectedQueryNode = savedQueries.XMLDocument.selectSingleNode("EELViewerQueries/NTQueries/Query[@name='" + savedSearches.options(savedSearches.selectedIndex).text + "']" );
  1754. if (selectedQueryNode == null) return;
  1755. // find eventtype/logtype and set it
  1756. if (connectionOn == "NT") {
  1757. savedEventTypeValue = selectedQueryNode.selectSingleNode("EventType").getAttribute("value");
  1758. for (i = 0; i < EventTypeSelection.options.length; i++) {
  1759. if (EventTypeSelection.options(i).id == savedEventTypeValue) {
  1760. EventTypeSelection.options(i).selected = true;
  1761. }
  1762. }
  1763. }
  1764. searchConditionNodes = selectedQueryNode.selectNodes("SearchCondition");
  1765. for ( i = SearchTable.rows.length, j = searchConditionNodes.length; i <=j; i++ ) {
  1766. addNewEmptyRowToSearchTable();
  1767. }
  1768. for (i=0; i < searchConditionNodes.length; i++) {
  1769. fieldName = searchConditionNodes.item(i).selectSingleNode("Field").getAttribute("name");
  1770. fieldValue = searchConditionNodes.item(i).selectSingleNode("Field").getAttributeNode("value").nodeValue;
  1771. operatorName = searchConditionNodes.item(i).selectSingleNode("Operator").getAttribute("name");
  1772. operatorValue = searchConditionNodes.item(i).selectSingleNode("Operator").getAttribute("value");
  1773. valueName = searchConditionNodes.item(i).selectSingleNode("Value").getAttribute("name");
  1774. valueValue = searchConditionNodes.item(i).selectSingleNode("Value").getAttribute("value");
  1775. searchFieldNames[i] = new Number(fieldValue) ;
  1776. SearchTable.rows(i).cells(0).innerText = fieldName;
  1777. searchFieldOperators[i] = new Number(operatorValue);
  1778. SearchTable.rows(i).cells(1).innerText = operatorName;
  1779. searchFieldValues[i] = valueValue;
  1780. SearchTable.rows(i).cells(2).innerText = valueName;
  1781. }
  1782. currentSearchTableRow = searchConditionNodes.length;
  1783. highlightSearchRow(currentSearchTableRow);
  1784. }
  1785. function saveSavedQueriesXML() {
  1786. if ((placeOfSavedQueries == null)) {
  1787. placeOfSavedQueries = getSavedQueriesFilePath();
  1788. }
  1789. if (placeOfSavedQueries == null)
  1790. return null;
  1791. try {
  1792. kalpaxml.wmiSaveQuery (placeOfSavedQueries, savedQueries.XMLDocument.xml) ;
  1793. } catch (e) {
  1794. return null ;
  1795. }
  1796. }
  1797. function populateSavedQueriesName(connectionType) {
  1798. var savedQueryNodes;
  1799. loadQueryDisabled = true;
  1800. if (connectionType == "EEL") {
  1801. savedQueryNodes = savedQueries.XMLDocument.selectNodes("EELViewerQueries/EELQueries/Query");
  1802. }else {
  1803. savedQueryNodes = savedQueries.XMLDocument.selectNodes("EELViewerQueries/NTQueries/Query");
  1804. }
  1805. for ( i = 0; i < savedSearches.options.length; ) {
  1806. savedSearches.options.remove(savedSearches.options(i));
  1807. }
  1808. savedSearches.options.add(createOption(" ",""));
  1809. for ( i = 0; i < savedQueryNodes.length; i++) {
  1810. if (savedQueryNodes.item(i).getAttribute("version") == getEELSchemaVersion())
  1811. savedSearches.options.add(createOption(" ",savedQueryNodes.item(i).getAttribute("name")));
  1812. }
  1813. loadQueryDisabled = false;
  1814. loadQuery();
  1815. }
  1816. function addNewEmptyRowToSearchTable() {
  1817. newRow = SearchTable.insertRow();
  1818. newRow.attachEvent('onclick', searchRowSelected);
  1819. var i;
  1820. for ( i = 0; i < 3; i++) {
  1821. var newCell = newRow.insertCell();
  1822. newCell.className = "searchTableDataAlignLeft";
  1823. newCell.innerHTML = "<BR/>";
  1824. }
  1825. }
  1826. function getEELSchemaVersion() {
  1827. return "EEL_06";
  1828. }
  1829. function clearDrillDown() {
  1830. hideDrillDown();
  1831. }
  1832. function removeBlankCharacters(value,leadingOrTrailing) {
  1833. if (value == "") return value;
  1834. if ((leadingOrTrailing == "LEADING") || (leadingOrTrailing == "LEADING_AND_TRAILING")) {
  1835. indexOfNonBlank = 0;
  1836. while(value.charAt(indexOfNonBlank) == " ") {
  1837. indexOfNonBlank++;
  1838. }
  1839. value = value.substr(indexOfNonBlank,value.length);
  1840. }
  1841. if ((leadingOrTrailing == "TRAILING") || (leadingOrTrailing == "LEADING_AND_TRAILING")) {
  1842. indexOfNonBlank = value.length-1;
  1843. while(value.charAt(indexOfNonBlank) == " ") {
  1844. indexOfNonBlank--;
  1845. }
  1846. value = value.substr(0,indexOfNonBlank+1);
  1847. }
  1848. return value;
  1849. }
  1850. function updateFieldListInSearch(eventLogName) {
  1851. fieldInputLength = FieldInput.options.length;
  1852. for (j=0; j < fieldInputLength; j++) {
  1853. FieldInput.options.remove(0);
  1854. }
  1855. getFieldsList(eventLogName, "sorted","PROPERTY|EMBEDDEDPROPERTY","FieldInput");
  1856. return true;
  1857. }
  1858. function moveRow(e,change)
  1859. {
  1860. oldSelectedRow = TABLEBODY1.rows(selectedRow-1).rowIndex;
  1861. var presentScrollBarValue = scrollBar.value;
  1862. var newScrollBarValue = null;
  1863. var old_INDEX_DATA=INDEX_DATA;
  1864. if (change==PAGE_SIZE)
  1865. {
  1866. if (e=="up")
  1867. {
  1868. if(oldSelectedRow==1)
  1869. {
  1870. newScrollBarValue = Math.max(scrollBar.value-change,0);
  1871. }
  1872. newSelectedRow=1;
  1873. }
  1874. else
  1875. {
  1876. if(oldSelectedRow==PAGE_SIZE)
  1877. {
  1878. newScrollBarValue = Math.min(scrollBar.value+change,numEELRecords-PAGE_SIZE);
  1879. }
  1880. newSelectedRow=PAGE_SIZE;
  1881. }
  1882. }
  1883. else
  1884. {
  1885. //for change = 1
  1886. if (e=="up")
  1887. {
  1888. if( presentScrollBarValue!=(selectedRecord - selectedRecordIndex))
  1889. {
  1890. newScrollBarValue=Math.max(selectedRecord - selectedRecordIndex,0);
  1891. newSelectedRow=Math.max(selectedRecordIndex - change,1);
  1892. }
  1893. else
  1894. {
  1895. if(oldSelectedRow == 1)
  1896. {
  1897. newScrollBarValue = Math.max(scrollBar.value - change,0);
  1898. newSelectedRow = 1;
  1899. }
  1900. else
  1901. newSelectedRow = oldSelectedRow - 1;
  1902. }
  1903. }
  1904. else
  1905. {
  1906. if(presentScrollBarValue!=(selectedRecord - selectedRecordIndex) )
  1907. {
  1908. newScrollBarValue=Math.min(selectedRecord - selectedRecordIndex ,numEELRecords-PAGE_SIZE);
  1909. newSelectedRow=Math.min(selectedRecordIndex + change,PAGE_SIZE);
  1910. }
  1911. else
  1912. {
  1913. if(oldSelectedRow == PAGE_SIZE)
  1914. {
  1915. newScrollBarValue = Math.min(scrollBar.value + change,numEELRecords);
  1916. newSelectedRow = PAGE_SIZE;
  1917. }
  1918. else
  1919. newSelectedRow = oldSelectedRow+1;
  1920. }
  1921. }
  1922. }
  1923. if(newScrollBarValue != null)
  1924. scrollBar.value = newScrollBarValue;
  1925. selectRow(TABLEBODY1.rows(newSelectedRow-1).cells(0)) ;
  1926. //TABLEBODY1.rows(selectedRow-1).cells(0).focus();
  1927. TABLEBODY1.rows(0).cells(0).focus();
  1928. }
  1929. function test()
  1930. {
  1931. if (window.event.keyCode=="18") ctrlflag = 1;
  1932. if ((window.event.keyCode=="46")&& (ctrlflag == 0)) {removeSearchCondition();}
  1933. if ((window.event.keyCode=="46") && (ctrlflag == 1)) {clearQuery();ctrlflag=0;}
  1934. }
  1935. function enterForDrillDown(e)
  1936. {
  1937. if (window.event.keyCode=="13") startDrillDown(e);
  1938. if (window.event.keyCode=="38") moveRow("up",1);
  1939. if (window.event.keyCode=="40") moveRow("dn",1);
  1940. if (window.event.keyCode=="33") moveRow("up",PAGE_SIZE);
  1941. if (window.event.keyCode=="34") moveRow("dn",PAGE_SIZE);
  1942. if( (window.event.srcElement.className == 'tableDataAlignLeft') && (window.event.keyCode=="32"))
  1943. {
  1944. window.event.cancelBubble = true;
  1945. window.event.returnValue = false;
  1946. }
  1947. }
  1948. function getSelectedFieldsForQuery() {
  1949. return selectedFieldsForQuery;
  1950. }
  1951. function updateSelectedFieldsForQuery() {
  1952. selectedFieldsForQuery = "";
  1953. var i;
  1954. var selectedFieldsForChooseColumnOrderLength = selectedFieldsForChooseColumnOrder.options.length;
  1955. for (i = 0; i < selectedFieldsForChooseColumnOrderLength; i++) {
  1956. if (selectedFieldsForQuery != "")
  1957. selectedFieldsForQuery = selectedFieldsForQuery + ", ";
  1958. selectedFieldsForQuery = selectedFieldsForQuery + selectedFieldsForChooseColumnOrder.options(i).id;
  1959. }
  1960. }
  1961. function zeroSearchRecords()
  1962. {
  1963. selectedRow = -1;
  1964. clearDrillDown();
  1965. searchStatus.innerHTML = L_CurrentSearchNoRecords_TEXT;
  1966. setErrorMessage(L_RecordsNotFoundMessage_TEXT,"");
  1967. handleErrorConditionInSearch(connectionOn);
  1968. }
  1969. function bringUpHelp() {
  1970. currentHelpFilePath = kalpaxml.wmiGetWindir() + "\\wbem\\eelview\\help/eelviewr.chm";
  1971. helpPath = "mk:@MSITStore:" + currentHelpFilePath;
  1972. window.showHelp(helpPath);
  1973. }
  1974. function getMachineName() {
  1975. var machineNameValue = MachineName.value;
  1976. if(machineNameValue.indexOf("\\\\") == 0)
  1977. machineNameValue = machineNameValue.substr(2);
  1978. return machineNameValue;
  1979. }
  1980. <!-- ******************************************************** -->
  1981. <!-- -->
  1982. <!-- Copyright (c) 1999-2000 Microsoft Corporation -->
  1983. <!-- -->
  1984. <!-- tablview.js -->
  1985. <!-- -->
  1986. <!-- Build Type : Free -->
  1987. <!-- Build Number : 0707 -->
  1988. <!-- Build Date : 07/07/2000 -->
  1989. <!-- ******************************************************* -->