//this is a .html file instead of a .js so that FBT will serve the page with substr for all SUBS if(typeof(mmUrlAddNoContext)=="undefined")mmUrlAddNoContext=""; // there may be an input at the top or the bottom function synchronizeSuppress(input) { var value = input.checked; var suppress = document.getElementById("suppress"); if (suppress) { suppress.checked = value; } var bottomSuppress = document.getElementById("bottomSuppress"); if (bottomSuppress) { bottomSuppress.checked = value; } } function editorWin(name){ var win = window.open(mmUrlAddNoContext+"&CONTEXT="+mmContext+"&page=com.other.Editor","blank","toolbar=no,width=500,height=300"); //alert("win:"+win); //win.edited.value='xxx'; } // expand / collapse textareas var minsize = ; var maxsize = ; function initTA(taName) { if (minsize == -1) return; var ta; if (typeof document.entry_form == "undefined") { ta = eval('document.BulkForm.'+taName); } else { ta = eval('document.entry_form.'+taName); } if (ta != null) { ta.rows = minsize; ta.scrollTop=0; } } function isdefined( variable) { return (typeof(window[variable]) == "undefined") ? false: true; } function expColTA(event,taName) { if (isdefined("tinyMCE") && tinyMCE.getInstanceById(taName)) { //if (tinyMCE.getInstanceById(taName)) { // tinyMCE.get(taName).execCommand('mceFullScreen'); //} fitInfo(event,""); return; } if (minsize == -1) return; var ta; if (typeof document.entry_form == "undefined") { ta = eval('document.BulkForm.'+taName); } else { ta = eval('document.entry_form.'+taName); } if (ta != null) { if (ta.rows==minsize) { ta.rows = maxsize; // maximize if minimized } else if (ta.rows > minsize) { ta.rows = minsize; // if not minimized, minimize } else { resizeTA(event,ta); // otherwise, fit existing text } } } // resize TextArea to fit text function resizeTA(event,t) { if (minsize == -1) return; a = t.value.split('\n'); b = a.length; for (i=0; i<a.length; i++) { m = parseInt(a[i].length / 80) ; if (m > 0) { b+=m; } } if (b > t.rows) { t.rows = b; } } var notifyMax = 10; var notifyMin = 4; function expColNotify(collapse,specific) { if (minsize == -1) return; var form; if (typeof document.entry_form == "undefined") { form = eval('document.BulkForm'); } else { form = eval('document.entry_form'); } var list = eval('form.mNotifyList'+specific); var select = eval('form.notifySelect'+specific); //if (select.length<=2 && collapse==false) return; // no need to resize if (list.rows<notifyMax) { list.rows=notifyMax; select.size=notifyMax-2; } else if (collapse==true) { list.rows=notifyMin; select.size=notifyMin-2; } } function sortNotify(specific){ var form; if(typeof document.entry_form=="undefined"){ form=eval('document.BulkForm'); }else{ form=eval('document.entry_form'); } if(form){ var list=eval('form.mNotifyList'+specific); if(list&&list.value){ var re=new RegExp('[,\r\n]+',"g"); if(re){ var arr=list.value.split(re); arr.sort(function(x,y){ var a=String(x).toLowerCase(); var b=String(y).toLowerCase(); if(a>b)return 1; if(a<b)return -1; return 0;}); list.value=arr.join("\n"); } } } } var tagsFirst = "<SUB TAGSFIRST>"; function addNotify(specific) { var form; if (typeof document.entry_form == "undefined") { form = eval('document.BulkForm'); } else { form = eval('document.entry_form'); } var append = ""; var operationObj = eval('form.notifyOperation'+specific); var operation = operationObj.selectedIndex; operationObj.selectedIndex = 0; var list = eval('form.mNotifyList'+specific); var select = eval('form.notifySelect'+specific); //clear if (operation==operationObj.options.length-1) { list.value=""; return false; } //add From notifySelect for(i=0; i<select.length; i++) { if (select[i].selected == true) { if(append.length > 0 || list.value.length > 0) { append += '\n'; } var val = select[i].value; if (tagsFirst!="1") { val = select.options[i].text; } if (operation==1&&operationObj.options.length>2) { if (tagsFirst=="1") { val += "*"; } else { var index = select[i].value.lastIndexOf("["); if (index>0) { val = val.substring(0,index-1) + " *" + val.substring(index); } else { val += "*"; } } } append += val; } } list.value+=append; //sortNotify(specific); return false; } var HIGHLIGHTCLASS = "highlight"; // functions for rolling over and highlighting main menu items function rollOnAll(evt,rowId) { var index = rowId.indexOf("-RC"); if (index<0) index = rowId.indexOf("-SPACER"); if (index>-1) { // in case row field, then start with parent of group of tr rollOn(evt,rowId.substr(0,index)); return; } var row = document.getElementById(rowId); if (row.className.indexOf(HIGHLIGHTCLASS)>-1) { // in case highlight is never turned off for some reason return; } if ( row.className == "" ) { row.className = HIGHLIGHTCLASS; } else { row.className = HIGHLIGHTCLASS + " " + row.className; } // possible there is a spacer var spacer = document.getElementById(rowId+"-SPACER"); if (spacer) { spacer.className = HIGHLIGHTCLASS + " " + spacer.className; } // do all row fields for (c=1;c<10;++c) { var child = document.getElementById(rowId+"-RC"+c); if (child == undefined) { return; } child.className = HIGHLIGHTCLASS + " " + child.className; } } function rollOffAll(rowId) { var index = rowId.indexOf("-RC"); if (index<0) index = rowId.indexOf("-SPACER"); if (index>-1) { // in case row field, then start with parent of group of tr rollOffAll(rowId.substr(0,index)); return; } var row = document.getElementById(rowId); row.className = row.className.replace(HIGHLIGHTCLASS,""); row.className = row.className.replace(/^\s+|\s+$/g,''); // possible there is a spacer var spacer = document.getElementById(rowId+"-SPACER"); if (spacer) { spacer.className = spacer.className.replace(HIGHLIGHTCLASS,""); spacer.className = spacer.className.replace(/^\s+|\s+$/g,''); } // do all row fields for (c=1;c<10;++c) { var child = document.getElementById(rowId+"-RC"+c); if (child == undefined) { return; } child.className = child.className.replace(HIGHLIGHTCLASS,""); child.className = child.className.replace(/^\s+|\s+$/g,''); } } function rollOn(evt, rowId) { var e = (window.event) ? window.event : evt; var targ; if (e.target) { targ = e.target; } else if (e.srcElement) { targ = e.srcElement; } if (targ.id.indexOf("idCol")!=0 && targ.id.indexOf("user")!=0) { targ.style.cursor="pointer"; } var row = document.getElementById(rowId); row.onmouseout = new Function("rollOffAll('"+rowId+"');"); rollOnAll(evt,rowId); } // testing for main menu dropdowns function showOptionsMenu(event,baseName) { var baseDiv=document.getElementById(baseName); if (baseDiv) { baseDiv.style.left=event.clientX; if (event.target) { baseDiv.style.left+=event.target.offsetWidth; } baseDiv.style.top=event.clientY; baseDiv.style.display=""; if(baseDiv.hideEvent!=null){ clearTimeout(baseDiv.hideEvent); } baseDiv.hideEvent=null; } } function hideOptionsMenu(evt, baseName) { var baseDiv=document.getElementById(baseName); if (baseDiv) { baseDiv.style.display="none"; } } // function for clicking an issue function doNav(evt, context, rowId, type) { var e = (window.event) ? window.event : evt; var targ; if (e.target) { targ = e.target; } else if (e.srcElement) { targ = e.srcElement; } //if (targ.nodeType == 3) { // defeat Safari bug // targ = targ.parentNode; //} if (targ.parentNode) { //alert("id:"+targ.id+" : "+targ.parentNode.className); if (targ.parentNode.className.indexOf("menurow")>=0 && // child of row, so regular links still work targ.id.indexOf("idCol")!=0) // not the id row, cause too easy to click just off it { var index = rowId.indexOf("-"); if (index>-1) { // in case row field, then start with parent of group of tr rowId = rowId.substr(0,index); } if (type == "IFRAME") { if (sv!="-1") { sv_hide(); // stop AJAX on previous sv_show } var link = mmUrlAddNoContext+"&CONTEXT="+context+"&page=com.other.SimpleViewBug&bugId="+rowId; sv_show(rowId,link); } else if (type == "OPEN"){ document.location = mmUrlAddNoContext+"&CONTEXT="+context+"&page=com.other.ViewBug&bugId="+rowId; } } } } // MAIN MENU Simple View function getElement(aID) { return (document.getElementById) ? document.getElementById(aID) : document.all[aID]; } function getIFrameDocument(aID){ var rv = null; var frame=getElement(aID); // if contentDocument exists, W3C compliant (e.g. Mozilla) if (frame.contentDocument) rv = frame.contentDocument; else // bad Internet Explorer ;) rv = document.getElementById(aID).document; return rv; } function adjustMyFrameHeight() { if(typeof (window.peterTesting) == 'function') { return peterTesting(); } var frame = getElement("sv_iframe"); var frameDoc = getIFrameDocument("sv_iframe"); if (navigator.appName == "Microsoft Internet Explorer") { //make window height the minimum. IE8 showing half window when only a few issues - make at least window height var height = frameDoc.body.offsetHeight; if (height<frameDoc.body.scrollHeight) { height = frameDoc.body.scrollHeight+30; } frame.style.height = height+'px'; } else { frame.style.height = (frameDoc.body.offsetHeight+30)+'px'; } } var LASTSV = "-1"; var SVSTARTUP; var svVisible=false; var ie = document.all?1:0; var svid="SimpleView_DIV"; var sv="-1"; var sv_html = "<iframe width=800 height=400 id=sv_iframe src=\"http://www.fittrackingsolutions.com\" vspace=0 hspace=0 FRAMEBORDER=1>"; function sv_escape(evt) { var e = (window.event) ? window.event : evt; if (e.keyCode == 27) { sv_hide(); } } function toggle_sv(context,rowId) { if (svVisible==true) { sv_hide(); } else { var link = mmUrlAddNoContext+"&CONTEXT="+context+"&page=com.other.SimpleViewBug&bugId="+rowId; sv_show(rowId,link); } } function sv_startup() { if (sv != "-1") { // close the current one sv.style.visibility = "hidden"; } sv = setupSV(); sv.innerHTML=sv_html; document.body.appendChild(sv); //these should not be modified sv.style.position="absolute"; sv.style.visibility="hidden"; sv.style.width="400px"; //sv.style.height="100000px"; // make it big so there is no second scrollbar sv.style.zIndex="1000"; sv_closer_startup(); } function setOpacityOff() { var mainMenuTable = document.getElementById("mainMenuTable"); if (mainMenuTable!=undefined) { //dashboard mainMenuTable.style.opacity = 1; mainMenuTable.style.filter = ''; var menu = document.getElementById("FBT_MENU"); if (menu!=undefined) { menu.style.opacity = 1; menu.style.filter = ''; } } } function setOpacity(value) { var mainMenuTable = document.getElementById("mainMenuTable"); if (mainMenuTable!=undefined) { mainMenuTable.style.opacity = value/10; mainMenuTable.style.filter = 'alpha(opacity=' + value*10 + ')'; var menu = document.getElementById("FBT_MENU"); if (menu!=undefined) { // older styles menu.style.opacity = value/10; menu.style.display = 'inline'; menu.style.filter = 'alpha(opacity=' + value*10 + ')'; } } } function sv_hide() { if (svVisible) window.scrollTo(0,sv.offsetTop); // back to where we started from svVisible=false; sv.innerHTML = "
empty
"; // stop ajax updates to FIT sv.style.visibility = "hidden"; setOpacityOff(); return false; } var VIEW = 1; var EDIT = 2; var SCROLLWIDTH = 25; // so scroll is not hidden function sv_show(distinct,link) { if(typeof (window.sv_customshow) == 'function') { sv_customshow(distinct,link); return false; } LASTSV=distinct; if (SVSTARTUP==undefined) { sv_startup(); SVSTARTUP==1; } var myWidth; var myHeight; if( typeof( window.innerWidth ) == 'number' ) { //Non-IE myWidth = window.innerWidth; myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myWidth = document.body.clientWidth; myHeight = document.body.clientHeight; } setOpacity(4); var xpos=200; var xOffset=ie?document.documentElement.scrollLeft:window.pageXOffset; var yOffset=ie?document.documentElement.scrollTop:window.pageYOffset; var ypos=yOffset; var xdiff = (myWidth<800) ? 800 : myWidth-xpos-(SCROLLWIDTH); if (distinct=="Trial" && xdiff<1000) xdiff = 1000; if (link.substring(0,5)=="html:") { sv_html = link.substring(5); } else { sv_html = "
"; } sv.innerHTML = sv_html; sv.style.left=xpos+'px'; sv.style.top=ypos+'px'; sv.style.position="absolute"; sv.style.width=xdiff+"px"; //sv.style.height="100000px"; sv.style.visibility = "visible"; svVisible=true; document.onkeypress= new Function("event","sv_escape(event);"); return false; } function sv_minimize(e) { //alert('hi'); sv.style.height="50px"; if (!e) e = window.event; // works on IE, but not NS (we rely on NS passing us the event) if (e) { //if (isDrag) { var mouseX=ie?event.x:e.clientX; var mouseY=ie?event.y:e.clientY; var tx = parseInt(sv.style.left+0); var ty = parseInt(sv.style.top+0); // unknown x/y ?? // sv.style.left=tx + mouseX-x; // sv.style.top=ty + mouseY-y; //} } } function setupSV() { //created the div element for the popup var divTag = document.createElement("div"); divTag.id = svid; return divTag; } var sv_closer="-1"; function sv_closer_startup() { sv_closer = setupSV(); sv_closer.innerHTML = //"

