2025-04-27 07:49:33 -04:00

799 lines
25 KiB
Plaintext

<html>
<head>
#include "header.inc"
#include "debug_js.inc"
#include "constants.inc"
<TITLE id="idTitle" name="idTitle">REMOTE_ASSISTANCE_INVITE</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="MSThemeCompatible" content="Yes">
<LINK id="UI_StyleSheet1" REL="STYLESHEET" TYPE="text/css" HREF="../../Css/rcBuddy.css">
<LINK id="UI_StyleSheet2" REL="stylesheet" TYPE="text/css" HREF="hcp://system/css/shared.css">
<Script id="idScript1" name="idScript1" language="javascript">
/*
* Localizable constants, text and messages
*/
var L_SENDFAIL2_Text = "\n\nClick 'OK' if you would like to save the invitation and send it to your friend yourself.";
var L_INVALID_EXP_TIME_Text = "Remote Assistance properties have been set such that invitations cannot remain open for more than ";
var L_INVALID_EXP_TIME2_Text = ".\n\nThe invitation has been reset to expire at the maximum limit of ";
var L_INVALID_EXP_TIME3_Text = "; if you want, you can select a lesser amount of time.";
var L_MIN_Text = " Mins";
var L_HR_Text = " Hours";
var L_DAY_Text = " Days";
//*****************************************************************************************//
// Content to be added to the email along with the incident object
//*****************************************************************************************//
var L_SUBJECT_Text = "YOU HAVE RECEIVED A REMOTE ASSISTANCE INVITATION FROM: ";
var L_LINE1_Text = " would like your assistance.A personal message may be included below.\n\n";
var L_SENDER_Text = "Request sent by :\t"; // + sender name
var L_EXPIRY_Text ="Request Expires :\t"; // + <Aug 29th. 18:54; 60 Minutes>
var L_DESCRIPTION_Text ="You can easily provide assistance from your computer by following the instructions at:\n\n";
var L_NOTE_Text = "\n\n\nCaution:\n\n\x2A Accept invitations only from people you know and trust.\n\x2A E-mail messages can contain viruses or other harmful attachments.\n\x2A Before opening the attachment, review the security precautions and information at the above address.\n\nPersonal message:\n";
//*****************************************************************************************//
var L_ERRACCESSDENIED_Text = "Directly launching this page is not allowed. ";
var oChannel = null;
var oRCSession = null;
var XMLFile="";
var oInc=null;
var oItem="";
var oSmapi = null;
var sExpiry = "";
var IncidentFile ="";
var tempflag=0;
function onLoad()
{
TraceFunctEnter("onLoad");
try
{
if( null == parent.OnLoad || parent.g_bRAStart == null )
{
idBody.style.visibility = "hidden";
window.navigate( "hcp://CN=Microsoft%20Corporation,L=Redmond,S=Washington,C=US/Remote%20Assistance/Escalation/Common/rcscreen1.htm" );
return;
}
if (parent.ResendFlag)
{
if (parent.tempPassStatus)
{
idchkpassword.checked=true;
idPassword.value="**********";
idConfirm.value="**********";
tempflag=1;
}
else
{
idchkpassword.checked=false;
PasswordState();
}
var time=parent.tempTime;
if (time>59 && time<1381)
{
idSelectUnits.selectedIndex=1;
UpdateCombo();
idSelectValues.selectedIndex=((time/60)-1);
}
if(time<60)
{
idSelectUnits.selectedIndex=0;
UpdateCombo();
idSelectValues.selectedIndex=(time-1);
}
if(time>1380)
{
idSelectUnits.selectedIndex=2;
UpdateCombo();
idSelectValues.selectedIndex=((time/1440)-1);
}
}
else
{
//Loading the dropdown combo .....
idSelectUnits.selectedIndex=1;
UpdateCombo();
}
idSelectValues.focus();
}
catch(error)
{
alert(parent.L_RCCTL_Text);
return;
}
TraceFunctLeave();
}
function UpdateCombo()
{
TraceFunctEnter("UpdateCombo");
try
{
var col=new Enumerator(document.all("idSelectValues").tags("Option"));
for (;!col.atEnd();col.moveNext())
{
x=col.item();
idSelectValues.options.remove(x.index);
}
for (i=1;i<100;i++)
{
var oOption = document.createElement("OPTION");
oOption.id="Val"+i;
if (i<10)
{
oOption.text=" 0"+i+" ";
}
else
{
oOption.text=" "+i+" ";
}
oOption.value=i;
idSelectValues.options.add(oOption);
}
/*
//if the hour option is choosen
if (idSelectUnits.item(idSelectUnits.selectedIndex).value==2)
{
var col=new Enumerator(document.all("idSelectValues").tags("Option"));
for (;!col.atEnd();col.moveNext())
{
x=col.item();
idSelectValues.options.remove(x.index);
}
for (i=1;i<=23;i++)
{
var oOption = document.createElement("OPTION");
oOption.id="Val"+i;
if (i<10)
{
oOption.text=" 0"+i+" ";
}
else
{
oOption.text=" "+i+" ";
}
oOption.value=i*60;
idSelectValues.options.add(oOption);
}
}
//if the minute option is choosen
else if (idSelectUnits.item(idSelectUnits.selectedIndex).value==1)
{
var col=new Enumerator(document.all("idSelectValues").tags("Option"));
for (;!col.atEnd();col.moveNext())
{
x=col.item();
idSelectValues.options.remove(x.index);
}
for (i=1;i<=59;i++)
{
var oOption = document.createElement("OPTION");
oOption.id="Val"+i;
if (i<10)
{
oOption.text=" 0"+i+" ";
}
else
{
oOption.text=" "+i+" ";
}
oOption.value=i;
idSelectValues.options.add(oOption);
}
}
//if the days option is choosen
else
{
var col=new Enumerator(document.all("idSelectValues").tags("Option"));
for (;!col.atEnd();col.moveNext())
{
x=col.item();
idSelectValues.options.remove(x.index);
}
for (i=1;i<=30;i++)
{
var oOption = document.createElement("OPTION");
oOption.id="Val"+i;
if (i<10)
{
oOption.text=" 0"+i+" ";
}
else
{
oOption.text=" "+i+" ";
}
oOption.value=i*24*60;
idSelectValues.options.add(oOption);
}
}
*/
}
catch(error)
{
alert(parent.L_RCCTL_Text);
return;
}
TraceFunctLeave();
}
function PasswordState()
{
TraceFunctEnter("PasswordState");
try
{
if (idchkpassword.checked)
{
idPassword.disabled = false;
idConfirm.disabled = false;
}
else
{
idPassword.disabled = true;
idConfirm.disabled = true;
}
}
catch(error)
{
alert(parent.L_RCCTL_Text);
return;
}
TraceFunctLeave();
}
function OnClear()
{
TraceFunctEnter("OnClear");
try
{
if (parent.ResendFlag && tempflag==1)
{
idPassword.value="";
idConfirm.value="";
tempflag=0;
}
}
catch(error)
{
alert(parent.L_RCCTL_Text);
return;
}
TraceFunctLeave();
}
#ifdef RA_PROTOTYPE
function GetMailToTicket(oInc)
{
try {
var sTicket = oInc.RCTicket;
var sTmp;
var sIP;
var sURL = oInc.RCTicketEncrypted ? "1": "0";
var sAry = sTicket.split(",");
// Get IP Address.
sTmp = sAry[2];
i = sTmp.indexOf(";");
sIPold = sTmp.slice(0, i);
var o = new ActiveXObject("rcbdyctl.setting");
sIP = o.SquishAddress(sIPold);
// sIPNew = o.ExpandAddress(sIP);
sURL +="," + sIP;
sURL += "," + sAry[3] + "," + sAry[4];
} catch(e)
{
alert("Error: " + e.description);
}
return sURL;
}
#endif
function OnSend()
{
TraceFunctEnter("OnSend");
var sPass = "";
var sPassStub = "";
var oSetting = null;
var oSetting1= null;
var ip = null;
var sExpiry = "";
var oEnc =null;
var oDict;
var d;
var iNow;
var bSave;
try
{
if (oSmapi == null)
{
oSmapi = parent.GetMapi();
}
oSetting1 = new ActiveXObject( szProgIDSetting );
oInc = parent.pchealth.CreateObject_Incident();
if (parent.ResendFlag)
{
oItem = parent.tempStore;
XMLFile = oItem.XMLDataFile;
oInc.LoadFromXMLFile(XMLFile);
oSmapi.ClearRecipList();
oSmapi.AddRecipient(oItem.DisplayString);
}
else
{
XMLFile = oSetting1.GetUserTempFileName;
}
//close existing session if required...
if (parent.ResendFlag && oInc.Misc("Status")!=parent.L_EXPIREDSTATUS_Text)
{
var oSession = parent.pchealth.CreateObject_RemoteDesktopSession(0, oInc.RcTicket,"");
oSession.CloseRemoteDesktopSession();
oSession = null;
}
if (idchkpassword.checked)
{
if(idPassword.value.length ==0 && idConfirm.value.length ==0)
{
alert(parent.L_NOPASSWD_Text);
idPassword.focus();
return;
}
if (idPassword.value != idConfirm.value)
{
alert(parent.L_INVALIDPASS_Text);
idPassword.value="";
idConfirm.value="";
idPassword.focus();
return;
}
}
else // for Resend only, we need to clear up password if it's not choosen.
{
OnClear();
}
oSetting = new ActiveXObject( szProgIDEscalationSetting );
if (tempflag == 0) // for both scenario: new and resend (for resend: here means password get changed.)
{
//Encryption of the password if necessary.
if ((idchkpassword.checked) &&(idPassword.value.length > 0))
{
#ifndef RA_PROTOTYPE
try
{
var oEnc = parent.pchealth.CreateObject_Encryption();
sPassStub = oSetting.CreatePassword;
sPass = oEnc.EncryptString(idPassword.value, sPassStub);
sPass = (5+sPass.length) + ";PASS=" + sPass;
}
catch (error)
{
alert(parent.L_ENCRYPT_Text);
return;
}
#else
sPass = "Need pass";
#endif
}
}
else // (tempflag==1) for resend only. Keep using the old value.
{
if (oInc.Misc.Exists("PassStub"))
sPassStub=oInc.Misc("PassStub");
if (oInc.Misc.Exists("Pass"))
sPass=oInc.Misc("Pass");
}
iExpiry = idSelectValues.options[idSelectValues.selectedIndex].value;
if (idSelectUnits.item(idSelectUnits.selectedIndex).value==1)
iExpiry = iExpiry;
else if (idSelectUnits.item(idSelectUnits.selectedIndex).value==2)
iExpiry = iExpiry*60;
else
iExpiry = iExpiry*24*60;
var oRARegSetting = new ActiveXObject("RACplDlg.RARegSetting");
var nMaxTicketExpirySettingInMins = oRARegSetting.MaxTicketExpiry / 60;
if (nMaxTicketExpirySettingInMins < iExpiry)
{
var nUnitVal;
var nNumVal;
var wshShell = new ActiveXObject("WScript.Shell");
try { // check group policy value.
nUnitVal = wshShell.RegRead("HKLM\\Software\\policies\\Microsoft\\Windows NT\\Terminal Services\\MaxTicketExpiryUnits");
nNumVal = wshShell.RegRead("HKLM\\Software\\policies\\Microsoft\\Windows NT\\Terminal Services\\MaxTicketExpiry");
}
catch(e)
{
// Check control panel value
try {
nUnitVal = wshShell.RegRead("HKLM\\SYSTEM\\ControlSet001\\Control\\Terminal Server\\MaxTicketExpiryUnits");
nNumVal = wshShell.RegRead("HKLM\\SYSTEM\\ControlSet001\\Control\\Terminal Server\\MaxTicketExpiry");
} catch (e)
{
// use default
nUnitVal = 2;
nNumVal = 30;
}
}
var msg;
var sUnit = (nUnitVal==0?L_MIN_Text:(nUnitVal==1?L_HR_Text:L_DAY_Text));
msg = L_INVALID_EXP_TIME_Text + nNumVal + sUnit + L_INVALID_EXP_TIME2_Text + nNumVal + sUnit + L_INVALID_EXP_TIME3_Text;
alert(msg);
idSelectUnits.selectedIndex = nUnitVal;
idSelectValues.selectedIndex = nNumVal-1;
return false;
}
#ifdef RA_PROTOTYPE
parent.sTo = "mailto:";
parent.sFrom = "mailto:";
parent.sMsg = "(No message for mailto:)";
#endif
// Create the new RCSession
if (parent.Init(iExpiry * 60, sPass ) == false)
{
return false;
}
oRCSession = parent.oRCSession;
oChannel = parent.oChannel;
ip = oSetting.GetIPAddress;
if (ip==null || ip=="" || ip =="0.0.0.0")
{
alert(parent.L_NOIP_Text);
return;
}
//creating the incident object
sSalemID = oRCSession.ConnectParms;
oRCSession.OnConnected = parent.onCallBackConnect;
IncidentFile = oSetting1.GetUserProfileDirectory + "\\rcBuddy.MsRcIncident";
oInc.UserName = parent.sFrom;
oInc.ProblemDescription = parent.sMsg;
oInc.UploadType = 1;
oInc.RcTicket = sSalemID;
oInc.RCTicketEncrypted = (sPass != "");
#ifdef RA_PROTOTYPE
// Need to create password stuff here.
if (oInc.RCTicketEncrypted)
{
var sAry = sSalemID.split(",");
// Use session id as random string.
try
{
var oEnc = parent.pchealth.CreateObject_Encryption();
sPassStub = sAry[4];
sPass = oEnc.EncryptString(idPassword.value, sPassStub);
sPass = (5+sPass.length) + ";PASS=" + sPass;
}
catch (error)
{
alert(parent.L_ENCRYPT_Text);
return;
}
}
#endif
d = new Date();
iNow = Math.round(Date.parse(d)/1000);
oInc.Misc("DtStart")=iNow;
oInc.Misc("DtLength")=iExpiry;
oInc.Misc("PassStub")=sPassStub;
// Save incident OFF to an XML file
// 1. need to remove unnecessary fields for this sent out file.
if (oInc.Misc.Exists("Pass"))
oInc.Misc.Remove("Pass");
if (oInc.Misc.Exists("HelpCnt"))
oInc.Misc.Remove("HelpCnt");
if (oInc.Misc.Exists("Status"))
oInc.Misc.Remove("Status");
if (oInc.Misc.Exists("L"))
oInc.Misc.Remove("L");
if (oInc.Misc.Exists("IP"))
oInc.Misc.Remove("IP");
if (oInc.Misc.Exists("Method"))
oInc.Misc.Remove("Method");
// Check for modem connectivity
oInc.Misc.add("L", 0);
try
{
if( true == parent.pchealth.Connectivity.IsAModem )
{
oInc.Misc("L") = 1;
}
}
catch (e)
{
// do nothing, use default
}
oInc.GetXML(IncidentFile);
// save local reference file.
oInc.Misc.add("IP", ip);
oInc.Misc.add("Status", parent.L_ACTIVESTATUS_Text);
oInc.Misc.add("Pass", sPass);
#ifdef _HELPCNT
oInc.Misc.add("HelpCnt", 0);
#endif
oInc.GetXML(XMLFile);
d = new Date((iNow + iExpiry * 60) * 1000);
sExpiry = d.toLocaleString();
// Email the incident to the Expert
try
{
#ifdef RA_PROTOTYPE
var sHCP = "http://jperez01/test.htm#" + GetMailToTicket(oInc);
var L_Subject_Text = "Remote Assistance";
var L_Body_Text = ". Helper should click the link to start Remote Assistance. ";
// Need to escape '+' with '.' since it's reserved by mailto protocal.
var sTmp = sHCP.replace(/\+/g, ".");
var sMailTo = "mailto:?subject=" + L_Subject_Text + "&body=" + L_EXPIRY_Text + sExpiry + L_Body_Text + escape(sTmp);
idMailTo.href = sMailTo;
idMailTo.click();
#else
oSmapi.Logon();
oSmapi.Subject = L_SUBJECT_Text + parent.sFrom;
oSmapi.Body=oInc.UserName+L_LINE1_Text+L_DESCRIPTION_Text+"http://windows.microsoft.com/RemoteAssistance/RA.asp"+L_NOTE_Text+oInc.ProblemDescription;
oSmapi.AttachedXMLFile = IncidentFile;
oSmapi.SendMail();
#endif
try {
if (parent.ResendFlag)
{
oItem.URL = oInc.RcTicket;
}
else
{
oChannel.RecordIncident(parent.sTo, sSalemID, "", XMLFile);
}
#ifndef RA_PROTOTYPE
navigate("rcScreen7.htm?screen5");
#endif
}
catch (e)
{
alert(parent.L_RCCTL_Text);
return;
}
}
catch (error)
{
bSave = confirm( L_SENDFAIL2_Text);
if (!bSave)
{
try
{
// Close Session
oRCSession.CloseRemoteDesktopSession();
parent.oRCSession=null;
}
catch(error)
{
alert(parent.L_RCCTL_Text);
return;
}
}
else
{
DoSave(IncidentFile, XMLFile);
}
}
}
catch(error)
{
alert(parent.L_RCCTL_Text);
}
TraceFunctLeave();
}
/*
Function: DoSave()
Description : This function saves the invitation as a local file.
*/
function DoSave(ExpertFile, LocalFile)
{
TraceFunctEnter("DoSave");
var o =null;
var tFileName="";
var temp="";
var i;
/* Start to save this invitation file */
try
{
// Get file name
o = new ActiveXObject("SAFRCFileDlg.FileSave");
o.FileName = "RAInvitation.msrcincident";
o.FileType ="MsRcIncident Files(*.msrcincident)\0*.msrcincident\0";
if (o.OpenFileSaveDlg())
{
tFileName = o.FileName;
temp = tFileName.toLowerCase();
i = temp.lastIndexOf(".msrcincident");
if (i == -1 || i < temp.length - 13) // wrong extension
{
tFileName += ".msrcincident";
}
// Save file
o = new ActiveXObject("Scripting.FileSystemObject");
parent.sFileLoc=tFileName;
o.CopyFile(ExpertFile, tFileName, true);
oInc.Misc.add("Method", parent.L_FILE_Text);
oInc.GetXML(LocalFile);
if (parent.ResendFlag)
{
// save updated salem Ticket
oItem.URL = oInc.RcTicket;
}
else
{
// save ticket locally
oChannel.RecordIncident(tFileName, sSalemID, "", LocalFile);
}
navigate("rcScreen7.htm?screen9");
return true;
}
else
{
// Delete this session.
oRCSession.CloseRemoteDesktopSession();
parent.oRCSession = null;
// delete the saved local reference file.
var fso = new ActiveXObject("Scripting.FileSystemObject");
fso.DeleteFile(LocalFile);
}
}
catch(error)
{
alert(parent.L_RCCTL_Text);
}
TraceFunctLeave();
}
</script>
</head>
<BODY id="idBody" name="idBody" scroll="auto" onload="onLoad();" class="margin sys-rhp-bgcolor">
<table class="MaxLayout" id="idtableframe" name="idtableframe" cellpadding="16px" border=0>
<tr>
<td class="valignTop">
<TABLE id="RA_Table" name="RA_Table" class="MaxWidth" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD id="idTd1" name="idTd1" colspan="2">
<Span id="idMainTitle" name="idMainTitle" class="sys-font-heading3 sys-rhp-color-title">Remote Assistance - E-mail an Invitation</Span>
</TD>
</TR>
<TR>
<TD class="Height7" colspan="2">
</TD>
</TR>
<TR>
<TD id="idTd2" name="idTd2" colspan="2" class="sys-table-cell-bgcolor3">
<span id="idSubTitle1" name="idSubTitle1" class="sys-font-body-bold sys-color-body valignmiddle">&nbsp;&nbsp;Set the invitation to expire</span>
</TD>
</TR>
<TR>
<TD class="height8" colspan="2">
</TD>
</TR>
<TR>
<TD id="idTd3" name="idTd3" colspan="2">
<Span id="idText1" name="idText1" class="valignmiddle sys-font-body sys-color-body">To lessen the chance that someone fraudulently gains access to your computer you can limit the time in which a recipient can accept a Remote Assistance invitation. Specify the duration that this invitation will remain open.</Span>
</TD>
</TR>
<TR>
<TD class="Height8" colspan="2">
</TD>
</TR>
<TR>
<TD colspan=2>
<table cellspacing="0" cellpadding="0" class="" border="0">
<TR>
<TD class="Width5">
<SELECT id="idSelectValues" name="idSelectValues" class="sys-font-body sys-color-body" tabindex="1">
</SELECT>
</TD>
<TD class="Width5">
<Select id="idSelectUnits" name="idSelectUnits" class="sys-font-body sys-color-body" onChange="//UpdateCombo();" tabindex="2">
<option id="Unit1" value=1 >Minutes</option>
<option id="Unit2" value=2 selected>Hours</option>
<option id="Unit3" value=3 >Days</option>
</Select>
</TD>
</TR>
</table>
</TD>
</TR>
<TR>
<TD class="Height10" colspan="2">
</TD>
</TR>
<TR>
<TD id="idTd4" name="idTd4" colspan="2" class="sys-table-cell-bgcolor3">
&nbsp;<Input type="Checkbox" name="idchkpassword" id="idchkpassword" checked onclick="PasswordState();" tabindex="3"><Label id="idSubTitle2" name="idSubTitle2" For="idchkpassword" class="sys-font-body-bold sys-color-body valignmiddle">&nbsp;Require the recipient to use a password</Label>
</TD>
</TR>
<TR>
<TD class="Height8" colspan="2">
</TD>
</TR>
<TR>
<TD id="idTd5" name="idTd5" colspan="2">
<Span id="idText2" name="idText2" class="valignmiddle sys-font-body sys-color-body">For security reasons, it is strongly recommended that you set a password that
the recipient must use to connect to your computer. Do not use your network
or Windows logon password.</Span>
</TD>
</TR>
<TR>
<TD class="Height9" colspan="2">
</TD>
</TR>
<TR>
<TD id="idTd6" name="idTd6" class="width4">
<Span id="idTextPassword" name="idTextPassword" class="sys-font-body sys-color-body">Type password:</Span>
</TD>
<TD id="idTd7" name="idTd7" class="Width2">
<Span id="idTextConfirm" name="idTextConfirm" class="sys-font-body sys-color-body">Confirm password:</Span>
</TD>
</TR>
<TR>
<TD class="Height8" colspan="2">
</TD>
</TR>
<TR>
<TD class="width4">
<Input type="password" name="idPassword" id="idPassword" onkeydown="OnClear()" class="Width3 sys-font-body sys-color-body" tabindex="4">
</TD>
<TD class="Width2">
<Input type="password" name="idConfirm" id="idConfirm" onkeydown="OnClear()" class="Width15 sys-font-body sys-color-body" tabindex="5">
</TD>
</TR>
<TR>
<TD class="Height4" colspan="2">
</TD>
</TR>
<TR>
<TD colspan="2" id="idTD9" name="idTD9">
<span id="idText3" name="idText3" class="valignmiddle sys-font-body sys-color-body"><B>Important</B>&nbsp;&nbsp;You must communicate the password to the recipient.</span><P id="idP" name="idP">
<HR id="idTd8" name="idTd8" class="bordertype1 sys-toppane-color-border">
</TD>
</TR>
<TR>
<TD class="Height4" colspan="2">
</TD>
</TR>
<TR>
<TD colspan="2" id="idbtn" name="idbtn" align="right">
#ifdef RA_PROTOTYPE
<a name="idMailTo" id="idMailTo"></a>
<Button id="idbtnSend" name="idbtnSend" class="sys-font-body sys-color-body" onclick="OnSend();" tabindex="6">&nbsp;&nbsp;Send invitation&nbsp;&nbsp;</Button>&nbsp;&nbsp;
#else
<Button id="idbtnSend" name="idbtnSend" class="sys-font-body sys-color-body" onclick="OnSend();" tabindex="6">&nbsp;&nbsp;&nbsp;&nbsp;Send Invitation&nbsp;&nbsp;&nbsp;&nbsp;</Button>
#endif
</TD>
</TR>
</Table>
</td>
</TR>
</Table>
</Body>
</html>