var __GetTip_re=undefined;
function GetTip(_1,_2,_3){
if(_3==undefined){
_3=true;
}
var _4=undefined;
_4="";
switch(_2){
case "sTitle":
case "idBugTitleEdit":
_4=FB_ONE_LINE_DESC;
break;
case "ixPersonAssignedTo":
_4=FB_WHO_ASSIGNED_TO;
break;
case "ixCategory":
_4=FB_EXPLAIN_CATEGORY;
break;
case "hrsCurrEstNew":
_4=FB_ESTIMATING_TIPS;
break;
case "ixPriority":
_4=FB_RELATIVE_PRIORITY;
break;
case "ixFixFor":
_4=FB_EXPLAIN_FIXFOR;
break;
case "sVersion":
_4=g_config.sCustom1Help;
break;
case "sComputer":
_4=g_config.sCustom2Help;
break;
case "sMessage":
_4=FB_SCOUT_TITLE_NOVICE;
break;
case "fStopReporting":
_4=FB_SCOUT_WILL_TOOLTIP;
break;
case "sDueDate":
case "sDueTime":
_4=FB_DUE_HELP;
break;
case "sCustomerEmail":
_4=FB_EMAIL_REQUIRED_PUBLIC;
break;
case "sEventEdit":
if(_1=="new"){
_4=FB_NEW_NOTE;
}
break;
}
if(Len(_4)>0&&_3){
if(IsEmpty(__GetTip_re)){
__GetTip_re=new RegExp();
__GetTip_re.Global=true;
__GetTip_re.IgnoreCase=true;
__GetTip_re.Pattern="<[^>]*>";
}
_4=__GetTip_re.Replace(_4,"");
}
return _4;
}
var __GetTabIndex_rgNames=undefined;
function GetTabIndex(_5){
var _6=undefined;
_6="";
if(IsEmpty(__GetTabIndex_rgNames)){
__GetTabIndex_rgNames=["idBeforeFirst","sTitle","ixProject","ixArea","ixFixFor","ixCategory","ixPersonAssignedTo","ixStatus","sDuplicatesEdit","sFrom","sTo","sCC","sBCC","sSubject","sEventEdit","sEventReply","sEventForward","Button_SendAndCloseEmail","Button_SendEmail","Button_CancelEmail","Button_OKEdit","Button_CancelEdit","Button_ResolveAndClose","Button_Resolve","Button_CancelResolve","idAttachFile","ixPriority","sMessage","fStopReporting","sDueDate1","sDueDate2","sDueDate3","sDueDate4","hrsCurrEstNew","hrsElapsedExtraNew","sCustomerEmail","sVersion","sComputer","idAfterLast"];
}
var ix;
for(ix=LBound(__GetTabIndex_rgNames,undefined);ix<=UBound(__GetTabIndex_rgNames,undefined);ix++){
if(_5==__GetTabIndex_rgNames[ix]){
_6="tabindex='"+(ix+100)+"'";
return _6;
}
}
return _6;
}
function GetExtraAttributes(_8){
var _9=undefined;
switch(_8){
case "idBugTitleEdit":
_9=" maxlength='128' onkeypress='bUserTyped=true;'";
break;
case "sVersion":
_9=" maxlength='40'";
break;
case "sComputer":
_9=" maxlength='80'";
break;
}
return _9;
}
function BugViewFieldExplicit(_a,_b,_c,_d,_e){
if(Len(_e)>0){
var _f;
_f=!((Left(_e,Len("<div class=\"content"))=="<div class=\"content"));
grgHTML[grgHTML.length]=("<label for=\"")+(_a)+("\" title=\"")+(GetTip("edit",_a,undefined))+("\">")+(_c)+("</label>");
if(_f){
grgHTML[grgHTML.length]=("<div ")+(Iif(Len(_d)>0,"id=\""+_d+"\"",""))+(" class=\"content ")+(_b)+("\">");
}
grgHTML[grgHTML.length]=(_e);
if(_f){
grgHTML[grgHTML.length]=("</div>");
}
}
}
function BugViewFieldWithClassNoLabel(_10,sID,_12,_13,_14){
if(sID=="ixPersonAssignedTo"){
if(_10=="Resolve"){
_14=goBug.ixPersonOpenedBy;
}
var _15;
_15=new CPerson();
if(_15.Load(CLng(_14))&&_15.fDeleted){
var _16;
_16=new CProject();
if(_16.Load(goBug.ixProject)){
_14=_16.ixPersonOwner;
}
}
}
if(sID=="ixStatus"){
if(_10=="Active"){
_14=1;
_10="Disabled";
}
if(_10=="Edit"){
if(_14==1){
var cat;
cat=new CCategory();
cat.Load(goBug.ixCategory);
_14=cat.ixStatusDefault;
}
}
}
switch(_10){
case "View":
if(Len(_14)==0){
return;
}
switch(_13){
case "statusbar":
case "submitter":
case "subtitle":
_14=_14;
break;
default:
switch(sID){
case "ixPriority":
if(_14==-1){
_14=FB_VARIOUS;
}else{
_14=PriorityDisplayClean(UnicodeClean(_14),goBug.sPriority);
}
break;
default:
_14=UnicodeClean(_14);
break;
}
break;
}
grgHTML[grgHTML.length]=("<div class=\"content ")+(_13)+("\">")+(_14)+("</div>");
break;
case "Edit":
case "Resolve":
case "Disabled":
case "Reopen":
_13="bugEditing";
if(_10=="Disabled"||_10=="Resolve"){
_13=_13+"\" disabled=\"1";
}
var _18;
_18=(Left(sID,2)=="ix");
grgHTML[grgHTML.length]=("<div class=\"");
if(!(_18)||sID=="ixPriority"){
grgHTML[grgHTML.length]=("content ");
}
if(_18){
grgHTML[grgHTML.length]=("wrapper");
}
grgHTML[grgHTML.length]=("\" title=\"")+(GetTip("edit",sID,undefined))+("\">");
switch(sID){
case "ixProject":
DlgListOfProjects(2,CLng(_14),gfIsNewBug,"",gfMultipleBugs,_13,-1,0,GetTabIndex(sID));
break;
case "ixArea":
DlgListOfAreas(2,CLng(_14),gfIsNewBug,"",gfMultipleBugs,_13,-1,false,GetTabIndex(sID));
break;
case "ixCategory":
DlgListOfCategories(CLng(_14),"",gfMultipleBugs,_13,-1,GetTabIndex(sID));
break;
case "ixPersonAssignedTo":
DlgListOfNames("ixPersonAssignedTo",CLng(_14),FB_PRIMARY_CONTACT,_10!="Reopen"&&gfMultipleBugs,false,true,false,_13,-1,"",GetTabIndex(sID),undefined);
break;
case "ixFixFor":
var _19;
_19=0;
if(goViewMap["projectAndArea"]!="Edit"){
_19=goBug.ixProject;
}
DlgListOfFixFors(CLng(_14),"",gfMultipleBugs,false,_19,_13,-1,GetTabIndex(sID));
break;
case "ixStatus":
DlgListOfStatuses(goBug.ixCategory,CLng(_14),Iif(_10!="Edit"&&CLng(_14)<1,FB_VARIOUS,""),false,(_10=="Edit"),false,_13,-1,"",GetTabIndex(sID));
break;
case "ixPriority":
DlgListOfPriorities(CLng(_14),"",gfMultipleBugs,_13,-1,"",GetTabIndex(sID));
break;
default:
grgHTML[grgHTML.length]=("<input class=\"dlgText\" id=\"")+(sID)+("\" ")+(DisabledIfTrue(_10=="Disabled"))+(" name=\"")+(_12)+("\" ")+(GetExtraAttributes(sID))+(" ")+(GetTabIndex(_12))+(" value=\"")+(UnicodeClean(_14))+("\" />");
break;
}
grgHTML[grgHTML.length]=("</div>");
break;
case "Echo":
grgHTML[grgHTML.length]=(_14);
break;
case "None":
return;
break;
default:
grgHTML[grgHTML.length]=("<h1>Unknown sView:")+(_10)+("</h1>");
break;
}
}
function BugViewFieldWithClass(_1a,sID,_1c,_1d,_1e,_1f){
var s;
s=pictureOf(BugViewFieldWithClassNoLabel,_1a,sID,_1c,_1d,_1f);
if(Len(s)==0){
return;
}
switch(_1a){
case "View":
if(!((_1d=="title"||_1d=="subtitle"||_1d=="statusbar"))){
grgHTML[grgHTML.length]=("<label title=\"")+(GetTip("edit",sID,undefined))+("\">")+(_1e)+("</label>");
}
break;
case "Edit":
case "Resolve":
case "Disabled":
grgHTML[grgHTML.length]=("<label title=\"")+(GetTip("edit",sID,undefined))+("\" for=\"")+(sID)+("\">")+(_1e)+("</label>");
break;
default:
grgHTML[grgHTML.length]=("<label title=\"")+(GetTip("edit",sID,undefined))+("\" for=\"")+(sID)+("\">")+(_1e)+("</label>");
break;
}
grgHTML[grgHTML.length]=(s);
}
function BugViewFieldRowWithClass(_21,sID,_23,_24,_25,_26,_27){
if(_21=="None"){
return;
}
grgHTML[grgHTML.length]=("<div class=\"row")+(_25)+(Iif(sID=="ixCategory"," first",""))+("\">");
BugViewFieldWithClass(Iif(_21=="View","Disabled",_21),sID,_23,_24,_26,_27);
grgHTML[grgHTML.length]=("</div>");
}
var gfIsNewBug;
gfIsNewBug=false;
var gfMultipleBugs;
gfMultipleBugs=false;
var goViewMap;
var goBug;
function BugViewTopBar(_28,_29,_2a,_2b,_2c){
gfIsNewBug=QueryPageNew(_28);
gfMultipleBugs=_29;
goViewMap=_2b;
goBug=_2c;
var _2d;
_2d=Iif(gfIsNewBug,FB_NEW_BUG,_2c.sTitle);
var _2e;
_2e=true;
var _2f;
_2f=["idAndTitle","projectAndArea","category","personAssignedTo","status","fixFor"];
var ix;
for(ix=LBound(_2f,undefined);ix<=UBound(_2f,undefined);ix++){
var _31;
_31=_2b[_2f[ix]];
if(_31!="None"&&_31!="Reply"&&_31!="View"){
_2e=false;
}
}
grgHTML[grgHTML.length]=("<div class=\"ixBug")+(Iif(_28=="newemail"," ixBugNewEmail",""))+("\">");
if(!(_29)&&!(gfIsNewBug)){
if(IsNumeric(_2a)){
if(CLng(_2a)<1){
_2a="";
}
}
grgHTML[grgHTML.length]=("<div class=\"ixBug")+(Len(_2a))+("\"><a href=\"default.asp?")+(Iif(Len(sTicket)==0,_2a,sTicket))+("\">")+(_2a)+("</a></div>");
}else{
grgHTML[grgHTML.length]=("<div class=\"multiple\">&nbsp;</div>");
}
grgHTML[grgHTML.length]=("</div>");
if(_2e){
grgHTML[grgHTML.length]=("<div class=\"idTitleProjectAndArea\">");
BugViewFieldWithClass(_2b["idAndTitle"],"idBugTitleEdit","sTitle","title",FB_TITLE,_2c.sTitle);
var _32;
_32="%1: %2 <span class='fixfor'>| %3</span>";
BugViewFieldWithClass(_2b["projectAndArea"],"","","subtitle","",SwapN(_32,[UnicodeClean(_2c.sProject),UnicodeClean(_2c.sArea),Swap1(FB_GROUP_BUGS_FIXFOR,UnicodeClean(_2c.sFixFor))]));
var _33;
_33=(!(_2c.fOpen)||_28=="close");
grgHTML[grgHTML.length]=("<div id='statusbarspacer'>&nbsp;</div>");
_32="<span class='status'>%1&nbsp;%2</span> | %3 ";
if(_33){
_32="<span class='status'>%1&nbsp;%3</span>";
}
var _34;
_34=pictureOf(CategoryIcon,_2c.ixCategory,"leftalign");
var _35;
_35=Iif(_2c.ixPersonAssignedTo==0,FB_VARIOUS,GetPerson(_2c.ixPersonAssignedTo));
var s;
s=SwapN(_32,[_34,Swap1(FB_ASSIGNED_TO_PERSON,_35),UnicodeClean(StatusName(_2c.ixStatus,_33))]);
BugViewFieldWithClass(_2b["category"],"","","statusbar","",s);
grgHTML[grgHTML.length]=("</div>");
}else{
if(_28!="newemail"){
BugViewFieldRowWithClass(_2b["idAndTitle"],"idBugTitleEdit","sTitle","title",1,FB_TITLE,_2c.sTitle);
}
BugViewFieldRowWithClass(_2b["projectAndArea"],"ixProject","ixProject","subtitle",2,FB_PROJECT,_2c.ixProject);
BugViewFieldRowWithClass(_2b["projectAndArea"],"ixArea","ixArea","subtitle",2,FB_AREA,_2c.ixArea);
BugViewFieldRowWithClass(_2b["fixFor"],"ixFixFor","ixFixFor","",2,FB_FIX_FOR,_2c.ixFixFor);
BugViewFieldRowWithClass(_2b["category"],"ixCategory","ixCategory","",3,FB_CATEGORY,_2c.ixCategory);
BugViewFieldRowWithClass(_2b["personAssignedTo"],"ixPersonAssignedTo","ixPersonAssignedTo","",3,FB_ASSIGNED_TO,_2c.ixPersonAssignedTo);
BugViewFieldRowWithClass(_2b["status"],"ixStatus","ixStatus","",3,FB_STATUS,_2c.ixStatus);
if(_2b["duplicatesOf"]!="View"){
var _37;
_37=pictureOf(BugViewDuplicatesOfRow,_2b,_2a,undefined);
if(Len(_37)>0){
grgHTML[grgHTML.length]=("<span id=\"spanDuplicatesEdit\" >");
BugViewFieldRowWithClass("Echo","","","",4,"&nbsp;","&nbsp;");
BugViewFieldRowWithClass("Echo","","","",4,"&nbsp;","&nbsp;");
BugViewFieldRowWithClass("Echo","sDuplicatesEdit","sDuplicatesEdit","",4,FB_DUPLICATES_OF,_37);
grgHTML[grgHTML.length]=("</span>");
}
}
}
grgHTML[grgHTML.length]=("<div class=\"fixAlignment\">&nbsp;</div>");
}
function BugViewSideBar(_38,_39,_3a,_3b,_3c){
gfIsNewBug=QueryPageNew(_38);
gfMultipleBugs=_39;
goViewMap=_3b;
goBug=_3c;
grgHTML[grgHTML.length]=("<hr />");
BugViewFieldExplicit("","",Iif(IsNormalUser(undefined),FB_CORRESPONDENT,FB_EMAIL),"",pictureOf(BugViewCorrespondentInfo,_3b,_3c.sCustomerEmail));
BugViewFieldWithClass(_3b["priority"],"ixPriority","ixPriority","",FB_PRIORITY,_3c.ixPriority);
if(_3b["duplicatesOf"]=="View"){
var _3d;
_3d=pictureOf(BugViewDuplicatesOfRow,_3b,_3a,undefined);
if(Len(_3d)>0){
grgHTML[grgHTML.length]=("<span id=\"spanDuplicatesEdit\" >");
BugViewFieldExplicit("sDuplicatesEdit","",FB_DUPLICATES_OF,"",_3d);
grgHTML[grgHTML.length]=("</span>");
}
}
BugViewFieldExplicit("","",FB_DUPLICATES,"",pictureOf(BugViewDuplicatesRow,_3a));
BugViewBugScoutInfo(_3b["bugzScoutTitle"],_3a,undefined);
BugViewFieldExplicit("sDueDate","",FB_DUE,"dtRow",pictureOf(BugViewDueDateInfo,_3b["dueDate"],_3c.dtDue));
grgHTML[grgHTML.length]=("<span id=\"idEstimateBlock\">");
BugViewFieldExplicit("hrsCurrEstNew","",FB_ESTIMATE,"",pictureOf(BugViewEstimateInfo,_3b["estimate"],_3c.fEstLocked,_3c.hrsOrigEst,_3c.hrsCurrEst,_3c.hrsElapsed,_3c.hrsElapsedExtra,_3a));
grgHTML[grgHTML.length]=("</span>");
if(g_config.fCustom1Visible){
BugViewFieldWithClass(_3b["custom1"],"sVersion","sVersion","",g_config.sCustom1,_3c.sVersion);
}
if(g_config.fCustom2Visible){
BugViewFieldWithClass(_3b["custom2"],"sComputer","sComputer","",g_config.sCustom2,_3c.sComputer);
}
BugViewFieldExplicit("","",FB_DISCUSS,"",pictureOf(BugViewDiscussGroupInfo,_3c.ixDiscussTopic));
BugViewFieldExplicit("","",FB_SEE_ALSO,"",pictureOf(BugViewRelationInfo,_3a,undefined));
BugViewFieldExplicit("","",FB_RELEASE_NOTES,"",pictureOf(BugViewReleaseNotesLink,_3a,_3c.ixStatus,undefined));
if(_3b["cvs"]!="None"){
BugViewFieldExplicit("","",FB_CHECKINS,"",pictureOf(BugViewCVSInfo,_38,_3a));
}
grgHTML[grgHTML.length]=("<div class=\"block\">");
SubscribeLink(_38,_3a,true);
grgHTML[grgHTML.length]=("</div>");
if(!(QueryPageNew(_38))&&!(_39)){
grgHTML[grgHTML.length]=("<div class=\"block rss\">");
var _3e;
_3e=FB_CASE+" "+_3a;
var _3f;
_3f="default.asp?pg=pgRss&amp;ixBug="+_3a;
if(!(IsNormalUser(undefined))){
_3f=_3f+"&amp;sTicket="+sTicket;
}
RSSIcon(_3f,true,undefined,undefined,undefined);
grgHTML[grgHTML.length]=("<a href=\"")+(_3f)+("\">")+(FB_RSS_TITLE)+("</a>")+("</div>");
}
}
function BugViewEditableBugEvent(_40,_41,_42,_43,_44,_45,_46){
gfIsNewBug=QueryPageNew(_40);
gfMultipleBugs=_41;
goViewMap=_43;
goBug=_44;
if(_43["sEvent"]=="None"){
return;
}
var _47;
_47=_43["sTo"]!="None";
var _48;
_48=_43["sSubjectRow"];
if(_48=="None"||_48=="Email"){
_48="Edit";
}
var _49;
_49=(GetPersonName(GetPersonID()));
var _4a;
switch(_40){
case "new":
_4a=Swap2(FB_ACTION_BY,FB_ACTION_OPENED,_49);
break;
case "assign":
_4a=Swap2(FB_ACTION_BY,FB_ACTION_ASSIGNED,_49);
break;
case "resolve":
_4a=Swap2(FB_ACTION_BY,FB_ACTION_RESOLVED,_49);
break;
case "close":
_4a=Swap2(FB_ACTION_BY,FB_ACTION_CLOSED,_49);
break;
case "reopen":
_4a=Swap2(FB_ACTION_BY,FB_ACTION_REOPENED,_49);
break;
case "reactivate":
_4a=Swap2(FB_ACTION_BY,FB_ACTION_REACTIVATED,_49);
break;
case "reply":
_4a=Swap2(FB_ACTION_BY,FB_ACTION_REPLIED,_49);
break;
case "forward":
_4a=Swap2(FB_ACTION_BY,FB_ACTION_FORWARDED,_49);
break;
case "email":
_4a=Swap2(FB_ACTION_BY,FB_ACTION_EMAILED,_49);
break;
case "edit":
_4a=Swap2(FB_ACTION_BY,FB_ACTION_EDITED,_49);
break;
default:
_4a=Swap2(FB_ACTION_BY,FB_ACTION_EDITED,_49);
break;
}
grgHTML[grgHTML.length]=("<div class=\"bugevent\">")+("<div class=\"summary\"><span class=\"action\">")+(_4a)+("</span> <span class=\"date\"><a>")+(CTZsDateFromUTC(UTCNow()))+("</a></span></div>")+("<div class=\"body editable\">");
if(_43["submitButtons"]=="Email"){
var ev;
var sTo;
sTo="";
var sCC;
sCC="";
var _4e;
var _4f;
var _50;
_50="("+FB_CASE_InSiteLanguage()+" "+g_config.sCasePrefix+_44.ixBug+") "+_44.sTitle;
ev=goBug.LoadLastExternalEmailEvent();
_4f=ev.bEmail;
if(_4f){
sCC=ev.sCC;
_4e=ev.sReplyTo;
}else{
_4e=_44.sCustomerEmail;
}
switch(_43["sSubject"]){
case "Reply":
sTo=_4e;
_50=FB_RE+" "+_50;
break;
case "Forward":
_50=FB_FW+" "+_50;
sCC="";
break;
}
if("newemail"==_40){
_50=_44.sTitle;
}
grgHTML[grgHTML.length]=("<div class=\"emailHeader\">");
BugViewFromRow(_40,_44.sCustomerEmail,_44.ixMailbox);
BugViewEmailRow(_40,FB_TO,"sTo",sTo);
BugViewEmailRow(_40,FB_CC,"sCC",sCC);
BugViewEmailRow(_40,FB_BCC,"sBCC","");
BugViewEmailRow(_40,FB_SUBJECT,"sSubject",_50);
grgHTML[grgHTML.length]=("</div>");
}
grgHTML[grgHTML.length]=("<textarea class=\"bug\" name=\"sEvent\" id=\"sEvent")+(_48)+("\" title=\"")+(GetTip(_40,"sEventEdit",undefined))+("\" accesskey=\"0\" rows=\"8\" cols=\"55\" wrap=\"virtual\" style=\"border: 0px;\"");
grgHTML[grgHTML.length]=(GetTabIndex("sEvent"+_48));
if(g_fIE4){
if(IsNormalUser(undefined)){
grgHTML[grgHTML.length]=("onkeypress=\"handleSnippetTargetKeypress(this,event);\" ");
}
grgHTML[grgHTML.length]=("onkeyup=\"adjustRows(this); giveFocus();\" ")+("onfocus=\"adjustRows(this); giveFocus();\" ");
}
grgHTML[grgHTML.length]=(">");
BugViewEditableBugEventTextArea(_40,_48,_45,_50,_4f,_44,ev);
grgHTML[grgHTML.length]=("</textarea>")+("<div id=\"submitButtonsEdit\" class=\"footer\">");
BugViewEditButtons(_40,_43,_41,"");
if(!(_41)){
BugViewEditableBugEventAttachments(ev,_40,_4f,_46);
}else{
grgHTML[grgHTML.length]=("<div class=\"attach\"><div id=\"sFileEdit\">&nbsp;</div><div class=\"attachmentBlock\" id=\"files_list\"></div></div>");
}
grgHTML[grgHTML.length]=("<div class=\"fixAlignment\">&nbsp;</div>")+("</div>")+("</div>")+("</div>");
}
function BugViewEditableBugEventTextArea(_51,_52,_53,_54,_55,_56,ev){
BugViewEditableBugEventTextAreaUniversal(_51,_52,_53,_54,_55,_56,ev);
}
function BugViewEditableBugEventTextAreaUniversal(_58,_59,_5a,_5b,_5c,_5d,ev){
if(Len(_5a)>0){
grgHTML[grgHTML.length]=(_5a);
}else{
if(QueryPageEmail(LCase(_59))){
var m;
m=new CMailbox();
if(m.Load(_5d.ixMailbox)){
grgHTML[grgHTML.length]=(UnicodeCleanTextArea(ReplacePlaceHolders(m.sTemplate,_5d.sTicket,_5d.ixBug,_5d.sCustomerEmail,_5b,m.sFullName,m.sEmail)));
}
if(_5c){
if(LCase(_59)=="reply"){
grgHTML[grgHTML.length]=(vbCr+vbCr+vbCr+FB_EMAIL_ORIGINAL_MESSAGE+vbCr);
FormatTextAsTextEmail(ev,">");
}else{
if(LCase(_59)=="forward"){
grgHTML[grgHTML.length]=(vbCr+vbCr+vbCr+FB_EMAIL_FORWARDED_MESSAGE+vbCr);
FormatTextAsTextEmail(ev,"");
}
}
}
}
}
}
function GetReplyText(_60){
var _61=undefined;
var rg;
rg=Split(FB_EMAIL_ORIGINAL_MESSAGE_ALL,"|",undefined,undefined);
var ix;
for(ix=LBound(rg,undefined);ix<=UBound(rg,undefined);ix++){
var _64;
_64=rg[ix];
if(InStr(_60,_64,undefined)>0){
_60=Left(_60,InStr(_60,_64,undefined)-1);
}
}
_61=_60;
return _61;
}
function QuoteEmail(_65,_66){
var _67=undefined;
_67=_66+Replace(_65,vbLf,vbLf+_66,undefined,undefined);
return _67;
}
function FormatTextAsTextEmail(ev,_69){
grgHTML[grgHTML.length]=(FB_FROM+": "+UnicodeClean(ev.sFrom)+vbCrLf);
if(ev.sReplyTo!=""){
grgHTML[grgHTML.length]=(FB_REPLY_TO+": "+UnicodeClean(ev.sReplyTo)+vbCrLf);
}
if(ev.sDate!=""){
grgHTML[grgHTML.length]=(FB_DATE+": "+UnicodeClean(ev.sDate)+vbCrLf);
}
if(ev.sTo!=""){
grgHTML[grgHTML.length]=(FB_TO+": "+UnicodeClean(ev.sTo)+vbCrLf);
}
if(ev.sCC!=""){
grgHTML[grgHTML.length]=(FB_CC+": "+UnicodeClean(ev.sCC)+vbCrLf);
}
if(ev.sBCC!=""){
grgHTML[grgHTML.length]=(FB_BCC+": "+UnicodeClean(ev.sBCC)+vbCrLf);
}
grgHTML[grgHTML.length]=(FB_SUBJECT+": ");
grgHTML[grgHTML.length]=(UnicodeClean(ev.sSubject)+vbCr+vbCr);
if((Len(_69)>0)){
grgHTML[grgHTML.length]=(QuoteEmail(GetReplyText(ev.sBodyText),_69));
}else{
grgHTML[grgHTML.length]=(ev.sBodyText);
}
}
function FormatTextAsHTMLEmail(ev,_6b){
if(_6b){
grgHTML[grgHTML.length]=("<div align=\"right\" style=\"margin-bottom:7px;\">");
if(g_config.fDebug){
grgHTML[grgHTML.length]=("[<a href=\"default.asp?pg=pgDownload&amp;pgType=pgSorterTokens&amp;ixBugEvent=")+(ev.ixBugEvent)+("\" target=\"_blank\">Tokens</a>] ")+("[<a href=\"default.asp?pg=pgDownload&amp;pgType=pgSource&amp;ixBugEvent=")+(ev.ixBugEvent)+("\" target=\"_blank\">Source</a>]");
}
grgHTML[grgHTML.length]=("</div>");
}
grgHTML[grgHTML.length]=("<div class=\"email\">")+("<div class=\"emailHeader\">");
BugDetailMailHeader(FB_FROM,ev.sFrom);
BugDetailMailHeader(FB_REPLY_TO,ev.sReplyTo);
BugDetailMailHeader(FB_DATE,ev.sDate);
BugDetailMailHeader(FB_TO,ev.sTo);
BugDetailMailHeader(FB_CC,ev.sCC);
BugDetailMailHeader(FB_BCC,ev.sBCC);
BugDetailMailHeader(FB_SUBJECT,ev.sSubject);
grgHTML[grgHTML.length]=("</div>")+("<div class=\"emailBody\">");
if(_6b){
grgHTML[grgHTML.length]=(TranslateTextIntoLinksEmail(ev.ixBugEvent,ev.sBodyHtml,false));
grgHTML[grgHTML.length]=("<br />");
ShowAttachmentsByEmailEvent(ev,ShowAttachmentWarning,ShowOneAttachment,ShowInlineAttachment);
}else{
grgHTML[grgHTML.length]=("<span id=\"eventTextContainer\">");
grgHTML[grgHTML.length]=(ev.sBodyHTML);
grgHTML[grgHTML.length]=("</span>");
}
grgHTML[grgHTML.length]=("</div></div>");
}
function BugViewEditableBugEventAttachments(ev,_6d,_6e,_6f){
if(gfMultipleBugs){
return;
}
grgHTML[grgHTML.length]=("<div class=\"attach\">");
if(_6f<1){
grgHTML[grgHTML.length]=("<div id=\"sFileEdit\" style=\"")+(DisplayIfTrue("close"!=_6d))+(";\">")+("<a href=\"javascript: void 0;\" class=\"dotted\" id=\"idAttachFile\" onclick=\"clickAttach();\" ")+(GetTabIndex("idAttachFile"))+("><span id=\"attachText\">")+(FB_ATTACH_FILE)+("</span></a> <a href=\"javascript: void 0;\" onclick=\"clickAttach();\" style=\"text-decoration:none;\" tabindex=\"-1\"><img src=\"attachment.gif\" border=\"0\"></a>")+("</div>");
}else{
grgHTML[grgHTML.length]=("&nbsp;");
}
if(_6f>0){
grgHTML[grgHTML.length]=("<div class=\"fixAlignment\">&nbsp;</div>")+("<span style=\"display:block;\"><span class=\"dropShadow\">")+("<a href=\"default.asp?pg=pgDownload&amp;pgType=pgScreenshot&amp;ixScreenshot=")+(_6f)+("\" target=\"altfilewindow\" title=\"")+(FB_CLICK_FOR_FULL)+("\">")+("<img src=\"default.asp?pg=pgDownload&amp;pgType=pgScreenshot&amp;ixScreenshot=")+(_6f)+("\" border=\"0\" inline=\"yes\" />")+("</a>")+("</span></span>")+("<div class=\"fixAlignment\" style=\"clear: both;\">&nbsp;</div>");
}else{
grgHTML[grgHTML.length]=("<input id=\"omitAtt\" name=\"omitAtt\" type=\"hidden\" value=\"-1\" />");
if(_6d=="forward"){
grgHTML[grgHTML.length]=("<div id=\"attachAutoForward\">");
if(_6e){
ShowAttachmentsByEmailEvent(ev,function(){
var _70;
return _70;
},ShowForwardingAtt,ShowForwardingInline);
grgHTML[grgHTML.length]=("<input id=\"ixBugEventAttachmentForward\" type=\"hidden\" name=\"ixBugEventAttachment\" value=\"")+(ev.ixBugEvent)+("\" />");
}else{
grgHTML[grgHTML.length]=("<input id=\"ixBugEventAttachmentForward\" type=\"hidden\" name=\"ixBugEventAttachment\" />");
}
grgHTML[grgHTML.length]=("</div>");
}
FileInput(undefined);
}
grgHTML[grgHTML.length]=("</div>");
}
function BugViewCorrespondentInfo(_71,_72){
var o;
o=elById("sCustomerEmailInfo");
if(o){
grgHTML[grgHTML.length]=("<span id=\"sCustomerEmailInfo\">")+(o.innerHTML)+("</span>");
}
}
function BugViewReleaseNotesLink(_74,_75,_76){
if(_75==undefined){
_75=-1;
}
if(_76==undefined){
_76=false;
}
if(BugCount(_74)!=1||_75==1){
return;
}
if(_76){
goBug=new CBug();
goBug.Load(_74);
}else{
if(!(goBug.get_IsEditable())){
return;
}
}
var s;
s="";
var _78;
_78="";
if(IsNormalUser(undefined)){
_78=goBug.GetReleaseNotes();
var _79;
_79="[{'sId' : 'ixToEdit', 'sTag' : 'input', 'value' : "+goBug.ixBug+"},"+" {'sId' : 'pgToEdit', 'sTag' : 'input', 'value' : 'pgAlaCarteReleaseNoteLink'},"+" {'sId' : 'sReleaseNotesToEdit', 'sTag' : 'textarea', 'value' : '"+SingleQuoteForJavascript(UnicodeCleanTextArea(_78))+"'},"+" {'sId' : 'ixCase', 'sTag' : 'span', 'value' : '"+goBug.ixBug+"'},"+" {'sId' : 'sTitle', 'sTag' : 'span', 'value' : '"+SingleQuoteForJavascript(UnicodeClean(goBug.sTitle))+"'}]";
if(Len(_78)>0){
s=s+UnicodeClean(QuickSnip(_78,50));
s=s+"&nbsp;<a href=\"default.asp?pg=pgEditReleaseNotes&amp;pgBack=pgEditBug&amp;command=view&amp;ixBug="+_74+"\" id=\"idEditReleaseNotes\" onclick=\""+ShowEditPaneJS("ReleaseNotes",_79,undefined,undefined,undefined,undefined)+"\">";
s=s+EditIconOnly(FB_EDIT_RELEASE_NOTES);
s=s+"</a>";
}else{
s=s+"<a class=\"dotted\" href=\"default.asp?pg=pgEditReleaseNotes&amp;pgBack=pgEditBug&amp;command=view&amp;ixBug="+_74+"\" id=\"idEditReleaseNotes\" onclick=\""+ShowEditPaneJS("ReleaseNotes",_79,undefined,undefined,undefined,undefined)+"\"><nobr>"+FB_ADD_RELEASE_NOTES+"</nobr></a>";
}
}
if(Len(s)>0){
s="<span id='staticReleaseNotes'>"+s+"</span></span>";
if(!(_76)){
s="<span id='containerReleaseNotes'>"+s+"</span>";
}
}
grgHTML[grgHTML.length]=(s);
}
function BugViewDuplicatesRow(_7a){
var o;
o=elById("sDuplicatesInfo");
if(o){
grgHTML[grgHTML.length]=("<span id=\"sDuplicatesInfo\">")+(o.innerHTML)+("</span>");
}
}
function BugViewDuplicatesOfRow(_7c,_7d,_7e){
if(typeof (goDup)!="undefined"){
BugViewDuplicatesOfRowDraw(_7c,null,goDup.ixBug,goDup.fLoaded,goBug.ixBugEventLatest,goBug.ixBugEventLastView,false,false);
}else{
BugViewDuplicatesOfRowDraw(_7c,null,"",false,0,0,false,false);
}
}
function BugViewDuplicatesOfRowDraw(_7f,_80,_81,_82,_83,_84,_85,_86){
if(_86){
if(_82){
grgHTML[grgHTML.length]=("{fLoaded:true,ixBug:")+(_80.ixBug)+(",ixBugEventLatest:")+(_80.ixBugEventLatest)+(",ixBugEventLastView:")+(_80.ixBugEventLastView)+("}");
}else{
grgHTML[grgHTML.length]=("{fLoaded:false,ixBug:")+(_80.ixBug)+("}");
}
return;
}
if((_81==-1||_81=="")&&_7f["duplicatesOf"]!="Resolve"){
return;
}
if(_7f["duplicatesOf"]=="Edit"||_7f["duplicatesOf"]=="Resolve"){
var _87;
_87=_81;
if(_81==-1){
_87="";
}
grgHTML[grgHTML.length]=("<input type=\"text\" name=\"sDuplicates\" id=\"sDuplicatesEdit\" class=\"bugEditing dlgText\" ")+(GetTabIndex("sDuplicatesEdit"))+(" value=\"")+(_87)+("\" />");
}else{
if(_81>0){
if(_82){
grgHTML[grgHTML.length]=(BugLink("default.asp?"+_81,_81,_81,_83,_84,undefined));
}else{
grgHTML[grgHTML.length]=(_81);
}
}else{
return;
}
}
grgHTML[grgHTML.length]=("<script language=\"JavaScript\" type=\"text/javascript\"> ");
if(_85){
if(_82){
grgHTML[grgHTML.length]=("var goDup = {fLoaded:true,ixBug:")+(_80.ixBug)+(",ixBugEventLatest:")+(_80.ixBugEventLatest)+(",ixBugEventLastView:")+(_80.ixBugEventLastView)+("}; ");
}else{
grgHTML[grgHTML.length]=("var goDup = {fLoaded:false,ixBug:")+(_80.ixBug)+("}; ");
}
}
grgHTML[grgHTML.length]=(" statusChange(); </script>");
}
function BugViewCVSInfo(_88,_89){
var o;
o=elById("cvsinfo");
if(o){
grgHTML[grgHTML.length]=("<span id=\"cvsinfo\">")+(o.innerHTML)+("</span>");
}
}
function BugViewBugScoutInfo(_8b,_8c,_8d){
if(!(typeof (goScout)!="undefined")){
return;
}
BugViewBugScountDraw(_8b,goScout.sMessage,goScout.bReportingMixed,goScout.fStopReporting,false);
}
function BugViewBugScountDraw(_8e,_8f,_90,_91,_92){
var _93;
_93=UnicodeClean(_8f);
if(_8e=="Edit"){
_93="<input id='sMessage' name='sMessage' maxlength='255' class='bugEditing dlgText' "+GetTabIndex("sMessage")+" value=\""+_93+"\" />";
}
var _94;
if(_8e=="View"){
if(_90){
_94=FB_VARIOUS;
}else{
if(_91){
_94=FB_STOP_REPORTS;
}else{
_94=FB_CONTINUE_REPORTS;
}
}
}else{
if(_8e=="Edit"){
_94="<select id='fStopReporting' name='fStopReporting' class='bugEditing' "+GetTabIndex("fStopReporting")+">";
if(_90){
_94=_94+"<option value=''>%1</option><option value='0'>%2</option><option value='1'>%3</option>";
}else{
_94=_94+"<option value='0' "+SelectedIfSame(_91,false)+">%2</option>";
_94=_94+"<option value='1' "+SelectedIfSame(_91,true)+">%3</option>";
}
_94=_94+"</select>";
_94=Swap3(_94,FB_VARIOUS,FB_CONTINUE_REPORTS,FB_STOP_REPORTS);
}
}
BugViewFieldExplicit("","",FB_NUMBER_OF_OCCURRENCES,"",goBug.c+1);
BugViewFieldExplicit("sMessage","sMessage",FB_SCOUT_MESSAGE,"",_93);
BugViewFieldExplicit("fStopReporting","fStopReporting",FB_SCOUT_WILL,"",_94);
if(_92){
BugViewBugScountDrawExtra(_8e,_8f,_90,_91,_92,false);
}
}
function BugViewBugScountDrawExtra(_95,_96,_97,_98,_99,_9a){
}
function BugViewDueDateInfo(_9b,_9c){
var _9d;
_9d="";
var _9e;
_9e="";
if(!(IsNull(_9c))){
_9d=_9c;
_9e=_9c;
}
if(_9b=="View"){
if(Len(_9d)==0){
return;
}
grgHTML[grgHTML.length]=(CTZsDateFromUTC(_9d));
}else{
if(_9b=="Edit"){
ShowCalendar("sDueDate","sDueTime",_9d,false,"bugEditing","",false,GetTabIndex("sDueDate1"),GetTabIndex("sDueDate2"));
grgHTML[grgHTML.length]=("<br />");
ShowTime("sDueTime",_9e,"bugEditing",false,GetTabIndex("sDueDate3"),GetTabIndex("sDueDate4"));
}
}
}
function BugViewDiscussGroupInfo(_9f){
var o;
o=elById("sDiscussGroupInfo");
if(o){
grgHTML[grgHTML.length]=("<span id=\"sDiscussGroupInfo\">")+(o.innerHTML)+("</span>");
}
}
function BugViewRelationInfo(_a1){
var o;
o=elById("sBugRelationInfo");
if(o){
grgHTML[grgHTML.length]=("<span id=\"sBugRelationInfo\">")+(o.innerHTML)+("</span>");
}
}
function BugViewEstimateInfo(_a3,_a4,_a5,_a6,_a7,_a8,_a9){
if(gfMultipleBugs){
return;
}
if(_a3=="View"){
if(0==_a5&&0==_a6){
return;
}
if(_a4){
BugViewEstimateHourRow(FB_ORIGINAL,_a5,undefined,undefined);
BugViewEstimateHourRow(FB_CURRENT,_a6,undefined,undefined);
if(_a7==_a8){
BugViewEstimateHourRow(FB_ELAPSED,_a8,undefined,undefined);
}else{
if(_a8==0){
BugViewElapsedHourRow(_a7,_a9,undefined);
}else{
BugViewEstimateHourRow(FB_ELAPSED,_a7,undefined,undefined);
grgHTML[grgHTML.length]=("<div style=\"margin-left:1em;\">");
BugViewElapsedHourRow(_a7-_a8,_a9,FB_TIMESHEET_ELAPSED);
BugViewEstimateHourRow(FB_OTHER_ELAPSED,_a8,undefined,undefined);
grgHTML[grgHTML.length]=("</div>");
}
}
BugViewRemainingHourRow(_a6,_a7);
}else{
grgHTML[grgHTML.length]=(SFromHoursOrBlank(_a6,undefined))+("<br />");
}
}else{
if(_a3=="Edit"){
if(_a4){
BugViewEstimateHourRow(FB_ORIGINAL,_a5,undefined,undefined);
BugViewCurrentEdit(_a6);
if(_a7==_a8){
BugViewElapsedEdit(FB_ELAPSED,_a8);
}else{
var _aa;
_aa=_a8>0;
BugViewEstimateHourRow(FB_ELAPSED,_a7,Iif(_aa,"","default.asp?pg=pgBugTimesheet&amp;ixBug="+_a9),Iif(_aa,"","toggleVisibleById('idEstimateDetails'); return false;"));
grgHTML[grgHTML.length]=("<div style=\"display:")+(Iif(_aa,"","none"))+("; margin-left:1em;\" id=\"idEstimateDetails\">");
BugViewElapsedHourRow(_a7-_a8,_a9,FB_TIMESHEET_ELAPSED);
BugViewElapsedEdit(FB_OTHER_ELAPSED,_a8);
grgHTML[grgHTML.length]=("</div>");
}
BugViewRemainingHourRow(_a6,_a7);
}else{
BugViewCurrentEdit(_a6);
if(_a6>0){
BugViewElapsedEdit(FB_ELAPSED,_a8);
}
}
}
}
}
function BugViewCurrentEdit(_ab){
BugViewEditHrs(FB_CURRENT,"hrsCurrEst",_ab);
}
function BugViewElapsedEdit(_ac,_ad){
BugViewEditHrs(_ac,"hrsElapsedExtra",_ad);
}
function BugViewEditHrs(_ae,sId,hrs){
var _b1;
_b1=sId+"New";
grgHTML[grgHTML.length]=(_ae)+(": <input type=\"text\" maxlength=\"40\" name=\"")+(_b1)+("\" id=\"")+(_b1)+("\" class=\"bugEditing dlgText\" ")+(GetTabIndex(_b1))+(" value=\"")+(SFromHoursOrBlank(hrs,undefined))+("\" /><br />");
}
function BugViewElapsedHourRow(_b2,_b3,_b4){
if(_b4==undefined){
_b4=FB_ELAPSED;
}
if(_b2>0){
BugViewEstimateHourRow(_b4,_b2,"default.asp?pg=pgBugTimesheet&amp;ixBug="+_b3,"return requestBugTimesheet("+_b3+");");
}else{
BugViewEstimateHourRow(_b4,_b2,undefined,undefined);
}
}
function BugViewRemainingHourRow(_b5,_b6){
BugViewEstimateHourRow(FB_REMAIN,Max(0,_b5-_b6),undefined,undefined);
}
function BugViewEstimateHourRow(_b7,hrs,_b9,sJS){
if(_b9==undefined){
_b9="";
}
if(sJS==undefined){
sJS="";
}
var _bb;
_bb=SFromHours(hrs,true);
var _bc;
_bc=SFromHours(hrs,false);
var _bd;
_bd=AttrIfNotBlank("href",_b9)+AttrIfNotBlank("onclick",sJS);
var _be;
_be=Iif(_bd!="","class='dotted'","");
if(_bb!=_bc){
grgHTML[grgHTML.length]=("<a ")+(_bd)+(" ")+(_be)+(" title='")+(_bc)+("'>")+(_b7)+(": <nobr>")+(_bb)+("</nobr></a><br />");
}else{
grgHTML[grgHTML.length]=("<a ")+(_bd)+(" ")+(_be)+(">")+(_b7)+(": <nobr>")+(_bb)+("</nobr></a><br />");
}
}
function BugViewFromRow(_bf,_c0,_c1){
grgHTML[grgHTML.length]=("<div class=\"emailHeaderName\"><label for=\"sFrom\">")+(FB_FROM)+(":</label></div>")+("<div class=\"emailHeaderValue\"><select name=\"sFrom\" id=\"sFrom\" class=\"bugEditing\" ")+(GetTabIndex("sFrom"))+(" >");
var rs;
rs=BugViewFromRowSource();
var cp;
cp=GetMe();
var _c4;
var _c5;
var _c6;
var _c7;
_c7=false;
if(Len(GlobalRequest("sFrom"))>0){
_c7=true;
}
while(!(rs.get_EOF())){
if(_c6!=rs["sEmail"]||_c1==rs["ixMailbox"]){
if(GetSecurityToken().Assert(ACL_PROJECT,rs["ixProject"],ACL_PERMISSION_WRITE)||_c1==rs["ixMailbox"]){
_c4="\""+rs["sFullName"]+"\" <"+rs["sEmail"]+">";
_c5="\""+cp.sFullName+"\" <"+rs["sEmail"]+">";
grgHTML[grgHTML.length]=("<option value=\"")+(UnicodeClean(_c4))+("\" ");
if(_c7){
grgHTML[grgHTML.length]=(SelectedIfSame(GlobalRequest("sFrom"),_c4));
}else{
grgHTML[grgHTML.length]=(SelectedIfSame(rs["ixMailbox"],_c1));
}
grgHTML[grgHTML.length]=(">")+(UnicodeClean(_c4))+("</option>");
if(_c4!=_c5){
grgHTML[grgHTML.length]=("<option value=\"")+(UnicodeClean(_c5))+("\" ");
if(_c7){
grgHTML[grgHTML.length]=(SelectedIfSame(GlobalRequest("sFrom"),_c5));
}
grgHTML[grgHTML.length]=(">")+(UnicodeClean(_c5))+("</option>");
}
_c6=rs["sEmail"];
}
}
rs.MoveNext();
}
CloseRS(rs);
if(_bf=="forward"){
grgHTML[grgHTML.length]=("<option value=\"")+(UnicodeClean(_c0))+("\">")+(UnicodeClean(FB_CORRESPONDENT+" ("+_c0+")"))+("</option>");
}
grgHTML[grgHTML.length]=("</select><script>DLCL();</script></div>");
}
function GlobalRequest(s){
var _c9=undefined;
_c9="";
return _c9;
}
function BugViewFromRowSource(){
var _ca=undefined;
_ca=new RecordSet(DB.Mailbox,undefined);
return _ca;
}
function BugViewEmailRow(_cb,_cc,_cd,_ce){
if(Len(GlobalRequest(_cd))>0){
_ce=GlobalRequest(_cd);
}
grgHTML[grgHTML.length]=("<div class=\"emailHeaderName\"><label for=\"")+(_cd)+("\">")+(_cc)+(":</label></div>")+("<div class=\"emailHeaderValue\"><input type=\"text\" name=\"")+(_cd)+("\" id=\"")+(_cd)+("\" class=\"bugEditing dlgText\" ")+(GetTabIndex(_cd))+(" value=\"")+(UnicodeClean(_ce))+("\" /></div>");
}
function BugViewActionButtons(_cf,_d0,_d1,_d2,_d3,_d4,_d5){
goBug=_d3;
if(BugCount(_d2)==1&&_cf!="view"&&IsNormalUser(undefined)){
grgHTML[grgHTML.length]=("<div class=\"nextprev\">");
FavoriteToggleIcon("Bug",_d2,undefined,undefined,"star"+Iif(_d5=="Top",0,1));
grgHTML[grgHTML.length]=("</div>");
}
if(BugCount(_d2)==1&&_cf=="view"&&IsNormalUser(undefined)){
grgHTML[grgHTML.length]=("<div class=\"nextprev\">");
FavoriteToggleIcon("Bug",_d2,undefined,undefined,"star"+Iif(_d5=="Top",0,1));
grgHTML[grgHTML.length]=("&nbsp;");
if(IsInRelativeList(SEARCH_TYPE_BUG,CLng(_d2))){
grgHTML[grgHTML.length]=("<a href=\"default.asp?pg=pgEditBug&amp;command=viewPrevious&amp;ixBug=")+(_d2)+("\" id=\"viewPrevious")+(_d5)+("\" class=\"nextPrev\" onclick=\"return goToRelativeBug('")+(_d2)+("', 'viewPrevious');\" title=\"")+(FB_PREVIOUS_BUG_TIP)+("\"><img src=\"leftArrow.gif\" border=\"0\" alt=\"\" /></a>")+("<a href=\"default.asp?pg=pgEditBug&amp;command=viewNext&amp;ixBug=")+(_d2)+("\" id=\"viewNext")+(_d5)+("\" class=\"nextPrev\" onclick=\"return goToRelativeBug('")+(_d2)+("', 'viewNext');\" title=\"")+(FB_NEXT_BUG_TIP)+("\"><img src=\"rightArrow.gif\" border=\"0\" alt=\"\" /></a>");
}
MakeClientInfoAvailableForRelativeList(_d2);
grgHTML[grgHTML.length]=("&nbsp;")+("</div>");
}
grgHTML[grgHTML.length]=("<div class=\"buttons\">");
if(_d0["actionButtons"]=="View"&&_d4){
BugViewActionButtonsContent(_d2,_d3.fOpen,_d3.ixStatus,Iif(_d5=="Top",0,1));
}else{
grgHTML[grgHTML.length]=("&nbsp;");
}
grgHTML[grgHTML.length]=("</div>");
}
function BugViewEditButtons(_d6,_d7,_d8,_d9){
if(!(goBug.get_IsEditable())){
grgHTML[grgHTML.length]=("&nbsp;");
return;
}
var _da;
_da="return clickBugSubmit(event, this.form, "+IntFromBool(!(_d8)&&!(QueryPageNew(_d6)))+", this.value, true);";
var _db;
_db="return clickBugSubmit(event, this.form, "+IntFromBool(!(_d8)&&!(QueryPageNew(_d6)))+", this.value, false);";
switch(_d7["submitButtons"]){
case "Email":
BugViewEditButton("Button_SendAndCloseEmail"+_d9,UnicodeClean(FB_SEND_CLOSE),_da);
BugViewEditButton("Button_SendEmail"+_d9,FB_SEND,_da);
BugViewEditButton("Button_CancelEmail"+_d9,FB_CANCEL,_db);
break;
case "Edit":
BugViewEditButton("Button_OKEdit"+_d9,FB_OK,_da);
BugViewEditButton("Button_CancelEdit"+_d9,FB_CANCEL,_db);
break;
case "Resolve":
if(goBug.ixPersonOpenedBy==GetPersonID()||IsVirtualUser(goBug.ixPersonOpenedBy)||IsCommunityUser(goBug.ixPersonOpenedBy)){
BugViewEditButton("Button_ResolveAndClose"+_d9,UnicodeClean(FB_RESOLVE_CLOSE),_da);
}
BugViewEditButton("Button_Resolve"+_d9,FB_RESOLVE,_da);
BugViewEditButton("Button_CancelResolve"+_d9,FB_CANCEL,_db);
break;
}
}
function BugViewEditButton(sID,_dd,_de){
var _df;
_df=(Len(_dd)>9);
grgHTML[grgHTML.length]=("<input class=\"actionButton2 dlgButton")+(Iif(_df," dlgButtonWide",""))+("\" type=\"submit\" id=\"")+(sID)+("\" name=\"OK\" value=\"")+(_dd)+("\" ")+(GetTabIndex(sID))+(" onClick=\"")+(_de)+("\"/>");
}
function BugViewActionButtonsContent(_e0,_e1,_e2,_e3){
var _e4;
_e4="default.asp?pg=pgEditBug&amp;ixBug="+_e0+"&amp;command=";
var _e5;
_e5=goBug.ixBugEventLatest;
var _e6;
_e6=CanSendEmail();
var _e7;
_e7=goBug.IsEmail();
var _e8;
_e8=goBug.ixCategory==3&&goBug.IsOriginalInquiry();
var _e9;
_e9=Split(_e0,",",undefined,undefined);
var _ea;
_ea=BugCount(_e0)>1;
var c;
c=goBug;
var _ec;
_ec=_e6;
if(!(_e6)&&_e7&&!(c==null)){
var _ed;
_ed=new CMailbox();
_ec=_ed.Load(c.ixMailbox);
}
if(_e1){
if(_e8){
BugViewActionButton("spam",FB_SPAM,_e0,_e5,_e3,true,true);
}
BugViewActionButton("edit",FB_EDIT,_e0,_e5,_e3,true,true);
BugViewAssignButton(_e0,_e5,_e3);
if(_ec){
if(!(_ea)&&_e7&&!(c==null)&&g_config.sSMTPServer!="NONE"){
BugViewActionButton("reply",FB_REPLY,_e0,_e5,_e3,true,(c.ixPersonAssignedTo==GetPersonID()));
}
}
if(_e6){
if(!(_ea)&&_e7&&!(c==null)){
BugViewActionButton("forward",FB_FORWARD,_e0,_e5,_e3,true,true);
}else{
BugViewActionButton("email",FB_EMAIL,_e0,_e5,_e3,true,true);
}
}
BugViewActionButton("resolve",FB_RESOLVE,_e0,_e5,_e3,true,true);
if(_e2!=1){
BugViewActionButton("reactivate",FB_REACTIVATE,_e0,_e5,_e3,true,true);
BugViewActionButton("close",FB_CLOSE,_e0,_e5,_e3,true,true);
}
}else{
BugViewActionButton("editClosed",FB_EDIT,_e0,_e5,_e3,true,true);
BugViewActionButton("reopen",FB_REOPEN,_e0,_e5,_e3,true,true);
}
}
function BugViewActionButton(_ee,_ef,_f0,_f1,_f2,_f3,_f4){
var _f5;
_f5="default.asp?pg=pgEditBug&amp;ixBug="+_f0+"&amp;command="+_ee;
if(Len(_f1)>0){
_f5=_f5+"&amp;ixBugEventLatest="+_f1;
}
var _f6;
_f6="return true;";
var _f7;
_f7="TabManager.preRenderView('"+_ee+"');";
if(_f4){
_f6="return TabManager.clickChangeView(event, '"+_ee+"');";
}else{
_f6="clickReply('"+_f0+"', "+GetPersonID()+" ); return TabManager.clickChangeView(event, '"+_ee+"');";
}
if(InStr(_ee,"spam",undefined)){
_f5="default.asp?pre=preSpam&amp;ixBug="+_f0+"&amp;";
_f6="document.body.style.cursor='wait';document.bugform.pre.value='preSpam';document.bugform.submit();return false;";
}else{
if(InStr(_ee,"assign",undefined)){
_f6="return showAssignSpan(this, event);";
_f7="";
}
}
grgHTML[grgHTML.length]=("&nbsp;<a class=\"actionButton2 icon\" onclick=\"")+(_f6)+("\" href=\"")+(_f5)+("\" onmouseover=\"window.status='")+(_ef)+("'; ")+(_f7)+(" return true;\" onmouseout=\"window.status='';return true;\" >");
ActionButtonImg(_ee);
grgHTML[grgHTML.length]=("</a><a class=\"actionButton2\" onclick=\"")+(_f6)+("\" href=\"")+(_f5)+("\" id=\"")+(_ee+_f2)+("\" command=\"")+(_ee)+("\" onmouseover=\"window.status='")+(_ef)+("'; ")+(_f7)+(" return true;\" onmouseout=\"window.status='';return true;\" >");
grgHTML[grgHTML.length]=(_ef);
grgHTML[grgHTML.length]=("</a>");
}
function BugViewAssignButton(_f8,_f9,_fa){
BugViewActionButton("assign",FB_ASSIGN,_f8,_f9,_fa,true,true);
grgHTML[grgHTML.length]=("<span id=\"spanTo_")+("assign"+_fa)+("\" style=\"display:none;\"></span>");
}
function ShowForwardingInline(_fb,_fc,_fd,_fe){
grgHTML[grgHTML.length]=("<div class=\"attachmentBlock\"><a href=\"default.asp?pg=pgDownload&amp;pgType=pgAttachment&amp;ixBugEvent=")+(_fb)+("&amp;sPart=")+(_fc)+("&amp;sTicket=")+(_fd)+("&amp;sFileName=")+(FBUrlPathEncode(_fe))+("\"  title=\"")+(FB_CLICK_FOR_FULL)+("\">")+("<img src=\"default.asp?pg=pgDownload&amp;pgType=pgAttachment&amp;ixBugEvent=")+(_fb)+("&amp;sPart=")+(_fc)+("&amp;sTicket=")+(_fd)+("&amp;sFileName=")+(FBUrlPathEncode(_fe))+("\" ")+("border=\"0\" inline=\"yes\" /></a>");
ShowForwardingDeleteIcon(_fc);
grgHTML[grgHTML.length]=("</div>");
}
function ShowForwardingAtt(_ff,_100,_101,_102){
grgHTML[grgHTML.length]=("<div class=\"attachmentBlock\"><a href=\"default.asp?pg=pgDownload&amp;pgType=pgAttachment&amp;ixBugEvent=")+(_ff)+("&amp;sPart=")+(_100)+("&amp;sTicket=")+(_101)+("&amp;sFileName=")+(FBUrlPathEncode(_102))+("\">")+(UnicodeClean(_102))+("</a>");
ShowForwardingDeleteIcon(_100);
grgHTML[grgHTML.length]=("</div>");
}
function ShowForwardingDeleteIcon(_103){
DeleteIconJS("javascript:void 0;","document.getElementById('omitAtt').value+='|"+_103+"'; parentNode.parentNode.removeChild(this.parentNode);",undefined,undefined);
}
function FileAttachFrame(){
grgHTML[grgHTML.length]=("<iframe name=\"attachFrame\"")+("src=\"attach.asp?lang=")+(FB_LANGUAGE)+("&")+(JS_VERSION)+("\" ")+("height=\"0px\" width=\"0px\" ")+("frameborder=\"0\" hspace=\"0\" vspace=\"0\" ")+("class=\"noborder\" scrolling=\"no\" ")+("marginwidth=0 marginheight=0 ")+("style=\"position:relative; overflow:hidden;\" noresize>")+("</iframe>");
}
function FileInput(_104){
if(_104==undefined){
_104=false;
}
grgHTML[grgHTML.length]=("<input type=\"hidden\" name=\"nFileCount\" value=\"1\" id=\"nFileCount\" />")+("<input type=\"hidden\" name=\"fIEFileBrowse\" value=\"0\" id=\"fIEFileBrowse\" />");
if(!(_104)){
grgHTML[grgHTML.length]=("<div class=\"attachmentBlock\" id=\"files_list\"></div>")+("<div style=\"height:0px; width:0px; overflow:hidden; position:relative;\">");
}
grgHTML[grgHTML.length]=("<input type=\"file\" name=\"File1\" id=\"File1\" size=\"40\" onkeypress=\"if (!event.ctrlKey && getKeyCode(event) == 13 && !window.ie && !window.opera) { return cancel(event); }\" tabindex=\"-1\" />");
if(!(_104)){
grgHTML[grgHTML.length]=("</div>");
}
}
function SubscribeLink(_105,ix,_107){
if(_107&&!(IsNormalUser(undefined))){
return;
}
if(!(IsAnyUser())){
return;
}
if(!(QueryPageNew(_105))&&g_config.sSMTPServer!="NONE"){
var cp;
cp=GetMe();
var _109;
var _10a;
var _10b;
if(_107){
if(BugCount(ix)>1){
_10b=FB_SUBSCRIBE_PLURAL;
}else{
_10b=FB_SUBSCRIBE;
}
_109=cp.IsSubscribed(ix);
_10a="&amp;pg=pgEditBug&amp;command=view&amp;ixBug="+ix;
}else{
_10b=FB_SUBSCRIBE_WIKIPAGE;
_109=cp.IsSubscribedToWikiPage(ix);
_10a="&amp;pg=pgEditBug&amp;command=view&amp;ixWikiPage="+ix;
}
grgHTML[grgHTML.length]=("<span id=\"containerSubscribe\" class=\"subscribe\">")+("<span id=\"unsubscribe\" style=\"")+(Iif(_109,"","display:none"))+("\">");
grgHTML[grgHTML.length]=(InsertPropURL(FB_UNSUBSCRIBE,"default.asp?pre=preUnsubscribe"+_10a,"class='dotted' id='linkUnsubscribe' onclick='quickSubscription(this, false); return false;'"));
grgHTML[grgHTML.length]=("</span>")+("<span id=\"subscribe\" style=\"")+(Iif(_109,"display:none",""))+("\">");
grgHTML[grgHTML.length]=(InsertPropURL(_10b,"default.asp?pre=preSubscribe"+_10a,"class='dotted' id='linkSubscribe' onclick='quickSubscription(this, true); return false;'"));
grgHTML[grgHTML.length]=("</span>");
if(!(_107)){
grgHTML[grgHTML.length]=("<form name=\"formSubscribe\" class=\"noBorder\">");
}
grgHTML[grgHTML.length]=("<input type=\"hidden\" id=\"idSubscriptionState\" name=\"idSubscriptionState\" value=\"")+(Iif(_109,"1","0"))+("\"/>");
if(!(_107)){
grgHTML[grgHTML.length]=("</form>");
}
grgHTML[grgHTML.length]=("</span>");
}
}
function BugDetailMailHeader(_10c,_10d){
if(Len(_10d)==0){
return;
}
grgHTML[grgHTML.length]=("<div class=\"emailHeaderName\">")+(_10c)+(":</div>")+("<div class=\"emailHeaderValue\">")+(UnicodeClean(_10d))+("</div>");
}


