2011-03-11 09:04:56 +00:00
|
|
|
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<List<NzbDrone.Web.Models.SeriesSearchResultModel>>" %>
|
|
|
|
<%@ Import Namespace="NzbDrone.Core.Repository" %>
|
|
|
|
|
|
|
|
<div id="searchResults">
|
|
|
|
<fieldset>
|
|
|
|
<legend>Search Results</legend>
|
2011-03-15 15:29:14 +00:00
|
|
|
|
|
|
|
<% int r = 0; %>
|
2011-03-11 09:04:56 +00:00
|
|
|
<% foreach (var result in Model)
|
|
|
|
{ %>
|
2011-03-15 15:29:14 +00:00
|
|
|
<%: Html.RadioButton("selectedSeries", result.TvDbId, new { @class="searchRadio examplePart", id="searchRadio_" + r }) %>
|
|
|
|
<b><%: Html.Label(result.TvDbName) %></b> (<%: Html.Label(result.FirstAired.ToString("MM/dd/yyyy"))%>)
|
|
|
|
|
|
|
|
<%: Html.TextBox(result.TvDbName + "_text", result.TvDbName, new { id = result.TvDbId + "_text", style="display:none" }) %>
|
|
|
|
<% r++;%>
|
2011-03-11 09:04:56 +00:00
|
|
|
<br />
|
2011-03-15 15:29:14 +00:00
|
|
|
<%
|
|
|
|
} %>
|
2011-03-11 09:04:56 +00:00
|
|
|
</fieldset>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="RootDirectories" style="display:none">
|
|
|
|
<fieldset>
|
|
|
|
<legend>Root TV Folders</legend>
|
2011-03-15 15:29:14 +00:00
|
|
|
|
|
|
|
<% int d = 0; %>
|
2011-03-11 09:04:56 +00:00
|
|
|
<% foreach (var dir in (List<RootDir>)ViewData["RootDirs"])
|
|
|
|
{ %>
|
2011-03-15 15:29:14 +00:00
|
|
|
<%: Html.RadioButton("selectedRootDir", dir.Path, dir.Default, new { @class="dirList examplePart", id="dirRadio_" + d }) %>
|
2011-03-11 09:04:56 +00:00
|
|
|
<%: Html.Label(dir.Path) %>
|
2011-03-15 15:29:14 +00:00
|
|
|
<% if (dir.Default) { %> * <% } %>
|
|
|
|
<% d++;%>
|
2011-03-11 09:04:56 +00:00
|
|
|
<br />
|
|
|
|
<% } %>
|
|
|
|
</fieldset>
|
|
|
|
|
|
|
|
<div id="example"></div>
|
|
|
|
|
|
|
|
<button class="t.button" onclick="addSeries ()">Add New Series</button>
|
|
|
|
</div>
|
|
|
|
|
2011-03-15 15:29:14 +00:00
|
|
|
<div id="addResult"></div>
|
2011-03-11 09:04:56 +00:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(".searchRadio").live("change", function () {
|
|
|
|
var checked = $(this).attr('checked');
|
|
|
|
|
|
|
|
if (checked) {
|
|
|
|
document.getElementById('RootDirectories').style.display = 'inline';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
function addSeries() {
|
|
|
|
//Get the selected tvdbid + selected root folder
|
|
|
|
//jquery bit below doesn't want to work...
|
|
|
|
|
2011-03-15 15:29:14 +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();
|
|
|
|
|
|
|
|
var checkedDir = $("input[name='selectedRootDir']:checked").val();
|
2011-03-11 09:04:56 +00:00
|
|
|
|
2011-03-15 15:29:14 +00:00
|
|
|
var id = "#" + checkedSeries + "_text";
|
|
|
|
var seriesName = $(id).val();
|
2011-03-11 09:04:56 +00:00
|
|
|
|
2011-03-15 15:29:14 +00:00
|
|
|
$("#addResult").load('<%=Url.Action("AddNewSeries", "Series") %>', {
|
|
|
|
dir: checkedDir,
|
|
|
|
seriesId: checkedSeries,
|
|
|
|
seriesName: seriesName
|
|
|
|
});
|
2011-03-11 09:04:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-15 15:29:14 +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();
|
2011-03-11 09:04:56 +00:00
|
|
|
|
2011-03-15 15:29:14 +00:00
|
|
|
var id = "#" + series + "_text";
|
|
|
|
var seriesName = $(id).val();
|
2011-03-11 09:04:56 +00:00
|
|
|
|
2011-03-15 15:29:14 +00:00
|
|
|
//var sep = '<%= ViewData["DirSep"] %>';
|
|
|
|
var sep = "\\";
|
|
|
|
|
|
|
|
var str = "Example: " + dir + sep + seriesName;
|
|
|
|
|
|
|
|
$('#example').text(str);
|
|
|
|
|
|
|
|
});
|
2011-03-11 09:04:56 +00:00
|
|
|
</script>
|