<%@  page pageEncoding="utf-8" contentType="text/html;charset=utf-8" import="com.novell.webaccess.common.JSPConduit, com.novell.emframe.dev.eMFrameUtils" %>
<%   JSPConduit c = JSPConduit.getJSPConduit(request);

  /* **************************************************************************
%name: CfgWizCollectionsToUpdate.js %
%version: 1 %
%date_modified: Wed Jun 19 02:52:04 2002 %
Copyright (c) 2001, 2002 Novell, Inc. All Rights Reserved.
THIS WORK IS AN UNPUBLISHED WORK AND CONTAINS CONFIDENTIAL PROPRIETARY
AND TRADE SECRET INFORMATION OF NOVELL, INC. ACCESS TO THIS WORK IS
RESTRICTED TO (I) NOVELL, INC. EMPLOYEES WHO HAVE A NEED TO KNOW HOW
TO PERFORM TASKS WITHIN THE SCOPE OF THEIR ASSIGNMENTS AND (II)
ENTITIES OTHER THAN NOVELL, INC. WHO HAVE ENTERED INTO APPROPRIATE
LICENSE AGREEMENTS. NO PART OF THIS WORK MAY BE USED, PRACTICED,
PERFORMED COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED,
CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, TRANSFORMED
OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF NOVELL, INC. ANY USE
OR EXPLOITATION OF THIS WORK WITHOUT AUTHORIZATION COULD SUBJECT THE
PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY.
***************************************************************************  */

  /* -------------------------------------------  */
  /* Puts the initial input focus into the page.  */
  /* -------------------------------------------  */%>
function setFocusAndInitializeForm()
{
	<%/* This function works on the main form.  */%>
	with (getMainWizForm())
	{
		var	aCaptionData;
		var	oNavData;

		<%/* Perform initializations common to all panels.  */%>
		initializePanel_Common();

		<%/* Set up input values  */
       /*-- get the selected indexes for the install modules and select them -- */%>
       var initialDisableNext = true;
        var aSelectedCollections = unpack( "<%= c.var("CfgWiz.SelectedCollectionsToUpdate") %>" );
        if ( aSelectedCollections != null )
        {
            for ( var i = 0; i < aSelectedCollections.length; i++ )
            {
                CollectionsToUpdate[ aSelectedCollections[i] ].selected = true;
                initialDisableNext = false;
            }
        }

		<%/* Finally, force the caption frame...  */%>
		aCaptionData = new Array();
		aCaptionData["Wiz_Banner_Text"]     = "<%= c.toScript(c.string("CfgWiz.Wizard.Title")) %>";
	 	aCaptionData["Wiz_Banner_ShowHelp"] = false;
		aCaptionData["Wiz_Header_Size"]     = 1;
		aCaptionData["Wiz_Header_Big_0"]    = true;
		aCaptionData["Wiz_Header_Bold_0"]   = true;
		aCaptionData["Wiz_Header_Icon_0"]   = "<%= c.getModulesUrl() %>/fw/images/wiz_SnapinIcon.gif";
		aCaptionData["Wiz_Header_Item_0"]   = "<%= c.toScript(c.string("CfgWiz.Collection.Title")) %>";

		parent.window.Wiz_BannerFrame.updateCaption( aCaptionData );

		<%/* ...and navigation frame to update with settings  */
		  /* ...appropriate for this panel.                   */%>
		oNavData               	= new Object();
		oNavData.disableFinish 	= true;
		oNavData.disableBack 	= false;
		oNavData.disableNext 	= initialDisableNext;
		parent.window.Wiz_NavigationFrame.updateNavigation( oNavData );

		<%/*-- set focus to the first input on the page -- */%>

	} <%/* with  */%>
} <%/* setFocusAndInitializeForm  */

  /* -----------------------------------------------------  */
  /* Called when the help button is pressed on this panel.  */
  /* -----------------------------------------------------  */%>
function showHelp()
{
	runHelp( "todo.html" );
} <%/* showHelp  */%>


<%/* ---------------------------------------------------------------------  */
  /* Selects or deselects all options in the Collections select box         */
  /* ---------------------------------------------------------------------  */%>
function selectAllCollections( select )
{
    <%/* This function works on the main form.  */%>
    with (getMainWizForm())
    {
        for ( var i=0; i < CollectionsToUpdate.length; i++ )
        {
            CollectionsToUpdate[ i ].selected = select;
        }
    }
    if ( select == true )
        disableNextBtn( false );
    else
        disableNextBtn( true );

}

function udpateNextBtnStatus()
{
    var oneSelected = false;

    <%/* This function works on the main form.  */%>
    with (getMainWizForm())
    {
        for ( var i=0; i < CollectionsToUpdate.length; i++ )
        {
            if ( CollectionsToUpdate[ i ].selected == true )
            {
                oneSelected = true;
                break;
            }
        }
    }

    disableNextBtn( !oneSelected );
}

function disableNextBtn( disable )
{
    var oNavData;
    oNavData               	= new Object();
    oNavData.disableFinish 	= true;
    oNavData.disableBack 	= true;
    oNavData.disableNext 	= disable;

    parent.window.Wiz_NavigationFrame.updateNavigation( oNavData );
}


<%  /* ----------------------------------------------------------------  */
  /* Validates the selected server information when one of the backup  */
  /* push buttons is pressed.                                          */
  /* ----------------------------------------------------------------  */%>
function validateForm_PerPanel()
{
	<%/* This function works on the main form.  */%>
	with (getMainWizForm())
	{
		var	sPB;

		<%/*-- save off values to pass to other pages -- */%>
        var selArray = new Array();
        var dstIndex = 0;
        var selIndex = CollectionsToUpdate.selectedIndex;
        if ( selIndex != -1 )
        {
            <%/*-- Handle multiple selection by extracting each selected item. -- */%>
            var theSelectLen = CollectionsToUpdate.length;
            for ( srcIndex = theSelectLen - 1, dstIndex; srcIndex >= 0; srcIndex-- )
            {
                if ( CollectionsToUpdate[ srcIndex ].selected == true )
                {
                    <%/*-- Add this item to the array. -- */%>
                    selArray[ dstIndex++ ] = srcIndex ;
                }
            }
        }
        SelectedCollectionsToUpdate.value = pack( selArray );


		  <%/* Validate which push button was pressed.  */%>
		sPB = getPBClicked();
		if ("WizPB_Back" == sPB)
		{
			performBack();
			return( false );
		} <%/* if  */%>
		if ("WizPB_Close" == sPB)
		{
			<%/* Return true so that the form gets submitted and the  */
			  /* plug-in gets a chance to cleanup.                    */%>
			return( true );
		} <%/* if  */%>
		if ("WizPB_Next" != sPB)
        {
			alert( "<%= c.toScript(c.string("CfgWiz.InternalError.UnknownPB")) %>" );
			return( false );
		} <%/* if  */


		  /* Returning true will cause the form to be submitted.  */%>
		return( true );
	} <%/* with  */%>
} <%/* validateForm_PerPanel  */



						     /* * * * * * *  */
                             /* End of File  */
                             /* * * * * * *  */%>
