<%@ Page Title="" Language="C#" MasterPageFile="~/Master/TimeSiteMaster.Master" AutoEventWireup="true" CodeBehind="ProjectManagementSectionPage.aspx.cs" Inherits="MKInsight.Online.ActionTracking.TimeRecording.ProjectManagementSectionPage" %>


<%@ Register Assembly="MKinsight.Online.UIServices" Namespace="Geekees.Common.Controls" TagPrefix="ct" %>
<%@ Register Src="../UIControls/MessageBox.ascx" TagName="MessageBox" TagPrefix="uc1" %>
<%@ Register Src="../UIControls/Header.ascx" TagName="Header" TagPrefix="uc2" %>
<%@ Register Src="../UIControls/TimeRecording/Projects/ProjectUniverseTree.ascx" TagName="ProjectUniverseTree"
    TagPrefix="uc3" %>

<%@ Register Src="../UIControls/TimeRecording/Projects/ProjectDetails.ascx" TagName="ProjectDetails"
    TagPrefix="uc5" %>
<%@ Register Assembly="UIWebControls" Namespace="UIWebControls" TagPrefix="cc4" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

    <script type="text/javascript" src="../scripts/jquery/jquery_min.js"></script>
    <script type="text/javascript" src="../scripts/jquery/jquery.box-min.js"></script>

    <link rel="stylesheet" type="text/css" href="../scripts/jquery/jqbox.css" />

    <script type="text/javascript" src="../scripts/ASTJavascript/astreeview/astreeview_packed.js"></script>
    <link rel="stylesheet" type="text/css" href="../scripts/ASTJavascript/astreeview/astreeview.css" />
    <link rel="stylesheet" type="text/css" href="../scripts/ASTJavascript/asdropdowntreeview/dropdowntreeview.css" />

    <script type="text/javascript">
        function nodeSelectHandler(elem) {

            document.getElementById('<%:txtSelectedNode.ClientID%>').value = elem.parentNode.getAttribute("treeNodeValue");
            document.getElementById('<%:btnSelectionPBTrigger.ClientID%>').click();
        }

    </script>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="c_M" runat="server">
    <uc2:Header ID="usc_H" runat="server" />
    <br />
    <uc1:MessageBox ID="usc_M" runat="server" />

    <asp:Panel ID="tbP" runat="server" CssClass="w-bar">
        <asp:LinkButton runat="server" ID="tbl_New" CssClass="w-button" Style="background: url(../images/add32.png); "
            OnClick="OnActionButtons">
            <asp:Label ID="tbl_NewLabel" runat="server"></asp:Label>

        </asp:LinkButton>

        <asp:LinkButton runat="server" ID="tbl_Admin" CssClass="w-button" Style="background: url(../images/config32.png); "
            OnClientClick="$.colorbox({ transition: 'none', width: '95%', height: '98%', iframe: true,href:'Projects/ProjectAdminPage.aspx'}); return false;">
            <asp:Label ID="tbl_AdminLabel" runat="server"></asp:Label>

        </asp:LinkButton>

    </asp:Panel>

    <div>
        <table style="width: 100%">
            <tr>
                <td style="vertical-align: top">
                    <asp:Panel ID="pt" runat="server" CssClass="c3boxleft" ScrollBars="Both">

                        <div style="display: none;">
                            <asp:Button ID="btnSelectionPBTrigger" runat="server" OnClick="OnSelectNode" />
                            <asp:TextBox ID="txtSelectedNode" runat="server"></asp:TextBox>
                            <asp:TextBox ID="txtMessage" runat="server"></asp:TextBox>
                        </div>

                        <ct:ASTreeView ID="astvMyTree" runat="server" BasePath="~/scripts/ASTJavascript/astreeview/"
                            DataTableRootNodeValue="0"
                            EnableRoot="false"
                            EnableNodeSelection="true"
                            EnableCheckbox="false"
                            EnableDragDrop="false"
                            EnableTreeLines="true"
                            EnableNodeIcon="true"
                            EnableCustomizedNodeIcon="true"
                            EnableContextMenu="false"
                            EnableDebugMode="false"
                            EnableAjaxOnEditDelete="true"
                            AddNodeProvider="ProjectManagementSectionPage.aspx"
                            LoadNodesProvider="ProjectManagementSectionPage.aspx"
                            AdditionalLoadNodesRequestParameters="{'t1':'ajaxLoad'}"
                            OnNodeSelectedScript="nodeSelectHandler(elem);"
                            EnableParentNodeExpand="true"
                            EnableHorizontalLock="true"
                            EnableContainerDragDrop="false"
                            EnableOnNodeDragAndDropCompleteScriptReturn="false"
                            Width="400" />
                    </asp:Panel>
                </td>
                <td style="vertical-align: top">
                    <cc4:MKGridView ID="dg_Projects" runat="server" AllowPaging="false" AllowSorting="false" AutoGenerateColumns="False"
                        CellPadding="3" DataKeyNames="ID" Font-Size="8pt" Width="95%">
                        <AlternatingRowStyle CssClass="alternatingrowstyle" />
                        <FooterStyle BackColor="White" ForeColor="#000066" />
                        <HeaderStyle CssClass="headerstyle" Font-Bold="True" HorizontalAlign="Left" Wrap="False" />
                        <PagerStyle HorizontalAlign="Left" />
                        <Columns>
                            <asp:CommandField HeaderText="Select" ShowSelectButton="True" />
                            <asp:BoundField DataField="ID" HeaderText="OnlineTimeRecordingUniqueIdentifier" />
                            <asp:BoundField DataField="Name" HeaderText="OnlineTimeRecordingName" />
                            <asp:BoundField DataField="Reference" HeaderText="OnlineTimeRecordingReference" />
                            <asp:BoundField DataField="Status" HeaderText="OnlineTimeRecordingStatus" />

                        </Columns>

                        <SelectedRowStyle BackColor="#D6E8FF" Font-Bold="True" ForeColor="Black" />
                    </cc4:MKGridView>
                </td>
                <td style="vertical-align: top">
                    <asp:Panel ID="pv" runat="server"
                        Visible="false">
                        <uc5:ProjectDetails ID="u_PD" runat="server" Visible="false" />
                    </asp:Panel>
                </td>
            </tr>
        </table>


    </div>

    <asp:UpdatePanel ID="pn" runat="server">
        <ContentTemplate>

        
            <asp:Button ID="btn_partial_refresh" runat="server" style="display:none;"  />
            <uc3:ProjectUniverseTree ID="u_PRU" runat="server" />
            </ContentTemplate>
    </asp:UpdatePanel>

      <script>

          try {
              $(document).ready(function () {

                  var xPos1, yPos1, timer1;

                  var prm = Sys.WebForms.PageRequestManager.getInstance();
                  prm.add_beginRequest(BeginRequestHandler);
                  prm.add_endRequest(EndRequestHandler);

                  function BeginRequestHandler(sender, args) {

                      try {
                          yPos1 = $(window).scrollTop();
                      } catch (err) { }
                  }

                  function EndRequestHandler(sender, args) {
                      try {
                          $(window).scrollTop(yPos1);
                          timer1 = window.setTimeout(function () { $(window).scrollTop(yPos1); }, 100);

                          $(window).scrollTop(yPos1);
                      }
                      catch (err) { }
                  }

              });
          }
          catch (err) { }

    </script>

</asp:Content>
