
/////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004-2005 SumTotal Systems, Inc. All rights reserved.
//
// The copyright to the computer software herein is proprietary and remains
// the property of SumTotal Systems, Inc. It may be used and/or copied only with
// the written consent of SumTotal Systems, Inc. or in accordance with the terms and
// conditions stipulated in the agreement/contract under which this software
// has been supplied.
//
// $Id: LMS_Training.js,v 1.10 2006/03/01 13:18:38 rajad Exp $
// $Date: 2006/03/01 13:18:38 $
// $RCSfile: LMS_Training.js,v $
// $Revision: 1.10 $
//
// Abstract:
//
//    Entry page for Activity Detail
//
// Revision History:
//
//    2004-02-27   Abhishek Gupta      Created File
//    2004-02-27   Prashantha Sawhney  Created File
//
/////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////
//
// Function Name :LMS_Learner_Launch
//
// Parameters    :nActivityId, nRegId, nAttemptId
//
// Return        :
//
// Synopsis      : Launch the activity
//
/////////////////////////////////////////////////////////////////////////////
function LMS_Learner_Launch(nActivityId, nRegId, nAttemptId, nLaunchMtd)
{
    //Added for CFR Transaction ID generation
    _UTL_CreateCFRTxnID();
    
    var strURL = "";

	//
	// This variable iDisplayMode determines if the display is a pop-up or a full-screen.
	// iDisplayMode = 0 determines a pop-up screen
	// iDisplayMode = 1 determines a full-screen
	//
	var iDisplayMode = null;

	 if ( nLaunchMtd == -21 ){
		strURL  =   _UTL_GetPagePath("management/LMS_CNT_LaunchSession.asp?EventID=" ) + nActivityId.toString();
		strURL      +=  "&SessionID=" + nActivityId.toString();
		strURL      +=  (nRegId == null) ? "" : "&RegId=" + nRegId.toString();
			
	 }else{ 
    strURL  =   _UTL_GetPagePath("management/LMS_CNT_LaunchCourse.asp?UserMode=0&ActivityID=") + nActivityId.toString();
    strURL      +=  (nRegId == null) ? "" : "&RegId=" + nRegId.toString();
    strURL      +=  (nAttemptId == null) ? "" : "&AttemptId=" + nAttemptId.toString();
		strURL      +=  "&EventID=" + nActivityId.toString()
	 }


    if ( typeof(nLaunchMtd) == "undefined" || nLaunchMtd == null )
    {
        window.location.href = strURL;
    }
    else
    {
        //
        // If KDOC launch in place
        //
		if (nLaunchMtd == -21)
		{
		     _UTL_OpenWindow(strURL+ "&CabFile=2");
		}else if ( nLaunchMtd == -22 )
        {
               iDisplayMode  = 0;
	       strURL		 +=  "&DisplayMode=" + iDisplayMode;
            _UTL_OpenWindow(strURL, "KDOC_" + String(nActivityId), 750, 550, "resizable=yes,scrollbars=yes,")
        }
        else
        {
               iDisplayMode = 1;
	        strURL		 +=  "&DisplayMode=" + iDisplayMode; 
            window.location.href = strURL;
        }

    }

}

////////////////////////////////////////////////////////////////////////////
//
// Function Name :LMS_Learner_ViewEvals
//
// Parameters    :nActivityId, strUserMode
//
// Return        :
//
// Synopsis      : View the Evaluations
//
/////////////////////////////////////////////////////////////////////////////

function LMS_Learner_ViewEvals(nActivityId, strUserMode, strCaller, strDispMode)
{
    var iPopup = 0;
	var strURL = _UTL_GetPagePath("management/LMS_Evaluation.asp?UserMode=" + strUserMode + "&ActivityId=") + nActivityId.toString();
    if ( typeof(strCaller) != "undefined" && typeof(strCaller) != null)
            strURL += "&CallerPg=" + strCaller ;

	if (typeof(strDispMode) == "undefined" || typeof(strDispMode) == null) iPopup = 0
	else if (strDispMode == '1') iPopup = 1			//popup window
	else iPopup = 0;								//inline window

	if (iPopup == 1)
	{
		var strRetVal = _UTL_OpenModalWindow(_UTL_GetCorePagePath("SYS_ModalDialog.asp") + "?Path=" + escape(strURL + "&DispMode=1"));
	} else
    window.location.href = strURL;


}

////////////////////////////////////////////////////////////////////////////
//
// Function Name : LMS_Learner_GoToCol
//
// Parameters    : strCollCenterID, strUserMode
//
// Return        :
//
// Synopsis      : Go to Collaboration Centre
//
/////////////////////////////////////////////////////////////////////////////

function LMS_Learner_GoToCol(strCollCenterID, strUserMode ) {

    var strURL = _UTL_GetPagePath("management/ACC_Interaction.asp?UserMode=" + strUserMode + "&ExchangePK=") + strCollCenterID;

    window.location.href = strURL;

}

////////////////////////////////////////////////////////////////////////////
//
// Function Name : LMS_Learner_ShowProgressReport
//
// Parameters    : nActivityId, strUserMode
//
// Return        :
//
// Synopsis      : Go to Progress Report Page
//
/////////////////////////////////////////////////////////////////////////////

function LMS_Learner_ShowProgressReport(nAttemptID, strUserMode)
{

    var strURL = _UTL_GetPagePath("management/LMS_ProgDtl.asp?UserMode=" + strUserMode + "&AttemptPK=") + nAttemptID ;
    if ( typeof(g_strCallerURL) != "undefined" && typeof(g_strCallerURL) != null)
        strURL += "&CallerURL=" + escape(g_strCallerURL); 
    window.location.href = strURL; 
             
}

////////////////////////////////////////////////////////////////////////////
//
// Function Name : LMS_Learner_ShowDiplomaReport
//
// Parameters    : nAttemptID,nActivityId, strUserMode
//
// Return        :
//
// Synopsis      : Go to Completion Diploma Report Page
//
/////////////////////////////////////////////////////////////////////////////

function LMS_Learner_ShowDiplomaReport(nAttemptID, nActID, strUserMode)
{
    var strWindowName = "Activity Reports";

    var strURL = _UTL_GetPagePath("management/LMS_ActReports.asp?ActId=" + nActID + "&UserMode=" + strUserMode + "&Mode=1&AttemptId=") + nAttemptID ;

    _UTL_OpenModalWindow(_UTL_GetCorePagePath("SYS_ModalDialog.asp") + "?Path=" + escape(strURL), strWindowName);
             
}




