
<%@ Page Language="C#" AutoEventWireup="true" Codebehind="Default.aspx.cs" Inherits="FileExplorer._Default" %>

<%@ Register Assembly="RadAjax.Net2" Namespace="Telerik.WebControls" TagPrefix="radA" %>
<%@ Register Assembly="RadGrid.Net2" Namespace="Telerik.WebControls" TagPrefix="radG" %>
<%@ Register Assembly="RadSplitter.Net2" Namespace="Telerik.WebControls" TagPrefix="radspl" %>
<%@ Register Assembly="RadTreeView.Net2" Namespace="Telerik.WebControls" TagPrefix="radT" %>
<!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>
  <title>File Explorer</title>
  <link rel="stylesheet" type="text/css" href="Styles/Style.css" />
</head>
<body scroll="no">
  <form id="form1" runat="server">

    <script type="text/javascript">
                      
      var isInAjaxCall; 
                      
      function RequestStart()
      {
        isInAjaxCall = true;         
      }
      
      function ResponseEnd()
      {
        isInAjaxCall = false; 
      }
                     
      function RowClick(index)  
      {          
        //__doPostBack("<%= RadGrid1.UniqueID %>", "RowClicked:" + this.Rows[index].ItemIndex);  
        if (!isInAjaxCall)
        {
          window["<%=RadAjaxManager1.ClientID%>"].AjaxRequest("RowClick:" + this.Rows[index].ItemIndex);
        }
        else
        {
          alert("too many requests at one time"); 
        }
      }                  
      
      function RefreshClick()
      {
        var slidingZone = <%= zoneLeft.ClientID %>;
        slidingZone.UnDockPane("slidingPaneOptions");
        slidingZone.DockPane("slidingPaneFiles");
        if (!isInAjaxCall)
        {
          window["<%=RadAjaxManager1.ClientID%>"].AjaxRequest("Refresh");
        }

      }

    </script>

    <radspl:RadSplitter ID="splitterMain" runat="server" Height="90%" Width="100%" 
      EnableClientDebug="False" HeightOffset="8" BorderSize="0" BorderStyle="None" 
      Skin="WebBlue" Orientation="Horizontal" VisibleDuringInit="False" 
      FullScreenMode="true">
      
      <radspl:RadPane ID="paneMain" runat="server" Height="100%" Width="100%" 
        Scrolling="None">
        <radspl:RadSplitter ID="splitterLeftRight" runat="server" Height="100%" 
          Width="100%" EnableClientDebug="False" BorderSize="0" BorderStyle="None" 
          Skin="WebBlue" Orientation="Vertical" VisibleDuringInit="False">
          
          <radspl:RadPane ID="paneLeft" runat="server" Height="80%" 
            Scrolling="None">
            
            <radspl:RadSlidingZone ID="zoneLeft" runat="server" 
              InitiallyDockedPaneId="slidingPaneFiles" >
              <radspl:RadSlidingPane ID="slidingPaneOptions" runat="server" Scrolling="none" 
                Title="Options">
                Include subdirectories in search?
                <asp:CheckBox ID="cbSubDirectories" runat="server" Text="" Checked="false" />
                <br />
                Root Directory
                <asp:TextBox ID="tbPath" CssClass="OptionInput" runat="server" Text="c:\"></asp:TextBox>
                <input type="Button" id="btnRefresh" OnClick="RefreshClick();" value="Refresh"/>                
              </radspl:RadSlidingPane>
              <radspl:RadSlidingPane ID="slidingPaneFiles" runat="server" Scrolling="none" 
                Title="Files">
                <radT:RadTreeView ID="RadTreeView1" runat="server" AutoPostBack="True" Skin="WebBlue"                
                  Width="100%" Height="100%" AllowNodeEditing="False" DragAndDrop="False"
                  OnNodeExpand="RadTreeView1_NodeExpand" OnNodeClick="RadTreeView1_NodeClick"
                  >
                </radT:RadTreeView>
              </radspl:RadSlidingPane>
            </radspl:RadSlidingZone>
            
          </radspl:RadPane> <%-- end pane left--%>
          
          <radspl:RadSplitBar ID="RadSplitBar1" runat="server" />
          
          <radspl:RadPane ID="paneRight" runat="server" Height="40%" Width="60%"
            Scrolling="None">
            <radspl:RadSplitter ID="splitterTopBottom" runat="server" Height="100%" 
                Width="100%" EnableClientDebug="False" BorderSize="0" 
                BorderStyle="None" Skin="WebBlue" Orientation="Horizontal" 
                  VisibleDuringInit="False">
                  
                <radspl:RadPane ID="paneTop" runat="server" Height="50%" Width="100%"
                      Scrolling="None">
                  <radG:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" GridLines="None"
                    EnableAJAX="true" Height="98%" Width="98%" Skin="WebBlue"
                    OnItemDataBound="RadGrid1_ItemDataBound" >
                    <MasterTableView Width="100%">
                      <Columns>
                        <radG:GridTemplateColumn HeaderText="Name" SortExpression="Name" UniqueName="Name">
                          <ItemTemplate>
                            <asp:Image ID="icon" runat="server" />
                            <asp:Label ID="itemLabel" runat="server" 
                              Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>'></asp:Label>
                          </ItemTemplate>
                          <ItemStyle BorderStyle="None" />
                        </radG:GridTemplateColumn>
                        <radG:GridTemplateColumn HeaderText="Size" SortExpression="Size" UniqueName="Size">
                          <ItemStyle BorderStyle="None" />
                        </radG:GridTemplateColumn>
                        <radG:GridTemplateColumn Display="False" HeaderText="Path" UniqueName="Path">
                          <ItemTemplate>
                            <asp:Label ID="pathLabel" runat="server" 
                              Text='<%# DataBinder.Eval(Container.DataItem, "Path") %>'></asp:Label>
                          </ItemTemplate>
                        </radG:GridTemplateColumn>
                      </Columns>
                      <ExpandCollapseColumn Visible="False">
                        <HeaderStyle Width="19px" />
                      </ExpandCollapseColumn>
                      <RowIndicatorColumn Visible="False">
                        <HeaderStyle Width="20px" />
                      </RowIndicatorColumn>
                    </MasterTableView>
                    <ItemStyle BorderStyle="None" />
                    <ClientSettings ApplyStylesOnClient="True" ReorderColumnsOnClient="True">
                      <Selecting AllowRowSelect="True" />
                      <Resizing AllowColumnResize="True" />
                      <Scrolling AllowScroll="True" UseStaticHeaders="True" ScrollHeight="99.9%" />
                      <ClientEvents OnRowClick="RowClick" />
                    </ClientSettings>
                    <HeaderStyle BorderColor="DarkGray" BorderStyle="Solid" BorderWidth="1px" />
                  </radG:RadGrid>
                </radspl:RadPane>
                
                <radspl:RadSplitBar ID="RadSplitBar2" runat="server" />
                
                <radspl:RadPane ID="paneBottom" runat="server" Height="50%" Width="100%" 
                      Scrolling="None">
                  
                    <fieldset id="details" runat="server"><legend>No file selected</legend></fieldset>
                  
                </radspl:RadPane>
                    
              </radspl:RadSplitter> <%-- end splitter right--%>
          </radspl:RadPane> <%-- end pane right--%>
        
        </radspl:RadSplitter> <%-- end splitter left--%>
      </radspl:RadPane> <%-- end main pane--%>
      
      <radspl:RadPane ID="paneFooter" runat="server" Height="30px" Width="100%" 
        CssClass="footer" Scrolling="none">
        <radA:AjaxLoadingPanel ID="AjaxLoadingPanel1" runat="server"
          Height="100%" Width="100%" IsSticky="True">
          <asp:Image ID="Image1" runat="server" AlternateText="Updating..." 
            ImageUrl="~/Img/LoadingProgressBar.gif"
            CssClass="UpdateImage" />&nbsp;&nbsp;Updating...
        </radA:AjaxLoadingPanel>
      </radspl:RadPane>
      
    </radspl:RadSplitter>

      <radA:RadAjaxManager ID="RadAjaxManager1" runat="server" 
        OnAjaxRequest="AjaxRequest" 
        ClientEvents-OnRequestStart="RequestStart" 
        ClientEvents-OnResponseEnd="ResponseEnd">
        <AjaxSettings>
          <radA:AjaxSetting AjaxControlID="RadTreeView1">
            <UpdatedControls>
              <radA:AjaxUpdatedControl ControlID="RadTreeView1" 
                LoadingPanelID="AjaxLoadingPanel1" />
              <radA:AjaxUpdatedControl ControlID="RadGrid1" 
                LoadingPanelID="AjaxLoadingPanel1" />
              <radA:AjaxUpdatedControl ControlID="details" 
                LoadingPanelID="AjaxLoadingPanel1" />
            </UpdatedControls>
          </radA:AjaxSetting>
          <radA:AjaxSetting AjaxControlID="RadAjaxManager1">
            <UpdatedControls>
              <radA:AjaxUpdatedControl ControlID="RadTreeView1" 
                LoadingPanelID="AjaxLoadingPanel1" />
              <radA:AjaxUpdatedControl ControlID="RadGrid1" 
                LoadingPanelID="AjaxLoadingPanel1" />
              <radA:AjaxUpdatedControl ControlID="details" 
                LoadingPanelID="AjaxLoadingPanel1" />
            </UpdatedControls>
          </radA:AjaxSetting>
        </AjaxSettings>
      </radA:RadAjaxManager>

  </form>
</body>
</html>
