<%@ page info="ProfilesImport" language="java" %> 
<%@page contentType="text/html;charset=UTF-8"%>
<%--
 ******************************************************************************* 
 * $RCSfile: Import.jsp,v $
 *
 * Description: This file contains the Group Import window of the APOC Manager
 *
 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
 * Use of this product is subject to license terms.
 *
 *******************************************************************************
 --%>
<%@taglib uri="/WEB-INF/tld/com_iplanet_jato/jato.tld" prefix="jato"%> 
<%@taglib uri="/WEB-INF/tld/com_sun_web_ui/cc.tld" prefix="cc"%>
<jato:useViewBean className="com.sun.apoc.manager.ProfilesImportViewBean">

<!-- Header -->
<cc:header  pageTitle="APOC.groupimport.title"
            bundleID="apocBundle"
            baseName="com.sun.apoc.manager.resource.apoc_manager"
            copyrightYear="2003"
            isPopup="true" 
            onLoad="javascript:onLoadAction()">

<script type="text/javascript">
<!--
var existingNames = "<cc:text name="ExistingNames"/>";
var overwrite = "<cc:text name="OverwriteAlert"/>";

var m_OpenerTop = top.opener;
while (m_OpenerTop.top.opener!=null) {
    m_OpenerTop = m_OpenerTop.top.opener;
}
m_OpenerTop = m_OpenerTop.top;

setInterval("setWindowHandle()", 1000);
function setWindowHandle() {
    m_OpenerTop.m_ImportWindow= top;
}

function onLoadAction() {
    <cc:text name="ConditionalJS" defaultValue="return true;" />
}

function isNameExisting() {
    var newName = document.forms[0]['filename'].value;
    var pos = newName.lastIndexOf("\\");
    if (pos == -1) {
        pos = newName.lastIndexOf("/");
    }

    if (pos != -1) {
        newName = newName.substring(pos + 1, newName.length);
    }
        
    var dotLoc = newName.lastIndexOf(".");
    if (dotLoc != -1) {
        newName = newName.substring(0, dotLoc);
    }

    var names = existingNames.split('|');
    for (i=0; i < names.length; i++) {
        if (newName == names[i]) {
            return true;
        }
    }
    return false;
}

// -->
</script> 

<jato:content name="ConditionalForm">

<!-- Secondary Masthead -->
<cc:secondarymasthead name="Masthead" bundleID="apocBundle" />

<!-- /apoc/jsp/UploadFile.jsp -->
<form action="../manager/ProfilesImport?ProfilesImport.TabHref=a"
      enctype="multipart/form-data" 
      method="post"
      target="importWindow"
      onSubmit="javascript:document.forms[0]['l10nFilename'].value=document.forms[0]['filename'].value; return true;" 
      name="importForm">

<jato:content name="DisplayAlert">
    <div class="content-layout">
        <BR>
        <cc:alertinline name="Alert" bundleID="apocBundle"/>
        <BR>
        <!-- 
            <cc:text name="StackTrace"/>
        -->
    </div>
</jato:content>

<!-- PageTitle -->
<cc:pagetitle name="ImportTitle" bundleID="apocBundle"
            pageTitleText="APOC.groupimport.title"
            pageTitleHelpMessage="APOC.groupimport.help"
            showPageTitleSeparator="true"
            showPageButtonsTop="false"
            showPageButtonsBottom="true">

<!-- non-lockhart code to implement the file upload facility -->
<table border="0" width="100%" cellpadding="0" cellspacing="0">
    <tr>
        <td><img src="/com_sun_web_ui/images/other/dot.gif" alt="" border="0" height="30" width="1" /></td>
    </tr>
    <tr>
        <td>
            <div class="MstDivUsr">    
                <span class="ChoLblTxt">
                    <label for="fileinput">
                        &nbsp;&nbsp;&nbsp;&nbsp;<cc:text name="ChooseText" bundleID="apocBundle"/>
                    </label>
                </span>
                &nbsp;&nbsp;
                <input type="hidden" name="l10nFilename" value="" /> 
                <input  name="filename" id="fileinput" type="file" 
                        onclick="javascript:setTimeout('switchStateImportButton()', 0)" 
                        onkeypress="javascript:setTimeout('switchStateImportButton()', 0)"
                        value="<cc:text name='DefaultValue' />"/>
            </div>
        </td>
    </tr>
</table>
</p>

</cc:pagetitle>

    <script type="text/javascript">
    <!--
    function switchStateImportButton() {
        var value = document.forms[0]['filename'].value;
        if(value == "") {
            document.forms[0]['ProfilesImport.ImportButton'].disabled=true;
            document.forms[0]['ProfilesImport.ImportButton'].className="Btn1Dis";
        } else {
            document.forms[0]['ProfilesImport.ImportButton'].disabled=false;
            document.forms[0]['ProfilesImport.ImportButton'].className="Btn1";
        }
    }

    switchStateImportButton()
    // -->
    </script> 

    
</form>

</jato:content>

</cc:header>
</jato:useViewBean>

