summarybar.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /********************************************************************************************************************************
  2. * Licensed Materials - Property of IBM *
  3. * *
  4. * IBM Cognos Products: AGS *
  5. * *
  6. * (C) Copyright IBM Corp. 2005, 2008 *
  7. * *
  8. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. *
  9. *********************************************************************************************************************************/
  10. //define the summary menu
  11. var summaryBarMenu = null;
  12. /*
  13. The call to this is done in the onmouseup event only.
  14. We cannot put in the function below. Because the function
  15. below can be called by the observer. called when the
  16. mouseup is fired on the summaryBarMenu drop down
  17. These functions are called in order:
  18. removeSummaryBarTasksMenuListener()
  19. showSummaryBarTasksMenu(event);
  20. summaryBar_cancelBub(event);
  21. */
  22. function removeSummaryBarTasksMenuListener() {
  23. parent.document.body.getWndObserver().removeListener(summaryBarMenu);
  24. }
  25. function showSummaryBarTasksMenu(event) {
  26. if (!summaryBarMenu) {
  27. initSummaryMenu();
  28. }
  29. if (summaryBarMenu.isVisible()) {
  30. summaryBarMenu.remove();
  31. if (parent.document.body.getWndObserver) {
  32. parent.document.body.getWndObserver().removeWhenDone(summaryBarMenu);
  33. }
  34. } else {
  35. //Must always be first to be able to delete the marked observer, before it shows it.
  36. if (parent.document.body.getWndObserver) {
  37. //Notify parent that mouseup occured. This is so that when
  38. //summaryBarMenu drop down is clicked any open menus are closed.
  39. parent.document.body.getWndObserver().notify(summaryBarMenu,"mouseup");
  40. //add summaryBarMenu as a listener so that the top level frame will call
  41. //this function when it receives a mouseup event
  42. parent.document.body.getWndObserver().addListener(summaryBarMenu, showSummaryBarTasksMenu, "mouseup");
  43. }
  44. summaryBarMenu.draw();
  45. summaryBarMenu.show();
  46. }
  47. }
  48. function summaryBar_cancelBub(evt)
  49. {
  50. //get the event in a cross-browser fashion
  51. evt = (evt) ? evt : ((event) ? event : null);
  52. //prevent the click from proceeding to other nodes
  53. if (typeof evt.cancelBubble != 'undefined')
  54. {
  55. evt.cancelBubble = true;
  56. }
  57. if (typeof evt.stopPropagation != 'undefined')
  58. {
  59. evt.stopPropagation();
  60. }
  61. }