var TabManager=new function(){
this.rgActionDesc=[];
this.cancelClicked=false;
this.dirtyView=false;
this.bEditedForm=false;
this.oTipper=false;
var _1=this;
if(typeof (rgBugView)!="undefined"){
this.rgBugView=rgBugView;
this.rgField=rgField;
}else{
this.rgBugView=[];
this.rgField=[];
}
this.safeForChangeView=function(){
if(window.webkit){
return (window.versionMajorWebKit>5||(window.versionMajorWebKit==5&&window.versionMinorWebKit>=25));
}
return !(window.opera||!window.dhtmlHistory);
};
this.clickChangeView=function(e,_3){
if(this.changeView(_3)){
return cancel(e);
}else{
return true;
}
};
this.getTipper=function(){
if(!this.oTipper){
this.oTipper=new ToolTipper();
}
return this.oTipper;
};
this.currentBugView=function(){
if(document.formWithProject){
return document.formWithProject.command.value;
}
};
this.changeView=function(_4){
_1.getTipper().cancelTip();
if(!this.safeForChangeView()){
return false;
}
if(this.changeViewImpl(_4)&&ViewHistoryManager){
ViewHistoryManager.oViewCurrent.sCommand=_4;
ViewHistoryManager.addViewHistory();
return true;
}else{
return false;
}
};
this.returnToView=function(_5){
if(!this.safeForChangeView()){
return;
}
this.changeViewImpl(_5);
};
this.setBug=function(_6){
goBug=_6;
return goBug;
};
this.getBug=function(){
return goBug;
};
this.addBeforeUnloadMessage=function(_7){
if("view"!=_7){
window.onbeforeunload=function(e){
if(TabManager.isFormDirty()&&!(document.all&&elById("fIEFileBrowse")&&1==elById("fIEFileBrowse").value)){
return FB_EDITS_WILL_BE_LOST;
}
};
}else{
window.onbeforeunload="";
}
};
this.changeViewImpl=function(_9){
this.addBeforeUnloadMessage(_9);
KeyManager.deactivateHotKeys();
this.cancelClicked=false;
var _a=elById("TopBugTips");
if(_a){
_a.innerHTML="";
}
this.renderView(_9);
if(null!=document.formWithProject){
document.formWithProject.command.value=_9;
}
this.flipAttachDeleteIcons(_9);
shrinkImagesToFit();
ClockCalBinding.init();
return true;
};
this.CreateFieldMap=function(_b){
if(QueryPageNew(_b)){
_b="edit";
}
var _c=this.rgBugView[0];
var _d=this.rgBugView.select(function(_){
return _.sCmd==_b;
});
if(_d.length!=0){
_c=_d[0];
}
oMap={};
var _f;
for(var ix in this.rgField){
_f=this.rgField[ix];
oMap[_f.sName]=_c[_f.sType];
}
return oMap;
};
this.getCachedView=function(_11){
if(!goBug.rgCachedViews){
goBug.rgCachedViews={};
}
if(!goBug.rgCachedViews[_11]){
var _12=this.CreateFieldMap(_11);
var _13=document.bugform.ixBug.value;
var _14=BugCount(document.bugform.ixBug.value)>1;
goBug.rgCachedViews[_11]={oBug:goBug,sCommand:_11,sButtons1:pictureOf(BugViewActionButtons,_11,_12,_14,_13,goBug,true,"Top"),sButtons2:pictureOf(BugViewActionButtons,_11,_12,_14,_13,goBug,true,"Bottom"),sTop:pictureOf(BugViewTopBar,_11,_14,_13,_12,goBug),sSide:pictureOf(BugViewSideBar,_11,_14,_13,_12,goBug),sEdit:pictureOf(BugViewEditableBugEvent,_11,_14,_13,_12,goBug,"",0)};
}
return goBug.rgCachedViews[_11];
};
this.preRenderView=function(_15,_16){
if(_15=="reply"){
return;
}
if(!_16){
try{
this.preRenderView(_15,true);
}
catch(e){
}
return;
}
this.getCachedView(_15);
};
this.setWindowTitle=function(){
if(typeof (goBug)!="undefined"&&document.formWithProject&&document.formWithProject.ixBug&&goBug.ixBug!=0){
document.title=FB_FOGBUGZ+" "+document.formWithProject.ixBug.value+": "+goBug.sTitle;
}
};
this.renderView=function(_17){
if(!_17){
_17=document.formWithProject.command.value;
}
var _18=this.getCachedView(_17);
if(!(window.mozilla&&window.macintosh)){
var _19=elById("FBHome");
safeFocus(_19);
}
setInnerHTML("bugviewActionButtonsTop",_18.sButtons1);
setInnerHTML("bugviewActionButtonsBottom",_18.sButtons2);
setInnerHTML("bugviewContainerTop",_18.sTop);
setInnerHTML("bugviewContainerSide",_18.sSide);
setInnerHTML("bugviewContainerEdit",_18.sEdit);
if(_17=="reactivate"){
choosePrimaryContact();
}
if(window.ie){
var el=elById("bugviewContainerEdit");
el.style.display=(_18.sEdit.length>0?"":"none");
}
this.setWindowTitle();
this.getTipper().cancelTip();
this.addToolTips(document.formWithProject);
var _1b=["sEventEdit","sEventReply","sEventForward"];
for(var ix=0;ix<_1b.length;ix++){
var _1d=elById(_1b[ix]);
if(_1d){
goBug[_1b[ix]]=_1d.value;
}else{
goBug[_1b[ix]]=undefined;
}
}
var _1e=BugCount(document.bugform.ixBug.value)>1;
DlgLinkProjectDropDown(_1e,goBug.ixProject,goBug.ixArea,goBug.ixFixFor,!_1e,true,true,false);
document.formWithProject.command.value=_17;
statusChange();
setTimeout(function(){
TabManager.focusCorrectFormElement(_17);
},1);
};
this.addBugEditToolTips=function(){
if(document.formWithProject&&document.formWithProject.command&&QueryPageEditable(document.formWithProject.command.value)){
this.addToolTips(document.formWithProject);
}
};
this.addToolTips=function(_1f){
if(window.opera){
return;
}
if(!_1f){
return;
}
var _20=/^idDropList_/;
var _21=/content|wrapper/;
var _22=document.formWithProject;
var _23="view";
if(_22&&_22.command){
_23=_22.command.value;
}
var _24=this.getTipper();
function doAddTip(id,el){
var s="";
if(_20.test(id)){
id=id.split("_")[1];
}
if(_22){
if(id){
s=GetTip(_23,id,false);
}
if(!s&&el.name){
s=GetTip(_23,el.name,false);
}
}
if(!s&&el.title){
s=UnicodeClean(el.title);
}
if(s){
el.title="";
_24.addTip(el,s);
if(el.parentNode.tagName=="NOBR"){
el=el.parentNode;
if(el.parentNode.tagName=="DIV"&&_21.test(el.parentNode.className)){
for(var i=0;i<el.childNodes.length;i++){
_24.addTip(el.childNodes[i],s);
}
}
}
if(el.parentNode.tagName=="DIV"&&_21.test(el.parentNode.className)){
el.parentNode.title="";
}
}
}
var rg=_1f.getElementsByTagName("label");
for(var ix=0;ix<rg.length;ix++){
doAddTip(rg[ix].htmlFor,rg[ix]);
}
rg=XMLParser.getArray(_1f,"input","textarea","select","img");
rg.foreach(function(_){
doAddTip(_.id,_);
});
rg=_1f.getElementsByTagName("a");
for(var ix=0;ix<rg.length;ix++){
doAddTip("",rg[ix]);
}
};
this.focusCorrectFormElement=function(_2c){
if(!_2c){
if(!document.formWithProject||!document.formWithProject.command){
return false;
}
_2c=document.formWithProject.command.value;
}
this.addBeforeUnloadMessage(_2c);
var sel=false;
switch(_2c){
case "new":
sel="idBugTitleEdit";
break;
case "resolve":
sel="ixStatus";
break;
case "reply":
sel="sEventReply";
break;
case "newemail":
case "forward":
sel="sTo";
break;
}
var _2e=false;
if(sel){
_2e=elById(sel);
}
if(!_2e){
_2e=elById("sEventEdit");
}
if(_2e){
safeFocus(elById("FBHome"));
setTimeout(function(){
safeFocus(_2e);
if(_2e.setSelectionRange){
try{
_2e.setSelectionRange(0,0);
}
catch(err){
}
}
},1);
return true;
}
return false;
};
this.flipAttachDeleteIcons=function(_2f){
new ListBrowser(elById("BugEvents"),function(el){
return el.className&&"attachmentDeleteIcon"==el.className;
},null,null,null,function(el){
el.style.display=("edit"==_2f)?"inline":"none";
},null);
};
this.blurCurrentSEventEl=function(){
var el=this.getCurrentSEventEl();
if(el){
safeFocus(el);
el.blur();
}
};
this.isFormDirty=function(){
if(!goBug){
return false;
}
if(!document.formWithProject){
return false;
}
var _33=document.formWithProject;
var _34;
for(_34 in goBug){
if(_34 in _33&&_33[_34].type!="hidden"&&!_33[_34].disabled&&_33[_34].value!=goBug[_34]){
if(Len(goBug[_34])==0&&Len(_33[_34].value)==0){
continue;
}
if((goBug[_34]==-1||goBug[_34]==undefined)&&_34.charAt(0)=="i"&&_34.charAt(1)=="x"&&QueryPageNew(_33.command.value)){
continue;
}
if((goBug[_34]==-1&&_33[_34].value=="0")&&_34.charAt(0)=="i"&&_34.charAt(1)=="x"){
continue;
}
this.oDirtyField=_33[_34];
return true;
}
}
return false;
};
this.getCurrentSEventEl=function(){
return this.getCurrentEl("sEvent");
};
this.getCurrentEl=function(_35){
var el;
el=elById(_35+"Edit");
if(isDisplayed(el)){
return el;
}
el=elById(_35+"Reply");
if(isDisplayed(el)){
return el;
}
el=elById(_35+"Forward");
if(isDisplayed(el)){
return el;
}
el=elById(_35+"Email");
if(isDisplayed(el)){
return el;
}
};
};
var ViewHistoryManager=new function(){
this.bInited=false;
this.oViewInit=null;
this.oViewCurrent=null;
this.init=function(_37,_38,_39){
var _3a=this.getFormInfo();
this.oViewInit={sCommand:_37,ixBug:_38,fMostRecentEventFirst:_39,ixBugEventLatest:ixBugEventLatest,oFormInfo:_3a};
this.oViewCurrent={sCommand:_37,ixBug:_38,fMostRecentEventFirst:_39,ixBugEventLatest:ixBugEventLatest,oFormInfo:_3a};
this.bInited=true;
};
this.getFormInfo=function(){
var _3b={};
var _3c=document.formWithProject;
if(!_3c){
return _3b;
}
var els=_3c.elements;
for(var ix=0;ix<els.length;ix++){
var el=els[ix];
if(el.name&&el.type!="hidden"){
_3b[el.name]=el.value;
}
}
return _3b;
};
this.setFormInfo=function(_40){
var _41=document.formWithProject;
if(!_41){
return;
}
for(var s in _40){
_41[s].value=_40[s];
}
};
this.addViewHistory=function(_43){
if(!this.bInited||!window.dhtmlHistory){
return false;
}
var o=dhtmlHistory;
var _45="add";
if(_43){
o=historyStorage;
_45="put";
}
o[_45](this.oViewCurrent.sCommand+"_"+this.oViewCurrent.fMostRecentEventFirst+"_"+this.oViewCurrent.ixBug,{type:"BugView",sCommand:this.oViewCurrent.sCommand,ixBug:this.oViewCurrent.ixBug,fMostRecentEventFirst:this.oViewCurrent.fMostRecentEventFirst,ixBugEventLatest:ixBugEventLatest,oFormInfo:this.getFormInfo()});
return true;
};
this.addBugView=function(){
if(!this.bInited||!window.dhtmlHistory){
return false;
}
dhtmlHistory.add(""+ixBugEventLatest,{sCommand:this.oViewCurrent.sCommand,ixBug:this.oViewCurrent.ixBug,fMostRecentEventFirst:this.oViewCurrent.fMostRecentEventFirst,ixBugEventLatest:ixBugEventLatest,oFormInfo:this.getFormInfo()});
return true;
};
this.setCurrentTo=function(_46){
if(!this.bInited){
return;
}
if(this.oViewCurrent.sCommand!=_46.sCommand){
this.oViewCurrent.sCommand=_46.sCommand;
TabManager.returnToView(_46.sCommand);
}
if(this.oViewCurrent.fMostRecentEventFirst!=_46.fMostRecentEventFirst){
this.oViewCurrent.fMostRecentEventFirst=_46.fMostRecentEventFirst;
this.oViewCurrent.ixBug=_46.ixBug;
setMostRecentEventFirst(this.oViewCurrent.ixBug,this.oViewCurrent.fMostRecentEventFirst,true);
}
this.setFormInfo(_46.oFormInfo);
};
this.handleHistoryChange=function(_47,_48){
if(!this.bInited){
return false;
}
if(null==_48){
this.setCurrentTo(this.oViewInit);
}else{
this.setCurrentTo(_48);
if(_48.ixBugEventLatest>ixBugEventLatest){
Info.show(FB_LOADING_BUG_DATA);
loadBug(_48.ixBug,_48.sCommand);
}
}
return true;
};
};
function clickReply(_49,_4a){
goBug.ixPersonAssignedTo=_4a;
changeBug(_49,"ixPersonAssignedTo",_4a,"reply","pgBugAssignAlaCarte");
}
function clickAssignDropdown(_4b){
var _4c=goBug.ixPersonAssignedTo;
goBug.ixPersonAssignedTo=_4b;
goBug.rgCachedViews={};
TabManager.clickChangeView(null,"assign");
goBug.ixPersonAssignedTo=_4c;
}
var ixBugEventLatest=0;
var sCommand="";
function changeBug(_4d,_4e,_4f,_50,sPg){
if(!oAjaxRequest){
oAjaxRequest=new AjaxRequest();
}
if(oAjaxRequest.isBusy()){
setTimeout("changeBug('"+_4d+"','"+_4e+"', '"+_4f+"', '"+_50+"', '"+sPg+"');",500);
}else{
oAjaxRequest=new AjaxRequest();
oAjaxRequest.initialize();
oAjaxRequest.bDefaultFailureBehavior=false;
oAjaxRequest.onreadystatechange(resultSubmitBug);
oAjaxRequest.open("GET",sDefaultURI+"?fAlaCarte=1&pre=preChangeBug&pg="+sPg+"&ixBug="+_4d+"&"+_4e+"="+_4f+"&ixBugEventLatest="+ixBugEventLatest+"&fMostRecentEventFirst="+ViewHistoryManager.oViewCurrent.fMostRecentEventFirst+"&command="+_50,true);
oAjaxRequest.send(null);
}
}
function loadBug(_52,_53){
if(!oAjaxRequest){
oAjaxRequest=new AjaxRequest();
}
if(oAjaxRequest.isBusy()){
setTimeout(function(){
loadBug(_52,_53);
},250);
}else{
oAjaxRequest=new AjaxRequest();
oAjaxRequest.initialize();
oAjaxRequest.onreadystatechange(resultSubmitBug);
oAjaxRequest.open("GET",sDefaultURI+"?fAlaCarte=1&pg=pgEntireBug&ixBug="+_52+"&command="+_53,true);
oAjaxRequest.send(null);
}
}
function updateActionButtons(_54){
var _55=XMLParser.getNodeArrayFrom(_54,"ActionButtons");
if(!_55||!_55.length){
return;
}
for(var ix=0;ix<_55.length;ix++){
var sId=XMLParser.getTextFrom(_55[ix],"idContainer");
var _58=XMLParser.getCDataFrom(_55[ix],"sHTML");
if(sId&&_58){
var o=elById(sId);
if(o){
o.innerHTML=_58;
}
}
}
}
function updateBugEventLatest(_5a,_5b){
if(!_5a||!_5b){
return false;
}
if(_5a==_5b){
return false;
}
if(_5a==ixBugEventLatest){
ixBugEventLatest=_5b;
if(document.bugform&&document.bugform.ixBugEventLatest){
document.bugform.ixBugEventLatest.value=ixBugEventLatest;
}
if(document.formWithProject&&document.formWithProject.ixBugEventLatest){
document.formWithProject.ixBugEventLatest.value=ixBugEventLatest;
}
return true;
}
return false;
}
function getValue(_5c){
var el=elById(_5c);
if(!el){
return "";
}
return el.value;
}
function setValue(_5e,_5f){
var el=elById(_5e);
if(!el){
return;
}
el.value=_5f;
if(isTagName(el,"select")){
DropListControl.refreshWithin(el.parentNode);
}
}
function resultSubmitBug(){
if(!oAjaxRequest){
return;
}
if(oAjaxRequest.isReady()){
var _61="";
var el=elById("sEventForward");
if(!el){
el=elById("sEventReply");
}
if(!el){
el=elById("sEventEdit");
}
if(el){
_61=el.value;
}
var _63=getValue("sFrom");
var sTo=getValue("sTo");
var sCC=getValue("sCC");
var _66=getValue("sBCC");
var _67=getValue("sSubject");
var _68=oAjaxRequest.responseXML(true);
if(!_68){
return;
}
loadWorkingOnPopup();
if(XMLParser.getTextFrom(_68,"sError")){
alert(XMLParser.getTextFrom(_68,"sError"));
}
if(XMLParser.getTextFrom(_68,"forceReload")&&"1"==XMLParser.getTextFrom(_68,"forceReload")){
window.location.reload();
return;
}
if(XMLParser.getTextFrom(_68,"loadPage")){
window.location.search=XMLParser.getTextFrom(_68,"loadPage");
Process.cancelInfoHide();
return;
}
var _69=XMLParser.getTextFrom(_68,"ixBugEventLatest");
if(null!=_69&&_69!=ixBugEventLatest){
ixBugEventLatest=_69;
var _6a=XMLParser.getCDataFrom(_68,"BugEventHTML");
if(_6a){
document.formWithProject.ixBugEventLatest.value=ixBugEventLatest;
if(XMLParser.getTextFrom(_68,"fRemoveOldToggle")=="1"&&elById("BugEventOrderToggle")){
elById("BugEventOrderToggle").innerHTML="";
}
if(window.mozilla){
saveSelection(el);
}
if(elById("newBugEventInsertBelowPoint")){
elById("newBugEventInsertBelowPoint").innerHTML=_6a+elById("newBugEventInsertBelowPoint").innerHTML;
}else{
if(elById("newBugEventInsertAbovePoint")){
elById("newBugEventInsertAbovePoint").innerHTML=elById("newBugEventInsertAbovePoint").innerHTML+_6a;
}
}
if(window.mozilla){
restoreSelection(el);
}
}
}
var _6b=XMLParser.getCDataFrom(_68,"EditFooterHTML");
if(_6b){
var _6c=elById("EditFooter");
if(_6c){
_6c.innerHTML=_6b;
}
}
var _6d=XMLParser.getCDataFrom(_68,"HiddenFieldsHTML");
if(_6d){
var el=elById("formWithProjectHiddenFields");
if(el){
el.innerHTML=_6d;
}
}
var _6e={"goBug":"BugFieldsJS","goDup":"BugFieldsDupJS","goScout":"BugFieldsScoutJS"};
for(var s in _6e){
var sJS=XMLParser.getCDataFrom(_68,_6e[s]);
if(sJS){
window[s]=eval("("+sJS+")");
}else{
window[s]=undefined;
}
}
var _71=XMLParser.getCDataFrom(_68,"BugFieldsHTML");
if(_71){
TabManager.blurCurrentSEventEl();
KeyManager.deactivateHotKeys();
var _72=elById("BugFields");
_72.innerHTML=_71;
TabManager.renderView();
if(document.formWithProject.ixProject&&document.formWithProject.ixArea&&document.formWithProject.ixFixFor){
SetupAreaProjectMapping();
SetupFixForProjectMapping();
setTimeout("if (isDisplayed(elById('ixStatus'))) statusChange();",1);
var _73=document.formWithProject.ixArea.options;
var _74=document.formWithProject.ixFixFor.options;
projectChanged(document.formWithProject.ixProject.options.selectedIndex,_73[_73.selectedIndex].value,_74[_74.selectedIndex].value);
}
updatePageTitle(goBug.sTitle);
var el=TabManager.getCurrentSEventEl();
if(null!=el){
if(_61){
el.value=_61;
}
safeFocus(el);
if(!document.selection){
if(el&&el.setSelectionRange){
try{
el.setSelectionRange(0,0);
}
catch(err){
}
}
}
}
_61="";
setValue("sFrom",_63);
setValue("sTo",sTo);
setValue("sCC",sCC);
setValue("sBCC",_66);
setValue("sSubject",_67);
var _75=XMLParser.getTextFrom(_68,"sCommand");
if(_75){
ViewHistoryManager.oViewCurrent.sCommand=_75;
ViewHistoryManager.addBugView();
}
TabManager.bEditedForm=false;
}
var _76=XMLParser.getCDataFrom(_68,"SeeAlsoHTML");
if(_76){
var el=elById("sBugRelationInfo");
if(el){
el.innerHTML=_76;
}
}
var _77=XMLParser.getCDataFrom(_68,"BugEventsHTML");
if(_77){
elById("BugEvents").innerHTML=_77;
}else{
TabManager.flipAttachDeleteIcons(_75);
}
Info.hide();
IdPop.hide();
ClockCalBinding.init();
try{
frames.attachFrame.initMSel();
}
catch(e){
}
}
}
function updatePageTitle(_78){
if(!_78||!_78.length||!document.titlePrototype){
return;
}
document.title=swap1(document.titlePrototype,_78);
}
function clickEventOrderToggle(e,_7a,_7b){
if(setMostRecentEventFirst(_7a,_7b,false)&&ViewHistoryManager){
elById("BugEventOrderToggle").innerHTML="";
ViewHistoryManager.oViewCurrent.fMostRecentEventFirst=_7b;
ViewHistoryManager.oViewCurrent.ixBug=_7a;
ViewHistoryManager.addViewHistory();
}
return cancel(e);
}
function setMostRecentEventFirst(_7c,_7d,_7e){
if(!oAjaxRequest){
oAjaxRequest=new AjaxRequest();
}
if(oAjaxRequest.isBusy()){
if(_7e){
setTimeout("setMostRecentEventFirst("+_7d+", "+_7c+")",500,true);
return true;
}
return false;
}
oAjaxRequest=new AjaxRequest();
oAjaxRequest.initialize();
oAjaxRequest.onreadystatechange(resultReplaceBugEvents);
oAjaxRequest.open("GET",sDefaultURI+"?fAlaCarte=1&pre=preSetMostRecentEventFirst&pg=pgBugEvents&ixBug="+_7c+"&fMostRecentEventFirst="+_7d,true);
oAjaxRequest.send(null);
return true;
}
function resultReplaceBugEvents(){
if(!XMLParser){
XMLParser=new XMLParser();
}
if(!oAjaxRequest||!oAjaxRequest.isReady()){
return;
}
var _7f=oAjaxRequest.responseXML();
var _80=XMLParser.getCDataFrom(_7f,"BugEventsHTML");
if(_80){
doReplaceBugEvents(_80);
shrinkImagesToFit();
}
}
function doReplaceBugEvents(_81){
var o=elById("BugEvents");
try{
if(o&&_81){
o.innerHTML=_81;
}
}
catch(e){
var _83=document.createElement("div");
_83.setAttribute("id","BugEvents");
_83.innerHTML=_81;
o.parentNode.replaceChild(_83,o);
}
}
function clickBugSubmit(e,_85,_86,_87,bOK){
TabManager.getTipper().cancelTip();
window.onbeforeunload=null;
ViewHistoryManager.addViewHistory(true);
if(bOK){
Process.start(this,"resultSubmitBug",failureSubmitBug,FB_SUBMITTING);
}else{
Process.start(this,"resultSubmitBug",failureSubmitBug,FB_CANCELLING);
TabManager.cancelClicked=true;
}
try{
frames.attachFrame.mSel.cleanupDupes();
}
catch(e){
}
enableInputsWithin("submitButtonsEdit",false);
if(!TabManager.safeForChangeView()){
return true;
}
if((1==_86)&&(_85.nFileCount)&&(1==_85.nFileCount.value&&""==_85.File1.value)){
doBugSubmit(_85,_87);
return cancel(e);
}
return true;
}
function doBugSubmit(_89,_8a){
if(!oAjaxRequest){
oAjaxRequest=new AjaxRequest();
}
if(oAjaxRequest.isBusy()){
setTimeout(function(){
doBugSubmit(_89,_8a);
},500);
}else{
var _8b=formToQueryString(_89);
oAjaxRequest=new AjaxRequest();
oAjaxRequest.initialize();
oAjaxRequest.onreadystatechange(resultSubmitBug);
oAjaxRequest.onfailure(failureSubmitBug);
oAjaxRequest.open("POST",sDefaultURI,true);
oAjaxRequest.send("fAlaCarte=1&pre=preSubmitBug&pg=pgBugFields&fMostRecentEventFirst="+ViewHistoryManager.oViewCurrent.fMostRecentEventFirst+"&"+"OK="+encodeURIComponent(_8a)+"&"+_8b);
}
}
function failureSubmitBug(){
enableInputsWithin("submitButtonsEdit",true);
}
function clickAttach(){
parent.document.getElementById("fIEFileBrowse").value=1;
frames.attachFrame.setTimeout("elById('clickMSel').onclick();",1);
}
function getQuotedText(el,_8d){
el.onclick=function(){
return false;
};
el.firstChild.innerHTML=FB_FETCHING;
if(!oAjaxRequest){
oAjaxRequest=new AjaxRequest();
}
if(oAjaxRequest.isBusy()){
if(fRetry){
setTimeout(function(){
getQuotedText(el,_8d);
},500);
return true;
}
return false;
}
oAjaxRequest=new AjaxRequest();
oAjaxRequest.initialize();
oAjaxRequest.onreadystatechange(resultInsertQuotedText);
oAjaxRequest.open("GET",sDefaultURI+"?fAlaCarte=1&pg=pgQuotedEmail&ixBugEvent="+_8d,true);
oAjaxRequest.elTarget=el;
oAjaxRequest.send(null);
return true;
}
function resultInsertQuotedText(){
if(!oAjaxRequest||!oAjaxRequest.isReady()){
return;
}
var _8e=oAjaxRequest.responseXML();
var _8f=XMLParser.getCDataFrom(_8e,"QuotedText");
if(_8f){
var _90=nextSiblingOfType(oAjaxRequest.elTarget,"span");
if(_90){
_90.innerHTML=_8f;
var _91=oAjaxRequest.elTarget;
oAjaxRequest.elTarget.onclick=function(){
toggleReply(_91);
return false;
};
_91.onclick();
}
}
}
function requestUpdateElapsedTime(_92){
if(!(elById("idEstimateBlock")&&goBug&&goBug.ixBug&&_92.match(function(_){
return _==goBug.ixBug;
}))){
return false;
}
if(!oAjaxRequest){
oAjaxRequest=new AjaxRequest();
}
if(oAjaxRequest.isBusy()){
setTimeout(requestUpdateElapsedTime,500);
}else{
oAjaxRequest=new AjaxRequest();
oAjaxRequest.initialize();
oAjaxRequest.onreadystatechange(responseUpdateElapsedTime);
oAjaxRequest.open("GET",sDefaultURI+"?fAlaCarte=1&pg=pgAlaCarteElapsedTime&ixBug="+goBug.ixBug);
oAjaxRequest.send(null);
}
return false;
}
function responseUpdateElapsedTime(){
if(!oAjaxRequest||!oAjaxRequest.isReady()){
return;
}
if(!goBug){
return;
}
var _94=oAjaxRequest.responseXML();
goBug.fEstLocked="true"==XMLParser.getTextFrom(_94,"fEstLocked");
goBug.hrsOrigEst=Number(XMLParser.getTextFrom(_94,"hrsOrigEst"));
goBug.hrsCurrEst=Number(XMLParser.getTextFrom(_94,"hrsCurrEst"));
goBug.hrsElapsed=Number(XMLParser.getTextFrom(_94,"hrsElapsed"));
goBug.hrsElapsedExtra=Number(XMLParser.getTextFrom(_94,"hrsElapsedExtra"));
goBug.rgCachedViews={};
var _95=TabManager.CreateFieldMap(document.formWithProject.command.value)["estimate"];
replaceContentAndYFT("idEstimateBlock",pictureOf(BugViewFieldExplicit,"hrsCurrEstNew","",FB_ESTIMATE,"",pictureOf(BugViewEstimateInfo,_95,goBug.fEstLocked,goBug.hrsOrigEst,goBug.hrsCurrEst,goBug.hrsElapsed,goBug.hrsElapsedExtra,goBug.ixBug)));
}
function replaceContentAndYFT(id,_97){
var el=elById(id);
if(el&&_97){
el.innerHTML=_97;
YFTManager.showYellow(id,el);
}
}
function goToRelativeBug(_99,_9a,_9b,_9c,_9d){
if(!oAjaxRequest){
oAjaxRequest=new AjaxRequest();
}
if(oAjaxRequest.isBusy()){
setTimeout("goToRelativeBug('"+_99+"','"+_9a+"','"+_9b+"','"+_9c+"','"+_9d+"');",500);
}else{
oAjaxRequest=new AjaxRequest();
oAjaxRequest.initialize();
oAjaxRequest.onreadystatechange(resultGoToRelativeBug);
oAjaxRequest.open("GET",sDefaultURI+"?fAlaCarte=1&pg=pgRelativeBugURL&ixBug="+_99+"&command="+_9a+"&search="+_9b+"&searchFor="+_9c+"&bIgnoreMax="+_9d,true);
oAjaxRequest.send(null);
}
return false;
}
function resultGoToRelativeBug(){
if(!XMLParser){
XMLParser=new XMLParser();
}
if(!oAjaxRequest||!oAjaxRequest.isReady()){
return;
}
var _9e=oAjaxRequest.responseXML();
var _9f=XMLParser.getTextFrom(_9e,"RelativeBugURL");
if(_9f){
window.location=_9f;
}
}
var rgAreaProject;
var rgFixForProject;
var rgProjectGroup;
function SetupAreaProjectMapping(){
sNoChangeArea=document.formWithProject.ixArea.getAttribute("sNoChangeArea");
ixNoChangeArea=document.formWithProject.ixArea.getAttribute("ixNoChangeArea");
rgAreaProject=DB.Area.select();
rgAreaProject.foreach(function(_){
_.ix=_.ixArea;
_.s=_.sArea;
_.ixP=_.ixProject;
});
if(document.formWithProject.ixArea.getAttribute("bFakeArea")){
rgAreaProject.push({ix:"-1",s:FB_NAME_OF_DEFAULT_AREA,ixP:"-1"});
}
}
function SetupFixForProjectMapping(){
if(!DB.FixFor){
return;
}
rgFixForProject=DB.FixFor.select();
rgFixForProject.foreach(function(_){
_.ix=_.ixFixFor;
_.s=_.sCTZFixForVersionFromUTC;
_.ixP=_.ixProject;
if(IsNull(_.ixP)){
_.ixP=-1;
}
});
}
function SetupProjectGroupMapping(){
rgProjectGroup=DB.Project.select();
rgProjectGroup.foreach(function(_){
_.ix=_.ixProject;
_.s=_.sProject;
_.ixG=_.ixGroup;
});
}
projectChanged=function(){
};
groupChanged=function(){
};
areaChanged=function(){
};
function DlgLinkProjectDropDown(_a3,_a4,_a5,_a6,_a7,_a8,_a9,_aa){
if(!document.formWithProject||!document.formWithProject.ixProject||!document.formWithProject.ixArea){
return;
}
var _ab=_a3?1:0;
SetupAreaProjectMapping();
if(_a9){
SetupFixForProjectMapping();
}
if(document.formWithProject.ixGroup){
SetupProjectGroupMapping();
}
var _ac=null;
var _ad=null;
if(_a5!=""){
_ad=_a5;
}
if(_a6!=""){
_ac=_a6;
}
projectChanged=function(x,_af,_b0){
if(_af){
_ad=_af;
}
if(_b0){
_ac=_b0;
}
var _b1=document.formWithProject.ixProject;
var _b2=document.formWithProject.ixArea;
var _b3=false;
var _b4=_b2.options;
var i;
for(i=_b4.length-1;i>=0;i=i-1){
_b4[i]=null;
}
var _b6=0;
if(_a3){
if(_aa){
_b4[_b6]=new Option(sNoChangeArea,ixNoChangeArea);
_b4[_b6].selected=true;
_b6++;
}else{
if(0==_b1.options[x].value||goBug.ixProject==_b1.options[x].value){
_b4[_b6]=new Option(sNoChangeArea,ixNoChangeArea);
_b4[_b6].selected=true;
_b6++;
}
}
}
for(i=0;i<rgAreaProject.length;i++){
if(rgAreaProject[i].ixP==_b1.options[x].value){
_b4[_b6]=new Option(decodeLTGT(rgAreaProject[i].s),rgAreaProject[i].ix);
if(_ad&&rgAreaProject[i].ix==_ad){
_b4[_b6].selected=true;
_b3=true;
}
_b6++;
}
}
if(window.opera){
redraw(_b2);
}
if(!_a3){
if(!_b3){
_b4[0].selected=true;
}
}
_b3=false;
if(_a9&&document.formWithProject.ixFixFor){
var _b7=document.formWithProject.ixFixFor.getAttribute("fIncludeDeleted")=="true";
_b4=document.formWithProject.ixFixFor.options;
for(i=_b4.length-1;i>=_ab;i=i-1){
_b4[i]=null;
}
_b6=_ab;
if(_a3){
if(_b4[0]!=null){
_b4[0].selected=true;
}
}
var _b8=rgFixForProject.select(function(_){
return (_b7||!_.fDeleted||_ac==_.ix)&&(_.ixP==_b1.options[x].value||_.ixP==-1);
});
for(i=0;i<_b8.length;i++){
_b4[_b6]=new Option(decodeLTGT(_b8[i].s),_b8[i].ix);
if(_ac&&_b8[i].ix==_ac){
_b4[_b6].selected=true;
_b3=true;
}
_b6++;
}
if(!_a3){
if(!_b3&&_b4[0]!=null){
_b4[0].selected=true;
}
}
if(window.opera){
redraw(document.formWithProject.ixFixFor);
}
}
if(_a8){
setPrimaryContact();
}
DropListControl.refreshWithin(document.formWithProject);
};
areaChanged=function(){
if(_a8){
setPrimaryContact();
DropListControl.refreshWithin(document.formWithProject);
}
};
function setPrimaryContact(){
if(!setAreaPrimaryContact()){
setProjectPrimaryContact();
}
}
function setProjectPrimaryContact(){
if(!document.formWithProject.ixPersonAssignedTo){
return;
}
var _ba=document.formWithProject.ixProject;
if(!_ba){
return;
}
var _bb=document.formWithProject.ixPersonAssignedTo.options;
var ix=0;
var _bd;
if(_a3){
ix=1;
}
for(i=0;i<DB.Project.length;i++){
_bd=DB.Project[i];
if(_bd.ixProject==_ba.value&&_bd.sPersonOwner){
_bb[ix].text=FB_PRIMARY_CONTACT+" ("+decodeLTGT(_bd.sPersonOwner)+")";
break;
}
}
}
function setAreaPrimaryContact(){
var _be=document.formWithProject.ixArea;
if(!_be){
return;
}
var _bf=false;
if(_a8&&document.formWithProject.ixPersonAssignedTo){
var _c0=document.formWithProject.ixPersonAssignedTo.options;
var ix=0;
var _c2;
if(_a3){
ix=1;
}
for(i=0;i<DB.Area.length;i++){
_c2=DB.Area[i];
if(_c2.ixArea==_be.value&&_c2.sPersonOwner){
_c0[ix].text=FB_PRIMARY_CONTACT+" ("+decodeLTGT(_c2.sPersonOwner)+")";
_bf=true;
break;
}
}
}
return _bf;
}
groupChanged=function(x){
var _c4=false;
var _c5=(_a3?1:0);
var _c6=document.formWithProject.ixProject.options;
var i;
for(i=_c6.length-1;i>=_c5;i=i-1){
_c6[i]=null;
}
var _c8=_c5;
if(_a3){
_c6[0].selected=true;
}
for(i=0;i<rgProjectGroup.length;i++){
if(rgProjectGroup[i].ixG==x||-1==x){
_c6[_c8]=new Option(decodeLTGT(rgProjectGroup[i].s),rgProjectGroup[i].ix);
if(_a4){
if(rgProjectGroup[i].ix==_a4){
_c6[_c8].selected=true;
_c4=true;
}
}
_c8++;
}
}
if(!_a3){
if(!_c4){
_c6[0].selected=true;
}
}
projectChanged(document.formWithProject.ixProject.selectedIndex);
};
projectChanged(document.formWithProject.ixProject.options.selectedIndex);
}
function choosePrimaryContact(){
if(document.formWithProject&&document.formWithProject.ixPersonAssignedTo){
var _c9=document.formWithProject.ixPersonAssignedTo;
_c9.selectedIndex=0;
DropListControl.refreshWithin(_c9.parentNode);
}
}


