//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=""; function mandatoryCheck() { var missingLabels = ""; var myForm = document.entry_form; var firstMissingId=""; for(i=0;i<myForm.elements.length;i++) { var input = myForm.elements[i]; var pos = -1; if (input) { pos = mandFields.indexOf(input.name); if (pos>-1) { if ( (input.options && input.selectedIndex>=0 && input.options[input.selectedIndex].text== "") || // select now allows blanks (!input.options && input.value == "")) { if (missingLabels.length > 0) { missingLabels += ", "; } if (firstMissingId.length==0) { firstMissingId=input.name; } missingLabels += mandFieldLabels[pos]; } } } } if (missingLabels.length > 0) { //fitInfo(event," : " + missingLabels); //alert(" : " + missingLabels); jQuery("#"+firstMissingId ).after("
: " + missingLabels + "
"); // jQuery(function() { jQuery( "#dialog" ).dialog({ //bgiframe: true, //autoOpen: false, //width: 100, //height: 100, modal: true, //position: 'absolute', close: function(event, ui) { var scrollPos = jQuery("#"+firstMissingId ).offset().top; jQuery(window).scrollTop(scrollPos); } }); // }); return false; } return true; } function fitSubmitCheck() { var ret = true; if (typeof mandFields!='undefined' && mandatoryCheck()==false) { ret = false; } //stale data check if(ret && typeof (window.ajaxCheckForStaleData) == 'function') { // ModifyBug case if (ajaxCheckForStaleData()==false) { ret = false; } } //stale data check if(ret && typeof (window.rtfCheckLinks) == 'function') { // tinymce stuff if (rtfCheckLinks()==false) { ret = false; } } if (!otherFitSubmitChecks(ret)) { ret = false; } return ret; } function otherFitSubmitChecks() { //this function is overridden elsewhere return true; } // 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("-EL"); 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) { break; } child.className = HIGHLIGHTCLASS + " " + child.className; } // do all ExtraLine fields for (c=1;c<10;++c) { var child = document.getElementById(rowId+"-EL"+c); if (child == undefined) { break; } child.className = HIGHLIGHTCLASS + " " + child.className; } } function rollOffAll(rowId) { var index = rowId.indexOf("-RC"); if (index<0) index = rowId.indexOf("-EL"); 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) { break; } child.className = child.className.replace(HIGHLIGHTCLASS,""); child.className = child.className.replace(/^\s+|\s+$/g,''); } // do all ExtraLine fields for (c=1;c<10;++c) { var child = document.getElementById(rowId+"-EL"+c); if (child == undefined) { break; } 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); } var LASTSV = "-1"; var SVSTARTUP; var svVisible=false; var ie = document.all?1:0; var svid="SimpleView_DIV"; var sv="-1"; var sv_html = "
"; // allow user to press escape to close calendar window/popup 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=&bugId="+rowId; sv_show(rowId,link); } } var updateRelationship = -1; function toggle_svNew(context,fieldId) { var moreVars = ""; if (svVisible==true) { sv_hide(); } else { updateRelationship = fieldId; var link = mmUrlAddNoContext+"&CONTEXT="+context+"&page=com.other.SimpleNewBug"+moreVars; sv_show((new Date()).getTime(),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); //sv.className='templatetitle'; //sv.style.backgroundColor='#006699'; //sv.style.padding='10px'; //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(hideId) { if (svVisible) window.scrollTo(0,sv.offsetTop); // back to where we started from svVisible=false; var current_sv = document.getElementById(hideId); if (!current_sv) { current_sv = sv; } current_sv.innerHTML = "
empty
"; // stop ajax updates to FIT current_sv.style.visibility = "hidden"; setOpacityOff(); extraStepsOnQuickViewClose(); return false; } function extraStepsOnQuickViewClose() {} var VIEW = 1; var EDIT = 2; var SCROLLWIDTH = 25; // so scroll is not hidden var svOffset = 200; 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=svOffset; var xOffset=ie?document.documentElement.scrollLeft:window.pageXOffset; var yOffset=ie?document.documentElement.scrollTop:window.pageYOffset; var ypos=yOffset; var iPADDING = 10; // padding of table around iframe var xdiff = (myWidth<800) ? 800 : myWidth-xpos-SCROLLWIDTH-iPADDING; 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) { 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 + (new Date()).getTime(); return divTag; } var sv_closer="-1"; function sv_closer_startup() { sv_closer = setupSV(); sv_closer.innerHTML = //"

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

"; sv_closer.id = "sv_closer"; 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"; window.setTimeout("sv_showCloser()", 100); } else { sv_closer.style.visibility="hidden"; window.setTimeout("sv_showCloser()", 500); } } //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; var selectStr = "<SUB sSelectMandatory>"; 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 != selectStr) { log("addMandSelect for field: " + field.getAttribute('name') + ", no "+selectStr+" 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] != selectStr) { log("addMandSelect for field: " + field.getAttribute('name') + ", adding "+selectStr+" to [" + i + "]"); FieldVal[i].unshift(selectStr); FieldLabel[i].unshift(selectStr); 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 selectStr to the field itself //alert("error on adding mand select: " + err); if (field != null && field.options[0].value != selectStr) { myEle=document.createElement("option"); theText=document.createTextNode(selectStr); myEle.appendChild(theText); myEle.setAttribute("value",selectStr); 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 == selectStr) { log("removeMandSelect for field: " + field.getAttribute('name') + ", has "+selectStr); 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] == selectStr) { log("removeMandSelect for field: " + field.getAttribute('name') + ", removing "+selectStr+" 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 == selectStr) { 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 || (debug==1 && message.length==0)) { return; } else if (debug==1) { setTimeout(function() { throw new Error(message); }, 0); 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>" + "<bo"+"dy></bo"+"dy>"); 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 getCurrentSelections(selectName) { var sel = document.getElementsByName(selectName)[0]; var ret = "<P><U><B>Current Selections</B></U>:<P>"; for (i=0; i<sel.options.length; i++) { if (sel.options[i].selected) { ret += sel.options[i].value + "<BR>"; } } return ret; } // info popup using jQuery (pass div) function fitDialogDiv(e, divId, w, h) { if (!h) { h = 400; } if (!w) { w = 600; } jQuery( divId ).dialog({ modal: true, width: w, height: h, buttons: { Ok: function() { jQuery( this ).dialog( "close" ); } } }); } // 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); } /// 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_escape(evt) { var e = (window.event) ? window.event : evt; if (e.keyCode == 27) { cal_hide(); } } var desiredX = -1; var desiredY = -1; var clickToDrag = ''; //drag not working now 'Click to drag'; function cal_show(e, target, format) { if (STARTUP==undefined) { calendar_startup(); STARTUP==1; } var screenX= document.body.clientWidth; var 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); } if (desiredX>0) { xpos = desiredX; desiredX=-1; } if (desiredY>0) { ypos = desiredY; desiredY=-1; } calendar.style.left=xpos+'px'; calendar.style.top=ypos+'px'; calendar.style.visibility = "visible"; tipVisible=true; hideSelectBoxes(xpos,ypos); document.onkeypress= new Function("event","cal_escape(event);"); } function cal_hide() { tipVisible=false; if (calendar!="-1") { calendar.innerHTML = "
empty
"; // stop ajax updates to FIT calendar.style.visibility = "hidden"; } hideSelectBoxes(0,0); setOpacityOff(); } 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; optn.style.fontFamily = helperArray[i].style.fontFamily; //"monospace"; // titles for pickers optn.disabled=helperArray[i].disabled; optn.style.fontWeight = helperArray[i].style.fontWeight; // "bold"; optn.style.textDecoration = helperArray[i].style.textDecoration; // "underline"; 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].disabled==true || (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; } optn.style.fontFamily = helperArray[i].style.fontFamily; //"monospace"; // titles for pickers optn.disabled = helperArray[i].disabled; optn.style.fontWeight = helperArray[i].style.fontWeight; // "bold"; optn.style.textDecoration = helperArray[i].style.textDecoration; // "underline"; // these did not work : // optn.style = helperArray[i].style; // optn.css("font-family","monospace"); 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) { log(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); } function checkUniqueField(id, bugid) { var ret = true; var success = false; var opt = { method: 'get', asynchronous: false, onSuccess: function(t) { if (!success && t.responseText.length > 5) { alert(t.responseText); success = true; ret = false; } }, onFailure: function(t) { alert("Unique value check failed: "+t.responseText); } } var fieldValue = ""; try { fieldValue = document.getElementById("field"+id).value; } catch (err) { return true; } new Ajax.Request(mmUrlAddNoContext + '&CONTEXT=' + mmContext + '&page=com.other.AjaxUtil' + '&checkUniqueField=' + id + '&checkUniqueFieldValue=' + fieldValue + '&checkUniqueFieldBug=' + bugid + '&makeUniqueUrl=' + (new Date().valueOf())+ '', opt); return ret; } // hello there function addRelationshipWarning() { if (""=="com.other.NewBug") { alert(""); return false; } else if (""=="com.other.ModifyBug") { return confirm(""); } return true; } function changeChart(obj,chartId) { var summaryChartImage = document.getElementById('summaryChartImage'); var link = "&page=com.other.JFreeReportChart&chartId="+chartId+"&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 = "&page=com.other.MainMenuSummary"; sv_show("Trial",link); return true; } var checkedHistory = new Array(); function toggleHistoryCheckbox(boxId) { if (checkedHistory[boxId]) { checkedHistory[boxId] = false; } else { checkedHistory[boxId] = true; } submitHistoryCheckboxes(); } function submitHistoryCheckboxes() { var checkedBoxes = ""; for (var i=0;i<checkedHistory.length;i++) { if (checkedHistory[i]) { checkedBoxes += " " + i; } } document.getElementById("checkedHistoryCheckboxes").value = checkedBoxes; return true; } function showHistoryCheckboxes(show) { var c = 0; var check = document.getElementById("historyCheck"+c); while (check) { if (show) { check.style.display = ""; } else { check.style.display = "none"; } c++; check = document.getElementById("historyCheck"+c); } } function showOptionsMenu(event,baseName) { //var ret = ""; var baseDiv=document.getElementById(baseName); if (baseDiv) { //log(baseName+ " : ["+ event.clientX + "," + event.clientY+"] ["+ // event.offsetLeft+ "," + event.offsetTop+"]" ); //log("target : ["+ event.target.clientX + "," + event.target.clientY+"] ["+ // event.target.offsetLeft+ "," + event.target.offsetTop+"]" ); //log("baseDiv.hideEvent: "+baseDiv.hideEvent); if(baseDiv.hideEvent!=null){ clearTimeout(baseDiv.hideEvent); } baseDiv.hideEvent=null; var e=event.target||event.srcElement; //var x=0; //var y=0; while(e!=null) { //log("showOptionsMenu " + baseDiv.id +":" +e.id||0); if (e.id) { //ret += "["+e.id+"]"; if (baseDiv.id == e.id) { //alert("returning : "+ret); return; } //log("add: "+e.id +" - "+e.offsetTop); //x+=e.offsetLeft; //y+=e.offsetTop; } e=e.offsetParent; } var scrollX = (window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0); var scrollY = (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0); baseDiv.style.left=(event.clientX+scrollX+5)+'px'; baseDiv.style.top=(event.clientY+scrollY+5)+'px'; //baseDiv.style.left=x+'px'; //baseDiv.style.top=y+'px'; baseDiv.style.display=""; } //alert(ret); } function hideOptionsMenu(evt, baseName, when) { var baseDiv=document.getElementById(baseName); if(baseDiv){ if (when!=0 && baseDiv.hideEvent==null) { var str = "hideOptionsMenu(window.event,'"+baseName+"',1000);"; baseDiv.hideEvent=setTimeout(str,when); } else { baseDiv.style.display="none"; } } } var qmenu=-1; var lastClickTime=0; function quickMenu(event,context,bsId) { if (qmenu==-1) { qmenu = new QuickMenu(event); } qmenu.setContext(context); qmenu.setBsId(bsId); //log(event.timeStamp-lastClickTime); if (event.type=="click" && event.timeStamp-lastClickTime<500) { qmenu.quickView(event); hideOptionsMenu(event,"rowOptionsMenu",0); } else { showOptionsMenu(event,"rowOptionsMenu"); } if (event.timeStamp) { lastClickTime=event.timeStamp; } //log(lastClickTime + " : " + event.type); hideOptionsMenu(event,"rowOptionsMenu",2000); // so it does not stay up forever return qmenu; } function QuickMenu(event) { var context = -1; var bsId = -1; this.setContext=function(id){this.context=id}; this.getContext=function(){return this.context}; this.setBsId=function(id){this.bsId=id}; this.getBsId=function(){return this.bsId}; var borderTopStyle=""; var html="\ <div id=rowOptionsMenu style=\"display:none;position:absolute;background:white;\" onmouseout=\"hideOptionsMenu(event,'rowOptionsMenu',500);\">"; if ("".length>0) { borderTopStyle = "style=\"border-top:none;\""; html += "\

"; } html += "\

</table</div>\

</table</div>\

</table</div>\

"; var div = document.createElement('div'); div.innerHTML = html; document.body.appendChild(div) this.quickView=function(e) { quickView(e,this.getContext(),this.getBsId(),"IFRAME","com.other.SimpleViewBug"); // sv_show } this.quickEdit=function(e) { quickView(e,this.getContext(),this.getBsId(),"IFRAME","com.other.SimpleModifyBug"); // sv_show } this.quickGrab=function(e){ desiredX=300; desiredWidth=600; desiredHeight=150; //sv_show(e,"&page=com.other.QuickGrab&CONTEXT="+this.getContext()+"&mId="+this.getBsId()); fitPopup(e,"link:&page=com.other.QuickGrab&CONTEXT="+this.getContext()+"&mId="+this.getBsId()); //jQuery().colorbox({opacity:"0.50",width:"60%",height:"60%",href:"&page=com.other.QuickGrab&CONTEXT="+this.getContext()+"&mId="+this.getBsId()}); hideOptionsMenu(event,"rowOptionsMenu",0); } this.quickAssign=function(e){ desiredX=300; desiredWidth=800; desiredHeight=500; //sv_show(e,"&page=com.other.QuickAssign&CONTEXT="+this.getContext()+"&bugId="+this.getBsId()); fitPopup(e,"link:&page=com.other.QuickAssign&CONTEXT="+this.getContext()+"&bugId="+this.getBsId()); //jQuery().colorbox({opacity:"0.50",width:"60%",height:"60%",href:"&page=com.other.QuickAssign&CONTEXT="+this.getContext()+"&bugId="+this.getBsId()}); hideOptionsMenu(event,"rowOptionsMenu",0); } this.quickChange=function(e){ //var baseDiv=document.getElementById("rowOptionsMenu"); //if(baseDiv){ fitPopup(e,"\ \ \ \

: "+ this.bsId + "

\

: "+ "Close" + "

\

: "+ "Me" + "

\

: Some Text

\

\ \
\ \ "); hideOptionsMenu(event,"rowOptionsMenu",0); //} } return(html); } var desiredWidth = -1; var desiredHeight = -1; function fitPopup(e,str){ if(!e)e=window.event; if(e&&typeof(str)=="string"){ if (str.substring(0,5)=="link:") { str = str.substring(5); if (desiredWidth<0) { desiredWidth=600; } if (desiredHeight<0) { desiredHeight=1000; } str = "

"; desiredWidth=-1; desiredHeight=-1; } else { str = "\

\
\ "+str+"

"; } if (cal_closer=="-1") { cal_closer_startup(); } //cal_hide(); // stop AJAX on previous sv_show setOpacity(5); cal_show(e,"",str); } } // MAIN MENU Quick View // 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 if (targ.id.indexOf("idCol")==0) { // not the id column, cause too easy to click just off it var trans = document.getElementById("transC"+context+"-"+rowId); //alert(trans.offsetLeft + ":" + e.clientX); if (trans==null || trans.offsetLeft >= e.clientX) { return; } } var index = rowId.indexOf("-"); if (index>-1) { // in case row field, then start with parent of group of tr rowId = rowId.substr(0,index); } //quickMenu(evt,context,rowId); //return; var page = ""; quickView(evt,context,rowId,type,page); //} else { //hideOptionsMenu(evt,"rowOptionsMenu",0); } } } function closeParentQuickView() { if (parent.sv=="-1") { return false; } else { parent.sv_hide(); } return true; } function quickView(evt, context, rowId, type, page) { if (type == "IFRAME") { if (sv!="-1") { sv_hide(); // stop AJAX on previous sv_show } var link = mmUrlAddNoContext+"&CONTEXT="+context+"&page="+page+"&bugId="+rowId; sv_show(rowId,link); } else if (type == "OPEN"){ page = page.replace("Simple",""); document.location = mmUrlAddNoContext+"&CONTEXT="+context+"&page="+page+"&bugId="+rowId; } } 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 cal_closer="-1"; function cal_closer_startup() { cal_closer = setupSV(); cal_closer.innerHTML = //"<table style='background-color:gray;' width=100% height=50>
" + ""; //""; //"

"; document.body.appendChild(cal_closer); //document.onmousemove=cal_minimize; //these should not be modified cal_closer.style.position="absolute"; cal_closer.style.visibility="hidden"; cal_closer.style.zIndex="2000"; } function cal_showCloser() { if (calendar!="-1" && calendar.style.visibility=="visible" && calendar.innerHTML.indexOf("cal_hide()")<0 ) { var top = ie?document.documentElement.scrollTop:window.pageYOffset; if ( top < calendar.offsetTop) { top = calendar.offsetTop; } top += ie?10:15; cal_closer.style.top = top +"px"; cal_closer.style.left = calendar.offsetLeft+10+"px"; cal_closer.style.visibility="visible"; window.setTimeout("cal_showCloser()", 100); } else { cal_closer.style.visibility="hidden"; window.setTimeout("cal_showCloser()", 500); } } // allow user to press escape to close calendar window/popup function cal_escape(evt) { var e = (window.event) ? window.event : evt; if (e.keyCode == 27) { cal_hide(); } } function initializeTabs(def) { if (defaultTab) { def = defaultTab } var anchor = unescape(document.location.hash.substring(1)); if (anchor && anchor.length>0) { selectSubTab(anchor); } else { selectSubTab(def); } } function addCustomRow(prefix) { var count = document.getElementById(prefix+"RowCount").value; var max = document.getElementById(prefix+"RowMax").value; count++; displayCustomRows(prefix,count,max); document.getElementById(prefix+"RowCount").value=count; } function displayCustomRows(prefix,count,max) { for(c=1;c<=max;++c) { var element = document.getElementById(prefix+"Row"+c); if (c<=count && element.getAttribute("data-rowhidden") != "1") { element.style.display = ""; } else { element.style.display = "none"; } } if (count==max) { // one should be visible if more can be added var elementImg = document.getElementById(prefix+"AddImage"); elementImg.style.visibility = 'hidden'; } } function clearCustomRow(prefix,fields,row) { for (f=1;f<=fields;f++){ var input = document.getElementById(prefix+"Row"+row+"Cell"+f); if (input.type=="checkbox") { input.checked=false; } else { input.value=''; } } var rowObj = document.getElementById(prefix+"Row"+row); var rowCount = document.getElementById(prefix+"RowCount").value; if (rowCount>1) { rowObj.style.visibility = 'hidden'; } if (prefix=="customSale") { doSaleCalculations(prefix); } else if (prefix=="customLease") { doLeaseCalculations(prefix); } } ///////// // Logic for relationship picker... ///////// function callMe(parm1,parm2,parm3,parm4) { alert("Call Me!" + parm1 + " " + parm2 + " " + parm3 + " " + parm4 + " " + parm2.id); } function getForm() { var form; if (typeof document.entry_form == "undefined") { form = document.BulkForm; } else { form = document.entry_form; } return form; } function removeRelValue(hiddenName,value) { var newValue = ""; var tokens = getForm()[hiddenName].value.split(" "); for (var i=0; i<tokens.length; i++) { if (value!=tokens[i]) { if (newValue.length>0) { newValue += " "; } newValue += tokens[i]; } } getForm()[hiddenName].value = newValue; return newValue; } function setRelDisplay(id,info,append) { var display = "display" + id; var innerHTML = ""; if (append==true) { //innerHTML = document.getElementById(display).innerHTML; } innerHTML += info; document.getElementById(display).innerHTML = innerHTML; } function pickRel(divName) { var element = document.getElementById(divName); element.style.display = ""; /* var fieldName = "thing"; // FROM SUGGEST... //we need to add the div to the fields first... var field = getForm()[fieldName]; field.id = fieldName; var fieldDiv = document.createElement("div"); fieldDiv.id = fieldName+"_choices"; fieldDiv.className = "autocomplete"; field.parentNode.appendChild(fieldDiv); //next we're going to add the autocomplete call... new Ajax.Autocompleter(fieldName, fieldName+"_choices", "", {parameters:'page=com.other.PickRelationship&field='+fieldName, afterUpdateElement : callMe}); */ } function closePicker(divName) { var element = document.getElementById(divName); element.style.display = "none"; } function getPickerTags(selectObj) { if (selectObj && selectObj.getAttribute('pickertags')) { return '&pickertags='+selectObj.getAttribute('pickertags'); } return ""; } function removeRel(field,id) { var hiddenName = "field" + field; if (field.indexOf("m")==0) { hiddenName = field; // mParent field } var value = removeRelValue(hiddenName,id); ajaxUpdate('&selected=' + value + '&displayDiv=display' + field + getPickerTags(getForm()[hiddenName])); } function updateRelValue(hiddenName,value,append) { var hObj = getForm()[hiddenName]; if (hObj.getAttribute("MULTIPLE")!=1) { hObj.value = ""; } var tokens = hObj.value.split(" "); if (tokens.indexOf(value)<0) { var newValue = ""; if (append==true) { var oldValue = hObj.value; if (oldValue.length>0) { oldValue += " "; } newValue += oldValue; } newValue += value; hObj.value = newValue; } return hObj.value; } function selectRel(selectObject,divName,displayName,hiddenName) { var value = getForm()[hiddenName].value; closePicker(divName); for (x=0;x<selectObject.length;x++) { if (selectObject[x].selected) { //if (value.length>0) value += " "; value = updateRelValue(hiddenName,selectObject[x].value,true); selectObject[x].selected = false; } } ajaxUpdate('&selected=' + value + '&displayDiv=' + displayName + getPickerTags(getForm()[hiddenName])); } function refreshRel(divName,displayName,hiddenName) { value = updateRelValue(hiddenName,"",true); ajaxUpdate('&selected=' + value + '&displayDiv=' + displayName + getPickerTags(getForm()[hiddenName])); } function updateTrackRelationship(bugId) { try { //automatically add bugId to track relationship var selector = document.getElementById("relPicker"+updateRelationship); selector.value = bugId; selectRel(selector,'relPicker'+updateRelationship,'display'+updateRelationship,'field'+updateRelationship); } catch (err) {} } function ajaxUpdate(args) { var opt = { method: 'get', onSuccess: function(t) { if (t.responseText.length > 10) { var ret = eval(t.responseText); } else { } }, onFailure: function(t) { } } var pickPage = '&page=com.other.PickRelationship'; if (args.indexOf("LOCAL")>=0) { pickPage = '&page=com.other.PickLocalTrack'; } new Ajax.Request(mmUrlAddNoContext + '&CONTEXT=' + mmContext + pickPage + '&ajax=1' + '&makeUniqueUrl=' + (new Date().valueOf())+ args, opt); } function pickerSearchAll(id){ var searchOptions = document.getElementById("relPicker"+id+"SearchOptions"); searchOptions.style.display = "none"; var search = document.getElementById("relPickerSearch"+id); var searchInfo = document.getElementById("relPicker"+id+"SearchInfo"); searchInfo.innerHTML = 'Searching all s for "' + search.value + '"...'; var showClosed = ""; if (document.getElementById("relPicker"+id+"ShowClosed").checked) { showClosed = "&showClosed=on"; } ajaxPickerSearchAll('&search=' + search.value + '&field=' + id + showClosed); } function pickerClearSearch(id){ ajaxPickerSearchAll('&field=' + id + '&clear=1'); } function ajaxPickerSearchAll(args) { var opt = { method: 'get', onSuccess: function(t) { if (t.responseText.length > 10) { var ret = eval(t.responseText); } else { } }, onFailure: function(t) { } } var pickPage = '&page=com.other.PickSearchAll'; if (args.indexOf("Local")>=0) { pickPage = '&page=com.other.PickLocalSearchAll'; } new Ajax.Request(mmUrlAddNoContext + '&CONTEXT=' + mmContext + pickPage + '&ajax=1' + '&makeUniqueUrl=' + (new Date().valueOf())+ args, opt); } function updatePickerSearchOptions(id) { var search = document.getElementById("relPickerSearch"+id); var searchOptions = document.getElementById("relPicker"+id+"SearchOptions"); var clearButton = document.getElementById("relPicker"+id+"ClearButton"); if (search.value.length > 0) { searchOptions.style.display = ""; } else if (clearButton.style.display == "none") { searchOptions.style.display = "none"; } } function pickerCheckEnter(e, id){ //make sure the form isn't submitted it user presses enter in search bar e = e || event; if ((e.keyCode || event.which || event.charCode || 0) == 13) { pickerSearchAll(id); return false; } return true; } function changeThumbnailImage(bsId) { //var e = (window.event) ? window.event : evt; //alert("changeThumbnailImage : "+bsId); //var targ; //if (e.target) { // targ = e.target; //} else if (e.srcElement) { // targ = e.srcElement; //} //var bsId = targ.id; //alert("bsId:"+bsId); var tnImg = document.getElementById("thumbnailImg"+bsId); var tnSelect = document.getElementById("thumbnailSelect"+bsId); //alert("link: "+tnSelect.value); tnImg.src = tnSelect.value; } function childControl(evt, id) { var e = (window.event) ? window.event : evt; var imgObj = document.getElementById(id); var img = "com/other/img/expand.gif"; //alert(imgObj.src + " vs " + img); if (imgObj.src.indexOf(img)>=0){ img = "com/other/img/collapse.gif"; } imgObj.src = img; id = id.replace("childControl",""); //alert("looking for " + id); //var row = document.getElementById(id); //if (row) { // alert("parentPath " + row.getAttribute('parentpath')); //} //row.onmouseout = new Function("rollOffAll('"+rowId+"');"); //rollOnAll(evt,rowId); var elements = document.getElementsByTagName("tr"); for(i=0;i<elements.length;++i) { var pp = elements[i].getAttribute('parentpath'); // alert(elements[i] + " : " + pp +" vs "+id); //if (pp && pp.id) { //} if (pp!=null && pp.indexOf(id+"-")>=0) { var root = pp.substring(0,pp.lastIndexOf("-")); var disp = ""; var nodes = root.split("-"); var check = ""; for (var n=0; n<nodes.length; n++) { if (check.length>0) check += "-"; check += nodes[n]; var checkpp = document.getElementById("childControl"+check); if (checkpp && checkpp.src.indexOf("expand")>0) { disp = "none"; break; } } elements[i].style.display = disp; //alert(elements[i].id); if (elements[i].id.indexOf("-CHILD")>=0) { childControlRC(elements[i].id,disp); } } //elements[i].style.display = display; // alert("CHANGE!"); } } function childControlRC(id, disp) { // look after any row fields for(var r=1; r<2; r++) { var rc = document.getElementById(id+"-RC"+r); //alert("looking for :"+id+"-RC"+r +" - "+rc); if (!rc) { break; // if no row column, then do not keep looking } rc.style.display = disp; } } // gets rid of dropdown menu on handhelds function iPadMenuClose(obj) { while (obj && obj.className.indexOf("dropdown_")<0) { obj=obj.parentNode; } obj.className += " hide"; setTimeout(function(_this) { _this.className = _this.className.replace(" hide",""); }, 200, obj); } function showErrorMessage(error) { log(error); // $(errorMessage") is not returning the right div object in ModifyBug, had to change to getElementById var errordiv = document.getElementById("errorMessage"); if (errordiv) { if (error.length > 0) { dumpDebug("showErrorMessage: "+error); error="

"+error+"

"; } else { // only add a blank message if it is not already blank dumpDebug("showEM:["+error+"]"); if (errordiv.innerHTML.length==0) { //alert(errordiv.innerHTML.length); 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"; } } // you can override this with AjaxDebugger function dumpDebug(message,e) { } // this will get the current value of a field for RO and Edit screens function fitFieldValue(str) { if (document.getElementById(str).value) { return document.getElementById(str).value; } return document.getElementById(str).innerHTML; } // document.div.name may not work function getDivByAttributeName(name) { var divs = document.getElementsByTagName("div"); for(var i=0;i