/* Utility to strip the path from a pathname. EXAMPLE: getFilename('../../theater-studium.html') yields: 'theater-studium.html' */ function getFilename(fname) { // parameter check idxa=fname.lastIndexOf('/')+1; idxc=fname.lastIndexOf('\\')+1; //' idxa=(idxc>idxa) ? idxc : idxa; idxb=fname.length; if (idxa>=idxb) { alert('Parameter fehlerhaft (getFilename() in base2.js): '+fname+' Datei: '+location.pathname+' Useragent: '+navigator.userAgent); return ''; } // strip path return fname.substring(idxa,idxb); } /* Utility to extract the base of the specified file name. EXAMPLE: getBasename('../musik-studium-fs.html','-fs.htm') yields: 'musikstudium' REQUIREMENTS: must contain suffix */ function getBasename(fname,suffix) { // parameter check idxa=fname.lastIndexOf('/')+1; idxb=fname.indexOf(suffix); if (idxa>=idxb) { alert('Parameter fehlerhaft (getBasename() in base2.js): '+fname+' Suffix: '+suffix+' Datei: '+location.pathname); return ''; } // extract base name from file name and remove dashes return SucheErsetze(fname.substring(idxa,idxb),'-',''); } function completePath(p) { // check if the path ends with a slash (p.e. /theater/tas/) if (p.length>0) { if (p.substring(p.length-1,p.length)=='/') { newp=p+'index.html';} else { newp=p;} } else {newp='index.html';} return newp; } function isAbsolute(p) { if (p.length>0) { return (p.substring(0,1)=='/'); } else {return false;} } function nav(a,b) {} function nav2(pageid,parentid,dept) {} function open_popup(file, popupName, options) { var defaultOptions= "location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no,dependent=yes"; var theOptions= options + defaultOptions; if (options.indexOf('width') == -1) { theOptions+= ",width=500"; } //alert(theOptions); return window.open(file, popupName, theOptions); } function openHelp(path) { open_popup(path, 'hilfe', 'width=550,height=500,'); } function open_sitemanager(file, popupName) { calcWindowOffsets(); // variables for window position calculation var maxWidth= 360; // maximum width of the window var minWidth= 200; // minimum width of the window var width; // inner width of window var height; // inner height of window var pos_x; // left corner coordinate of window var pos_y; // top corner coordinate of window // calc width of main window. apply constraints for minimal and maximal width. width= Math.min(maxWidth, Math.floor(availWidth / 4.5)); width= Math.max(minWidth, width); var outer_width= width + winXOfs; // outer width of window height= availHeight - winYOfs; // inner height of window (not including title bar p.e.) pos_x= availWidth - outer_width; // outer coordinate pos_y= topOfsY; var options=''; window.open( file, popupName, options + "top=" + pos_y + ",left=" + pos_x + ",width=" + width + ",height=" + height + ",location=no,menubar=no,resizable=yes," + "scrollbars=yes,status=no,toolbar=no,dependent=yes" ); } var winXOfs; // combined width of left and right stuff around inner browser area (window border) OS and browser dependent! var winYOfs; // combined height of top and bottom stuff around inner browser area (window title bar and border) OS and browser dependent! var availHeight; var availWidth; var topOfsY; // top offset (for mac os x, p.e.) /** calculate window offsets */ function calcWindowOffsets() { if (FFOX) { winXOfs= 8; winYOfs= 34; } else if (IE) { if (isWin && OSVersion == 'XP') { // win xp // window title bars with win xp theme applied are a good deal larger than with w2k theme winXOfs= 10; winYOfs= 38; } else if (isWin && (OSVersion == '2000' || OSVersion == '98')) { // win 2k or 98 winXOfs= 12; winYOfs= 28; } else if (isWin) { // other windows os's winXOfs= 10; winYOfs= 38; // FIXME: Concerning IE on Mac OS, I cannot tell MacOS9 from MacOSX right now. // } else if (OS == 'Mac' && OSVersion == 'X') { // // mac os x // winXOfs= 5; // winYOfs= 52; } else if (isMac) { // all mac os's winXOfs= 30; winYOfs= 35; } else { // other os's winXOfs= 10; winYOfs= 38; } } else if (NS6plus) { if (isWin && OSVersion == 'XP') { // win xp winXOfs= 12; winYOfs= 36; } else if (isWin && (OSVersion == '2000' || OSVersion == '98')) { // win 2k or 98 winXOfs= 10; winYOfs= 30; } else if (isWin) { // other windows os's winXOfs= 12; winYOfs= 36; } else if (isMac && OSVersion == 'X') { // mac os x winXOfs= 4; winYOfs= 40; } else if (isMac) { // other mac os's winXOfs= 15; winYOfs= 32; } else if (isLinux) { // linux winXOfs= 10; winYOfs= 30; } else { // other os's winXOfs= 12; winYOfs= 36; } } else if (SAF && isMac) { winXOfs= 5; winYOfs= 27; } else if (KONQ) { winXOfs= 14; winYOfs= 34; } else { // other browsers winXOfs=12; winYOfs=38; } // note about window positioning: // window position coordinates in ie are absolute; i.e. // if the taskbar is at the left side of the screen, a window // positioned at x coordinate 0 occupies the same space as the taskbar. // Whereas in Opera and Mozilla based browsers, the coordinates are relative. // availHeight and availWidth are always correct in ie, // but show wrong results in mozilla based browsers under windows // when taskbar is non standard (more than one row of icons or positioning // other than at the bottom or top of the screen. // in mac os x: // window positioning in the vertical works like this: // coordinates are absolute beginning on the first pixel row on the screen (in the menu bar). // windows are automatically moved down so that they don't bite the menu bar. if (isMac && OSVersion == 'X') { topOfsY= 22; } else { topOfsY= 0; } availHeight= screen.availHeight - topOfsY; availWidth= screen.availWidth; } function condtext(pre, post, text) { if (text.length<=0) return ''; return pre + text + post; } function hmtfw_htmlspecialchars(str) { if (typeof(str) == "string") { str= str.replace(/&/g, "&"); str= str.replace(/"/g, """); str= str.replace(/'/g, "'"); str= str.replace(//g, ">"); } return str; } /* Copyright 2004 Patrick R. Michaud (pmichaud@pobox.com) The function insMarkup() is part of PmWiki; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See pmwiki.php for full details. This file provides Javascript functions to support WYSIWYG-style editing. The concepts are borrowed from the editor used in Wikipedia, but the code has been rewritten from scratch to integrate better with PHP and PmWiki's codebase. The code has been modified by www.zhdk.ch */ function insMarkup(areaobj, mopen, mclose, mtext, mtextpre, mtextpost) { if (areaobj.setSelectionRange > '') { var p0 = areaobj.selectionStart; var p1 = areaobj.selectionEnd; var top = areaobj.scrollTop; var str = mtext; var cur0 = p0 + mopen.length; var cur1 = p0 + mopen.length + str.length; while (p1 > p0 && areaobj.value.substring(p1-1, p1) == ' ') p1--; if (p1 > p0) { str = condtext(mtextpre, mtextpost, areaobj.value.substring(p0, p1)); cur0 = p0 + mopen.length + str.length + mclose.length; cur1 = cur0; } areaobj.value = areaobj.value.substring(0,p0) + mopen + str + mclose + areaobj.value.substring(p1); areaobj.focus(); areaobj.selectionStart = cur0; areaobj.selectionEnd = cur1; areaobj.scrollTop = top; } else if (document.selection) { var str = condtext(mtextpre, mtextpost, document.selection.createRange().text); if (str == '') str = mtext; areaobj.focus(); document.selection.createRange().text = mopen + str + mclose; } else { areaobj.value += mopen + mtext + mclose; } jQuery(areaobj).trigger('input'); return; } function watchit(url) { alert('Die Abo-Funktion wird Ihnen kostenlos von ChangeNotes.com zur Verfügung gestellt. \nBeachten Sie bitte, dass wir keine Garantie für die korrekte Funktion dieses Dienstes übernehmen.'); watchitWin = window.open( 'http://www.changenotes.com/addapage.php?url='+encodeURIComponent(document.location), 'watchitWindow', 'scrollbars=yes,resizable=yes,toolbar=no,directories=no,status=no,menubar=no,height=550,width=600' ); watchitWin.focus(); return false; } var mailcollector_window; var bail_out; var wait_bail_out; var interval_handle; var timeout_bail_out; var old_img_name; var new_img_name; function hmtfw_ping_window(reference) { var successful= true; try { reference.hmtfw_ping(); } catch(e) { successful= false; }; if (successful) { return reference; } else { return null; } } function hmtfw_get_mailcollector_options() { calcWindowOffsets(); // variables for window position calculation var exactWidth= 360; // exact width of the window var exactHeight= 225; // exact height of the window var width; // inner width of window var height; // inner height of window var pos_x; // left corner coordinate of window var pos_y; // top corner coordinate of window width= exactWidth; var outer_width= width + winXOfs; // outer width of window height= exactHeight + winYOfs; // inner height of window (not including title bar p.e.) var outer_height= height; // outer height of window // placement values: // 0: automatic (place it where there is space) // 1: upper right corner var placement= 0; // place it where there is space switch (placement) { case 0: var parent_pos_x; var parent_pos_y; var parent_width; var parent_height; if (window.screenX != null && window.outerWidth) { parent_pos_x= window.screenX; parent_width= window.outerWidth; parent_pos_y= window.screenY; parent_height= window.outerHeight; } else if (window.screenLeft) { if (document.documentElement) { parent_pos_x= window.screenLeft; parent_width= document.documentElement.offsetWidth; parent_pos_y= window.screenTop; parent_height= document.documentElement.offsetHeight; } else if (document.body && document.body.offsetWidth) { parent_pos_x= window.screenLeft; parent_width= document.body.offsetWidth; parent_pos_y= window.screenTop; parent_height= document.body.offsetHeight; } } // ms (more space) left: true if horizontally the current window has more free space on the left side. // ms top: analogue. var ms_left= (parent_pos_x) > (availWidth - parent_width - parent_pos_x); var ms_top= (parent_pos_y) > (availHeight - parent_height - parent_pos_y); if (ms_left) { pos_x= 0; } else { pos_x= availWidth - outer_width; // outer coordinate } if (ms_top) { pos_y= topOfsY; } else { pos_y= availHeight - outer_height + topOfsY; } break; case 1: pos_x= availWidth - outer_width; // outer coordinate pos_y= topOfsY; break; } return "top=" + pos_y + ",left=" + pos_x + ",width=" + width + ",height=" + height + ","; } function hmtfw_add_mail(addr, img_id, mailcollector_url) { var wnd_options= hmtfw_get_mailcollector_options(); old_img_name= 'mail-plus5.gif'; new_img_name= 'mail-plus-ok4.gif'; // wait for the previous call to this method to be completed. if (interval_handle || timeout_bail_out) { alert('Die Funktion wird gerade ausgeführt. Bitte warten Sie einen Moment und probieren es nochmals.'); return; } mailcollector_window= hmtfw_ping_window(mailcollector_window); if (!mailcollector_window) { mailcollector_window= open_popup('', 'hmtfw_mailcollector', wnd_options); mailcollector_window= hmtfw_ping_window(mailcollector_window); if (!mailcollector_window) { mailcollector_window= open_popup(mailcollector_url, 'hmtfw_mailcollector', wnd_options); } } interval_handle= setInterval( function () { try { mailcollector_window.hmtfw_add_mail_int(addr); clearInterval(interval_handle); clearTimeout(timeout_bail_out); timeout_bail_out= null; interval_handle= null; try { var elm= gE(img_id); elm.src= SucheErsetze(elm.src, old_img_name, new_img_name); } catch(e) {} } catch(e) {} }, 100) ; timeout_bail_out= setTimeout("alert('aborting'); clearInterval(interval_handle); timeout_bail_out= null; interval_handle= null;", 10000); } function hmtfw_get_mail_url() { var addresses= gE("mailcollector").value; // var separator= gE("separator").value; // var recipient= "Undisclosed-Recipient:;"; var recipient= ""; var subject= ""; // var bcc= addresses.replace(/\r?\n$/, ""); // while (bcc.indexOf("\n") >= 0) { // bcc= bcc.replace(/\r?\n/, separator + " "); // } var bcc; var bccs= ""; var pos; pos= addresses.indexOf("\n"); while (pos >= 0) { bcc= addresses.substring(0, pos); bcc= bcc.replace(/^\s|\s$/, ""); addresses= addresses.substring(pos + 1, addresses.length); if (bcc.length > 0) { bccs+= "&bcc=" + encodeURIComponent(bcc); } pos= addresses.indexOf("\n"); } addresses= addresses.replace(/^\s|\s$/, ""); if (addresses.length > 0) { bccs+= "&bcc=" + encodeURIComponent(addresses); } return "mailto:" + encodeURIComponent(recipient) + "?subject=" + encodeURIComponent(subject) + bccs; } function hmtfw_add_mail_int(addr) { gE("mailcollector").value+= addr + "\n"; } function hmtfw_ping() { return true; } var context_window; function hmtfw_get_context_options() { calcWindowOffsets(); // variables for window position calculation var exactWidth= 360; // exact width of the window var exactHeight= 225; // exact height of the window var width; // inner width of window var height; // inner height of window var pos_x; // left corner coordinate of window var pos_y; // top corner coordinate of window width= exactWidth; var outer_width= width + winXOfs; // outer width of window height= exactHeight + winYOfs; // inner height of window (not including title bar p.e.) var outer_height= height; // outer height of window // placement values: // 0: automatic (place it where there is space) // 1: upper right corner // 3: lower left corner var placement= 3; // place it where there is space switch (placement) { case 0: var parent_pos_x; var parent_pos_y; var parent_width; var parent_height; if (window.screenX != null && window.outerWidth) { parent_pos_x= window.screenX; parent_width= window.outerWidth; parent_pos_y= window.screenY; parent_height= window.outerHeight; } else if (window.screenLeft) { if (document.documentElement) { parent_pos_x= window.screenLeft; parent_width= document.documentElement.offsetWidth; parent_pos_y= window.screenTop; parent_height= document.documentElement.offsetHeight; } else if (document.body && document.body.offsetWidth) { parent_pos_x= window.screenLeft; parent_width= document.body.offsetWidth; parent_pos_y= window.screenTop; parent_height= document.body.offsetHeight; } } // ms (more space) left: true if horizontally the current window has more free space on the left side. // ms top: analogue. var ms_left= (parent_pos_x) > (availWidth - parent_width - parent_pos_x); var ms_top= (parent_pos_y) > (availHeight - parent_height - parent_pos_y); if (ms_left) { pos_x= 0; } else { pos_x= availWidth - outer_width; // outer coordinate } if (ms_top) { pos_y= topOfsY; } else { pos_y= availHeight - outer_height + topOfsY; } break; case 1: pos_x= availWidth - outer_width; // outer coordinate pos_y= topOfsY; break; case 3: pos_x= 0; //topOfsX; pos_y= availHeight - outer_height; break; } return "top=" + pos_y + ",left=" + pos_x + ",width=" + width + ",height=" + height + ","; } function hmtfw_open_context(context_url) { var wnd_options= hmtfw_get_context_options(); context_window= hmtfw_ping_window(context_window); if (!context_window) { context_window= open_popup('', 'hmtfw_context', wnd_options); context_window= hmtfw_ping_window(context_window); if (!context_window) { context_window= open_popup(context_url, 'hmtfw_context', wnd_options); } } } function hmtfw_refresh_context(close_window) { var wnd_options= hmtfw_get_context_options(); // wait for the previous call to this method to be completed. if (interval_handle || timeout_bail_out) { alert('Die Funktion wird gerade ausgeführt. Bitte warten Sie einen Moment und probieren es nochmals.'); return; } context_window= hmtfw_ping_window(context_window); if (!context_window) { context_window= open_popup('', 'hmtfw_context', wnd_options); context_window= hmtfw_ping_window(context_window); if (!context_window) { return; } } var close_stmt= ""; if (close_window) { close_stmt= "window.close();"; } interval_handle= setInterval("try { context_window.hmtfw_refresh_context_int(); " + close_stmt + "clearInterval(interval_handle); clearTimeout(timeout_bail_out); timeout_bail_out= null; interval_handle= null; } catch(e) {}", 100); timeout_bail_out= setTimeout("alert('Popup konnte nicht geöffnet werden. Bitte Popup-Blocker für diese Website deaktivieren.'); clearInterval(interval_handle); timeout_bail_out= null; interval_handle= null;", 10000); } var hmtfw_hash_builder = new function () { var params; this.set = function (key, value) { params[key] = value; }; this.remove = function (key, value) { delete params[key]; }; this.get = function (key, value) { return params[key]; }; this.keyExists = function (key) { return params.hasOwnProperty(key); }; this.getHash= function () { var hashBuilderTemp = [], key, value; for(key in params) if (params.hasOwnProperty(key)) { key = escape(key), value = escape(params[key]); // escape(undefined) == "undefined" hashBuilderTemp.push(key + ( (value !== "undefined") ? '=' + value : "" )); } return hashBuilderTemp.join("&"); }; this.push= function () { var hashBuilderTemp = [], key, value; for(key in params) if (params.hasOwnProperty(key)) { key = escape(key), value = escape(params[key]); // escape(undefined) == "undefined" hashBuilderTemp.push(key + ( (value !== "undefined") ? '=' + value : "" )); } window.location.hash = hashBuilderTemp.join("&"); }; (this.load = function () { params = {} var hashStr = window.location.hash, hashArray, keyVal hashStr = hashStr.substring(1, hashStr.length); // trim apersand hashStr= hashStr.replace(new RegExp('^&+'), ''); hashStr= hashStr.replace(new RegExp('&+$'), ''); hashArray = hashStr.split('&'); for(var i = 0; i < hashArray.length; i++) { keyVal = hashArray[i].split('='); params[unescape(keyVal[0])] = (typeof keyVal[1] != "undefined") ? unescape(keyVal[1]) : keyVal[1]; } })(); } function hmtfw_form_submit(button_id, clear_target, scroll_to_same_height) { if (button_id) { var elem= gE(button_id); if (clear_target) { try { elem.form.target= ''; } catch(e) { } } if(scroll_to_same_height) { var yScrollOffset= hmtfwGetScrollTop(window); try { hmtfw_hash_builder.set('scroll_to_height', yScrollOffset); var hash= hmtfw_hash_builder.getHash(); var action= elem.form.action; if(action.indexOf('#') >= 0) { action= action.substring(0, (action.indexOf('#'))); } elem.form.action= action + '#' + hash; } catch(e) { // } } elem.click(); return true; } return false; } function hmtfw_form_ajax_submit(form_elem, var_name) { if (!var_name || !form_elem) { return false; } var data= jQuery(form_elem).serialize(); if (data) { data= data + "&"; } data= data + encodeURIComponent("__auto_submit__") + "=" + encodeURIComponent(var_name) return true; } /** * returns true if given event object (for a onkeyup/onkeydown/onkeypress event) does not result in the input value being changed. * @see http://www.quirksmode.org/js/keys.html for details on keyCode and charCode. * @see http://api.jquery.com/keypress/ * @param evt * @return bool */ function hmtfw_is_non_changing_char(evt) { if ((evt.type == 'keypress' || evt.type == 'keyup' || evt.type == 'keydown') && !evt.charCode) { switch (evt.keyCode) { case 9: // tab case 12: // numlock on mac case 16: // shift case 17: // cmd or ctrl case 18: // alt case 20: // capslock case 27: // escape return true; } if (!OP && !IE && !SAF) { // operaand msie don't deliver charCode for onkeypress and normal keystrokes such as "p". // instead they give the charCode as keyCode, therefore we can't distinguish "p" from F1 p.e. switch (evt.keyCode) { case 33: // page-up case 34: // page-down case 35: // end case 36: // home case 37: // left case 38: // up case 39: // right case 40: // down case 45: // insert case 91: // windows case 112: // f1 case 113: // f2 case 114: // f3 case 115: // f4 case 116: // f5 case 117: // f6 case 118: // f7 case 119: // f8 case 120: // f9 case 121: // f10 case 122: // f11 case 123: // f12 case 144: // numlock return true; } } if (SAF && evt.type == 'keypress') { // safari uses other keyCodes for these keys switch (evt.keyCode) { case 63232: // cursor movement case 63233: // cursor movement case 63234: // cursor movement case 63235: // cursor movement case 63273: // home case 63275: // end case 63289: // numlock case 63276: // page-up case 63277: // page-down return true; } } } return false; } function hmtfw_stop_propagation(event) { event.cancelBubble= true; if (event.stopPropagation) { event.stopPropagation(); } return false; } function hmtfw_insert_person_mtag(id, name, vorname, status, aktiv, pic_exists, preferred_email, telg, telp, telm, textarea_id, param2, param3) { if (id > 0 && textarea_id) { var e= gE(textarea_id); if (e) { insMarkup( e, '[person(id=' + id + '): ', // mopen ']', // mclose, vorname + ' | ' + name, // mtext '', // mtextpre '' // mtextpost ); } } } // state store js functions var hmtfw_state_store_queue; var hmtfw_state_store_flush_job_handle; var hmtfw_state_store_flush_lock= false; var hmtfw_state_store_flush_onunload_installed= false; function hmtfw_state_store_queue_flush(async) { if (!hmtfw_state_store_queue || hmtfw_state_store_flush_lock) { return false; } hmtfw_state_store_flush_lock= true; jQuery.ajax( { url: hmtfw_state_store_app_url, async: async, type: 'POST', cache: false, data: { state: hmtfw_state_store_queue } } ); if (hmtfw_state_store_flush_job_handle) { clearTimeout(hmtfw_state_store_flush_job_handle); } hmtfw_state_store_queue= null; hmtfw_state_store_flush_lock= false; } function hmtfw_state_store_get_queued_state(tree_ulid, user_ident_mode, sub_ulid) { if (sub_ulid.length == 0) { // we should avoid empty keys in hashes. sub_ulid= hmtfw_empty_key; } while (hmtfw_state_store_flush_lock) {} var state; try { state= hmtfw_state_store_queue[tree_ulid][user_ident_mode][sub_ulid]; } catch (e) { state= null; } return state; } function hmtfw_state_store_queue_add(tree_ulid, user_ident_mode, sub_ulid, state) { if (sub_ulid.length == 0) { // we should avoid empty keys in hashes. sub_ulid= hmtfw_empty_key; } while (hmtfw_state_store_flush_lock) {} var obj= hmtfw_state_store_queue; if (!obj) { obj= hmtfw_state_store_queue= new Object(); } obj= obj[tree_ulid]; if (!obj) { obj= hmtfw_state_store_queue[tree_ulid]= new Object(); } obj= obj[user_ident_mode]; if (!obj) { obj= hmtfw_state_store_queue[tree_ulid][user_ident_mode]= new Object(); } hmtfw_state_store_queue[tree_ulid][user_ident_mode][sub_ulid]= state; if (hmtfw_state_store_flush_job_handle) { clearTimeout(hmtfw_state_store_flush_job_handle); } hmtfw_state_store_flush_job_handle= setTimeout('hmtfw_state_store_queue_flush(true);', hmtfw_state_store_flush_delay); if (!hmtfw_state_store_flush_onunload_installed) { add_onunload_script( "hmtfw_state_store_queue_flush(true);", false, true, true ); hmtfw_state_store_flush_onunload_installed= true; } } // tree js function hmtfw_tree_state_queue_add(tree_ulid, user_ident_mode, sub_ulid, node_id, new_state) { var state= hmtfw_state_store_get_queued_state(tree_ulid, user_ident_mode, sub_ulid); if (state === null || state === undefined) { state= new Object(); } state[node_id]= (new_state) ? 1 : 0; hmtfw_state_store_queue_add(tree_ulid, user_ident_mode, sub_ulid, state); } function hmtfw_tree_store_persistence(idx, elem, do_expand) { var e= jQuery(elem); // save expanded / collapsed state in cookie hmtfw_tree_state_queue_add( e.attr('data-tree-ulid'), e.attr('data-user-ident-mode'), e.attr('data-sub-ulid'), e.attr('data-tree-node-id'), do_expand ); } function hmtfw_tree_store_form_persistence(idx, elem, do_expand) { var e= jQuery(elem); var id= e.attr('data-tree-node-id'); var inp= e.closest('.tn_main').find('input:checkbox[value="' + id + '"]').first(); if (do_expand) { inp.prop('checked', 'checked'); } else { inp.removeProp('checked'); } } function hmtfw_tree_go_to_node(html_id, use_flicker, use_persistence, use_form_persistence) { // get jquery object for node var node= jQuery('#' + html_id); // open all nested lists up to this node var tmp_line= node.parentsUntil('.tn_ul_main').filter('.tn_ul').slideDown(); if (use_persistence) { tmp_line.each(function(idx) { hmtfw_tree_store_persistence(idx, this, true); }); } if (use_form_persistence) { tmp_line.each(function(idx) { hmtfw_tree_store_form_persistence(idx, this, true); }); } // scroll node into view var top= node.offset().top; jQuery('html,body').animate({scrollTop: top}, 1000); // highlight the node var box= jQuery('#' + html_id + ' > * > .tn_node, ' + '#' + html_id + ' > .tn_node'); node.addClass('tn_node_highlight'); // add class to the "li" element if (use_flicker) { // flickering should take approx. 2 seconds for (var i= 1; i <= 10; i++) { box.fadeTo(0, 0.2); box.fadeTo(200, 1); } } else { // no flickering box.delay(2000); } // remove highlight class from "li" element box.fadeIn(0, function(){ node.removeClass('tn_node_highlight'); }); } function hmtfw_multi_tab_state_store_click(container_selector, tab_key, container_ulid, user_ident_mode, sub_ulid) { var open_tabs= // array of keys of currently open tabs jQuery(container_selector + " > div"). filter(":visible"). map(function(index, node) { return jQuery(node).attr("data-hmtfw-key"); }). get(); var closed_tabs= // array of keys of currently closed tabs jQuery(container_selector + " > div"). filter(":hidden"). map(function(index, node) { return jQuery(node).attr("data-hmtfw-key"); }). get(); var state= { open_tabs: open_tabs, closed_tabs: closed_tabs, toggle_tab: tab_key }; hmtfw_state_store_queue_add(container_ulid, user_ident_mode, sub_ulid, state); } // this global variable contains registered elements and their value var hmtfw_registered_for_reset= new Array(); // automatically register all input elements with class "hmtfw_auto_reset" for value reset add_onload_script('hmtfw_register_inputelem_for_reset(jQuery(\'.hmtfw_auto_reset\'));'); // register unload script that resets the registered elements to the stored value add_onunload_script('\ try { \ for (var i= 0; i < hmtfw_registered_for_reset.length; i++) { \ hmtfw_registered_for_reset[i].elem.val(hmtfw_registered_for_reset[i].value);\ }\ } catch (e) {}\ ', false, true, false); /** * register an input element and its current value to be resetted on unload. * @param jquery_elems a jquery object containing one or more form input elements. */ function hmtfw_register_inputelem_for_reset(jquery_elems) { jquery_elems.each(function (index) { try { var jquery_elem= jQuery(this); hmtfw_registered_for_reset.push({ elem: jquery_elem, value: jquery_elem.val() }); } catch (e) {} }); } ///** // * create or update a div with the given id. // * // * this is used e.g. for the hover div for selecting persons in input_person_array // * // * optionally attach it to a given element // * // * @param html_id // * @param jquery_elem_to_attach_to // * @param update_only true or false // * @returns // */ //function hmtfw_open_singleton_div(html_id, jquery_elem_to_attach_to, update_only) { // var obj= jQuery('#' + html_id); // if (!update_only && obj.length != 1) { // // dom element not found // // // find a parent we can append the new div // var parent_obj; // // if (jquery_elem_to_attach_to && jquery_elem_to_attach_to.length == 1) { // parent_obj= jquery_elem_to_attach_to.closest('.tx_hmtfw'); // } // // if (!parent_obj) { // parent_obj= jQuery('body'); // } // // parent_obj.append('
'); // obj= jQuery('#' + html_id); // } // // if (!obj) { // return; // } // // // show this div if the user enters the elem // jquery_elem_to_attach_to.one('focus', function () { hmtfw_open_singleton_div(html_id, jquery_elem_to_attach_to, true); }); // // obj.show(); // if (obj && jquery_elem_to_attach_to && jquery_elem_to_attach_to.length == 1) { // // attach to this element // var position= jquery_elem_to_attach_to.offset(); // var height= jquery_elem_to_attach_to.outerHeight(false); // obj.offset({ left: position.left, top: position.top + height - 1 }); // // // hide this div if the user leaves the elem // jquery_elem_to_attach_to.on('blur', function (event) { // obj.slideUp(); // hide div // jQuery(this).off(event); // unregister event listener // }); // } // // return obj; //} // //function hmtfw_close_singleton_div(html_id) { // var obj= jQuery('#' + html_id); // obj.remove(); //}