<%@ Page language="c#" Codebehind="Security.aspx.cs" AutoEventWireup="false" Inherits="Mediachase.UI.Web.FileStorage.Security" %>
<%@ Register TagPrefix="ibn" TagName="BlockHeader" src="..\Modules\BlockHeader.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > 

<html>
   <head>
    <title>
			<%=LocRM.GetString("Security") %>
    </title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name=vs_defaultClientScript content="JavaScript">
    <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
    <script src="../Scripts/browser.js"></script>
		<script src="../Scripts/buttons.js"></script>
		<LINK href="../layouts/styles/windows.css" type="text/css" rel="stylesheet">
		<link href="../Themes/<%=Mediachase.UI.Web.Util.CommonHelper.GetTheme()%>/theme.css" rel="stylesheet">
		<link href="../Themes/<%=Mediachase.UI.Web.Util.CommonHelper.GetTheme()%>/color1.css" rel="stylesheet">
		<LINK href='<%=Mediachase.UI.Web.Util.CommonHelper.GetAbsolutePath("/layouts/styles/mcCalendClient.css")%>' rel="stylesheet">
		<script><!--
		if ((browseris.mac) && !browseris.ie5up)
		{
			var macstyle = "../layouts/styles/mac.css";
			document.write("<link rel='stylesheet' Type='text/css' href='" + macstyle + "'>");
		}
	
		//--></script>		
		<script language="JavaScript"> 
			function disableEnterKey() 
			{ 
				try {
					if (window.event.keyCode == 13 && window.event.srcElement.type != "textarea")
						window.event.keyCode = 0;
				}
				catch (e) {}
			} 
		</script>	
  </head>
  <body class="UserBackground" id="pT_body" leftMargin="0" topMargin="0" marginwidth="0" marginheight="0">
	
    <form id="frmMain" method="post" runat="server" enctype="multipart/form-data">
			<ibn:BlockHeader id="secHeader" runat="server" />
			<table id="mainTable" class="ibn-stylebox-light text" style="HEIGHT: 100%;" height="100%" cellSpacing="0" cellPadding="2" width="100%" border="0">
				<tr height="22">
					<td class="boldtext" width="290" height="22"><%=LocRM.GetString("Available") %> :</td>
					<td class="ibn-navframe boldtext"><%=LocRM.GetString("Selected") %> :</td>
				</tr>
				<tr style="HEIGHT: 100%">
					<td vAlign="top" width="290">
						<!-- Groups & Users -->
						<table class="text" style="MARGIN-TOP: 5px" cellSpacing="0" cellPadding="2" width="100%">
							<tr>
								<td width="9%"><%=LocRM.GetString("Group") %>:</td>
								<td width="91%"><asp:dropdownlist id="ddGroups" runat="server" Width="190px" CssClass="text" AutoPostBack="True"></asp:dropdownlist></td>
							<tr>
								<td vAlign="top"><%=LocRM.GetString("User") %>:</td>
								<td vAlign="top"><asp:DropDownList id="ddUsers" runat="server" Width="190px" CssClass="text"></asp:DropDownList></td>
							</tr>
							<tr>
								<td vAlign="top"><%=LocRM.GetString("Rights") %>:</td>
								<td vAlign="top"><asp:dropdownlist id="ddRights" runat="server" Width="190px" CssClass="text"></asp:dropdownlist></td>
							</tr>
							<tr>
								<td vAlign="top"></td>
								<td vAlign="top">
									<asp:radiobuttonlist id="rbList" runat="server" Width="190px" CssClass="text" RepeatColumns="2"></asp:radiobuttonlist>
								</td>
							</tr>
							<tr>
								<td vAlign="top" height="28">&nbsp;</td>
								<td>
									<Button id="btnAdd" runat="server" onclick="DisableButtons(this);DisableCheck();" Class="text" style="width:90px;" type="button">
									</Button>
								</td>
							</tr>
						</table>
						<table id="tblInhereted" runat=server class="text" cellSpacing="0" cellPadding="3" width="100%" border="0">
							<tr>
								<td width="99%">
									<label for="cbInherit">
										<input id="cbInherit" onclick="CheckClear()" type="checkbox" value="Has Inherited" name="cbInherit" runat="server">
										<%=LocRM.GetString("tInherit")%>
									</label>
								</td>
								<td width="1%">
									<div align="right"></div>
								</td>
							</tr>
						</table>
						<!-- End Groups & Users -->
					</td>
					<td vAlign="top" height="100%" class="ibn-navframe">
						<!-- Data GRID -->
						<div style="OVERFLOW-Y: auto; HEIGHT: 262px"><asp:datagrid id="dgMembers" Runat="server" AutoGenerateColumns="False" AllowPaging="False" AllowSorting="False" cellpadding="3" gridlines="None" CellSpacing="3" borderwidth="0px">
								<ItemStyle CssClass="ibn-propertysheet"></ItemStyle>
								<HeaderStyle CssClass="text"></HeaderStyle>
								<Columns>
									<asp:BoundColumn DataField="ID" Visible="False"></asp:BoundColumn>
									<asp:TemplateColumn HeaderText='Name'>
										<ItemTemplate>
											<%# GetLink((int)DataBinder.Eval(Container.DataItem, "Weight"), DataBinder.Eval(Container.DataItem, "Name").ToString())%>
										</ItemTemplate>
									</asp:TemplateColumn>
									<asp:TemplateColumn HeaderText='Rights'>
										<ItemTemplate>
											<%# DataBinder.Eval(Container.DataItem, "Rights")%>
										</ItemTemplate>
									</asp:TemplateColumn>
									<asp:templatecolumn headertext="Allow" itemstyle-width="45" HeaderStyle-HorizontalAlign=Center ItemStyle-HorizontalAlign=Center>
										<itemtemplate>
											<%# (bool)DataBinder.Eval(Container.DataItem, "Allow") ?
													"<img src='../layouts/Images/accept.gif' border='0' width=16 height=16 align='absmiddle' >":
													"<img src='../layouts/Images/deny.gif' border='0' width=16 height=16 align='absmiddle' >"
											%>
										</itemtemplate>
									</asp:templatecolumn>
									<asp:templatecolumn itemstyle-width="30" Visible="True">
										<itemtemplate>
											<asp:imagebutton visible='<%# DataBinder.Eval(Container.DataItem, "IsInherited")%>' id="ibDelete" runat="server" borderwidth="0" width="16" height="16" commandname="Delete" causesvalidation="False" imageurl="../layouts/images/DELETE.GIF">
											</asp:imagebutton>
										</itemtemplate>
									</asp:templatecolumn>
								</Columns>
							</asp:datagrid>
							<!-- End Data GRID --></div>
					</td>
				</tr>
			</table>
			<asp:LinkButton id="btnSave" runat="server" Visible=False></asp:LinkButton>
			<asp:LinkButton id="btnRestoreInherited" runat="server" Visible=False></asp:LinkButton>
			<asp:LinkButton id="btnSetInherited" runat="server" Visible=False></asp:LinkButton>
			<asp:LinkButton id="btnClearInherited" runat="server" Visible=False></asp:LinkButton>
			<asp:LinkButton ID="btnSaveLostChanges" Runat=server Visible=False></asp:LinkButton>
			<script language=javascript>
				function DisableCheck()
				{	
					document.forms[0].<%=cbInherit.ClientID %>.disabled = true;
				}
				
				function FuncSave()
				{
					<%=Page.GetPostBackClientEvent(btnSave,"") %>
				}
				
				function getMenu(s)
				{
					return document.getElementById(s)
				}
				
				function openEditItem()
				{
					var menu = getMenu('divEditItem');
					var selectColl = document.getElementsByTagName('select');
					for(var i=0;i<selectColl.length;i++)
						selectColl[i].style.visibility = "hidden";
					menu.style.display = "";
				}
				
				function cancel()
				{
					getMenu('divEditItem').style.display = "none";
					document.forms[0].<%=cbInherit.ClientID %>.checked = true;
					var selectColl = document.getElementsByTagName('select');
					for(var i=0;i<selectColl.length;i++)
						selectColl[i].style.visibility = "";
				}
				
				function Leave()
				{
					getMenu('divEditItem').style.display = "none";
					<%=Page.GetPostBackClientEvent(btnSetInherited,"") %>
				}
				
				function Drop()
				{
					getMenu('divEditItem').style.display = "none";
					<%=Page.GetPostBackClientEvent(btnClearInherited,"") %>
				}
				
				function CheckClear()
				{
					if (document.forms[0].<%=cbInherit.ClientID %>.checked == false)
					{	
						openEditItem();
					}
					else
						<%=Page.GetPostBackClientEvent(btnRestoreInherited,"") %>
				}
				
				function openMenuLostrights()
				{
					var mTab = document.getElementById('mainTable');	
					if(mTab != null)
						mTab.style.display = "none";
						
					var menu = getMenu('divLostRights');
					
					
					var l = (document.body.clientWidth - 200) / 2;
					var t = (document.body.clientHeight - 200) / 2;
					
					if(! browseris.ie5up)
					{
						l = 50;
						t = 50;
					}
										
					menu.style.left = l;
					menu.style.top = t;
					menu.style.display = "";
				}
				
				function savewithlost()
				{
					<%=Page.GetPostBackClientEvent(btnSaveLostChanges,"") %>
				}
				
				function cancellost()
				{
					getMenu('divLostRights').style.display = "none";
					var mTab = document.getElementById('mainTable');	
					if(mTab != null)
						mTab.style.display = "";
				}
			</script>
			
			<div id="divEditItem" style="position:absolute; top:30;left:10; width:340; z-index:255;padding:5px;display:none; border: 1px solid #95b7f3;" class="ibn-rtetoolbarmenu ibn-propertysheet ibn-selectedtitle">
				<FIELDSET style="HEIGHT: 220px;margin:0;padding:2px">
					<LEGEND class="text ibn-legend-default" id="lgdPModal" runat="server"></LEGEND>
					<table cellpadding="0" cellspacing="0" border="0" width="100%">
						<tr>
							<td class="text">
								<p align="left" class="text"><%=LocRM.GetString("tText")%><br>
									<br><%=LocRM.GetString("tTextCopy")%><br>
									<br><%=LocRM.GetString("tTextRemove")%><br>
									<br><%=LocRM.GetString("tTextCancel")%><br>
								</p>
							</td>
						</tr>
						<tr>
							<td style="padding-left:10px;padding-top:10px">
								<input type="button" class="text" value='<%=LocRM.GetString("tCopy")%>' style="width:97;" onclick="Leave();" />&nbsp;&nbsp;
								<input type="button" class="text" value='<%=LocRM.GetString("tRemove")%>' style="width:80;" onclick="Drop();" />&nbsp;&nbsp;
								<input type="button" class="text" value='<%=LocRM.GetString("tCancel")%>' style="width:80;" onclick="cancel();" />
							</td>
						</tr>
					</table>
				</FIELDSET>
			</div>
			<div id="divLostRights" style="position:absolute; top:30px;left:300px; width:200px; z-index:255;padding:5px;display:none; border: 1px solid #95b7f3;" class="ibn-rtetoolbarmenu ibn-propertysheet ibn-selectedtitle">
				<FIELDSET style="HEIGHT: 130px;margin:0;padding:2px">
					<LEGEND class="text ibn-legend-default" id="lgdLostRights" runat="server"></LEGEND>
					<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
						<tr>
							<td class="text">
								<p align="center" class="text">
									<%=LocRM.GetString("tAttentionText")%>
								</p>
							</td>
						</tr>
						<tr valign=bottom>
							<td style="padding-left:10px;padding-top:10px;padding-bottom:15px" valign=bottom>
								<input type="button" class="text" value='<%=LocRM.GetString("Save")%>' style="width:80px;" onclick="savewithlost();" />&nbsp;&nbsp;
								<input type="button" class="text" value='<%=LocRM.GetString("Cancel")%>' style="width:80px;" onclick="cancellost();" />
							</td>
						</tr>
					</table>
				</fieldset>
			</div>
     </form>
  </body>
</html>