" + ""; //""; //"

"; document.body.appendChild(sv_closer); //document.onmousemove=sv_minimize; //these should not be modified sv_closer.style.position="absolute"; sv_closer.style.visibility="hidden"; sv_closer.style.zIndex="2000"; } function sv_showCloser() { if (svVisible) { var top = ie?document.documentElement.scrollTop:window.pageYOffset; if ( top < sv.offsetTop) { top = sv.offsetTop; } top += ie?10:15; sv_closer.style.top = top +"px"; sv_closer.style.left = sv.offsetLeft+10+"px"; sv_closer.style.visibility="visible"; } else { sv_closer.style.visibility="hidden"; } window.setTimeout("sv_showCloser()", 100); } //mandatory fields that were added dynamically var addedMand = new Array(); //mandatory fields that were added dynamically, then made non-mandatory var removedMand = new Array(); function addMandatory(fieldName,fieldLabel) { log("addMandatory for field: " + fieldName + " / " + fieldLabel); addedMand[fieldName] = "1"; if (removedMand[fieldName] = "1") { removedMand[fieldName] = ""; } for (var i=0;i<mandFields.length;i++) { if (mandFields[i] == fieldName) { log("addMandatory for field: " + fieldName + " / " + fieldLabel + " already MAND"); return; } } mandFields.length++; mandFieldLabels.length++; mandFields[mandFields.length-1] = fieldName; mandFieldLabels[mandFields.length-1] = fieldLabel; addMandIcon(fieldName); var field = eval("document.entry_form."+fieldName); if (field.tagName == "SELECT") { //this is a dropdown, add select... option log("addMandatory for field: " + fieldName + " / " + fieldLabel + ", it's a select field..."); addMandSelect(field); } } //when a field is made mandatory dynamically, //set to true if Select... should be selected //otherwise current value will stay selected var setMandFieldToSelect = false; function addMandSelect(field) { //we need to go through the array and find hierarchies //where this field is a child... var parents = new Array(); var addedParents = new Array(); try { if (field != null && field.options[0] && field.options[0].value != "Select...") { log("addMandSelect for field: " + field.getAttribute('name') + ", no Select... yet: [" + field.options[0].value +"]"); log("FieldVal.length: " + FeldVal.length); for (i in FieldVal) { var index = i.lastIndexOf("~"+field.getAttribute('name')); if (index > 0 && i.charAt(index-1) != '~') { if (FieldVal[i][0] != "Select...") { log("addMandSelect for field: " + field.getAttribute('name') + ", adding Select... to [" + i + "]"); FieldVal[i].unshift("Select..."); FieldLabel[i].unshift("Select..."); var parentName = i.substring(0,i.indexOf("~")); var parent = eval("document.entry_form." + parentName); if (addedParents[parentName] != 1) { parents.push(parent); addedParents[parentName] = 1; } } } } for (i=0;i<parents.length;i++) { log("addMandSelect for field: " + field.getAttribute('name') + ", changeField parent:" + parents[i].getAttribute('name')); changeField(parents[i]); } } else { log("addMandSelect for field: " + field.getAttribute('name') + ", already has Select..."); } } catch(err) { //this case is when there is no heirarchy //so we just want to add Select... to the field itself //alert("error on adding mand select: " + err); if (field != null && field.options[0].value != "Select...") { myEle=document.createElement("option"); theText=document.createTextNode("Select..."); myEle.appendChild(theText); myEle.setAttribute("value","Select..."); field.insertBefore(myEle,field.getElementsByTagName('option')[0]); if (setMandFieldToSelect || "<SUB onPage>" == "com.other.NewBug") { field.selectedIndex = 0; } } } } function removeMandSelect(field) { //we need to go through the array and find hierarchies //where this field is a child... var parents = new Array(); var addedParents = new Array(); try { if (field != null && field.options[0] && field.options[0].value == "Select...") { log("removeMandSelect for field: " + field.getAttribute('name') + ", has Select..."); log("FieldVal.length: " + FeldVal.length); for (i in FieldVal) { var index = i.lastIndexOf("~"+field.getAttribute('name')); if (index > 0 && i.charAt(index-1) != '~') { if (FieldVal[i][0] == "Select...") { log("removeMandSelect for field: " + field.getAttribute('name') + ", removing Select... from [" + i + "]"); FieldVal[i].shift(); FieldLabel[i].shift(); var parentName = i.substring(0,i.indexOf("~")); var parent = eval("document.entry_form." + parentName); if (addedParents[parentName] != 1) { parents.push(parent); addedParents[parentName] = 1; } } } } for (i=0;i<parents.length;i++) { log("removeMandSelect for field: " + field.getAttribute('name') + ", changeField parent:" + parents[i].getAttribute('name')); changeField(parents[i]); } } else { log("removeMandSelect for field: " + field.getAttribute('name') + ", no Select... to remove"); } } catch(err) { //this case is when there is no heirarchy //so we just want to remove Select... from the field itself //alert("error on adding mand select..."); if (field != null && field.options[0].value == "Select...") { field.options[0] = null; } } } function removeMandatory(fieldName) { log("removeMandatory for field: " + fieldName); addedMand[fieldName] = "0"; var remove = false; for (var i=0;i<mandFields.length;i++) { if (!remove && mandFields[i] == fieldName) { remove = true; } if (remove && i < mandFields.length-1) { mandFields[i] = mandFields[i+1]; mandFieldLabels[i] = mandFieldLabels[i+1]; } } if (remove) { mandFields.length--; mandFieldLabels.length--; } removeMandIcon(fieldName); var field = eval("document.entry_form."+fieldName); if (field.tagName == "SELECT") { //this is a dropdown, remove select... option removeMandSelect(field); } log("removeMandatory for field: " + fieldName + ", done... returning"); } function whatIsMandatory() { var ret = mandFields[0]; for (var i=1;i<mandFields.length;i++) { ret += ", " + mandFields[i]; } alert(ret); } function addMandIcon(fieldName) { var destination = document.getElementById(fieldName+"Icons"); try { if (destination.firstChild.getAttribute('name') == "dynamicMand") { //already there return; } } catch (err) {} var image = document.createElement("img"); image.src = "<SUB REVISIONPREFIX>com/other/req.gif"; image.border = "0"; image.title = "<SUB sMandatoryField>"; image.alt = "<SUB sMandatoryField>"; var image = document.createElement("img"); image.src = "<SUB REVISIONPREFIX>com/other/req.gif"; image.border = "0"; image.title = "<SUB sMandatoryField>"; image.alt = "<SUB sMandatoryField>"; image.setAttribute('name','dynamicMand'); destination.insertBefore(image,destination.firstChild); } function removeMandIcon(fieldName) { var target = document.getElementById(fieldName+"Icons"); try { if (target.firstChild.getAttribute('name') == "dynamicMand") { target.removeChild(target.firstChild); } } catch (err) {} } var debug = 0; function log(message) { if (!debug) { return; } if (!log.window_ || log.window_.closed) { var win = window.open("", null, "width=800,height=600," + "scrollbars=yes,resizable=yes,status=no," + "location=no,menubar=no,toolbar=no"); if (!win) return; var doc = win.document; doc.write("<html>" + "
"); doc.close(); log.window_ = win; } var logLine = log.window_.document.createElement("div"); logLine.appendChild(log.window_.document.createTextNode(message)); log.window_.document.body.appendChild(logLine); } //might need this //if (document.layers) { // if (document.id.display == "none"){ function toggleInnerSection(name) { var inner = document.getElementById(name+"_INNER"); var display = "none"; var img = "com/other/plus_black.gif"; if (inner.style.display=='none') { display = "block"; img = "com/other/minus_black.gif"; } inner.style.display = display; if (document.images){ document.images[name+"_IMG"].src=img; } for(var i=0;i<document.forms.length;i+=1){ if(!document.forms[i].toggleCommands){ var toggleCommands=document.createElement("input"); if(toggleCommands){ toggleCommands.name="toggleCommands"; toggleCommands.type="hidden"; document.forms[i].appendChild(toggleCommands); if(!document.forms[i].toggleCommands){ document.forms[i].toggleCommands=toggleCommands; } } } if(document.forms[i].toggleCommands){ var re=new RegExp("\\btoggleInnerSection\\('"+name+"'\\);\\b"); if(document.forms[i].toggleCommands.value.match(re)){ document.forms[i].toggleCommands.value.replace(re,""); }else{ document.forms[i].toggleCommands.value+="toggleInnerSection('"+name+"');"; } } } } function getElementsByClass(searchClass,node,tag) { var classElements = new Array(); if ( node == null ) node = document; if ( tag == null ) tag = '*'; var els = node.getElementsByTagName(tag); var elsLen = els.length; var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)"); for (i = 0, j = 0; i < elsLen; i++) { if ( pattern.test(els[i].className) ) { classElements[j] = els[i]; j++; } } return classElements; } // Used to toggle the value of whether something is displayed by changing the attributes of it's CSS... function toggleInnerCSS(name,tagname) { var display = "none"; var img = "<SUB REVISIONPREFIX>com/other/plus_black.gif"; if (document.images){ if (document.images[name+"_IMG"].src.indexOf("plus") > 0) { display = ""; img = "com/other/minus_black.gif"; } } var elements = getElementsByClass(name+"_INNER",tagname); for(i=0;i<elements.length;++i) { elements[i].style.display = display; // alert("CHANGE!"); } if (document.images){ document.images[name+"_IMG"].src=img; } } function showErrorMessage(error) { var errordiv = $("errorMessage"); if (errordiv) { if (error.length > 0) { dumpDebug("showErrorMessage: "+error); error="

