<%@ control language="C#" autoeventwireup="true" inherits="controls_admin_releases, controls.admin" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<div class="row">
    <div class="container">
        <div class="row">
            <div class="panel panel-primary">
                <!-- Default panel contents -->
                <div class="panel-heading">Releases</div>
                <div class="panel-body">
                    <div class="row">
                        <div class="col-md-8">
                            <h4>Release Management</h4>
                        </div>
                        <div class="col-md-4 text-right">
                            <asp:LinkButton ID="btnNewRelease" CssClass="glyphicon glyphicon-plus palette-add" runat="server"
                                OnClick="btnNewRelease_Click" data-toggle="tooltip" title="Add">
                            </asp:LinkButton>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-12">
                            <asp:UpdatePanel ID="upReleases" runat="server" UpdateMode="Conditional">
                                <ContentTemplate>
                                    <asp:Panel ID="pnlReleaseList" runat="server">
                                        <div class="table-responsive">
                                            <asp:Repeater ID="rptReleases" runat="server">
                                                <HeaderTemplate>
                                                    <table class="dataTableGrid table table-bordered table-striped table-hover" data-page-length="15">
                                                        <thead>
                                                            <tr>
                                                                <th>Date</th>
                                                                <th>Version No</th>
                                                                <th>Available</th>
                                                                <th>Date Uploaded</th>
                                                                <th class="optionCol">Edit</th>
                                                                <th class="optionCol">Delete</th>
                                                            </tr>
                                                        </thead><tbody>
                                                </HeaderTemplate>
                                                <ItemTemplate>
                                                    
                                                        <tr>
                                                            <td>
                                                                <%#DataBinder.Eval(Container, "DataItem.versionDate")%>
                                                            </td>
                                                            <td>
                                                                <%#DataBinder.Eval(Container, "DataItem.versionNo")%>
                                                            </td>
                                                            <td>
                                                                <%#DataBinder.Eval(Container, "DataItem.isAvailable")%>
                                                            </td>
                                                            <td>
                                                                <%#DataBinder.Eval(Container, "DataItem.dateSaved")%>
                                                            </td>
                                                            <td class="optionCol">
                                                                <asp:LinkButton ID="lnkEdit" runat="server" CssClass="glyphicon glyphicon-edit palette-edit"
                                                                    CommandArgument='<%# Bind("recId") %>' OnClick="lnkEdit_Click"
                                                                    data-toggle="tooltip" title="Edit">
                                                                </asp:LinkButton></td>
                                                            <td class="optionCol">
                                                                <asp:LinkButton ID="lnkRemove" runat="server" CssClass="glyphicon glyphicon-remove palette-remove"
                                                                    OnClientClick="return window.confirm('Are you sure wish to delete this item?');"
                                                                    CommandArgument='<%# Bind("recId") %>' OnClick="lnkRemove_Click"
                                                                    data-toggle="tooltip" title="Delete">
                                                                </asp:LinkButton>
                                                            </td>
                                                        </tr>
                                                    
                                                </ItemTemplate>
                                                <FooterTemplate>
                                                    </tbody></table>
                                                </FooterTemplate>
                                            </asp:Repeater>
                                        </div>
                                    </asp:Panel>
                                    <asp:Panel ID="pnlReleasePage" runat="server" Visible="false">
                                        <div class="row">
                                            <div class="col-md-12">
                                                <hr />
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-md-6 col-lg-offset-2 form-horizontal">
                                                <div class="col-sm-offset-4 col-sm-8">
                                                    <asp:ValidationSummary ID="ValidationSummary6" CssClass="alert alert-danger alert-dismissible" ShowMessageBox="false" runat="server" DisplayMode="BulletList"
                                                        Visible="true" ValidationGroup="Release" />
                                                    <asp:Panel ID="pnlResult" Width="100%" Visible="false" runat="server">
                                                        <div class="alert alert-warning alert-dismissible" role="alert">
                                                            <p>
                                                                <asp:Label ID="lblResult" runat="server"></asp:Label>
                                                            </p>
                                                        </div>
                                                    </asp:Panel>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-md-12">
                                                <div class="form-horizontal">
                                                    <div class="row">
                                                        <div class="col-sm-5 col-sm-offset-1">
                                                            <div class="form-group">
                                                                <label for="txtVersionNo" class="col-sm-4 control-label">Version No</label>
                                                                <div class="col-sm-8">
                                                                    <input type="text" class="form-control" id="txtVersionNo" runat="server" placeholder="Version No">
                                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" SetFocusOnError="true"
                                                                        ControlToValidate="txtVersionNo" ValidationGroup="Release" Display="None"
                                                                        ErrorMessage="Missing: Version No"></asp:RequiredFieldValidator>
                                                                </div>
                                                            </div>
                                                            <div class="form-group">
                                                                <label for="txtName" class="col-sm-4 control-label">Available</label>
                                                                <div class="col-sm-8">
                                                                    <div class="col-sm-12">
                                                                        <div>
                                                                            <asp:CheckBox ID="chkAvailable" runat="server" Text="available for download" />
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-sm-5">
                                                            <div class="form-group">
                                                                <label for="txtCaption" class="col-sm-4 control-label">Select Files(s):</label>
                                                                <div class="col-sm-8">
                                                                    <telerik:RadAsyncUpload runat="server" ID="radReleaseFileUpload" MultipleFileSelection="Automatic" AllowedFileExtensions=".zip" OnFileUploaded="radReleaseFileUpload_FileUploaded" EnableInlineProgress="true">
                                                                        <FileFilters>
                                                                            <telerik:FileFilter Description="Compressed Files" Extensions=".zip" />
                                                                        </FileFilters>
                                                                    </telerik:RadAsyncUpload>
                                                                    <telerik:RadProgressManager ID="RadProgressManager2" runat="server" />
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="row">
                                                        <div class="col-sm-10 col-sm-offset-1">
                                                            <div class="form-group">
                                                                <label for="edReleaseNotes" class="col-sm-4 control-label">Release Notes</label>
                                                                <br />
                                                                <br />
                                                                <telerik:RadEditor ID="edReleaseNotes" OnClientLoad="RadEditorClientLoad" Width="100%" Height="500px" runat="server">
                                                                    <CssFiles>
                                                                        <telerik:EditorCssFile Value="~/css/cms.css" />
                                                                    </CssFiles>
                                                                    <Content>                 
                                                                    </Content>
                                                                    <ImageManager ViewPaths="~/upload/image"
                                                                        UploadPaths="~/upload/image"
                                                                        DeletePaths="~/upload/image" MaxUploadFileSize="7100000"></ImageManager>
                                                                    <DocumentManager ViewPaths="~/upload/file" UploadPaths="~/upload/file" DeletePaths="~/upload/file" MaxUploadFileSize="7100000" />
                                                                    <FlashManager ViewPaths="~/upload/flash" UploadPaths="~/upload/flash" DeletePaths="~/upload/flash" />
                                                                </telerik:RadEditor>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="row">
                                                        <div class="col-md-12">
                                                            <div class="form-group">
                                                                <div class="col-sm-3 col-sm-offset-5">
                                                                    <asp:Button ID="btnSave" runat="server" CssClass="btn btn-info" Text="Save" ValidationGroup="Release" OnClick="btnSave_Click" />
                                                                    |
                                                                <asp:Button ID="btnCancel" runat="server" CssClass="btn btn-warning" Text="Back" OnClick="btnCancel_Click" />
                                                                </div>

                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </asp:Panel>
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="btnCancel" EventName="Click" />
                                    <asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />
                                    <ajax:AsyncPostBackTrigger ControlID="btnNewRelease" EventName="Click" />
                                </Triggers>
                            </asp:UpdatePanel>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
