var changedContent = false; $(function() { initTooltip(); }); function initTooltip() { if ($.isFunction($.fn.tooltip)) { $('.trovarit_tooltip').Tooltip({ showURL: false, id: "trovarit_tooltip", showBody: "; ", fade: 250 }); } } function callOnEnter(e,functionToCall,argArray) { var keycode; if (window.event) keycode = window.event.keyCode; else if (e) keycode = e.which; else return true; if (keycode == 13) { if ((argArray == null) || (argArray == "")) { argArray = new Array(); } functionToCall.apply(this, argArray); return false; } else return true; } function submitEnter(myfield,e) { var keycode; if (window.event) keycode = window.event.keyCode; else if (e) keycode = e.which; else return true; if (keycode == 13) { myfield.form.submit(); return false; } else return true; } /* * * */ function confirmDialog(title, onYesClick, question, height, width, onNoClick) { if (height == null) { height="auto"; } if (width == null) { width=300; } if (onNoClick == null) { onNoClick=""; } $("#dialog").html(""); var dialogContent = unescape("%3Cdiv%20class%3D%22trovarit_dialog_content%22%3E%0D%0A%3Cdiv%20class%3D%22trovarit_dialog_info%22%3Equestion%3C%2Fdiv%3E%0D%0A%3Ccenter%3E%0D%0A%3Ctable%20cellpadding%3D%2220%22%20width%3D%22270%22%3E%0A%20%20%3Ctr%3E%0A%20%20%20%20%3Ctd%20width%3D%22100%22%3E%3Ca%20class%3D%22trovarit_standard_button%22%20%0D%0A%20%0D%0Astyle%3D%22%20height%3A20px%3B%20line-height%3A%2020px%3B%20font-weight%3Abold%3B%20color%3A%23ffffff%3B%20background-color%3A%233F89C3%3B%0D%0Aborder-left-color%3A%2379add6%3B%20%0D%0Aborder-top-color%3A%2379add6%3B%20%0D%0Aborder-right-color%3A%232c6089%3B%20%0D%0Aborder-bottom-color%3A%232c6089%3B%22%0D%0A%20onclick%3D%22onYesClick%3B%24%28%27%23dialog%27%29.dialog%28%27close%27%29%3B%22%20onmouseover%3D%22this.style.background%3D%27%23397bb0%27%3B%22%20onmouseout%3D%22this.style.background%3D%27%233F89C3%27%3B%22%3E%0D%0AJA%0D%0A%3C%2Fa%3E%0D%0A%3C%2Ftd%3E%0A%20%20%20%20%3Ctd%20width%3D%22100%22%3E%3Ca%20class%3D%22trovarit_standard_button%22%20%0D%0A%20%0D%0Astyle%3D%22%20height%3A20px%3B%20line-height%3A%2020px%3B%20font-weight%3Abold%3B%20color%3A%23ffffff%3B%20background-color%3A%23E75200%3B%0D%0Aborder-left-color%3A%23ef864d%3B%20%0D%0Aborder-top-color%3A%23ef864d%3B%20%0D%0Aborder-right-color%3A%23a23900%3B%20%0D%0Aborder-bottom-color%3A%23a23900%3B%22%0D%0A%20onclick%3D%22onNoClick%3B%24%28%27%23dialog%27%29.dialog%28%27close%27%29%3B%22%20onmouseover%3D%22this.style.background%3D%27%23d04a00%27%3B%22%20onmouseout%3D%22this.style.background%3D%27%23E75200%27%3B%22%3E%0D%0ANEIN%0D%0A%3C%2Fa%3E%0D%0A%3C%2Ftd%3E%0A%20%20%3C%2Ftr%3E%0A%3C%2Ftable%3E%0A%3C%2Fcenter%3E%0D%0A%3C%2Fdiv%3E"); dialogContent = dialogContent.replace(/onYesClick/, onYesClick); dialogContent = dialogContent.replace(/onNoClick/, onNoClick); dialogContent = dialogContent.replace(/question/, question); $("#dialog").html(dialogContent); $("#dialog").dialog({ close: function(event, ui) { $(this).dialog('destroy'); }, resizable: false, draggable: false, height: height, width: width, bgiframe: true, modal: true, title: title }); } function infoDialog(title, content, height, width, onCloseClick) { if (height == null) { height="auto"; } if (width == null) { width=400; } if (onCloseClick == null) { onCloseClick=""; } $("#dialog").html(""); var dialogContent = unescape("%3Cdiv%20class%3D%22trovarit_dialog_content%22%3E%0D%0A%3Cdiv%20style%3D%22overflow%3A%20auto%3Bheight%3A%20150px%22%3E%3Cdiv%20class%3D%22trovarit_dialog_info%22%3Eboxcontent%3C%2Fdiv%3E%3C%2Fdiv%3E%0D%0A%3Ccenter%3E%0D%0A%3Ctable%20width%3D%22370%22%20style%3D%22margin-top%3A%2010px%3B%22%3E%0D%0A%20%20%3Ctr%3E%0D%0A%20%20%20%20%3Ctd%20width%3D%22100%25%22%20align%3D%22center%22%3E%3Ca%20class%3D%22trovarit_standard_button%22%20%0D%0A%20%0D%0Astyle%3D%22%20width%3A100px%3B%20color%3A%23555555%3B%20background-color%3A%23E0E0E0%3B%0D%0Aborder-left-color%3A%23eaeaea%3B%20%0D%0Aborder-top-color%3A%23eaeaea%3B%20%0D%0Aborder-right-color%3A%239d9d9d%3B%20%0D%0Aborder-bottom-color%3A%239d9d9d%3B%22%0D%0A%20onclick%3D%22onCloseClick%3B%24%28%27%23dialog%27%29.dialog%28%27close%27%29%22%20onmouseover%3D%22this.style.background%3D%27%23cacaca%27%3B%22%20onmouseout%3D%22this.style.background%3D%27%23E0E0E0%27%3B%22%3E%0D%0ASCHLIESSEN%0D%0A%3C%2Fa%3E%0D%0A%3C%2Ftd%3E%0D%0A%20%20%3C%2Ftr%3E%0D%0A%3C%2Ftable%3E%0D%0A%3C%2Fcenter%3E%0D%0A%3C%2Fdiv%3E"); dialogContent = dialogContent.replace(/onCloseClick/, onCloseClick); if (height!="auto") { dialogContent = dialogContent.replace(/height: 150px/, 'height: '+(height-100)+'px;'); } else { dialogContent = dialogContent.replace(/height: 150px/, ''); } dialogContent = dialogContent.replace(/370/, width-30); dialogContent = dialogContent.replace(/boxcontent/, content); $("#dialog").html(dialogContent); $("#dialog").dialog({ close: function(event, ui) { $(this).dialog('destroy'); }, resizable: false, draggable: false, height: height, width: width, bgiframe: true, modal: true, title: title }); } /**********************************************************************************************/ function checkCookiesActive() { $.post( "http://www.it-matchmaker.com/core/ajax/ajax.php", { type: "CHECK_COOKIES", page_charset: "ISO-8859-1" }, function(html) { if (html != 1) { if ("iso-8859-1" != "utf-8") { html = decode_utf8(html); } $(".trovarit_cookies_error").html(html); } }); } /**********************************************************************************************/ function encode_utf8( s ) { return unescape( encodeURIComponent( s ) ); } /**********************************************************************************************/ function decode_utf8( s ) { return decodeURIComponent( escape( s ) ); } /**********************************************************************************************/ function addslashes(str) { str=str.replace(/\\/g,'\\\\'); str=str.replace(/\"/g,'\\"'); str=str.replace(/\0/g,'\\0'); str=str.replace(/\n/g,''); str=str.replace(/\t/g,''); return str; } /**********************************************************************************************/ function exportTableToExcel(tableID, savename) { if (savename == null || savename == '') { savename = "Excel_Tabelle" } if ($('#'+tableID).length > 0) { blockScreen(); var headerData = '"header":['; $('#'+tableID+' th').each(function (i) { headerData += '"'+addslashes($(this).text().replace(/^\s+|\s+$/g, ''))+'",'; }); headerData = headerData.slice(0, -1) + '],'; var tableData = '"data": ['; $('#'+tableID+' tbody tr:visible').each(function (i) { var rowData = '['; $("td",this).each(function(j) { var tdContent = ""; tdContent = addslashes($(".exportThis",this).text().replace(/^\s+|\s+$/g, '')); if (tdContent == "") { tdContent = addslashes($(".sortThis",this).text().replace(/^\s+|\s+$/g, '')); } rowData += '"'+tdContent+'",'; }); rowData = rowData.slice(0, -1) + '],'; tableData = tableData + rowData; }); tableData = tableData.slice(0, -1) + ']'; alldata = "{"+headerData+tableData+"}"; $.post( "http://www.it-matchmaker.com/core/ajax/ajax.php", { type: "CREATE_EXCEL_FROM_TABLE", page_charset: "ISO-8859-1", data: alldata, savename: savename }, function(data) { unblockScreen(); if (data.length != 32) { if ("iso-8859-1" != "utf-8") { data = decode_utf8(data); } infoDialog("FEHLER", data); } else { location.href = "http://www.it-matchmaker.com/core/get_generated_file.php?file="+data; } }); } else { infoDialog("FEHLER", "Die Tabelle mit der ID existiert nicht!"); } } /**********************************************************************************************/ function tableToolbarFilter(tableID) { blockScreen(); setTimeout(function(){callTableToolbarFilter(tableID);}, 150); } /**********************************************************************************************/ function callTableToolbarFilter(tableID) { var filterText = $('input#'+tableID+'_input_filter').val(); $('table#'+tableID+' tbody tr').removeHighlight(); if (filterText.length == 0) { $('table#'+tableID+' tbody tr').show(); } else { $('table#'+tableID+' tbody tr').each( function (column) { var searchText = $(this).text(); if (searchText.toLowerCase().indexOf(filterText.toLowerCase()) >= 0) { $(this).show(); } else { $(this).hide(); } }); $('table#'+tableID+' tbody tr').highlight(filterText); } setToolbarInfo(tableID, false); if ($('#'+tableID+'_all_count').text() > 0) { $("table#"+tableID).trigger("appendCache"); } unblockScreen(); } /**********************************************************************************************/ function setToolbarInfo(tableID, initNow) { if ($('table#'+tableID+' tbody tr:first td').length == 0) { $('#'+tableID+'_visible_count').text(0); } else { $('#'+tableID+'_visible_count').text($('table#'+tableID+' tbody tr td:visible').length / $('table#'+tableID+' tbody tr:first td').length); } if (initNow) { $('#'+tableID+'_all_count').text($('table#'+tableID+' tbody tr').length); } } /**********************************************************************************************/ function tableToolbarFilterReset(tableID) { $('input#'+tableID+'_input_filter').val(""); tableToolbarFilter(tableID); } /**********************************************************************************************/ function addTableToolbar(tableID, filename, legendeTemplate, helpLink) { if (($('#'+tableID).length == 1) && ($('#'+tableID).prev().attr("class") != "trovarit_table_toolbar_container")) { $.post( "http://www.it-matchmaker.com/core/ajax/ajax.php", { type: "GET_TABLE_TOOLBAR", page_charset: "ISO-8859-1", app_language: "de", tableID: tableID, filename: filename, legendeTemplate: legendeTemplate, helpLink: helpLink }, function(html) { if ("iso-8859-1" != "utf-8") { html = decode_utf8(html); } $('#'+tableID).before(html); }); } else { infoDialog("FEHLER", "Die Tabelle mit der ID existiert nicht!"); } } /**********************************************************************************************/ function reinitTablesorter(tableID) { $("table#"+tableID).trigger("update"); $("table#"+tableID).trigger("appendCache"); } /**********************************************************************************************/ function initTablesorter(tableID, sortRow, sortDescending) { if (sortRow == null) { sortRow = 0; } if (sortDescending == null) { sortDescending = 0; } $('table#'+tableID).tablesorter({ widgets: ['zebra'], sortList: [[sortRow,sortDescending]], textExtraction: function(node) { return $("span.sortThis", node).text(); } }); } /**********************************************************************************************/ function initFormValidator(formID) { $("#"+formID).validate({ meta: "validate", errorClass: "trovarit_validation_error", errorPlacement: function(error, element) { } }); } /**********************************************************************************************/ function isFormValid(formID) { if ($('#'+formID).length > 0) { if ($('#'+formID).valid()) { return true; } else { infoDialog("FEHLER","Bitte füllen Sie alle Felder korrekt aus!"); return false; } } else { infoDialog("FEHLER", "isFormValid(): Kein Formular mit der ID '"+formID+"' gefunden!"); } } /**********************************************************************************************/ function contentChanged(changed) { changedContent = changed; setUnload(changed); } /**********************************************************************************************/ function setUnload(enabled) { var existsUnload = $("body").attr("onbeforeunload") != null; if ((!existsUnload) && (enabled)) { $("body").attr("onbeforeunload", "return 'Daten haben sich geändert und wurden noch nicht gespeichert!'"); } else if ((existsUnload) && (!enabled)) { $("body").removeAttr("onbeforeunload"); } } /**********************************************************************************************/ function addValidatorCombobox() { jQuery.validator.addMethod("selectCombobox", function(value, element) { if (value == "") { return false; } return true; }, " "); }