"+error+"

"; } else { // only add a blank message if it is not already blank if (errordiv.innerHTML.length==0) { return; } } error.escapeHTML(); if (error.length > 1000) { error = error.substring(0,100); } error.sub('"', 'Q'); error.sub('"', 'q'); errordiv.innerHTML = error; errordiv.style.visibility="visible"; errordiv.style.zIndex="1000"; } } function getCurrentSelections(selectName) { var sel = document.getElementsByName(selectName)[0]; var ret = "

Current Selections:

"; for (i=0; i<sel.options.length; i++) { if (sel.options[i].selected) { ret += sel.options[i].value + "<BR>"; } } return ret; } // info popup function fitInfo(e,str) { if (!e) var e = window.event; //str = str.replace(/
/i, "\r\n"); //alert(str); // open a blank window //var infoWin = window.open('', 'FitInfo', 'location=no,status=no,toolbar=no,scrollbars=yes,menubar=no,resizable=yes,toolbar=no,width=600,height=400'); //infoWin.document.write("Fit Information" + str); // use calendar stuff instead cause of popup blockers var info = "

" + "
com/other/info.gif\"> Info | com/other/close_black.gif\">
" + str + "

"; cal_show(e, "", info); } function fitPopup(e,str){ if(!e)e=window.event; if(e&&typeof(str)=="string"){ cal_show(e,"","\

