/* * Copyright (c) 2006 Jonathan Weiss * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* tooltip-0.2.js - Small tooltip library on top of Prototype * by Jonathan Weiss distributed under the BSD license. * * This tooltip library works in two modes. If it gets a valid DOM element * or DOM id as an argument it uses this element as the tooltip. This * element will be placed (and shown) near the mouse pointer when a trigger- * element is moused-over. * If it gets only a text as an argument instead of a DOM id or DOM element * it will create a div with the classname 'tooltip' that holds the given text. * This newly created div will be used as the tooltip. This is usefull if you * want to use tooltip.js to create popups out of title attributes. * * * Usage: * * * * * Now whenever you trigger a mouseOver on the `trigger` element, the tooltip element will * be shown. On o mouseOut the tooltip disappears. * * Example: * * * * * * * *
* This is product 1 *
* * * * You can use my_tooltip.destroy() to remove the event observers and thereby the tooltip. */ function init(){ // wird beim Laden aufgerufen // registriert für alle sup-Tags, die nur Ziffern // enthalten, ein Klick-Ereignis var sups = document.getElementsByTagName("sup"); if (!sups) return false; for (var i = 0; i < sups.length; i++){ // sup enthält die Fußnotennummer var sup = parseInt(sups[i].id.substr(4)); if (sup != null && !isNaN(sup)){ // Beim Registrieren als Ereignis lassen sich keine // Argumente übergeben -> das Skript erzeugt für jedes // Ereignis eine Funktion new Quickbox(sups[i],''+sup+''); } } } var Quickbox = Class.create(); Quickbox.prototype = { initialize: function(element, tool_tip) { var options = Object.extend({ default_css: false, margin: "0px", padding: "5px", backgroundColor: "#FFD", min_distance_x: 5, min_distance_y: 5, delta_x: 0, delta_y: 0, zindex: 1000 }, arguments[2] || {}); this.element = $(element); this.options = options; this.blendIn = ''; this.blendOut = ''; // use the supplied tooltip element or create our own div if($(tool_tip)) { this.tool_tip = $(tool_tip); } else { this.tool_tip = $(document.createElement("div")); this.tool_tip.id = "quickbox"+tool_tip; document.body.appendChild(this.tool_tip); this.tool_tip.addClassName("tooltip"); this.tool_tip.innerHTML = "

Lade Daten

Einen Augenblick bitte...

"; new Ajax.Updater( this.tool_tip, '/2.1/servicepoint/helptexts.php', { method: 'get', parameters: 'ref='+ tool_tip+'&lang=de' } ); } // hide the tool-tip by default this.tool_tip.hide(); this.eventMouseOver = this.showQuickbox.bindAsEventListener(this); this.eventMouseOut = this.hideQuickbox.bindAsEventListener(this); this.quickboxMouseOver = this.keepQuickbox.bindAsEventListener(this); this.quickboxMouseOut = this.hideQuickbox.bindAsEventListener(this); this.registerEvents(); }, destroy: function() { Event.stopObserving(this.element, "mouseover", this.eventMouseOver); Event.stopObserving(this.element, "mouseout", this.eventMouseOut); Event.stopObserving(this.tool_tip, "mouseover", this.quickboxMouseOver); Event.stopObserving(this.tool_tip, "mouseout", this.quickboxMouseOut); }, registerEvents: function() { Event.observe(this.element, "mouseover", this.eventMouseOver); Event.observe(this.element, "mouseout", this.eventMouseOut); Event.observe(this.tool_tip, "mouseover", this.quickboxMouseOver); Event.observe(this.tool_tip, "mouseout", this.quickboxMouseOut); }, showQuickbox: function(event) { Event.stop(event); // get position var mouse_x = Event.pointerX(event); var mouse_y = Event.pointerY(event); // decide if we need to switch sides for the tooltip var dimensions = Element.getDimensions( this.tool_tip ); var element_width = dimensions.width; var element_height = dimensions.height; if ( (element_width + mouse_x) >= ( this.getWindowWidth() - this.options.min_distance_x) ){ // too big for X mouse_x = mouse_x - element_width; // apply min_distance to make sure that the mouse is not on the tool-tip mouse_x = mouse_x - this.options.min_distance_x; } else { mouse_x = mouse_x + this.options.min_distance_x; } if ( (element_height + mouse_y) >= ( this.getWindowHeight() - this.options.min_distance_y) ){ // too big for Y mouse_y = mouse_y - element_height; // apply min_distance to make sure that the mouse is not on the tool-tip mouse_y = mouse_y - this.options.min_distance_y; } else { mouse_y = mouse_y + this.options.min_distance_y; } // now set the right styles this.setStyles(mouse_x, mouse_y); clearTimeout(this.blendOut); this.blendIn = setTimeout("new Element.show($('"+this.tool_tip.id+"'))",500); }, setStyles: function(x, y){ // set the right styles to position the tool tip Element.setStyle( this.tool_tip, { position:'absolute', top:y + this.options.delta_y + "px", left:x + this.options.delta_x + "px", zindex:this.options.zindex } ); // apply default theme if wanted if (this.options.default_css){ Element.setStyle( this.tool_tip, { margin:this.options.margin, padding:this.options.padding, backgroundColor:this.options.backgroundColor, zindex:this.options.zindex } ); } }, hideQuickbox: function(event){ clearTimeout(this.blendIn); this.blendOut = setTimeout("new Element.hide($('"+this.tool_tip.id+"'))",1000); }, keepQuickbox: function(event){ clearTimeout(this.blendOut); }, getWindowHeight: function(){ var innerHeight; if (navigator.appVersion.indexOf('MSIE')>0) { innerHeight = document.body.clientHeight; } else { innerHeight = window.innerHeight; } return innerHeight; }, getWindowWidth: function(){ var innerWidth; if (navigator.appVersion.indexOf('MSIE')>0) { innerWidth = document.body.clientWidth; } else { innerWidth = window.innerWidth; } return innerWidth; } } /* * Copyright (c) 2006 Jonathan Weiss * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* tooltip-0.2.js - Small tooltip library on top of Prototype * by Jonathan Weiss distributed under the BSD license. * * This tooltip library works in two modes. If it gets a valid DOM element * or DOM id as an argument it uses this element as the tooltip. This * element will be placed (and shown) near the mouse pointer when a trigger- * element is moused-over. * If it gets only a text as an argument instead of a DOM id or DOM element * it will create a div with the classname 'tooltip' that holds the given text. * This newly created div will be used as the tooltip. This is usefull if you * want to use tooltip.js to create popups out of title attributes. * * * Usage: * * * * * Now whenever you trigger a mouseOver on the `trigger` element, the tooltip element will * be shown. On o mouseOut the tooltip disappears. * * Example: * * * * * * * *
* This is product 1 *
* * * * You can use my_tooltip.destroy() to remove the event observers and thereby the tooltip. */ function initbubbles(){ // wird beim Laden aufgerufen // registriert für alle sup-Tags, die nur Ziffern // enthalten, ein Klick-Ereignis var bubbles = document.getElementsByClassName("ministate"); if (!bubbles) return false; for (var i = 0; i < bubbles.length; i++){ if(bubbles[i].id.substr(3,5)=='staff'){ // Mitarbeiterliste //alert(bubbles[i].id.substr(8)); new Tooltip(bubbles[i],''+bubbles[i].id.substr(3)+''); } else{ // Mitarbeitersekretariat var sup = parseInt(bubbles[i].id.substr(3)); if (sup != null && !isNaN(sup)){ // Beim Registrieren als Ereignis lassen sich keine // Argumente übergeben -> das Skript erzeugt für jedes // Ereignis eine Funktion new Tooltip(bubbles[i],''+sup+''); } } } return true; } var Tooltip = Class.create(); Tooltip.prototype = { initialize: function(element, tool_tip) { var options = Object.extend({ default_css: false, margin: "0px", padding: "5px", backgroundColor: "#FFD", min_distance_x: 5, min_distance_y: 5, delta_x: 0, delta_y: 0, zindex: 1000 }, arguments[2] || {}); this.element = $(element); this.options = options; this.blendIn = ''; this.blendOut = ''; // use the supplied tooltip element or create our own div if($(tool_tip)) { this.tool_tip = $(tool_tip); } else { this.tool_tip = $(document.createElement("div")); this.tool_tip.id = "tooltip"+tool_tip; document.body.appendChild(this.tool_tip); this.tool_tip.addClassName("tooltip"); //this.tool_tip.innerHTML = "

Lade Daten

Einen Augenblick bitte...

"; } // hide the tool-tip by default this.tool_tip.hide(); this.eventMouseOver = this.showTooltip.bindAsEventListener(this); this.eventMouseOut = this.hideTooltip.bindAsEventListener(this); this.tooltipMouseOver = this.keepTooltip.bindAsEventListener(this); this.tooltipMouseOut = this.hideTooltip.bindAsEventListener(this); this.registerEvents(); }, destroy: function() { Event.stopObserving(this.element, "mouseover", this.eventMouseOver); Event.stopObserving(this.element, "mouseout", this.eventMouseOut); Event.stopObserving(this.tool_tip, "mouseover", this.tooltipMouseOver); Event.stopObserving(this.tool_tip, "mouseout", this.tooltipMouseOut); }, registerEvents: function() { Event.observe(this.element, "mouseover", this.eventMouseOver); Event.observe(this.element, "mouseout", this.eventMouseOut); Event.observe(this.tool_tip, "mouseover", this.tooltipMouseOver); Event.observe(this.tool_tip, "mouseout", this.tooltipMouseOut); }, showTooltip: function(event) { Event.stop(event); // get position var mouse_x = Event.pointerX(event); var mouse_y = Event.pointerY(event); //alert('OK '+event+' xy ='+mouse_x+'x'+mouse_y); // decide if we need to switch sides for the tooltip var dimensions = Element.getDimensions( this.tool_tip ); var element_width = dimensions.width; var element_height = dimensions.height; if ( (element_width + mouse_x) >= ( this.getWindowWidth() - this.options.min_distance_x) ){ // too big for X mouse_x = mouse_x - element_width; // apply min_distance to make sure that the mouse is not on the tool-tip mouse_x = mouse_x - this.options.min_distance_x; } else { mouse_x = mouse_x + this.options.min_distance_x; } if ( (element_height + mouse_y) >= ( this.getWindowHeight() - this.options.min_distance_y) ){ // too big for Y mouse_y = mouse_y - element_height; // apply min_distance to make sure that the mouse is not on the tool-tip mouse_y = mouse_y - this.options.min_distance_y; } else { mouse_y = mouse_y + this.options.min_distance_y; } // now set the right styles this.setStyles(mouse_x, mouse_y); clearTimeout(this.blendOut); //alert('xy = '+mouse_x+'x'+mouse_y+' => '+this.tool_tip.id.substr(7,5)); // Mitarbeiter aus der Liste if(this.tool_tip.id.substr(7,5)=='staff'){ staff_aid = this.tool_tip.id.substr(12); staff_email = $('email'+staff_aid).value; this.tool_tip.innerHTML = '

Mitarbeiter in Mitarbeitersekretariat umwandeln

'; //alert('staff=> '+this.tool_tip.innerHTML); // Mitarbeitersekretariat (Mitarbeiter-Sekretariat) /*if(this.tool_tip.innerHTML == "

Lade Daten

Einen Augenblick bitte...

")*/ }else { //alert(this.tool_tip.id); //alert('ref='+ this.tool_tip.id.substring(7)+'&lang=de'); new Ajax.Updater( this.tool_tip, '/2.1/servicepoint/include/return_staffoffice_status.inc.php', { method: 'get', parameters: 'ref='+ this.tool_tip.id.substring(7)+'&lang=de', evalScripts:true } ); //alert('status=> '+this.tool_tip.innerHTML); } this.blendIn = setTimeout("new Element.show($('"+this.tool_tip.id+"'))",900); }, setStyles: function(x, y){ // set the right styles to position the tool tip Element.setStyle( this.tool_tip, { position:'absolute', top:y + this.options.delta_y + "px", left:x + this.options.delta_x + "px", zindex:this.options.zindex } ); // apply default theme if wanted if (this.options.default_css){ Element.setStyle( this.tool_tip, { margin:this.options.margin, padding:this.options.padding, backgroundColor:this.options.backgroundColor, zindex:this.options.zindex } ); } }, hideTooltip: function(event){ clearTimeout(this.blendIn); this.blendOut = window.setTimeout("new Element.hide($('"+this.tool_tip.id+"'))",500); }, keepTooltip: function(event){ window.clearTimeout(this.blendOut); }, getWindowHeight: function(){ var innerHeight; if (navigator.appVersion.indexOf('MSIE')>0) { innerHeight = document.body.clientHeight; } else { innerHeight = window.innerHeight; } return innerHeight; }, getWindowWidth: function(){ var innerWidth; if (navigator.appVersion.indexOf('MSIE')>0) { innerWidth = document.body.clientWidth; } else { innerWidth = window.innerWidth; } return innerWidth; } } function allCheckboxOn(){ setCheckbox('cball1', 'cball', 'all'); all_checkbox = document.getElementsByClassName("cb"); for (var i = 0; i < all_checkbox.length; i++){ if($('cball1_checkbox').value=='all'){ imgname = "/2.1/images/checkbox_checked.gif" wert = all_checkbox[i].id.substr(2); }else{ imgname = "/2.1/images/checkbox.gif"; wert = ''; } //setCheckbox(all_checkbox[i].id, 'ma', all_checkbox[i].id.substr(2)); $(all_checkbox[i].id).src = imgname; $(all_checkbox[i].id+'_checkbox').value = wert; } }// function cursorStyle(which){ $('content').style.cursor = which; } window.setInterval( function(){ if(zustand != window.location.hash){ call(window.location.hash.substring(1)); } }, 500 ); // TR bzw, eine Zeile bei der Suche-Ausgabe markieren function toggleMarked(what){ if(Element.hasClassName(what, 'row_marked')){ Element.removeClassName(what, 'row_marked'); }else{ Element.addClassName(what, 'row_marked'); } } var checkUrl = function(locact){ var myAjax = new Ajax.Updater( "container", "/sp/de/include/"+locact+".inc.php", { evalScripts: true, onLoading: cursorStyle('wait'), onComplete: insertResponse, onFailure: showError } ); return false; } // Routing Faxboxen function checkOthers(who, val){ allMessageOff(); // Fehler bzw. Meldungen ausschalten error = false; x = document.getElementsByTagName('select'); for (var i = 0; i < x.length; i++){ Element.removeClassName(x[i], 'error'); if(val != ''){ if(x[i].value == val && x[i] != who && x[i].id != 'menu'){ Element.addClassName(x[i], 'error'); error = true; } } } if(error){ Element.addClassName(who, 'error'); new Insertion.Before( 'form', '

Der gewählte Mitarbeiter ist bereits einer anderen Faxbox-Nummer zugeordnet!

' ); $('main').scrollTop = "0px"; } } function saveFaxRouting(){ allMessageOff(); // Fehler bzw. Meldungen ausschalten seite = '/2.1/servicepoint/include/faxbox_assignment.inc.php'; post = 'id=1'; error = false; x = document.getElementsByTagName('select'); for (var i = 0; i < x.length; i++){ if(x[i].id != 'menu'){ post += '&'+x[i].id+'='+x[i].value; } } new Ajax.Request( seite, { postBody: post, onLoading: cursorStyle('wait'), onSuccess: function(r){ cursorStyle('auto'); if(r.responseText == "true"){ new Insertion.Before( 'form', '

Die Zuordnung der Faxboxen wurde erfolgreich gespeichert und ist in ca. fünf Minuten aktiv. Die Inhaber der Faxboxen wurden gleichzeitig per E-Mail informiert.

' ); }else{ new Insertion.Before( 'form', r.responseText, { evalScripts: true, onFailure: showError } ); } $('main').scrollTop = "0px"; }, onFailure: showError } ); return false; } function updateContractSelector(cid){ new Ajax.Updater( "quickjump", "/sp/de/include/contract_selector.inc.php", { postBody: "cid="+cid, evalScripts: true, onLoading: cursorStyle('wait'), onFailure: showError, onComplete: cursorStyle('auto') } ); return false; } // KwK-Gutschein erstellen function getGutschein(value){ new Ajax.Updater( "newdiv", "/2.1/kwk/kwk.php", { postBody: 'art='+value, evalScripts: true, onLoading: cursorStyle('wait'), onComplete: cursorStyle('auto'), onFailure: showError } ); return false; } if(window.location.hash == "" || window.location.hash == "#"){ window.location.hash = "#overview"; var zustand = "#overview"; }else{ var zustand = window.location.hash; } window.onresize = sizeIt; //