mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-10 04:52:42 +01:00
Merge branch 'kay.one' of github.com:NzbDrone/NzbDrone into markus
This commit is contained in:
commit
8b841c633a
@ -148,16 +148,6 @@
|
||||
<categoryid>6</categoryid>
|
||||
<enclosure url="http://nzbmatrix.com/nzb-details.php?id=914427&hit=1" length="418717368" type="application/x-nzb" />
|
||||
</item>
|
||||
<item>
|
||||
<title>Fussball Bundesliga 2010 2011 30 Spieltag FC Bayern Muenchen vs Bayer 04 Leverkusen German WS dTV XviD WoGS</title>
|
||||
<guid>http://nzbmatrix.com/nzb-details.php?id=914423&hit=1</guid>
|
||||
<link>http://nzbmatrix.com/nzb-details.php?id=914423&hit=1</link>
|
||||
<description><![CDATA[<b>Name:</b> Fussball Bundesliga 2010 2011 30 Spieltag FC Bayern Muenchen vs Bayer 04 Leverkusen German WS dTV XviD WoGS<br /><b>Category:</b> TV: Divx/Xvid<br /><b>Size:</b> 1.28 GB<br /><b>Added:</b> 2011-04-25 11:41:35<br /><b>Group:</b> alt.binaries.multimedia <BR /><b>NFO:</b> <a href="http://nzbmatrix.com/viewnfo.php?id=914423">View NFO</a> ]]></description>
|
||||
<category>TV: Divx/Xvid</category>
|
||||
<cattext>tv.divx/xvid</cattext>
|
||||
<categoryid>6</categoryid>
|
||||
<enclosure url="http://nzbmatrix.com/nzb-details.php?id=914423&hit=1" length="1377828864" type="application/x-nzb" />
|
||||
</item>
|
||||
<item>
|
||||
<title>How I Met Your Mother S06E20 The Exploding Meatball Sub German Custom Subbed WS HDTV XviD iNTERNAL BaCKToRG</title>
|
||||
<guid>http://nzbmatrix.com/nzb-details.php?id=914420&hit=1</guid>
|
||||
|
@ -1,10 +1,12 @@
|
||||
// ReSharper disable RedundantUsingDirective
|
||||
using System;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test
|
||||
{
|
||||
@ -52,10 +54,10 @@ public class ParserTest : CoreTest
|
||||
public void ParseTitle_single(string postTitle, string title, int seasonNumber, int episodeNumber)
|
||||
{
|
||||
var result = Parser.ParseTitle(postTitle);
|
||||
result.EpisodeNumbers.Should().HaveCount(1);
|
||||
result.SeasonNumber.Should().Be(seasonNumber);
|
||||
result.EpisodeNumbers[0].Should().Be(episodeNumber);
|
||||
result.EpisodeNumbers.First().Should().Be(episodeNumber);
|
||||
result.CleanTitle.Should().Be(Parser.NormalizeTitle(title));
|
||||
result.EpisodeNumbers.Count.Should().Be(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -68,12 +70,15 @@ public void ParseTitle_single(string postTitle, string title, int seasonNumber,
|
||||
[TestCase(@"P:\TV Shows\House\Season 6\S06E13 - 5 to 9 - 720p BluRay.mkv", 6, 13)]
|
||||
[TestCase(@"S:\TV Drop\House - 10x11 - Title [SDTV]\1011 - Title.avi", 10, 11)]
|
||||
[TestCase(@"S:\TV Drop\King of the Hill - 10x12 - 24 Hour Propane People [SDTV]\1012 - 24 Hour Propane People.avi", 10, 12)]
|
||||
[TestCase(@"S:\TV Drop\King of the Hill - 10x12 - 24 Hour Propane People [SDTV]\Hour Propane People.avi", 10, 12)]
|
||||
public void PathParse_tests(string path, int season, int episode)
|
||||
{
|
||||
var result = Parser.ParsePath(path);
|
||||
result.EpisodeNumbers.Should().HaveCount(1);
|
||||
result.SeasonNumber.Should().Be(season);
|
||||
result.EpisodeNumbers[0].Should().Be(episode);
|
||||
|
||||
ExceptionVerification.IgnoreWarns();
|
||||
}
|
||||
|
||||
[TestCase("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", QualityTypes.DVD)]
|
||||
@ -167,7 +172,7 @@ public void TitleParse_multi(string postTitle, string title, int season, int[] e
|
||||
[TestCase("2011.01.10 - Denis Leary - HD TV.mkv", "", 2011, 1, 10)]
|
||||
[TestCase("2011.03.13 - Denis Leary - HD TV.mkv", "", 2011, 3, 13)]
|
||||
[TestCase("The Tonight Show with Jay Leno - 2011-06-16 - Larry David, \"Bachelorette\" Ashley Hebert, Pitbull with Ne-Yo", "The Tonight Show with Jay Leno", 2011, 6, 16)]
|
||||
public void episode_daily_parse(string postTitle, string title, int year, int month, int day)
|
||||
public void parse_daily_episodes(string postTitle, string title, int year, int month, int day)
|
||||
{
|
||||
var result = Parser.ParseTitle(postTitle);
|
||||
var airDate = new DateTime(year, month, day);
|
||||
@ -176,6 +181,16 @@ public void episode_daily_parse(string postTitle, string title, int year, int mo
|
||||
Assert.IsNull(result.EpisodeNumbers);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void parse_daily_should_fail_if_episode_is_far_in_future()
|
||||
{
|
||||
var title = string.Format("{0}.{1}.{2} - Denis Leary - HD TV.mkv", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.AddDays(2).Day);
|
||||
|
||||
Parser.ParseTitle(title).Should().BeNull();
|
||||
|
||||
ExceptionVerification.ExcpectedWarns(1);
|
||||
}
|
||||
|
||||
|
||||
[TestCase("30.Rock.Season.04.HDTV.XviD-DIMENSION", "30.Rock", 4)]
|
||||
[TestCase("Parks.and.Recreation.S02.720p.x264-DIMENSION", "Parks.and.Recreation", 2)]
|
||||
@ -345,6 +360,7 @@ public void parse_season_extras(string postTitle)
|
||||
var result = Parser.ParseTitle(postTitle);
|
||||
|
||||
result.Should().BeNull();
|
||||
ExceptionVerification.ExcpectedWarns(1);
|
||||
}
|
||||
|
||||
[TestCase("Lie.to.Me.S03.SUBPACK.DVDRip.XviD-REWARD")]
|
||||
@ -355,6 +371,16 @@ public void parse_season_subpack(string postTitle)
|
||||
var result = Parser.ParseTitle(postTitle);
|
||||
|
||||
result.Should().BeNull();
|
||||
|
||||
ExceptionVerification.ExcpectedWarns(1);
|
||||
}
|
||||
|
||||
[TestCase("Fussball Bundesliga 2010 2011 30 Spieltag FC Bayern Muenchen vs Bayer 04 Leverkusen German WS dTV XviD WoGS")]
|
||||
public void unparsable_should_log_error_but_not_throw(string title)
|
||||
{
|
||||
Parser.ParseTitle(title);
|
||||
ExceptionVerification.IgnoreWarns();
|
||||
ExceptionVerification.ExcpectedErrors(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public void import_unparsable_file_should_skip()
|
||||
|
||||
//Assert
|
||||
VerifySkipImport(result, mocker);
|
||||
ExceptionVerification.ExcpectedWarns(1);
|
||||
ExceptionVerification.ExcpectedWarns(2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -155,7 +155,7 @@ public void Trim_Logs_should_clear_logs_older_than_30_days()
|
||||
|
||||
//Assert
|
||||
var result = Db.Fetch<Log>();
|
||||
result.Should().HaveCount(21);
|
||||
result.Should().HaveCount(20);
|
||||
result.Should().OnlyContain(s => s.Time > DateTime.Now.AddDays(-30));
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ public DatabaseTarget(IDatabase database)
|
||||
public void Register()
|
||||
{
|
||||
LogManager.Configuration.AddTarget("DbLogger", this);
|
||||
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, this));
|
||||
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Info, this));
|
||||
|
||||
LogManager.ConfigurationReloaded += (sender, args) => Register();
|
||||
LogConfiguration.Reload();
|
||||
|
@ -62,86 +62,103 @@ public static class Parser
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Parses a file path into list of episodes it contains
|
||||
/// </summary>
|
||||
/// <param name = "path">Path of the file to parse</param>
|
||||
/// <returns>List of episodes contained in the file</returns>
|
||||
internal static EpisodeParseResult ParsePath(string path)
|
||||
{
|
||||
var fileInfo = new FileInfo(path);
|
||||
return ParseTitle(fileInfo.Name);
|
||||
|
||||
var result = ParseTitle(fileInfo.Name);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
Logger.Trace("Attempting to parse episode info using full path. {0}", fileInfo.FullName);
|
||||
result = ParseTitle(fileInfo.FullName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses a post title into list of episodes it contains
|
||||
/// </summary>
|
||||
/// <param name = "title">Title of the report</param>
|
||||
/// <returns>List of episodes contained in the post</returns>
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
internal static EpisodeParseResult ParseTitle(string title)
|
||||
{
|
||||
try
|
||||
{
|
||||
Logger.Trace("Parsing string '{0}'", title);
|
||||
var simpleTitle = SimpleTitleRegex.Replace(title, String.Empty);
|
||||
|
||||
foreach (var regex in ReportTitleRegex)
|
||||
{
|
||||
//Use only the filename, not the entire path
|
||||
var match = regex.Matches(simpleTitle);
|
||||
|
||||
if (match.Count != 0)
|
||||
{
|
||||
var seriesName = NormalizeTitle(match[0].Groups["title"].Value);
|
||||
var result = ParseMatchCollection(match);
|
||||
if (result != null)
|
||||
{
|
||||
//Check if episode is in the future (most likley a parse error)
|
||||
if (result.AirDate > DateTime.Now.AddDays(1).Date)
|
||||
break;
|
||||
|
||||
result.Language = ParseLanguage(title);
|
||||
result.Quality = ParseQuality(title);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Logger.Warn("Unable to parse episode info. {0}", title);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error("An error has occurred while trying to parse '{0}'", title);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static EpisodeParseResult ParseMatchCollection(MatchCollection matchCollection)
|
||||
{
|
||||
var seriesName = NormalizeTitle(matchCollection[0].Groups["title"].Value);
|
||||
|
||||
int airyear;
|
||||
Int32.TryParse(match[0].Groups["airyear"].Value, out airyear);
|
||||
Int32.TryParse(matchCollection[0].Groups["airyear"].Value, out airyear);
|
||||
|
||||
EpisodeParseResult parsedEpisode;
|
||||
|
||||
if (airyear < 1)
|
||||
if (airyear < 1900)
|
||||
{
|
||||
var seasons = new List<int>();
|
||||
|
||||
foreach (Capture seasonCapture in match[0].Groups["season"].Captures)
|
||||
foreach (Capture seasonCapture in matchCollection[0].Groups["season"].Captures)
|
||||
{
|
||||
int s;
|
||||
if (Int32.TryParse(seasonCapture.Value, out s))
|
||||
seasons.Add(s);
|
||||
int parsedSeason;
|
||||
if (Int32.TryParse(seasonCapture.Value, out parsedSeason))
|
||||
seasons.Add(parsedSeason);
|
||||
}
|
||||
|
||||
//If more than 1 season was parsed go to the next REGEX (A multi-season release is unlikely)
|
||||
if (seasons.Distinct().Count() != 1)
|
||||
continue;
|
||||
|
||||
var season = seasons[0];
|
||||
return null;
|
||||
|
||||
parsedEpisode = new EpisodeParseResult
|
||||
{
|
||||
CleanTitle = seriesName,
|
||||
SeasonNumber = season,
|
||||
SeasonNumber = seasons.First(),
|
||||
EpisodeNumbers = new List<int>()
|
||||
};
|
||||
|
||||
foreach (Match matchGroup in match)
|
||||
foreach (Match matchGroup in matchCollection)
|
||||
{
|
||||
var count = matchGroup.Groups["episode"].Captures.Count;
|
||||
var episodeCaptures = matchGroup.Groups["episode"].Captures.Cast<Capture>().ToList();
|
||||
|
||||
//Allows use to return a list of 0 episodes (We can handle that as a full season release)
|
||||
if (count > 0)
|
||||
if (episodeCaptures.Any())
|
||||
{
|
||||
var first = Convert.ToInt32(matchGroup.Groups["episode"].Captures[0].Value);
|
||||
var last = Convert.ToInt32(matchGroup.Groups["episode"].Captures[count - 1].Value);
|
||||
|
||||
for (int i = first; i <= last; i++)
|
||||
{
|
||||
parsedEpisode.EpisodeNumbers.Add(i);
|
||||
var first = Convert.ToInt32(episodeCaptures.First().Value);
|
||||
var last = Convert.ToInt32(episodeCaptures.Last().Value);
|
||||
parsedEpisode.EpisodeNumbers = Enumerable.Range(first, last - first + 1).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
//Check to see if this is an "Extras" or "SUBPACK" release, if it is, return NULL
|
||||
//Todo: Set a "Extras" flag in EpisodeParseResult if we want to download them ever
|
||||
if (!String.IsNullOrEmpty(match[0].Groups["extras"].Value))
|
||||
if (!String.IsNullOrWhiteSpace(matchCollection[0].Groups["extras"].Value))
|
||||
return null;
|
||||
|
||||
parsedEpisode.FullSeason = true;
|
||||
@ -152,27 +169,21 @@ internal static EpisodeParseResult ParseTitle(string title)
|
||||
else
|
||||
{
|
||||
//Try to Parse as a daily show
|
||||
var airmonth = Convert.ToInt32(match[0].Groups["airmonth"].Value);
|
||||
var airday = Convert.ToInt32(match[0].Groups["airday"].Value);
|
||||
var airmonth = Convert.ToInt32(matchCollection[0].Groups["airmonth"].Value);
|
||||
var airday = Convert.ToInt32(matchCollection[0].Groups["airday"].Value);
|
||||
|
||||
parsedEpisode = new EpisodeParseResult
|
||||
{
|
||||
CleanTitle = seriesName,
|
||||
AirDate = new DateTime(airyear, airmonth, airday),
|
||||
Language = ParseLanguage(simpleTitle)
|
||||
AirDate = new DateTime(airyear, airmonth, airday).Date,
|
||||
};
|
||||
}
|
||||
|
||||
parsedEpisode.Quality = ParseQuality(title);
|
||||
parsedEpisode.CleanTitle = seriesName;
|
||||
|
||||
Logger.Trace("Episode Parsed. {0}", parsedEpisode);
|
||||
|
||||
return parsedEpisode;
|
||||
}
|
||||
}
|
||||
Logger.Warn("Unable to parse episode info. {0}", title);
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses a post title to find the series that relates to it
|
||||
@ -294,7 +305,7 @@ internal static Quality ParseQuality(string name)
|
||||
return result;
|
||||
}
|
||||
|
||||
public static LanguageType ParseLanguage(string title)
|
||||
internal static LanguageType ParseLanguage(string title)
|
||||
{
|
||||
var lowerTitle = title.ToLower();
|
||||
|
||||
|
@ -208,8 +208,8 @@ private void ProcessQueue()
|
||||
if (Queue.Count != 0)
|
||||
{
|
||||
job = Queue.First();
|
||||
logger.Trace("Popping {0} from the queue.", job);
|
||||
Queue.Remove(job);
|
||||
logger.Debug("Popping {0} from the queue.", job);
|
||||
}
|
||||
}
|
||||
|
||||
|
12
NzbDrone.Web/App_Start/EntityFramework.SqlServerCompact.cs
Normal file
12
NzbDrone.Web/App_Start/EntityFramework.SqlServerCompact.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
|
||||
[assembly: WebActivator.PreApplicationStartMethod(typeof(NzbDrone.Web.App_Start.EntityFramework_SqlServerCompact), "Start")]
|
||||
|
||||
namespace NzbDrone.Web.App_Start {
|
||||
public static class EntityFramework_SqlServerCompact {
|
||||
public static void Start() {
|
||||
Database.DefaultConnectionFactory = new SqlCeConnectionFactory("System.Data.SqlServerCe.4.0");
|
||||
}
|
||||
}
|
||||
}
|
95
NzbDrone.Web/App_Start/MiniProfiler.cs
Normal file
95
NzbDrone.Web/App_Start/MiniProfiler.cs
Normal file
@ -0,0 +1,95 @@
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Linq;
|
||||
using MvcMiniProfiler;
|
||||
using MvcMiniProfiler.MVCHelpers;
|
||||
using Microsoft.Web.Infrastructure.DynamicModuleHelper;
|
||||
//using System.Data;
|
||||
//using System.Data.Entity;
|
||||
//using System.Data.Entity.Infrastructure;
|
||||
|
||||
//using MvcMiniProfiler.Data.Linq2Sql;
|
||||
|
||||
[assembly: WebActivator.PreApplicationStartMethod(
|
||||
typeof(NzbDrone.Web.App_Start.MiniProfilerPackage), "PreStart")]
|
||||
|
||||
[assembly: WebActivator.PostApplicationStartMethod(
|
||||
typeof(NzbDrone.Web.App_Start.MiniProfilerPackage), "PostStart")]
|
||||
|
||||
|
||||
namespace NzbDrone.Web.App_Start
|
||||
{
|
||||
public static class MiniProfilerPackage
|
||||
{
|
||||
public static void PreStart()
|
||||
{
|
||||
|
||||
// Be sure to restart you ASP.NET Developement server, this code will not run until you do that.
|
||||
|
||||
//TODO: See - _MINIPROFILER UPDATED Layout.cshtml
|
||||
// For profiling to display in the UI you will have to include the line @MvcMiniProfiler.MiniProfiler.RenderIncludes()
|
||||
// in your master layout
|
||||
|
||||
//TODO: Non SQL Server based installs can use other formatters like: new MvcMiniProfiler.SqlFormatters.InlineFormatter()
|
||||
MiniProfiler.Settings.SqlFormatter = new MvcMiniProfiler.SqlFormatters.SqlServerFormatter();
|
||||
|
||||
//TODO: To profile a standard DbConnection:
|
||||
// var profiled = new ProfiledDbConnection(cnn, MiniProfiler.Current);
|
||||
|
||||
//TODO: If you are profiling EF code first try:
|
||||
// MiniProfilerEF.Initialize();
|
||||
|
||||
//Make sure the MiniProfiler handles BeginRequest and EndRequest
|
||||
DynamicModuleUtility.RegisterModule(typeof(MiniProfilerStartupModule));
|
||||
|
||||
//Setup profiler for Controllers via a Global ActionFilter
|
||||
GlobalFilters.Filters.Add(new ProfilingActionFilter());
|
||||
}
|
||||
|
||||
public static void PostStart()
|
||||
{
|
||||
// Intercept ViewEngines to profile all partial views and regular views.
|
||||
// If you prefer to insert your profiling blocks manually you can comment this out
|
||||
var copy = ViewEngines.Engines.ToList();
|
||||
ViewEngines.Engines.Clear();
|
||||
foreach (var item in copy)
|
||||
{
|
||||
ViewEngines.Engines.Add(new ProfilingViewEngine(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MiniProfilerStartupModule : IHttpModule
|
||||
{
|
||||
public void Init(HttpApplication context)
|
||||
{
|
||||
context.BeginRequest += (sender, e) =>
|
||||
{
|
||||
var request = ((HttpApplication)sender).Request;
|
||||
//TODO: By default only local requests are profiled, optionally you can set it up
|
||||
// so authenticated users are always profiled
|
||||
if (request.IsLocal) { MiniProfiler.Start(); }
|
||||
};
|
||||
|
||||
|
||||
// TODO: You can control who sees the profiling information
|
||||
/*
|
||||
context.AuthenticateRequest += (sender, e) =>
|
||||
{
|
||||
if (!CurrentUserIsAllowedToSeeProfiler())
|
||||
{
|
||||
MvcMiniProfiler.MiniProfiler.Stop(discardResults: true);
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
context.EndRequest += (sender, e) =>
|
||||
{
|
||||
MiniProfiler.Stop();
|
||||
};
|
||||
}
|
||||
|
||||
public void Dispose() { }
|
||||
}
|
||||
}
|
||||
|
@ -4,18 +4,14 @@
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using System.Web.Caching;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using MvcMiniProfiler;
|
||||
using NLog.Config;
|
||||
using Ninject;
|
||||
using Ninject.Web.Mvc;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core;
|
||||
using NzbDrone.Core.Instrumentation;
|
||||
using Telerik.Web.Mvc;
|
||||
|
||||
namespace NzbDrone.Web
|
||||
{
|
||||
@ -99,13 +95,11 @@ protected void Application_Error(object sender, EventArgs e)
|
||||
|
||||
protected void Application_BeginRequest()
|
||||
{
|
||||
Thread.CurrentThread.Name = "UI";
|
||||
MiniProfiler.Start();
|
||||
Thread.CurrentThread.Name = "WEB_THREAD";
|
||||
}
|
||||
|
||||
protected void Application_EndRequest()
|
||||
{
|
||||
MiniProfiler.Stop();
|
||||
}
|
||||
}
|
||||
}
|
@ -46,23 +46,20 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EntityFramework, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\EntityFramework.4.2.0.0\lib\net40\EntityFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MvcMiniProfiler, Version=1.9.0.0, Culture=neutral, PublicKeyToken=b44f9351044011a3, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\MiniProfiler.1.9\lib\net40\MvcMiniProfiler.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Ninject, Version=2.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.2.2.1.4\lib\net40-Full\Ninject.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Ninject.Web.Mvc">
|
||||
<Reference Include="Ninject.Web.Mvc, Version=2.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.MVC3.2.2.2.0\lib\net40-Full\Ninject.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
@ -118,6 +115,10 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Libraries\TvdbLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WebActivator, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\WebActivator.1.5\lib\net40\WebActivator.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Content\2011.3.1115\Metro\editor.png" />
|
||||
@ -174,6 +175,8 @@
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>UploadLocalization.en-US.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="App_Start\EntityFramework.SqlServerCompact.cs" />
|
||||
<Compile Include="App_Start\MiniProfiler.cs" />
|
||||
<Compile Include="Controllers\CommandController.cs" />
|
||||
<Compile Include="Controllers\DirectoryController.cs" />
|
||||
<Compile Include="Controllers\EpisodeController.cs" />
|
||||
@ -486,9 +489,6 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Misnamed\Index.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Log\SubMenu.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Settings\System.cshtml" />
|
||||
</ItemGroup>
|
||||
|
@ -24,7 +24,11 @@
|
||||
Logs
|
||||
}
|
||||
@section ActionMenu{
|
||||
@{Html.RenderPartial("SubMenu");}
|
||||
<ul class="sub-menu">
|
||||
<li>@Ajax.ActionLink("Clear Logs", "Clear", "Log", new AjaxOptions { OnSuccess = "reloadGrid" })</li>
|
||||
</ul>
|
||||
<div style="margin-bottom: 10px">
|
||||
</div>
|
||||
}
|
||||
@section MainContent{
|
||||
@{Html.Telerik().Grid<Log>().Name("logsGrid")
|
||||
@ -32,7 +36,7 @@ Logs
|
||||
.Columns(columns =>
|
||||
{
|
||||
columns.Bound(c => c.Time).Title("Time").Width(170);
|
||||
columns.Bound(c => c.Level).Title("Level");
|
||||
columns.Bound(c => c.Level).Title("Level").Width(70);
|
||||
columns.Bound(c => c.Logger).Title("Source");
|
||||
columns.Bound(c => c.Message);
|
||||
})
|
||||
@ -41,15 +45,12 @@ Logs
|
||||
"<div><#= ExceptionType #></div>" +
|
||||
"<div class='stackframe'><#= Exception #></div>"
|
||||
))
|
||||
.DataBinding(data =>
|
||||
{
|
||||
data.Server().Select("AjaxBinding", "Log", new { ajax = true });
|
||||
data.Ajax().Select("AjaxBinding", "Log").Enabled(true);
|
||||
})
|
||||
.DataBinding(data => data.Ajax().Select("AjaxBinding", "Log").Enabled(true))
|
||||
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.Time).Descending()).Enabled(true))
|
||||
.Pageable(c => c.PageSize(50).Position(GridPagerPosition.Bottom).Style(GridPagerStyles.NextPrevious))
|
||||
.Pageable(paging => paging.Style(GridPagerStyles.Status).PageOnScroll(true).PageSize(100))
|
||||
.Filterable()
|
||||
.ClientEvents(c => c.OnRowDataBound("onRowDataBound"))
|
||||
.Scrollable(c=>c.Height(500))
|
||||
.Render();}
|
||||
}
|
||||
<script type="text/javascript">
|
||||
|
@ -1,5 +0,0 @@
|
||||
<ul class="sub-menu">
|
||||
<li>@Ajax.ActionLink("Clear Logs", "Clear", "Log", new AjaxOptions{ OnSuccess = "reloadGrid" })</li>
|
||||
</ul>
|
||||
|
||||
<div style="margin-bottom: 10px"></div>
|
@ -11,6 +11,7 @@
|
||||
<package id="jQuery.vsdoc" version="1.6" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" />
|
||||
<package id="MiniProfiler" version="1.9" />
|
||||
<package id="MiniProfiler.MVC3" version="1.9.1" />
|
||||
<package id="Ninject" version="2.2.1.4" />
|
||||
<package id="Ninject.MVC3" version="2.2.2.0" />
|
||||
<package id="Ninject.Web.Mvc2" version="2.2.0.1" />
|
||||
|
97
packages/MiniProfiler.MVC3.1.9.1/Content/App_Start/MiniProfiler.cs.pp
vendored
Normal file
97
packages/MiniProfiler.MVC3.1.9.1/Content/App_Start/MiniProfiler.cs.pp
vendored
Normal file
@ -0,0 +1,97 @@
|
||||
using System;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Linq;
|
||||
using MvcMiniProfiler;
|
||||
using MvcMiniProfiler.MVCHelpers;
|
||||
using Microsoft.Web.Infrastructure;
|
||||
using Microsoft.Web.Infrastructure.DynamicModuleHelper;
|
||||
//using System.Data;
|
||||
//using System.Data.Entity;
|
||||
//using System.Data.Entity.Infrastructure;
|
||||
//using MvcMiniProfiler.Data.EntityFramework;
|
||||
//using MvcMiniProfiler.Data.Linq2Sql;
|
||||
|
||||
[assembly: WebActivator.PreApplicationStartMethod(
|
||||
typeof($rootnamespace$.App_Start.MiniProfilerPackage), "PreStart")]
|
||||
|
||||
[assembly: WebActivator.PostApplicationStartMethod(
|
||||
typeof($rootnamespace$.App_Start.MiniProfilerPackage), "PostStart")]
|
||||
|
||||
|
||||
namespace $rootnamespace$.App_Start
|
||||
{
|
||||
public static class MiniProfilerPackage
|
||||
{
|
||||
public static void PreStart()
|
||||
{
|
||||
|
||||
// Be sure to restart you ASP.NET Developement server, this code will not run until you do that.
|
||||
|
||||
//TODO: See - _MINIPROFILER UPDATED Layout.cshtml
|
||||
// For profiling to display in the UI you will have to include the line @MvcMiniProfiler.MiniProfiler.RenderIncludes()
|
||||
// in your master layout
|
||||
|
||||
//TODO: Non SQL Server based installs can use other formatters like: new MvcMiniProfiler.SqlFormatters.InlineFormatter()
|
||||
MiniProfiler.Settings.SqlFormatter = new MvcMiniProfiler.SqlFormatters.SqlServerFormatter();
|
||||
|
||||
//TODO: To profile a standard DbConnection:
|
||||
// var profiled = new ProfiledDbConnection(cnn, MiniProfiler.Current);
|
||||
|
||||
//TODO: If you are profiling EF code first try:
|
||||
// MiniProfilerEF.Initialize();
|
||||
|
||||
//Make sure the MiniProfiler handles BeginRequest and EndRequest
|
||||
DynamicModuleUtility.RegisterModule(typeof(MiniProfilerStartupModule));
|
||||
|
||||
//Setup profiler for Controllers via a Global ActionFilter
|
||||
GlobalFilters.Filters.Add(new ProfilingActionFilter());
|
||||
}
|
||||
|
||||
public static void PostStart()
|
||||
{
|
||||
// Intercept ViewEngines to profile all partial views and regular views.
|
||||
// If you prefer to insert your profiling blocks manually you can comment this out
|
||||
var copy = ViewEngines.Engines.ToList();
|
||||
ViewEngines.Engines.Clear();
|
||||
foreach (var item in copy)
|
||||
{
|
||||
ViewEngines.Engines.Add(new ProfilingViewEngine(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MiniProfilerStartupModule : IHttpModule
|
||||
{
|
||||
public void Init(HttpApplication context)
|
||||
{
|
||||
context.BeginRequest += (sender, e) =>
|
||||
{
|
||||
var request = ((HttpApplication)sender).Request;
|
||||
//TODO: By default only local requests are profiled, optionally you can set it up
|
||||
// so authenticated users are always profiled
|
||||
if (request.IsLocal) { MiniProfiler.Start(); }
|
||||
};
|
||||
|
||||
|
||||
// TODO: You can control who sees the profiling information
|
||||
/*
|
||||
context.AuthenticateRequest += (sender, e) =>
|
||||
{
|
||||
if (!CurrentUserIsAllowedToSeeProfiler())
|
||||
{
|
||||
MvcMiniProfiler.MiniProfiler.Stop(discardResults: true);
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
context.EndRequest += (sender, e) =>
|
||||
{
|
||||
MiniProfiler.Stop();
|
||||
};
|
||||
}
|
||||
|
||||
public void Dispose() { }
|
||||
}
|
||||
}
|
||||
|
39
packages/MiniProfiler.MVC3.1.9.1/Content/Views/Shared/_MINIPROFILER UPDATED Layout.cshtml
vendored
Normal file
39
packages/MiniProfiler.MVC3.1.9.1/Content/Views/Shared/_MINIPROFILER UPDATED Layout.cshtml
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>@ViewBag.Title</title>
|
||||
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
|
||||
<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
|
||||
|
||||
@* Make sure you've added this one line to your LAYOUT or MASTER PAGE *@
|
||||
|
||||
@MvcMiniProfiler.MiniProfiler.RenderIncludes()
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="page">
|
||||
<header>
|
||||
<div id="title">
|
||||
<h1>My MVC Application</h1>
|
||||
</div>
|
||||
<div id="logindisplay">
|
||||
@Html.Partial("_LogOnPartial")
|
||||
</div>
|
||||
<nav>
|
||||
<ul id="menu">
|
||||
<li>@Html.ActionLink("Home", "Index", "Home")</li>
|
||||
<li>@Html.ActionLink("About", "About", "Home")</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<section id="main">
|
||||
@RenderBody()
|
||||
</section>
|
||||
<footer>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
BIN
packages/MiniProfiler.MVC3.1.9.1/MiniProfiler.MVC3.1.9.1.nupkg
vendored
Normal file
BIN
packages/MiniProfiler.MVC3.1.9.1/MiniProfiler.MVC3.1.9.1.nupkg
vendored
Normal file
Binary file not shown.
6
packages/MiniProfiler.MVC3.1.9.1/tools/install.ps1
vendored
Normal file
6
packages/MiniProfiler.MVC3.1.9.1/tools/install.ps1
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
param($installPath, $toolsPath, $package, $project)
|
||||
|
||||
$path = [System.IO.Path]
|
||||
$appstart = $path::Combine($path::GetDirectoryName($project.FileName), "App_Start\MiniProfiler.cs")
|
||||
$DTE.ItemOperations.OpenFile($appstart)
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,50 +0,0 @@
|
||||
/**
|
||||
* jQuery Validation Plugin 1.8.0
|
||||
*
|
||||
* http://bassistance.de/jquery-plugins/jquery-plugin-validation/
|
||||
* http://docs.jquery.com/Plugins/Validation
|
||||
*
|
||||
* Copyright (c) 2006 - 2011 Jörn Zaefferer
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
(function(c){c.extend(c.fn,{validate:function(a){if(this.length){var b=c.data(this[0],"validator");if(b)return b;b=new c.validator(a,this[0]);c.data(this[0],"validator",b);if(b.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){b.cancelSubmit=true});b.settings.submitHandler&&this.find("input, button").filter(":submit").click(function(){b.submitButton=this});this.submit(function(d){function e(){if(b.settings.submitHandler){if(b.submitButton)var f=c("<input type='hidden'/>").attr("name",
|
||||
b.submitButton.name).val(b.submitButton.value).appendTo(b.currentForm);b.settings.submitHandler.call(b,b.currentForm);b.submitButton&&f.remove();return false}return true}b.settings.debug&&d.preventDefault();if(b.cancelSubmit){b.cancelSubmit=false;return e()}if(b.form()){if(b.pendingRequest){b.formSubmitted=true;return false}return e()}else{b.focusInvalid();return false}})}return b}else a&&a.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing")},valid:function(){if(c(this[0]).is("form"))return this.validate().form();
|
||||
else{var a=true,b=c(this[0].form).validate();this.each(function(){a&=b.element(this)});return a}},removeAttrs:function(a){var b={},d=this;c.each(a.split(/\s/),function(e,f){b[f]=d.attr(f);d.removeAttr(f)});return b},rules:function(a,b){var d=this[0];if(a){var e=c.data(d.form,"validator").settings,f=e.rules,g=c.validator.staticRules(d);switch(a){case "add":c.extend(g,c.validator.normalizeRule(b));f[d.name]=g;if(b.messages)e.messages[d.name]=c.extend(e.messages[d.name],b.messages);break;case "remove":if(!b){delete f[d.name];
|
||||
return g}var h={};c.each(b.split(/\s/),function(j,i){h[i]=g[i];delete g[i]});return h}}d=c.validator.normalizeRules(c.extend({},c.validator.metadataRules(d),c.validator.classRules(d),c.validator.attributeRules(d),c.validator.staticRules(d)),d);if(d.required){e=d.required;delete d.required;d=c.extend({required:e},d)}return d}});c.extend(c.expr[":"],{blank:function(a){return!c.trim(""+a.value)},filled:function(a){return!!c.trim(""+a.value)},unchecked:function(a){return!a.checked}});c.validator=function(a,
|
||||
b){this.settings=c.extend(true,{},c.validator.defaults,a);this.currentForm=b;this.init()};c.validator.format=function(a,b){if(arguments.length==1)return function(){var d=c.makeArray(arguments);d.unshift(a);return c.validator.format.apply(this,d)};if(arguments.length>2&&b.constructor!=Array)b=c.makeArray(arguments).slice(1);if(b.constructor!=Array)b=[b];c.each(b,function(d,e){a=a.replace(RegExp("\\{"+d+"\\}","g"),e)});return a};c.extend(c.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",
|
||||
validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:c([]),errorLabelContainer:c([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(a){this.lastActive=a;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass);this.addWrapper(this.errorsFor(a)).hide()}},onfocusout:function(a){if(!this.checkable(a)&&(a.name in this.submitted||!this.optional(a)))this.element(a)},
|
||||
onkeyup:function(a){if(a.name in this.submitted||a==this.lastElement)this.element(a)},onclick:function(a){if(a.name in this.submitted)this.element(a);else a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(a,b,d){c(a).addClass(b).removeClass(d)},unhighlight:function(a,b,d){c(a).removeClass(b).addClass(d)}},setDefaults:function(a){c.extend(c.validator.defaults,a)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",
|
||||
url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:c.validator.format("Please enter no more than {0} characters."),minlength:c.validator.format("Please enter at least {0} characters."),rangelength:c.validator.format("Please enter a value between {0} and {1} characters long."),
|
||||
range:c.validator.format("Please enter a value between {0} and {1}."),max:c.validator.format("Please enter a value less than or equal to {0}."),min:c.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){function a(e){var f=c.data(this[0].form,"validator");e="on"+e.type.replace(/^validate/,"");f.settings[e]&&f.settings[e].call(f,this[0])}this.labelContainer=c(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&
|
||||
this.labelContainer||c(this.currentForm);this.containers=c(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var b=this.groups={};c.each(this.settings.groups,function(e,f){c.each(f.split(/\s/),function(g,h){b[h]=e})});var d=this.settings.rules;c.each(d,function(e,f){d[e]=c.validator.normalizeRule(f)});c(this.currentForm).validateDelegate(":text, :password, :file, select, textarea",
|
||||
"focusin focusout keyup",a).validateDelegate(":radio, :checkbox, select, option","click",a);this.settings.invalidHandler&&c(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){this.checkForm();c.extend(this.submitted,this.errorMap);this.invalid=c.extend({},this.errorMap);this.valid()||c(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);
|
||||
return this.valid()},element:function(a){this.lastElement=a=this.clean(a);this.prepareElement(a);this.currentElements=c(a);var b=this.check(a);if(b)delete this.invalid[a.name];else this.invalid[a.name]=true;if(!this.numberOfInvalids())this.toHide=this.toHide.add(this.containers);this.showErrors();return b},showErrors:function(a){if(a){c.extend(this.errorMap,a);this.errorList=[];for(var b in a)this.errorList.push({message:a[b],element:this.findByName(b)[0]});this.successList=c.grep(this.successList,
|
||||
function(d){return!(d.name in a)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){c.fn.resetForm&&c(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b=0,d;for(d in a)b++;return b},hideErrors:function(){this.addWrapper(this.toHide).hide()},
|
||||
valid:function(){return this.size()==0},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{c(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(a){}},findLastActive:function(){var a=this.lastActive;return a&&c.grep(this.errorList,function(b){return b.element.name==a.name}).length==1&&a},elements:function(){var a=this,b={};return c([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&
|
||||
a.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in b||!a.objectLength(c(this).rules()))return false;return b[this.name]=true})},clean:function(a){return c(a)[0]},errors:function(){return c(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext)},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=c([]);this.toHide=c([]);this.currentElements=c([])},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers)},
|
||||
prepareElement:function(a){this.reset();this.toHide=this.errorsFor(a)},check:function(a){a=this.clean(a);if(this.checkable(a))a=this.findByName(a.name).not(this.settings.ignore)[0];var b=c(a).rules(),d=false,e;for(e in b){var f={method:e,parameters:b[e]};try{var g=c.validator.methods[e].call(this,a.value.replace(/\r/g,""),a,f.parameters);if(g=="dependency-mismatch")d=true;else{d=false;if(g=="pending"){this.toHide=this.toHide.not(this.errorsFor(a));return}if(!g){this.formatAndAdd(a,f);return false}}}catch(h){this.settings.debug&&
|
||||
window.console&&console.log("exception occured when checking element "+a.id+", check the '"+f.method+"' method",h);throw h;}}if(!d){this.objectLength(b)&&this.successList.push(a);return true}},customMetaMessage:function(a,b){if(c.metadata){var d=this.settings.meta?c(a).metadata()[this.settings.meta]:c(a).metadata();return d&&d.messages&&d.messages[b]}},customMessage:function(a,b){var d=this.settings.messages[a];return d&&(d.constructor==String?d:d[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(arguments[a]!==
|
||||
undefined)return arguments[a]},defaultMessage:function(a,b){return this.findDefined(this.customMessage(a.name,b),this.customMetaMessage(a,b),!this.settings.ignoreTitle&&a.title||undefined,c.validator.messages[b],"<strong>Warning: No message defined for "+a.name+"</strong>")},formatAndAdd:function(a,b){var d=this.defaultMessage(a,b.method),e=/\$?\{(\d+)\}/g;if(typeof d=="function")d=d.call(this,b.parameters,a);else if(e.test(d))d=jQuery.format(d.replace(e,"{$1}"),b.parameters);this.errorList.push({message:d,
|
||||
element:a});this.errorMap[a.name]=d;this.submitted[a.name]=d},addWrapper:function(a){if(this.settings.wrapper)a=a.add(a.parent(this.settings.wrapper));return a},defaultShowErrors:function(){for(var a=0;this.errorList[a];a++){var b=this.errorList[a];this.settings.highlight&&this.settings.highlight.call(this,b.element,this.settings.errorClass,this.settings.validClass);this.showLabel(b.element,b.message)}if(this.errorList.length)this.toShow=this.toShow.add(this.containers);if(this.settings.success)for(a=
|
||||
0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight){a=0;for(b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass)}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return c(this.errorList).map(function(){return this.element})},showLabel:function(a,
|
||||
b){var d=this.errorsFor(a);if(d.length){d.removeClass().addClass(this.settings.errorClass);d.attr("generated")&&d.html(b)}else{d=c("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(a),generated:true}).addClass(this.settings.errorClass).html(b||"");if(this.settings.wrapper)d=d.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();this.labelContainer.append(d).length||(this.settings.errorPlacement?this.settings.errorPlacement(d,c(a)):d.insertAfter(a))}if(!b&&this.settings.success){d.text("");
|
||||
typeof this.settings.success=="string"?d.addClass(this.settings.success):this.settings.success(d)}this.toShow=this.toShow.add(d)},errorsFor:function(a){var b=this.idOrName(a);return this.errors().filter(function(){return c(this).attr("for")==b})},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(a){var b=this.currentForm;return c(document.getElementsByName(a)).map(function(d,e){return e.form==
|
||||
b&&e.name==a&&e||null})},getLength:function(a,b){switch(b.nodeName.toLowerCase()){case "select":return c("option:selected",b).length;case "input":if(this.checkable(b))return this.findByName(b.name).filter(":checked").length}return a.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):true},dependTypes:{"boolean":function(a){return a},string:function(a,b){return!!c(a,b.form).length},"function":function(a,b){return a(b)}},optional:function(a){return!c.validator.methods.required.call(this,
|
||||
c.trim(a.value),a)&&"dependency-mismatch"},startRequest:function(a){if(!this.pending[a.name]){this.pendingRequest++;this.pending[a.name]=true}},stopRequest:function(a,b){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[a.name];if(b&&this.pendingRequest==0&&this.formSubmitted&&this.form()){c(this.currentForm).submit();this.formSubmitted=false}else if(!b&&this.pendingRequest==0&&this.formSubmitted){c(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=
|
||||
false}},previousValue:function(a){return c.data(a,"previousValue")||c.data(a,"previousValue",{old:null,valid:true,message:this.defaultMessage(a,"remote")})}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(a,b){a.constructor==String?this.classRuleSettings[a]=b:c.extend(this.classRuleSettings,
|
||||
a)},classRules:function(a){var b={};(a=c(a).attr("class"))&&c.each(a.split(" "),function(){this in c.validator.classRuleSettings&&c.extend(b,c.validator.classRuleSettings[this])});return b},attributeRules:function(a){var b={};a=c(a);for(var d in c.validator.methods){var e=a.attr(d);if(e)b[d]=e}b.maxlength&&/-1|2147483647|524288/.test(b.maxlength)&&delete b.maxlength;return b},metadataRules:function(a){if(!c.metadata)return{};var b=c.data(a.form,"validator").settings.meta;return b?c(a).metadata()[b]:
|
||||
c(a).metadata()},staticRules:function(a){var b={},d=c.data(a.form,"validator");if(d.settings.rules)b=c.validator.normalizeRule(d.settings.rules[a.name])||{};return b},normalizeRules:function(a,b){c.each(a,function(d,e){if(e===false)delete a[d];else if(e.param||e.depends){var f=true;switch(typeof e.depends){case "string":f=!!c(e.depends,b.form).length;break;case "function":f=e.depends.call(b,b)}if(f)a[d]=e.param!==undefined?e.param:true;else delete a[d]}});c.each(a,function(d,e){a[d]=c.isFunction(e)?
|
||||
e(b):e});c.each(["minlength","maxlength","min","max"],function(){if(a[this])a[this]=Number(a[this])});c.each(["rangelength","range"],function(){if(a[this])a[this]=[Number(a[this][0]),Number(a[this][1])]});if(c.validator.autoCreateRanges){if(a.min&&a.max){a.range=[a.min,a.max];delete a.min;delete a.max}if(a.minlength&&a.maxlength){a.rangelength=[a.minlength,a.maxlength];delete a.minlength;delete a.maxlength}}a.messages&&delete a.messages;return a},normalizeRule:function(a){if(typeof a=="string"){var b=
|
||||
{};c.each(a.split(/\s/),function(){b[this]=true});a=b}return a},addMethod:function(a,b,d){c.validator.methods[a]=b;c.validator.messages[a]=d!=undefined?d:c.validator.messages[a];b.length<3&&c.validator.addClassRules(a,c.validator.normalizeRule(a))},methods:{required:function(a,b,d){if(!this.depend(d,b))return"dependency-mismatch";switch(b.nodeName.toLowerCase()){case "select":return(a=c(b).val())&&a.length>0;case "input":if(this.checkable(b))return this.getLength(a,b)>0;default:return c.trim(a).length>
|
||||
0}},remote:function(a,b,d){if(this.optional(b))return"dependency-mismatch";var e=this.previousValue(b);this.settings.messages[b.name]||(this.settings.messages[b.name]={});e.originalMessage=this.settings.messages[b.name].remote;this.settings.messages[b.name].remote=e.message;d=typeof d=="string"&&{url:d}||d;if(this.pending[b.name])return"pending";if(e.old===a)return e.valid;e.old=a;var f=this;this.startRequest(b);var g={};g[b.name]=a;c.ajax(c.extend(true,{url:d,mode:"abort",port:"validate"+b.name,
|
||||
dataType:"json",data:g,success:function(h){f.settings.messages[b.name].remote=e.originalMessage;var j=h===true;if(j){var i=f.formSubmitted;f.prepareElement(b);f.formSubmitted=i;f.successList.push(b);f.showErrors()}else{i={};h=h||f.defaultMessage(b,"remote");i[b.name]=e.message=c.isFunction(h)?h(a):h;f.showErrors(i)}e.valid=j;f.stopRequest(b,j)}},d));return"pending"},minlength:function(a,b,d){return this.optional(b)||this.getLength(c.trim(a),b)>=d},maxlength:function(a,b,d){return this.optional(b)||
|
||||
this.getLength(c.trim(a),b)<=d},rangelength:function(a,b,d){a=this.getLength(c.trim(a),b);return this.optional(b)||a>=d[0]&&a<=d[1]},min:function(a,b,d){return this.optional(b)||a>=d},max:function(a,b,d){return this.optional(b)||a<=d},range:function(a,b,d){return this.optional(b)||a>=d[0]&&a<=d[1]},email:function(a,b){return this.optional(b)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(a)},
|
||||
url:function(a,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},
|
||||
date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a))},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(a)},number:function(a,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9-]+/.test(a))return false;var d=0,e=0,f=false;a=a.replace(/\D/g,"");for(var g=a.length-1;g>=
|
||||
0;g--){e=a.charAt(g);e=parseInt(e,10);if(f)if((e*=2)>9)e-=9;d+=e;f=!f}return d%10==0},accept:function(a,b,d){d=typeof d=="string"?d.replace(/,/g,"|"):"png|jpe?g|gif";return this.optional(b)||a.match(RegExp(".("+d+")$","i"))},equalTo:function(a,b,d){d=c(d).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){c(b).valid()});return a==d.val()}}});c.format=c.validator.format})(jQuery);
|
||||
(function(c){var a={};if(c.ajaxPrefilter)c.ajaxPrefilter(function(d,e,f){e=d.port;if(d.mode=="abort"){a[e]&&a[e].abort();a[e]=f}});else{var b=c.ajax;c.ajax=function(d){var e=("port"in d?d:c.ajaxSettings).port;if(("mode"in d?d:c.ajaxSettings).mode=="abort"){a[e]&&a[e].abort();return a[e]=b.apply(this,arguments)}return b.apply(this,arguments)}}})(jQuery);
|
||||
(function(c){!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.handle.call(this,e)}c.event.special[b]={setup:function(){this.addEventListener(a,d,true)},teardown:function(){this.removeEventListener(a,d,true)},handler:function(e){arguments[0]=c.event.fix(e);arguments[0].type=b;return c.event.handle.apply(this,arguments)}}});c.extend(c.fn,{validateDelegate:function(a,
|
||||
b,d){return this.bind(b,function(e){var f=c(e.target);if(f.is(a))return d.apply(f,arguments)})}})})(jQuery);
|
25596
packages/TelerikMvcExtensions.2011.3.1115/lib/net40/Telerik.Web.Mvc.xml
vendored
Normal file
25596
packages/TelerikMvcExtensions.2011.3.1115/lib/net40/Telerik.Web.Mvc.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user