forked from dnnsoftware/Dnn.Platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5,772 changed files
with
1,083,569 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
|
||
# Custom for Visual Studio | ||
*.cs diff=csharp | ||
*.sln merge=union | ||
*.csproj merge=union | ||
*.vbproj merge=union | ||
*.fsproj merge=union | ||
*.dbproj merge=union | ||
|
||
# Standard to msysgit | ||
*.doc diff=astextplain | ||
*.DOC diff=astextplain | ||
*.docx diff=astextplain | ||
*.DOCX diff=astextplain | ||
*.dot diff=astextplain | ||
*.DOT diff=astextplain | ||
*.pdf diff=astextplain | ||
*.PDF diff=astextplain | ||
*.rtf diff=astextplain | ||
*.RTF diff=astextplain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
################# | ||
## Visual Studio | ||
################# | ||
|
||
## Ignore Visual Studio temporary files, build results, and | ||
## files generated by popular Visual Studio add-ons. | ||
|
||
# User-specific files | ||
*.suo | ||
*.user | ||
*.sln.docstates | ||
|
||
# Build results | ||
[Dd]ebug/ | ||
[Rr]elease/ | ||
*_i.c | ||
*_p.c | ||
*.ilk | ||
*.meta | ||
*.obj | ||
*.pch | ||
*.pdb | ||
*.pgc | ||
*.pgd | ||
*.rsp | ||
*.sbr | ||
*.tlb | ||
*.tli | ||
*.tlh | ||
*.tmp | ||
*.vspscc | ||
.builds | ||
*.dotCover | ||
*.ldf | ||
|
||
## TODO: If you have NuGet Package Restore enabled, uncomment this | ||
#packages/ | ||
|
||
# Visual Studio profiler | ||
*.psess | ||
*.vsp | ||
|
||
# ReSharper is a .NET coding add-in | ||
_ReSharper* | ||
|
||
# Others | ||
[Bb]in | ||
[Oo]bj | ||
sql | ||
TestResults | ||
*.Cache | ||
ClientBin | ||
stylecop.* | ||
~$* | ||
*.dbmdl | ||
Generated_Code #added for RIA/Silverlight projects | ||
|
||
# Backup & report files from converting an old project file to a newer | ||
# Visual Studio version. Backup files are not needed, because we have git ;-) | ||
_UpgradeReport_Files/ | ||
Backup*/ | ||
UpgradeLog*.XML | ||
|
||
############ | ||
## DNN | ||
############ | ||
|
||
[Dd]esktop[Mm]odules\DNNCorp | ||
[Dd]esktop[Mm]odules\DNNCorp\HTML | ||
[Dd]esktop[Mm]odules\DNNCorp\RazorModules | ||
[Dd]esktop[Mm]odules\DNNCorp | ||
|
||
|
||
############ | ||
## Windows | ||
############ | ||
|
||
# Windows image file caches | ||
Thumbs.db | ||
|
||
# Folder config file | ||
Desktop.ini |
204 changes: 204 additions & 0 deletions
204
DNN Platform/Components/ClientDependency/Source/BaseLoader.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Web; | ||
using ClientDependency.Core.Controls; | ||
using ClientDependency.Core.FileRegistration.Providers; | ||
using ClientDependency.Core.Config; | ||
using System.Configuration.Provider; | ||
using System.Runtime.CompilerServices; | ||
|
||
//Make a 'friend' to mvc app | ||
[assembly: InternalsVisibleTo("ClientDependency.Core.Mvc")] | ||
|
||
namespace ClientDependency.Core | ||
{ | ||
|
||
public class BaseLoader | ||
{ | ||
|
||
public BaseLoader(HttpContextBase http) | ||
{ | ||
CurrentContext = http; | ||
} | ||
|
||
protected HttpContextBase CurrentContext { get; private set; } | ||
|
||
public BaseFileRegistrationProvider Provider { get; set; } | ||
|
||
/// <summary> | ||
/// Tracks all dependencies and maintains a deduplicated list | ||
/// </summary> | ||
internal List<ProviderDependencyList> Dependencies = new List<ProviderDependencyList>(); | ||
/// <summary> | ||
/// Tracks all paths and maintains a deduplicated list | ||
/// </summary> | ||
internal HashSet<IClientDependencyPath> Paths = new HashSet<IClientDependencyPath>(); | ||
|
||
/// <summary> | ||
/// Adds a path to the current loader | ||
/// </summary> | ||
/// <param name="pathNameAlias"></param> | ||
/// <param name="path"></param> | ||
/// <returns>Returns the current loader instance so you can chain calls together</returns> | ||
public BaseLoader AddPath(string pathNameAlias, string path) | ||
{ | ||
AddPath(new BasicPath() { Name = pathNameAlias, Path = path }); | ||
return this; | ||
} | ||
|
||
/// <summary> | ||
/// Adds a path to the current loader | ||
/// </summary> | ||
/// <param name="path"></param> | ||
/// <returns>Returns the current loader instance so you can chain calls together</returns> | ||
public BaseLoader AddPath(IClientDependencyPath path) | ||
{ | ||
Paths.Add(path); | ||
return this; | ||
} | ||
|
||
/// <summary> | ||
/// Registers dependencies with the specified provider. | ||
/// </summary> | ||
/// <param name="provider"></param> | ||
/// <param name="dependencies"></param> | ||
/// <param name="paths"></param> | ||
/// <param name="currProviders"></param> | ||
/// <remarks> | ||
/// This is the top most overloaded method | ||
/// </remarks> | ||
public void RegisterClientDependencies(BaseFileRegistrationProvider provider, IEnumerable<IClientDependencyFile> dependencies, IEnumerable<IClientDependencyPath> paths, ProviderCollection currProviders) | ||
{ | ||
//find or create the ProviderDependencyList for the provider | ||
ProviderDependencyList currList = Dependencies | ||
.Where(x => x.ProviderIs(provider)) | ||
.DefaultIfEmpty(new ProviderDependencyList(provider)) | ||
.SingleOrDefault(); | ||
|
||
//add the dependencies that don't have a provider specified | ||
currList.AddDependencies(dependencies | ||
.Where(x => string.IsNullOrEmpty(x.ForceProvider))); | ||
|
||
//add the list if it is new | ||
if (!Dependencies.Contains(currList) && currList.Dependencies.Count > 0) | ||
Dependencies.Add(currList); | ||
|
||
//we need to look up all of the dependencies that have forced providers, | ||
//check if we've got a provider list for it, create one if not and add the dependencies | ||
//to it. | ||
var allProviderNamesInList = dependencies | ||
.Select(x => x.ForceProvider) | ||
.Where(x => !string.IsNullOrEmpty(x)) | ||
.Distinct(); | ||
var forceProviders = (from provName in allProviderNamesInList | ||
where currProviders[provName] != null | ||
select (BaseFileRegistrationProvider) currProviders[provName]).ToList(); | ||
foreach (var prov in forceProviders) | ||
{ | ||
//find or create the ProviderDependencyList for the prov | ||
var p = prov; | ||
var forceList = Dependencies | ||
.Where(x => x.ProviderIs(prov)) | ||
.DefaultIfEmpty(new ProviderDependencyList(prov)) | ||
.SingleOrDefault(); | ||
//add the dependencies that don't have a force provider specified | ||
forceList.AddDependencies(dependencies | ||
.Where(x => x.ForceProvider == p.Name)); | ||
//add the list if it is new | ||
if (!Dependencies.Contains(forceList)) | ||
Dependencies.Add(forceList); | ||
} | ||
|
||
//add the paths, ensure no dups | ||
Paths.UnionWith(paths); | ||
} | ||
|
||
public void RegisterClientDependencies(List<IClientDependencyFile> dependencies, params IClientDependencyPath[] paths) | ||
{ | ||
RegisterClientDependencies(Provider, dependencies, paths, ClientDependencySettings.Instance.MvcRendererCollection); | ||
} | ||
|
||
public void RegisterClientDependencies(List<IClientDependencyFile> dependencies, IEnumerable<IClientDependencyPath> paths) | ||
{ | ||
RegisterClientDependencies(Provider, dependencies, paths, ClientDependencySettings.Instance.MvcRendererCollection); | ||
} | ||
|
||
|
||
|
||
#region RegisterDependency overloads | ||
|
||
public void RegisterDependency(string filePath, ClientDependencyType type) | ||
{ | ||
RegisterDependency(filePath, "", type); | ||
} | ||
|
||
public void RegisterDependency(string filePath, ClientDependencyType type, object htmlAttributes) | ||
{ | ||
RegisterDependency(filePath, "", type, htmlAttributes); | ||
} | ||
|
||
public void RegisterDependency(int priority, string filePath, ClientDependencyType type) | ||
{ | ||
RegisterDependency(priority, filePath, "", type); | ||
} | ||
|
||
public void RegisterDependency(int priority, string filePath, ClientDependencyType type, object htmlAttributes) | ||
{ | ||
RegisterDependency(priority, filePath, "", type, htmlAttributes); | ||
} | ||
|
||
public void RegisterDependency(string filePath, string pathNameAlias, ClientDependencyType type) | ||
{ | ||
RegisterDependency(Constants.DefaultPriority, filePath, pathNameAlias, type); | ||
} | ||
|
||
public void RegisterDependency(string filePath, string pathNameAlias, ClientDependencyType type, object htmlAttributes) | ||
{ | ||
RegisterDependency(Constants.DefaultPriority, filePath, pathNameAlias, type, htmlAttributes); | ||
} | ||
|
||
/// <summary> | ||
/// Dynamically registers a dependency into the loader at runtime. | ||
/// This is similar to ScriptManager.RegisterClientScriptInclude. | ||
/// Registers a file dependency with the default provider. | ||
/// </summary> | ||
/// <param name="priority"></param> | ||
/// <param name="filePath"></param> | ||
/// <param name="pathNameAlias"></param> | ||
/// <param name="type"></param> | ||
public void RegisterDependency(int priority, string filePath, string pathNameAlias, ClientDependencyType type) | ||
{ | ||
RegisterDependency(Constants.DefaultGroup, priority, filePath, pathNameAlias, type); | ||
} | ||
|
||
public void RegisterDependency(int priority, string filePath, string pathNameAlias, ClientDependencyType type, object htmlAttributes) | ||
{ | ||
RegisterDependency(Constants.DefaultGroup, priority, filePath, pathNameAlias, type, htmlAttributes); | ||
} | ||
|
||
public void RegisterDependency(int group, int priority, string filePath, string pathNameAlias, ClientDependencyType type) | ||
{ | ||
IClientDependencyFile file = new BasicFile(type) { Group = group, Priority = priority, FilePath = filePath, PathNameAlias = pathNameAlias }; | ||
RegisterClientDependencies(new List<IClientDependencyFile> { file }, new List<IClientDependencyPath>()); //send an empty paths collection | ||
} | ||
|
||
public void RegisterDependency(int group, int priority, string filePath, string pathNameAlias, ClientDependencyType type, object htmlAttributes) | ||
{ | ||
var file = new BasicFile(type) { Group = group, Priority = priority, FilePath = filePath, PathNameAlias = pathNameAlias }; | ||
|
||
//now add the attributes to the list | ||
foreach(var d in htmlAttributes.ToDictionary()) | ||
{ | ||
file.HtmlAttributes.Add(d.Key, d.Value.ToString()); | ||
} | ||
|
||
RegisterClientDependencies(new List<IClientDependencyFile> { file }, new List<IClientDependencyPath>()); //send an empty paths collection | ||
} | ||
|
||
#endregion | ||
|
||
|
||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
DNN Platform/Components/ClientDependency/Source/BasicFile.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace ClientDependency.Core | ||
{ | ||
public class BasicFile : IClientDependencyFile, IHaveHtmlAttributes | ||
{ | ||
public BasicFile(ClientDependencyType type) | ||
{ | ||
DependencyType = type; | ||
HtmlAttributes = new Dictionary<string, string>(); | ||
} | ||
|
||
#region IClientDependencyFile Members | ||
|
||
public string FilePath { get; set; } | ||
public ClientDependencyType DependencyType { get; private set; } | ||
public int Priority { get; set; } | ||
public int Group { get; set; } | ||
public string PathNameAlias { get; set; } | ||
/// <summary> | ||
/// This can be empty and will use default provider | ||
/// </summary> | ||
public string ForceProvider { get; set; } | ||
public bool ForceBundle { get; set; } | ||
|
||
/// <summary> | ||
/// Used to store additional attributes in the HTML markup for the item | ||
/// </summary> | ||
/// <remarks> | ||
/// Mostly used for CSS Media, but could be for anything | ||
/// </remarks> | ||
public IDictionary<string, string> HtmlAttributes { get; private set; } | ||
|
||
#endregion | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
DNN Platform/Components/ClientDependency/Source/BasicPath.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Web; | ||
using System.Web.UI; | ||
|
||
namespace ClientDependency.Core | ||
{ | ||
public class BasicPath : IClientDependencyPath | ||
{ | ||
public BasicPath() { } | ||
public BasicPath(string name, string path) | ||
{ | ||
Name = name; | ||
Path = path; | ||
} | ||
|
||
public string Name { get; set; } | ||
public string Path { get; set; } | ||
public bool ForceBundle { get; set; } | ||
} | ||
} | ||
|
Oops, something went wrong.