var sNoSnippets="";
var sWarning="";
var sSnippetKey="";
var rgSnippet=[];
var elemSnippetHelperTarget;
var elemSnippetWarningTarget;
var sSnippetHelperSToReplace;
function replaceWithSnippet(_1,_2,s){
s=replacePlaceHolders(s);
var n=_2.length;
var _5,_6;
safeFocus(_1);
if(document.selection&&!window.opera){
var _7=document.selection.createRange();
_7.collapse();
_7.moveStart("character",-n);
_7.text=s;
_5=s.search(/\[\[/);
_6=s.search(/\]\]/);
if(_5!=-1&&_6!=-1){
_7.moveStart("character",-s.length+_5);
_7.moveEnd("character",-s.length+_6+2);
}
_7.select();
_7.scrollIntoView();
if(s){
setTimeout(function(){
safeFocus(_1);
},1);
}
}else{
if(_1.selectionStart||_1.selectionStart=="0"){
var _8=Math.max(0,_1.selectionStart);
var _9=Math.max(0,_8-n);
var _a=_1.value.substring(0,_9);
var _b=_1.value.substring(_8,_1.value.length);
var _c,_d,_e;
_5=s.search(/\[\[/);
_6=s.search(/\]\]/);
_1.value=_a;
_c=_1.scrollHeight;
if(_5!=-1&&_6!=-1){
_1.value=_1.value+s.substring(0,_5);
_e=_1.scrollHeight-_1.offsetHeight;
}
_1.value=_a+s;
_d=_1.scrollHeight-_c;
_1.value=_1.value+_b;
var _f=_c+_d-_1.offsetHeight;
if(_5!=-1&&_6!=-1){
_1.setSelectionRange(_9+_5,_9+_6+2);
if(_e<_f){
_f=_e;
}
}else{
var _10=_9+s.length;
_1.setSelectionRange(_10,_10);
if(window.opera){
redraw(_1);
}
}
_1.scrollTop=Math.max(0,_f);
}else{
var txt=_1.value;
var _12=txt.lastIndexOf(_2+sSnippetKey);
if(_12>-1){
_12=_12+n;
_1.value="";
_1.blur();
_1.value=txt.substring(0,_12-n)+s+txt.substring(_12+1);
safeFocus(_1);
}
}
}
}
function getSnippetName(_13){
var _14="";
if(document.selection&&!window.opera){
safeFocus(_13);
sel=document.selection.createRange();
sel.collapse();
sel.moveStart("word",-1);
selSlashcheck=sel.duplicate();
selSlashcheck.moveStart("character",-1);
selSlashcheck.moveStart("word",-1);
var _15=1;
while(selSlashcheck.text!=""&&(selSlashcheck.text.lastIndexOf(sSnippetKey)!=selSlashcheck.text.length-1)&&selSlashcheck.text.indexOf("/")!=-1&&selSlashcheck.text.indexOf("\n")<0&&selSlashcheck.text.indexOf(" ")<0&&selSlashcheck.text.split("/").length!=_15){
sel=selSlashcheck.duplicate();
_15=selSlashcheck.text.split("/").length;
selSlashcheck.moveStart("character",-1);
selSlashcheck.moveStart("word",-1);
}
_14=sel.text;
if(_14.lastIndexOf(" ")>-1){
_14="";
}
}else{
if(_13.selectionStart||_13.selectionStart=="0"){
var _16=Math.max(0,_13.selectionStart);
var _17=Math.max(0,_16-16);
_14=_13.value.substr(_17,_16-_17);
var _18=_14.split(/\s/);
_14=_18[_18.length-1];
}
}
return _14;
}
function doSnippetAction(_19,e,_1b){
if(rgSnippet.length==0){
showSnippetWarning(_19,sNoSnippets);
return true;
}else{
if(_1b.length==0){
sSnippetHelperSToReplace="";
return false;
}else{
if(_1b.charAt(_1b.length-1)==sSnippetKey){
sSnippetHelperSToReplace=_1b;
if(document.selection||_19.selectionStart||_19.selectionStart=="0"){
replaceWithSnippet(_19,sSnippetKey,"");
sSnippetHelperSToReplace=sSnippetHelperSToReplace.substring(0,sSnippetHelperSToReplace.length-1);
}
showSnippetHelper(_19);
return cancel(e);
}else{
var _1c=_1b.toLowerCase();
for(i=0;i<rgSnippet.length;i++){
if(_1c==rgSnippet[i].name.toLowerCase()){
replaceWithSnippet(_19,_1b,rgSnippet[i].text);
return cancel(e);
}
}
sSnippetHelperSToReplace=_1b;
var _1d=sWarning.indexOf("%1");
showSnippetWarning(_19,sWarning.substring(0,_1d)+_1b+sWarning.substring(_1d+2));
return true;
}
}
}
}
function replaceFirstSnippetInstance(_1e){
var _1f="";
var _20=_1e.value.lastIndexOf(sSnippetKey);
_1f=_1e.value.substring(0,_20);
var _21=Math.max(0,Math.max(_1f.lastIndexOf(" "),_1f.lastIndexOf("\n"))+1);
var _22=_20;
_1f=_1f.substr(_21,_22-_21);
return doSnippetAction(_1e,null,_1f);
}
function handleSnippetTargetKeypress(_23,e){
bUserTyped=true;
hideSnippetWarning(true);
var _25=String.fromCharCode(getKeyCode(e));
if(_25==sSnippetKey){
if(!(document.selection||_23.selectionStart||_23.selectionStart=="0")){
setTimeout("replaceFirstSnippetInstance("+_23.id+")",100);
return true;
}else{
var _26=getSnippetName(_23);
return doSnippetAction(_23,e,_26);
}
}
}
function showSnippetWarning(_27,_28){
elemSnippetWarningTarget=_27;
var _29=elById("idSnippetWarningText");
_29.innerHTML=_28;
var pos=getAbsolutePosition(_27);
pos.x+=_27.offsetWidth*0.66;
var _2b=elById("editSnippetWarning");
_2b.style.width=_27.offsetWidth*0.33;
if(!theMgr.exists("editSnippetWarning")){
theMgr.addWithHandler("editSnippetWarning",hideSnippetWarning);
}
theMgr.showPopup("editSnippetWarning",null,pos.x,pos.y,true);
}
function hideSnippetWarning(_2c){
if(_2c){
theMgr.hideAllPopups(false);
}
if(elemSnippetWarningTarget){
safeFocus(elemSnippetWarningTarget);
}
return true;
}
function showSnippetHelper(_2d){
if(window.TabManager&&TabManager.oTipper){
TabManager.oTipper.cancelTip();
}
var _2e=elById("idSnippetSelect");
var _2f=elById("idSnippetOKButton");
elemSnippetHelperTarget=_2d;
if(_2e.length!=rgSnippet.length){
populateSnippetSelect();
}
if(clickmaskSnippet){
clickmaskSnippet.style.display="";
}
_2d.style.height=Math.round(_2d.offsetHeight/2)+"px";
var _30;
var _31;
if(!document.selection&&_2d.selectionStart&&_2d.selectionEnd){
_30=_2d.selectionStart;
_31=_2d.selectionEnd;
}
if(!document.selection&&_2d.selectionStart&&_2d.selectionEnd){
_2d.selectionStart=_30;
_2d.selectionEnd=_31;
}
var pos=getAbsolutePosition(_2d);
pos.y+=_2d.offsetHeight;
var _33=elById("editSnippetHelper");
_33.style.width=_2d.offsetWidth+"px";
if(!theMgr.exists("editSnippetHelper")){
theMgr.addWithHandler("editSnippetHelper",hideSnippetHelper);
}
theMgr.showPopup("editSnippetHelper",null,pos.x,pos.y,true,false,true);
if(_2f.focus){
safeFocus(_2f);
}
if(_2e.focus){
safeFocus(_2e);
}
refreshSnippetHelper();
}
function hideSnippetHelper(_34){
if(_34){
theMgr.hideAllPopups(false);
}
if(elemSnippetHelperTarget){
elemSnippetHelperTarget.style.height="";
redraw(elemSnippetHelperTarget);
safeFocus(elemSnippetHelperTarget);
}
return true;
}
function refreshSnippetHelper(){
var _35=elById("idSnippetSelect").selectedIndex;
var _36=new RegExp("<","gi");
var _37=new RegExp(">","gi");
if(_35>-1){
var _38=rgSnippet[_35].text;
_38=encodeLTGT(_38);
var s="<span class=snippetText>"+_38+"</span>";
var _3a=encodeLTGT(rgSnippet[_35].comment);
if(_3a.length>0){
s="<span class=snippetComment>"+_3a+"</span><hr>"+s;
}
elById("idSnippetText").innerHTML=s;
}
}
function populateSnippetSelect(){
var _3b=elById("idSnippetSelect");
while(_3b.length>0){
_3b.remove(0);
}
var _3c;
for(i=0;i<rgSnippet.length;i++){
optNew=new Option(rgSnippet[i].name,rgSnippet[i].name,i==0,i==0);
if(document.all){
_3b.add(optNew);
}else{
_3b.add(optNew,null);
}
if(i==0){
optNew.selected=true;
}
}
}
function handleSnippetHelperOK(e){
KeyManager.deactivateHotKeys();
hideSnippetHelper(true);
var _3e=elById("idSnippetSelect").selectedIndex;
if(_3e>-1){
replaceWithSnippet(elemSnippetHelperTarget,sSnippetHelperSToReplace,rgSnippet[_3e].text);
}
return cancel(e);
}
function handleSnippetHelperCancel(e){
KeyManager.deactivateHotKeys();
hideSnippetHelper(true);
return cancel(e);
}
function handleSnippetSelectKeypress(e){
if(getKeyCode(e)==13){
return handleSnippetHelperOK(e);
}else{
if(getKeyCode(e)==27){
return handleSnippetHelperCancel(e);
}
}
}

