<html>
<head>
<title>
-if -param ucm_context rebase
Rebase Progress
-else
Deliver Progress
-endif
</title>

<!-- Include components common to every page -->
-include pages Head.inc

<script language="Javascript">

//
// This needed by toolbar frame to start the integration in the appropriate
// context
//
var RPC =
-if -param ucm_context rebase
-jsquote -rebase_rpc
-else
-jsquote -deliver_rpc
-endif
;

//
// The stream associated to the current sessions *development* view
// (the current session will always be the development view).  Unused
// in a rebase context.
//
var devStream = 
-if -param ucm_context deliver
-jsquote -stream
-else
""
-endif
;

//
// The activities selected to deliver - unused in a rebase context
//
var deliverActivities = 
-if -param ucm_context deliver
-deliver_selected_activities
-else
""
-endif
;

//
// The session preferences for deferload and automerge.  These need to come before
// UCMConstants.js, as there are references to those variables in that package.
//
var session_deferload =
-deferload
;

var session_automerge =
-automerge
;

//
// Variables required by the controller
//

var session =
-if -param ucm_context deliver
-jsquote -integration_session
-else
-jsquote -session
-endif

var workroot =
-if -param ucm_context deliver
-jsquote -integration_workroot
-else
-jsquote -workroot
-endif

//
// The toolbar script (Integration.js) depends upon this declaration
//
var appletDeclaration = 
-jsquote -applet com.rational.ccweb.client.UCMApplet CCWebClient ccwebcl 'width="0"' 'height="0"' 'name="ucmApplet"' MAYSCRIPT

function helpCallback()
{
    var helpfile = 
-if -param ucm_context rebase
  -jsquote -url help "rebase_status.htm"
-else
  -jsquote -url help "deliver_status.htm"
-endif 
  ;

  openHelp(helpfile);
}

</script>

<script language="Javascript" 
    src=
    -quote -url scripts popLeftMenu.js
>
</script>

<script language="Javascript" 
    src=
    -quote -url scripts ProcessPageToolbar.js
>
</script>

<script language="Javascript" 
    src=
    -quote -url pages Integration/UCMConstants.js
>
</script>

<script language="Javascript" 
    src=
    -quote -url scripts MergeElement.js
>
</script>

<script language="Javascript" 
    src=
    -quote -url pages Integration/IntegrationList.js
>
</script>

<script language="Javascript" 
    src=
    -quote -url pages Integration/Transcript.js
>
</script>

<script language="Javascript" 
    src=
    -quote -url pages Integration/Integration.js
>
</script>

<script language="Javascript">

// *****************************************************************************
// controller
//
// The UI controller object, which lives in the toolbar frame.  We initialize it,
// as code outside of the toolbar frame context needs to tickle the controller 
// from time to time (and only have access to this frameset).  Change this variable
// name, and you will need to track down references to it in the Integration
// Javascript directory.
//
//
// *****************************************************************************
var controller = null;

// *****************************************************************************
// setWindowStatus
//
// Function called by column headers "mouseOver", "mouseOut".
//
// *****************************************************************************
setWindowStatus = function(
    text
)
{
    if (setWindowStatus.arguments.length == 0)
        window.status = '';
    else
        window.status = text;

    return true;
}

// *****************************************************************************
// onSelectAll
//
// Called by the toolbar Select All link, as defined in ProcessPageUtils (included
// in toolbar frame document).
//
// *****************************************************************************
function onSelectAll()
{
    controller.onSelectAll();
}

// *****************************************************************************
// onSelectNone
//
// Called by the toolbar Select None link, as defined in ProcessPageUtils (included
// in toolbar frame document).
//
// *****************************************************************************
function onSelectNone()
{
    controller.onSelectNone();
}

// *****************************************************************************
// makeEmptyListingDoc
//
// Create the listing frame doc, which will be replaced dynamically.
//
// *****************************************************************************
function makeEmptyListingDoc()
{
    var s = '<html>' +
            '<body bgcolor="#ffffff">' +
            '</body>' +
            '</html>';
    return s;
}

// *****************************************************************************
// resizeEvent
//
// Called when NN4 gets a resize event
//
// *****************************************************************************
function resizeEvent(e)
{ 
    if (is_nn4 == true) {
        //Unfortunately, there is no alternative to re-loading the page
        top.history.go(0);
    }
}

// *****************************************************************************
// getUCMApplet
//
// *****************************************************************************
function getUCMApplet()
{
    var doc = toolbarFrame.document;

    if (doc.applets.length >= 1) {
        var applet = doc.applets["ucmApplet"];
        if (applet) {
            return applet;
        }
        else {
            return null;
        }
    }

    return null;
}

