<%@ page info="ConfigureReport" language="java" %> 
<%@page contentType="text/html;charset=UTF-8"%>
<%--
 ******************************************************************************* 
 * $RCSfile: ShowResults.jsp,v $
 *
 * Description: This file contains the Configure Report Dialog
 *
 * 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.ShowResultsViewBean">

<!-- Header -->
<cc:header pageTitle="" copyrightYear="2005"
 baseName="com.sun.apoc.manager.resource.apoc_manager"
 bundleID="apocBundle" onLoad="javascript:beginDisplay(); return false;" isPopup="true" >
<style type="text/css">
table.Tbl td.TblTdLytNoBrd {border-top:solid 0px #a8b2b6;border-right:solid 0px #a8b2b6;border-left:solid 0px #a8b2b6;border-bottom:solid 0px #a8b2b6;background-color:#E1E1E1}
table.Tbl td.TblTdLytBrdRgtTop {border-top:solid 0px #a8b2b6;border-right:solid 1px #a8b2b6;border-left:solid 0px #a8b2b6;border-bottom:solid 0px #a8b2b6;background-color:#E1E1E1}
a img {border-style:none} 
</style>

<script type="text/javascript" src="/apoc/js/MainWindow.js"></script>
<script type="text/javascript" src="/apoc/js/ProfileWindow.js"></script>
<script type="text/javascript"><!-- Empty script so IE5.0 Windows will draw table and button borders --></script>

<cc:form name="ConfigrepForm" method="post">
<script type="text/javascript">
<!--
    var IMAGE_PREFIX = "image.";
    var TURNER_PREFIX = "turner.";
    var TABLE1 = "table1";
    var TABLE2 = "table2";
    
    function setRadio() {
        var objFormField = document.forms[0].elements['ShowResults.UseReportRadio'];
        if (objFormField == null){
            return "";
        }
        var intControlLength = objFormField.length;
        for (var i=0; i<intControlLength; i++) {
            if (objFormField[i].checked) {
                var strValue = objFormField[i].value;
                return strValue;
            }
        }
    }

    function submitBrowse(entityId, entityType) {
        if((entityType == 'USER') || (entityType == 'ORG') || (entityType == 'ROLE') || (entityType == 'USERID')) {
            document.ConfigrepForm['ShowResults.OrgEntity'].value = entityId;
            document.ConfigrepForm.action="/apoc/manager/ShowResults?ShowResults.OrgBrowseHref=a&isReportHidden=true"; 
        } else {
            document.ConfigrepForm['ShowResults.DomEntity'].value = entityId;        
            document.ConfigrepForm.action="/apoc/manager/ShowResults?ShowResults.DomBrowseHref=a&isReportHidden=true"; 
        }
        document.ConfigrepForm.submit(); 
    }

    function printPage() {
        window.print();
    }

    function toggleBrowseButtons() {
        if (document.ConfigrepForm['ShowResults.UseReportRadio'][0].checked) {
            document.getElementById("orgTreeRow").style.display="";
            document.getElementById("domTreeRow").style.display="none";            
        } else if (document.ConfigrepForm['ShowResults.UseReportRadio'][1].checked) {
            document.getElementById("orgTreeRow").style.display="none";
            document.getElementById("domTreeRow").style.display="";             
        } else {
            document.getElementById("orgTreeRow").style.display="";
            document.getElementById("domTreeRow").style.display="";        
        }
    }
 
    function beginDisplay() {
        toggleBrowseButtons();
   /*     var table = document.getElementById(TABLE2);
        if (table != null) {
            for(var i=0; i < table.rows.length; i++) {
                if (table.rows[i].id != null && table.rows[i].id.length != 0) {
                    var childId = table.rows[i].id;
                    var arr = childId.split(".");
                    var style2 = document.getElementById(childId).style;
                    var childImage  = document.getElementById(IMAGE_PREFIX + childId);
                    if (arr == null || arr.length <= 2) {
                        style2.display ='';
                        if (childImage != null && arr.length==2) {
                            setImage(childImage, "grouprow_collapsed.gif");
                        }
                    } else {
                        style2.display="none";
                    }
                }
            }
        }*/
        return false;
    }

    function showhideprofiles(element) {
        var id = element.id.substring(TURNER_PREFIX.length, element.id.length);
        var table = document.getElementById(TABLE1);
        for(var i=0; i < table.rows.length; i++) {
            if (table.rows[i].id != null && table.rows[i].id.length != 0) {
                var childId = table.rows[i].id;
                if (childId != id && childId.indexOf(id) == 0) {
                    var style2 = document.getElementById(childId).style;
                    if (style2.display == "none") {
                        style2.display = '';
                    } else {
                        style2.display = "none";
                    }
                }
            }
        }
        switchImage(document.getElementById(IMAGE_PREFIX+id));
        return false;
    }

    function showhide(element) {
        var id = element.id.substring(TURNER_PREFIX.length, element.id.length);
        var action = getAction(document.getElementById(IMAGE_PREFIX+id));
        if (action == "hide") {
            hide(id);
        } else {
            show(id, action);
        }
        switchImage(document.getElementById(IMAGE_PREFIX+id));
        return false;
    }

    function hide(id) {
        var table = document.getElementById(TABLE2);
        for(var i=0; i < table.rows.length; i++) {
            if (table.rows[i].id != null && table.rows[i].id.length != 0) {
                var childId = table.rows[i].id;
                if (childId != id && childId.indexOf(id) == 0) {
                    var style2 = document.getElementById(childId).style;
                        style2.display ="none";
                }
            }
        }
        return false;
    }

    function show(id ,action) {
        var table = document.getElementById(TABLE2);
        var children = getChildren(id); 
        for (var i= 0; i < children.length; i++) {
            var childId  = children[i];
            var style2 = document.getElementById(childId).style;
            if(action == 'show'){
                style2.display ='';
            }else{
                style2.display ="none";
            } 
            var childElement = document.getElementById(IMAGE_PREFIX+childId);
            if (childElement != null) {
                childAction = getAction(childElement);
                // SL TODO - CHANGE THIS TO SOMETHING BETTER
                //The getAction() method is used to decide whether to show or hide 
                // the row based on the arrow images position - here we want to 
                // know whether to show or hide a child row using the direct parents
                // arrow image position so we actually want the inverse of getAction()
                if(childAction == "show"){
                    childAction = "hide";
                } else {
                    childAction = "show";
                }
                id = childId;
                show(id, childAction);
            }
        }
        return false;
    }

    function getChildren(id) {
        var prefix  = id + ".";
        var children = new Array();
        var table = document.getElementById(TABLE2);
        for(var i=0; i < table.rows.length; i++) {
            if (table.rows[i].id != null && table.rows[i].id.length != 0) {
                var childId = table.rows[i].id;
                if (childId.indexOf(prefix) == 0 && childId != id) {
                    var suffix = childId.substring(prefix.length, childId.length);
                    if (suffix.indexOf(".") == -1) {
                        children.push(childId);
                    }
                }
            }
        }
        return children;
    }

    function getAction(element) {
        var stem = element.src.substring(0, element.src.lastIndexOf("/")+1);
        var currentImage = element.src.substring(element.src.lastIndexOf("/")+1, element.src.length);
        if (currentImage=="grouprow_collapsed.gif") {
            return "show";
        } else {
            return "hide";
        }
    }

    function switchImage(element) {
        var stem = element.src.substring(0, element.src.lastIndexOf("/")+1);
        var currentImage = element.src.substring(element.src.lastIndexOf("/")+1, element.src.length);
        if (currentImage=="grouprow_collapsed.gif") {
            element.src = stem + "grouprow_expanded.gif";        
        } else {
            element.src= stem + "grouprow_collapsed.gif";       
        }
        return false;
    }

    function setImage(element, image) {
        var stem = element.src.substring(0, element.src.lastIndexOf("/")+1);
        var currentImage = element.src.substring(element.src.lastIndexOf("/")+1, element.src.length);
        element.src = stem + image;
        return false;
    }
-->
</script>

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

    <!-- Page Title (Packages) -->
    <cc:pagetitle name="PageTitle" bundleID="apocBundle"
     pageTitleText="APOC.configrep.title"
     pageTitleHelpMessage="APOC.configrep.help"
     showPageTitleSeparator="true"
     showPageButtonsTop="true"
     showPageButtonsBottom="false">

    <!-- Property Sheet -->
    <table width="90%" id="propertyTable" align="center" border="0" cellpadding="0" cellspacing="10">
        <tr>
            <td colspan="3">
                <br/>
            </td>
        </tr>
        <tr>
            <td valign="top" width="30%">
                <span class="LblLev2Txt"> 
                    <cc:text name="UseLabel" defaultValue="APOC.configrep.reptype" bundleID="apocBundle" />
                </span> 
            </td>
            <td align="left" colspan ="2">
                <cc:radiobutton
                    name="UseReportRadio"
                    bundleID="apocBundle"
                    dynamic="true" 
                    styleLevel="3" 
                    onClick="javascript:toggleBrowseButtons(); return true;"/>
            </td>
        </tr>
        <tr id="orgTreeRow">
            <td align="left">
                <span class="LblLev2Txt">
                    <cc:text name="OrgTreeLabel" defaultValue="APOC.configrep.orgtree" bundleID="apocBundle" />
                </span>
            </td>
            <td valign="bottom" align="left">
                <cc:text name="OrgTree" bundleID="apocBundle" />
                &nbsp;&nbsp;&nbsp;
                <cc:button  name="OrgBrowseButton"
                    bundleID="apocBundle" 
                    defaultValue="APOC.profilewnd.general.browse"
                    type="secondaryMini"
                />
            </td>
        </tr>
        <tr id="domTreeRow">
            <td align="left">
                <span class="LblLev2Txt">
                    <cc:text name="DomTreeLabel" defaultValue="APOC.configrep.domtree" bundleID="apocBundle" />
                </span>
            </td>
            <td valign="bottom" align="left">
                <cc:text name="DomTree" bundleID="apocBundle" />
                &nbsp;&nbsp;&nbsp;
                <cc:button  name="DomBrowseButton"
                    bundleID="apocBundle" 
                    defaultValue="APOC.profilewnd.general.browse"
                    type="secondaryMini"
                />
            </td>
        </tr>
    </table>

    </cc:pagetitle>

    <!-- Hidden Fields -->
    <cc:hidden name="PolicyTemplateSelection" />
    <cc:hidden name="OrgEntity" />
    <cc:hidden name="DomEntity" />
    <cc:hidden name="ReportType" />


<table border="0" width="100%" cellpadding="0" cellspacing="0">
    <tr>
        <td colspan="3">
            <img src="/com_sun_web_ui/images/other/dot.gif" alt="" border="0" height="30" width="1" />
        </td>
    </tr>
    <tr>
        <td>
            <img src="/com_sun_web_ui/images/other/dot.gif" alt="" border="0" height="1" width="10" />
        </td>
        <td class="TtlLin" style="background-color:#d0d7da" width="90%">
            <img src="/com_sun_web_ui/images/other/dot.gif" alt="" border="0" height="1" width="1" />
        </td>
        <td>
            <img src="/com_sun_web_ui/images/other/dot.gif" alt="" border="0" height="1" width="10" />
        </td>
    </tr>
</table>
<br>
<br>

<jato:content name="DisplayReport">

<!-- The profiles contributing to this report -->
<p>
    <div class="TtlTxtDiv">
        <h1><cc:text name="ReportInfo" bundleID="apocBundle" /></h1>
    </div>
</p>
<p>
    <div class="TtlTxtDiv">
        <h2><cc:text name="CreationInfo" bundleID="apocBundle"/></h2>
    </div>
</p>
<br/>
<br/>    
<p>
    <div class="TtlTxtDiv">
        <h2><jato:text name="NoSections" fireDisplayEvents="true"/></h2>
    </div>
</p>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><td>
    <jato:content name="DisplayTables">
        <div class="TblMgn">
            <table name="table1" id="table1" class="Tbl" style="border:solid 1px #a8b2b6;" cellpadding="0" cellspacing="0">
                <caption class="TblTtlTxt" style="border-left:solid 0px;border-right:solid 0px;">
                    <cc:text name="ProfilesInvolvedTitle" bundleID="apocBundle"/>
                </caption>
                <tr id="0">
                    <th class="TblColHdrCl1" align="left" scope="col">
                   <!--     <a id="turner.0" href="" onClick="showhideprofiles(this); return false;">
                            <img id="image.0" src="/apoc/images/grouprow_expanded.gif" alt="Click to Collapse Group" width="10" height="11" />
                        </a> -->
                        <span class="TblHdrTxt">
                            <cc:text name="EntityInvolvedTitle" bundleID="apocBundle"/>
                        </span>
                    </th>
                </tr>
                <tr id="0.1">
                    <td class="TblTdLyt" align="left">
                        <cc:text name="ProfilesInvolved" bundleID="apocBundle"/>
                    </td>
                </tr> 
            </table>
        </div>
        <br/>
        <br/>
        <div class="TblMgn">
            <table name="table2" id="table2" class="Tbl" style="border:solid 1px #a8b2b6;" cellpadding="0" cellspacing="0">
                <caption class="TblTtlTxt" style="border-left:solid 0px;border-right:solid 0px;">
                    <cc:text name="SettingsSummaryTitle" bundleID="apocBundle"/>
                </caption>
                <tr>
                    <th class="TblColHdrCl1" align="center" scope="col" width="6%" colspan="2" >
                         <span class="TblHdrTxt">
                        </span>
                    </th>
                    <th id="nameCol" class="TblColHdr" align="left" scope="col" width="32%">
                        <table class="TblHdrTbl" cellpadding="0" cellspacing="0">
                            <tr>
                                <td align="left">
                                    <span class="TblHdrTxt">
                                        <cc:text name="NameHeading" bundleID="apocBundle"/>
                                    </span>
                                </td>
                            </tr>
                        </table>
                    </th>
                    <th id="valueCol" class="TblColHdr" align="left" scope="col" width="32%">
                        <table class="TblHdrTbl" cellpadding="0" cellspacing="0">
                            <tr>
                                <td align="left">
                                    <span class="TblHdrTxt">
                                        <cc:text name="ValueHeading" bundleID="apocBundle"/>
                                    </span>
                                </td>
                            </tr>
                        </table>
                    </th>
                    <th id="statusCol" class="TblColHdr" align="left" scope="col" width="30%" nowrap="nowrap">
                        <table class="TblHdrTbl" cellpadding="0" cellspacing="0">
                            <tr>
                                <td align="left">
                                    <span class="TblHdrTxt">
                                        <cc:text name="StatusHeading" bundleID="apocBundle"/>
                                    </span>
                                </td>
                            </tr>
                        </table>
                    </th>
                </tr>

                <!-- Beginning of table of settings display -->
                <jato:tiledView name="CategoryTiledView" fireChildDisplayEvents="true">    
                    <tr id='<cc:text name="RowID" bundleID="apocBundle"/>'>
                        <th class="TblColHdrCl1" align="left" scope="colgroup" colspan="5">
                         <!--   <a id='<cc:text name="TurnerID" bundleID="apocBundle"/>' href="" onClick="showhide(this); return false;">
                                <img id='<cc:text name="ImageID" bundleID="apocBundle"/>' src="/apoc/images/grouprow_expanded.gif" alt="Click to Collapse Group" width="10" height="11" />
                            </a>   -->
                            <span class="TblHdrTxt">
                                <cc:text name="Category" bundleID="apocBundle"/>
                            </span>
                        </th>
                    </tr>
                    <jato:tiledView name="SectionTiledView" fireChildDisplayEvents="true">    
                        <tr id='<cc:text name="RowID" bundleID="apocBundle"/>'>
                            <td class="TblTdLytBrdRgtTop" width="3%" nowrap="nowrap">
                            </td>
                            <th class="TblColHdrCl1" align="left" scope="colgroup" colspan="4">
                            <!--    <a id='<cc:text name="TurnerID" bundleID="apocBundle"/>' href="" onClick="showhide(this); return false;">
                                    <img id='<cc:text name="ImageID" bundleID="apocBundle"/>' src="/apoc/images/grouprow_expanded.gif" alt="Click to Collapse Group" width="10" height="11" />
                                </a> -->
                                <span class="TblHdrTxt">
                                    <cc:text name="Section" bundleID="apocBundle"/>
                                </span>
                            </th>
                        </tr>
                        <jato:tiledView name="PropertyTiledView" fireChildDisplayEvents="true">    
                            <tr id='<cc:text name="RowID" bundleID="apocBundle"/>' >
                                <td class="TblTdLytNoBrd" align="left" width="3%"><span></span></td>
                                <td class="TblTdLytBrdRgtTop" align="left" width="3%"><span></span></td>
                                <td class="TblTdLyt" align="left">
                                    <span>
                                        <cc:text name="NameValue" bundleID="apocBundle"/>
                                    </span>
                                </td>
                                <td class="TblTdLyt" align="left">
                                    <span>
                                        <cc:text name="ValueValue" bundleID="apocBundle"/>
                                    </span>
                                </td>
                                <td class="TblTdLyt" align="left">
                                    <span>
                                        <cc:text name="StatusValue" bundleID="apocBundle"/>
                                    </span>
                                    <span>
                                        <cc:href name="ProfileValueHref" onClick="javascript:openProfileEditorWindowAtSection(this); return false;">
                                            <cc:text name="ProfileValue" bundleID="apocBundle"/>
                                        </cc:href>                                
                                    </span>
                                    <br/>
                                    <span>
                                        <cc:text name="StatusValueProtection" bundleID="apocBundle"/>
                                    </span>
                                </td>
                            </tr>
                        </jato:tiledView>
                    </jato:tiledView>
                </jato:tiledView>   
            </table>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
        </div>
    </jato:content>
</td></tr>
</table>
    <script type="text/javascript">
    <!--
        var windowTitle = '<cc:text name="WindowTitle" bundleID="apocBundle"/>';
        if (windowTitle.length == 0 ) {
            windowTitle = '<cc:text name="WindowTitle" defaultValue="APOC.configrep.title" bundleID="apocBundle"/>'
        }
        parent.document.title = windowTitle;
        if (document.ConfigrepForm['ShowResults.PrintButton'].disabled == true){
            document.ConfigrepForm['ShowResults.PrintButton'].className='Btn1Dis';
            parent.buttons.document.ButtonsForm['ReportButtons.PrintButton'].disabled = true;
            parent.buttons.document.ButtonsForm['ReportButtons.PrintButton'].className='Btn1Dis';
        } else {
            parent.buttons.document.ButtonsForm['ReportButtons.PrintButton'].disabled = false;
            parent.buttons.document.ButtonsForm['ReportButtons.PrintButton'].className='Btn1Def';
        }
    //-->
    </script>
    <input type="hidden" name="com_sun_web_ui_popup" value="true" />
</jato:content>
</cc:form>
</cc:header>
</jato:useViewBean> 

