<%@ page info="Sync Buttons" language="java" %> 
<%@page contentType="text/html;charset=UTF-8"%>
<%--
 ******************************************************************************* 
 * $RCSfile: Buttons.jsp,v $
 *
 * Description: This file contains the left frame of the APOC Manager, the 
 *              navigation frame.
 *
 * 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.SyncButtonsViewBean">

    <cc:header pageTitle="APOC.sync.title" copyrightYear="2005"
        baseName="com.sun.apoc.manager.resource.apoc_manager"
        bundleID="apocBundle"
        isPopup="true">

        <script type="text/javascript" src="/apoc/js/MainWindow.js"></script> 

        <script type="text/javascript">
        <!--
            function triggerSync() {
                var resultsForm     = top.results.document.ResultsForm;
                resultsForm.action = "/apoc/manager/SyncResult?SyncResult.SyncButton=a";
                resultsForm.submit();
                return false;
            }

            function triggerReset() {
                var resultsForm     = top.results.document.ResultsForm;
                var elementRunner   = 0;

                // iterate over every SelectionCheckbox;jato_boolean;LeftIdHidden;RightIdHidden set in all tables
                while (resultsForm.elements[elementRunner]!=null) {
                    // find begin of one quadruple
                    if (resultsForm.elements[elementRunner].name.indexOf("SelectionCheckbox")!=-1) {
                        resultsForm.elements[elementRunner].checked=false; 
                        elementRunner+=3; // skip non-checkboxes
                    }
                    elementRunner++;
                }

                top.results.enableSync(false);
                top.results.enableReset(false);
                
                return false;
            }
        // -->
        </script>  

        <cc:form name="ButtonsForm" method="post">

<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
    <td valign='bottom'>
    </td>
    <td align="right" nowrap="nowrap" valign="bottom">
        <div class="TtlBtnBtmDiv">
            <cc:button  name="Sync" 
                        bundleID="apocBundle"
                        type="secondary"
                        title="APOC.sync.sync.help"
                        defaultValue="APOC.sync.sync.button"
                        onClick="javascript:allowSubmit(false); triggerSync(); return false;"
                        tabIndex="1"
                        disabled="true"/> 
            <cc:button  name="Reset" 
                        bundleID="apocBundle" 
                        type="secondary" 
                        title="APOC.sync.reset.help"
                        defaultValue="APOC.sync.reset.button" 
                        onClick="javascript:allowSubmit(false); triggerReset(); this.disabled='disabled'; this.className='Btn2Dis'; return false;" 
                        tabIndex="2"
                        disabled="true"/> 
            <cc:button  name="Cancel" 
                        bundleID="apocBundle" 
                        title="APOC.sync.cancel.help"
                        type="secondary" 
                        defaultValue="APOC.button.cancel" 
                        onClick="top.window.close(); return false;" 
                        tabIndex="3" /> 
        </div>
    </td>
</tr>
</table>

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

