<%@ Page Language="C#" AutoEventWireup="true" Inherits="Web.Wpdcc.setPrivilege" Codebehind="setPrivilege.aspx.cs" %>

<!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">
    <title><%= title %></title>

    <!--#include file="../Css/head.htm"-->
    <base target="_self" />
    <script  type="text/javascript"  src="../assets/js/jquery.js"></script>
      <script type="text/javascript" src="../js/TreeView2.js"></script>
    <script type="text/javascript" language="javascript">		
		var TParams = new Object() ;	
		var TParams1 = new Object() ;
		function initValues()
		{	
			var TaParams = document.all.Hidden2.value.split('|') ;
			for (i=0 ; i < TaParams.length ; i++) {
				var TbParams = TaParams[i].split('=') ;
				TParams[TbParams[0]] = i;
				TParams1[i] = TbParams[1];
				if(TbParams[0]=="canAuditContribute")
				{
				    var itemAdd = document.getElementById("canAdd");
				    var itemDelete = document.getElementById("canDelete");
				    var itemRecommand = document.getElementById("canSetRecommand");
				    var itemTop = document.getElementById("canSetTop");
				    if (TbParams[1]=="1")
				    {
				        itemRecommand.selectedIndex = 1;
				        itemRecommand.disabled = false;
				        TParams1[TParams["canSetRecommand"]] = 1;
				        itemAdd.selectedIndex = 0;
				        itemAdd.disabled = true;
				        TParams1[TParams["canAdd"]] = 0;
				        itemDelete.selectedIndex = 0;
				        itemDelete.disabled = true;
				        TParams1[TParams["canDelete"]] = 0;
				        itemTop.selectedIndex = 1;
				        itemTop.disabled = false;
				        TParams1[TParams["canSetTop"]] = 1;
				    }
				    else
				    {
				        itemRecommand.selectedIndex = 0;
				        itemRecommand.disabled = true;
				        TParams1[TParams["canSetRecommand"]] = 0;
				        itemAdd.selectedIndex = 1;
				        itemAdd.disabled = false;
				        itemDelete.selectedIndex = 1;
				        itemDelete.disabled = false;
				        TParams1[TParams["canDelete"]] = 1;
				        TParams1[TParams["canAdd"]] = 1;
				        itemTop.selectedIndex = 0;
				        itemTop.disabled = true;
				        TParams1[TParams["canSetTop"]] = 0;
				    }
				}
			}			
		}
		function changeValue(id, val)
		{
		        if (id=="canAuditContribute")
		        {
				    var itemAdd = document.getElementById("canAdd");
				    var itemDelete = document.getElementById("canDelete");
				    var itemRecommand = document.getElementById("canSetRecommand");
				    var itemTop = document.getElementById("canSetTop");
		            if(val=="1")
		            {
		                itemAdd.selectedIndex = 0;
		                TParams1[TParams["canAdd"]] = 0;
		                itemAdd.disabled = true;
		                
		                itemDelete.selectedIndex = 0;
		                TParams1[TParams["canDelete"]] = 0;
		                itemDelete.disabled = true;
		                
		                itemRecommand.selectedIndex = 1;
		                TParams1[TParams["canSetRecommand"]] = 1
		                itemRecommand.disabled = false;
		                
		                itemTop.selectedIndex = 1;
		                TParams1[TParams["canSetTop"]] = 1
		                itemTop.disabled = false;
		            }
		            else if(val=="0")
		            {   
		                itemRecommand.selectedIndex = 0;
		                TParams1[TParams["canSetRecommand"]] = 0;
		                itemRecommand.disabled = true;
		                
		                itemTop.selectedIndex = 0;
		                TParams1[TParams["canSetTop"]] = 0;
		                itemTop.disabled = true;
		                
		                itemAdd.selectedIndex = 1;
		                TParams1[TParams["canAdd"]] = 1
		                itemAdd.disabled = false;
		                
		                itemDelete.selectedIndex = 1;
		                TParams1[TParams["canDelete"]] = 1
		                itemDelete.disabled = false;
		            }
		        }
			TParams1[TParams[id]] = val;	
		}
		function setValues()
		{	
			var str = '';
			var TaParams = document.all.Hidden2.value.split('|');
			for (i = 0 ; i < TaParams.length ; i++) {
			    var TaParam = TaParams[i].split('=');
			    str = str + TaParam[0] + "=" + TParams1[TParams[TaParam[0]]] + "|";
			}
			//document.all.Hidden2.value = str;
			document.all.Hidden2.value = str.substring(0, str.length-1);
			
			parent.window.dialogArguments.BindValue(document.all.Hidden2.value, document.all.Hidden1.value);
            
            window.close();
			//parent.$.fancybox.close();
		}
		
	</script>
</head>
<body>
    <form id="form1" runat="server">
        <table border="0" cellpadding="2" cellspacing="1" align="center" width="100%" class="border">
            <tr>
                <td class="topbg" align="center" colspan="2"><%= title %></td>
            </tr>
            <tr>
                <td width="30px">&nbsp;</td>
                <td>
                    <asp:TreeView ID="treeView" runat="server" AutoGenerateDataBindings="False" ShowLines="True">
                    </asp:TreeView>
                </td>
            </tr>
            <tr>
                <td align="center"  colspan="2" style="height: 24px">
                    <%--<asp:Button ID="checkButton" class="btn" runat="server" Text="保 存" OnClick="checkButton_Click"></asp:Button>--%>
                    <input id="Button1" type="button" value="保存" onclick="setValues();" />
                    &nbsp;
                    <input id="btnClose" name="btnClose" type="button" value="关闭" onclick="window.close();" /></td>
            </tr>
        </table>
        <input id="Hidden1" runat="server" type="Hidden" />
        <input id="Hidden2" runat="server" type="Hidden" />
    </form>
    <script type="text/javascript" language="javascript">initValues();</script>
    <!--#include file="../Css/foot.htm"-->
</body>
</html>
