<%@ Page Title="" Language="C#" AutoEventWireup="false" MasterPageFile="~/SiteMaster.master" CodeBehind="DefinedListsPage.aspx.cs" Inherits="MKinsight.Online.UIServices.DefinedList.DefinedListsPage" %>

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

<%@ Register Src="../UIControls/Interface/TextBoxEx.ascx" TagName="TextBoxEx" TagPrefix="uc4" %>

<%@ Register Src="../UIControls/Interface/CheckBoxEX.ascx" TagName="CheckBoxEX" TagPrefix="uc5" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="<%:ResolveUrl("~/scripts/ASTJavascript/astreeview/astreeview.css")%>"
        type="text/css" rel="stylesheet" />

    <script src="<%:ResolveUrl("~/scripts/ASTJavascript/astreeview/astreeview_packed.js")%>"
        type="text/javascript"></script>

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

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

        function dndCompleteHandler(elem, newParent) {

            try {

                PageMethods.MoveNodes(elem.getAttribute("treeNodeValue"), newParent.getAttribute("treeNodeValue"), OnSucceeded, OnFailed);
                return true;

			}
            catch (err) {
                return false;
			}
		}

        function OnSucceeded(result, userContext, methodName) { }
        function OnFailed(error, userContext, methodName) { }

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="c_M" runat="server">
    <uc1:Header ID="usc_Header" runat="server" />

    <uc2:MessageBox ID="usc_M" runat="server" />

    <table id="tb_RiskUniverse" runat="server" style="width: 100%">
        <tr>
            <td class="left" style="width: 290px; vertical-align: top;">
                <asp:TreeView ID="tree" runat="server" NodeIndent="15">
                    <SelectedNodeStyle Font-Bold="True" ForeColor="#009933" />
                </asp:TreeView>
            </td>
            <td class="left" style="border-left-color: #09c; border-left-width: 1px; border-left-style: dashed; vertical-align: top;">
                <h2>
                    <asp:Label ID="lbl_Title" runat="server"></asp:Label>
                </h2>
                <asp:Panel ID="pnl_List" runat="server">
                    <uc3:DefinedItemList ID="usc_DfItems" runat="server" Visible="false" />
                </asp:Panel>
                <asp:Panel ID="pnl_Tree" runat="server">
                    <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>
                    <table>
                        <tr>
                            <td class="left" colspan="2" style="height: 20px; vertical-align: top;"></td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lbl_Name" runat="server" Text="Name:"></asp:Label>
                            </td>
                            <td class="amend_field">
                                <asp:TextBox ID="txt_Name" Enabled="false" runat="server" CssClass="amend" MaxLength="256"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lbl_Desc" runat="server" Text="Description:"></asp:Label>
                            </td>
                            <td class="amend_field">
                                <asp:TextBox ID="txt_Desc" runat="server" Enabled="false" CssClass="amend" TextMode="MultiLine"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lbl_ListItems" runat="server" Text="List Items:"></asp:Label>
                            </td>
                            <td class="amend_field">
                                <asp:Panel ID="pnl_Items" runat="server">
                                    <ct:ASTreeView ID="astvMyTree" runat="server" BasePath="~/scripts/ASTJavascript/astreeview/"
                                        DataTableRootNodeValue="0" EnableRoot="false" EnableNodeSelection="true" EnableCheckbox="false"
                                        EnableDragDrop="true" EnableTreeLines="false" EnableNodeIcon="true" EnableCustomizedNodeIcon="false"
                                        EnableContextMenu="false" EnableDebugMode="false" EnableAjaxOnEditDelete="true"
                                        AddNodeProvider="~/ConfigurationPages/DefinedListsPage.aspx" LoadNodesProvider="~/ConfigurationPages/DefinedListsPage.aspx"
                                        AdditionalLoadNodesRequestParameters="{'t1':'ajaxLoad'}" OnNodeSelectedScript="nodeSelectHandler(elem);"
                                        EnableParentNodeExpand="true" EnableHorizontalLock="true" EnableContainerDragDrop="true"
                                        OnNodeDragAndDropCompleteScript="dndCompleteHandler( elem, newParent );" EnableOnNodeDragAndDropCompleteScriptReturn="true"
                                        Width="400" />
                                </asp:Panel>
                                <asp:Panel ID="pnl_Update" runat="server" BorderColor="WhiteSmoke" BorderWidth="1" Visible="false" Width="510px">
                                    <table>
                                        <tr>
                                            <td></td>
                                        </tr>
                                        <tr>
                                            <td>

                                                <uc4:TextBoxEx ID="u_Value" runat="server" />

                                            </td>
                                        </tr>
                                        <tr>
                                            <td>

                                                <uc5:CheckBoxEX ID="u_Archived" runat="server" />

                                            </td>
                                        </tr>
                                    </table>
                                </asp:Panel>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" runat="server" id="td_hr">
                                <hr class="ee" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" runat="server" id="td_Actions">
                                <asp:Button ID="btn_New" runat="server" Font-Bold="true" />
                                <asp:Button ID="btn_Update" runat="server" Font-Bold="true" />
                                <asp:Button ID="btn_Cancel" runat="server" />
                                <span class="smalltab"></span>
                                <asp:Button ID="btn_Up" runat="server" />
                                <asp:Button ID="btn_Down" runat="server" />
                                <asp:Button ID="btn_RemoveParent" runat="server" Visible="false" />
                                <span class="tab">&nbsp;</span><asp:Button ID="btn_Delete" runat="server" ForeColor="Red" />
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </td>
        </tr>
    </table>

</asp:Content>
