2011-03-10 07:49:59 +00:00
|
|
|
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<AddNewSeriesModel>" %>
|
|
|
|
<%@ Import Namespace="NzbDrone.Web.Models" %>
|
|
|
|
<%@ Import Namespace="Telerik.Web.Mvc.UI" %>
|
2011-03-17 07:40:23 +00:00
|
|
|
<%@ Import Namespace="NzbDrone.Core.Repository" %>
|
2011-03-10 07:49:59 +00:00
|
|
|
|
|
|
|
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
|
|
|
|
Add New Series
|
2011-03-17 07:40:23 +00:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
jQuery(document).ready(function () {
|
|
|
|
$('#searchButton').attr('disabled', '');
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2011-03-10 07:49:59 +00:00
|
|
|
</asp:Content>
|
|
|
|
<asp:Content ID="Menu" ContentPlaceHolderID="ActionMenu" runat="server">
|
|
|
|
<%
|
|
|
|
Html.RenderPartial("SubMenu");
|
|
|
|
%>
|
|
|
|
</asp:Content>
|
|
|
|
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
|
|
|
|
|
|
|
|
<%= Html.Label("Enter a Series Name") %>
|
2011-03-11 09:04:56 +00:00
|
|
|
<%= Html.TextBox("new_series_name", String.Empty, new { id="new_series_id" }) %>
|
2011-03-10 07:49:59 +00:00
|
|
|
|
2011-03-11 09:04:56 +00:00
|
|
|
<p>
|
2011-03-17 07:40:23 +00:00
|
|
|
<button class="t.button" id="searchButton" disabled="disabled" onclick="searchSeries ()">Search</button>
|
2011-03-11 09:04:56 +00:00
|
|
|
</p>
|
2011-03-10 07:49:59 +00:00
|
|
|
|
2011-03-11 09:04:56 +00:00
|
|
|
<div id="result"></div>
|
|
|
|
|
2011-03-18 15:39:19 +00:00
|
|
|
<div id="RootDirectories" class="rootDirectories" style="display:none">
|
2011-03-17 07:40:23 +00:00
|
|
|
<fieldset>
|
|
|
|
<legend>Root TV Folders</legend>
|
|
|
|
|
|
|
|
<% int d = 0; %>
|
|
|
|
<% foreach (var dir in Model.RootDirectories)
|
|
|
|
{ %>
|
|
|
|
<%: Html.RadioButton("selectedRootDir", dir.Path, dir.Default, new { @class="dirList examplePart", id="dirRadio_" + d }) %>
|
|
|
|
<%: Html.Label(dir.Path) %>
|
|
|
|
<% if (dir.Default) { %> * <% } %>
|
|
|
|
<% d++;%>
|
|
|
|
<br />
|
|
|
|
<% } %>
|
|
|
|
</fieldset>
|
|
|
|
|
|
|
|
<div id="example"></div>
|
|
|
|
|
|
|
|
<button class="t.button" onclick="addSeries ()">Add New Series</button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="addResult"></div>
|
|
|
|
|
2011-03-11 09:04:56 +00:00
|
|
|
<script type="text/javascript" language="javascript">
|
|
|
|
|
2011-03-17 07:40:23 +00:00
|
|
|
$('#new_series_id').bind('keydown', function (e) {
|
|
|
|
if (e.keyCode == 13) {
|
|
|
|
$('#searchButton').click();
|
|
|
|
}
|
|
|
|
});
|
2011-03-11 09:04:56 +00:00
|
|
|
|
2011-03-17 07:40:23 +00:00
|
|
|
function searchSeries() {
|
|
|
|
var seriesSearch = $('#new_series_id');
|
2011-03-11 09:04:56 +00:00
|
|
|
|
2011-03-17 07:40:23 +00:00
|
|
|
$("#result").text("Searching...");
|
|
|
|
document.getElementById('RootDirectories').style.display = 'none';
|
2011-03-11 09:04:56 +00:00
|
|
|
$("#result").load('<%=Url.Action("SearchForSeries", "Series") %>', {
|
|
|
|
seriesName: seriesSearch.val()
|
2011-03-17 07:40:23 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
$(".searchRadio").live("change", function () {
|
|
|
|
var checked = $(this).attr('checked');
|
|
|
|
|
|
|
|
if (checked) {
|
|
|
|
document.getElementById('RootDirectories').style.display = 'inline';
|
2011-03-11 09:04:56 +00:00
|
|
|
}
|
2011-03-17 07:40:23 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
function addSeries() {
|
|
|
|
//Get the selected tvdbid + selected root folder
|
|
|
|
//jquery bit below doesn't want to work...
|
2011-03-11 09:04:56 +00:00
|
|
|
|
2011-03-17 07:40:23 +00:00
|
|
|
var checkedSeries = $("input[name='selectedSeries']:checked").val();
|
|
|
|
//var checkedSeries = $('input.searchRadio:checked').val();
|
|
|
|
//var checkedSeries = $('input:radio[name=selectedSeries]:checked').val();
|
|
|
|
//var checkedSeries = $('input:radio[class=searchRadio]:checked').val();
|
2011-03-11 09:04:56 +00:00
|
|
|
|
2011-03-17 07:40:23 +00:00
|
|
|
var checkedDir = $("input[name='selectedRootDir']:checked").val();
|
|
|
|
|
|
|
|
var id = "#" + checkedSeries + "_text";
|
|
|
|
var seriesName = $(id).val();
|
|
|
|
|
|
|
|
$("#addResult").load('<%=Url.Action("AddNewSeries", "Series") %>', {
|
|
|
|
dir: checkedDir,
|
|
|
|
seriesId: checkedSeries,
|
|
|
|
seriesName: seriesName
|
|
|
|
});
|
2011-03-11 09:04:56 +00:00
|
|
|
}
|
2011-03-17 07:40:23 +00:00
|
|
|
|
|
|
|
//Need to figure out how to use 'ViewData["DirSep"]' instead of hardcoding '\'
|
|
|
|
$(".examplePart").live("change", function () {
|
|
|
|
var dir = $("input[name='selectedRootDir']:checked").val();
|
|
|
|
var series = $("input[name='selectedSeries']:checked").val();
|
|
|
|
|
|
|
|
var id = "#" + series + "_text";
|
|
|
|
var seriesName = $(id).val();
|
|
|
|
|
|
|
|
var sep = "\\";
|
|
|
|
|
|
|
|
var str = "Example: " + dir + sep + seriesName;
|
|
|
|
|
|
|
|
$('#example').text(str);
|
|
|
|
|
|
|
|
});
|
2011-03-11 09:04:56 +00:00
|
|
|
</script>
|
2011-03-15 15:29:14 +00:00
|
|
|
<div id="tester"></div>
|
2011-03-10 07:49:59 +00:00
|
|
|
|
|
|
|
</asp:Content>
|