// @current revision 2/17/2009 11:55:27 AM +mlp // @previous revision 7.28.2008 +mlp if (!window.XMLHttpRequest) { window.IE6 = true; window.XMLHttpRequest = function() { var oMSAXO; if(typeof(window.ActiveXObject)=='function') { oMSAXO = new ActiveXObject('Msxml2.XMLHTTP'); if(oMSAXO.readyState!=0) { oMSAXO = new ActiveXObject('Microsoft.XMLHTTP') } if(oMSAXO.readyState!=0) { //no ajax for you, begone! oMSAXO=false; } } return oMSAXO; }; } else { window.IE6 = false; } //************************************************************ Function.prototype.ajaxEvent = function (url, oElement, append, queued, sFunction, aArguments, get_post) { //function ajaxEvent(url, oElement, append, queued, sFunction, aArguments, get_post) { //NOTE: the queued variable is confusing since it's the inverse of the xmlhttp implementation for asynchronous mode. keep it this way for backwards compatibility... if(!url){return(false);} //REQUEST URL if (get_post!='POST') { //defaults to GET get_post = 'GET' } else { get_post= 'GET' } if (append===false) { append=false; } else { append=true; } //replace||append into callback div. if(!oElement){ //no callback } else { if (typeof(oElement)=='string') { //id of element, resolve to DOM reference oElement=document.getElementById(oElement); //resolve to object if id passed in returns false and indicates no callback if DOM Element doesn't exist } if(oElement) { //custom for loading animation if(oElement.parentNode) { //custom for loading animation var loRE = new RegExp('folder'); (loRE.test(oElement.parentNode.className))?(ClassFX.addClass(oElement.parentNode,'loading')):(null); } } } if (!window.XMLHttpRequest) { window.IE6 = true; window.XMLHttpRequest = function() { var oMSAXO; if(typeof(window.ActiveXObject)=='function') { oMSAXO = new ActiveXObject('Msxml2.XMLHTTP'); if(oMSAXO.readyState!=0) { oMSAXO = new ActiveXObject('Microsoft.XMLHTTP') } if(oMSAXO.readyState!=0) { //no ajax for you, begone! oMSAXO=false; } } return oMSAXO; }; } var oXMLHTTP = new XMLHttpRequest(); //CALL if (!oXMLHTTP) {callbackEvents(false,oElement,append); return;} if (oXMLHTTP.overrideMimeType) {oXMLHTTP.overrideMimeType('text/xml');} //override to text/xml -oops, cant use this for anything else if we do this. var lAsynch = true; if (queued) { //switch value here for clarity, since it was't set up right. lAsynch = false; } else { lAsynch = true; } //for ie6 if(window.IE6) { //the gap between older implementations and newer ones is getting wider... FF3 = drastically incompatible with IE6 oXMLHTTP.open('GET', url, lAsynch);//submit request (asynchronous = true) oXMLHTTP.onreadystatechange = function () { if (oXMLHTTP.readyState == 4) { if(oXMLHTTP.status == 200) { callbackEvents(oXMLHTTP.responseText,oElement,append); if(typeof(this[sFunction])=='function') { this[sFunction]; } } } }; oXMLHTTP.send(null); //required to send to null } else { //Exactly right implementation in FF3/IE7. Extend the object firing event passing in context to event recipient. oXMLHTTP.callBack = oElement; oXMLHTTP.append = append; if (lAsynch) { //asynchronous request. oXMLHTTP.open('GET', url, lAsynch);//submit request (asynchronous = true) oXMLHTTP.onreadystatechange = function (aEvt) { if (oXMLHTTP.readyState == 4) { if(oXMLHTTP.status == 200) { callbackEvents(oXMLHTTP); if(sFunction) { if(typeof(window[sFunction])=='function') { try { window[sFunction](aArguments); } catch(e) { trace('/*no dice*/'); } } else if(typeof(this[sFunction])=='function') { try { this[sFunction](aArguments); } catch(e) { trace('/*no dice*/'); } } else if(typeof(sFunction)=='string') { try { eval(sFunction+'('+aArguments+');'); } catch(e) { trace('/*no dice*/'); } } else { /*fuzzy dice*/ } } } } }; oXMLHTTP.send(null); //required to send to null } else { //synchronous request, i have to call this differently or firefox won't perform the callback function oXMLHTTP.open('GET', url, lAsynch); //submit request (asynchronous = true) oXMLHTTP.send(null); //required to send to null if(oXMLHTTP.status == 200) { callbackEvents(oXMLHTTP); if(sFunction) { if(typeof(window[sFunction])=='function') { try { window[sFunction](aArguments); } catch(e) { trace('/*no dice*/'); } } else if(typeof(this[sFunction])=='function') { try { this[sFunction](aArguments); } catch(e) { trace('/*no dice*/'); } } else if(typeof(sFunction)=='string') { try { eval(sFunction+'('+aArguments+');'); } catch(e) { trace('/*no dice*/'); } } else { /*fuzzy dice*/ } } } } } } //************************************************************ //overwrite placeholder calls... var ajaxEvent = function (url, oElement, append, queued, sFunction, aArguments, get_post) { Function.ajaxEvent(url, oElement, append, queued, sFunction, aArguments, get_post); }; //***************************************** function preCallBack(oElement,luValue) { return true; } //************************************************************ function callbackEvents(oXMLHTTP,oElement,append){ //specific task for call back if (typeof(oXMLHTTP)!='object') { sResponseData = oXMLHTTP; } else { var sResponseData = ''; if(oXMLHTTP==false) { sResponseData = 'Request failed, unsupported XMLHTTP implementation'; } else { sResponseData = oXMLHTTP.responseText; } } if (oXMLHTTP.callBack==null) { //ie6 won't extend activeXObject oElement=(oElement==false)?(null):(oElement); } else { oElement=oXMLHTTP.callBack; } lAppend=(append===true)?(true):( (append===false)?(false):(oXMLHTTP.append) ); if(!oElement) { return; } else { preCallBack(oElement,sResponseData); var loRE = /input/ig; if(loRE.test(oElement.tagName)) { oElement.value = (lAppend)?(oElement.value + sResponseData):(sResponseData); } else { //textarea||div etc. oElement.innerHTML = (lAppend)?(oElement.innerHTML + sResponseData):(sResponseData); } postCallBack(oElement,sResponseData); } return; } //************************************************************ function postCallBack(oElement,luValue) { if(oElement.parentNode) { var loRE = new RegExp('loading'); (loRE.test(oElement.parentNode.className))?(ClassFX.removeClass(oElement.parentNode,'loading')):(null); (ClassFX.hasClass(oElement.parentNode,'loading'))?(ClassFX.removeClass(oElement.parentNode,'loading')):(null); } return true; } //************************************************************ //DEPENDS ON getDimensions, document.getElementById(), $document.getElementById(), ClassFX, AjaxFX //notes: add expiry and toggle status bar option - also maybe an external stylesheet? //add container for ajax request...? function interstate(ProgrenetorID, width, height, URIorElement, refresh, ToolbarID ) { //simple interstitial implementation var BodyID = 'view'; //id for body element: temp required if(ProgrenetorID>=0) { //check if this is valid index and return focus to existent interstitial if(!isNaN(ProgrenetorID)) { index=ProgrenetorID; //reload contents? if(!Planetary[index]) { } else { if(Planetary[index].interGalactic.parentNode) { for (a=0;a-1 ) { //url = XMLHTTPRequest oContentElement = document.createElement('div'); var oLoadingAnimation = new loadingAnimation( 'large', false ); oContentElement.appendChild( oLoadingAnimation.render() ); ajaxEvent(URIorElement, oContentElement, false, true ); //load contents oLoadingAnimation.destroy(); } else { //dom element, load pre-rendered contents oContentElement = document.createElement('div'); oContentElement.innerHTML = 'The specified content element [' + URIorElement + '] does not exist.'; } // } else { oContentElement = document.getElementById(URIorElement); //Get XMLHTTP response || Use Existing DOM Element if(!oContentElement) { //load pre-rendered contents oContentElement = document.createElement('div'); oContentElement.innerHTML = 'The specified content element [' + URIorElement + '] does not exist.'; } else { ClassFX.removeClass( oContentElement, 'none' ); ClassFX.removeClass( oContentElement, 'hidden' ); ClassFX.addClass( oContentElement, 'block' ); } } // var iOffset = Planetary.length; //offset for stacked windows iOffset = iOffset*10; //new interstitial window added to global planetary collection Planetary.push(new interstitial(width, height, iOffset, iOffset, ToolbarID)); //create in global scope index = Planetary.length-1; oParentNode = document.getElementById(BodyID); //haxxing if(!typeof(oParentNode.appendChild)=="function"){ //hmmm @todo make a routine to get a valid top level parent node if (!oParentNode) { alert('unable to access the correct dom element for object placement, sorry.'); return; } } oParentNode.appendChild(Planetary[index].render()); //add interstitial Planetary[index].interGalactic.appendChild(oContentElement); //oContentElement = either pre-rendered content or loading placeholder.. if(oContentElement.id=='') { oContentElement.setAttribute('id', Planetary[index].interGalactic.id + '_catcher'); }; EventListener.addEvent( window, 'resize', function( ) { for (a=0;a-1) { //url = XMLHTTPRequest oContentElement = document.getElementById(this.interGalactic.id+'_catcher'); if(oContentElement) { var oLoadingAnimation = new loadingAnimation('large',false); oContentElement.appendChild(oLoadingAnimation.render()); ajaxEvent(URIorElement,oContentElement,true,false); //load contents (append + asynchronous mode) oLoadingAnimation.destroy(); } }// }, show:function () { ClassFX.removeClass(this.interGalactic,'none'); ClassFX.removeClass(this.interGalactic,'hidden'); ClassFX.addClass(this.interGalactic,'visible'); }, hide:function () { ClassFX.removeClass(this.interGalactic,'visible'); ClassFX.addClass(this.interGalactic,'hidden'); ClassFX.addClass(this.interGalactic,'none'); }, close:function () { this.interGalactic.parentNode.removeChild(this.interGalactic); }, centerPosition:function () { Dimensions.refresh(); this.iObjWidth = this.interGalactic.offsetWidth; this.iObjHeight = this.interGalactic.offsetHeight; this.iTop = (Dimensions.iDocHeight>this.iObjHeight) ? (Dimensions.iScrollTop+Dimensions.iDocHeight/2-this.iObjHeight/2+'px') : (Dimensions.iScrollTop+5+'px'); //Position interstitial box this.interGalactic.style.zIndex = 24000; this.interGalactic.style.left = this.XOffset + (Dimensions.iDocWidth/2-this.iObjWidth/2)+"px"; //Position interstitial box this.interGalactic.style.top = this.YOffset + Math.floor(parseInt(this.iTop))+"px"; } } //***************************************** //recycleable loading animated gif function loadingAnimation(sType,lsSource) { lsSystemPath = '/box/system/'; //defaults lsSystemPath += (sType=='large')?('loading.gif'):('loading-small.gif'); lsSource=(lsSource||lsSystemPath); this.img=document.createElement('img'); this.img.setAttribute('id','loading-' + RID() ); //attach random id ClassFX.addClass(this.img,'hidden'); this.img.src=lsSource; } loadingAnimation.prototype = { render:function () { ClassFX.removeClass(this.img,'hidden'); return this.img; }, show:function () { this.img.style.visibility='visible'; }, hide:function () { this.img.style.visibility='hidden'; }, destroy:function () { if(this.img.parentNode) { return this.img.parentNode.removeChild(this.img); } else { this.img = null; } } } //***************************************** //transparent grey overlay function cliche(lsID, width, height, lsClass) { this.element = document.createElement('DIV'); this.element.id = lsID; this.element.width = width+'px'; this.element.height = height+'px'; this.element.className = lsClass; this.width = width; this.height = height; } cliche:prototype = { resize:function (width, height) { this.element.width = width+'px'; this.element.height = height+'px'; } } /** This is a JavaScript library that will allow you to easily add some basic DHTML drop-down datepicker functionality to your Notes forms. This script is not as full-featured as others you may find on the Internet, but it's free, it's easy to understand, and it's easy to change. You'll also want to include a stylesheet that makes the datepicker elements look nice. An example one can be found in the database that this script was originally released with, at: http://www.nsftools.com/tips/NotesTips.htm#datepicker I've tested this lightly with Internet Explorer 6 and Mozilla Firefox. I have no idea how compatible it is with other browsers. version 1.5 December 4, 2005 Julian Robichaux -- http://www.nsftools.com HISTORY -- version 1.0 (Sept. 4, 2004): Initial release. -- version 1.1 (Sept. 5, 2004): Added capability to define the date format to be used, either globally (using the defaultDateSeparator and defaultDateFormat variables) or when the displayDatePicker function is called. -- version 1.2 (Sept. 7, 2004): Fixed problem where datepicker x-y coordinates weren't right inside of a table. Fixed problem where datepicker wouldn't display over selection lists on a page. Added a call to the datePickerClosed function (if one exists) after the datepicker is closed, to allow the developer to add their own custom validation after a date has been chosen. For this to work, you must have a function called datePickerClosed somewhere on the page, that accepts a field object as a parameter. See the example in the comments of the updateDateField function for more details. -- version 1.3 (Sept. 9, 2004) Fixed problem where adding the
and