\
\ "+str+"

"); //var cur=getPosition(e); //var xpos = cur.x+offsetX; //parseInt((document.body.clientWidth-calendar.offsetWidth)/2)+document.body.scrollLeft; //var ypos = cur.y+offsetY; //parseInt((document.body.clientHeight-calendar.offsetHeight)/2)+document.body.scrollTop; //calendar.style.left=xpos+'px'; //calendar.style.top=ypos+'px'; //hideSelectBoxes(xpos,ypos); } } /// Calendar stuff var tipVisible=false var ie = document.all?1:0; var id="calendar" var calendar="-1"; var currentStatus = "Click to Drag"; var calendar_bgcolor = "lightgrey"; var cell_bgcolor = "lightgrey"; var cell_highlight = "#eeeeee"; var button_color = "#eeeeee"; var button_highlight = "#b0b0ff"; var today_bgcolor = "#b0b0ff"; var today_highlight = "#e0e0ff"; var close_bgcolor = "lightgrey"; var close_highlight = "#eeeeee"; var STARTUP; //for testing //var errors = window.open(); /***** * Following are variables for the * tooltip which can be customized *****/ var offsetX = -120; //horizontal offset of the tooltip //-120 var offsetY = -100; //vertical offset of the tooltip var tipWidth = 400; //width of the tooltip var tipHeight = 90; //approximate height of the tooltip months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; var calendarhtml="

