<%@ page info="ContentAreaPolicies" language="java" %> 
<%--
 ******************************************************************************* 
 * $RCSfile: Assignees.jsp,v $
 *
 * Description: 
 *
 * Copyright 2004 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"%>
<%@taglib uri="/WEB-INF/apoc.tld" prefix="apoc"%>

<jato:pagelet>
<jato:containerView name="Assignees">

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

<script type="text/javascript">
<!--
    function toggleMenu() {
        var nElementRunner=0;
        var nCheckedElements=0;
        var assignButton    = "ProfileWindow.TabContent.Assignees.AssignButton";
        var unassignButton  = "ProfileWindow.TabContent.Assignees.UnassignButton";
        
        while (document.ProfileForm.elements[nElementRunner]!=null) {
            if ( (document.ProfileForm.elements[nElementRunner].name.indexOf("SelectionCheckbox")!=-1)  && 
                 (document.ProfileForm.elements[nElementRunner].name.indexOf("jato_boolean") == -1) &&
                 (document.ProfileForm.elements[nElementRunner].checked==true) ) {
                nCheckedElements++;
            }
            nElementRunner++;
        }

        var bIsReadOnly = <cc:text name="JSReadOnly"/>;

        // enable "assign" button if no profile is selected
        ccSetButtonDisabled(assignButton, "ProfileForm", (bIsReadOnly||(nCheckedElements!=0)));
        // enable "unassign" button if at least one profile is selected
        ccSetButtonDisabled(unassignButton, "ProfileForm", (bIsReadOnly||(nCheckedElements==0)));
    }

    function submitBrowse(entityId, entityType) {
        document.ProfileForm['ProfileWindow.TabContent.Assignees.AssigneeEntityId'].value=entityId;
        document.ProfileForm['ProfileWindow.TabContent.Assignees.AssigneeEntityType'].value=entityType;
        document.ProfileForm.action="../manager/ProfileWindow?ProfileWindow.TabContent.Assignees.AssignHref=a"; 
        document.ProfileForm.submit(); 
    }

    function openBrowseTreeWindow() {
        openWindow(window, null, '/apoc/manager/BrowseTreeIndex?EntityId=<cc:text name="JSEntityId"/>&EntityType=<cc:text name="JSEntityType"/>&', 'TreeWindow', 500, 600, true); 
    }

// -->
</script>
<jato:content name="DisplayAlert">
    <div class="content-layout">
        <BR>
        <cc:alertinline name="Alert" bundleID="apocBundle"/>
        <BR>
        <!-- 
            <cc:text name="StackTrace"/>
        -->
    </div>
</jato:content>
<cc:pagetitle name="PageTitle" bundleID="apocBundle"
	pageTitleText="APOC.profilewnd.assignees.title" 
	showPageTitleSeparator="true"
	pageTitleHelpMessage="APOC.profilewnd.assignees.help"
	showPageButtonsTop="true"
	showPageButtonsBottom="false">
	
<br>

<!-- Action Table -->
<cc:actiontable
	name="ActionTable"
  	bundleID="apocBundle"
  	title="APOC.profilewnd.assignees.title"
  	empty="APOC.profilewnd.assignees.noorgs"
  	selectionType="multiple"
    selectionJavascript="setTimeout('toggleMenu()', 0)" 
   	showAdvancedSortIcon="false"
  	showLowerActions="false"
  	showPaginationControls="false"
  	showPaginationIcon="false"
  	showSelectionIcons="true"
  	maxRows="25"/>
	
</cc:pagetitle>

<script type="text/javascript">
<!--
    setTimeout('toggleMenu()', 0);
    // -->
</script> 

<cc:hidden name="AssigneeEntityId" defaultValue="a" />
<cc:hidden name="AssigneeEntityType" defaultValue="a" />

</jato:containerView>
</jato:pagelet>
