123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017 |
- // Licensed Materials - Property of IBM
- //
- // IBM Cognos Products: pps
- //
- // (C) Copyright IBM Corp. 2005, 2017
- //
- // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- /************************************/
- /* dimbar methods */
- var last_item;
- var last_on_page;
- var first_on_page;
- var DISPLAY_ALL_ITEMS = 0;
- var flyoutM = new flyoutManager();
- var wrap_images = new Array();
- var DIMBAR_FLYOUT_MIN_WIDTH = 120;
- var DIMBAR_FLYOUT_MAX_HEIGHT = 150;
- var DIMBAR_FLYOUT_MIN_RIGHT_PADDING = 20;
- var DIMBAR_FLYOUT_SCROLLBAR_PADDING = 10;
- var DIMBAR_FLYOUT_DELAY = 350;
- var DIMBAR_FLYOUT_NOT_INITIALIZED = 0;
- var DIMBAR_FLYOUT_LOADING = 1;
- var DIMBAR_FLYOUT_DISPLAYED = 2;
- var currentDimbarWrapBrowserText;
- var actionPaneDimBar = (window.name == "ActionPane");
- function hasNextSibling(item) {
- return (item && item.parentNode && item.parentNode.nextSibling);
- }
- function rollover_button(event, button ) {
- //If the right button was clicked, do not perform the action.
- var eventM = new eventManager(event);
- if (eventM.theEvent.button == 2)
- return;
- if (button.className != "dimbar-button-img-disabled")
- button.className="dimbar-button-img-rollover";
- }
- function rollout_button( button ) {
- if (button.className != "dimbar-button-img-disabled")
- button.className="dimbar-button-img";
- }
- function refresh_dimbar() {
- var button_farleft = document.getElementById("dimbar_farleft");
- if (!button_farleft)
- return;
- var button_farright = document.getElementById("dimbar_farright");
- var button_pageleft = document.getElementById("dimbar_pageleft");
- var button_pageright = document.getElementById("dimbar_pageright");
- var menuPath = topparent.getGlobal("menuImagePath");
- var farLeftDisGif = "farleft_dis.gif";
- var farRightDisGif = "farright_dis.gif";
- var farLeftGif = "farleft.gif";
- var farRightGif = "farright.gif";
- var pageLeftDisGif = "pageleft_dis.gif";
- var pageRightDisGif = "pageright_dis.gif";
- var pageLeftGif = "pageleft.gif";
- var pageRightGif = "pageright.gif";
- if ((!actionPaneDimBar && topparent.getGlobal("dimbar_wrap")) || is_item_on_page(1)) {
- if (!button_farleft.src || button_farleft.src.indexOf("/" + farLeftDisGif) < 0)
- button_farleft.src = menuPath + farLeftDisGif;
- if (!button_pageleft.src || button_pageleft.src.indexOf("/" + pageLeftDisGif) < 0)
- button_pageleft.src = menuPath + pageLeftDisGif;
- button_farleft.className = "dimbar-button-img-disabled";
- button_pageleft.className = "dimbar-button-img-disabled";
- } else {
- if (!button_farleft.src || button_farleft.src.indexOf("/" + farLeftGif) < 0)
- button_farleft.src = menuPath + farLeftGif;
- if (!button_pageleft.src || button_pageleft.src.indexOf("/" + pageLeftGif) < 0)
- button_pageleft.src = menuPath + pageLeftGif;
- button_farleft.className = "dimbar-button-img";
- button_pageleft.className = "dimbar-button-img";
- }
- if ((!actionPaneDimBar && topparent.getGlobal("dimbar_wrap")) || is_item_on_page(last_item)) {
- if (!button_farright.src || button_farright.src.indexOf("/" + farRightDisGif) < 0)
- button_farright.src = menuPath + farRightDisGif;
- if (!button_pageright.src || button_pageright.src.indexOf("/" + pageRightDisGif) < 0)
- button_pageright.src = menuPath + pageRightDisGif;
- button_farright.className = "dimbar-button-img-disabled";
- button_pageright.className = "dimbar-button-img-disabled";
- } else {
- if (!button_farright.src || button_farright.src.indexOf("/" + farRightGif) < 0)
- button_farright.src = menuPath + farRightGif;
- if (!button_pageright.src || button_pageright.src.indexOf("/" + pageRightGif) < 0)
- button_pageright.src = menuPath + pageRightGif;
- button_farright.className = "dimbar-button-img";
- button_pageright.className = "dimbar-button-img";
- }
- }
- function reflow_dimbar() {
- if (!document.getElementById("dimbar-content"))
- return;
- //get the last item
- if (!actionPaneDimBar)
- last_on_page = get_last_from_first(topparent.getGlobal("dimbar_first_item"));
- else
- last_on_page = get_last_from_first(first_on_page);
- //In case we have grown the dimbar and can fit more at the beginning.
- var best_first_item = get_first_from_last(last_on_page);
- if (actionPaneDimBar) {
- if (best_first_item < parseInt(first_on_page))
- display_items(best_first_item);
- } else {
- if (best_first_item < parseInt(topparent.getGlobal("dimbar_first_item")))
- display_items(best_first_item);
- }
- refresh_dimbar();
- }
- function init_dimbar() {
- first_on_page = 1;
-
- wrap_images["nowrap"] = new Image();
- wrap_images["nowrap"].src = topparent.getGlobal("menuImagePath") + "nowrap.gif";
- wrap_images["wrap"] = new Image();
- wrap_images["wrap"].src = topparent.getGlobal("menuImagePath") + "wrap.gif";
- last_item = document.getElementById("dimbar-content").getAttribute("num_items");
- set_item_attributes();
- set_dimbar_wrap();
- reflow_dimbar();
- }
- function set_item_attributes() {
- //quickly unhide each item so that we can set their item_width attributes
- var item = document.getElementById("dimbar_item1");
- while (item && item.getAttribute && item.getAttribute("number")) {
- item.className = "dimbar-item-table";
- item.setAttribute("item_width",item.offsetWidth);
- if (!hasNextSibling(item)) break;
- item = item.parentNode.nextSibling.firstChild;
- }
- }
- function set_dimbar_wrap() {
- var dimbar = document.getElementById("dimbar-content");
- var icon = document.getElementById("dimbar_wrap");
- if (!actionPaneDimBar && topparent.getGlobal("dimbar_wrap")) {
- display_items(DISPLAY_ALL_ITEMS);
- if (!icon.src || icon.src.indexOf("/wrap.gif") < 0)
- icon.src = wrap_images["wrap"].src;
- icon.setAttribute("title", dimbar_alt_wrap_off);
- currentDimbarWrapBrowserText = dimbar_help_wrap_off;
- dimbar.className = "dimbar-content-div-wrap";
- } else if (!actionPaneDimBar) {
- display_items(topparent.getGlobal("dimbar_first_item"));
- if (!icon.src || icon.src.indexOf("/nowrap.gif") < 0)
- icon.src = wrap_images["nowrap"].src;
- icon.setAttribute("title", dimbar_alt_wrap_on);
- currentDimbarWrapBrowserText = dimbar_help_wrap_on;
- dimbar.className = "dimbar-content-div";
- } else {
- display_items(first_on_page);
- dimbar.className = "dimbar-content-div";
- }
- // Resize the crosstab, because wrapping on/off the dimbar may change image height
- if (!actionPaneDimBar)
- doResize();
- }
- function display_items(start) {
- start = parseInt(start);
- var item = document.getElementById("dimbar_item1");
- while (item && item.getAttribute && item.getAttribute("number")) {
- if (item.getAttribute("number") < start)
- item.className = "dimbar-item-table-hidden";
- else
- item.className = "dimbar-item-table";
- if (!hasNextSibling(item)) break;
- item = item.parentNode.nextSibling.firstChild;
- }
- if (start != DISPLAY_ALL_ITEMS) {
- if (!actionPaneDimBar)
- topparent.setGlobal("dimbar_first_item",start);
- else
- first_on_page = start;
- last_on_page = get_last_from_first(start);
- }
- }
- function get_first_from_last(last_item) {
- last_item = parseInt(last_item);
- var width = document.getElementById("dimbar-content").offsetWidth;
- var totalwidth = 0;
- var item = document.getElementById("dimbar_item" + last_item);
- while (item && item.getAttribute && item.getAttribute("number") &&
- ((totalwidth + parseInt(item.getAttribute("item_width"))) <= width)) {
- totalwidth += parseInt(item.getAttribute("item_width"));
- item = document.getElementById("dimbar_item" + (parseInt(item.getAttribute("number")) - 1));
- }
- if (!item)
- return 1;
- else
- return item.parentNode.nextSibling.firstChild.getAttribute("number");
- }
- function get_last_from_first (first_item) {
- first_item = parseInt(first_item);
- var width = document.getElementById("dimbar-content").offsetWidth;
- var item = document.getElementById("dimbar_item" + first_item);
- var totalwidth = 0;
- while (item && item.getAttribute && item.getAttribute("number") &&
- ((totalwidth + parseInt(item.getAttribute("item_width"))) <= width)) {
- totalwidth += parseInt(item.getAttribute("item_width"));
- if (!hasNextSibling(item)) break;
- item = item.parentNode.nextSibling.firstChild;
- }
- if (!item || !item.getAttribute || !item.getAttribute("number"))
- return last_item;
- else
- return document.getElementById("dimbar_item" + (parseInt(item.getAttribute("number")) - 1)).getAttribute("number");
- }
- function is_item_on_page (item_num) {
- if (!actionPaneDimBar) {
- return (parseInt(topparent.getGlobal("dimbar_first_item")) <= parseInt(item_num) && parseInt(item_num) <= parseInt(last_on_page));
- } else {
- return (first_on_page <= parseInt(item_num) && parseInt(item_num) <= parseInt(last_on_page));
- }
- }
- function resetDimbarToTop() {
- var dimbar = document.getElementById("dimbar-content");
- for (var i = 0; i < dimbar.childNodes.length; i++) {
- var barItem = dimbar.childNodes[i];
- if (barItem.firstChild && barItem.firstChild.getAttribute && barItem.firstChild.tagName == "TABLE") {
- barItem = barItem.firstChild;
- var catNode = dimCache.getDimTopNode(parseInt(barItem.getAttribute("dimIdx")));
- barItem.setAttribute("category",catNode.getLabel());
- barItem.setAttribute("name",catNode.getFullName());
- barItem.setAttribute("code",catNode.getCode());
- barItem.setAttribute("alternate",false);
- barItem.setAttribute("leaf",false);
- barItem.setAttribute("ppds_id",catNode.getPPDSID());
- var span = document.getElementById("dimbar_item" + parseInt(barItem.getAttribute("number")) + "_cell").firstChild;
- var isrc = span.firstChild.childNodes[1].src;
- var iclass = span.firstChild.childNodes[1].className;
- for (var j = span.firstChild.childNodes.length - 1; j >= 0; j--) {
- span.firstChild.removeChild(span.firstChild.childNodes[j]);
- }
- span.firstChild.appendChild(document.createTextNode(catNode.getLabel()));
- insertIMGNode(span.firstChild, isrc, iclass, []);
- span.className = "dimbar-dimension-span";
- }
- }
- }
- function button_action( event, button ) {
- //If the right button was clicked, do not perform the action.
- var eventM = new eventManager(event);
- if (eventM.theEvent.button == 2)
- return;
- if (button.className != "dimbar-button-img-disabled") {
- rollout_button( button );
- if (button.id == "dimbar_reset") {
- if (!actionPaneDimBar)
- if (topparent.getGlobal("isSplitView"))
- parent.Crosstab.doit('H');
- else
- parent.Data.doit('H');
- else
- resetDimbarToTop();
- } else if (button.id == "dimbar_wrap") {
- topparent.setGlobal("dimbar_wrap",(!topparent.getGlobal("dimbar_wrap")));
- set_dimbar_wrap();
- } else if (button.id == "dimbar_farleft") {
- display_items(1);
- } else if (button.id == "dimbar_farright") {
- display_items(get_first_from_last(last_item));
- } else if (button.id == "dimbar_pageleft") {
- if (!actionPaneDimBar)
- display_items(parseInt(topparent.getGlobal("dimbar_first_item")) - 1);
- else
- display_items(first_on_page - 1);
- } else if (button.id == "dimbar_pageright") {
- display_items(get_first_from_last(parseInt(last_on_page) + 1));
- }
- refresh_dimbar();
- }
- }
- function performDimbarItemSiblingRollover(item) {
- if (!actionPaneDimBar) {
- if (item.getAttribute("type") == "up")
- item.className='dimbar-item-sibling-cell-rollover-top';
- else
- item.className='dimbar-item-sibling-cell-rollover-bottom';
- }
- }
- function doDimbarItemRollover(item) {
- item.className = "dimbar-item-cell-rollover";
- }
- function getDimensionTable(item) {
- while (item.tagName != "TABLE") {
- item = item.parentNode;
- }
- return item;
- }
- function doDimbarItemRollout(item) {
- var table = item;
- while (table.tagName != "TABLE")
- table = table.parentNode;
- if (parseInt(flyoutM.getCurrentFlyoutDim()) != parseInt(table.getAttribute("dimIdx")))
- item.className = "dimbar-item-cell";
- }
- function performDimbarItemSiblingRollout(item) {
- item.className='dimbar-item-sibling-cell';
- }
- function clearDimRollover(dim) {
- var item = document.getElementById("dimbar_item1");
- while (item && item.getAttribute && item.getAttribute("number")) {
- if (parseInt(item.getAttribute("dimIdx")) == parseInt(dim))
- document.getElementById(item.id + "_cell").className = "dimbar-item-cell";
- if (!hasNextSibling(item)) break;
- item = item.parentNode.nextSibling.firstChild;
- }
- }
- function performDimbarItemSiblingFilterPrevious(event, item) {
- var eventM = new eventManager(event);
- eventM.cancelBubble();
- if (!actionPaneDimBar) {
- var com = 'DP' + ':' + item.getAttribute("cat_id") + "," + item.getAttribute("dimIdx") + ';' + item.getAttribute("cat_code");
-
- //Since we can have more than one measure dimbar item, we have to use the number of the dimbar item not the dimIdx
- //In the creation of the command. Note: this assumes that the dimbar items are in order of dimension id.
- if (parseInt(item.getAttribute("number")) > topparent.getGlobal("gDimensionInfo").length)
- com += "\t" + (parseInt(item.getAttribute("number")) - 1);
- topparent.getXtabFrame().doit(com);
- }
- }
- function performDimbarItemSiblingFilterNext(event, item) {
- var eventM = new eventManager(event);
- eventM.cancelBubble();
- if (!actionPaneDimBar) {
- var com = 'DN' + ':' + item.getAttribute("cat_id") + "," + item.getAttribute("dimIdx") + ';' + item.getAttribute("cat_code");
- //Since we can have more than one measure dimbar item, we have to use the number of the dimbar item not the dimIdx
- //In the creation of the command. Note: this assumes that the dimbar items are in order of dimension id.
- if (parseInt(item.getAttribute("number")) > topparent.getGlobal("gDimensionInfo").length)
- com += "\t" + (parseInt(item.getAttribute("number")) - 1);
- topparent.getXtabFrame().doit(com);
- }
- }
- function doDimbarItemDragStart(item) {
- var rs = "@";
- topparent.getGlobal("dndManager").setDrag("dim" + rs + item.getAttribute("dimIdx") + rs + "level" + rs + "1" + rs + "ppds_id" + rs + item.getAttribute("ppds_id") + rs + "code" + rs + item.getAttribute("code"));
- window.event.dataTransfer.effectAllowed="all";
- }
- function preventDefault(event) {
- (new eventManager(event)).preventDefault();
- }
- function clearFlyouts() {
- if (!topparent.allFramesInitialized())
- return;
- flyoutM.clearFlyouts();
- }
- /***********************************/
- /* Flyouts */
- //Flyout cache class
- //This maintains a pointer to each flyout so they can be found through javascript.
- //all creation and deletion of Flyouts should be done through this class.
- function flyoutManager() {
-
- var flyouts = new Array();
- var topFlyout = null;
- var currentDimbarObj = null;
- this.createTopFlyout = function(obj, dimIdx) {
- if (topFlyout) {
- clearDimRollover(topFlyout.getDimIdx());
- removeFlyout(topFlyout.getId());
- }
- var category = dimCache.getCategory(dimIdx, obj.getAttribute("code"));
- if (!category) {
- category = dimCache.createCategory(dimIdx, obj.getAttribute("code"), obj.getAttribute("category"), obj.getAttribute("name"), obj.getAttribute("ppds_id"), obj.getAttribute("alternate") == "true", obj.getAttribute("leaf") == "true", obj.getAttribute("calculated") == "true", obj.getAttribute("nonselectable") == "true", obj.getAttribute("customSubset") == "true");
- }
- topFlyout = new dimbarFlyout(dimIdx, 0, category.getCode(), obj, true, 0);
- currentDimbarObj = obj;
- }
- this.createFlyout = function(parentid, dimIdx, index, firstItem) {
- var parentFlyout = getFlyout(parentid);
- var id = parentFlyout.getId() + "-" + index;
- if (!parentFlyout || getFlyout(id))
- return;
- if (parentFlyout.getChildFlyout()) {
- removeFlyout(parentFlyout.getChildFlyout().getId());
- }
- var flyout = new dimbarFlyout(dimIdx, index, parentFlyout.getCategory(index), parentFlyout, false, firstItem);
- flyouts[flyout.getId()] = flyout;
- parentFlyout.setChildFlyout(flyout);
- }
- this.displayFlyout = function(id) {
- var flyout = getFlyout(id);
- if (flyout) {
- if (flyout.tryLoad()) {
- flyout.displayContent();
- } else {
- flyout.displayLoading();
- }
- }
- }
- this.hideFlyouts = function() {
- if (topFlyout) {
- hideFlyout(topFlyout.getId());
- }
- }
- this.clearFlyouts = function() {
- if (topFlyout) {
- clearDimRollover(topFlyout.getDimIdx());
- removeFlyout(topFlyout.getId());
- topFlyout = null;
- currentDimbarObj = null;
- }
- }
- this.cancelUnloadedFlyout = function(id, index) {
- var flyoutId = id + "-" + index;
- var flyout = getFlyout(flyoutId);
- if (flyout && !flyout.isLoaded())
- removeFlyout(flyoutId);
- }
- this.clearChildFlyout = function(id) {
- var flyout = getFlyout(id);
- if (flyout.getChildFlyout()) {
- removeFlyout(flyout.getChildFlyout().getId());
- }
- }
- this.getCurrentFlyoutDim = function() {
- if (topFlyout == null) {
- return -1;
- } else {
- return topFlyout.getDimIdx();
- }
- }
- this.getCurrentDimbarObj = function() {
- return currentDimbarObj;
- }
- function hideFlyout(id) {
- if (topFlyout && topFlyout.getId() == id) {
- if (topFlyout.getChildFlyout())
- hideFlyout(topFlyout.getChildFlyout().getId());
- topFlyout.hideFlyout();
- } else {
- if (flyouts[id]) {
- if (flyouts[id].getChildFlyout()) {
- hideFlyout(flyouts[id].getChildFlyout().getId())
- }
- flyouts[id].hideFlyout();
- }
- }
- }
- function removeFlyout(id) {
- if (topFlyout && topFlyout.getId() == id) {
- if (topFlyout.getChildFlyout())
- removeFlyout(topFlyout.getChildFlyout().getId());
- topFlyout.clearFlyout();
- topFlyout = null;
- } else {
- if (flyouts[id]) {
- if (flyouts[id].getChildFlyout()) {
- removeFlyout(flyouts[id].getChildFlyout().getId())
- }
- flyouts[id].clearFlyout();
- flyouts[id] = null;
- }
- }
- }
- function getFlyout(id) {
- if (topFlyout && topFlyout.getId() == id)
- return topFlyout
- else
- return flyouts[id];
- }
- }
- //Flyout class
- function dimbarFlyout(dimIdx, idx, cat, cal, top, firstItem) {
- var category = cat;
- var flyout = null;
- var childFlyout = null;
- var items = new Array();
- var id = "flyout";
- var index = idx;
- var caller = cal;
- var topLevel = top;
- var firstItem = firstItem;
- var dimIdx = dimIdx;
- var dataLoaded = false;
- var state = DIMBAR_FLYOUT_NOT_INITIALIZED;
- var timerID;
- //Constructor
- if (!topLevel) {
- id = caller.getId() + "-" + index;
- }
- flyout = document.createElement("DIV");
- flyout.className = "dimbar_flyout";
- flyout.id = id;
- flyout_content = document.createElement("DIV");
- flyout_content.className = "dimbar_flyout_insert";
- flyout.appendChild(flyout_content);
- flyout.onmousedown = function(event) { preventNetscapeDrag(event); };
-
- //Add the flyout to the document.
- flyout.style.visibility = "hidden";
- flyout.style.top = "0px";
- flyout.style.left = "0px";
- document.body.appendChild(flyout);
- timerID = setInterval("flyoutM.displayFlyout('" + id + "')",DIMBAR_FLYOUT_DELAY);
- //Public methods
- this.getId = function() {
- return id;
- }
- this.getChildFlyout = function() {
- return childFlyout;
- }
- this.isLoaded = function() {
- return (state == DIMBAR_FLYOUT_DISPLAYED);
- }
- this.setChildFlyout = function(child) {
- childFlyout = child;
- }
- this.getFlyoutLeft = function() {
- return flyout.offsetLeft;
- }
- this.getFlyoutWidth = function() {
- return flyout.offsetWidth;
- }
- this.getCode = function() {
- return category;
- }
- this.getDimIdx = function() {
- return dimIdx;
- }
- this.getCategory = function(idx) {
- return items[idx];
- }
- this.getPage = function() {
- return page;
- }
- this.getItemTop = function(idx) {
- var topItem = getFlyoutContent().childNodes[0];
- var item = getFlyoutContent().childNodes[0];
- while (item && ((item.getAttribute("index") == null) || (item.getAttribute("index") < idx)))
- item = item.nextSibling;
- return item.offsetTop - topItem.offsetTop + flyout.offsetTop - flyout.scrollTop;
- }
- this.displayLoading = function() {
- if (state == DIMBAR_FLYOUT_NOT_INITIALIZED) {
- populateLoading();
- setFlyoutDimensions();
- setFlyoutPosition(true);
- flyout.style.visibility = "visible";
- state = DIMBAR_FLYOUT_LOADING;
- }
- }
- this.displayContent = function() {
- clearInterval(timerID);
- populateFlyout();
- setFlyoutDimensions();
- setFlyoutPosition(false);
- flyout.style.visibility = "visible";
- state = DIMBAR_FLYOUT_DISPLAYED;
- }
- this.tryLoad = function() {
- if (topLevel) {
- if (getCatNode(category).allLoaded())
- return true;
- if (!dataLoaded)
- getCatNode(category).loadAllRelated();
- } else {
- if (getCatNode(category).childrenLoaded(firstItem))
- return true;
- if (!dataLoaded)
- getCatNode(category).loadChildren();
- }
- dataLoaded = true;
- return false;
- }
- this.hideFlyout = function() {
- //This for all intents and purposes gets rid of the flyout,
- //however it leaves it in the DOM tree so it can be accessed by script.
- //Important for Drag and Drop.
- clearInterval(timerID);
- setTimeout(function() {
- flyout.style.display = "none";
- },0);
- }
- this.clearFlyout = function() {
- clearInterval(timerID);
- clearFlyoutItems();
- flyout.onmousedown = null;
- document.body.removeChild(flyout);
- flyout = null;
- }
- //Private methods
- function getFlyoutContent() {
- return flyout.firstChild;
- }
- function getCatNode(code) {
- return dimCache.getCategory(dimIdx, code);
- }
- function setFlyoutPosition(isLoading) {
- var windowWidth = document.body.offsetWidth;
- var windowHeight = document.body.offsetHeight;
- if (window.innerWidth) {
- windowWidth = window.innerWidth;
- windowHeight = window.innerHeight;
- }
- if (topLevel) {
- if (actionPaneDimBar)
- flyout.style.top = getPageOffsetTop(caller) - flyout.offsetHeight;
- else
- flyout.style.top = getPageOffsetTop(caller) + caller.offsetHeight;
- if (getPageOffsetLeft(caller) + flyout.offsetWidth < windowWidth)
- flyout.style.left = getPageOffsetLeft(caller);
- else
- flyout.style.left = windowWidth - flyout.offsetWidth;
- } else {
- if ((caller.getItemTop(index) + flyout.offsetHeight) < windowHeight)
- flyout.style.top = caller.getItemTop(index);
- else
- flyout.style.top = windowHeight - flyout.offsetHeight;
- if ((caller.getFlyoutLeft() + caller.getFlyoutWidth() + flyout.offsetWidth) < windowWidth)
- flyout.style.left = caller.getFlyoutLeft() + caller.getFlyoutWidth();
- else if (caller.getFlyoutLeft() - flyout.offsetWidth >= 0)
- flyout.style.left = caller.getFlyoutLeft() - flyout.offsetWidth;
- else {
- flyout.style.left = "0px";
- if (isLoading) {
- flyout.style.top = caller.getItemTop(index) + flyout.offsetHeight;
- }
- }
- }
- }
- function setFlyoutDimensions() {
- flyout.style.width = "0px";
- flyout.style.width = flyout.scrollWidth + DIMBAR_FLYOUT_MIN_RIGHT_PADDING;
- if (flyout.scrollHeight > DIMBAR_FLYOUT_MAX_HEIGHT) {
- flyout.style.height = DIMBAR_FLYOUT_MAX_HEIGHT;
- // since we forced scrolling we have to correct the horizontal width now
- flyout.style.width = flyout.scrollWidth + DIMBAR_FLYOUT_MIN_RIGHT_PADDING + DIMBAR_FLYOUT_SCROLLBAR_PADDING;
- }
- if (flyout.offsetWidth < DIMBAR_FLYOUT_MIN_WIDTH) {
- flyout.style.width = DIMBAR_FLYOUT_MIN_WIDTH;
- }
- }
- function populateLoading() {
- var item = document.createElement("DIV");
- item.className = "dimbar_flyout_entry";
- item.appendChild(document.createTextNode(topparent.getGlobal("gLoadingText")));
- getFlyoutContent().appendChild(item);
- }
- function clearFlyoutItems() {
- var content = getFlyoutContent();
- while (content.firstChild) {
- //Remove each function explicitly from the object to break the circular reference.
- var child = content.firstChild;
- if (child.onmouseover)
- child.onmouseover = null;
- if (child.onmouseout)
- child.onmouseout = null;
- if (child.onclick)
- child.onclick = null;
- if (child.ondragstart)
- child.ondragstart = null;
- content.removeChild(child);
- }
- }
- function populateFlyout() {
- clearFlyoutItems();
-
- var content = getFlyoutContent();
- if (topLevel) {
-
- //Get all the ancestors except the root
- var ancestors = new Array();
- if (!getCatNode(category).isTopNode()) {
- ancestors[0] = category; //treat the category as the last ancestor
- var parent = getCatNode(category).getParent();
- while (!getCatNode(parent).isTopNode()) {
- ancestors[ancestors.length] = parent;
- parent = getCatNode(parent).getParent();
- }
-
- //for each ancestor (starting at the highest) add their parents to the flyout
- var lastAncestor = ancestors.length - 1;
- while (lastAncestor >= 0) {
- var parents = getCatNode(ancestors[lastAncestor]).getParents();
- for (var i = 0; i < parents.length; i++) {
- if (!dimCache.getCategory(dimIdx, parents[i]).isCustomSubset() || !actionPaneDimBar)
- content.appendChild(createFlyoutItem(parents[i]));
- }
- //Add a separator
- content.appendChild(createFlyoutSeperator());
- //remove the ancestor from the array
- lastAncestor--;
- }
- //add the siblings
- var siblings = getCatNode(category).getSiblings();
- for (var i = 0; i < parseInt(topparent.getGlobal("childLimit")) && i < siblings.length; i++)
- if (!dimCache.getCategory(dimIdx, siblings[i]).isCustomSubset() || !actionPaneDimBar)
- content.appendChild(createFlyoutItem(siblings[i]));
- if ((getCatNode(getCatNode(category).getParent()) > parseInt(topparent.getGlobal("childLimit"))) || !getCatNode(getCatNode(category).getParent()).allChildrenLoaded()) {
- content.appendChild(createMoreItem(getCatNode(category).getParent()));
- }
- //Add a separator
- if (!getCatNode(category).isLeaf())
- content.appendChild(createFlyoutSeperator());
-
- } else { //We want one sibling (this particular one)
- content.appendChild(createFlyoutItem(category));
- if (!getCatNode(category).isLeaf())
- content.appendChild(createFlyoutSeperator());
- }
- }
-
- //add the categories children
- if (!getCatNode(category).isLeaf()) {
- var catNodes = getCatNode(category).getChildren();
- for (var i = firstItem; i < firstItem + parseInt(topparent.getGlobal("childLimit")) && i < catNodes.length; i++) {
- if (!dimCache.getCategory(dimIdx, catNodes[i]).isCustomSubset() || !actionPaneDimBar)
- content.appendChild(createFlyoutItem(catNodes[i]));
- }
- if ((getCatNode(category).getNumChildrenLoaded() > firstItem + parseInt(topparent.getGlobal("childLimit"))) || !getCatNode(category).allChildrenLoaded()) {
- content.appendChild(createMoreItem(category));
- }
- }
- }
- function createFlyoutItem(catNode) {
- var idx = items.length;
- items[idx] = catNode;
- var node = getCatNode(catNode);
- var item = document.createElement("A");
- item.className = (node.isAlternateParent()? "dimbar_flyout_entry_alternate" : "dimbar_flyout_entry");
- item.setAttribute("origClass",item.className);
- item.setAttribute("flyout",id);
- item.setAttribute("category",node.getCode());
- item.setAttribute("index",idx);
- item.setAttribute("ppdsId",node.getPPDSID());
- if (node.getParent())
- item.setAttribute("parentId",dimCache.getCategory(node.getDimension(), node.getParent()).getPPDSID());
- else
- item.setAttribute("parentId","0");
- item.setAttribute("dimIdx",node.getDimension());
- item.setAttribute("code",node.getCode());
- item.setAttribute("name",node.getLabel());
- item.setAttribute("tag",node.getFullName());
- item.setAttribute("leaf",node.isLeaf());
- item.href = "#"; //Needed to enable Drag and Drop for IE.
- var mouseOverFunc = "this.className = this.getAttribute('origClass') + ' dimbar_flyout_entry_rollover';";
- if (!node.isLeaf()) {
- mouseOverFunc += "\nflyoutM.createFlyout(this.getAttribute('flyout'), this.getAttribute('dimIdx'), parseInt(this.getAttribute('index')), 0);";
- } else {
- mouseOverFunc += "\nflyoutM.clearChildFlyout(this.getAttribute('flyout'));";
- }
- item.onmouseover = new Function(mouseOverFunc);
- var mouseOutFunc = "this.className = this.getAttribute('origClass');";
- if (!node.isLeaf()) {
- mouseOutFunc += "\nflyoutM.cancelUnloadedFlyout(this.getAttribute('flyout'), parseInt(this.getAttribute('index')));";
- }
- item.onmouseout = new Function(mouseOutFunc);
-
- if (!actionPaneDimBar) {
- item.onclick = function() {
- var com = 'DC' + ':' + this.getAttribute("ppdsId") + "," + this.getAttribute("dimIdx") + ';' + this.getAttribute("code");
- //Since we can have more than one measure dimbar item, we have to use the number of the dimbar item not the dimIdx
- //In the creation of the command. Note: this assumes that the dimbar items are in order of dimension id.
- if (parseInt(flyoutM.getCurrentDimbarObj().getAttribute("number")) > topparent.getGlobal("gDimensionInfo").length)
- com += "\t" + (flyoutM.getCurrentDimbarObj().getAttribute("number") - 1);
- topparent.getXtabFrame().doit(com);
- }
- } else {
- item.onclick = function() {
- handleDimbarClick(this);
- }
- }
- item.ondragstart = function() {
- flyoutM.hideFlyouts();
- var rs = "@";
- topparent.getGlobal("dndManager").setDrag("dim" + rs + this.getAttribute("dimIdx") + rs + "level" + rs + "1" + rs + "ppds_id" + rs + this.getAttribute("ppdsId") + rs + "code" + rs + this.getAttribute("code") + rs + "parentId" + rs + this.getAttribute("parentId"));
- window.event.dataTransfer.effectAllowed="all";
- }
- if (!node.isLeaf()) {
- insertIMGNode(item, topparent.getGlobal("menuImagePath") + "arrow.right.png", "dimbar_flyout_arrow", []);
- }
- var currentLabel = node.getLabel();
- var hiddenForm = topparent.getXtabFrame().document.fhidden;
- if (hiddenForm && hiddenForm.SHN != "undefined" && hiddenForm.SHN != null && hiddenForm.SHN.value == 1) {
- currentLabel = node.getFullName();
- }
- item.appendChild(document.createTextNode(currentLabel));
- return item;
- }
- function createFlyoutSeperator() {
- var sep = document.createElement("DIV");
- sep.className = "dimbar-flyout-separator";
- return sep;
- }
- function createMoreItem(parent) {
- var idx = items.length;
- items[idx] = parent;
- var item = document.createElement("A");
- item.className = "dimbar_flyout_entry";
- item.setAttribute("origClass",item.className);
- item.setAttribute("flyout",id);
- item.setAttribute("index",idx);
- item.setAttribute("dimIdx",dimIdx);
- item.setAttribute("firstItem",firstItem + parseInt(topparent.getGlobal("childLimit")));
- var mouseOverFunc = "this.className = this.getAttribute('origClass') + ' dimbar_flyout_entry_rollover';";
- mouseOverFunc += "\nflyoutM.createFlyout(this.getAttribute('flyout'), this.getAttribute('dimIdx'), parseInt(this.getAttribute('index')), parseInt(this.getAttribute('firstItem')));";
- item.onmouseover = new Function(mouseOverFunc);
- var mouseOutFunc = "this.className = this.getAttribute('origClass');";
- mouseOutFunc += "\nflyoutM.cancelUnloadedFlyout(this.getAttribute('flyout'), parseInt(this.getAttribute('index')));";
- item.onmouseout = new Function(mouseOutFunc);
- insertIMGNode(item, topparent.getGlobal("menuImagePath") + "arrow.right.png", "dimbar_flyout_arrow", []);
- item.appendChild(document.createTextNode(topparent.getGlobal("gMoreText")));
- return item;
- }
- }
- function getPageOffsetLeft(obj) {
- var left = obj.offsetLeft;
- var oParent = obj.offsetParent;
- while (oParent) {
- left += oParent.offsetLeft;
- oParent = oParent.offsetParent;
- }
- return left;
- }
- function getPageOffsetTop(obj) {
- var top = obj.offsetTop;
- var oParent = obj.offsetParent;
- while (oParent) {
- top += oParent.offsetTop;
- oParent = oParent.offsetParent;
- }
- return top;
- }
- function toggleDimTip(obj, showalt, hidealt) {
- if (topparent.getGlobal("treeVisible"))
- obj.alt = hidealt;
- else
- obj.alt = showalt;
- }
- function toggleTree(event, obj) {
-
- if (topparent.getGlobal("treeVisible")) {
- topparent.closeTreeFrame();
- }
- else {
- topparent.openTreeFrame();
- }
- if (event) {
- var eventM = new eventManager(event);
- eventM.cancelBubble();
- }
-
- // Update toolbar icons to show the new tree state
- if (topparent.getGlobal('is_dashboard'))
- topparent.updateToolbar();
- }
- function setToggleTreeIconOpen() {
- var img = document.getElementById("hideShowTree");
- if (img)
- img.src = topparent.getGlobal("imgPath") + "close_tab.gif";
- }
- function setToggleTreeIconClosed() {
- var img = document.getElementById("hideShowTree");
- if (img)
- img.src = topparent.getGlobal("imgPath") + "open_tab.gif";
- }
|