"; calendarhtml+="
Default
"; calendarhtml+="

" var x,y; var isDrag=false; function getPosition(e) { e = e || window.event; var cursor = {x:0, y:0}; if (e.pageX || e.pageY) { cursor.x = e.pageX; cursor.y = e.pageY; } else { var de = document.documentElement; var b = document.body; cursor.x = e.clientX + (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0); cursor.y = e.clientY + (de.scrollTop || b.scrollTop) - (de.clientTop || 0); } return cursor; } function cal_show(e, target, format) { if (STARTUP==undefined) { calendar_startup(); STARTUP==1; } screenX= document.body.clientWidth; screenY= document.body.clientHeight; var mouseX=0; //ie?event.x:e.clientX; var mouseY=0; //ie?event.y:e.clientY; var xpos=0; var ypos=0; if (ie) { var cursor = getPosition(event); // had problems with IE 7/8 with/without DOCTYPE mouseX=cursor.x; mouseY=cursor.y; xpos=cursor.x+offsetX; ypos=cursor.y+offsetY; } else { mouseX=e.clientX; mouseY=e.clientY; xpos=e.pageX+offsetX; ypos=e.pageY+offsetY; } //old way //var xpos=ie?event.x+offsetX+document.body.scrollLeft:e.pageX+offsetX; //var ypos=ie?event.y+offsetY+document.body.scrollTop:e.pageY+offsetY; if (!ie) { //IE dragging not working right now, //this is causing it to pop up in the //wrong spot if (offsetY < 0) { //check if hitting top of the screen if (mouseY < (-offsetY)) { //move the tip under the mouse ypos -= offsetY - 10; } } else { //check if hitting the bottom if (mouseY+offsetY+tipHeight > screenY) { //move the tip over the mouse ypos -= tipHeight + 20; } } if (mouseX + offsetX < 4) { //check the left side of the screen xpos += -(mouseX+offsetX) + 4 } else if (mouseX+offsetX+tipWidth > (screenX)) { //check the right side xpos += (screenX) - (mouseX+offsetX+tipWidth); } } //alert("T: " + target + " F: " + format + " E: " + e); if (target=="") { calendar.innerHTML = format; // simple info box. } else { getCalendar(target,format); } calendar.style.left=xpos+'px'; calendar.style.top=ypos+'px'; calendar.style.visibility = "visible"; tipVisible=true; hideSelectBoxes(xpos,ypos); } function cal_hide() { tipVisible=false; calendar.style.visibility = "hidden"; hideSelectBoxes(0,0); } function cal_changeStatus(stat) { currentStatus = stat; var statusBar = document.getElementById("calendar_statusBar"); statusBar.innerHTML = currentStatus; } function cal_move(e) { if (calendar == "-1") { return true; } if (!e) e = window.event; // works on IE, but not NS (we rely on NS passing us the event) if (e) { if (isDrag) { var mouseX=ie?event.x:e.clientX; var mouseY=ie?event.y:e.clientY; var tx = parseInt(calendar.style.left+0); var ty = parseInt(calendar.style.top+0); calendar.style.left=tx + mouseX-x; calendar.style.top=ty + mouseY-y; x=mouseX; y=mouseY; hideSelectBoxes(tx + mouseX-x,ty + mouseY-y); return false; } } return true; } function cal_select(e) { var mouseX=ie?event.x:e.clientX; var mouseY=ie?event.y:e.clientY; isDrag=true; x=mouseX; y=mouseY; return false; } function cal_deselect() { isDrag=false; return false; } function populateCalendar(month, year, target, format) { var now = new Date(); var currentDate = -1; var firstDay = new Date(); firstDay.setDate(1); firstDay.setMonth(month); firstDay.setFullYear(year); var prevY = year - 1; var nextY = year + 1; var prevM = month - 1; var nextM = month + 1; var prevMY = year; var nextMY = year; if (prevM == -1) { prevM = 11; prevMY= prevY; } else if (nextM == 12) { nextM = 0; nextMY = nextY; } var todayAction = "populateCalendar("+now.getMonth()+","+now.getFullYear()+",'"+target+"','"+format+"');"; var todayText = "Jump to current date"; var targetOnChange = "if (document."+target+".onchange!=undefined) { document." + target + ".onchange(); }"; if (month == now.getMonth() && year == now.getFullYear()) { currentDate = now.getDate(); var fullYear = new String(now.getFullYear()); var fullDate = getDateFormat(currentDate,month,fullYear,year,format); todayAction = "document." + target + ".value='" + fullDate + "';cal_hide();"+targetOnChange+"return true;"; todayText = "Set date to today"; } var ret="

