/* Functies: - mouse(menuoption,newimg,statustext) - mouseclick(menuoption,newimg,stdimg,statustext) - getCurrentDBName() - left(pString,pLeftOf, pReturn) - leftback(pString,pLeftOf, pReturn) - rebuildURL(pUrl) - secureWindow(pSecure, pHref) - link(url,target,pSecure) - CheckStatus() - NewWindow(link,w,h) - CheckType(veld) - CheckValue(fld) - openURLinFrame(url,target) - OpenNewWindow(naam,url,propsOpties) - statusBalk(tekst) */ /* -------------------------------------------------------------------------------------------------------------------------------------------------------------- Purpose: Changes the images of the menuoptions on mouse-over/out Author: Liza Top Created: 29-10-2002 (dd-mm-yyyy) Used in: Form: Menu -------------------------------------------------------------------------------------------------------------------------------------------------------------- */ var selectedstdimg = ""; var selectedmenuoption = ""; function mouse(menuoption,newimg,statustext) { window.status=statustext; if (selectedmenuoption!=menuoption) { if (document.images[menuoption]) document.images[menuoption].src = newimg; } return true; } function mouseclick(menuoption,newimg,stdimg,statustext) { if (selectedmenuoption!="") { if (document.images[selectedmenuoption]) document.images[selectedmenuoption].src = selectedstdimg } if (document.images[menuoption]) document.images[menuoption].src = newimg; selectedstdimg=stdimg; selectedmenuoption=menuoption; return true; } /* -------------------------------------------------------------------------------------------------------------------------------------------------------------- Purpose: Retrieve current database name and path Author: Liza Top Created: 29-10-2002 (dd-mm-yyyy) Used in: Returns database name and path, based on the current url -------------------------------------------------------------------------------------------------------------------------------------------------------------- */ function getCurrentDBName() { startPath = location.pathname; mark = startPath.indexOf(".nsf"); mark = mark + 4; dbname = startPath.substring(0,mark); return(dbname); } /*================================================================================= functie : left parameters : pString = totale string pLeftOf= vanaf deze tekst pReturn = geef de string terug als het patroon niet gevonden is(true) geef een lege string terug als het patroon niet gevonden is(false) Default is false doel : creatie : 25-04-2003 auteur : Kris van Kooten gewijzigd : door : reden : =================================================================================*/ function left(pString,pLeftOf, pReturn) { if(pReturn==null) pReturn = false; iPos=pString.indexOf(pLeftOf); iResult = pString.substring(0,iPos); if(iResult=="" && pReturn) return pString; return iResult } /*-------------------------------------------------------------------------------------------------------------------------------- functie : leftback parameters : pString = totale string pLeftOf= vanaf deze tekst pReturn = geef de string terug als het patroon niet gevonden is(true) geef een lege string terug als het patroon niet gevonden is(false) Default is false doel : creatie : 25-04-2003 auteur : Kris van Kooten gewijzigd : door : reden : --------------------------------------------------------------------------------------------------------------------------------*/ function leftback(pString,pLeftOf, pReturn){ if(pReturn==null) pReturn = false; iPos=pString.lastIndexOf(pLeftOf); iResult = pString.substring(0,iPos); if(iResult=="" && pReturn) return pString; return iResult } /* -------------------------------------------------------------------------------------------------------------------------------------------------------------- Functie : secureWindow Doel :vertalen van ../ naar totale url Creatie : 12-10-05 1.5.2 KRIS Uitleg : Voorbeelden: start nsf: http://brein.nl/dir/subdir/webgen.nsf ../view?openview > : http://brein.nl/dir/subdir/webgen.nsf/view?openview ../../test.nsf?opendatabase > : http://brein.nl/dir/subdir/test.nsf?opendatabase ../../../test.nsf?opendatabase> : http://brein.nl/dir/test.nsf?opendatabase /xxx.nsf : http://brein.nl/xxx.nsf (Publ+paginas+op+Unid)/etc.. : http://brein.nl/dir/subdir/webgen.nsf/(Publ+paginas+op+Unid)/etc.. -------------------------------------------------------------------------------------------------------------------------------------------------------------- */ function rebuildURL(pUrl) { var iPreUrl="http://" +window.location.host +curdbPad; var iPath = leftback(iPreUrl,"/",true); if(pUrl.indexOf("..")>-1) { var iArray = pUrl.split("../") if(iArray.length==2) { //---- ../view?openview > : http://brein.nl/dir/subdir/webgen.nsf/view?openview pUrl = iPreUrl +"/" +iArray[iArray.length-1] } else { // overig var iNewPath=iPath; for (var k=2;k-1) { // link verpakt in javascript, splitsen van script var iArray = pHref.split('","'); pHref=""; for(var j=0;j-1) pHref = pHref.replace("https","http"); } return pHref; } /* -------------------------------------------------------------------------------------------------------------------------------------------------------------- Purpose: Opens the given url in the given target after checking url for being from 'linkbeheer' Author: Liza Top Created: 29-10-2002 (dd-mm-yyyy) Used in: Form: Menu Aangepast : 11-10-05 1.5.2 KRIS Doesn't return anything -------------------------------------------------------------------------------------------------------------------------------------------------------------- */ function link(url,target,pSecure) { if (url.length==4) { jsarr=jsstring.split(";") for (j=0;j=0) { blankwindowprops=target.substring(target.indexOf('^^')+2,target.length) target='_blank' } else { blankwindowprops="" } if(target=="" || target=="_top") { //11-10-05 2.5.2 KRIS: controle op secure openen van linkje if(target=="_top") actie = secureWindow(pSecure, actie); top.location=actie } else if (target=="_self") { document.location=actie } else if (target=="_blank") { //11-10-05 2.5.2 KRIS: controle op secure openen van linkje actie = secureWindow(pSecure, actie) if (blankwindowprops!='') { OpenNewWindow('newWindow2',actie,blankwindowprops) } else { window.open(actie) } } else if (top.frames[target]) { top.frames[target].location=actie; } else { openURLinFrame(actie,target) return false; } } /* -------------------------------------------------------------------------------------------------------------------------------------------------------------- Purpose: Checks the status of the page Author: Liza Top Created: 29-10-2002 (dd-mm-yyyy) Used in: Form: Page (onLoad) When the page does not have the status 'Publiceren', it may not be displayed in the browser. The last 5 charachters of the URL are removed to force an errorpage to be opened, instead of the page. When a page is opened using the preview button it should be displayed. -------------------------------------------------------------------------------------------------------------------------------------------------------------- */ function CheckStatus(){ if (paginastatus!='Publiceren') { urlstring=document.URL.toLowerCase(); preview=urlstring.indexOf("all+op+id") //the page is not opened thru preview, therefor the page $FoutPagina must be opened. if (preview==-1) { foutpagina=curdbPad+"/pagenames/$FoutPagina?opendocument" location=foutpagina; return false; } } } /* -------------------------------------------------------------------------------------------------------------------------------------------------------------- Purpose: Opens a new window centered on the screen Author: Liza Top Created: 29-10-2002 (dd-mm-yyyy) Used in: Form: Page Used by 'afdrukversie' -------------------------------------------------------------------------------------------------------------------------------------------------------------- */ function NewWindow(link,w,h) { var winl = (screen.width - w) / 2; var wint = (screen.height - h) / 2; winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',directories=0,menubar=0,scrollbars=0,location=0,status=0,toolbar=0,resizable=0' win = window.open(link, 'Print', winprops) } /* -------------------------------------------------------------------------------------------------------------------------------------------------------------- Purpose: Determine the type of the given field Author: Liza Top Created: 29-10-2002 (dd-mm-yyyy) Used in: Form: Search function CheckValue() Returns the type of the given field: - radio - checkbox - text - textarea - select-one - select-multiple -------------------------------------------------------------------------------------------------------------------------------------------------------------- */ function CheckType(veld) { var ftype = veld.type; if (ftype == null) { var flength = veld.length; if (flength != null) { ftype = 'radio' } } return ftype } /* -------------------------------------------------------------------------------------------------------------------------------------------------------------- Purpose: Retrieve the value of the given field Author: Liza Top Created: 29-10-2002 (dd-mm-yyyy) Used in: Form: Search Returns 'false' when radiobuttons, checkboxes, select & mulitple select fields do not have a selected option, otherwise it returns the value of the selected option In case of radiobuttons and checkboxes, first step is checking whether there are 1 or multiple options. When there is 1 option, it's checked whether this option is selected. If so, the value of the selected option is returned. If it isn't selected, the function returns 'false'. When there are multiple options, the functions loops through them until the selected one is found, after which the value of that option is returned by the function. If nothing is selcted, the function returns 'false'. In case of select-one or select-mulitple, the functions loops through them until the selected one is found, after which the value of that option is returned by the function. If nothing is selcted, the function returns 'false'. The values of text and textarea fields are returned immediatly. An empty field is returned as een empty string ------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ function CheckValue(fld) { if ((fld==undefined) || (fld==null)) { return null } else { aFldType=CheckType(fld) var bFound=false switch (aFldType){ case "radio": case "checkbox": checkboxValuesArray = new Array() if (fld.length==null){ // there is only 1 option, so check immediatly whether it's selected if (fld.checked) { bFound=true checkboxValuesArray[0]=fld.value } } else { // there are multiple options present, so loop through them for (var counter=0; counter