var N = (document.all) ? 0 : 1; var system = new Object(); system.mini = new Object(); system.mini_view = new Object(); system.view = new Object(); system.layersList = new Object(); system.searcher = new Object(); system.balloon = new Object(); system.layoutComponents = new Object(); system.init = function() { if (system.configOK == 0) { document.getElementById("loading_info").style.visibility = "hidden"; alert('Error: config.xml does not exist'); } else { document.getElementById("loading_info").style.visibility = "hidden"; system.body.loadingBoxShow(); if (system.numberOfMaps > 0) { system.mode = "move"; // jesli true przy kazdym generowaniu widoku ustawia wszystkie elementy na empty system.view.clearAllELements = true; system.layer_table = new Array(); // true/false - aktywna warstwa moze/nie moze byc w trybie identyfikacji system.mode_info = false; // true/false - aktywna warstwa moze/nie moze byc w trybie linkow www system.mode_wwwLinks = false; system.body.get_size(); // przypisanie zdarzen do layout'u if (window.opera) window.onscroll = function(){window.scrollTo(0, 0)}; window.oncontextmenu = emptyfunction; if (document.getElementById("elementsLayerContainer").addEventListener) document.getElementById("elementsLayerContainer").addEventListener('DOMMouseScroll', system.elementsLayer.wheel, false); document.getElementById("elementsLayerContainer").onmousewheel = system.elementsLayer.wheel; window.onresize = function(){system.scale.set(system.map_id)}; YAHOO.util.Event.addListener("miniContainer", "click", system.mini_view.MC); YAHOO.util.Event.addListener("main_body", "mouseout", system.body.mouse_out); document.getElementById('mini_view').onmouseover = function() {system.mini_view.mouseOver = true}; document.getElementById('mini_view').onmouseout = function() {system.mini_view.mouseOver = false}; system.mini_view.DD = new YAHOO.util.DD("mini_view", "", {scroll: false}); system.mini_view.DD.on("endDragEvent", system.mini_view.MU); YAHOO.util.Event.addListener("elementsLayerContainer", "dblclick", system.elementsLayer.mouseDblClick); YAHOO.util.Event.addListener("elementsLayerContainer", "click", system.elementsLayer.mouseClick); YAHOO.util.Event.addListener("elementsLayerContainer", "mousedown", system.elementsLayer.mouseDown); YAHOO.util.Event.addListener("elementsLayerContainer", "mousemove", system.elementsLayer.mouseMove); YAHOO.util.Event.addListener("elementsLayerContainer", "mouseup", system.elementsLayer.mouseUp); YAHOO.util.Event.addListener("elementsLayerContainer", "mouseout", function (){system.elementsLayer.mouseout = true}); document.getElementById("skala_select").onchange = system.scale.onchange; document.getElementById("layers_list_button").onclick = system.layersList.visibility_switch; document.getElementById("link_caption").onclick = function() {document.getElementById('link_caption').select()}; document.getElementById("link_button").onclick = function() { window.oncontextmenu = emptyfunction; document.getElementById('link_layer').style.visibility = 'hidden'; systemMODE(system.prev_mode); }; document.getElementById("button_mini").onclick = system.mini_view.switch_visibility; document.getElementById("object_button").onclick = system.identification.object_info_switch_visibility; document.getElementById("bt_move").onclick = function() {systemMODE('move')}; document.getElementById("bt_move").onmouseover = function() {buttonCHANGE('move', 'on')}; document.getElementById("bt_move").onmouseout = function() {buttonCHANGE('move', 'off')}; document.getElementById("bt_onepoint_distance").onclick = function() {systemMODE('onepoint_distance')}; document.getElementById("bt_onepoint_distance").onmouseover = function() {buttonCHANGE('onepoint_distance', 'on')}; document.getElementById("bt_onepoint_distance").onmouseout = function() {buttonCHANGE('onepoint_distance', 'off')}; document.getElementById("bt_multipoint_distance").onclick = function() {systemMODE('multipoint_distance')}; document.getElementById("bt_multipoint_distance").onmouseover = function() {buttonCHANGE('multipoint_distance', 'on')}; document.getElementById("bt_multipoint_distance").onmouseout = function() {buttonCHANGE('multipoint_distance', 'off')}; document.getElementById("bt_area").onclick = function() {systemMODE('area')}; document.getElementById("bt_area").onmouseover = function() {buttonCHANGE('area', 'on')}; document.getElementById("bt_area").onmouseout = function() {buttonCHANGE('area', 'off')}; document.getElementById("bt_info").onclick = function() {if (system.mode_info) systemMODE('info')}; document.getElementById("bt_info").onmouseover = function() {if (system.mode_info) buttonCHANGE('info', 'on')}; document.getElementById("bt_info").onmouseout = function() {if (system.mode_info) buttonCHANGE('info', 'off')}; document.getElementById("bt_www_links").onclick = function() {if (system.mode_wwwLinks) systemMODE('www_links')}; document.getElementById("bt_www_links").onmouseover = function() {if (system.mode_wwwLinks) buttonCHANGE('www_links', 'on')}; document.getElementById("bt_www_links").onmouseout = function() {if (system.mode_wwwLinks) buttonCHANGE('www_links', 'off')}; document.getElementById("bt_link").onclick = function() {systemMODE('link')}; document.getElementById("bt_link").onmouseover = function() {buttonCHANGE('link', 'on')}; document.getElementById("bt_link").onmouseout = function() {buttonCHANGE('link', 'off')}; document.getElementById("bt_zoom_plus").onmouseover = function() {buttonCHANGE('zoom_plus', 'on')}; document.getElementById("bt_zoom_plus").onmouseout = function() {buttonCHANGE('zoom_plus', 'off')}; document.getElementById("bt_zoom_plus").onclick = function() {system.scale.zoom('plus')}; document.getElementById("bt_zoom_minus").onmouseover = function() {buttonCHANGE('zoom_minus', 'on')}; document.getElementById("bt_zoom_minus").onmouseout = function() {buttonCHANGE('zoom_minus', 'off')}; document.getElementById("bt_zoom_minus").onclick = function() {system.scale.zoom('minus')}; document.getElementById("bt_enable_layers").onclick = function() { system.layersList.allonoff(1); system.view.show(); system.body.loadingBoxHide(); }; document.getElementById("bt_enable_layers").onmouseover = function() {buttonCHANGE('enable_layers', 'on')}; document.getElementById("bt_enable_layers").onmouseout = function() {buttonCHANGE('enable_layers', 'off')}; document.getElementById("bt_disable_layers").onclick = function() { system.layersList.allonoff(0); system.view.show(); system.body.loadingBoxHide(); }; document.getElementById("bt_disable_layers").onmouseover = function() {buttonCHANGE('disable_layers', 'on')}; document.getElementById("bt_disable_layers").onmouseout = function() {buttonCHANGE('disable_layers', 'off')}; document.getElementById("bt_help").onclick = function() {systemMODE('help')}; document.getElementById("bt_help").onmouseover = function() {buttonCHANGE('help', 'on')}; document.getElementById("bt_help").onmouseout = function() {buttonCHANGE('help', 'off')}; document.getElementById("layers_list_container").onmouseout = function() {system.layersList.mouseOverLayerId = -1;}; /* document.getElementById("bt_print").onclick = function() { window.open ( 'controller.php5?project_id=' + system.project_id + '&id=' + system.map_id + "," + system.layersList.actual_state_array + "," + system.view.middleRealPosX + "," + system.view.middleRealPosY + "&page_id=1002", '_blank' ) }; */ //document.getElementById("bt_print").onmouseover = function() {buttonCHANGE('print', 'on')}; //document.getElementById("bt_print").onmouseover = function() {buttonCHANGE('print', 'off')}; //document.getElementById("bt_print").onmouseout = function() {buttonCHANGE('print', 'off')}; /* var divsArray = new Array ( "main_body", "ruler", "ruler_caption", "description", "real_position", "mini_view_div", "button_mini", "object_info", "object_button", "buttons_layer", "layers_list", "elementsLayer", "loading_info", "measurement_caption", "multipoint", "searchselection", "searchselectionInner", "company", "real_position_caption", "object_info_caption", "layers_list_container", "layers_list_button" ); for (var divId in divsArray) { if (divId == 'remove' || divId == 'indexOf') {continue;} document.getElementById(divsArray[divId]).onselectstart = function() {return false}; } */ document.getElementById("main_body").onselectstart = function() {return false}; document.getElementById("description_caption").innerHTML = str_replace('\n', '
', system.view.description); for (var mapId in system.maps) { if (mapId == 'remove' || mapId == 'indexOf') {continue;} document.getElementById("skala_select").options[mapId] = new Option(system.maps[mapId].name, mapId); } document.getElementById("skala_select").options[system.map_id ].selected = true; document.getElementById("docBody").style.background = system.bgcolor; document.getElementById("main_body").style.background = system.bgcolor; document.getElementById("elementsLayer").style.background = system.bgcolor; document.getElementById("elementsLayer2").style.background = system.bgcolor; document.getElementById("elementsLayerContainer").style.background = system.bgcolor; system.searcher.initSelection(); system.layersList.build(); system.mini_view.recalculate_size(system.map_id); system.view.allow_map_change = true; system.mini_view.set_visibility(); system.identification.object_info_set_visibility(); systemMODE(system.mode); rulerSHOW(); // jesli jest wiecej skal niz 1 utworz slider if ((system.numberOfMaps - 1) > 0) { scaleSlider = new Slider (document.getElementById("scale_slider"), document.getElementById("scale_slider_input"), "vertical"); scaleSlider.setMinimum(0); scaleSlider.setMaximum(system.numberOfMaps - 1); scaleSlider.setValue(system.map_id); scaleSlider.onmouseup = function() { document.getElementById('skala_select').value = scaleSlider.getValue(); system.scale.onchange(); }; scaleSlider.onchange = function(){document.getElementById('skala_select').value = scaleSlider.getValue()}; document.getElementById('scale_area').style.visibility = "visible"; } else { document.getElementById('scale_area').style.visibility = "hidden"; } // przesuwa widok na srodek system.view.move(1,1); system.searcher.urlSearch(); system.scale.set(system.map_id); system.layersList.visibility_switch(); document.getElementById("buttons_layer").style.visibility = "visible"; document.getElementById("ruler").style.visibility = "visible"; document.getElementById("description").style.visibility = "visible"; document.getElementById("layers_list_button").style.visibility = "visible"; document.getElementById("button_mini").style.visibility = "visible"; system.helpPanel = new YAHOO.widget.Panel ("helpPanel", { width: system.body.width * 0.9, height: system.body.height * 0.9, draggable: false, // modal: true, dragOnly : true, fixedcenter: true, constraintoviewport: true, underlay: "shadow", close: true, visible: false, zIndex: 250 } ); system.helpPanel.setBody('
'); system.helpPanel.render(); system.wwwPanel = new YAHOO.widget.Panel ("wwwPanel", { width: system.body.width * 0.9, height: system.body.height * 0.9, draggable: false, // modal: true, dragOnly : true, fixedcenter: true, constraintoviewport: true, underlay: "shadow", close: true, visible: false, zIndex: 250 } ); system.wwwPanel.hideEvent.subscribe (function(){document.getElementById("wwwIframe").src = "empty.html";}, 1); system.wwwPanel.render(); system.balloon.imagesPath = system.layoutPath + 'images/balloons'; system.balloon.preloadBallonImages(); document.getElementById('btProject_' + system.project_id).className = "project-switch-button-pressed"; } else { system.body.loadingBoxHide(); alert('Projekt nie zawiera map'); } } }; system.gotoProject = function (projectId) { document.location.href = "index.php5?project_id=" + projectId + "&map_id=" + system.map_id + "&x=" + system.view.middleRealPosX + "&y=" + system.view.middleRealPosY; };//source http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml function loadjscssfile(filename, filetype){ if (filetype=="js"){ //if filename is a external JavaScript file var fileref=document.createElement('script') fileref.setAttribute("type","text/javascript") fileref.setAttribute("src", filename) } else if (filetype=="css"){ //if filename is an external CSS file var fileref=document.createElement("link") fileref.setAttribute("rel", "stylesheet") fileref.setAttribute("type", "text/css") fileref.setAttribute("href", filename) } if (typeof fileref!="undefined") document.getElementsByTagName("head")[0].appendChild(fileref) } /* balloon.js -- a DHTML library for balloon tooltips $Id: balloon.js,v 1.20 2008/05/08 03:13:09 sheldon_mckay Exp $ See http://www.gmod.org/wiki/index.php5/Popup_Balloons for documentation. Copyright (c) 2007 Sheldon McKay, Cold Spring Harbor Laboratory This balloon tooltip package and associated files not otherwise copyrighted are distributed under the MIT-style license: http://opensource.org/licenses/mit-license.php5 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. If publications result from research using this SOFTWARE, we ask that CSHL and the author be acknowledged as scientifically appropriate. */ // These global variables are necessary to avoid losing scope when //setting the balloon timeout and for inter-object communication var currentBalloonClass; var balloonIsVisible; var balloonIsSticky; var balloonInvisibleSelects; var balloonIsSuppressed; var tooltipIsSuppressed; /////////////////////////////////////////////////// // Constructor for Balloon class // // Balloon configuration // // Reset these values for custom balloon designs // /////////////////////////////////////////////////// var Balloon = function() { // handler wywolywany po utworzeniu balloona this.afterBalloonCreate = function(){return false}; this.afterSetContents = function(){return false}; this.showLoading = false; // Location of optional ajax handler that returns tooltip contents this.helpUrl = null; this.posX = 0; this.posY = 0; this.eventElement = null; this.url = ''; // maxium allowed balloon width (px) this.minWidth = 150; // minimum allowed balloon width (px) this.maxWidth = 600; // maxium allowed balloon width (px) this.minHeight = 150; // minimum allowed balloon width (px) this.maxHeight = 600; // Default tooltip text size this.balloonTextSize = '90%'; // Delay before balloon is displayed (msec) this.delayTime = 500; // If fade-in/out is allowed this.allowFade = false; // time interval for fade-in (msec) this.fadeIn = 300; // time interval for fade-out (msec) this.fadeOut = 300; // Vertical Distance from cursor location (px) this.vOffset = 0; // text-padding within the balloon (px) this.padding = 10; // How long to display mousover balloons (msec) // false = 'always on' this.displayTime = 10000; // width of shadow (space aroung whole balloon; px) // This can be zero if there is no shadow and the // edges of the balloon are also the edges of the image this.shadow = 20; // whether the balloon should have a stem this.stem = true; // The height (px) of the stem and the extent to which the // stem image should overlaps the balloon image. this.stemHeight = 32; this.stemOverlap = 3; // track the cursor every time the mouse moves document.onmousemove = this.setActiveCoordinates; // scrolling aborts unsticky balloons document.onscroll = Balloon.prototype.hideTooltip; // make balloons go away if the page is unloading or waiting // to unload. window.onbeforeunload = function(){ Balloon.prototype.hideTooltip(1); balloonIsSuppressed = true; }; if (this.isIE()) { this.suppress = true; } } ////////////////////////////////////////////////////////////////////////// // This is the function that is called on mouseover. It has a built-in // // delay time to avoid balloons popping up on rapid mouseover events // ////////////////////////////////////////////////////////////////////////// Balloon.prototype.showTooltip = function(args) { this.posX = args.posX; this.posY = args.posY; this.imagesPath = args.imagesPath; this.showLoading = args.showLoading; // images of balloon body. If the browser is IE < 7, png alpha // channels will not work. An optional alternative image can be // provided. It should have the same dimensions as the default png image this.balloonImage = this.imagesPath + '/balloon.png'; // with alpha channels this.ieImage = this.imagesPath + '/balloon_ie.png'; // indexed color, transparent background // A stem for each of the four orientations this.upLeftStem = this.imagesPath + '/up_left.png'; this.downLeftStem = this.imagesPath + '/down_left.png'; this.upRightStem = this.imagesPath + '/up_right.png'; this.downRightStem = this.imagesPath + '/down_right.png'; // A close button for sticky balloons this.closeButton = this.imagesPath + '/close.png'; this.newWindowButton = this.imagesPath + '/new_window.png'; this.eventElement = args.eventElement; // Awful IE bug, page load aborts if the balloon is fired // before the page is fully loaded. if (this.isIE() && document.readyState.match(/complete/i)) { this.suppress = false; } // All balloons have been suppressed, go no further // if (this.suppress || balloonIsSuppressed) { // return false; // } // Non-sticky balloons suppressed if (tooltipIsSuppressed && !args.sticky) { return false; } // Sorry Konqueror, no fade-in for you! if (this.isKonqueror()) this.allowFade = false; // Check for mouseover (vs. mousedown or click) //var mouseOver = evt.type.match('mouseover','i'); var mouseOver = 0; // if the firing event is a click, fade-in and a non-sticky balloon make no sense if (!mouseOver) { args.sticky = true; this.fadeOK = false; } else { this.fadeOK = this.allowFade; } // Don't fire on mouseover if a non-sticky balloon is visible if (balloonIsVisible && !balloonIsSticky && mouseOver) return false; // Don't start a non-sticky balloon if a sticky one is visible if (balloonIsVisible && balloonIsSticky && !args.sticky) return false; // Ignore repeated firing of mouseover->mouseout events on // the same element (Safari) var el = this.getEventTarget(); if (args.sticky && mouseOver && this.isSameElement(el,this.currentElement)) return false; this.firingElement = el; // A new sticky balloon can erase an old one if (args.sticky) this.hideTooltip(1); // attach a mouseout event handler to the target element var closeBalloon = function() { var override = balloonIsSticky && !balloonIsVisible; Balloon.prototype.hideTooltip(override) } if (!mouseOver) el.onmouseup = function() {return false}; el.onmouseout = closeBalloon; balloonIsSticky = args.sticky; // force balloon width and/or height if requested this.width = args.width; this.height = args.height; this.hideTooltip(); // if this is IE < 7 use an alternative image id provided if (this.isOldIE() && this.ieImage) { this.balloonImage = this.ieImage; this.ieImage = null; } // look for a url in the balloon contents if (args.caption.match(/^url:/)) { var urlArray = args.caption.split(':'); args.caption = ''; this.activeUrl = urlArray[1]; } // or if the contents are to be retrieved from an element else if (args.caption.match(/^load:/)) { var load = args.caption.split(':'); if (!document.getElementById(load[1])) alert ('problem locating element '+load[1]); args.caption = document.getElementById(load[1]).innerHTML; this.loadedFromElement = true; } // or if the text is a bare hyperlink else if (args.caption.match(/^(https?:|\/|ftp:)\S+$/i)) { this.activeUrl = args.caption; args.caption = ''; } // request the contents synchronously (ie wait for result) this.currentHelpText = this.getContents(args.caption); this.loadedFromElement = false; // Put the balloon contents and images into a visible (but offscreen) // element so they will be preloaded and have a layout to // calculate the balloon dimensions if (!this.container) { this.container = document.createElement('div'); document.body.appendChild(this.container); this.setStyle(this.container,'position','absolute'); this.setStyle(this.container,'top',-8888); this.setStyle(this.container,'display','inline'); } else { this.setStyle(this.container,'display','inline'); } // this.container.innerHTML = unescape(this.currentHelpText); this.container.innerHTML = this.currentHelpText; // Also preload the balloon images if (!this.images) { this.images = document.createElement('div'); document.body.appendChild(this.images); this.setStyle(this.images,'position','absolute'); this.setStyle(this.images,'top',-8888); this.setStyle(this.images,'display','inline'); if (this.upLeftStem) this.images.innerHTML = ''; if (this.upRightStem) this.images.innerHTML += ''; if (this.downLeftStem) this.images.innerHTML += ''; if (this.downRightStem) this.images.innerHTML += ''; this.images.innerHTML += ''; this.images.innerHTML += ''; this.images.innerHTML += ''; } else { this.setStyle(this.images,'display','none'); } currentBalloonClass = this; // Capture coordinates for mousedown or click if (!mouseOver) this.setActiveCoordinates(); // make delay time short for onmousedown var delay = mouseOver ? this.delayTime : 1; this.timeoutTooltip = window.setTimeout(this.doShowTooltip,delay); } ///////////////////////////////////////////////////////////////////// // Tooltip rendering function ///////////////////////////////////////////////////////////////////// Balloon.prototype.doShowTooltip = function() { var self = currentBalloonClass; // Stop firing if a balloon is already being displayed if (balloonIsVisible) return false; // a short delay time might cause some intereference // with fade-out window.clearTimeout(self.timeoutFade); self.setStyle('balloon','display','none'); // make sure user-configured numbers are not strings self.parseIntAll(); // create the balloon object var balloon = self.makeBalloon(); // window dimensions var pageWidth = YAHOO.util.Dom.getViewportWidth(); var pageCen = Math.round(pageWidth/2); var pageHeight = YAHOO.util.Dom.getViewportHeight(); var pageLeft = YAHOO.util.Dom.getDocumentScrollLeft(); var pageTop = YAHOO.util.Dom.getDocumentScrollTop(); var pageMid = pageTop + Math.round(pageHeight/2); // balloon orientation var vOrient = self.activeTop > pageMid ? 'up' : 'down'; var hOrient = self.activeRight > pageCen ? 'left' : 'right'; // get the preloaded balloon contents var helpText = self.container.innerHTML; self.contents.innerHTML = '
' + helpText + '
'; // how and where to draw the balloon self.setBalloonStyle(vOrient,hOrient,pageWidth,pageLeft); // sticky balloons need a close control if (balloonIsSticky) { var topRight = document.getElementById('topRight'); var margin = Math.round(self.padding/2); var top = margin + self.shadow + 2; var marginLeft = 20 - margin; topRight.innerHTML = '\ '; /* top = top + 16; topRight.innerHTML += '\ '; */ } balloonIsVisible = true; // in IE < 7, hide