// *****************************************************************************
// startIntegration
//
// It may take a while for the applet to initialize, so poll one of its methods
// until it responds as "defined".  Then update the controller with the reference.
//
// *****************************************************************************
var try_count = 0;
function startIntegration()
{
    var theApp = getUCMApplet();

    if (theApp && (!is_ie || typeof theApp.cancelStreamInProgress != "undefined")) {
        if (is_nn4 == true) {
            // In Netscape 4, capture all resize events in order
            // to refresh frames when resized.
            top.window.onResize = resizeEvent;
            top.window.captureEvents(Event.RESIZE);
        }

        // Put the deliver/rebase in motion
        controller.applet = theApp;
        controller.startIntegration();
        return;
    }

    try_count++;
    if (try_count == 60) {
        alert("Cannot start or script UCM Deliver/Rebase applet!");
    }
    else {
        // try again in 1 second
        setTimeout("startIntegration()", 1000);
    }
}

// *****************************************************************************
// onLoad
//
// *****************************************************************************
function onLoad() {

    //
    // Make an empty listing document
    //
    listingFrame.document.write('<html><body bgcolor="#ffffff"></body></html>');
    listingFrame.document.close();
 
    // 
    // Create the integration controller object.  This will create the toolbar and
    // listing document as well.
    //
    controller = new Integration(
                    baseURL,
                    session,
                    workroot,
                    toolbarFrame,
                    listingFrame,
-if -param ucm_context rebase
                    "rebase",
-else
                    "deliver",
-endif
                    top.RPC,
                    session_deferload,
                    session_automerge,
                    devStream,
                    deliverActivities);

    //
    // The toolbar frame contains an applet that needs to talk back
    // to the controller.  It can only do so if the reference to
    // that controller is in same window as the applet definition
    //
    toolbarFrame.controller = controller;

    //
    // Start the integration
    //
    startIntegration();
}

// *****************************************************************************
// onUnLoad
//
// The frameset onUnload event handler.
//
// *****************************************************************************
function onUnload ()
{
      if (toolbarFrame.document.applets.length > 1)
            toolbarFrame.document.applets["ucmApplet"] = null;
}

</script>

</head>

<!-- nyi: dynamically size the frames. -->

-if -browser NNAV 4 7

// <frameset  id="theFrameset" rows="267,*" frameborder="no" border="0" framespacing="0"    // abs modify - delete
//          onLoad="onLoad()" onUnload="onUnload()">                                        // abs modify - delete

   <frameset  id="theFrameset" rows="267,*" frameborder="no" border="0" framespacing="0"    // abs modify - add
            onLoad="onLoad()" onUnload="onUnload()">                                        // abs modify - add                                    

    <frame name=toolbarFrame
        src="javascript:void 0"
        scrolling="no"
        noresize
        marginheight="0"
        marginwidth="0"
        leftmargin="0"
        topmargin="0">

    <frame name=listingFrame 
        src="javascript:void 0"
        scrolling="auto"
        marginheight="0"
        marginwidth="0"
        leftmargin="0"
        topmargin="0">

                                                                                      // abs modify - add start
    <frame name=abslistingFrame 
        src="clearweb.exe?init_view"
        scrolling="auto"
        marginheight="0"
        marginwidth="0"
        leftmargin="0"
        topmargin="0">
                                                                                      // abs modify - add end

</frameset>

-else

// <frameset  id="theFrameset" rows="252,*" frameborder="no" border="0" framespacing="0"    // abs modify - delete
//          onLoad="onLoad()" onUnload="onUnload()">                                        // abs modify - delete

   <frameset  id="theFrameset" rows="252,*" frameborder="no" border="0" framespacing="0"    // abs modify - add
            onLoad="onLoad()" onUnload="onUnload()">                                        // abs modify - add  

    <frame name=toolbarFrame
        scrolling="no"
        noresize
        marginheight="0"
        marginwidth="0"
        leftmargin="0"
        topmargin="0">

    <frame name=listingFrame 
        scrolling="auto"
        marginheight="0"
        marginwidth="0"
        leftmargin="0"
        topmargin="0">

                                                                                      // abs modify - add start
    <frame name=abslistingFrame 
        src="clearweb.exe?init_view"
        scrolling="auto"
        marginheight="0"
        marginwidth="0"
        leftmargin="0"
        topmargin="0">
                                                                                      // abs modify - add end

</frameset>

-endif

</html>
