home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2005 July & August
/
PCWorld_2005-07-08_cd.bin
/
komunikace
/
netscape
/
nsb-install-8-0.exe
/
chrome
/
aim.jar
/
content
/
aim
/
InviteAFriendWizard.js
< prev
next >
Wrap
Text File
|
2004-12-02
|
4KB
|
138 lines
var InviteScreenName = "";
var inviteMsg = "";
var numHits = null;
var queryEmailAddress = null;
var containerArray = new Array();
var wizardMap = {
InviteAFriend1: { previous: null, next:"InviteAFriend1_5", finish: false },
InviteAFriend1_5: { previous: "InviteAFriend1", next: null, finish: false },
InviteAFriend2: { previous: "InviteAFriend1", next:null, finish: true },
InviteAFriend3: { previous: "InviteAFriend1", next:null, finish: true },
InviteAFriend3_5: { previous: "InviteAFriend1", next:null, finish: true },
InviteAFriend5: { previous: "InviteAFriend1", next:null, finish: true },
}
var profName = "";
var profDir = "";
var wizardManager = null;
function InviteWizardOnload() {
if (window.arguments[0])
{
InviteScreenName=window.arguments[0];
}
if (window.arguments[1])
inviteMsg = window.arguments[1];
}
function Startup( startPage, frame_id )
{
if( frame_id == "" ) {
dump("Please supply a content_frame ID!");
return false;
}
wizardManager = new WizardManager( frame_id, null, null, wizardMap );
wizardManager.URL_PagePrefix = "chrome://aim/content/";
wizardManager.URL_PagePostfix = ".xul";
wizardManager.SetHandlers( onNext, null, onFinish, onCancel, null, null );
wizardManager.LoadPage( startPage, false );
}
function onCancel()
{
window.close();
}
function onFinish()
{
if( !wizardManager.wizardMap[wizardManager.currentPageTag].finish )
return;
window.close();
}
function onNext()
{
var tag = wizardManager.WSM.GetTagFromURL( wizardManager.content_frame.src, "/", ".xul" );
wizardManager.WSM.SavePageData( tag, null, null, null );
var inputemail = wizardManager.WSM.PageData["InviteAFriend1"].emailaddress.value;
if(inputemail == null)
return;
if (checkvalidemail())
{
var curPageTag = wizardManager.wizardMap[wizardManager.currentPageTag];
wizardManager.WSM.SavePageData( curPageTag, null, null, null );
var nextPageTag = wizardManager.wizardMap[wizardManager.currentPageTag].next;
wizardManager.LoadPage( nextPageTag, false );
wizardManager.ProgressUpdate( ++wizardManager.currentPageNumber );
}
}
var invCallback = new Object();
invCallback.OnSendInviteComplete = function(emailaddr)
{
var invitedate= new Date();
AddToInviteList(emailaddr, invitedate);
parent.wizardManager.LoadPage('InviteAFriend2',false);
}
invCallback.OnSendInviteError = function(emailaddr,pErrMsg)
{
if (pErrMsg) {
parent.wizardManager.LoadPage('InviteAFriend5',false);
parent.document.getElementById('header').setAttribute('description',pErrMsg);
return;}
parent.wizardManager.LoadPage('InviteAFriend3',false);
}
function checkvalidemail()
{
var email=parent.wizardManager.WSM.PageData.InviteAFriend1.emailaddress.value;
var isValid=checkInputEmail(email);
return isValid;
}
function cmdInviteBuddy()
{
var pIIMManager = aimManager();
if (!pIIMManager)
{
return;
}
var pIInviteManager=aimInviteManager();
if (!pIInviteManager)
{
return;
}
var InviteAddress=parent.wizardManager.WSM.PageData.InviteAFriend1.emailaddress.value;
var InviteMessage=parent.wizardManager.WSM.PageData.InviteAFriend1.greeting.value;
try{
pIInviteManager.SendInvite(invCallback, InviteAddress, InviteMessage);
}
catch (ex) {
parent.wizardManager.LoadPage('InviteAFriend1',false);
}
}