" + "
" + "
" + months[firstDay.getMonth()] + " " + firstDay.getFullYear() + " | X
" + "
" + "
" + "
" +"
" +"
<< | < | Today | > | >>
" + "
" + "
" + "
" + "
" + "
" + "
" + "
Sun | Mon | Tue | Wed | Thu | Fri | Sat
" + getDayGrid(firstDay,currentDate,target,format) + "
" + currentStatus + "
" + "

"; calendar.innerHTML = ret; } function getDayGrid(now,today,target,format) { var ret="
"; var fullDate; var currentDate=1; var month = now.getMonth(); var fullYear = new String(now.getFullYear()); var year = new String(fullYear.substr(2,2)); var lastDay = getLastDay(now.getMonth(),now.getFullYear()); var atLastDay=0; for(i=0;i<now.getDay();i++) { //add blank cells to beginning ret+="<td width=14% style='border:1px solid #aaa'> </td>"; } for(i=now.getDay();i<7;i++) { //rest of first week fullDate = getDateFormat(currentDate,month,fullYear,year,format); ret+=getDay(currentDate,today,fullDate,target); currentDate++; } ret+="</tr>"; for (j=1;j<6;j++) { //remaining weeks ret+="<tr>"; for(i=j*7;i<(j+1)*7;i++) { if (currentDate>lastDay) { atLastDay=1; break; } fullDate = getDateFormat(currentDate,month,fullYear,year,format); ret+=getDay(currentDate,today,fullDate,target); currentDate++; } ret+="
"; if (atLastDay) { break; } } return ret; } function getDay(currentDate,today,fullDate,target) { var background = cell_bgcolor; var highlight = cell_highlight; if (currentDate == today) { background = today_bgcolor;"#b0b0ff"; highlight = today_highlight; } var targetOnChange = "if (document."+target+".onchange!=undefined) { document." + target + ".onchange(); }"; return "" + "
" + currentDate +"
"; } function getCalendar(target,format) { var now = new Date(); populateCalendar(now.getMonth(),now.getFullYear(),target,format); } function getLastDay(month,year) { if (month == 1) { //Feb if ((year % 4) == 0) { if ((year % 100) == 0 && (year % 400) != 0) { return 28; } return 29; } return 28; } else if (month==0||month==2||month==4||month==6||month==7||month==9||month==11) { return 31; } return 30; } function getDateFormat(d,mon,fullYear,year,format) { var date; mon++; var day = "" + d; var month = "" + mon; if (day.length==1) { day = "0" + day; } if (month.length==1) { month = "0" + month; } switch (format) { case "MM\/dd\/yyyy" : date = month + "\/" + day + "\/" + fullYear; break; case "MM\/dd\/yy" : date = month + "\/" + day + "\/" + year; break; case "yyyy\/MM\/dd" : date = fullYear + "\/" + month + "\/" + day; break; case "dd\/MM\/yy" : date = day + "\/" + month + "\/" + year; break; case "dd\/MM\/yyyy" : date = day + "\/" + month + "\/" + fullYear; break; case "dd.MM.yyyy" : date = day + "." + month + "." + fullYear; break; case "dd-MM-yyyy" : date = day + "-" + month + "-" + fullYear; break; case "MM-dd-yyyy" : date = month + "-" + day + "-" + fullYear; break; default : date = fullYear + "\/" + month + "\/" + day; } return date; } function getAbsolute(obj) { var position = {x: obj.offsetLeft,y: obj.offsetTop}; if (obj.offsetParent) { var parent = getAbsolute(obj.offsetParent); position.x += parent.x; position.y += parent.y; } return position; }; function hideSelectBoxes(xpos,ypos) { if (!ie) return; var cal_x1 = xpos; var cal_y1 = ypos; var cal_x2 = cal_x1 + calendar.offsetWidth; var cal_y2 = cal_y1 + calendar.offsetHeight; genericHideSelectBoxes(cal_x1,cal_y1,cal_x2,cal_y2,tipVisible); } function genericHideSelectBoxes(cal_x1,cal_y1,cal_x2,cal_y2, isVisible) { if (!ie) return; var omitTags = calendar.getElementsByTagName("select"); var selectTags = document.getElementsByTagName("select"); var current = null; for (var i = 0; i < selectTags.length; i++) { current = selectTags[i]; var omit=false; for(var j=0;j<omitTags.length;j+=1){ if(current==omitTags[j]){ omit=true; break; } } if(omit){continue;} var position = getAbsolute(current); var sel_x1 = position.x; var sel_y1 = position.y; var sel_x2 = current.offsetWidth + sel_x1; var sel_y2 = current.offsetHeight + sel_y1; //errors.document.writeln("cy1:"+cal_y1+",cy2:"+cal_y2+"<br>sy1:"+sel_y1+",sy2:"+sel_y2+"
-----------
"); if (!isVisible || (cal_x1 > sel_x2) || (cal_x2 < sel_x1) || (cal_y1 > sel_y2) || (cal_y2 < sel_y1)) { //no overlap if (!current.visibility_record) { current.visibility_record = current.currentStyle.visibility; } current.style.visibility = current.visibility_record; } else { //need to hide if (!current.visibility_record) { current.visibility_record = current.currentStyle.visibility; } current.style.visibility = "hidden"; } } }; document.onmousemove=cal_move; function calendar_startup() { if (calendar != "-1") { // close the current one calendar.style.visibility = "hidden"; } calendar = setupCalendar(); calendar.innerHTML=calendarhtml; document.body.appendChild(calendar); //these should not be modified calendar.style.position="absolute"; calendar.style.visibility="hidden"; calendar.style.zIndex="1000"; } function setupCalendar() { //created the div element for the popup var divTag = document.createElement("div"); divTag.id = id; divTag.onmousedown = function (evt) { cal_select(evt || window.event); }; divTag.onmouseup = function () { cal_deselect(); }; return divTag; } function checkDate(e, target) { var format = ""; var dateVal = target.value; var relativeDate = false; dateVal = dateVal.strip(); if (dateVal.length!=0) { var lower = dateVal.toLowerCase(); if (lower.indexOf("+")>=0 || lower.indexOf("-")>=0 || // +/- 1 day lower.indexOf("y")>=0 || //year / yesterday lower.indexOf("m")>=0 || //month lower.indexOf("w")>=0 || //week lower.indexOf("d")>=0 || //day lower.indexOf("h")>=0 || //hour lower.indexOf("m")>=0 || //minute lower.indexOf("s")>=0 || //second lower.indexOf("t")>=0 || //tomorrow lower.indexOf("n")>=0 ) //now { // relative dates allow : Year / Month / Week / Day / Hour / MINute / Second / now / today / yesterday return true; } } if (dateVal.length!=0 && dateVal.length != format.length) { alert("Incorrect date format : " + dateVal + " ["+format+"]"); } else { // check slashes/dots/dashes are in same spots for (var i=0;i<dateVal.length;i++) { var c = dateVal.charAt(i); if (c=='/'||c=="."||c=="-") { if (format.charAt(i)!=c) { alert("Incorrect date format : " + dateVal + " ["+format+"]"); } } } } } // these functions are for updating selects on the fly function copyMenuToHelperArray(menu,helperArray){ if(menu&&menu.options&&typeof(helperArray)!="undefined"){ helperArray.length=0; for(var i=0;i<menu.options.length;i+=1){ helperArray[i]=menu.options[i]; if(helperArray[i].value==""){ helperArray[i].value=helperArray[i].text; } } } } // this function is used by the DropItemMenu in Passit // it was also copied to the Notify List code to look after selections when using search option, to reduce options // make sure options stay selected user shrinks and expands the selection list function copyMenuSelectedToHelperArray(menu,helperArray){ if(menu&&menu.options&&typeof(helperArray)!="undefined"){ // speed up page load. Most of the time people will not be searching .... if (menu.options.length == helperArray.length) return; var selectedHash = {}; var unselectedHash = {}; for(var i=0;i<menu.options.length;i+=1){ if (menu.options[i].selected==true) { selectedHash[menu.options[i].text]=1; } else { unselectedHash[menu.options[i].text]=1; } } for(var j=0;j<helperArray.length;j+=1){ if (selectedHash[helperArray[j].text]) { if (helperArray[j].selected==false) { helperArray[j].selected = true; } } else if (unselectedHash[helperArray[j].text]) { if (helperArray[j].selected==true) { helperArray[j].selected = false; } } } } } function copyHelperArraySelectedToMenu(helperArray,menu){ if(menu&&menu.options&&typeof(helperArray)!="undefined"){ for(var i=0;i<helperArray.length;i+=1){ //if(helperArray[i].selected){ // need to do unselect too for(var j=0;j<menu.options.length;j+=1){ if(helperArray[i].text==menu.options[j].text){ if (menu.options[j].selected != helperArray[j].selected) { menu.options[j].selected=helperArray[j].selected; } break; } } //} } } } function copyHelperArrayToMenu(menu,helperArray){ if(menu&&menu.options&&typeof(helperArray)!="undefined"){ menu.options.length=0; for(var i=0;i<helperArray.length;i+=1){ var optn=document.createElement("option"); optn.selected=helperArray[i].selected; optn.text=helperArray[i].text; optn.value=helperArray[i].value; menu.options.add(optn); } } } var helperArray=[]; var notifyGroupArray=[]; function updateMenu(specific,menu,helperArray,menuHelper,emptyMessage,startsWith){ if(menu&&menu.options&&typeof(helperArray)!="undefined"&&menuHelper){ if(helperArray.length==0&&menu.options.length>0){ copyMenuToHelperArray(menu,helperArray); } copyMenuSelectedToHelperArray(menu,helperArray); menu.options.length=0; var j=0; var help; if(startsWith===true){ help=new RegExp("^"+menuHelper.value,"i"); }else{ help=new RegExp(menuHelper.value,"i"); } for(var i=0;i<helperArray.length;i+=1){ if(helperArray[i].text.match(help)&&(extraCheck(specific,menu,helperArray[i].text))){ var optn=document.createElement("option"); optn.selected=helperArray[i].selected; optn.text=helperArray[i].text; if(helperArray[i].value!=""){ optn.value=helperArray[i].value; }else{ optn.value=helperArray[i].text; } menu.options.add(optn); } } if(menu.options.length==0&&emptyMessage&&emptyMessage.style){ menu.style.display="none"; emptyMessage.style.display=""; }else{ menu.style.display=""; if(emptyMessage&&emptyMessage.style)emptyMessage.style.display="none"; } } } function extraCheck(specific,menu,option) { if (menu.name=='notifySelect'+specific) { var filter = eval('menu.form.notifyFilter'+specific); var groupArray = eval('notifyGroupArray'+specific); if (filter.selectedIndex==0) { // show all return true; } else { var group = false; for (i=0; i<groupArray.length; i++) { if (option==groupArray[i]) { group=true; } } if (filter.selectedIndex==1) { // show groups return group; } else { return !group; } } } else { return true; } } function submitFormOnEnter(textfield,e,button){ var keycode; if(window.event)keycode=window.event.keyCode; else if(e)keycode=e.which; else return true; if(keycode==13){ if(button&&button.click){ button.click(); return false; }else{ if(textfield&&textfield.form&&textfield.form.submit){ textfield.form.submit(); return false; }else{ return true; } } }else{ return true; } } //this function can be called from anonymous pages //to update a select field with the current list options function getFieldListOptions(trackNum, fieldId) { var mmContext = trackNum; var opt = { method: 'get', onSuccess: function(t) { try { eval(t.responseText); } catch (e) { alert(e); alert("Problem retrieving list options for field "+fieldId+". Check Exception Log."); } }, onFailure: function(t) { alert("Problem retrieving list options for field "+fieldId+". Check Exception Log."); } } var url = '<SUB URLADDWITHOUTCONTEXT>' + '?CONTEXT=' + trackNum + '&page=com.other.AnonAjaxUtil' + '&makeUniqueUrl=' + (new Date().valueOf()) + '&getFieldListOptions=' + fieldId; new Ajax.Request(url,opt); } // hello there function addRelationshipWarning() { if ("<SUB onPage>"=="com.other.NewBug") { alert("<SUB sAddRelationshipNewBugWarning>"); return false; } else if ("<SUB onPage>"=="com.other.ModifyBug") { return confirm("<SUB sAddRelationshipModifyBugWarning>"); } return true; } function changeSummaryChart(obj) { var summaryChartImage = document.getElementById('summaryChartImage'); var link = "<SUB URLADD>&page=com.other.JFreeSummaryChart&chartType="+type; if (summaryChartImage) { var type = obj.options[obj.selectedIndex].value; summaryChartImage.src = link; } else { sv_show("Trial",link); } return true; } function showSummaryChart(obj) { var link = "<SUB URLADD>&page=com.other.MainMenuSummary"; sv_show("Trial",link); return true; } var checkedHistory = new Array(<SUB numHistoryEntries>); function toggleHistoryCheckbox(boxId) { if (checkedHistory[boxId]) { checkedHistory[boxId] = false; } else { checkedHistory[boxId] = true; } submitHistoryCheckboxes(); } function submitHistoryCheckboxes() { var checkedBoxes = ""; for (var i=0;i