<%@ Page Language="c#" MasterPageFile="../masterpages/umbracoDialog.Master" CodeBehind="sort.aspx.cs" AutoEventWireup="True" Inherits="Umbraco.Web.UI.Umbraco.Dialogs.Sort" %>

<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="Umbraco.Core.IO" %>
<%@ Import Namespace="Umbraco.Web" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>

<asp:Content ContentPlaceHolderID="head" runat="server">
    <umb:CssInclude ID="CssInclude1" runat="server" FilePath="Dialogs/SortDialog.css" PathNameAlias="UmbracoClient"></umb:CssInclude>
</asp:Content>

<asp:Content ContentPlaceHolderID="body" runat="server">

    <umb:JsInclude ID="JsInclude3" runat="server" FilePath="Dialogs/SortDialog.js" PathNameAlias="UmbracoClient" />
    <umb:JsInclude ID="JsInclude1" runat="server" FilePath="tablesorting/jquery.tablesorter.min.js" PathNameAlias="UmbracoClient" />
    <umb:JsInclude ID="JsInclude2" runat="server" FilePath="tablesorting/tableDragAndDrop.js" PathNameAlias="UmbracoClient" />

    <div class="umb-dialog-body">
        <cc1:Pane runat="server">

          <div id="loading" style="display: none; margin-bottom: 35px;">
                <div class="notice">
                    <p><%= umbraco.ui.Text("sort", "sortPleaseWait") %></p>
                </div>
                
                <div class="umb-loader-wrapper">
                    <cc1:ProgressBar ID="prog1" runat="server" Title="sorting.." />
                </div>
            </div>

            <div id="sortingDone" style="display: none;" class="success">
                <div class="alert alert-success">
                    <asp:Literal runat="server" ID="sortDone"></asp:Literal>
                </div>
                <button class="btn btn-primary" onclick="UmbClientMgr.closeModalWindow()"><%= umbraco.ui.Text("general", "ok")%></button>
            </div>

            <div id="sortArea">
                <p class="help">
                    <%= umbraco.ui.Text("sort", "sortHelp") %>
                </p>

                <div id="sortableFrame">
                    <table id="sortableNodes">
                        <thead>
                            <tr>
                                <th style="width: 100%"><%= umbraco.ui.Text("general", "name") %></th>
                                <th class="nowrap" style="display: <%= HideDateColumn ? "none" : "table-cell" %>;"><%= umbraco.ui.Text("sort", "sortCreationDate") %></th>
                                <th class="nowrap"><%= umbraco.ui.Text("sort", "sortOrder") %></th>
                            </tr>
                        </thead>
                        <tbody>
                            <asp:Literal ID="lt_nodes" runat="server" />
                        </tbody>
                    </table>
                </div>
            </div>
        </cc1:Pane>

    </div>
    <div class="umb-dialog-footer btn-toolbar umb-btn-toolbar">
        <a id="closeWindowButton" href="#" class="btn btn-link"><%=umbraco.ui.Text("general", "cancel", this.getUser())%></a>
        <input id="submitButton" type="button" class="btn btn-primary" value="<%=umbraco.ui.Text("save") %>" />
    </div>

    <script type="text/javascript">

        jQuery(document).ready(function () {

            var sortDialog = new Umbraco.Dialogs.SortDialog({
                submitButton: jQuery("#submitButton"),
                closeWindowButton: jQuery("#closeWindowButton"),
                dateTimeFormat: "<%=CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern%> <%=CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern%>",
                currentId: "<%=Request.CleanForXss("ID")%>",
                serviceUrl: "<%= IOHelper.ResolveUrl(SystemDirectories.Umbraco)%>/WebServices/NodeSorter.asmx/UpdateSortOrder?app=<%=Request.CleanForXss("app")%>"
            });

            sortDialog.init();
        });

    </script>

</asp:Content>