var win = null; var themenu = null; var themenuctx = null; var theCallendar=null; var yscroll=null var prevX=null; var prevY=null; var startTouchX=null; var startTouchY=null; var theFixedTopMenu=null; var touchScale=0.1; var submitMessage=new Array(); var systemKeys=new Set(['B','C','E','H','I','P','T','W','Z']); hidemenu(); window.addEventListener('load', function() { theFixedTopMenu=document.getElementById('itcFixedTopMenu'); if (theFixedTopMenu&&false) { window.addEventListener('scroll', function(e) { if (window.scrollY<30) { theFixedTopMenu.dataset.itctopmenuposition=window.scrollY; itcDelClass(theFixedTopMenu,'minimised'); } else if(Math.abs(parseInt(theFixedTopMenu.dataset.itctopmenuposition)-window.scrollY)>50) { itcAddClass(theFixedTopMenu,'minimised'); } }); } }); function getHorizontalOffset(theObject) { var theOffsetParent=theObject.offsetParent; var theOffsetLeft=0; while (theOffsetParent) { theOffsetLeft+=theOffsetParent.offsetLeft; theOffsetParent=theOffsetParent.offsetParent; } return theOffsetLeft; } function getVerticalOffset(theObject) { var theOffsetParent=theObject.offsetParent; var theOffsetTop=0; while (theOffsetParent) { theOffsetTop+=theOffsetParent.offsetTop; theOffsetParent=theOffsetParent.offsetParent; } return theOffsetTop; } function getAvaibleHeight(theMargin) { if (screen.availHeight&&!isNaN(parseInt(screen.availHeight))&&parseInt(screen.availHeight)>0) return parseInt(screen.availHeight)-theMargin; else return 700; } function getAvaibleWidth(theMargin) { if (screen.availWidth&&!isNaN(parseInt(screen.availWidth))&&parseInt(screen.availWidth)>0) return parseInt(screen.availWidth)-theMargin; else return 1024; } function dropit(e,whichone,xoffset,yoffset,prevCoords,scrollOffset) { //hide all menus except pressed one document.onclick=hidemenu; parent.document.onclick=hidemenu; window.onscroll=null; hidecallendar(); if (themenu!=eval(document.getElementById(whichone)) || themenuctx!=eval(document.getElementById(whichone)).dataset.itcmenucontext) hidemenu(); //get current menu themenu=eval(document.getElementById(whichone)); if (themenu) themenuctx=themenu.dataset.itcmenucontext; theBody=document.body; themenuoffsetX=theBody.scrollLeft; themenuoffsetY=theBody.scrollTop; theX=e.clientX+themenuoffsetX-(e.button==0&&e.screenX!=0&&e.screenY!=0?e.offsetX+2:0)-(xoffset?xoffset:0); theY=e.clientY+themenuoffsetY-(e.button==0&&e.screenX!=0&&e.screenY!=0?e.offsetY-14:0)-(yoffset?yoffset:0); if (theX+themenu.clientWidth>(theBody.scrollWidth+(scrollOffset?scrollOffset:0)-2)) theX=(theBody.scrollWidth+(scrollOffset?scrollOffset:0)-2)-themenu.clientWidth; themenu.style.left=theX; themenu.style.top=theY; if (!isMobile()) { if (themenu.clientHeight+e.clientY-(e.button==0?e.offsetY-14:0)-(yoffset?yoffset:0)>theBody.clientHeight) theBody.scrollTop=theBody.scrollTop+(themenu.clientHeight+e.clientY-(e.button==0?e.offsetY-14:0)-(yoffset?yoffset:0))-theBody.clientHeight; theBody.style.minHeight=theBody.scrollHeight+'px'; } if (prevCoords) { themenu.style.left=prevX; themenu.style.top=prevY; } else { prevX=themenu.style.left; prevY=themenu.style.top; } if (themenu.style.visibility=="hidden") { themenu.style.opacity="1.0"; themenu.style.visibility="visible"; if (themenu.dataset&&themenu.dataset.itcmenudisplaynone) themenu.style.display="initial"; } else { themenu.style.visibility="hidden"; themenu.style.opacity="0.0"; if (themenu.dataset&&themenu.dataset.itcmenudisplaynone) themenu.style.display="none"; } return false; } function dropitTopMenu(e,whichone,left) { //if top menu is minimised only maximise it if (theFixedTopMenu&&parseInt(getComputedStyle(theFixedTopMenu).top)!=0) { theFixedTopMenu.dataset.itctopmenuposition=window.scrollY; itcDelClass(theFixedTopMenu,'minimised'); return false; } //hide all menus except pressed one document.onclick=hidemenu; parent.document.onclick=hidemenu; window.onscroll=hidemenu; hidecallendar(); if (themenu!=eval(parent.document.getElementById(whichone))) hidemenu(); //get current menu themenu=eval(parent.document.getElementById(whichone)); //calculate position theBody=document.body; themenuoffsetX=theBody.scrollLeft; themenuoffsetY=theBody.scrollTop; theleft=getHorizontalOffset(left)-themenuoffsetX-1; themenu.style.left=(theleft+themenu.clientWidth>theBody.clientWidth-2?theBody.clientWidth-2-themenu.clientWidth:theleft) themenu.style.top=getVerticalOffset(left)+left.clientHeight-themenuoffsetY; if (themenu.style.visibility=="hidden") { themenu.style.opacity="1.0"; themenu.style.visibility="visible"; } else { themenu.style.visibility="hidden"; themenu.style.opacity="0.0"; } return false; } function dropitsub(left,e,whichone) { //hide all menus except pressed one document.onclick=hidemenu; parent.document.onclick=hidemenu; window.onscroll=hidemenu; hidecallendar(); if (themenu!=eval(parent.document.getElementById(whichone))) hidemenu(); //get current menu themenu=eval(parent.document.getElementById(whichone)); //calculate position theBody=document.body; theleft=parseInt(left.offsetParent.offsetParent.offsetParent.style.left); themenu.style.left=(theleft+themenu.clientWidth>theBody.clientWidth-2?theBody.clientWidth-2-themenu.clientWidth:theleft) themenu.style.top=left.offsetParent.offsetParent.offsetParent.style.top; if (themenu.style.visibility=="hidden") { themenu.style.opacity="1.0"; themenu.style.visibility="visible"; } else { themenu.style.visibility="hidden"; themenu.style.opacity="0.0"; } return false; } function hidemenu(e) { if (themenu) { themenu.style.visibility="hidden"; themenu.style.opacity="0.0"; if (themenu.dataset&&themenu.dataset.itcmenudisplaynone) themenu.style.display="none"; } } function openCallendar(e,type,context,xoffset,yoffset) { //hide all menus and all callendars except pressed one document.onclick=hidecallendar; parent.document.onclick=hidecallendar; hidemenu(); hidecallendar(); //get current callendar theCallendar=eval(document.getElementById(type)); //init callendar if needed var isReload=false; if (context&&theCallendar.contentWindow.initCallendar) isReload=theCallendar.contentWindow.initCallendar(context[0],context[1],context[2]); //calculate position theBody=document.body; theX=e.clientX+theBody.scrollLeft-(e.offsetX+6)-(xoffset?xoffset:0); theY=e.clientY+theBody.scrollTop-(e.offsetY-14)-(yoffset?yoffset:0); if (theX+theCallendar.clientWidth>(theBody.scrollWidth-2)) theX=(theBody.scrollWidth-2)-theCallendar.clientWidth; if (!isMobile()) { if ((theY-theCallendar.clientHeight-6>theBody.scrollTop+(theFixedTopMenu?theFixedTopMenu.clientHeight+parseInt(getComputedStyle(theFixedTopMenu).top)-5:0))&&(theCallendar.clientHeight+e.clientY-(e.offsetY-14)-(yoffset?yoffset:0)>theBody.clientHeight)) theY=theY-theCallendar.clientHeight-6; } if (theCallendar.style.visibility=="visible") { theCallendar.style.top="-1000px"; theCallendar.style.visibility="hidden"; theCallendar.style.opacity="0.0"; } else { theCallendar.style.left=theX; theCallendar.style.top=theY; if (!isReload) { theCallendar.style.opacity="1.0"; theCallendar.style.visibility="visible"; } } return false; } function hidecallendar() { if (theCallendar) { theCallendar.style.top="-1000px"; theCallendar.style.visibility="hidden"; theCallendar.style.opacity="0.0"; } } function NewWindow(mypage,w,h,m) { if (m && m=='nowindow') { location.href=mypage; return null; } else { TopPosition = Math.floor(Math.random()*25); LeftPosition = Math.floor(Math.random()*25); settings = 'height='+(h==''?getAvaibleHeight(100):h)+',width='+(w==''?'1024':(w=='fullscreen'?getAvaibleWidth(50):w))+',top='+TopPosition+',left='+LeftPosition+',menubar=yes,scrollbars=yes,resizable=yes,status=no'; win = window.open(mypage,'_blank'); win.document.body.style.background = '#FFFFFF'; if(win.window.focus){win.window.focus();} return win; } } function NewWindowOne(mypage,myname,w,h) { TopPosition = Math.floor(Math.random()*25); LeftPosition = Math.floor(Math.random()*25); settings = 'height='+(h==''?getAvaibleHeight(100):h)+',width='+(w==''?'1024':(w=='fullscreen'?getAvaibleWidth(50):w))+',top='+TopPosition+',left='+LeftPosition+',menubar=yes,scrollbars=yes,resizable=yes,status=no'; win = window.open((mypage==''&&false?'javascript:;':mypage),myname); win.document.body.style.background = '#FFFFFF'; if(win.window.focus){win.window.focus();} return win; } function NewWindowFix(mypage,myname,w,h,scroll,resize,stat,popup) { TopPosition = Math.floor(Math.random()*25); LeftPosition = Math.floor(Math.random()*25); settings = 'height='+(h==''?getAvaibleHeight(100):h)+',width='+(w==''?'1024':(w=='fullscreen'?getAvaibleWidth(50):w))+',top='+TopPosition+',left='+LeftPosition+',menubar=yes,scrollbars='+scroll+',resizable='+resize+',status='+stat+',popup='+popup; win = window.open(mypage,myname,(isMobile()||!popup?null:settings)); win.document.body.style.background = '#FFFFFF'; if(win.window.focus){win.window.focus();} return win; } function invertColor(theHex) { theHex=theHex.replace(/#/gi,''); return "#"+(Number(`0x1${theHex}`) ^ 0xFFFFFF).toString(16).substr(1).toUpperCase(); } function setWindowIcon(theIcon, isParent) { if (theIcon) { var theIconUrl = null; var theDocument = theIcon.ownerDocument; if (theIcon.contentDocument) { var theIconContent = theIcon.contentDocument.cloneNode(true); var theSvg = theIconContent.querySelector("#itcubeIconSvg"); if (theSvg) theSvg.style.backgroundColor = (true?getComputedStyle(theIcon).getPropertyValue('--itcWindowIconBackground'):invertColor(getComputedStyle(theIcon).getPropertyValue('--itcWindowIconBackground'))); var theSvgIcon = theIconContent.querySelectorAll("#itcubeIcon"); if (theSvgIcon) for (var theCounter=0;theCounter 1) ismobile = true; return ismobile; } function getIEVersionNumber() { if (/MSIE (\d+\.\d+);/.test(navigator.userAgent) || /Trident.+rv:(\d+\.\d+)/.test(navigator.userAgent)) return parseFloat(new Number(RegExp.$1)); else return 0; } function itcTouchStart(e,forceDefaultAction,sourceOfEvent) { startTouchX=parseInt(e.changedTouches[0].clientX); startTouchY=parseInt(e.changedTouches[0].clientY); if (typeof(itcFormTouchStart)==='function') itcFormTouchStart(startTouchX,startTouchY,0,sourceOfEvent); if (!forceDefaultAction) e.preventDefault(); } function itcTouchMove(e,forceDefaultAction,sourceOfEvent) { var offsetTouchX=parseInt(e.changedTouches[0].clientX)-startTouchX; var offsetTouchY=parseInt(e.changedTouches[0].clientY)-startTouchY; var moveLength=touchScale*((getAvaibleWidth(0)+getAvaibleHeight(0))/2); var moveScale=0; if (typeof(itcFormTouchMove)==='function') { moveScale=Math.abs(offsetTouchX)/moveLength; itcFormTouchMove(offsetTouchX,offsetTouchY,(moveScale>1?1:moveScale),sourceOfEvent); } if (!forceDefaultAction) e.preventDefault(); } function itcTouchEnd(e,forceDefaultAction,sourceOfEvent) { var offsetTouchX=parseInt(e.changedTouches[0].clientX)-startTouchX; var offsetTouchY=parseInt(e.changedTouches[0].clientY)-startTouchY; var moveLength=touchScale*((getAvaibleWidth(0)+getAvaibleHeight(0))/2); var moveScale=0; if (typeof(itcFormTouchEnd)==='function') { moveScale=Math.abs(offsetTouchX)/moveLength; itcFormTouchEnd(offsetTouchX,offsetTouchY,(moveScale>1?1:moveScale),sourceOfEvent); } if (!forceDefaultAction) e.preventDefault(); } function getAjaxResponse(theUrl, theCallback, theErrorCallback, theParams, theParamsFormat, theAuth) { var oReq = new XMLHttpRequest(); if (theCallback) { oReq.onreadystatechange = function() { if (this.readyState == 4) { if (this.status == 200) theCallback(this.responseText); else if (theErrorCallback) theErrorCallback(this.responseText, this.status); } } } theUrl=theUrl+(theParams?'?':'&')+'RandomSeed='+(new Date()).getTime(); oReq.open(theParams?'POST':'GET', theUrl.replace(/!URL!/, 'itcubeSQL.jsp'), theCallback?true:false); oReq.setRequestHeader('Content-type', (theParamsFormat?theParamsFormat:'application/x-www-form-urlencoded')); if (theAuth) oReq.setRequestHeader('Authorization', theAuth); oReq.send(theParams?theParams:null); if (!theCallback && oReq.status && oReq.status=='200') return oReq.responseText; else return ""; } function getTranslation(theFields, theSrcLng, theDstLng, theHtmlMode) { var isNotEmpty = false; var jsonValue = { 'text': [], 'formality': 'prefer_more', 'show_billed_characters': true, 'preserve_formatting': true }; if (theSrcLng) jsonValue.source_lang = theSrcLng; if (theDstLng) jsonValue.target_lang = theDstLng; if (theHtmlMode) jsonValue.tag_handling = 'html'; for (var txtCounter = 0; txtCounter < theFields.length; txtCounter++) { jsonValue.text[txtCounter] = (theFields[txtCounter].nodeName=='IFRAME'?GetHtml(theFields[txtCounter]):(theFields[txtCounter].nodeName=='INPUT'||theFields[txtCounter].nodeName=='TEXTAREA'?theFields[txtCounter].value:(theFields[txtCounter].innerText.trim()?theFields[txtCounter].innerHTML:''))).trim(); if (jsonValue.text[txtCounter]) isNotEmpty = true; } if (isNotEmpty) { theFields.forEach((theField) => {theField.style.opacity='0.5'}); getAjaxResponse('itcubeTRANS.jsp;jsessionid=53FF3EF7BE7D9A403B76CA63300E6172', function (theTranslation) { theFields.forEach((theField) => {theField.style.opacity=''}); var jsonTranslation = JSON.parse(theTranslation); for (var txtCounter = 0; txtCounter < theFields.length && jsonTranslation.translations[txtCounter]; txtCounter++) { if (jsonTranslation.translations[txtCounter].text) { if (theFields[txtCounter].nodeName == 'IFRAME') { InsertHtml(jsonTranslation.translations[txtCounter].text,theFields[txtCounter]); } else if (theFields[txtCounter].nodeName == 'INPUT' || theFields[txtCounter].nodeName == 'TEXTAREA') theFields[txtCounter].value = jsonTranslation.translations[txtCounter].text; else theFields[txtCounter].innerHTML = jsonTranslation.translations[txtCounter].text; } } }, function (theError,theStatus) { theFields.forEach((theField) => {theField.style.opacity=''}); var theErrorMessage = ''; try { theErrorMessage=(theStatus==403?'Niepoprawny klucz':(theStatus==456?'Przekroczony limit zapytań':(theStatus==503?'Usługa czasowo niedostępna':(theStatus==413?'Przekroczony limit rozmiaru tekstu':JSON.parse(theError).message)))); } catch (e) { theErrorMessage=theStatus; } itcAlert('Próba tłumczenia zakończyła się błędem: '+theErrorMessage); }, 'translateText='+encodeURIComponent(JSON.stringify(jsonValue)) ); }; } function softwareClick(event, anchorName, anchorContext, forceNewWindow) { var anchorObj=(anchorContext?anchorContext.document.getElementById(anchorName):document.getElementById(anchorName)); if (forceNewWindow) { NewWindow(anchorObj.href.replace(/mode=add/gi,'mode=edit')+'&mode=edit','',''); } else { if (false&&anchorObj.click) { anchorObj.click(); } else if (document.createEvent) { if (event.target !== anchorObj) { var evt = document.createEvent("MouseEvents"); evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); var allowDefault = anchorObj.dispatchEvent(evt); } } } } function scrollToX(scrollObj, scrollDuration, scrollTo) { try { var orgTitle = scrollObj.title; var scrollLeft = scrollObj.scrollLeft; var scrollStep = Math.PI / (scrollDuration / 10); var cosParameter = (scrollLeft - scrollTo) / 2; var scrollCount = 0, scrollMargin = 0; if (scrollObj.title != 'scrolling...') { if ((scrollDuration == 0) || (scrollLeft == scrollTo)) { scrollObj.scrollLeft = scrollTo; } else { scrollObj.title = 'scrolling...'; if (typeof(requestAnimationFrame)==='function') { //HTML 5 function step () { setTimeout(function() { if (scrollCount * scrollStep < Math.PI) { requestAnimationFrame(step); scrollMargin = cosParameter - cosParameter * Math.cos(scrollCount * scrollStep); scrollObj.scrollLeft = scrollLeft - scrollMargin; scrollCount = scrollCount + 1; } else { scrollObj.scrollLeft = scrollTo; scrollObj.title = orgTitle; } }, 10 ); } requestAnimationFrame(step); } else { //HTML 4- var scrollInterval = setInterval(function() { if (scrollCount * scrollStep < Math.PI) { scrollMargin = cosParameter - cosParameter * Math.cos(scrollCount * scrollStep); scrollObj.scrollLeft = scrollLeft - scrollMargin; scrollCount = scrollCount + 1; } else { scrollObj.scrollLeft = scrollTo; clearInterval(scrollInterval); scrollObj.title = orgTitle; } }, 10 ); } } return true; } else { return false; } } catch (e) { return false; } } function parseITCubeForm(theForm,theFields,theMultipleDelimiter,includeAllFields) { var elem = theForm.elements; var theResult = new Array(); for (var i = 0; i < elem.length; i++) { if (theFields[elem[i].name]) { if (elem[i].type == 'select-one') { if (includeAllFields || elem[i].value != theFields[elem[i].name][1]) theResult[theFields[elem[i].name][0]] = elem[i].options[elem[i].selectedIndex].text; } else if (elem[i].type == 'select-multiple') { var str = ''; for (var counter=0; counter0?theDifference:0)); if (theDate) { EndDate.value=formatITCubeDate(theDate); EndTime.value=formatITCubeDate(theDate,'Time'); } } } } if (StartDate && StartTime) { StartDate.addEventListener('change', function(e) {theFunction(StartDate,StartTime,EndDate,EndTime,e)}); StartTime.addEventListener('change', function(e) {theFunction(StartDate,StartTime,EndDate,EndTime,e)}); bindITCubePreviousValue([StartDate,StartTime]); } } function bindITCubeDataList(theField,theDataListOptions) { if (theField) { var theDataList = document.createElement('datalist'); var theDataListId = 'itcdatalist_'+theField.getAttribute('name'); theDataList.setAttribute('id', theDataListId); document.body.appendChild(theDataList); theField.setAttribute('list', theDataListId); if (!Array.isArray(theDataListOptions)) theDataListOptions=theDataListOptions.split('\n'); theDataListOptions.forEach(function(theItem){ var theOption = document.createElement('option'); theOption.value = theItem; theDataList.appendChild(theOption); }); } } function addITCubeDynamicField(theParent,theType,theId,theName,theStyle,theClass,theOptions) { if (theParent&&theType) { var theField = document.createElement(theType); if (theId) theField.setAttribute('id',theId); if (theName) theField.setAttribute('name',theName); if (theClass) theField.setAttribute('class',theClass); if (theStyle) theField.setAttribute('style',theStyle); if (theOptions) { for (var theOptionsCounter=0;theOptionsCounter e.value).join(','); } function scrollToITCubeElement(theElementId, theAnimation) { if (theElementId && theElementId!='' && document.getElementById(theElementId)) { theObject=document.getElementById(theElementId); theObject.style.animation = ""; theObject.scrollIntoView({behavior: "smooth", block: "end", inline: "nearest"}); theObject.style.animation = "1s ease 0.2s "+(theAnimation?theAnimation:"zoomoutbg"); theObject.style.animationFillMode = "forwards"; } } function itcAddClass(theObject,theClass) { if (!theObject.classList.contains(theClass)) theObject.classList.add(theClass); } function itcDelClass(theObject,theClass) { if (theObject.classList.contains(theClass)) theObject.classList.remove(theClass); } function itcHasClass(theObject,theClass) { return theObject.classList.contains(theClass); } function itcDelOptions(theElement, isDomMode) { if (isDomMode) { while (theElement.options.length) theElement.options.remove(0); theElement.selectedIndex=-1; } else { theElement.length=0; theElement.selectedIndex=-1; } } function removeAttributeITCubeInput(theInputs, theAttribute) { for (var inputCounter=0;inputCounter-1?null:selectSrcElementValue); if (selectSrcElementRegisterEvent) { if (selectSrcElement.addEventListener) { selectSrcElement.addEventListener('change', function(e) { bindITCubeMaskedList(selectDstElement,selectDstElementAttributeName,selectDstElementRemoveMode,selectDstElementResetValue,selectSrcElement,selectSrcElementValueInactive,selectSrcElementValueFunction); }); } } else { if (selectDstElementResetValue!=null&&selectSrcElementValue!=null) { selectDstElement.value=selectDstElementResetValue; selectDstElement.dispatchEvent(new Event('change')); } if (selectDstElementRemoveMode) document.form.submit(); } initITCubeMaskedList(selectDstElement,selectDstElementAttributeName,selectSrcElementValue,selectDstElementRemoveMode); } } function initITCubeDynamicList(selectElement,visibleOptions,isMoreOption,isPreventAutoReload) { var orginalOptions=[]; var isHiddenOption=false; if (!isPreventAutoReload && selectElement.loadOrginalOptions) selectElement.loadOrginalOptions(); for (var j = 0; j < selectElement.length; j++) { if (visibleOptions instanceof Array) { if (visibleOptions.indexOf(selectElement.options[j].value)==-1) selectElement.options[j].setAttribute("hidden","yes"); } else { if (!(new RegExp(visibleOptions,"g")).test(selectElement.options[j].value)) selectElement.options[j].setAttribute("hidden","yes"); } } for (var j = 0; j < selectElement.length; j++) { if (selectElement.options[j].getAttribute("hidden")!=null&&selectElement.options[j].selected==false) { selectElement.options[j].removeAttribute("hidden"); orginalOptions.push([selectElement.options[j],(selectElement.options[j].selected?true:false)]); selectElement.removeChild(selectElement.options[j]); isHiddenOption=true; j--; } else { selectElement.options[j].removeAttribute("hidden"); orginalOptions.push([selectElement.options[j],(selectElement.options[j].selected?true:false)]); } } selectElement.orginalOptions=orginalOptions; selectElement.loadOrginalOptions=function() { this.length=0; for (var i = 0; i < this.orginalOptions.length; i++) { this.orginalOptions[i][0].selected=this.orginalOptions[i][1]; this.add(this.orginalOptions[i][0]); } this.blur(); } if (isHiddenOption && isMoreOption) { var optionElement=document.createElement("option"); optionElement.text='Rozwiń listę'; optionElement.dataset.itctype='dynamiclistunhide'; selectElement.add(optionElement); selectElement.addEventListener('change', function() { if (this.querySelector('option[data-itctype="dynamiclistunhide"]') && this.querySelector('option[data-itctype="dynamiclistunhide"]').selected) { this.loadOrginalOptions(); } else { if (orgFunction) orgFunction(); } }); } } function autoresizeITCubeInputDispatchBlurEvent(baseElement, nextElement) { nextElement.addEventListener('blur', function ITCubeInputDispatchBlurEvent (e) { if (e.relatedTarget&&((e.relatedTarget.type&&e.relatedTarget.type=='select-one')||(e.relatedTarget.classList&&(e.relatedTarget.classList.contains('dynamicsizefoldprevent')||e.relatedTarget.classList.contains('buttonlarge'))))) autoresizeITCubeInputDispatchBlurEvent(baseElement, e.relatedTarget); else if (e.relatedTarget!==baseElement) { if (e.relatedTarget&&e.relatedTarget.classList&&(e.relatedTarget.classList.contains('itclabelcon')||e.relatedTarget.classList.contains('button'))) { e.relatedTarget.addEventListener('click', function ITCubeInputDispatchClickEvent() { baseElement.style.transitionProperty='';baseElement.style.height=parseInt(baseElement.dataset.height)+'px'; e.relatedTarget.removeEventListener('click', ITCubeInputDispatchClickEvent); }) } else { baseElement.style.transitionProperty='';baseElement.style.height=parseInt(baseElement.dataset.height)+'px'; } } nextElement.removeEventListener('blur', ITCubeInputDispatchBlurEvent); }); } function autoresizeITCubeInput(theInputs,isInitialized) { if (!isInitialized) { scrollITCubeInput(theInputs); var theButtons=document.querySelectorAll('IMG.button, IMG.buttonlarge, INPUT[type=image].button, INPUT[type=image].buttonlarge, LABEL.itclabelcon, .dynamicfoldwait'); for (var Counter=0;Counter0?theInput.getBoundingClientRect().height:(theInput.getAttribute('size')?theInput.getAttribute('size'):(theInput.getAttribute('rows')?theInput.getAttribute('rows'):1))*26.0):parseInt(theInput.style.height)); var theMaxHeight=(isNaN(parseInt(theInput.style.maxHeight))?theHeight*3:parseInt(theInput.style.maxHeight)); theInput.dataset.orgheight=theInput.style.height; theInput.dataset.orgmaxHeight=theInput.style.maxHeight; theInput.dataset.height=theHeight; theInput.dataset.transitionTimestamp=(new Date()).getTime(); theInput.style.height=theHeight+'px'; theInput.style.maxHeight=theMaxHeight+'px'; theInput.classList.add('dynamicsize'); theInput.addEventListener('focus', theInput.ITCubeInputFocusEvent=function ITCubeInputFocusEvent(e) { hidecallendar(); e.target.style.transitionProperty=''; e.target.style.height=(e.target.scrollHeight<=parseInt(e.target.dataset.height)?parseInt(e.target.dataset.height):e.target.scrollHeight+(e.target.dataset.orgheightChanged?1:5))+'px'; e.target.dataset.transitionTimestamp=(new Date()).getTime(); e.target.dataset.orgheightChanged=true; if (false) {window.setTimeout(function() {e.target.scrollIntoView({behavior:'smooth',block:(false||e.target.dataset.itcsnapnearest?'nearest':'center'),inline:'nearest'});},(0.1+parseFloat(getComputedStyle(e.target).transitionDuration)+parseFloat(getComputedStyle(e.target).transitionDelay))*1000*(e.target.scrollHeight<=parseInt(e.target.dataset.height)?0.33:1))} }); if (theInput.type!='select-multiple') { theInput.addEventListener('input', theInput.ITCubeInputInputEvent=function ITCubeInputInputEvent(e) { e.target.style.transitionProperty='none'; e.target.style.height=(e.target.scrollHeight<=parseInt(e.target.style.height)?parseInt(e.target.style.height):e.target.scrollHeight+5)+'px'; }); } } else { if (false) { theInput.contentWindow.addEventListener('focus', theInput.ITCubeInputFocusEvent=function ITCubeInputFocusEvent(e) { e.target.parent.document.getElementById('editorData').scrollIntoView({behavior:'smooth',block:(false?'nearest':'center'),inline:'nearest'}); }); theInput.addEventListener('load', theInput.ITCubeInputLoadEvent=function ITCubeInputLoadEvent(e) { e.target.contentWindow.addEventListener('focus', e.target.ITCubeInputFocusEvent); }); } } } } function removeresizeITCubeInput(theInputs) { for (var inputCounter=0;inputCounter=theMaxHeight); } function getITCubeContentOverflowViewport(theObject, theMargin) { const theBounds = theObject.getBoundingClientRect(); return {topOverflow: -1*(theBounds.top-theMargin), leftOverflow: -1*(theBounds.left-theMargin), bottomOverflow: -1*((window.innerHeight || document.documentElement.clientHeight)-(theBounds.bottom+theMargin)), rightOverflow: -1*((window.innerWidth || document.documentElement.clientWidth)-(theBounds.right+theMargin))}; } function scrollITCubeInput(theInputs) { for (var inputCounter=0;inputCounter1?theInputs[inputCounter].options[theInputs[inputCounter].selectedIndex].offsetTop-theInputs[inputCounter].options[theInputs[inputCounter].selectedIndex].clientHeight:0); } function titleITCubeMultipleSelect(theElements) { for (var elementCounter=0;elementCounter0) { if (theHeight-theBottomOverflow>128.0) { theElementClone.style.height=theHeight-theBottomOverflow; } else { theElementClone.style.top=-theHeight; theElementClone.style.clipPath='polygon(0% 100%, 100% 100%, 100% 100%, 0% 100%)'; var theTopOverflow=getITCubeContentOverflowViewport(theElementClone,(typeof parent.mainMenuPage === 'undefined'?5:75)).topOverflow; if (theTopOverflow>0) if (theHeight-theTopOverflow>theMinHeight) { theElementClone.style.height=theHeight-theTopOverflow; theElementClone.style.top=-(theHeight-theTopOverflow); } else { theElementClone.style.height=theMinHeight; theElementClone.style.top=-theMinHeight; } } } if (theRightOverflow>0) theElementClone.style.width=(theWidth-theRightOverflow>0?theWidth-theRightOverflow:0); scrollITCubeInput([theElementClone]); theElement.classList.add('focus'); theElementClone.focus(); theElementClone.style.scrollbarWidth=(theElementClone.scrollHeight>theElementClone.clientHeight?'thin':'none'); theElementClone.style.transition=''; theElementClone.style.clipPath='polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)'; theElementClone.style.opacity='1.0'; } else { if (isSync) { theElement.selectedIndex=theElementClone.selectedIndex; theElement.dispatchEvent(new Event('change')); } theElementClone.style.display='none'; theElementClone.style.opacity='0'; theElement.classList.remove('focus'); if (!isBlur) theElement.focus(); } } function wrapITCubeSingleSelectSync(theElement) { if (theElement.type=='select-one') { if (theElement.classList.contains('pictureditems')) { theElement.style.setProperty('--itc-picture', theElement.options[theElement.selectedIndex].style.getPropertyValue('--itc-picture')); } } else if (theElement.type=='select-multiple') { theElement.style.removeProperty('--itc-picture'); } } function fireITCubeEvent(theElement,theEvent) { if (theElement) theElement.dispatchEvent(new Event((theEvent?(theEvent.type?theEvent.type:theEvent):'change'))); } function fireITCubeMouseEvent(theElement,theEvent) { if (theElement) theElement.dispatchEvent(new MouseEvent((theEvent?(theEvent.type?theEvent.type:theEvent):'click'),{clientX: theElement.getBoundingClientRect().left, clientY: theElement.getBoundingClientRect().bottom, screenX: 0, screenY: 0})); } function preventITCubeSqlAction(theForm, theIndices) { var theInput = theForm.querySelector("input[name='PreventNonstandardSqlAction']"); if (!theInput) { theInput = document.createElement('input'); theInput.type = 'hidden'; theInput.name = 'PreventNonstandardSqlAction'; theForm.appendChild(theInput); } theInput.value = ''; for (var theIndex=0; theIndex1?"
  • ":"")+submitMessage[counter]); if (submitMessage.length>0) { itcInfo(theMessage,function () {itcFormSubmit(theSubmit);}); submitMessage.length=0; return false; } } function itcIsOffline() { try { if (false || getAjaxResponse('itcubePING.jsp?ping=yes')=='OK') return false; else return true; } catch(err) { return true; } } function rewriteITCubeSelect(theStringValue,theField) { return rewriteITCubeMultiple([theStringValue],theField,false,true); } function rewriteITCubeMultiple(theStringValues,theField,isAppend,isEvent) { var orginalOptions=[];var isSelected=false; for (var theFieldCounter=0;theFieldCounterPersonId and PersonId='"+thePerson+"' and '"+theStartDate+"'<=AbsenceDateEnd and ('"+theStartTime+"'=AbsenceDateStart and ('"+theEndTime+"'>StartTime or '"+theEndDate+"'>AbsenceDateStart) order by AbsenceDateEnd desc, EndTime desc limit 2")).split('\n'); var isMultiple=(theResult.length>1?true:false); theResult=theResult[0].split('\t'); var theDeputy=(theResult.length==3?{DeputyId:theResult[0],DeputyName:theResult[1],AbsenceTo:theResult[2]}:null); if (theDeputy) { if (theField) { if (isMultiple) itcAlert((theMode=='accepter'?'Akceptująca osoba jest aktualnie nieobecna, nie jest jednak możliwe jednoznaczne wyznaczenie zastępcy':(theMode=='deputy'?'Zastępująca osoba jest nieobecna w podanym okresie, nie jest jednak możliwe jednoznaczne wyznaczenie zastępcy':'Realizująca osoba jest nieobecna w podanym okresie, nie jest jednak możliwe jednoznaczne wyznaczenie zastępcy'))); else itcConfirm((theMode=='accepter'?'Akceptująca osoba jest nieobecna w okresie !AbsenceTo!, czy zmienić wartość pola Akceptujący na osobę zastępującą (!DeputyName!) ?':(theMode=='deputy'?'Zastępująca osoba jest nieobecna w okresie !AbsenceTo!, czy zmienić wartość pola Zastępujący na osobę zastępującą (!DeputyName!) ?':'Realizująca osoba jest nieobecna w okresie !AbsenceTo!, czy zmienić wartość pola Realizator na osobę zastępującą (!DeputyName!) ?')).replace(/!DeputyName!/gi,theDeputy.DeputyName).replace(/!AbsenceTo!/gi,theDeputy.AbsenceTo),function () { for (var theFieldCounter=0;theFieldCounter { var isPasswordCheck=(thePasswordCheck.type=='checkbox'&&thePasswordCheck.checked)||(thePasswordCheck.type=='hidden'&&thePasswordCheck.value==1); thePassword.placeholder=(isPasswordCheck?'':'Pozostaw bez zmian'); thePassword.readOnly=(isPasswordCheck?false:true); if (!isPasswordCheck) { thePassword.value=''; thePassword.dispatchEvent(new Event('keyup')); thePassword.dispatchEvent(new Event('change')); } }); if (isInit) { thePasswordCheck.addEventListener('click',function(e) {synchPasswordFields(thePasswordValue,thePasswordCheck)}); } } } function urlParameterEncode(theString) { return theString.replace('%','%25').replace('&','%26').replace('#','%23'); } function regexpParameterEncode(theString) { return theString.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1"); } function formatNumber(text,forceInteger) { if (forceInteger) return text.replace(/[^\d-]/g,''); else return text.replace(/[^\d.,-]/g,'').replace(/,/gi,'.'); } function stringStartsEndsWith(stringToCheck,query,mode) { if (mode=='starts') return (stringToCheck.substr(0, query.length).toUpperCase() == query.toUpperCase()); else return (stringToCheck.substr(stringToCheck.length-query.length, stringToCheck.length).toUpperCase() == query.toUpperCase()); } function itcGetLng() { return 'pl'; } function itcMapGeolocation(theAddress) { var theLatLon = JSON.parse(getAjaxResponse('https://nominatim.openstreetmap.org/search?format=json&limit=1&q='+encodeURIComponent(theAddress))); if (theLatLon.length>0) return [parseFloat(theLatLon[0].lat).toFixed(6),parseFloat(theLatLon[0].lon).toFixed(6)]; else return null; } function itcMapInit(mapContainer, mapIsCluster, mapMaxZoom) { var theToken = ''; var theMap = L.map(mapContainer); L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token='+theToken, { attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © Mapbox', maxZoom: (mapMaxZoom?mapMaxZoom:18), id: 'mapbox/streets-v11', tileSize: 512, zoomOffset: -1, accessToken: theToken }).addTo(theMap); var theMapCluster = L.markerClusterGroup({showCoverageOnHover: false, iconCreateFunction: function (cluster) { var childCount = cluster.getChildCount(); var c = ' marker-cluster-'; if (childCount < 10) {c += 'small';} else if (childCount < 100) {c += 'medium';} else {c += 'large';} return new L.DivIcon({ html: '
    ' + childCount + '
    ', className: 'marker-cluster' + c, iconSize: new L.Point(50, 50)}); } }); theMap.addLayer(theMapCluster); return [theMap, (mapIsCluster?theMapCluster:theMap)]; } function itcMapPaint(theMap, mapAutoPopup, mapCenter, mapInitZoom) { var markerLayer = new L.featureGroup(); theMap[1].eachLayer(function (theMarker) {if (theMarker.options && theMarker.options.itcGetBounds) markerLayer.addLayer(theMarker);}); if (markerLayer.getLayers().length>1) theMap[0].fitBounds(markerLayer.getBounds(), {padding: L.point(10, 10)}); else if (markerLayer.getLayers().length==1) theMap[0].setView([markerLayer.getBounds().getCenter().lat, markerLayer.getBounds().getCenter().lng], 8); else theMap[0].setView((mapCenter?mapCenter:[52.15,19.33]), (mapInitZoom?mapInitZoom:6)); if (mapAutoPopup) theMap[1].eachLayer(function (theMarker) {if (theMarker.options && theMarker.options.itcMarker) theMarker.openPopup();}); } function itcMapMarker(theMap, theType, theTitle, thePopup, theLat, theLon, theSize, theColor, theAddress) { if (theLon&&theLat) { itcMapPaintMarker(theMap, theType, theTitle, thePopup, theLat, theLon, theSize, theColor) } else if (theAddress) { var theGeolocation = itcMapGeolocation(theAddress); if (theGeolocation.length>0) itcMapPaintMarker(theMap, theType, theTitle, thePopup, theGeolocation[0].lat, theGeolocation[0].lon, theSize, theMinZoom, theMaxZoom, theColor) } } function itcMapPaintMarker(theMap, theType, theTitle, thePopup, theLat, theLon, theSize, theColor) { var theMarker; if (theType=='' || theType=='marker') { if (theColor&&theColor!='') { L.Icon.Default.prototype.options.iconUrl = theColor+'.png'; L.Icon.Default.prototype.options.iconRetinaUrl = theColor+'-2x.png'; } theMarker = L.marker([theLat, theLon],{itcMarker: 'yes', itcGetBounds: 'yes' }); theMarker.addTo(theMap[1]); } else if (theType=='circlemarker'||theType=='circlepixels') { theMarker = L.circleMarker([theLat, theLon], {color: (theColor&&theColor!=''?theColor:'#b00000'), weight: 1, fillColor: (theColor&&theColor!=''?theColor:'#b00000'), fillOpacity: 0.5, radius: (theSize!=null?theSize:0), itcMarker: 'yes', itcGetBounds: 'yes'}); theMarker.addTo((theType=='circlemarker'?theMap[1]:theMap[0])); } else if (theType=='circlemeeters') { theMarker = L.circle([theLat, theLon], {color: (theColor&&theColor!=''?theColor:'#b00000'), weight: 1, fillColor: (theColor&&theColor!=''?theColor:'#b00000'), fillOpacity: 0.5, radius: (theSize!=null?theSize:0), itcMarker: 'yes'}); theMarker.addTo(theMap[0]); } if (thePopup&&thePopup!='') theMarker.bindPopup(thePopup,{autoClose:false, closeOnClick:false, className: 'itcMapPopup'}); if (theTitle&&theTitle!='') theMarker.bindTooltip(theTitle,{interactive:true, permanent:true, direction:(theType=='' || theType=='marker'?'auto':'top'), className: 'itcMapToolTip'}); } function itcMapRemoveEvents(theElement) { return theElement.replaceWith(theElement.cloneNode(true)); } function itcAddTouchDesktopItem(theActionName, theAction) { if (true&&document.getElementById('itcformtitlebar')&&document.getElementById('itcTouchDisplay')) { var theActionBtn = document.createElement("LABEL"); itcAddClass(theActionBtn,'touchtext'); theActionBtn.innerHTML=theActionName; theActionBtn.addEventListener('click',theAction); document.getElementById('itcTouchDisplay').appendChild(theActionBtn); document.getElementById('itcformtitlebar').style.overflow='hidden'; } } function itcDeriveFormFields(srcForm, dstForm, excludedFields, nameMapFunction) { theFields=srcForm.querySelectorAll('INPUT[type="text"], INPUT[type="checkbox"], INPUT[type="color"], TEXTAREA, SELECT:not([multiple]):not(.itcubeclonedselect)'); for (var i=0; i