<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PrivilegeEditList.aspx.cs" Inherits="Chaokers.CN.SysMembership.Web.PrivilegeEditList" %>
<%@ Import Namespace="System.Data" %>

<%@ Register assembly="Chaokers.CN.SysMembership.Components" namespace="Chaokers.CN.SysMembership.Components.Controls" tagprefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<asp:Literal runat="server">权限管理</asp:Literal>    
<style type="text/css">
.tbList{ border:0px; }
.tbList td{   
    border:solid 1px #dddddd;
    border-left:0px;
    border-right:0px;
    border-top:0px;
}
.border_mouseOver{

}
.border_mouseOut{

}
</style>
</head>
<body>
<script type="text/javascript">
    function edit(privilegeID) {
        window.location = "PrivilegeEdit.aspx?ModuleID=<% = base.moduleID %>&PrivilegeID=" + privilegeID;
    }
    function del(privilegeID) {
        if (confirm("确定要删除该权限吗？\n注：删除该权限将级联删除其所有子权限，请慎重操作！")) {
            window.location.href = "DelPrivilege.aspx?PrivilegeID=" + privilegeID + "&ReturnURL=PrivilegeEditList.aspx?ModuleID=<% = base.moduleID %>";
        }
    }
    function setChildPrivileges(privilegeID) {
            var obj = showModalDialog('SubPrivilegeContainer.aspx?ModuleID=<% = base.moduleID %>&ParentID=' + privilegeID + "&Random=" + Math.random(), window, 'dialogWidth:700px;dialogHeight=490px;help:0;status:0;resizable:1;scroll:0;');
            return;
        }
    function sort(privilegeID) {
            var obj = showModalDialog('SortContainer.aspx?ModuleID=<% = base.moduleID %>&PrivilegeID=' + privilegeID + "&Random=" + Math.random(), window, 'dialogWidth:700px;dialogHeight=490px;help:0;status:0;resizable:1;scroll:0;');
            return;
        }
    function move(privilegeID) {
            var obj = showModalDialog('PrivilegeMove.aspx?PrivilegeID=' + privilegeID + "&Random=" + Math.random(), window, 'dialogWidth:700px;dialogHeight=290px;help:0;status:0;resizable:1;scroll:0;');            
            window.location.reload();
        }
    function SetMOverState(obj) {
        obj.style.backgroundColor = "#f5f5f5";            
//            var length = obj.childNodes.length;
//            for (var i = 0; i < length; i++) {
//                obj.childNodes[i].className = "border_mouseOver";
//            }
        }
    function SetMOutState(obj) {
        obj.style.backgroundColor = "#ffffff";
//        var length = obj.childNodes.length;
//            for (var i = 0; i < length; i++) {
//                obj.childNodes[i].className = "border_mouseOut";
//            }
       }
       
</script>
<form id="form1" runat="server">    
<div id="wrapper">  

    <cc1:CurrLocation ID="CurrLocation1" runat="server" InnerText="角色与权限/权限字典管理" />
    
    <div id="mainContainer"> 
    
    <div class="note">
    <p>说明：点击系统功能模块名称，可以对该模块下的所有权限数据进行管理维护。</p>
    </div>
    
    <br />

    <table width="100%" class="editTable" border="1" bordercolor="<% = base.AppTheme.MainBorderColor %>" style="border-collapse:collapse;" cellspacing="0" cellpadding="0">    
    <thead>
    <td height="23" align="center">        
        <b>系统功能模块</b>
    </td>
    <td align="left">        
       <p style="margin:5px;">       
       <asp:Label ID="lblModuleInfo" runat="server" Text="节点权限数据" Font-Bold="true" />
       </p>
    </td>
    </thead>
    <tr>
    <td valign="top" style="width:120px;">
    <div style="padding:3px;font-size:14px;">
        <asp:Repeater ID="rpModules" runat="server">
        <HeaderTemplate>
        <table border="0" cellpadding="3" width="100%">
        </HeaderTemplate>
        <ItemTemplate>        
        <tr>
        <td>　<%# FormatModuleName((int)Eval("ModuleID"), Eval("ModuleName").ToString())%>
        </td>
        </tr>            
        </ItemTemplate>
        <FooterTemplate>
        </table>
        </FooterTemplate>
        </asp:Repeater>
        <asp:Label ID="lblNote_Module" runat="server"></asp:Label>
    </div>        
    </td>
    <td>        
        <asp:Repeater ID="myRepeater" Runat="server" EnableViewState="False"  >
        <HeaderTemplate>
        
        <div style="height:350px;overflow:scroll;overflow-x:hidden;">
        <table cellpadding="3" cellspacing="0" class="tbList"  border="0" style="width:100%;">
        </HeaderTemplate>
        <ItemTemplate>
        <tr class="cursor-hand" onmouseover="SetMOverState(this);" onmouseout="SetMOutState(this);">	    
	        <td align="left" class="firstTd">&nbsp;<a href="javascript:edit('<%# Eval("PrivilegeID")%>');"><%# FormatPrivilegeName(Eval("PrivilegeName").ToString(), (int)Eval("PrivilegeDepth"), Eval("StateFlag").ToString())%></a><%# OutLink(Eval("Target").ToString(), Eval("DefaultPageURL").ToString())%><%# Eval("Icon").ToString() == "" ? "" : "(" + Eval("Icon").ToString() + ")" %></td>	    
	        <td align="right">
	            <a href="javascript:edit('<%# Eval("PrivilegeID")%>');" title="编辑权限"><img src='../Images/Controls/AspTreeView/edit.gif' align='absmiddle' border='0' alt='编辑权限'/></a>&nbsp;
                <a href="javascript:setChildPrivileges('<%# Eval("PrivilegeID")%>');" title="设置该权限下的页面和按钮权限"><img src='../Images/Controls/AspTreeView/config.gif' align='absmiddle' border='0' alt='设置该权限下的页面和按钮权限'/></a>&nbsp;
                <a href="javascript:sort('<%# Eval("PrivilegeID")%>');" title="权限排序"><img src='../Images/Controls/AspTreeView/sort.gif' align='absmiddle' border='0' alt='权限排序'/></a>&nbsp;
                <a href="javascript:del('<%# Eval("PrivilegeID")%>');" title="删除权限"> <img src='../Images/Controls/AspTreeView/del.gif' align='absmiddle' border='0' alt='删除权限'/></a>&nbsp;
                <a href="javascript:move('<%# Eval("PrivilegeID")%>');" title="转移权限"><img src='../Images/Controls/AspTreeView/move.gif' align='absmiddle' border='0' alt='转移权限'/></a>&nbsp;
	        </td>
	        <td width="10"></td>
        </tr>
        </ItemTemplate>
        <FooterTemplate>
        </table>
        </div>
        
        <table cellpadding="5" cellspacing="0" border="0" style="width:100%;border-top:solid 1px #dddddd;">
        <tr>
        <td align="right"><em><b><a href="PrivilegeEdit.aspx?ModuleID=<% = base.moduleID %>">[添加权限]</a></b></em></td>
        <td width="10"></td>
        </tr>
        </table>
        
        </FooterTemplate>
        </asp:Repeater>
        <asp:Label ID="lblNote_Privilege" runat="server"></asp:Label>        
    </td>
    </tr>
    
    </table>

    </div><!--"mainContainer.END"-->

</div><!--"wrapper.END"-->
</form> 

</body>
</html>
