// Copyright (c) 2005 CA. All rights
reserved.
// detail_form.js,v 1.341.1.7 2006/05/04
23:28:03
var _dtl=void(0);
var _dtl_debug=false;
var rxQuote=new RegExp(/"/g);
var cur_row_num=-1;
var cur_exp_row_arr=void(0);
var exp_sec_num=0;
function exp_row_node(row_num)
{
this.row_num=row_num;
this.row_id_arr=new Array();
}
exp_row_node.prototype.add_row_id=function(id)
{
var idx=this.row_id_arr.length;
var row_id;
if(typeof id=="string"&&id!="")
row_id=id;
else
row_id="exp_row"+exp_sec_num+this.row_num+"_"+idx;
this.row_id_arr[idx]=row_id;
return row_id;
}
exp_row_node.prototype.hide_row=function()
{
return this.change_row_disp_state("none");
}
exp_row_node.prototype.show_row=function()
{
var show_str="block";
if(!_browser.isIE)
show_str="";
return
this.change_row_disp_state(show_str);
}
exp_row_node.prototype.change_row_disp_state=function(disp)
{
var len=this.row_id_arr.length;
var id;
var row;
var height=0;
var prev_disp;
for(var i=(len-1);i>=0;i--)
{
id=this.row_id_arr[i];
if(typeof id=="string")
{
row=document.getElementById(id);
if(typeof row=="object")
{
prev_disp=row.style.display;
if(prev_disp!="none"&&
disp=="none")
height+=row.offsetHeight;
row.style.display=disp;
if(prev_disp=="none"&&
disp!="none")
height+=row.offsetHeight;
}
}
}
return height;
}
function get_exp_row_id(id)
{
if(cur_row_num==-1)
return id;
var len=cur_exp_row_arr.length;
for(var i=0;i<len;i++)
{
if(cur_exp_row_arr[i].row_num==cur_row_num)
break;
}
if(i==len)return id;
return cur_exp_row_arr[i].add_row_id(id);
}
function createExpandableRow(exp_rows)
{
cur_exp_row_arr=new Array();
cur_row_num=0;
var arr=exp_rows.split(",");
for(var i=0;i<arr.length;i++)
cur_exp_row_arr[cur_exp_row_arr.length]=new
exp_row_node(arr[i]);
return cur_exp_row_arr;
}
function
DetailForm(factory,id,next_persid,stdbuttons,skip_page_hdr,onsubmit)
{
if(factory=="defer"){
this.edit=true;
holdHTMLText(false);
stdbuttons=false;
this.win=window;
if(typeof skip_page_hdr=="undefined")
skip_page_hdr="skip";
}
else{
this.edit=(typeof
edit_form=="number"&&edit_form==1);
this.id=id;
this.next_persid=next_persid;
}
if(typeof onsubmit=="string")
this.onsubmit=onsubmit;
else
this.onsubmit="return check_submit();";
this.lastKeycode=0;
this.html="";
this.expSecHtml="";
this.factory=factory;
this.displayName="";
try{
if(this.factory==propFactory&&
factoryDisplayName.length>0)
this.displayName=factoryDisplayName;
}
catch(e){}
this.lastTableNum=-1;
this.rowNum=0;
this.colNum=0;
this.hdrColNum=0;
this.maxCol=0;
this.colID=0;
this.currID="";
this.rowData=new Array();
this.dateField=new Array();
this.colSpan=new Array();
this.form=new Array();
this.formStarted=false;
this.tableStarted=false;
this.doingLabelButton=false;
this.rowOpen=false;
this.TDOpen=false;
this.tabIndex=100;
this.imgBtnRow=false;
this.roclass=" CLASS=detailro";
this.eventHandler="";
this.firstField=void(0);
this.firstFieldFocused=0;
this.onload=void(0);
this.fieldToValidate=new Array();
this.errorCount=0;
this.serverErrorCount=0;
this.propertyRow=void(0);
this.spellchk=false;
this.fieldsToReset=void(0);
this.syncing=false;
this.secondary=false;
this.skip_agt_check=false;
this.dataoverrideclass="";
this.editAttrs=new Object();
this.lookupAttrs=new Object();
this.doSrchKnow=0;
this.lastHdrtext="";
this.propId="id";
this.propHdr="hdrtext";
this.propMaxSize="maxsize";
this.propIsReq="is_required";
this.propServerErr="serverFoundError";
this.propError="error";
this.propExtError="extError";
this.propBrowserError="browserFoundError";
this.propSDProp="is_property";
this.propNotFound=null;
if(!this.edit){
this.hdrclass="detailro";
this.reqhdrclass="detailro";
this.dataclass=this.roclass;
this.backfillReq=false;
}
else{
this.hdrclass="labeltext";
this.reqhdrclass="requiredlabeltext";
this.dataclass="";
var opnr=ahdframeset.opener;
this.backfillReq=(this.id=="0"&&
typeof
opnr=="object"&&opnr!=null&&
typeof opnr.cfgIsPopup=="string"&&
typeof
opnr.argBackfillField=="string"&&
opnr.cfgIsPopup.length>0&&
opnr.argBackfillField.length>0);
}
if(typeof propGLType=="string"&&
propGLType=="secondary")
{
this.secondary=true;
if(typeof argPersistentID!="undefined")
{
var
edit_windows=getEditWindows(argPersistentID);
for(var i=0;i<edit_windows.length;i++){
var w=edit_windows[i];
if(typeof w._dtl=="object"&&
!w._dtl.secondary){
w.parent.opener=ahdtop;
window.opener=w.parent;
}
}
}
}
if(skip_page_hdr!="skip")
{
docWriteln("<TABLE cellSpacing=0 cellPadding=0
width='100%' border=0 class=page_header>");
docWriteln("<TR>");
docWriteln("<TD align=left
width='99%'><h2
style='margin:0px;'>"+form_title+"</h2></TD>");
docWriteln("<TD align=right
width='1%'>");
ImgBtnSetDefaultTabIndex(this.edit?30000:this.tabIndex);
if(typeof
stdbuttons!="boolean"||stdbuttons){
this.imgBtnRow=true;
if(!this.edit){
ImgBtnRow(void(0),false);
// if((0+cfgUserAuth)>1){
//
ImgBtnCreate("btn001",msgtext(513),"detailEdit()",true);
// }
}
else{
var saveButtonFieldset=false;
if(typeof
detailExtraSaveButtons!="undefined"){
var count=detailExtraSaveButtons(false);
if(count>0){
saveButtonFieldset=true;
this.imgBtnRow=count+1;
var
fieldset="<table><tr><td>";
if(_browser.isIe)
fieldset+="<fieldset>";
else
fieldset+="<fieldset
class=firefox_fieldset>";
var legend=msgtext(930);
if(typeof
factoryDisplayName=="string"&&
factoryDisplayName.length>0)
legend=msgtext(933,factoryDisplayName);
docWriteln(fieldset+"<legend
class=button_legend>"+
legend+"</legend>");
}
}
ImgBtnRow(void(0),false);
if(!this.secondary)
ImgBtnCreate("btn001",msgtext(208),"detailSave()",true);
else
ImgBtnCreate("btn001",msgtext(401),"detailSave()",true);
if(saveButtonFieldset){
detailExtraSaveButtons(true);
ImgBtnEndRow();
docWriteln("</fieldset></td><td
valign=bottom>");
ImgBtnRow(void(0),false);
}
ImgBtnCreate("btncncl",msgtext(209),"detailCancel()",true);
ImgBtnCreate("btn003",msgtext(400),
"check_reset();detailReset()",true);
}
}
}
}
function DetailForm_getHTMLText()
{
if(typeof
this.win=="object"&&!this.win.closed)
return this.win.getHTMLText();
else
return"";
}
DetailForm.prototype.getHTMLText=DetailForm_getHTMLText;
function startDetail(options,bScroll)
{
if(_dtl.imgBtnRow){
ImgBtnEndRow();
if(typeof
_dtl.imgBtnRow=="number"&&_dtl.imgBtnRow>1)
docWriteln("</td></tr></table>");
_dtl.imgBtnRow=false;
}
docWriteln("</TD></TR></TABLE>");
ImgBtnSetDefaultTabIndex(_dtl.tabIndex);
build_alertmsg();
if(typeof options!="string")
options="";
if(options==""||null==options.match(/noscroll/i)){
if(typeof bScroll=="undefined")
bScroll=0;
startScrollbar(false,bScroll);
}
_dtl.center=(options!=""&&null!=options.match(/center/i));
if(_dtl.center)
docWriteln("<CENTER>");
if(_dtl.factory.length>0){
_dtl.formStarted=true;
var out="<FORM NAME=main_form
ACTION='"+cfgCgi+"' METHOD=";
if(!_dtl.edit)
out+="GET>\n";
else
out+="POST STYLE='display:none'
onSubmit='"+_dtl.onsubmit+"'>\n"+
"<INPUT TYPE=HIDDEN NAME=JEDIT
VALUE=1>\n";
out+='<INPUT TYPE=HIDDEN NAME=SID
VALUE="'+cfgSID+'">\n'+
'<INPUT TYPE=HIDDEN NAME=FID
VALUE="'+cfgFID+'">\n'+
'<INPUT TYPE=HIDDEN NAME=OP
VALUE="UPDATE">\n'+
'<INPUT TYPE=HIDDEN NAME=FACTORY
VALUE="'+_dtl.factory+'">\n';
if(_dtl.id.length>0)
out+="<INPUT TYPE=HIDDEN NAME=SET.id
VALUE='"+_dtl.id+"'>\n";
docWriteln(out);
_dtl.form[0]=document.main_form;
}
}
function endDetail()
{
detailEndRow();
var out="";
if(_dtl.tableStarted)
out="</TABLE>\n";
if(_dtl.formStarted)
out+="</FORM>";
docWriteln(out);
_dtl.tableStarted=false;
if(typeof
AlertMsg=="string"&&AlertMsg.length>0){
var
e=document.getElementById("alertmsgText");
if(typeof e=="object"&&e!=null){
e.innerHTML=AlertMsg;
e=document.getElementById("alertmsg");
e.style.display="block";
adjScrollDivHeight();
}
}
if(typeof _dtl.firstField=="string"){
_dtl.firstField=document.getElementById(_dtl.firstField);
if(_dtl.firstField!=null){
_dtl.onload=window.onload;
window.onload=detailOnload;
}
else if(_dtl.edit)
_dtl.form[0].style.display="block";
}
if(_dtl.center)
docWriteln("</CENTER>");
if(typeof ahdtop=="object"&&
typeof
ahdtop.detailForms=="object"&&
(typeof alg_factory!="string"||
alg_factory==propFactory)){
if(typeof
argPersistentID=="string"&&
argPersistentID.length>0)
ahdtop.detailForms[argPersistentID]=window.parent;
if(propFactory=="chg"&&typeof
argChgRefNum=="string")
ahdtop.detailForms["chg"+argChgRefNum]=window.parent;
else
if((propFactory=="cr"||propFactory=="iss")&&
typeof argRefNum=="string")
ahdtop.detailForms[propFactory+argRefNum]=window.parent;
}
if(_dtl.spellchk){
do_hiddenfm('spell_form','main_form');
}
}
function detailOnload()
{
if(typeof _dtl.form[0]=="object"){
var f=_dtl.form[0];
f.style.display="block";
if(propFormName.match(/^zdetail/i)&&
typeof f.HTMPL!="object"){
var htmpl=document.createElement("input");
htmpl.type="hidden";
htmpl.name="HTMPL";
htmpl.value=propFormName;
f.appendChild(htmpl);
}
}
if(typeof _dtl.onload=="function")
_dtl.onload();
setTempKeyDownHandler(detailKeyDown);
try{
if(_dtl.serverErrorCount==0){
if(_dtl.firstField.offsetTop>0&&
window.parent.name!="popunder"&&
_dtl.lastKeycode==0&&
(typeof ahdframeset.workframe!="object"||
typeof
ahdframeset.workframe.SkipInitialFocus=="undefined"||
ahdframeset.workframe.SkipInitialFocus!="1"))
_dtl.firstField.focus();
}
else{
var firstBadField=detailValidate();
if(typeof firstBadField=="object")
detailSetFocus(firstBadField);
else
_dtl.firstField.focus();
}
}
catch(e){}
if(typeof top.workframe=="object")
setTimeout("top.workframe.SkipInitialFocus =
0",3000);
if(document.location.search.match(/INITFROM=(\w*)/)&&
typeof top.opener=="object"&&
top.opener!=null&&
!top.opener.closed&&
typeof
top.opener.document.forms[RegExp.$1]=="object"){
var
srcForm=top.opener.document.forms[RegExp.$1];
for(var
i=0;i<srcForm.elements.length;i++){
var e=srcForm.elements[i];
var
tgt=document.main_form.elements[e.name];
if(typeof
tgt=="object"&&tgt!=null){
if(tgt.type!="select-one")
{
if(e.name=="SET.description"||e.name=="SET.summary")
tgt.value=unescape(e.value);
else
tgt.value=e.value;
}
else{
for(var j=0;j<tgt.options.length;j++){
var o=tgt.options[j];
if(o.value==e.value){
tgt.selectedIndex=j;
break;
}
}
}
}
}
}
}
function detailOnUnload()
{
if(typeof ahdtop!="undefined"){
if(typeof alg_factory!="string"||
alg_factory==propFactory){
if(typeof
argPersistentID=="string"&&
argPersistentID.length>0)
delete ahdtop.detailForms[argPersistentID];
if(propFactory=="chg"&&typeof
argChgRefNum=="string")
delete
ahdtop.detailForms["chg"+argChgRefNum];
else
if((propFactory=="cr"||propFactory=="iss")&&
typeof argRefNum=="string")
delete
ahdtop.detailForms[propFactory+argRefNum];
}
}
}
function detailFocus1st()
{
var bSkipFocus=false;
if(typeof ahdframeset.workframe=="object")
{
if(ahdframeset.workframe.SkipInitialFocus!="undefined")
{
if(ahdframeset.workframe.SkipInitialFocus=="1")
{
bSkipFocus=true;
}
}
}
if(bSkipFocus)
{
return;
}
if(typeof _dtl!="undefined"&&
!_dtl.firstFieldFocused)
{
window.focus();
try{
_dtl.firstField.focus();
}
catch(e){}
}
try{
if(_dtl.edit)
ahdframeset.workframe.SkipInitialFocus="1";
}
catch(e){}
}
function
detailStartExpRow(form_name,label,exp_rows,colspan,tblClass)
{
if((form_name!="")&&
(label!="")&&
(exp_rows!="")&&
(colspan>0)&&
!ahdtop.cstUsingScreenReader)
{
detailEndTable();
detailExpandSec(form_name,label,exp_rows,colspan);
}
detailStartRow(tblClass);
}
function detailStartRow(tblClass)
{
if(tblClass=="CLASS=")
tblClass=void(0);
detailCloseForm()
var html="";
detailEndRow();
if(_dtl.tableStarted&&
(typeof tblClass!="undefined"||
ahdtop.cstUsingScreenReader||
(ahdtop.cfgUserType!="analyst"&&!_dtl.edit))){
html+="</TABLE>\n";
_dtl.tableStarted=false;
}
if(!_dtl.tableStarted){
if(_dtl.rowNum==_dtl.lastTableNum)
_dtl.rowNum++;
_dtl.lastTableNum=_dtl.rowNum;
_dtl.currTblId="dtltbl"+_dtl.rowNum;
_dtl.currTblObj=null;
html+="<TABLE id="+_dtl.currTblId+" ";
if(typeof
tblClass=="string"&&tblClass.length>0)
html+=tblClass;
else{
html+="cellpadding=1 cellspacing=5";
if(!_dtl.center)
html+=" WIDTH='90%'";
}
html+=">\n";
_dtl.tableStarted=true;
docWrite(html);
html="";
_dtl.currTblObj=document.getElementById(_dtl.currTblId);
if(_dtl.currTblObj!=null){
var summary;
if(typeof
notebook_current_tabinfo=="object")
summary=msgtext(875,notebook_current_tabinfo.tab_name,_dtl.rowNum+1);
else if(typeof
hdrTitle=="string"&&hdrTitle.length>0)
summary=msgtext(874,hdrTitle,_dtl.rowNum+1);
else
summary=msgtext(838,_dtl.displayName,_dtl.rowNum+1);
if(ahdtop.cfgUserType=="analyst"&&
!ahdtop.cstUsingScreenReader)
summary=summary.replace(/[\s-]*$/,"");
_dtl.currTblObj.summary=summary;
}
}
if(_dtl.expSecHtml!="")
{
html+=_dtl.expSecHtml;
_dtl.expSecHtml="";
}
if(cur_row_num!=-1)
cur_row_num++;
var row_id=get_exp_row_id("");
if(row_id!="")row_id=" ID='"+row_id+"' ";
html+='<TR'+row_id+' VALIGN=TOP>';
docWriteln(html);
_dtl.rowOpen=true;
}
function detailCloseForm()
{
if(!_dtl.edit&&_dtl.formStarted){
document.writeln("</form>");
_dtl.formStarted=false;
}
}
function detailWriteRow()
{
detailEndRow(false);
}
function detailEndRow(closeRow)
{
var html="";
if(_dtl.colNum>0){
if(_dtl.rowOpen){
if(_dtl.colNum==1&&
(ahdtop.cfgUserType!="analyst"||
ahdtop.cstUsingScreenReader)){
if(_dtl.currTblObj==null)
_dtl.currTblObj=document.getElementById(_dtl.currTblId);
if(_dtl.currTblObj!=null)
_dtl.currTblObj.cellSpacing="0";
var th=document.getElementsByTagName("th");
html+="<th> </th>";
_dtl.colSpan[_dtl.colNum]="";
detailSetRowData(" ");
}
html+="</TR>\n";
}
var row_id=get_exp_row_id("");
if(row_id!="")row_id=" ID='"+row_id+"' ";
html+='<TR'+row_id+'>\n';
_dtl.rowOpen=true;
for(var i=0;i<_dtl.colNum;i++){
var text=_dtl.rowData[i];
html+="<td";
if(typeof _dtl.colSpan[i]=="string")
html+=_dtl.colSpan[i];
html+=_dtl.dataclass+" ALIGN=left
VALIGN=top>\n";
if(typeof _dtl.dateField[i]!="number"||
_dtl.dateField[i]!=1){
html+=text+"\n";
}
else{
var next_id=void(0);
var date_data=text.split(":",5);
if(date_data.length==4)
html+=date_input_text(detailCurrForm(),"",date_data[0],
date_data[1],date_data[2],date_data[3]);
if(date_data.length==5)
{
html+=date_input_text(detailCurrForm(),"",date_data[0],
date_data[1],date_data[2],date_data[3],
date_data[4]);
}
}
if(!text.match(/<\/td>/i))
html+="</td>\n";
}
_dtl.colNum=0;
_dtl.hdrColNum=0;
_dtl.colID=0;
_dtl.rowNum++;
}
else if(_dtl.rowOpen){
if(_dtl.TDOpen){
html+="</td>";
_dtl.TDOpen=false;
}
if(_dtl.currTblId=="dtltbl"+_dtl.rowNum){
_dtl.currObj=document.getElementById(_dtl.currTblId);
if(_dtl.currObj!=null){
_dtl.currObj.id="";
_dtl.currObj.summary="";
}
}
}
if(typeof closeRow!="boolean"||closeRow){
if(_dtl.rowOpen){
html+="</tr>";
_dtl.rowOpen=false;
}
}
else{
html+="<td "+_dtl.roclass+">";
_dtl.TDOpen=true;
}
if(html.length>0)
docWriteln(html);
}
function detailEndHdrRow()
{
_dtl.colNum=0;
_dtl.hdrColNum=0;
_dtl.colID=0;
if(_dtl.rowOpen){
docWriteln("</TR>");
_dtl.rowOpen=false;
}
}
function detailEndTable()
{
detailEndRow();
docWriteln("</TABLE>");
_dtl.tableStarted=false;
}
function
detailSetEventHandler(text,readonly)
{
if(_dtl.edit||
(typeof
readonly=="boolean"&&readonly)){
_dtl.eventHandler=text;
}
}
function detailSetFieldTitle(title)
{
_dtl.fieldTitle=title;
}
function detailNextID(colspan,lastInRow)
{
var text="";
var id="df_"+_dtl.rowNum+"_"+_dtl.colID;
_dtl.currID=id;
if(typeof _dtl.firstField=="undefined")
_dtl.firstField=id;
if(typeof
notebook_current_tabinfo=="object")
notebook_current_tabinfo.setFirstField(id);
if(typeof colspan=="number")
_dtl.colID+=colspan;
else{
if(typeof colspan=="boolean")
lastInRow=colspan;
_dtl.colID++;
}
text=" ID="+id+" tabindex="+_dtl.tabIndex;
var eh=_dtl.eventHandler;
if(eh.length==0){
text+=" onFocus=\"return
detailFocus(this);\""+
" onBlur=\"return detailBlur(this);\"";
}
else{
_dtl.eventHandler="";
eh=" "+eh;
if(eh.match(/^(.*onFocus=\\?['"'])(.*)$/i))
eh=RegExp.$1+"detailFocus(this);"+RegExp.$2;
else
text+=" onFocus=\"return
detailFocus(this);\"";
if(eh.match(/^(.*onBlur=\\?['"'])(.*)$/i))
eh=RegExp.$1+"detailBlur(this);"+RegExp.$2;
else
text+=" onBlur=\"return
detailBlur(this);\"";
text+=eh;
}
if(typeof
lastInRow=="boolean"&&lastInRow){
_dtl.rowNum++;
_dtl.colID=0;
_dtl.colNum=0;
_dtl.hdrColNum=0;
}
return text;
}
function detailNextLinkID()
{
var text="
ID=dflnk_"+_dtl.rowNum+"_"+_dtl.colID;
text+=" tabindex=-1";
text+=" onFocus=\"return
detailFocus(this);\""+
" onBlur=\"return detailBlur(this);\"";
return text;
}
function detailIncrCol(colspan)
{
if(typeof colspan=="number")
_dtl.colID+=colspan;
else
_dtl.colID++;
}
function detailFocus(e)
{
if(typeof e=="object"&&e!=null){
if(e.className!="errorField"&&
e.className!="focusErrorField")
e.className="focusField";
else
e.className="focusErrorField";
if(_dtl.lastKeycode==0)
_dtl.lastKeycode=1;
if((typeof
_dtl.firstField=="object")&&
(_dtl.firstField==e))
_dtl.firstFieldFocused=1;
}
return true;
}
function detailBlur(e)
{
if(typeof e=="object"&&e!=null){
if(e.className!="errorField"&&
e.className!="focusErrorField")
e.className="";
else{
detailValidate(true,false);
if(_dtl.errorCount)
e.className=="errorField";
else
e.className=="";
}
if((typeof
_dtl.firstField=="object")&&
(_dtl.firstField==e))
_dtl.firstFieldFocused=0;
}
return true;
}
function detailCurrForm()
{
var n=_dtl.form.length-1;
if(n<=0)
return"main_form";
else
return"main_form"+n;
}
function detailLabelFor(hdrtext,labelForId)
{
var id,doLabelFor;
if(typeof labelForId=="boolean")
doLabelFor=labelForId;
else
doLabelFor=(typeof
_dtl.fieldTitle!="string"||
_dtl.fieldTitle.length==0);
if(doLabelFor){
if(typeof labelForId=="string")
id=labelForId;
else
id="df_"+_dtl.rowNum+"_"+_dtl.colID;
}
if(_dtl.currTblObj==null)
_dtl.currTblObj=document.getElementById(_dtl.currTblId);
if(_dtl.currTblObj!=null&&
(ahdtop.cstUsingScreenReader||
ahdtop.cfgUserType!="analyst")){
var newSummaryText=(_dtl.colNum==0?" ":",
")+hdrtext;
if(typeof
_dtl.fieldTitle=="string"&&
_dtl.fieldTitle.length>0){
newSummaryText=(_dtl.colNum==0?" ":",
")+_dtl.fieldTitle;
if(!_dtl.edit)
_dtl.fieldTitle=void(0);
}
_dtl.currTblObj.summary+=newSummaryText;
}
return" scope='col'>"+hdrtext;
}
function
detailRowHdr(hdrtext,colspan,is_required,writeToDoc,labelForId)
{
var cols="";
if(typeof colspan!="number")
colspan=1;
else if(colspan>1)
cols=" colspan="+colspan;
_dtl.lastHdrtext=hdrtext;
if(hdrtext.length>0){
if(ahdtop.cfgUserType=="analyst"&&
!ahdtop.cstUsingScreenReader)
hdrtext=hdrtext+" ";
var html="<th"+cols+" ALIGN=left
VALIGN=baseline";
if(!hdrtext.match(/^ +$/)){
if(!bool(is_required))
html+=" class="+_dtl.hdrclass;
else{
html+=" class="+_dtl.reqhdrclass;
var trailingNbsp=0;
while(hdrtext.match(/^(.*) \s*$/i)){
hdrtext=RegExp.$1;
trailingNbsp++;
}
hdrtext+=ahdtop.cfgIndRequired;
_dtl.lastHdrtext+=ahdtop.cfgIndRequired;
while(trailingNbsp-->2)
hdrtext+=" ";
}
}
html+=detailLabelFor(hdrtext,labelForId)+"</th>";
if(typeof
writeToDoc!="boolean"||writeToDoc)
docWriteln(html);
}
_dtl.colSpan[_dtl.hdrColNum++]=cols;
if(_dtl.hdrColNum>_dtl.maxCol)
_dtl.maxCol=_dtl.hdrColNum;
return html;
}
function
detailReadonlyFormRowHdr(hdrtext,colspan,is_required,writeToDoc)
{
var saveEdit=_dtl.edit;
_dtl.edit=false;
detailRowHdr(hdrtext,colspan,is_required,writeToDoc);
_dtl.edit=saveEdit;
}
function
detailSetReadonlyRowData(value,colspan,id,rows,size)
{
if(typeof id!="string"||id.length==0){
id="df_"+_dtl.rowNum+"_"+_dtl.colID;
detailIncrCol(colspan);
}
if(typeof _dtl.firstField=="undefined")
_dtl.firstField=id;
var html,idinfo=" id="+id;
if((!ahdtop.cstUsingScreenReader)||
value.match(/^\s*\<a /i)){
html=value.replace(/\n/g,"<br>");
if(_dtl.edit)
idinfo+=" style='font-size:0.7em;'";
if(typeof
_dtl.colSpan[_dtl.colNum]=="string")
_dtl.colSpan[_dtl.colNum]+=idinfo;
else
_dtl.colSpan[_dtl.colNum]=idinfo;
}
else{
idinfo+=" tabindex="+_dtl.tabIndex+
" style='background-color:gainsboro;";
if(!_dtl.edit)
idinfo+="font-size:1.0em;";
idinfo+="'";
if(typeof size!="number"){
if(value.length<20)
size=20;
else if(value.length>100)
size=100;
else
size=value.length;
}
if(typeof
rows=="number"&&rows>1){
html="<textarea readonly rows="+rows+"
cols="+size+
idinfo+' title="'+_dtl.lastHdrtext+'">'+
value+"</textarea>";
}
else{
html="<input type=text readonly
size="+size+idinfo;
if(value!=" "){
value=value.replace(/"/g,'"');
html+=' value="'+value+'"';
}
html+=' title="'+_dtl.lastHdrtext+'">';
}
}
detailSetRowData(html);
return;
}
function detailSetRowData(text,isDate)
{
if(_dtl.dataoverrideclass!="")
{
_dtl.colSpan[_dtl.colNum]+=_dtl.dataoverrideclass;
_dtl.dataoverrideclass="";
}
else
{
if(_dtl.dataclass.length==0&&text.substr(0,1)!="<")
_dtl.colSpan[_dtl.colNum]+=_dtl.roclass;
}
_dtl.rowData[_dtl.colNum]=text;
if((typeof
isDate=="number")&&(isDate==1))
_dtl.dateField[_dtl.colNum]=1;
else
_dtl.dateField[_dtl.colNum]=0;
_dtl.colNum++;
if(_dtl.colNum>_dtl.maxCol)
_dtl.maxCol=_dtl.colNum;
}
function
detailDate(hdrtext,attr_name,colspan,size,time,
is_required,value)
{
if(_dtl.edit)
detailDateEdit(hdrtext,attr_name,colspan,size,time,
is_required,value);
else
detailDateReadonly(hdrtext,attr_name,colspan,time,value);
}
function
detailDateReadonly(hdrtext,attr_name,colspan,time,value)
{
detailRowHdr(hdrtext,colspan,false);
if(value.length>0)
value=date_to_string(value,0,0,time);
else
value=" ";
detailSetReadonlyRowData(value,colspan);
}
function
detailDateEdit(hdrtext,attr_name,colspan,size,time,
is_required,value)
{
if(!detailOK2Edit(attr_name,hdrtext)){
detailDateReadonly(hdrtext,attr_name,colspan,time,value);
return;
}
var field_name;
if(attr_name.match(/^KEEP\./))
field_name=attr_name;
else
field_name="SET."+attr_name;
detailWriteDateHdr(hdrtext,field_name,colspan,is_required,false,"",time);
if(typeof size!="number"||size<2)
size=20;
var nextid=detailNextID(colspan);
if(ahdtop.cstUsingScreenReader){
var titletext=hdrtext;
if(bool(is_required))
titletext+=ahdtop.cfgIndRequired;
nextid+='
title="'+msgtext(897,titletext)+'"';
}
detailSetRowData(field_name+
":"+value+":"+size+
":"+nextid+":"+time,1);
detailSetValidate(hdrtext,is_required,100);
}
function
detailWriteDateHdr(hdrtext,field_name,colspan,
is_required,selector_id,flag_name,time)
{
detailRowHdr("",colspan,is_required);
var n=_dtl.form.length-1;
var hdrhtml="<TH"+
_dtl.colSpan[_dtl.hdrColNum-1]+
' ALIGN=left VALIGN=middle>';
var link='<A
class=lookup1em'+detailNextLinkID()+
' HREF="javascript:void(0)" onClick=\"';
if(typeof selector_id=="string")
link+="detailSwitchDateToText('"+selector_id+"','"+
field_name+"','"+flag_name+"', true);return
false;\" ";
else
{
if(typeof
time!="undefined"&&time=="no")
{
link+="popup_date_helper('"+detailCurrForm()+"','"+
field_name+"','"+
time+"');return false;\" ";
}
else
{
link+="popup_date_helper('"+detailCurrForm()+"','"+
field_name+"');return false;\" ";
}
}
var titletext=msgtext(852,hdrtext);
var lbltext=hdrtext;
if(ahdtop.cstUsingScreenReader){
lbltext=msgtext(840,hdrtext);
hdrhtml+=link+'title="'+msgtext(896,titletext)+'">';
}
else{
link+='title="'+titletext+'"
onMouseOver="window.status=\''+
msgtext(102,hdrtext.toLowerCase()).replace(/\'/g,"\\\'")+
'\';return true" '+
'onMouseOut="window.status=window.defaultStatus;return
true">';
hdrhtml+=link+
'<IMG WIDTH=12 HEIGHT=12 BORDER=0
STYLE="vertical-align:middle" SRC="'+
get_IMG_path("IMG_lookup_cal")+'" alt="'+
msgtext(852,hdrtext)+'"> ';
}
hdrhtml+="<SPAN CLASS=";
if(!bool(is_required))
hdrhtml+="lookup";
else{
hdrhtml+=_dtl.reqhdrclass;
lbltext=+ahdtop.cfgIndRequired;
}
hdrhtml+=detailLabelFor(lbltext)+"</SPAN></A></TH>";
docWriteln(hdrhtml);
}
function
detailDateDropdown(hdrtext,attr_name,colspan,size,
is_required,flag_name,selections)
{
var field_name;
if(attr_name.indexOf("SET")==0)
field_name=attr_name;
else
field_name="SET."+attr_name;
var
date_id="df_"+_dtl.rowNum+"_"+_dtl.colID;
detailWriteDateHdr(hdrtext,field_name,colspan,is_required,date_id,flag_name);
var dateNextID=detailNextID();
var
text=date_input_text("main_form","",field_name,"",size,
dateNextID.replace(date_id,date_id+"_hdn")+
" STYLE='display:none'");
var eh="detailSwitchDateToText('"+date_id+
"','"+field_name+"','"+flag_name+"',
false);";
var p=dateNextID.match(/^(.*)return
(detailBlur.this.;)(.*)$/);
if(p==null)
dateNextID+=" "+eh;
else
dateNextID=p[1]+p[2]+eh+"return
false;"+p[3];
var titletext=hdrtext;
if(bool(is_required))
titletext+=ahdtop.cfgIndRequired;
text+="<SELECT"+dateNextID+
" title=\""+titletext+"\""+
" onClick=\"_dtl.lastKeycode=0;"+eh+"\""+
" STYLE='width:"+(size*10)+"'>\n";
text+="<OPTION
VALUE=0><"+msgtext(1)+">\n";
for(var i=6;i<arguments.length-1;i+=2)
text+="<OPTION
VALUE="+arguments[i]+">"+
arguments[i+1]+"\n";
text+="<OPTION
VALUE=other>"+msgtext(290)+"\n";
text+="</SELECT>";
detailSetRowData(text);
detailSetValidate(hdrtext,is_required,100);
}
function
detailSwitchDateToText(id,field_name,flag_name,popup_helper)
{
var selector=document.getElementById(id);
var
input=document.getElementById(id+"_hdn");
if(selector==null||input==null)
{
if(popup_helper)
popup_date_helper('main_form',field_name);
}
else{
var
v=selector[selector.selectedIndex].value;
if(v!="0"||popup_helper){
selector.onblur=null;
selector.id=id+"_selector";
selector.tabIndex=-1;
input.id=id;
input.style.display="";
input.setAttribute("autocomplete","OFF");
if(_dtl.lastKeycode==0||_dtl.lastKeycode==ENTER)
input.focus();
selector.style.display="none";
var
flag=document.getElementById(flag_name);
if(flag!=null)
flag.value="1";
if(v=="other"||popup_helper)
popup_date_helper('main_form',field_name);
else{
var today=new Date();
if(v-0>0){
var tmp=Math.round(today.getTime()/ 1000) + (v -
0);
input.value=date_to_string(tmp,0);
}
}
adjScrollDivHeight();
}
}
}
function
detailDropdown(hdrtext,attr_name,obj_type,colspan,size,
is_required,persid,rel_attr,
autofill,common_name_attr,common_name_value,
search_status,search_results,link,cbwidth,extraURL,
dflt,selections)
{
var i,field_name;
common_name_value=unescape(common_name_value);
rel_attr=unescape(rel_attr);
if(typeof
selections!="string"||selections.length==0)
selections=new Array();
else{
selections=unescape(selections);
if(selections=="SelListCacheMax"){
detailLookupEdit(hdrtext,attr_name,obj_type,colspan,size,
is_required,persid,rel_attr,
autofill,common_name_attr,common_name_value,
search_status,search_results,"yes",extraURL);
return;
}
selections=selections.split("@,@");
for(i=18;i<arguments.length;i++)
selections[selections.length]=unescape(arguments[i]);
}
if(!detailOK2Edit(attr_name,hdrtext)){
detailLookupReadonly(hdrtext,attr_name,colspan,
persid,common_name_value,link);
return;
}
detailRowHdr(hdrtext,colspan,is_required);
if(attr_name.match(/^KEEP\./))
field_name=attr_name;
else
field_name="SET."+attr_name;
var
item='<SELECT'+detailNextID(colspan);
if(cbwidth!=0)
item+=' STYLE="WIDTH:'+cbwidth+'px;"';
if(typeof _dtl.fieldTitle!="string"||
_dtl.fieldTitle.length==0){
var titletext=hdrtext;
if(bool(is_required))
titletext+=ahdtop.cfgIndRequired;
item+=" title=\""+titletext+"\"";
}
else{
item+=" title=\""+_dtl.fieldTitle+"\"";
_dtl.fieldTitle=void(0);
}
item+=' NAME="'+field_name+'">\n';
var options="";
if(!bool(is_required)||
(rel_attr.length==0&&dflt.length==0))
options+='<OPTION
VALUE=""><'+msgtext(1)+'>\n';
var curr_found=false;
for(i=1;i<selections.length;i+=2){
var sym=selections[i-1];
var code=selections[i];
if(code==rel_attr||
(sym==dflt&&
rel_attr.length==0&&
dflt.length>0)){
curr_found=true;
options+='<OPTION SELECTED
VALUE="'+code+'">'+sym+'\n';
}
else
options+='<OPTION
VALUE="'+code+'">'+sym+'\n';
}
if(!curr_found&&rel_attr.length>0){
if(common_name_value.length==0)
common_name_value="?";
options+='<OPTION SELECTED
VALUE="'+rel_attr+'">'+common_name_value+'\n';
}
item+=options+'</SELECT>\n';
detailSetRowData(item);
detailSetValidate(hdrtext,is_required);
}
function
detailHier(hdrtext,attr_name,obj_type,colspan,size,
is_required,persid,rel_attr,
autofill,common_name_attr,common_name_value,
search_status,search_results)
{
common_name_value=unescape(common_name_value);
rel_attr=unescape(rel_attr);
var ahdtop=get_ahdtop();
if(typeof
ahdtop=="object"&&ahdtop!=null&&
ahdtop.cfgSuppressHier.indexOf(" "+obj_type+"
")!=-1){
detailLookupEdit(hdrtext,attr_name,obj_type,colspan,size,
is_required,persid,rel_attr,
autofill,common_name_attr,common_name_value,
search_status,search_results);
return;
}
if(_dtl.edit)
detailHierEdit(hdrtext,attr_name,obj_type,colspan,size,
is_required,persid,rel_attr,
autofill,common_name_attr,common_name_value,
search_status,search_results)
else
detailLookupReadonly(hdrtext,attr_name,colspan,
persid,common_name_value);
}
var cat_validate_fld=void(0);
function
detailHierEdit(hdrtext,attr_name,obj_type,colspan,size,
is_required,persid,rel_attr,
autofill,common_name_attr,common_name_value,
search_status,search_results)
{
if(!detailOK2Edit(attr_name,hdrtext)){
detailLookupReadonly(hdrtext,attr_name,colspan,
persid,common_name_value);
return;
}
if(typeof size!="number"||size<2)
size=20;
var n=_dtl.form.length-1;
var item,do_autofill;
detailRowHdr("",colspan,is_required);
if(typeof common_name_attr!="string"||
common_name_attr.length==0)
do_autofill=false;
else
do_autofill=(autofill=="yes");
var hdrhtml="<TH"+
_dtl.colSpan[_dtl.hdrColNum-1]+
' ALIGN=left VALIGN=middle>';
var link='<A
class=lookup1em'+detailNextLinkID()+
' HREF="javascript:void(0)"
onclick="popup_hier(\''+
obj_type+"','KEY."+attr_name+
"','"+detailCurrForm()+"','"+
common_name_attr+"',1)\" ";
var lbltext=hdrtext;
var titletext=msgtext(851,hdrtext);
if(ahdtop.cstUsingScreenReader){
lbltext=msgtext(841,lbltext);
hdrhtml+=link+'
title="'+msgtext(896,titletext)+'">';
}
else{
link+='title="'+titletext+'"
onMouseOver="window.status=\''+
msgtext(102,lbltext.toLowerCase()).replace(/\'/g,"\\\'")+
'\';return true" '+
'onMouseOut="window.status=window.defaultStatus;return
true">';
hdrhtml+=link+
'<IMG WIDTH=12 HEIGHT=12 BORDER=0
STYLE="vertical-align:middle" SRC="'+
get_IMG_path("IMG_lookup_hier")+'" alt="'+
msgtext(851,hdrtext)+'"> ';
}
hdrhtml+="<SPAN CLASS=";
if(!bool(is_required))
hdrhtml+="lookup";
else{
hdrhtml+=_dtl.reqhdrclass;
lbltext=+ahdtop.cfgIndRequired;
}
hdrhtml+=detailLabelFor(lbltext)+"</SPAN></A></TH>";
docWriteln(hdrhtml);
var onchg;
if(do_autofill)
onchg="detailAutofill(this,'"+obj_type+
"',0,'"+common_name_attr+"',true);";
else
onchg="detailClearSetField(this)";
var eh=_dtl.eventHandler;
if(eh.length==0)
_dtl.eventHandler="onChange=\""+onchg+"\"
";
else
if(!eh.match(/^(.*onChange=\\?)(['"'])(.*)$/i))
_dtl.eventHandler+=" onChange=\""+onchg+"\"
";
else{
if(RegExp.$2=="'")
onchg=onchg.replace(/'/g,'"');
_dtl.eventHandler=RegExp.$1+RegExp.$2+onchg+";"+RegExp.$3;
}
if(obj_type=="KCAT"&&attr_name=="PRIMARY_INDEX")
{
item="<INPUT"+detailNextID(colspan)+"
TYPE=text readonly style=border:none;background- color:white
VALUE=\""+
common_name_value.replace(rxQuote,""")+
"\" SIZE=50"+" NAME=\"KEY."+attr_name+"\"";
}
else
{
item="<INPUT"+detailNextID(colspan)+"
TYPE=text VALUE=\""+
common_name_value.replace(rxQuote,""")+
"\" SIZE="+size+"
NAME=\"KEY."+attr_name+"\"";
}
if(ahdtop.cstUsingScreenReader){
titletext=hdrtext;
if(bool(is_required))
titletext+=ahdtop.cfgIndRequired;
item+='
title="'+msgtext(897,titletext)+'">\n';
}
else
item+=">\n";
item+='<INPUT TYPE=hidden NAME="'+
"SET."+attr_name+'"
VALUE="'+rel_attr+'">\n';
if(typeof
search_status=="string"&&search_status.length>0){
item+="<BR><SPAN ID=search_status_span
CLASS=statuslabeltext>"+
search_status+"</SPAN>";
if(typeof
AlertMsg=="string"&&AlertMsg.length>0)
AlertMsg+="<BR>"+hdrtext+":
"+search_status;
else
AlertMsg=hdrtext+": "+search_status;
}
detailSetRowData(item);
var
f_obj=detailSetValidate(hdrtext,is_required,0,search_status);
if(attr_name=="category")
cat_validate_fld=f_obj;
}
function
detailLookup(hdrtext,attr_name,obj_type,colspan,size,
is_required,persid,rel_attr,
autofill,common_name_attr,common_name_value,
search_status,search_results,link,extraURL)
{
common_name_value=unescape(common_name_value);
if(attr_name=="group")
{
common_name_value=common_name_value.replace(",
,","");
}
if(_dtl.edit)
detailLookupEdit(hdrtext,attr_name,obj_type,colspan,size,
is_required,persid,rel_attr,
autofill,common_name_attr,common_name_value,
search_status,search_results,link,extraURL)
else
detailLookupReadonly(hdrtext,attr_name,colspan,
persid,common_name_value,link);
}
function
detailLookupReadonly(hdrtext,attr_name,colspan,
persid,common_name_value,link)
{
var item;
common_name_value=unescape(common_name_value);
var arr=persid.split(":");
var is_contact=arr[0]=="agt"||
arr[0]=="cnt"||
arr[0]=="cst"||
arr[0]=="agtgrp"||
arr[0]=="grp";
if(is_contact)
{
arr=common_name_value.split(",");
if(arr.length==3)
common_name_value=arr[0]+", "+arr[1]+"
"+arr[2];
}
var nextIdText=detailNextID(colspan);
var id=_dtl.currID+"_"+attr_name;
if(common_name_value.length==0){
_dtl.lookupAttrs[attr_name]={id:id};
detailRowHdr(hdrtext,colspan,false,void(0),id);
detailSetReadonlyRowData(" ",colspan,id);
return;
}
else if(typeof
link=="string"&&link=="no"){
_dtl.lookupAttrs[attr_name]={id:id};
detailRowHdr(hdrtext,colspan,false,void(0),id);
detailSetReadonlyRowData(common_name_value,colspan,id);
return;
}
else{
detailRowHdr(hdrtext,colspan,false,void(0),false);
var
lookupClass=(_dtl.edit?'lookup':'lookup1em');
if(typeof
link=="string"&&link!="yes")
item='<A'+nextIdText+'
HREF="javascript:'+link+
' " title="'+hdrtext+" "+common_name_value+
'"><SPAN
class='+lookupClass+'>'+common_name_value+
'</SPAN></A>';
else
item="<A"+nextIdText+
' title="'+hdrtext+" "+common_name_value+
"\"
HREF='javascript:showDetailWithPersid(\""+persid+
"\")'><SPAN
class="+lookupClass+'>'+common_name_value+
'</SPAN></A>';
id=_dtl.currID;
}
_dtl.lookupAttrs[attr_name]={id:id};
detailSetRowData(item);
}
function selAgtCheck(sel)
{
if(_dtl.edit&&!_dtl.skip_agt_check)
{
var opt=sel.options[sel.selectedIndex];
if(typeof
opt.value=="undefined"||opt.value=="")return;
var f=document.main_form;
detailAgtCheck(f,"group",opt.value,prop_ref);
}
}
function
detailLookupEdit(hdrtext,attr_name,obj_type,colspan,size,
is_required,persid,rel_attr,
autofill,common_name_attr,common_name_value,
search_status,search_results,linkinfo,extraURL,bSetFontTo1em)
{
if(typeof bSetFontTo1em!="undefined")
{
if(bSetFontTo1em==1)
{
_dtl.dataoverrideclass="
style='font-size:1.0em;'";
}
}
if(!detailOK2Edit(attr_name,hdrtext)){
detailLookupReadonly(hdrtext,attr_name,colspan,
persid,common_name_value);
return;
}
if(typeof extraURL=="undefined")
extraURL="";
extraURL=extraURL.replace(/'/g,escape("'"));
extraURL=extraURL.replace(/"/g,escape('"'));
common_name_value=unescape(common_name_value);
if(typeof size!="number"||size<2)
size=20;
var n=_dtl.form.length-1;
var is_contact=obj_type=="agt"||
obj_type=="cnt"||
obj_type=="cst"||
obj_type=="agtgrp"||
obj_type=="grp";
var item,field_name,do_autofill;
if(typeof
search_results!="string"||search_results.length==0)
search_results="";
else
search_results=search_results.split("@,@");
if(search_results.length>2){
detailRowHdr(hdrtext,colspan,is_required);
if(attr_name.match(/^KEEP\./))
field_name=attr_name;
else
field_name="SET."+attr_name;
if(attr_name=="group")
{
var onblur="selAgtCheck(this)";
var eh=_dtl.eventHandler;
if(eh.length==0)
_dtl.eventHandler="onBlur=\""+onblur+"\" ";
else
if(!eh.match(/^(.*onBlur=\\?)(['"'])(.*)$/i))
_dtl.eventHandler+=" onBlur=\""+onblur+"\"
";
else
_dtl.eventHandler=RegExp.$1+RegExp.$2+onblur+";"+RegExp.$3;
}
item='<SELECT'+detailNextID(colspan)+
' NAME="'+field_name+'">\n';
var options="";
if(!bool(is_required))
options+='<OPTION
VALUE=""><'+msgtext(1)+'>\n';
for(var
i=1;i<search_results.length;i+=2){
var sym=search_results[i-1];
var code=search_results[i];
options+='<OPTION
VALUE="'+code+'">'+sym+'\n';
}
options+="<OPTION
VALUE='noneoftheabove'>"+msgtext(236)+"\n";
item+=options+'</SELECT>\n';
}
else{
detailRowHdr("",colspan,is_required);
if(search_results.length==2){
common_name_value=search_results[0];
rel_attr=search_results[1];
}
if(typeof common_name_attr!="string"||
common_name_attr.length==0)
do_autofill=false;
else
do_autofill=(autofill=="yes");
var hdrhtml="<TH"+
_dtl.colSpan[_dtl.hdrColNum-1]+
' ALIGN=left VALIGN=middle>';
var link='<A class=lookup1em'+
detailNextLinkID()+
' HREF="javascript:void(0)" onclick="';
if(typeof
linkinfo=="string"&&linkinfo!="yes"){
link+=linkinfo+"\" ";
}
else if(is_contact)
link+="fill_name_fields(_dtl.form["+n+"],'"+
obj_type+"','"+attr_name+"',true,'"+extraURL+"'
)\" ";
else{
link+="popup_search('"+obj_type+"','KEY."+attr_name+
"','"+detailCurrForm()+"',
'"+extraURL+"',0,'"+
common_name_attr+"')\" ";
}
var titletext=msgtext(851,hdrtext);
var lbltext=hdrtext;
if(ahdtop.cstUsingScreenReader){
lbltext=msgtext(839,lbltext);
hdrhtml+=link+'
title="'+msgtext(896,titletext)+'">';
}
else{
link+='title="'+titletext+'"
onMouseOver="window.status=\''+
msgtext(102,lbltext.toLowerCase()).replace(/\'/g,"\\\'")+
'\';return true" '+
'onMouseOut="window.status=window.defaultStatus;return
true">';
hdrhtml+=link+
'<IMG WIDTH=12 HEIGHT=12 BORDER=0
STYLE="vertical-align:middle" SRC="'+
get_IMG_path("IMG_lookup")+'" alt="'+
msgtext(851,hdrtext)+'"> ';
}
hdrhtml+="<SPAN CLASS=";
if(!bool(is_required))
hdrhtml+="lookup";
else{
hdrhtml+=_dtl.reqhdrclass;
lbltext+=ahdtop.cfgIndRequired;
}
hdrhtml+=detailLabelFor(lbltext)+"</SPAN></A></TH>";
docWriteln(hdrhtml);
var onchg;
if(do_autofill)
onchg="detailAutofill(this,'"+obj_type+
"',"+is_contact+",'"+common_name_attr+"',false,'"+extraURL+"');";
else if(is_contact)
onchg="fill_name_fields('main_form','"+obj_type+
"','"+attr_name+"',true,'"+extraURL+"');";
else
onchg="detailClearSetField(this);";
var eh=_dtl.eventHandler;
if(eh.length==0)
_dtl.eventHandler="onChange=\""+onchg+"\"
";
else
if(!eh.match(/^(.*onChange=\\?)(['"'])(.*)$/i))
_dtl.eventHandler+=" onChange=\""+onchg+"\"
";
else{
if(RegExp.$2=="'")
onchg=onchg.replace(/'/g,'"');
_dtl.eventHandler=RegExp.$1+RegExp.$2+onchg+RegExp.$3;
}
item="<INPUT"+detailNextID(colspan)+"
TYPE=text VALUE=\""+
common_name_value.replace(rxQuote,""")+
"\" SIZE="+size;
if(ahdtop.cstUsingScreenReader){
var titletext=hdrtext;
if(bool(is_required))
titletext+=ahdtop.cfgIndRequired;
item+='
title="'+msgtext(897,titletext)+'"';
}
item+=" NAME=\"";
if(!is_contact){
item+="KEY."+attr_name+"\">\n";
}
else{
item+=attr_name+"_combo_name\">\n";
item+='<INPUT TYPE=hidden NAME="'+
"KEY."+attr_name+'">\n';
item+='<INPUT TYPE=hidden NAME="'+
attr_name+'_lname">\n';
item+='<INPUT TYPE=hidden NAME="'+
attr_name+'_fname">\n';
item+='<INPUT TYPE=hidden NAME="'+
attr_name+'_mname">\n';
}
item+='<INPUT TYPE=hidden NAME="'+
"SET."+attr_name+'"
VALUE="'+rel_attr+'">\n';
}
if(typeof
search_status=="string"&&search_status.length>0){
item+="<BR><SPAN
CLASS=statuslabeltext>"+
search_status+"</SPAN>";
if(typeof
AlertMsg=="string"&&AlertMsg.length>0)
AlertMsg+="<BR>"+hdrtext+":
"+search_status;
else
AlertMsg=hdrtext+": "+search_status;
}
detailSetRowData(item);
detailSetValidate(hdrtext,is_required,0,search_status);
}
function
detailAutofill(e,obj_type,is_contact,common_name_attr,is_hier,extraURL)
{
if(typeof
autofillTrigger!="undefined"&&
!autofillTrigger(e,obj_type,is_contact,common_name_attr))
return;
detailClearSetField(e);
var do_search=false;
if(_dtl.lastKeycode==TAB&&
ahdframe.currentAction==ACTN_COMPLETE&&
!e.value.match(/^\s*$/)){
if(is_contact)
do_search=true;
else if(is_hier)
popup_hier(obj_type,e.name,"main_form",common_name_attr,true);
else
popup_search(obj_type,e.name,"main_form",
extraURL,0,common_name_attr);
}
if(is_contact&&
e.name.match(/^(.*)_combo_name$/))
fill_name_fields(_dtl.form[0],obj_type,RegExp.$1,do_search,extraURL);
}
function detailClearSetField(e)
{
if(e.name.match(/^KEY\.(.*)$/)||
e.name.match(/^(.*)_combo_name$/)){
var
setfld=document.main_form["SET."+RegExp.$1];
if(setfld!=null)
setfld.value="";
}
}
function
detailCheckbox(hdrtext,attr_name,colspan,value,on,off)
{
if(_dtl.edit)
detailCheckboxEdit(hdrtext,attr_name,colspan,value);
else
detailCheckboxReadonly(hdrtext,attr_name,colspan,value,on,off);
}
function
detailCheckboxReadonly(hdrtext,attr_name,colspan,value,on,off)
{
detailRowHdr(hdrtext,colspan,false);
if(value.length==0||value.match(/^[
0]*$/)){
if(typeof off=="string"&&
off.length>0&&
!off.match(/^ +$/))
value=off;
else
value=" ";
}
else{
if(typeof
on=="string"&&on.length>0)
value=on;
else
value="X";
}
detailSetReadonlyRowData(value,colspan);
}
function
detailCheckboxEdit(hdrtext,attr_name,colspan,value)
{
if(!detailOK2Edit(attr_name,hdrtext)){
detailCheckboxReadonly(hdrtext,attr_name,colspan,value);
return;
}
detailRowHdr(hdrtext,colspan,false);
var item="<INPUT TYPE=hidden
NAME=SET."+attr_name+
"
VALUE=\""+value.replace(rxQuote,""")+"\">\n"+
"<INPUT"+detailNextID(colspan)+
" TYPE=checkbox VALUE='1'
NAME=CBX."+attr_name+
" onClick=\"detailSetCbxFlag(this)\"";
if(typeof _dtl.fieldTitle!="string"||
_dtl.fieldTitle.length==0)
item+=" title=\""+hdrtext+"\"";
else{
item+=" title=\""+_dtl.fieldTitle+"\"";
_dtl.fieldTitle=void(0);
}
if(value.length>0&&!value.match(/^[
0]*$/))
item+=" CHECKED";
item+=">";
detailSetRowData(item);
}
function detailSetCbxFlag(element)
{
if(element.name.match(/CBX\.([\.\w]*)/)){
var f=document.main_form["SET."+RegExp.$1];
if(f!=null)
f.value=(element.checked?"1":"0");
}
}
function
detailTextbox(hdrtext,attr_name,colspan,rows,size,
is_required,maxsize,value,spellchk,srchknow)
{
if(_dtl.edit)
detailTextboxEdit(hdrtext,attr_name,colspan,rows,size,
is_required,maxsize,value,spellchk,srchknow)
else
detailTextboxReadonly(hdrtext,attr_name,colspan,value,
void(0),void(0),rows,size);
}
function
detailTextboxReadonly(hdrtext,attr_name,colspan,value,id,overrideclass,rows,size)
{
value=unescape(value);
detailRowHdr(hdrtext,colspan,false);
if(value.length==0||value.match(/^ *$/))
value=" ";
if(typeof overrideclass!="undefined")
_dtl.dataoverrideclass="
CLASS="+overrideclass;
detailSetReadonlyRowData(value,colspan,id,rows,size);
}
function
detailTextboxEdit(hdrtext,attr_name,colspan,rows,size,
is_required,maxsize,value,spellchk,srchknow)
{
if(!detailOK2Edit(attr_name,hdrtext)){
detailTextboxReadonly(hdrtext,attr_name,colspan,value);
return;
}
var item,th,field_name;
value=unescape(value);
if(typeof size!="number"||size<2)
size=20;
if(attr_name.match(/^KEEP\./))
field_name=attr_name;
else
field_name="SET."+attr_name;
var spellchk_button=(typeof
spellchk=="string"&&spellchk.match(/^[Yy]/));
var srchknow_button=(typeof
srchknow=="string"&&srchknow.match(/^[Yy]/));
if((!spellchk_button)&&(!srchknow_button))
detailRowHdr(hdrtext,colspan,is_required);
else{
_dtl.doingLabelButton=true;
var
rowHdr=detailRowHdr(hdrtext,colspan,is_required,false);
if(typeof colspan!="number"||colspan==1)
th="<TH";
else
th="<TH COLSPAN="+colspan;
rowHdr=rowHdr.replace("baseline","middle");
var row_id=get_exp_row_id("");
if(row_id!="")
row_id=" ID='"+row_id+"' ";
docWriteln(th+"
ALIGN=left><TABLE><TR"+row_id+">"+rowHdr);
if(spellchk_button){
_dtl.spellchk=true;
ImgBtnSetDefaultTabIndex(_dtl.tabIndex+1);
docWriteln("<TH>");
ImgBtnCreate("",msgtext(408),
"popup_spellchecker('spell_form','main_form','"+
field_name+"')",true,0,msgtext(912,hdrtext));
docWriteln("</TH>");
}
if(srchknow_button){
_dtl.srhknow=true;
ImgBtnSetDefaultTabIndex(_dtl.tabIndex+1);
docWriteln("<TH>");
ImgBtnCreate("",msgtext(690),
"srchknow('"+field_name+"')",true,0,
msgtext(913,hdrtext));
docWriteln("</TH>");
}
docWriteln("</TR></TABLE></TH>");
_dtl.doingLabelButton=false;
}
if(propFactory=="KD")
{
_dtl.spellchk=true;
}
var titletext=hdrtext;
if(bool(is_required))
titletext+=ahdtop.cfgIndRequired;
if(rows-0==1)
{
item="<INPUT"+detailNextID(colspan)+
" TYPE=text
VALUE=\""+value.replace(rxQuote,""")+
"\" SIZE="+size+" NAME='"+field_name+"'";
if(typeof _dtl.fieldTitle!="string"||
_dtl.fieldTitle.length==0)
item+=" title=\""+titletext+"\"";
else{
item+=" title=\""+_dtl.fieldTitle+"\"";
_dtl.fieldTitle=void(0);
}
if(maxsize>0)
item+=" MAXLENGTH="+maxsize+">";
else
item+=">";
}
else{
item="<TEXTAREA"+detailNextID(colspan)+
" ROWS="+rows+" COLS="+size;
if(typeof _dtl.fieldTitle!="string"||
_dtl.fieldTitle.length==0)
item+=" title=\""+titletext+"\"";
else{
item+=" title=\""+_dtl.fieldTitle+"\"";
_dtl.fieldTitle=void(0);
}
item+=" NAME='"+field_name+"'>"+
value+"</TEXTAREA>";
}
detailSetRowData(item);
detailSetValidate(hdrtext,is_required,maxsize);
if(spellchk_button||srchknow_button)
_dtl.tabIndex++;
}
function
detailExternal(hdrtext,text,colspan)
{
if(typeof text!="string"){
if(typeof text=="number"&&
typeof colspan=="undefined")
colspan=text;
if(typeof
hdrtext!="string"||hdrtext.length==0)
return;
text=hdrtext;
hdrtext="";
}
detailRowHdr(hdrtext,colspan,false);
if(!text.match(/^\s*\</))
detailSetReadonlyRowData(text,colspan);
else
detailSetRowData(text);
}
function
detailHTMLEditBox(hdrtext,attr_name,colspan,rows,size,
is_required,maxsize,value,spellchk,preview,optionid,readonly,toolbar)
{
var row_id;
var id="df_"+_dtl.rowNum+"_"+_dtl.colID;
var divId="div"+id;
var generatedButton=false;
if((typeof
readonly=="string"&&readonly.match(/^[Yy]/))||
!detailOK2Edit(attr_name,hdrtext))
{
detailHTMLEditBoxReadOnly(hdrtext,attr_name,colspan,rows,size,
is_required,maxsize,value,preview,optionid,divId);
return;
}
var bShowEditor=true;
if(ahdtop.cfgNX_KT!="Yes"&&toolbar=="kd")
bShowEditor=false;
var th,field_name,spellButId;
if(optionid.length==0||optionid=="")
optionid="id"+attr_name;
if(typeof size!="number"||size<2)
size=20;
if(attr_name.match(/^KEEP\./))
field_name=attr_name;
else
field_name="SET."+attr_name;
var
rowHdr=detailRowHdr(hdrtext,colspan,is_required,false);
if(typeof colspan!="number"||colspan==1)
th="<TH";
else
th="<TH COLSPAN="+colspan;
rowHdr=rowHdr.replace("baseline","middle");
row_id=get_exp_row_id("");
if(row_id!="")row_id=" ID='"+row_id+"' ";
docWriteln(th+"
ALIGN=left><TABLE><TR"+row_id+">"+rowHdr+"<TH>");
_dtl.doingLabelButton=true;
if(bShowEditor||
(typeof
spellchk=="string"&&spellchk.match(/^[Yy]/))){
generatedButton=true;
ImgBtnRow(10);
if(bShowEditor)
{
ImgBtnSetDefaultTabIndex(_dtl.tabIndex+1);
ImgBtnCreate("",msgtext(561,hdrtext),
"OpenHTMLEditor('"+field_name+"','"+divId+"','"+
toolbar+"')",true,0,msgtext(914,hdrtext));
}
if(typeof
spellchk=="string"&&spellchk.match(/^[Yy]/))
{
_dtl.spellchk=true;
ImgBtnSetDefaultTabIndex(_dtl.tabIndex+1);
spellButId=ImgBtnCreate("",msgtext(408),
"popup_spellchecker('spell_form','main_form','"+
field_name+"')",true,0,msgtext(912,hdrtext));
}
ImgBtnEndRow();
}
docWriteln("</TH>");
if(bShowEditor&&typeof
preview=="string"&&preview.match(/^[Yy]/))
{
var
qvKey=registerActionKey("",msgtext(562),setRadioButton,
_dtl.form[0].name,optionid,0);
var
htmlKey=registerActionKey("",msgtext(563),setRadioButton,
_dtl.form[0].name,optionid,1);
docWriteln("<TH><INPUT TYPE=radio
ID=radioPreview NAME="+
optionid+
"
onclick=detailHTMLEditBoxMode('1','"+divId+"','"+
id+"','"+spellButId+
"') tabindex="+(_dtl.tabIndex+1)+
"><SPAN class=labeltext><label
for='radioPreview'>"+
fmtLabelWithActkey(msgtext(562),qvKey)+
"</label></SPAN><INPUT TYPE=radio
CHECKED ID=radioSource NAME="+
optionid+
"
onclick=detailHTMLEditBoxMode('0','"+divId+"','"+
id+"','"+spellButId+
"') tabindex="+(_dtl.tabIndex+1)+
"><SPAN class=labeltext><label
for='radioSource'>"+
fmtLabelWithActkey(msgtext(563),htmlKey)+
"</label></SPAN></TH>");
}
docWriteln("</TR></TABLE></TH>");
_dtl.doingLabelButton=false;
var item="";
item+="<TABLE CELLPADDING=0
CELLSPACING=0>";
if(bShowEditor)
{
row_id=get_exp_row_id("");
if(row_id!="")row_id=" ID='"+row_id+"' ";
item+="<TR"+row_id+">"+"<TD><DIV
ID='"+divId+"' "+
"
style='display:none;overflow:auto;font-size:1.0em;background-color:#f4f4f4;border-
style:solid;border-width:1;'>"+
"</DIV></TD></TR>";
}
row_id=get_exp_row_id("");
var titletext=hdrtext;
if(bool(is_required))
titletext+=ahdtop.cfgIndRequired;
if(row_id!="")row_id=" ID='"+row_id+"' ";
item+="<TR><TD"+row_id+"><TEXTAREA
"+detailNextID(colspan)+
" title=\""+titletext+"\""+
" ROWS="+rows+" COLS="+size+
"
NAME='"+field_name+"'></TEXTAREA></TD></TR></TABLE>";
detailSetRowData(item);
detailSetValidate(hdrtext,is_required,maxsize);
var
sCMD="SetHTMLValue('"+value+"','"+field_name+"');";
window.setTimeout(sCMD,50);
if(generatedButton)
_dtl.tabIndex++;
}
function SetHTMLValue(sValue,sFldName)
{
sValue=unescape(sValue);
var e=null;
for(var
i=0;i<document.forms.length;i++){
e=document.forms[i].elements[sFldName];
if(typeof e=="object")
break;
}
if(typeof e=="object")
try{
e.value=sValue;
}
catch(e){}
}
function
detailHTMLEditBoxReadOnly(hdrtext,attr_name,colspan,rows,size,
is_required,maxsize,value,preview,optionid,divId)
{
var row_id;
var field_name;
value=unescape(value);
value=ReplaceRepIdToImgPath(value);
if(optionid==0||optionid.length==0||optionid=="")
optionid="id"+attr_name;
if(typeof size!="number"||size<2)
size=20;
if(attr_name.match(/^KEEP\./))
field_name=attr_name;
else
field_name="SET."+attr_name;
detailRowHdr(hdrtext,colspan,false);
detailIncrCol(colspan);
var sAttr=detailNextID(colspan);
var startPos=sAttr.indexOf("=");
var endPos=sAttr.indexOf(" ",startPos);
var sID=sAttr.substring(startPos+1,endPos);
var item="";
row_id=get_exp_row_id("");
if(row_id!="")
row_id=" ID='"+row_id+"' ";
item+="<TABLE width=100% CELLPADDING=0
CELLSPACING=0 class=labeltext style='font-
size:1.0em;'><TR"+row_id+
"><TD><DIV ID='"+divId+"'
tabindex="+_dtl.tabIndex+
" title=\""+hdrtext+"\"
style='overflow:auto;'>"+
value+"</DIV></TD></TR></TABLE>";
detailSetRowData(item);
}
function
detailKeyDown(active_element,keycode,shiftkey,altkey)
{
_dtl.lastKeycode=keycode;
var r,c,e=null,v;
if(typeof active_element=="object"){
var id=active_element.id;
if(typeof id!="string")
id="";
if(id.match(/df([\w]*)_([\d]+)_([\d]+)/)){
var lnk=RegExp.$1;
var row=RegExp.$2-0;
var col=RegExp.$3-0;
var maxRow=_dtl.rowNum-1;
var maxCol=_dtl.maxCol;
if(row==_dtl.propertyRow){
switch(keycode){
case ARROW_UP:
if(col>0)
e=document.getElementById("df_"+row+"_"+(col-1));
break;
case ARROW_DOWN:
e=document.getElementById("df_"+row+"_"+(col+1));
break;
}
if(e!=null)
keycode=0;
}
switch(keycode){
case ARROW_LEFT:
if(ahdtop.cfgUserType!="analyst"||
ahdtop.cstUsingScreenReader)
break;
if(!altkey){
if((active_element.type=="text"||
active_element.type=="textarea")&&
active_element.value.length>0)
break;
}
while(e==null){
col--;
if(col<0){
col=maxCol;
if(row>0)
row--;
else
row=maxRow;
}
e=document.getElementById("df_"+row+"_"+col);
}
break;
case ARROW_RIGHT:
if(active_element.tagName=="A"&&
!altkey&&
!shiftkey){
for(var p=active_element;
p!=null&&p.tagName!="FORM";
p=p.parentNode){
var handler=p.oncontextmenu;
if(handler==null)
handler=p.onmouseover;
if(handler!=null){
var script=handler.toString().replace(/\n/g,"
");
if(script.match(/\{(.*\.show)/)){
eval(RegExp.$1+"('mouseless',active_element,0)");
return false;
}
}
}
}
if(ahdtop.cfgUserType!="analyst"||
ahdtop.cstUsingScreenReader)
break;
if(!altkey){
if((active_element.type=="text"||
active_element.type=="textarea")&&
active_element.value.length>0)
break;
}
while(e==null){
col++;
if(col>maxCol){
col=0;
if(row<maxRow)
row++;
else
row=0;
}
e=document.getElementById("df_"+row+"_"+col);
}
break;
case ARROW_UP:
if(ahdtop.cstUsingScreenReader){
if(active_element.type=="text")
e=document.getElementById("dflnk_"+row+"_"+col);
if(e==null)
break;
}
if((active_element.type=="select-one"||
active_element.type=="select-multiple")&&
(_browser.isNS||!shiftkey))
break;
if(!altkey){
if(active_element.type=="textarea"&&
active_element.value.length>0)
break;
}
if(lnk!="lnk")
e=document.getElementById("dflnk_"+row+"_"+col);
for(r=row-1;r>0&&e==null;r--)
e=document.getElementById("df_"+r+"_"+col);
while(e==null){
if(row>0)
row--;
else
row=maxRow;
for(c=col;e==null&&c>=0;c--)
e=document.getElementById("df_"+row+"_"+c);
}
break;
case ARROW_DOWN:
if(ahdtop.cstUsingScreenReader&&
active_element.tagName!="A")
break;
if((active_element.type=="select-one"||
active_element.type=="select-multiple")&&
(_browser.isNS||!shiftkey))
break;
if(!altkey){
if(active_element.type=="textarea"&&
active_element.value.length>0)
break;
}
if(lnk=="lnk")
e=document.getElementById("df_"+row+"_"+col);
for(r=row+1;r<=maxRow&&e==null;r++)
e=document.getElementById("df_"+r+"_"+col);
while(e==null){
if(row<maxRow)
row++;
else
row=0;
for(c=col;e==null&&c>=0;c--)
e=document.getElementById("df_"+row+"_"+c);
}
break;
case TAB:
if(_dtl.errorCount){
for(var
i=0;i<_dtl.fieldToValidate.length;i++){
v=_dtl.fieldToValidate[i];
if(v.id==active_element.id){
if(v.browserFoundError){
v.browserFoundError=v.error;
var incr=shiftkey?-1:+1;
while(true){
i+=incr;
if(i<0)
i=_dtl.fieldToValidate.length-1;
else if(i>=_dtl.fieldToValidate.length)
i=0;
v=_dtl.fieldToValidate[i];
if(v.error){
if(v.id!=active_element.id)
e=document.getElementById(v.id);
break;
}
}
}
break;
}
}
}
break;
case ENTER:
if(active_element.type=="checkbox"){
active_element.checked=!active_element.checked;
detailSetCbxFlag(active_element);
return false;
}
if(typeof
active_element.onblur!="undefined"&&
active_element.onblur!=null&&
(active_element.type=="select-one"||
active_element.type=="text")){
active_element.onblur();
return false;
}
if(shiftkey)
return false;
break;
}
}
if(shiftkey){
switch(keycode){
case HOME:
if(typeof
active_element.type=="string"&&
(active_element.type=="text"||
active_element.type=="textarea"))
break;
case PAGE_UP:
detailTabOff(1);
return false;
case END:
if(typeof
active_element.type=="string"&&
(active_element.type=="text"||
active_element.type=="textarea"))
break;
case PAGE_DOWN:
detailTabOff(-1);
return false;
}
}
if(e!=null){
detailSetFocus(e);
return false;
}
}
return true;
}
function detailTabOff(direction)
{
if(typeof direction!="number"){
if((!_browser.isIE)||
window.event==null)
direction=1;
else
direction=(window.event.shiftKey?-1:1);
}
var e,startRow,startCol,endRow,endCol;
if(direction==1){
startRow=0;
startCol=0;
endRow=_dtl.rowNum;
endCol=_dtl.maxCol;
}
else{
startRow=_dtl.rowNum-1;
startCol=_dtl.maxCol-1;
endRow=-1;
endCol=-1;
}
for(var
row=startRow;row!=endRow;row+=direction){
for(var
col=startCol;col!=endCol;col+=direction){
e=document.getElementById("df_"+row+"_"+col);
if(e!=null){
var p=e.parentNode;
while(p!=null&&
(p.tagName!="DIV"||!p.id.match(/nbtab_\d+/)))
p=p.parentNode;
if(e.parentNode.style.display!="none"){
if(p==null||
p.style.display=="block"){
if(typeof ahdframeset.workframe!="object"||
typeof
ahdframeset.workframe.SkipInitialFocus=="undefined"||
ahdframeset.workframe.SkipInitialFocus!="1"){
setTimeout("try {
document.getElementById('"+e.id+
"').focus(); } catch(e) {}",0);
}
return true;
}
}
}
}
}
var evt=window.event;
/*
var outstr=" info: ";
if(evt.srcElement&&typeof
evt.srcElement.name!="undefined"){
outstr="name = ";
outstr+=evt.srcElement.name;
}
if(evt.srcElement&&typeof
evt.srcElement.id!="undefined"){
outstr+=" id = ";
outstr+=evt.srcElement.id;
}
*/
if(evt!=null)
{
if(evt.srcElement.name=="end"&&!evt.altKey){
e=document.getElementById("start");
if(typeof e!="undefined"){
e.focus();
}
}
}
return true;
}
function detailSetFocus(e)
{
if(typeof e=="object"&&
e!=null){
for(var
p=e.parentNode;p!=null;p=p.parentNode){
if(p.tagName=="DIV"&&
p.id.match(/nbtab_(\d+)/)){
var n=RegExp.$1-0;
show_tab_src(n,false);
break;
}
}
if(typeof ahdframeset.workframe!="object"||
typeof
ahdframeset.workframe.SkipInitialFocus=="undefined"||
ahdframeset.workframe.SkipInitialFocus!="1"){
setTimeout("try {
document.getElementById('"+e.id+
"').focus(); } catch(e) {}",0);
}
return;
}
if((typeof
ahdframeset.workframe!="object"||
typeof
ahdframeset.workframe.SkipInitialFocus=="undefined"||
ahdframeset.workframe.SkipInitialFocus!="1")&&
typeof detailFocus1st!="undefined"){
detailFocus1st();
}
}
function detailNoProperties(factory)
{
detailEndRow();
if(typeof
factory!="string"||factory.length==0)
factory=_dtl.factory;
var catg;
if(factory!="cr")
catg=msgtext(248);
else if(propIsITIL)
catg=msgtext(300);
else
catg=msgtext(249);
var row_id=get_exp_row_id("");
if(row_id!="")row_id=" ID='"+row_id+"' ";
var out="<TR"+row_id+"><TD COLSPAN=3
ALIGN=CENTER CLASS=labeltext>"+
msgtext(246,catg)+
"</TD></TR>";
docWriteln(out);
_dtl.propertyRow=_dtl.rowNum;
_dtl.propertyTabFirstIndex=_dtl.tabIndex;
_dtl.propertyTabIndex=_dtl.tabIndex;
}
function
detailWriteProperty(number,required,label,value,sample,type,options)
{
if(typeof _dtl.propertyRow=="undefined"){
_dtl.propertyRow=_dtl.rowNum;
_dtl.propertyTabFirstIndex=_dtl.tabIndex;
_dtl.propertyTabIndex=_dtl.tabIndex;
}
if(!_dtl.edit){
detailSetRowData(label);
_dtl.lastHdrtext=label;
detailSetReadonlyRowData(value);
}
else{
var checked="";
if(typeof type!="string")
{
type="TEXT";
}else
{
if(type=="CHECKBOX")
{
if(value.toLowerCase()=="yes")
{
checked=" checked='checked'";
}
value="Yes";
}
}
var hdrtext=label;
if(required!="1")
_dtl.colSpan[_dtl.colNum]="
CLASS="+_dtl.hdrclass;
else{
hdrtext+=ahdtop.cfgIndRequired;
_dtl.colSpan[_dtl.colNum]="
CLASS="+_dtl.reqhdrclass;
}
_dtl.rowData[_dtl.colNum++]=hdrtext;
_dtl.tabIndex=_dtl.propertyTabIndex;
var rowData;
if(typeof
type=="string"&&type=="SELECT")
{
var option_data=options.split("@,@");
var i;
rowData="<select "+detailNextID()+
" title=\""+hdrtext+"\""+
" name=SET.prop"+number+".value>";
for(i=1;i<option_data.length;i+=2)
{
rowData+="<option
value='"+option_data[i-1]+"'";
if(option_data[i-1]==value)
rowData+="selected ";
rowData+=">"+option_data[i]+"</option>";
}
rowData+="</select>";
}else
{
rowData="<input"+detailNextID()+"
TYPE='"+type+"'"+
" title=\""+hdrtext+'"'+
checked+" name=SET.prop"+number+".value "+
"size=50 "+
"value=\""+value.replace(rxQuote,""")+"\">";
}
_dtl.colSpan[_dtl.colNum]="";
detailSetRowData(rowData);
detailSetValidate(msgtext(251,label),required,240,"",true);
_dtl.propertyTabIndex=_dtl.tabIndex;
}
_dtl.colSpan[_dtl.colNum]="";
_dtl.lastHdrtext=msgtext(929,label);
detailSetReadonlyRowData(sample,void(0),_dtl.currID+"_sample");
_dtl.rowData[_dtl.colNum-1]+="</td></tr><tr>";
}
function detailMergeProperties(srcDtl)
{
var
tgt=document.getElementById("propertyDiv");
if(tgt==null||
typeof _dtl.propertyRow!="number"||
typeof srcDtl.propertyRow!="number"||
srcDtl.factory!="defer")
return;
var i,j;
var currPropCnt=0;
var propIndex=0;
var currValCnt=_dtl.fieldToValidate.length;
var propErrorFound=false;
for(i=currValCnt-1;i>=0;i--){
var v=_dtl.fieldToValidate[i];
if(v.id.match(/df_(\d+)_\d+/)){
row=RegExp.$1-0;
if(row==_dtl.propertyRow){
currPropCnt++
if(v.error)
propErrorFound=true;
}
else if(row<_dtl.propertyRow){
propIndex=i+1;
break;
}
}
}
if(propErrorFound)
detailValidate();
tgt.innerHTML=srcDtl.getHTMLText();
resetHTMLTextHold();
var
newPropCnt=srcDtl.fieldToValidate.length;
if(newPropCnt<currPropCnt){
for(i=propIndex+newPropCnt,j=propIndex+currPropCnt;
j<currValCnt;
i++,j++)
_dtl.fieldToValidate[i]=_dtl.fieldToValidate[j];
_dtl.fieldToValidate.length=currValCnt+newPropCnt-currPropCnt;
}
else if(newPropCnt>currPropCnt){
for(i=currValCnt+newPropCnt-currPropCnt-1,j=currValCnt-1;
i>=propIndex+newPropCnt;
i--,j--)
_dtl.fieldToValidate[i]=_dtl.fieldToValidate[j];
}
for(i=propIndex,j=0;j<newPropCnt;i++,j++)
_dtl.fieldToValidate[i]=srcDtl.fieldToValidate[j];
if(typeof
notebook_set_first_property=="function")
notebook_set_first_property(tgt,srcDtl.firstField);
}
function
detailSetValidate(hdrtext,is_required,maxsize,emsg,is_prop)
{
if(typeof is_required=="string")
is_required=parseInt(is_required,10);
if(typeof maxsize=="undefined")
maxsize=0;
else if(typeof maxsize=="string")
maxsize=parseInt(maxsize,10);
if(typeof emsg!="string")
emsg="";
if(is_required||maxsize>0||emsg.length>0){
var v=new Object();
v.id=_dtl.currID;
v.hdrtext=hdrtext;
v.maxsize=maxsize;
v.is_required=is_required;
v.serverFoundError=(emsg.length>0);
v.error=false;
v.extError=false;
v.browserFoundError=false;
v.is_property=(typeof
is_prop=="boolean"&&is_prop);
_dtl.fieldToValidate[_dtl.fieldToValidate.length]=v;
if(v.serverFoundError)
_dtl.serverErrorCount++;
return v;
}
return void(0);
}
function detailOK2Edit(attr_name,hdrtext)
{
if(_dtl.edit){
if(typeof
_dtl.editAttrs[attr_name]=="undefined"){
if(typeof
hdrtext!="string"||hdrtext.length==0)
hdrtext=attr_name;
_dtl.editAttrs[attr_name]=hdrtext;
if("nr"==propFactory&&typeof
ufam_restricted=="number"&&1==ufam_restricted){
var ahdtop=get_ahdtop();
if(typeof ahdtop=="object"){
if(ahdtop.cfgUfamAttributes.indexOf("
"+attr_name+" ")>=0){
return false;
}
}
}
return true;
}
showAlertMsg(msgtext(771,attr_name,hdrtext,
_dtl.editAttrs[attr_name]));
}
return false;
}
function detailSave(op)
{
if((ahdframe.currentAction==ACTN_LOADPROP||
ahdframe.currentAction==ACTN_CHK_ASSIGNEE)&&
typeof ahdframe.resumeAction=="undefined"){
if(typeof
op=="string"&&op.length>0)
ahdframe.resumeAction="detailSave('"+op+"')";
else
ahdframe.resumeAction="detailSave()";
return;
}
if(typeof preSaveTrigger=="function")
if(!preSaveTrigger())
return;
e=document.getElementById("alertmsgText");
if(e!=null)
e.innerHTML="";
var firstBadField=detailValidate();
if(_dtl.errorCount>_dtl.serverErrorCount)
detailSetFocus(firstBadField);
else{
if(_dtl.secondary){
if(propFormName2==propFactory){
var f=document.main_form;
if(typeof f.HTMPL!="object"){
ahdframeset.top_splash.next_persid=argPersistentID;
var htmpl=document.createElement("input");
htmpl.name="HTMPL";
htmpl.value="show_main_detail.htmpl";
f.appendChild(htmpl);
}
}
}
else{
var
edit_windows=getEditWindows(argPersistentID);
for(var i=0;i<edit_windows.length;i++){
var w=edit_windows[i];
if(typeof w._dtl=="object"){
firstBadField=w.detailValidate();
if(w._dtl.errorCount>w._dtl.serverErrorCount){
w.detailSetFocus(firstBadField);
return;
}
else
w.pdm_submit("main_form","UPDATE",void(0),true);
}
}
}
if(_dtl.backfillReq){
var f=document.main_form;
if(typeof f.HTMPL!="object"){
ahdframeset.top_splash.next_persid="backfill";
var htmpl=document.createElement("input");
htmpl.type="hidden";
htmpl.name="HTMPL";
htmpl.value="show_main_detail.htmpl";
f.appendChild(htmpl);
var arr=argPersistentID.split(":");
var is_contact=arr[0]=="agt"||
arr[0]=="cnt"||
arr[0]=="cst"||
arr[0]=="agtgrp"||
arr[0]=="grp";
if(is_contact)
{
var is_cnt=document.createElement("input");
is_cnt.type="hidden";
is_cnt.name="KEEP.is_contact";
is_cnt.value="1";
f.appendChild(is_cnt);
}
}
}
try{
if(typeof
top.opener.autoRefreshWindows=="object")
top.opener.autoRefreshWindows[parent.window.name]=true;
}
catch(e){}
if(typeof alg_factory=="string"&&
_dtl.factory!=alg_factory){
ahdtop.saveAckMsgNum=920;
ahdtop.saveAckMsgFactoryName=msgtext(936);
ahdtop.saveAckMsgObjectName="";
}
else{
if(_dtl.id==0)
ahdtop.saveAckMsgNum=920;
else
ahdtop.saveAckMsgNum=921;
ahdtop.saveAckMsgFactoryName=factoryDisplayName;
if(argCommonNameAttr=="id"||
argCommonNameAttr=="description"||
argCommonNameAttr=="text"||
argCommonNameAttr=="COMMENT_TEXT"||
argCommonNameAttr=="constraint_majic")
ahdtop.saveAckMsgObjectName="";
else
ahdtop.saveAckMsgObjectName=saveAckMsgObjectName;
}
if(typeof
op=="string"&&op.length>0)
pdm_submit('main_form',op,void(0),true);
else
pdm_submit('main_form','UPDATE',void(0),true);
}
}
function detailCancel()
{
if(ahdframe.currentAction==ACTN_LOADPROP&&
typeof ahdframe.resumeAction=="undefined"){
ahdframe.resumeAction="detailCancel()";
return;
}
detailResetSyncFields()
if(_dtl.secondary){
if(propFormName2==propFactory){
ahdframeset.top_splash.next_persid=argPersistentID;
_dtl.next_persid="show_main_detail.htmpl";
}
}
else{
var
edit_windows=getEditWindows(argPersistentID);
for(var i=0;i<edit_windows.length;i++){
var w=edit_windows[i];
if(w.ahdframeset==ahdtop){
w.ImgBtnDoCancel();
}
else{
w.ImgBtnDisableButton("btncncl");
w.parent.close();
}
}
}
cancel_update(_dtl.factory,_dtl.id,_dtl.next_persid,void(0),true);
}
function detailEdit()
{
if(!action_in_progress()){
set_action_in_progress(ACTN_LOADFORM);
var url=cfgCgi;
var dlm="?";
var f=document.main_form;
var element_count=f.elements.length;
for(var i=0;i<element_count;i++){
var e=f.elements[i];
url+=dlm+e.name+"="+escape(e.value);
dlm="+";
}
replace_page(url);
}
}
function
detailReportValidation(field,has_error,emsg)
{
var badField=null;
for(var
i=0;i<_dtl.fieldToValidate.length;i++){
var v=_dtl.fieldToValidate[i];
if(v.id==field.id){
if(has_error){
v.extError=true;
v.extErrorMsg=emsg;
badField=detailValidate();
}
else if(v.extError){
v.extError=false;
badField=detailValidate();
}
return badField;
}
}
if(has_error)
alert(emsg);
return badField;
}
function detailReset()
{
for(var
i=0;i<_dtl.fieldToValidate.length;i++){
var v=_dtl.fieldToValidate[i];
v.extError=false;
}
if(_dtl.edit&&_dtl.id!="0")
detailValidate();
try
{
if(typeof _dtl.firstField=="object")
_dtl.firstField.focus();
}
catch(e)
{
}
detailResetSyncFields()
if(propFactory=="USP_PREFERENCES")
{
if(typeof window_onload=="function")
{
window_onload();
}
}
}
function
detailValidate(display_alertmsg,popup_alertmsg)
{
if(typeof AlertMsg=="string")AlertMsg="";
if(typeof display_alertmsg=="undefined")
display_alertmsg=0;
_dtl.errorCount=0;
_dtl.serverErrorCount=0;
var e,v,firstBadField;
var
alertmsg=document.getElementById("alertmsg");
if(_dtl.fieldToValidate.length>0){
var msg="";
for(var
i=0;i<_dtl.fieldToValidate.length;i++){
v=_dtl.fieldToValidate[i];
e=document.getElementById(v.id);
var newmsg="";
v.error=false;
if(e!=null){
e.className="";
var val="";
if(e.type=="select-multiple")
{
for(var j=0;j<e.length;j++)
{
var e_val=e.options[j].value;
if(e_val.length>0)
{
val=e_val;
break;
}
}
}
else if(e.type!="select-one")
val=e.value;
else if(e.selectedIndex!=-1)
val=e.options[e.selectedIndex].value;
if(v.is_required&&
val.length==0)
newmsg=msgtext_with_pfx(250,v.hdrtext);
else if(v.maxsize>0&&
v.maxsize<val.length)
newmsg=msgtext_with_pfx(11,v.hdrtext,val.length,
v.maxsize);
else if(v.serverFoundError){
_dtl.serverErrorCount++;
newmsg="";
}
if(v.extError){
if(newmsg.length>0)
newmsg+="<BR>";
newmsg+=v.hdrtext+": "+v.extErrorMsg;
}
if(newmsg.length>0||v.serverFoundError){
e.className="errorField";
v.error=true;
v.browserFoundError=true;
_dtl.errorCount++;
if(typeof firstBadField!="object")
firstBadField=e;
if(msg.length==0)
msg=newmsg;
else
msg+="<BR>"+newmsg;
}
}
}
}
if(_dtl.errorCount==0&&!display_alertmsg){
if(alertmsg!=null){
alertmsg.style.display="none";
adjScrollDivHeight();
}
}
else
showAlertMsg(msg,popup_alertmsg);
if(typeof reshow_curr_tab!="undefined")
reshow_curr_tab();
return firstBadField;
}
function showAlertMsg(msg,popup_alertmsg)
{
e=document.getElementById("alertmsgText");
if(e!=null&&typeof
msg=="string"&&msg.length>0){
if(typeof AlertMsg!="string")
AlertMsg="";
if(AlertMsg.length>0)
AlertMsg+="<BR>"+msg;
else
AlertMsg=msg;
if(e.innerHTML!=AlertMsg){
e.innerHTML=AlertMsg;
if((ahdtop.cstUsingScreenReader||
ahdtop.cfgUserType!="analyst")&&
(typeof
popup_alertmsg!="boolean"||popup_alertmsg)){
var
popupMsg=AlertMsg.replace(RegExp("<BR>","gi"),"\\n")
.replace(RegExp('"',"g"),'\\"');
window.setTimeout('alert("'+popupMsg+'")',1);
}
}
var
alertmsg=document.getElementById("alertmsg");
if(alertmsg!=null&&
alertmsg.style.display!="block"){
alertmsg.style.display="block";
adjScrollDivHeight();
}
}
}
function call_event_handlers(e)
{
if(typeof e.onchange!="undefined"&&
e.onchange!=null)
e.onchange();
if(typeof e.onblur!="undefined"&&
e.onblur!=null)
e.onblur();
}
function
detailSyncEditForms(srcElement,isGroup)
{
if(!_dtl.syncing&&
typeof srcElement=="object"&&
typeof srcElement.type=="string"&&
typeof argPersistentID=="string"&&
argPersistentID.length>0){
_dtl.syncing=true;
var saveCurrVal=false;
if(typeof _dtl.fieldsToReset=="undefined"){
_dtl.fieldsToReset=new Object();
saveCurrVal=true;
}
else if(typeof
_dtl.fieldsToReset[srcElement.name]=="undefined")
saveCurrVal=true;
var newValue;
if(srcElement.type!="select-one")
newValue=srcElement.value;
else
newValue=srcElement.options[srcElement.selectedIndex].value;
if(srcElement.name.match(/^SET\.([^\.]+)$/)||
srcElement.name.match(/^(.+)_combo_name$/)){
var attr_name=RegExp.$1;
if(typeof top.opener=="object"&&
top.opener!=null&&
typeof top.opener._dtl=="object"){
var
attr_info=top.opener._dtl.lookupAttrs[attr_name];
if(typeof attr_info=="object"){
attr_info["newValueWindow"]=window;
if(srcElement.type!="select-one")
attr_info["newValue"]=newValue;
else
attr_info["newValue"]=
srcElement.options[srcElement.selectedIndex].text;
}
}
}
var
edit_windows=getEditWindows(argPersistentID);
for(var i=0;i<edit_windows.length;i++){
var w=edit_windows[i];
var f=w.document.main_form;
if(typeof f=="object"){
var tgtElement=f.elements[srcElement.name];
if(typeof
tgtElement=="object"&&tgtElement!=null){
if(tgtElement.type!="select-one"){
if(saveCurrVal){
_dtl.fieldsToReset[srcElement.name]=tgtElement.value;
saveCurrVal=false;
}
if(newValue==tgtElement.value)
break;
tgtElement.value=newValue;
}
else{
if(saveCurrVal){
_dtl.fieldsToReset[srcElement.name]=
tgtElement.options[tgtElement.selectedIndex].value;
saveCurrVal=false;
}
for(var k=tgtElement.length-1;k>=0;k--)
if(tgtElement.options[k].value==newValue)
break;
if(k<0||k==tgtElement.selectedIndex)
break;
tgtElement.selectedIndex=k;
}
if(typeof
isGroup=="boolean"&&isGroup&&
typeof w._dtl=="object"&&
typeof w._dtl.skip_agt_check=="boolean")
w._dtl.skip_agt_check=true;
call_event_handlers(tgtElement);
break;
}
}
}
_dtl.syncing=false;
}
}
function detailResetSyncFields()
{
if(typeof _dtl.fieldsToReset=="object"){
for(var name in _dtl.fieldsToReset){
var v=_dtl.fieldsToReset[name];
var e=document.main_form.elements[name];
if(typeof e=="object"&&e!=null){
if(e.type!="select-one")
e.value=v;
else for(var
i=e.options.length-1;i>=0;i--){
if(e.options[i].value==v){
e.selectedIndex=i;
break;
}
}
detailSyncEditForms(e);
}
}
_dtl.fieldsToReset=void(0);
}
}
function
detailHideElements(id,count,new_first_id)
{
count=2*count;
var e=document.getElementById(id);
var hiddenElements=new Array();
if(e!=null){
var td=e.parentNode;
var tr=td.parentNode;
var rows=tr.parentNode.childNodes;
var found=false;
for(var i=0;i<rows.length;i++){
if(tr==rows[i]){
for(var
col=0;col<tr.childNodes.length;col++){
if(tr.childNodes[col]==td){
found=true;
break;
}
}
break;
}
}
if(found){
for(;i>=0;i--){
if(typeof
rows[i].childNodes=="object"&&
rows[i].childNodes.length>col){
e=rows[i].childNodes[col];
hiddenElements[hiddenElements.length]=e;
e.style.display="none";
if(typeof _dtl.firstField!="object"||
_dtl.firstField==null||
typeof
_dtl.firstField.parentNode!="object"||
e==_dtl.firstField.parentNode)
if(typeof new_first_id=="string")
_dtl.firstField=document.getElementById(new_first_id);
count--;
if(count<=0)
break;
}
}
}
}
adjScrollDivHeight();
return hiddenElements;
}
function
backfill_cnt_event(form_name,base_name,lname,fname,mname,
cntID,caller_type)
{
detailCntBackfill(form_name,base_name,lname,fname,mname,
cntID,caller_type);
}
function
detailCntBackfill(form_name,base_name,lname,fname,mname,
cntID,caller_type)
{
var f=void(0);
var r=form_name.match(/main_form([0-9]*)/);
if(r!=null){
if(r[1].length==0)
f=_dtl.form[0];
else
f=_dtl.form[r[1]-0];
}
if(typeof f=="object"&&f!=null){
var
combo_name=f.elements[base_name+"_combo_name"];
if(typeof
combo_name!="object"||combo_name==null)
combo_name=f.elements[base_name];
if(typeof
combo_name=="object"||combo_name!=null){
if(_dtl.errorCount){
for(var
i=0;i<_dtl.fieldToValidate.length;i++){
var v=_dtl.fieldToValidate[i];
if(v.id==combo_name.id){
if(v.error&&v.is_required)
detailValidate();
}
}
}
if(typeof
caller_type!="string"||caller_type!="autofill")
combo_name.focus();
if(typeof top.opener=="object"&&
top.opener!=null&&
typeof top.opener._dtl=="object"){
var
attr_info=top.opener._dtl.lookupAttrs[base_name];
if(typeof attr_info=="object")
attr_info["newValue"]=combo_name.value;
}
}
}
}
function
backfill_event(form,field_name,value,
persid,rel_attr_val,caller_type)
{
var e=form.elements[field_name];
if(caller_type!="autofill"){
_dtl.lastKeycode=0;
e.focus();
}
if(field_name=="SET.category")
change_category_func(propFactory);
else if(field_name=="KEY.category"){
e=form.elements["SET.category"];
if(typeof e=="object"){
if(e.type=="text"||
e.type=="hidden")
e.value=rel_attr_val;
else if(e.type=="select-one"){
for(var i=0;i<e.length;i++){
var o=e.options[i];
if(o.value==value){
o.selected=1;
break;
}
}
}
}
change_category_func(propFactory);
}
if(field_name=="KEY.PRIMARY_INDEX")
{
var iStartPos;
while(true)
{
iStartPos=value.indexOf(">");
if(iStartPos==-1)
{
break;
}
else
{
value=value.substring(iStartPos+1,value.length);
}
}
form.elements["KEY.PRIMARY_INDEX"].value=value;
form.elements["SET.PRIMARY_INDEX"].value=rel_attr_val;
}
if(field_name.match(/^.*\.(\w+)$/)&&
typeof top.opener=="object"&&
top.opener!=null&&
typeof top.opener._dtl=="object"){
var
attr_info=top.opener._dtl.lookupAttrs[RegExp.$1];
if(typeof attr_info=="object")
attr_info["newValue"]=value;
}
}
function detailSwitchToEsc(typefld)
{
if(typeof
typefld=="object"&&typefld.value=="TR"){
typefld.value="ESC";
var h1=document.getElementsByTagName("h1");
for(var i=0;i<h1.length;i++)
h1[i].innerHTML=escalate_title;
if(typeof prioElements=="object"){
for(i=0;i<prioElements.length;i++)
prioElements[i].style.display="";
_dtl.firstField=document.getElementById(prio_id);
}
}
}
function
detailAgtCheck(f,base_name,cntID,prop_ref)
{
if(typeof prop_ref=="undefined")
prop_ref="";
if(base_name=="group"&&cntID!=""&&
typeof
f=="object"&&f!=null&&
typeof
f.elements["SET.assignee"]=="object")
{
var
agt_id=f.elements["SET.assignee"].value;
var
agt_name=f.elements["KEY.assignee"].value;
if(agt_id!=""||agt_name!=""){
set_action_in_progress(ACTN_CHK_ASSIGNEE);
upd_workframe("AGT_IN_GROUP","agt_id="+agt_id,
"agt_name="+agt_name,"group_id="+cntID,
"func=parent.ahdframe.clear_agt_callback",
"prop_ref="+prop_ref);
}
}
}
function
detailXferEscBackfill(base_name,lname,fname,mname,
cntID,caller_type)
{
var f=_dtl.form[0];
if(typeof
caller_type=="string"&&caller_type=="backfill"){
var
combo_name=f.elements[base_name+"_combo_name"];
if(typeof
combo_name=="object"||combo_name!=null)
detailSyncEditForms(e,(base_name=="group"));
}
detailAgtCheck(f,base_name,cntID);
if(caller_type=="autofill"){
var
e=document.main_form.elements[base_name+"_combo_name"];
if(typeof e=="object"&&e!=null)
detailSyncEditForms(e);
}
}
function clear_agt_callback(bClear)
{
if(bClear&&typeof
document.main_form!="undefined")
{
var f=document.main_form;
var key_fld=f.elements["KEY.assignee"];
var set_fld=f.elements["SET.assignee"];
var
combo_fld=f.elements["assignee_combo_name"];
if(typeof key_fld=="object")
key_fld.value="";
if(typeof set_fld=="object")
set_fld.value="";
if(typeof combo_fld=="object")
{
combo_fld.value="";
call_event_handlers(combo_fld);
}
}
set_action_in_progress(ACTN_COMPLETE);
}
function detailExtUpdate(in_args){
if(!_dtl.edit){
if(typeof refreshForm!="undefined"){
refreshForm();
}
return;
}
if(typeof in_args=="undefined")return;
var key,val;
for(key in in_args){
if(0==key.indexOf("KEY.")||0==key.indexOf("SET.")){
var overWrite=0;
var attr=key.slice(4);
var owKey="OW."+attr;
var owVal=in_args[owKey];
if("string"==typeof
owVal&&"1"==owVal){
overWrite="1";
}
val=in_args[key];
if("KEY.category"==key){
setEditElements("SET.category","",overWrite);
}
setEditElements(key,val,overWrite);
}
}
}
function
setEditElements(elementName,val,overWrite)
{
var attrPrefix="";
var plainAttrName="";
var input_el=null;
if(!_dtl.edit)return 0;
if(typeof document.main_form=="undefined")
return-1;
if(0==elementName.indexOf("KEY.")||0==elementName.indexOf("SET.")){
attrPrefix=elementName.slice(0,3);
plainAttrName=elementName.slice(4);
}else{
return-1;
}
input_el=document.main_form.elements[elementName];
if(typeof
input_el!="object"||input_el==null){
if("KEY"==attrPrefix){
input_el=document.main_form.elements["SET."+plainAttrName];
if(typeof
input_el!="object"||input_el==null||input_el.type!="select-one")
{
return-1;
}
}else{
return-1;
}
}
if(1!=overWrite){
var oldVal="";
if("select-one"==input_el.type){
oldVal=input_el.options[input_el.selectedIndex].value;
}else{
oldVal=input_el.value;
}
if(typeof
oldVal=="string"&&oldVal.length>0){
return 0;
}
}
if(input_el.type=="select-one"){
for(var
i=0;i<input_el.options.length;i++){
var candidate;
if("KEY"==attrPrefix){
candidate=input_el.options[i].text;
}else{
candidate=input_el.options[i].value;
}
if(candidate==val){
input_el.selectedIndex=i;
break;
}
}
}else{
val=val.replace(/'/g,"\'");
input_el.value=val;
}
if(typeof input_el.onblur=="function"){
input_el.onblur();
}
if(typeof input_el.onchange=="function"){
input_el.onchange();
}
return 1;
}
function detailCopyEditForm(exceptions)
{
var parent_win=ahdframeset.opener;
var from_f=parent_win.document.main_form;
var to_f=window.document.main_form;
if(typeof from_f=="object"&&
typeof to_f=="object")
{
var eles=from_f.elements;
var val;
for(var i=0;i<eles.length;i++)
{
var from_e=eles[i];
if(typeof from_e=="object"&&
from_e!=null&&
typeof from_e.name=="string"&&
from_e.name!=""&&
from_e.name!="FID"&&
from_e.name!="SID")
{
var j;
for(j=0;j<exceptions.length;j++)
{
if(from_e.name==exceptions[j])
break;
}
if(j<exceptions.length)continue;
var to_e=to_f.elements[from_e.name];
if(typeof to_e!="object"||to_e==null)
continue;
if(from_e.type=="select-one")
{
to_e.selectedIndex=from_e.selectedIndex;
}
else
if(from_e.type=="radio")
{
from_e=eles[from_e.name];
for(var k=0;k<from_e.length;k++)
{
to_e[k].checked=from_e[k].checked;
}
i+=(from_e.length-1);
}
else
{
to_e.value=from_e.value;
}
}
}
}
}
function
detailDropdownEdit(hdrtext,attr_name,obj_type,colspan,size,
is_required,persid,rel_attr,
autofill,common_name_attr,common_name_value,
search_status,search_results,link,
cbwidth,extraURL,dflt,selections)
{
var i,field_name;
common_name_value=unescape(common_name_value);
selections=unescape(selections);
rel_attr=unescape(rel_attr);
if(typeof
selections=="string"&&selections.length>0){
selections=selections.split("@,@");
for(i=18;i<arguments.length;i++)
selections[selections.length]=unescape(arguments[i]);
}
if(selections.length<=1){
detailLookupEdit(hdrtext,attr_name,obj_type,colspan,size,
is_required,persid,rel_attr,
autofill,common_name_attr,common_name_value,
search_status,search_results,"yes",extraURL);
return;
}
detailRowHdr(hdrtext,colspan,is_required);
if(attr_name.match(/^KEEP\./))
field_name=attr_name;
else
field_name="SET."+attr_name;
var
item='<select'+detailNextID(colspan);
if(typeof _dtl.fieldTitle!="string"||
_dtl.fieldTitle.length==0){
var titletext=hdrtext;
if(bool(is_required))
titletext+=ahdtop.cfgIndRequired;
item+=" title=\""+titletext+"\"";
}
else{
item+=" title=\""+_dtl.fieldTitle+"\"";
_dtl.fieldTitle=void(0);
}
if(cbwidth==0){
if(!_dtl.edit)
item+=" style='font-size:1.0em;'";
}
else if(_dtl.edit)
item+=" style='width:'"+cbwidth+"px;'";
else
item+=" style='font-size:0em;
width:'"+cbwidth+"px;'";
item+=' name="'+field_name+'">\n';
var options="";
if(!bool(is_required)||
(rel_attr.length==0&&dflt.length==0))
options+='<OPTION
VALUE=""><'+msgtext(1)+'>\n';
var curr_found=false;
for(i=1;i<selections.length;i+=2){
var sym=selections[i-1];
var code=selections[i];
if(code==rel_attr||
(sym==dflt&&
rel_attr.length==0&&
dflt.length>0)){
curr_found=true;
options+='<OPTION SELECTED
VALUE="'+code+'">'+sym+'\n';
}
else
options+='<OPTION
VALUE="'+code+'">'+sym+'\n';
}
if(!curr_found&&rel_attr.length>0){
if(common_name_value.length==0)
common_name_value="?";
options+='<OPTION SELECTED
VALUE="'+rel_attr+'">'+
common_name_value+'\n';
}
item+=options+'</SELECT>\n';
detailSetRowData(item);
detailSetValidate(hdrtext,is_required);
}
var exp_sec_arr=new Array();
function
exp_sec_node(form_name,init_state,exp_rows)
{
this.form_name=form_name;
this.down_id="exp_sec_down_id"+exp_sec_num;
this.up_id="exp_sec_up_id"+exp_sec_num;
this.state=init_state;
this.exp_sec_num=exp_sec_num;
this.exp_rows_obj=createExpandableRow(exp_rows);
this.adj_height=0;
exp_sec_arr[exp_sec_num]=this;
exp_sec_num++;
}
exp_sec_node.on_load_func=function()
{
var len=exp_sec_arr.length;
var cur;
for(var i=0;i<len;i++)
{
cur=exp_sec_arr[i];
if(cur.state=="up")
cur.show_rows(true);
else
if(cur.state=="down")
cur.hide_rows(true);
}
}
exp_sec_node.prototype.hide_rows=function(bLoad)
{
this.adj_height=0;
var len=this.exp_rows_obj.length;
for(var i=(len-1);i>=0;i--)
{
this.adj_height+=this.exp_rows_obj[i].hide_row();
}
if(typeof bLoad!="boolean"||
!bLoad)
reshow_curr_tab(this.adj_height);
}
exp_sec_node.prototype.show_rows=function(bLoad)
{
this.adj_height=0;
var len=this.exp_rows_obj.length;
for(var i=0;i<len;i++)
{
this.adj_height-=this.exp_rows_obj[i].show_row();
}
if(typeof bLoad!="boolean"||
!bLoad)
reshow_curr_tab(this.adj_height);
}
function exp_sec_clicked(idx)
{
if(idx>=exp_sec_arr.length||
typeof exp_sec_arr[idx]=="undefined")
{
alertmsg(646);
return;
}
var obj=exp_sec_arr[idx];
var
down_obj=document.getElementById(obj.down_id);
var
up_obj=document.getElementById(obj.up_id);
if(obj.state=="up")
{
down_obj.style.display="block";
up_obj.style.display="none";
obj.state="down";
obj.hide_rows();
}
else
if(obj.state=="down")
{
down_obj.style.display="none";
up_obj.style.display="block";
obj.state="up";
obj.show_rows();
}
ahdtop.set_expand_sec_state(obj.form_name,obj.exp_sec_num,obj.state);
}
function
detailExpandSec(form_name,label,exp_rows,colspan)
{
var
init_state=ahdtop.get_expand_sec_state(form_name,exp_sec_num);
var html="";
var node=new
exp_sec_node(form_name,init_state,exp_rows);
html+='<TR><TD
COLSPAN='+colspan+'><TABLE width="100%" border="0"
cellspacing="0" cellpadding="0"><TR>';
html+='<TD width="4" height="22"
class="page_section_header_left"><IMG
SRC="'+get_IMG_path("IMG_spacer")+
'" width="4" height="22"
alt=""></TD>';
html+='<TD
class="page_section_header_center"><SPAN
id="'+node.down_id+
'" class="page_section_header_text_hs"
style="display:';
if(init_state=="down")
html+='block" ';
else
html+='none" ';
html+='onClick="exp_sec_clicked('+node.exp_sec_num+')">'+
'<IMG
SRC="'+get_IMG_path("IMG_arrow_down")+'" width="14"
height="14" '+
'border="0" class="hide_show_button"
alt="'+msgtext(848)+'">'+label+'</SPAN>'+
'<SPAN class="page_section_header_text_hs"
id="'+node.up_id+'" style="display:';
if(init_state=="up")
html+='block" ';
else
html+='none" ';
html+='onClick="exp_sec_clicked('+node.exp_sec_num+')">'+
'<IMG SRC="'+get_IMG_path("IMG_arrow_up")+'"
width="14" height="14" '+
'border="0" class="hide_show_button"
alt="'+msgtext(849)+'">'+label+'</SPAN>'+
'</TD><TD width="4" height="22"
class="page_section_header_right">'+
'<IMG SRC="'+get_IMG_path("IMG_spacer")+'"
width="4" height="22"
alt=""></TD></TR></TABLE></TD></TR>';
_dtl.expSecHtml=html;
}
function add_response(i)
{
if(ahdframe.currentAction==0&&i>0)
{
var
url=cfgCgi+"?SID="+cfgSID+"+FID="+fid_generator()+
"+OP=PERSRESP_EXPAND+MSG_ID="+resp_ids[i]+
"+PERSID="+resp_persid+
"+CALLBACK=parent.ahdframe.add_response_callback";
display_new_page(url,ahdframeset.workframe);
set_action_in_progress(ACTN_AUTOFILL);
}
}
function add_response_callback(msg){
set_action_in_progress(0);
document.main_form.elements[resp_field].value+=unescape(msg);
}
function gblsd_ck_prefix(value)
{
var colon=/\:$/;
var result=value.match(colon);
if(result==null)alertmsg(651,value);
}
function gblsd_upcase(field)
{
field.value=field.value.toUpperCase();
}
function gblsd_set_global_name(v)
{
var
f=document.main_form.elements["SET.global_name"];
if(f.value.length==0)f.value=v.toUpperCase();
}
function gblsd_ck_master(cb,g)
{
var
f=document.main_form.elements["SET.is_master"];
if(cb.checked==true){
if(g!=""){
if(!confirm(msgtext(790,g))){
f.value=0;
cb.checked=false;
return;
}
}
f.value=1;
}else{
f.value=0;
}
return;
}
function detailValueOf(field_name)
{
var form=window.document.main_form;
if(typeof form=="undefined")
return"";
var obj=form.elements[field_name];
if(typeof obj=="undefined")
return"";
if(obj.type=="select-one")
return
obj.options[obj.selectedIndex].value;
else
return obj.value;
}
function loadFilterArray()
{
var attrs=propSearchConfig.split(",");
for(var i=0;i<attrs.length;i++)
{
if(attrs[i].substr(attrs[i].length-1,1)=="*"){
attrs[i]=attrs[i].substr(0,attrs[i].length-1);
}
var e=document.forms["main_form"].elements;
loadFilterArr[attrs[i]]="";
if(typeof
e["SET."+attrs[i]]!="undefined"&&e["SET."+attrs[i]].value.length>0)
{
loadFilterArr[attrs[i]]=e["SET."+attrs[i]].value;
}
if(typeof
e["KEY."+attrs[i]]!="undefined"&&e["KEY."+attrs[i]].value.length>0)
{
loadFilterArr[attrs[i]]=e["KEY."+attrs[i]].value;
}
if(attrs[i]=="priority"||attrs[i]=="severity"||attrs[i]=="impact"||attrs[i]=="urgency")
{
continue;
}else{
for(var j=0;j<e.length;j++)
{
if(typeof e[j].type=="string"&&
e[j].type=="select-one"&&
e[j].name.substr(0,4)=="SET."&&
e[j].value.length>0)
{
var attrlen=attrs[i].length;
if(e[j].name.substr(0,attrlen+4+1)=="SET."+attrs[i])
{
for(var k=0;k<e[j].length;k++)
{
if(e[j].options[k].selected==true)
{
loadFilterArr[attrs[i]]=e[j].options[k].text;
}
}
}
}
}
}
}
}
function srchknow(field)
{
if(typeof
document.main_form.elements[field]=="undefined"||
typeof
document.main_form.elements[field].value=="undefined"||
document.main_form.elements[field].value=="")
{
alertmsg(761);
return;
}
if(action_in_progress())
{
return;
}else{
set_action_in_progress(ACTN_SEARCH);
}
var idx=find_tab_by_src("SD_LAUNCHED");
if(idx!=null)
{
var tab_name=tab_name_by_id(idx);
var fac=argPersistentID.split(":");
if(fac[0]!='cr'&&fac[0]!='iss')
{
alert(msgtext(691,fac[0]));
return;
}
if(typeof _dtl=="object")
_dtl.doSrchKnow=1;
if((typeof
cur_selected!="undefined")&&
(cur_selected==idx))
{
var tab_obj=window.frames[tab_name];
if((typeof tab_obj=="object")&&
(typeof tab_obj.loadFilter!="undefined"))
{
tab_obj.loadFilter();
return;
}
}
show_tab_src(idx);
}else{
alertmsg(692);
}
}
function
getDetailElementProperty(elementId,propKey)
{
var propValue=this.propNotFound;
if(_dtl.fieldToValidate.length>0){
for(var
i=0;i<_dtl.fieldToValidate.length;i++){
if(_dtl.fieldToValidate[i].id==elementId){
var targetElement=_dtl.fieldToValidate[i];
if(typeof
targetElement[propKey]!="undefined")
propValue=targetElement[propKey];
break;
}
}
}
return propValue;
}
function detailValidateFileName(fld_obj)
{
if(typeof fld_obj=="undefined")
return true;
var val=fld_obj.value;
if(val.match(/[\\\/:\*\?"<>'\|^&,;+]/)!=null)
{
detailReportValidation(fld_obj,1,msgtext(765));
return false;
}
else
{
val=ltrim(val);
val=rtrim(val);
fld_obj.value=val;
detailReportValidation(fld_obj,0);
return true;
}
}
function ltrim(argvalue)
{
while(1)
{
if(argvalue.substring(0,1)!=" ")
break;
argvalue=argvalue.substring(1,argvalue.length);
}
return argvalue;
}
function rtrim(argvalue)
{
while(1)
{
if(argvalue.substring(argvalue.length-1,argvalue.length)!="
")
break;
argvalue=argvalue.substring(0,argvalue.length-1);
}
return argvalue;
}