parent
68321c98d0
commit
b4fb3002a4
File diff suppressed because one or more lines are too long
@ -0,0 +1,250 @@
|
||||
/*! Copyright (c) 2008 Brandon Aaron (http://brandonaaron.net)
|
||||
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
||||
*
|
||||
* Version: 1.0.3
|
||||
* Requires jQuery 1.1.3+
|
||||
* Docs: http://docs.jquery.com/Plugins/livequery
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
$.extend($.fn, {
|
||||
livequery: function(type, fn, fn2) {
|
||||
var self = this, q;
|
||||
|
||||
// Handle different call patterns
|
||||
if ($.isFunction(type))
|
||||
fn2 = fn, fn = type, type = undefined;
|
||||
|
||||
// See if Live Query already exists
|
||||
$.each( $.livequery.queries, function(i, query) {
|
||||
if ( self.selector == query.selector && self.context == query.context &&
|
||||
type == query.type && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) )
|
||||
// Found the query, exit the each loop
|
||||
return (q = query) && false;
|
||||
});
|
||||
|
||||
// Create new Live Query if it wasn't found
|
||||
q = q || new $.livequery(this.selector, this.context, type, fn, fn2);
|
||||
|
||||
// Make sure it is running
|
||||
q.stopped = false;
|
||||
|
||||
// Run it immediately for the first time
|
||||
q.run();
|
||||
|
||||
// Contnue the chain
|
||||
return this;
|
||||
},
|
||||
|
||||
expire: function(type, fn, fn2) {
|
||||
var self = this;
|
||||
|
||||
// Handle different call patterns
|
||||
if ($.isFunction(type))
|
||||
fn2 = fn, fn = type, type = undefined;
|
||||
|
||||
// Find the Live Query based on arguments and stop it
|
||||
$.each( $.livequery.queries, function(i, query) {
|
||||
if ( self.selector == query.selector && self.context == query.context &&
|
||||
(!type || type == query.type) && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) && !this.stopped )
|
||||
$.livequery.stop(query.id);
|
||||
});
|
||||
|
||||
// Continue the chain
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
$.livequery = function(selector, context, type, fn, fn2) {
|
||||
this.selector = selector;
|
||||
this.context = context || document;
|
||||
this.type = type;
|
||||
this.fn = fn;
|
||||
this.fn2 = fn2;
|
||||
this.elements = [];
|
||||
this.stopped = false;
|
||||
|
||||
// The id is the index of the Live Query in $.livequery.queries
|
||||
this.id = $.livequery.queries.push(this)-1;
|
||||
|
||||
// Mark the functions for matching later on
|
||||
fn.$lqguid = fn.$lqguid || $.livequery.guid++;
|
||||
if (fn2) fn2.$lqguid = fn2.$lqguid || $.livequery.guid++;
|
||||
|
||||
// Return the Live Query
|
||||
return this;
|
||||
};
|
||||
|
||||
$.livequery.prototype = {
|
||||
stop: function() {
|
||||
var query = this;
|
||||
|
||||
if ( this.type )
|
||||
// Unbind all bound events
|
||||
this.elements.unbind(this.type, this.fn);
|
||||
else if (this.fn2)
|
||||
// Call the second function for all matched elements
|
||||
this.elements.each(function(i, el) {
|
||||
query.fn2.apply(el);
|
||||
});
|
||||
|
||||
// Clear out matched elements
|
||||
this.elements = [];
|
||||
|
||||
// Stop the Live Query from running until restarted
|
||||
this.stopped = true;
|
||||
},
|
||||
|
||||
run: function() {
|
||||
// Short-circuit if stopped
|
||||
if ( this.stopped ) return;
|
||||
var query = this;
|
||||
|
||||
var oEls = this.elements,
|
||||
els = $(this.selector, this.context),
|
||||
nEls = els.not(oEls);
|
||||
|
||||
// Set elements to the latest set of matched elements
|
||||
this.elements = els;
|
||||
|
||||
if (this.type) {
|
||||
// Bind events to newly matched elements
|
||||
nEls.bind(this.type, this.fn);
|
||||
|
||||
// Unbind events to elements no longer matched
|
||||
if (oEls.length > 0)
|
||||
$.each(oEls, function(i, el) {
|
||||
if ( $.inArray(el, els) < 0 )
|
||||
$.event.remove(el, query.type, query.fn);
|
||||
});
|
||||
}
|
||||
else {
|
||||
// Call the first function for newly matched elements
|
||||
nEls.each(function() {
|
||||
query.fn.apply(this);
|
||||
});
|
||||
|
||||
// Call the second function for elements no longer matched
|
||||
if ( this.fn2 && oEls.length > 0 )
|
||||
$.each(oEls, function(i, el) {
|
||||
if ( $.inArray(el, els) < 0 )
|
||||
query.fn2.apply(el);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.extend($.livequery, {
|
||||
guid: 0,
|
||||
queries: [],
|
||||
queue: [],
|
||||
running: false,
|
||||
timeout: null,
|
||||
|
||||
checkQueue: function() {
|
||||
if ( $.livequery.running && $.livequery.queue.length ) {
|
||||
var length = $.livequery.queue.length;
|
||||
// Run each Live Query currently in the queue
|
||||
while ( length-- )
|
||||
$.livequery.queries[ $.livequery.queue.shift() ].run();
|
||||
}
|
||||
},
|
||||
|
||||
pause: function() {
|
||||
// Don't run anymore Live Queries until restarted
|
||||
$.livequery.running = false;
|
||||
},
|
||||
|
||||
play: function() {
|
||||
// Restart Live Queries
|
||||
$.livequery.running = true;
|
||||
// Request a run of the Live Queries
|
||||
$.livequery.run();
|
||||
},
|
||||
|
||||
registerPlugin: function() {
|
||||
$.each( arguments, function(i,n) {
|
||||
// Short-circuit if the method doesn't exist
|
||||
if (!$.fn[n]) return;
|
||||
|
||||
// Save a reference to the original method
|
||||
var old = $.fn[n];
|
||||
|
||||
// Create a new method
|
||||
$.fn[n] = function() {
|
||||
// Call the original method
|
||||
var r = old.apply(this, arguments);
|
||||
|
||||
// Request a run of the Live Queries
|
||||
$.livequery.run();
|
||||
|
||||
// Return the original methods result
|
||||
return r;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
run: function(id) {
|
||||
if (id != undefined) {
|
||||
// Put the particular Live Query in the queue if it doesn't already exist
|
||||
if ( $.inArray(id, $.livequery.queue) < 0 )
|
||||
$.livequery.queue.push( id );
|
||||
}
|
||||
else
|
||||
// Put each Live Query in the queue if it doesn't already exist
|
||||
$.each( $.livequery.queries, function(id) {
|
||||
if ( $.inArray(id, $.livequery.queue) < 0 )
|
||||
$.livequery.queue.push( id );
|
||||
});
|
||||
|
||||
// Clear timeout if it already exists
|
||||
if ($.livequery.timeout) clearTimeout($.livequery.timeout);
|
||||
// Create a timeout to check the queue and actually run the Live Queries
|
||||
$.livequery.timeout = setTimeout($.livequery.checkQueue, 20);
|
||||
},
|
||||
|
||||
stop: function(id) {
|
||||
if (id != undefined)
|
||||
// Stop are particular Live Query
|
||||
$.livequery.queries[ id ].stop();
|
||||
else
|
||||
// Stop all Live Queries
|
||||
$.each( $.livequery.queries, function(id) {
|
||||
$.livequery.queries[ id ].stop();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Register core DOM manipulation methods
|
||||
$.livequery.registerPlugin('append', 'prepend', 'after', 'before', 'wrap', 'attr', 'removeAttr', 'addClass', 'removeClass', 'toggleClass', 'empty', 'remove');
|
||||
|
||||
// Run Live Queries when the Document is ready
|
||||
$(function() { $.livequery.play(); });
|
||||
|
||||
|
||||
// Save a reference to the original init method
|
||||
var init = $.prototype.init;
|
||||
|
||||
// Create a new init method that exposes two new properties: selector and context
|
||||
$.prototype.init = function(a,c) {
|
||||
// Call the original init and save the result
|
||||
var r = init.apply(this, arguments);
|
||||
|
||||
// Copy over properties if they exist already
|
||||
if (a && a.selector)
|
||||
r.context = a.context, r.selector = a.selector;
|
||||
|
||||
// Set properties
|
||||
if ( typeof a == 'string' )
|
||||
r.context = c || document, r.selector = a;
|
||||
|
||||
// Return the result
|
||||
return r;
|
||||
};
|
||||
|
||||
// Give the init function the jQuery prototype for later instantiation (needed after Rev 4091)
|
||||
$.prototype.init.prototype = $.prototype;
|
||||
|
||||
})(jQuery);
|
@ -1,15 +0,0 @@
|
||||
@model IEnumerable<String>
|
||||
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
@if (Model.Count() == 0)
|
||||
{
|
||||
@Html.DisplayText("No Series to Add");
|
||||
}
|
||||
|
||||
@foreach (var path in Model)
|
||||
{
|
||||
Html.RenderAction("RenderPartial", "AddSeries", new {path});
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
@using NzbDrone.Core.Repository.Quality
|
||||
@model SelectList
|
||||
<div style="padding:3px" id="div_@(ViewData["guid"])">
|
||||
<fieldset>
|
||||
<legend>@ViewData["path"].ToString()</legend>
|
||||
<div>
|
||||
@{Html.Telerik().ComboBox()
|
||||
.Name("seriesList_" + ViewData["guid"])
|
||||
.BindTo(Model)
|
||||
.DataBinding(binding => binding.Ajax().Select("_textLookUp", "AddSeries").Delay(400))
|
||||
.Filterable(f => f.FilterMode(AutoCompleteFilterMode.Contains))
|
||||
.HighlightFirstMatch(true)
|
||||
.HtmlAttributes(new { style = "width: 300px;" })
|
||||
.Render();}
|
||||
@Html.Telerik().DropDownList().Name("qualityList_" + ViewData["guid"]).BindTo((SelectList)ViewData["quality"]).HtmlAttributes(new { style = "width: 100px", @class = "qualityDropbox" })
|
||||
<button class="listButton" onclick="addSeries('@ViewData["guid"]','@ViewData["javaPath"].ToString()' )">
|
||||
Add</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
@ -0,0 +1,98 @@
|
||||
@using System.Collections
|
||||
@using NzbDrone.Web.Models
|
||||
@using System.Web.Mvc.Html
|
||||
@model ExistingSeriesModel
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
@if (Model.ExistingSeries.Count == 0)
|
||||
{
|
||||
<h3 style="color: tomato">
|
||||
No series available. Try adding a new Root Folder.
|
||||
</h3>
|
||||
}
|
||||
else
|
||||
{
|
||||
<h3>
|
||||
Series Ready to be added.
|
||||
@Html.DropDownList(Guid.NewGuid().ToString(), Model.Quality, new { @class = "qualitySelector masterQualitySelector" })
|
||||
</h3>
|
||||
<div>
|
||||
|
||||
</div>
|
||||
|
||||
}
|
||||
@foreach (var series in Model.ExistingSeries)
|
||||
{
|
||||
<span class="existingSeries">
|
||||
<div>
|
||||
<span class="seriesPathValue">
|
||||
@Html.Label(series.Item1)
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<input class="seriesLookup" type="text" style="width: 400px" value="@series.Item2" />
|
||||
@Html.DropDownList(Guid.NewGuid().ToString(), Model.Quality, new { @class = "qualitySelector" })
|
||||
<button class="addExistingButton">
|
||||
Add</button>
|
||||
</div>
|
||||
</span>
|
||||
}
|
||||
|
||||
<style>
|
||||
.existingSeries
|
||||
{
|
||||
border-color: #f2f2f2;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
background-color: #f2f2f2;
|
||||
margin: 0px 10px 20px 0px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
display: inline-block;
|
||||
}
|
||||
.masterQualitySelector
|
||||
{
|
||||
left: 202px;
|
||||
position: relative;
|
||||
background-color: #f2f2f2;
|
||||
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
|
||||
$(".masterQualitySelector").change(function () {
|
||||
|
||||
var profileId = $(this).val();
|
||||
$("#existingSeries").find(".qualitySelector").each(function () {
|
||||
$(this).val(profileId);
|
||||
});
|
||||
});
|
||||
|
||||
$(".addExistingButton").click(function () {
|
||||
|
||||
var root = $(this).parents(".existingSeries");
|
||||
|
||||
var addSeriesUrl = '@Url.Action("AddExistingSeries", "AddSeries")';
|
||||
var title = $(this).siblings(".seriesLookup").val();
|
||||
var qualityId = $(this).siblings(".qualitySelector").val();
|
||||
|
||||
var path = root.find(".seriesPathValue Label").text();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: addSeriesUrl,
|
||||
data: jQuery.param({ path: path, seriesName: title, qualityProfileId: qualityId }),
|
||||
error: function (req, status, error) {
|
||||
alert("Sorry! We could not add " + path + " at this time. " + error);
|
||||
},
|
||||
success: function () {
|
||||
root.hide('highlight', 'fast');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
@ -1,42 +1,35 @@
|
||||
@using NzbDrone.Web.Helpers;
|
||||
@using NzbDrone.Web.Models;
|
||||
@model NzbDrone.Web.Models.SeriesModel
|
||||
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
<div style="width: 435px; margin: 10px;">
|
||||
|
||||
<div class=".settingsForm">
|
||||
@Html.HiddenFor(m => m.SeriesId)
|
||||
|
||||
<div class="edit-group">
|
||||
<div class="config-title">@Html.LabelFor(m => m.Path)</div>
|
||||
<div class="config-value">@Html.TextBoxFor(m => m.Path, new { style = "width: 300" })</div>
|
||||
</div>
|
||||
|
||||
<div class="edit-group">
|
||||
<div class="config-title">@Html.LabelFor(m => m.Monitored)</div>
|
||||
<div class="config-value">@Html.CheckBoxFor(m => m.Monitored, new { style = "margin-right:287px" })</div>
|
||||
</div>
|
||||
|
||||
<div class="edit-group">
|
||||
<div class="config-title">@Html.LabelFor(m => m.SeasonFolder)</div>
|
||||
<div class="config-value">@Html.CheckBoxFor(m => m.SeasonFolder, new { style = "margin-right:287px" })</div>
|
||||
</div>
|
||||
|
||||
<div class="edit-group">
|
||||
<b>@Html.LabelFor(m => m.QualityProfileId)</b>
|
||||
@Html.DropDownListFor(model => model.QualityProfileId, (SelectList)ViewData["SelectList"], new { style = "margin-left:40px" })
|
||||
</div>
|
||||
|
||||
<label class="labelClass">@Html.LabelFor(m => m.Monitored)
|
||||
<span class="small">@Html.DescriptionFor(m => m.Monitored)</span>
|
||||
</label>
|
||||
@Html.CheckBoxFor(m => m.Monitored, new { @class = "inputClass checkClass" })
|
||||
<label class="labelClass">@Html.LabelFor(m => m.SeasonFolder)
|
||||
<span class="small">@Html.DescriptionFor(m => m.SeasonFolder)</span>
|
||||
</label>
|
||||
@Html.CheckBoxFor(m => m.SeasonFolder, new { @class = "inputClass checkClass" })
|
||||
<label class="labelClass">@Html.LabelFor(m => m.QualityProfileId)
|
||||
<span class="small">@Html.DescriptionFor(m => m.QualityProfileId)</span>
|
||||
</label>
|
||||
@Html.DropDownListFor(m => m.QualityProfileId, (SelectList)ViewData["SelectList"], new { @class = "inputClass" })
|
||||
|
||||
<div id="seasonEditorSection">
|
||||
<div style="font-weight: bold; padding-right: 15px; padding-bottom: 5px;">
|
||||
@Html.LabelFor(m => m.SeasonEditor)
|
||||
<span id="seasonEditorLoader"><img src="../../../Content/Images/ajax-loader.gif" width="14px" height="14px" style="margin-bottom: -2px;"/></span>
|
||||
<span id="seasonEditorLoader">
|
||||
<img src="../../../Content/Images/ajax-loader.gif" width="14px" height="14px" style="margin-bottom: -2px;" /></span>
|
||||
</div>
|
||||
<div id="season-editor">
|
||||
</div>
|
||||
<div id="season-editor"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<span id="ajaxSaveWheel" style="display: none; float: right; padding-right: 368px; padding-top: 1.5px;"><img src="../../../Content/Images/ajax-loader.gif" width="20px" height="20px"/></span>
|
||||
<span id="ajaxSaveWheel" style="display: none; float: right; padding-right: 368px;
|
||||
padding-top: 1.5px;">
|
||||
<img src="../../../Content/Images/ajax-loader.gif" width="20px" height="20px" /></span>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue