Merge branch 'U4-8198_file_system' of https://github.com/yannisgu/Umbraco-CMS into yannisgu-U4-8198_file_system
Conflicts: src/Umbraco.Web/Umbraco.Web.csproj
This commit is contained in:
@@ -114,7 +114,13 @@
|
||||
/// </summary>
|
||||
public const string UserTypes = "userTypes";
|
||||
|
||||
//TODO: Fill in the rest!
|
||||
public const string Scripts = "scripts";
|
||||
|
||||
public const string PartialViews = "partialViews";
|
||||
|
||||
public const string PartialViewMacros = "partialViewMacros";
|
||||
|
||||
//TODO: Fill in the rest!
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -106,6 +106,9 @@ Umbraco.Sys.registerNamespace("Umbraco.Application");
|
||||
treeService.clearCache();
|
||||
});
|
||||
},
|
||||
childNodeCreated: function() {
|
||||
//no-op, just needs to be here for legacy reasons
|
||||
},
|
||||
reloadActionNode: function () {
|
||||
angularHelper.safeApply($rootScope, function() {
|
||||
var currentMenuNode = appState.getMenuState("currentNode");
|
||||
|
||||
@@ -3,47 +3,38 @@
|
||||
<!--Content-->
|
||||
<add initialize="true" sortOrder="0" alias="content" application="content" title="Content" iconClosed="icon-folder" iconOpen="icon-folder" type="Umbraco.Web.Trees.ContentTreeController, umbraco" />
|
||||
<add initialize="false" sortOrder="0" alias="contentRecycleBin" application="content" title="Recycle Bin" iconClosed="icon-folder" iconOpen="icon-folder" type="umbraco.cms.presentation.Trees.ContentRecycleBin, umbraco" />
|
||||
|
||||
<!--Media-->
|
||||
<add initialize="true" sortOrder="0" alias="media" application="media" title="Media" iconClosed="icon-folder" iconOpen="icon-folder" type="Umbraco.Web.Trees.MediaTreeController, umbraco" />
|
||||
<add initialize="false" sortOrder="0" alias="mediaRecycleBin" application="media" title="Recycle Bin" iconClosed="icon-folder" iconOpen="icon-folder" type="umbraco.cms.presentation.Trees.MediaRecycleBin, umbraco" />
|
||||
|
||||
<!--Settings-->
|
||||
<add initialize="true" sortOrder="0" alias="documentTypes" application="settings" title="Document Types" iconClosed="icon-folder" iconOpen="icon-folder-open" type="Umbraco.Web.Trees.ContentTypeTreeController, umbraco" />
|
||||
<add application="settings" alias="templates" title="Templates" iconClosed="icon-folder" iconOpen="icon-folder-open" type="Umbraco.Web.Trees.TemplatesTreeController, umbraco" initialize="true" sortOrder="1" />
|
||||
<add application="settings" alias="partialViews" title="Partial Views" silent="false" initialize="true" iconClosed="icon-folder" iconOpen="icon-folder" type="Umbraco.Web.Trees.PartialViewsTree, umbraco" sortOrder="2" />
|
||||
<add application="settings" alias="stylesheets" title="Stylesheets" type="umbraco.loadStylesheets, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="3" />
|
||||
<add application="settings" alias="stylesheetProperty" title="Stylesheet Property" type="umbraco.loadStylesheetProperty, umbraco" iconClosed="" iconOpen="" initialize="false" sortOrder="3" />
|
||||
<add application="settings" alias="scripts" title="Scripts" type="umbraco.loadScripts, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="4" />
|
||||
<add application="settings" alias="languages" title="Languages" iconClosed="icon-folder" iconOpen="icon-folder-open" type="Umbraco.Web.Trees.LanguageTreeController, umbraco" sortOrder="5" />
|
||||
<add application="settings" alias="partialViews" title="Partial Views" silent="false" initialize="true" iconClosed="icon-folder" iconOpen="icon-folder" type="Umbraco.Web.Trees.PartialViewsTreeController, umbraco" sortOrder="2" />
|
||||
<add application="settings" alias="stylesheets" title="Stylesheets" type="Umbraco.Web.Trees.StylesheetsTreeController, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="3" />
|
||||
<add application="settings" alias="scripts" title="Scripts" type="Umbraco.Web.Trees.ScriptsTreeController, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="4" />
|
||||
<add application="settings" alias="languages" title="Languages" iconClosed="icon-folder" iconOpen="icon-folder-open" type="Umbraco.Web.Trees.LanguageTreeController, umbraco" sortOrder="5" />
|
||||
<add initialize="true" sortOrder="7" alias="dataTypes" application="settings" title="Data Types" iconClosed="icon-folder" iconOpen="icon-folder" type="Umbraco.Web.Trees.DataTypeTreeController, umbraco" />
|
||||
<add initialize="true" sortOrder="8" alias="mediaTypes" application="settings" title="Media Types" iconClosed="icon-folder" iconOpen="icon-folder-open" type="Umbraco.Web.Trees.MediaTypeTreeController, umbraco" />
|
||||
|
||||
<!--Developer-->
|
||||
<add application="developer" alias="macros" title="Macros" type="Umbraco.Web.Trees.MacrosTreeController, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="2" />
|
||||
<add application="developer" alias="packager" title="Packages" type="umbraco.loadPackager, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="3" />
|
||||
<add application="developer" alias="packagerPackages" title="Packager Packages" type="umbraco.loadPackages, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" initialize="false" sortOrder="3" />
|
||||
<add application="developer" alias="relationTypes" title="Relation Types" type="umbraco.loadRelationTypes, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="4" />
|
||||
<add application="developer" alias="xslt" title="XSLT Files" type="umbraco.loadXslt, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="5" />
|
||||
<add application="developer" alias="partialViewMacros" type="Umbraco.Web.Trees.PartialViewMacrosTree, umbraco" silent="false" initialize="true" sortOrder="6" title="Partial View Macro Files" iconClosed="icon-folder" iconOpen="icon-folder" />
|
||||
|
||||
<add application="developer" alias="xslt" title="XSLT Files" type="Umbraco.Web.Trees.XsltTreeController, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="5" />
|
||||
<add application="developer" alias="partialViewMacros" type="Umbraco.Web.Trees.PartialViewMacrosTreeController, umbraco" silent="false" initialize="true" sortOrder="6" title="Partial View Macro Files" iconClosed="icon-folder" iconOpen="icon-folder" />
|
||||
<!--Users-->
|
||||
<add application="users" alias="users" title="Users" type="umbraco.loadUsers, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="0" />
|
||||
<add application="users" alias="userTypes" title="User Types" type="umbraco.cms.presentation.Trees.UserTypes, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="1" />
|
||||
<add application="users" alias="userTypes" title="User Types" type="Umbraco.Web.Trees.UserTypesTreeController, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="1" />
|
||||
<add application="users" alias="userPermissions" title="User Permissions" type="umbraco.cms.presentation.Trees.UserPermissions, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="2" />
|
||||
|
||||
<!--Members-->
|
||||
<add initialize="true" sortOrder="0" alias="member" application="member" title="Members" iconClosed="icon-folder" iconOpen="icon-folder-open" type="Umbraco.Web.Trees.MemberTreeController, umbraco" />
|
||||
<add initialize="true" sortOrder="1" alias="memberTypes" application="member" title="Member Types" iconClosed="icon-folder" iconOpen="icon-folder-open" type="Umbraco.Web.Trees.MemberTypeTreeController, umbraco" />
|
||||
<add application="member" sortOrder="2" alias="memberGroups" title="Member Groups" type="umbraco.loadMemberGroups, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" />
|
||||
|
||||
<add application="member" sortOrder="2" alias="memberGroups" title="Member Groups" type="umbraco.loadMemberGroups, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" />
|
||||
<!--Translation-->
|
||||
<add application="translation" alias="dictionary" title="Dictionary" type="umbraco.loadDictionary, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="0" />
|
||||
<add silent="false" initialize="true" sortOrder="1" alias="openTasks" application="translation" title="Tasks assigned to you" iconClosed="icon-folder" iconOpen="icon-folder" type="umbraco.loadOpenTasks, umbraco" />
|
||||
<add silent="false" initialize="true" sortOrder="2" alias="yourTasks" application="translation" title="Tasks created by you" iconClosed="icon-folder" iconOpen="icon-folder" type="umbraco.loadYourTasks, umbraco" />
|
||||
|
||||
<!-- Custom -->
|
||||
<!--<add application="myApplication" alias="myTree" title="Me Tree" type="MyNamespace.myTree, MyAssembly"
|
||||
iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="10" />-->
|
||||
|
||||
</trees>
|
||||
@@ -9,10 +9,9 @@
|
||||
<!--Settings-->
|
||||
<add initialize="true" sortOrder="0" alias="documentTypes" application="settings" title="Document Types" iconClosed="icon-folder" iconOpen="icon-folder-open" type="Umbraco.Web.Trees.ContentTypeTreeController, umbraco" />
|
||||
<add application="settings" alias="templates" title="Templates" iconClosed="icon-folder" iconOpen="icon-folder-open" type="Umbraco.Web.Trees.TemplatesTreeController, umbraco" initialize="true" sortOrder="1" />
|
||||
<add application="settings" alias="partialViews" title="Partial Views" silent="false" initialize="true" iconClosed="icon-folder" iconOpen="icon-folder" type="Umbraco.Web.Trees.PartialViewsTree, umbraco" sortOrder="2" />
|
||||
<add application="settings" alias="stylesheets" title="Stylesheets" type="umbraco.loadStylesheets, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="3" />
|
||||
<add application="settings" alias="stylesheetProperty" title="Stylesheet Property" type="umbraco.loadStylesheetProperty, umbraco" iconClosed="" iconOpen="" initialize="false" sortOrder="3" />
|
||||
<add application="settings" alias="scripts" title="Scripts" type="umbraco.loadScripts, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="4" />
|
||||
<add application="settings" alias="partialViews" title="Partial Views" silent="false" initialize="true" iconClosed="icon-folder" iconOpen="icon-folder" type="Umbraco.Web.Trees.PartialViewsTreeController, umbraco" sortOrder="2" />
|
||||
<add application="settings" alias="stylesheets" title="Stylesheets" type="Umbraco.Web.Trees.StylesheetsTreeController, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="3" />
|
||||
<add application="settings" alias="scripts" title="Scripts" type="Umbraco.Web.Trees.ScriptsTreeController, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="4" />
|
||||
<add application="settings" alias="languages" title="Languages" iconClosed="icon-folder" iconOpen="icon-folder-open" type="Umbraco.Web.Trees.LanguageTreeController, umbraco" sortOrder="5" />
|
||||
<add initialize="true" sortOrder="7" alias="dataTypes" application="settings" title="Data Types" iconClosed="icon-folder" iconOpen="icon-folder" type="Umbraco.Web.Trees.DataTypeTreeController, umbraco" />
|
||||
<add initialize="true" sortOrder="8" alias="mediaTypes" application="settings" title="Media Types" iconClosed="icon-folder" iconOpen="icon-folder-open" type="Umbraco.Web.Trees.MediaTypeTreeController, umbraco" />
|
||||
@@ -21,8 +20,8 @@
|
||||
<add application="developer" alias="packager" title="Packages" type="umbraco.loadPackager, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="3" />
|
||||
<add application="developer" alias="packagerPackages" title="Packager Packages" type="umbraco.loadPackages, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" initialize="false" sortOrder="3" />
|
||||
<add application="developer" alias="relationTypes" title="Relation Types" type="umbraco.loadRelationTypes, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="4" />
|
||||
<add application="developer" alias="xslt" title="XSLT Files" type="umbraco.loadXslt, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="5" />
|
||||
<add application="developer" alias="partialViewMacros" type="Umbraco.Web.Trees.PartialViewMacrosTree, umbraco" silent="false" initialize="true" sortOrder="6" title="Partial View Macro Files" iconClosed="icon-folder" iconOpen="icon-folder" />
|
||||
<add application="developer" alias="xslt" title="XSLT Files" type="Umbraco.Web.Trees.XsltTreeController, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="5" />
|
||||
<add application="developer" alias="partialViewMacros" type="Umbraco.Web.Trees.PartialViewMacrosTreeController, umbraco" silent="false" initialize="true" sortOrder="6" title="Partial View Macro Files" iconClosed="icon-folder" iconOpen="icon-folder" />
|
||||
<!--Users-->
|
||||
<add application="users" alias="users" title="Users" type="umbraco.loadUsers, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="0" />
|
||||
<add application="users" alias="userTypes" title="User Types" type="Umbraco.Web.Trees.UserTypesTreeController, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="1" />
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
<header>Xslt</header>
|
||||
<usercontrol>/create/xslt.ascx</usercontrol>
|
||||
<tasks>
|
||||
<create assembly="umbraco" type="XsltTasks" />
|
||||
<delete assembly="umbraco" type="XsltTasks" />
|
||||
</tasks>
|
||||
</nodeType>
|
||||
@@ -72,6 +73,14 @@
|
||||
<create assembly="umbraco" type="StylesheetTasks" />
|
||||
</tasks>
|
||||
</nodeType>
|
||||
<nodeType alias="stylesheetsFolder">
|
||||
<header>Stylesheet</header>
|
||||
<usercontrol>/create/simple.ascx</usercontrol>
|
||||
<tasks>
|
||||
<create assembly="umbraco" type="StylesheetTasks" />
|
||||
<delete assembly="umbraco" type="StylesheetTasks" />
|
||||
</tasks>
|
||||
</nodeType>
|
||||
<nodeType alias="initxslt">
|
||||
<header>XSLT file</header>
|
||||
<usercontrol>/create/xslt.ascx</usercontrol>
|
||||
@@ -229,6 +238,13 @@
|
||||
<delete assembly="umbraco" type="PartialViewTasks" />
|
||||
</tasks>
|
||||
</nodeType>
|
||||
<nodeType alias="initpartialViews">
|
||||
<header>Macro</header>
|
||||
<usercontrol>/Create/PartialView.ascx</usercontrol>
|
||||
<tasks>
|
||||
<create assembly="umbraco" type="PartialViewTasks" />
|
||||
</tasks>
|
||||
</nodeType>
|
||||
<nodeType alias="partialViewMacros">
|
||||
<header>Macro</header>
|
||||
<usercontrol>/Create/PartialViewMacro.ascx</usercontrol>
|
||||
@@ -237,6 +253,13 @@
|
||||
<delete assembly="umbraco" type="PartialViewMacroTasks" />
|
||||
</tasks>
|
||||
</nodeType>
|
||||
<nodeType alias="initpartialViewMacros">
|
||||
<header>Macro</header>
|
||||
<usercontrol>/Create/PartialViewMacro.ascx</usercontrol>
|
||||
<tasks>
|
||||
<create assembly="umbraco" type="PartialViewMacroTasks" />
|
||||
</tasks>
|
||||
</nodeType>
|
||||
<nodeType alias="partialViewsFolder">
|
||||
<header>Macro</header>
|
||||
<usercontrol>/Create/PartialView.ascx</usercontrol>
|
||||
|
||||
@@ -64,9 +64,9 @@ namespace Umbraco.Web.UI.Umbraco.Settings.Views
|
||||
get
|
||||
{
|
||||
if (Request.QueryString["treeType"].IsNullOrWhiteSpace())
|
||||
{
|
||||
return TreeDefinitionCollection.Instance.FindTree<PartialViewsTree>().Tree.Alias;
|
||||
}
|
||||
{
|
||||
return Constants.Trees.PartialViews;
|
||||
}
|
||||
return Request.CleanForXss("treeType");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +191,25 @@ namespace Umbraco.Web.Models.Trees
|
||||
view => LaunchDialogView(
|
||||
view,
|
||||
ApplicationContext.Current.Services.TextService.Localize("defaultdialogs/confirmdelete") + " '" + (item == null ? "" : item.Name) + "' ?"));
|
||||
}
|
||||
}
|
||||
|
||||
internal void ConvertLegacyFileSystemMenuItem(string path, string nodeType, string currentSection)
|
||||
{
|
||||
//First try to get a URL/title from the legacy action,
|
||||
// if that doesn't work, try to get the legacy confirm view
|
||||
|
||||
//in some edge cases, item can be null so we'll just convert those to "-1" and "" for id and name since these edge cases don't need that.
|
||||
Attempt
|
||||
.Try(LegacyTreeDataConverter.GetUrlAndTitleFromLegacyAction(Action,
|
||||
path,
|
||||
nodeType,
|
||||
path, currentSection),
|
||||
action => LaunchDialogUrl(action.Url, action.DialogTitle))
|
||||
.OnFailure(() => LegacyTreeDataConverter.GetLegacyConfirmView(Action, currentSection),
|
||||
view => LaunchDialogView(
|
||||
view,
|
||||
ApplicationContext.Current.Services.TextService.Localize("defaultdialogs/confirmdelete") + " '" + path + "' ?"));
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -2,35 +2,50 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Formatting;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ClientDependency.Core;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Models.Trees;
|
||||
using Umbraco.Web._Legacy.Actions;
|
||||
using Constants = Umbraco.Core.Constants;
|
||||
|
||||
namespace Umbraco.Web.Trees
|
||||
{
|
||||
public abstract class FileSystemTreeController : TreeController
|
||||
{
|
||||
protected abstract string FilePath { get; }
|
||||
protected abstract string FileSearchPattern { get; }
|
||||
protected abstract IEnumerable<string> FileSearchPattern { get; }
|
||||
protected abstract string EditFormUrl { get; }
|
||||
protected abstract bool EnableCreateOnFolder { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Inheritors can override this method to modify the file node that is created.
|
||||
/// </summary>
|
||||
/// <param name="xNode"></param>
|
||||
protected virtual void OnRenderFileNode(ref TreeNode treeNode) { }
|
||||
protected virtual void OnRenderFileNode(TreeNode treeNode, FileInfo file)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inheritors can override this method to modify the folder node that is created.
|
||||
/// </summary>
|
||||
/// <param name="xNode"></param>
|
||||
protected virtual void OnRenderFolderNode(ref TreeNode treeNode) { }
|
||||
|
||||
protected override Models.Trees.TreeNodeCollection GetTreeNodes(string id, System.Net.Http.Formatting.FormDataCollection queryStrings)
|
||||
protected virtual void OnRenderFolderNode(TreeNode treeNode)
|
||||
{
|
||||
}
|
||||
|
||||
protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
|
||||
{
|
||||
var nodes = new TreeNodeCollection();
|
||||
|
||||
string orgPath = "";
|
||||
string path = "";
|
||||
if (!string.IsNullOrEmpty(id) && id != "-1")
|
||||
if (!string.IsNullOrEmpty(id) && id != Constants.System.Root.ToInvariantString())
|
||||
{
|
||||
orgPath = id;
|
||||
path = IOHelper.MapPath(FilePath + "/" + orgPath);
|
||||
@@ -41,54 +56,124 @@ namespace Umbraco.Web.Trees
|
||||
path = IOHelper.MapPath(FilePath);
|
||||
}
|
||||
|
||||
DirectoryInfo dirInfo = new DirectoryInfo(path);
|
||||
DirectoryInfo[] dirInfos = dirInfo.GetDirectories();
|
||||
if (!Directory.Exists(path) && !System.IO.File.Exists(path))
|
||||
{
|
||||
return nodes;
|
||||
}
|
||||
|
||||
if (System.IO.File.Exists(path))
|
||||
{
|
||||
return GetTreeNodesForFile(path, id, queryStrings);
|
||||
}
|
||||
|
||||
DirectoryInfo dirInfo = new DirectoryInfo(path);
|
||||
DirectoryInfo[] dirInfos = new DirectoryInfo(path).GetDirectories();
|
||||
|
||||
var nodes = new TreeNodeCollection();
|
||||
foreach (DirectoryInfo dir in dirInfos)
|
||||
{
|
||||
if ((dir.Attributes & FileAttributes.Hidden) == 0)
|
||||
if ((dir.Attributes.HasFlag(FileAttributes.Hidden)) == false)
|
||||
{
|
||||
var HasChildren = dir.GetFiles().Length > 0 || dir.GetDirectories().Length > 0;
|
||||
var node = CreateTreeNode(orgPath + dir.Name, orgPath, queryStrings, dir.Name, "icon-folder", HasChildren);
|
||||
var hasChildren = dir.GetFiles().Length > 0 || dir.GetDirectories().Length > 0;
|
||||
var node = CreateTreeNode(orgPath + dir.Name, orgPath, queryStrings, dir.Name, "icon-folder",
|
||||
hasChildren);
|
||||
|
||||
OnRenderFolderNode(ref node);
|
||||
if(node != null)
|
||||
nodes.Add(node);
|
||||
//TODO: This isn't the best way to ensure a noop process for clicking a node but it works for now.
|
||||
node.AdditionalData["jsClickCallback"] = "javascript:void(0);";
|
||||
OnRenderFolderNode(node);
|
||||
|
||||
nodes.Add(node);
|
||||
}
|
||||
}
|
||||
|
||||
//this is a hack to enable file system tree to support multiple file extension look-up
|
||||
//so the pattern both support *.* *.xml and xml,js,vb for lookups
|
||||
string[] allowedExtensions = new string[0];
|
||||
bool filterByMultipleExtensions = FileSearchPattern.Contains(",");
|
||||
FileInfo[] fileInfo;
|
||||
var files = FileSearchPattern
|
||||
.SelectMany(p => dirInfo.GetFiles("*." + p))
|
||||
.Where(f => !f.Attributes.HasFlag(FileAttributes.Hidden));
|
||||
|
||||
if (filterByMultipleExtensions)
|
||||
foreach (FileInfo file in files)
|
||||
{
|
||||
fileInfo = dirInfo.GetFiles();
|
||||
allowedExtensions = FileSearchPattern.ToLower().Split(',');
|
||||
}
|
||||
else
|
||||
fileInfo = dirInfo.GetFiles(FileSearchPattern);
|
||||
var nodeId = orgPath + file.Name;
|
||||
|
||||
foreach (FileInfo file in fileInfo)
|
||||
{
|
||||
if ((file.Attributes & FileAttributes.Hidden) == 0)
|
||||
{
|
||||
if (filterByMultipleExtensions && Array.IndexOf<string>(allowedExtensions, file.Extension.ToLower().Trim('.')) < 0)
|
||||
continue;
|
||||
var node = CreateTreeNode(
|
||||
nodeId,
|
||||
orgPath, queryStrings,
|
||||
file.Name.StripFileExtension(),
|
||||
"icon-file",
|
||||
false,
|
||||
"/" + queryStrings.GetValue<string>("application") + "/framed/" +
|
||||
Uri.EscapeDataString(string.Format(EditFormUrl, nodeId)));
|
||||
|
||||
var node = CreateTreeNode(orgPath + file.Name, orgPath, queryStrings, file.Name, "icon-file", false);
|
||||
OnRenderFileNode(node, file);
|
||||
|
||||
OnRenderFileNode(ref node);
|
||||
|
||||
if(node != null)
|
||||
nodes.Add(node);
|
||||
}
|
||||
nodes.Add(node);
|
||||
}
|
||||
|
||||
return nodes;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual TreeNodeCollection GetTreeNodesForFile(string path, string id, FormDataCollection queryStrings)
|
||||
{
|
||||
return new TreeNodeCollection();
|
||||
}
|
||||
|
||||
|
||||
protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
|
||||
{
|
||||
|
||||
var menu = new MenuItemCollection();
|
||||
|
||||
OnBeforeRenderMenu(menu, id, queryStrings);
|
||||
|
||||
if (id == Constants.System.Root.ToInvariantString())
|
||||
{
|
||||
//Create the normal create action
|
||||
menu.Items.Add<ActionNew>(Services.TextService.Localize("actions", ActionNew.Instance.Alias))
|
||||
//Since we haven't implemented anything for file systems in angular, this needs to be converted to
|
||||
//use the legacy format
|
||||
.ConvertLegacyFileSystemMenuItem("", "init" + TreeAlias, queryStrings.GetValue<string>("application"));
|
||||
|
||||
//refresh action
|
||||
menu.Items.Add<RefreshNode, ActionRefresh>(
|
||||
Services.TextService.Localize("actions", ActionRefresh.Instance.Alias), true);
|
||||
|
||||
return menu;
|
||||
|
||||
}
|
||||
|
||||
if (Directory.Exists(IOHelper.MapPath(FilePath + "/" + id)))
|
||||
{
|
||||
if (EnableCreateOnFolder)
|
||||
{
|
||||
//Create the normal create action
|
||||
menu.Items.Add<ActionNew>(Services.TextService.Localize("actions", ActionNew.Instance.Alias))
|
||||
//Since we haven't implemented anything for file systems in angular, this needs to be converted to
|
||||
//use the legacy format
|
||||
.ConvertLegacyFileSystemMenuItem(id, TreeAlias + "Folder",
|
||||
queryStrings.GetValue<string>("application"));
|
||||
}
|
||||
|
||||
//refresh action
|
||||
menu.Items.Add<RefreshNode, ActionRefresh>(
|
||||
Services.TextService.Localize("actions", ActionRefresh.Instance.Alias), true);
|
||||
|
||||
}
|
||||
|
||||
//add delete option for all languages
|
||||
menu.Items.Add<ActionDelete>(Services.TextService.Localize("actions", ActionDelete.Instance.Alias), true)
|
||||
.ConvertLegacyFileSystemMenuItem(
|
||||
id, TreeAlias, queryStrings.GetValue<string>("application"));
|
||||
|
||||
OnAfterRenderMenu(menu, id, queryStrings);
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
protected virtual void OnBeforeRenderMenu(MenuItemCollection menu, string id, FormDataCollection queryStrings)
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void OnAfterRenderMenu(MenuItemCollection menu, string id, FormDataCollection queryStrings)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
using System.Text;
|
||||
using Umbraco.Core.IO;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Web.Trees
|
||||
{
|
||||
/// <summary>
|
||||
/// Tree for displaying partial view macros in the developer app
|
||||
/// </summary>
|
||||
[Tree(Constants.Applications.Developer, "partialViewMacros", "Partial View Macro Files", sortOrder: 6)]
|
||||
public class PartialViewMacrosTree : PartialViewsTree
|
||||
{
|
||||
public PartialViewMacrosTree(string application) : base(application)
|
||||
{
|
||||
}
|
||||
|
||||
protected override string FilePath
|
||||
{
|
||||
get { return SystemDirectories.MvcViews + "/MacroPartials/"; }
|
||||
}
|
||||
|
||||
public override void RenderJS(ref StringBuilder javascript)
|
||||
{
|
||||
javascript.Append(
|
||||
@"
|
||||
function openMacroPartialView(id) {
|
||||
UmbClientMgr.contentFrame('Settings/Views/EditView.aspx?treeType=partialViewMacros&file=' + id);
|
||||
}
|
||||
");
|
||||
|
||||
}/// <summary>
|
||||
/// Ensures that no folders can be added
|
||||
/// </summary>
|
||||
/// <param name="xNode"></param>
|
||||
protected override void OnRenderFolderNode(ref XmlTreeNode xNode)
|
||||
{
|
||||
base.OnRenderFolderNode(ref xNode);
|
||||
|
||||
xNode.NodeType = "partialViewMacrosFolder";
|
||||
}
|
||||
|
||||
protected override void ChangeNodeAction(XmlTreeNode xNode)
|
||||
{
|
||||
xNode.Action = xNode.Action.Replace("openFile", "openMacroPartialView");
|
||||
}
|
||||
}
|
||||
}
|
||||
24
src/Umbraco.Web/Trees/PartialViewMacrosTreeController.cs
Normal file
24
src/Umbraco.Web/Trees/PartialViewMacrosTreeController.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.Text;
|
||||
using Umbraco.Core.IO;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Web.Trees
|
||||
{
|
||||
/// <summary>
|
||||
/// Tree for displaying partial view macros in the developer app
|
||||
/// </summary>
|
||||
[Tree(Constants.Applications.Developer, Constants.Trees.PartialViewMacros, "Partial View Macro Files", sortOrder: 6)]
|
||||
public class PartialViewMacrosTreeController : PartialViewsTreeController
|
||||
{
|
||||
protected override string FilePath
|
||||
{
|
||||
get { return SystemDirectories.MvcViews + "/MacroPartials/"; }
|
||||
}
|
||||
|
||||
protected override string EditFormUrl
|
||||
{
|
||||
get { return "Settings/Views/EditView.aspx?treeType=partialViewMacros&file={0}"; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
|
||||
using umbraco.cms.businesslogic.template;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
using Umbraco.Web._Legacy.Actions;
|
||||
|
||||
namespace Umbraco.Web.Trees
|
||||
{
|
||||
/// <summary>
|
||||
/// Tree for displaying partial views in the settings app
|
||||
/// </summary>
|
||||
[Tree(Constants.Applications.Settings, "partialViews", "Partial Views", sortOrder: 2)]
|
||||
public class PartialViewsTree : FileSystemTree
|
||||
{
|
||||
public PartialViewsTree(string application) : base(application) { }
|
||||
|
||||
public override void RenderJS(ref StringBuilder javascript)
|
||||
{
|
||||
javascript.Append(
|
||||
@"
|
||||
function openPartialView(id) {
|
||||
UmbClientMgr.contentFrame('Settings/Views/EditView.aspx?treeType=partialViews&file=' + id);
|
||||
}
|
||||
");
|
||||
}
|
||||
|
||||
protected override void CreateRootNode(ref XmlTreeNode rootNode)
|
||||
{
|
||||
rootNode.NodeType = TreeAlias;
|
||||
rootNode.NodeID = "init";
|
||||
}
|
||||
|
||||
protected override string FilePath
|
||||
{
|
||||
get { return SystemDirectories.MvcViews + "/Partials/"; }
|
||||
}
|
||||
|
||||
protected override string FileSearchPattern
|
||||
{
|
||||
get { return "*.cshtml"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensures that no folders can be added
|
||||
/// </summary>
|
||||
/// <param name="xNode"></param>
|
||||
protected override void OnRenderFolderNode(ref XmlTreeNode xNode)
|
||||
{
|
||||
// We should allow folder hierarchy for organization in large sites.
|
||||
xNode.Action = "javascript:void(0);";
|
||||
xNode.NodeType = "partialViewsFolder";
|
||||
xNode.Menu = new List<IAction>(new IAction[]
|
||||
{
|
||||
ActionNew.Instance,
|
||||
ContextMenuSeperator.Instance,
|
||||
ActionDelete.Instance,
|
||||
ContextMenuSeperator.Instance,
|
||||
ActionRefresh.Instance
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected virtual void ChangeNodeAction(XmlTreeNode xNode)
|
||||
{
|
||||
xNode.Action = xNode.Action.Replace("openFile", "openPartialView");
|
||||
}
|
||||
|
||||
protected override void OnRenderFileNode(ref XmlTreeNode xNode)
|
||||
{
|
||||
ChangeNodeAction(xNode);
|
||||
xNode.Icon = "icon-article";
|
||||
xNode.OpenIcon = "icon-article";
|
||||
|
||||
xNode.Text = xNode.Text.StripFileExtension();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
49
src/Umbraco.Web/Trees/PartialViewsTreeController.cs
Normal file
49
src/Umbraco.Web/Trees/PartialViewsTreeController.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
|
||||
using umbraco.cms.businesslogic.template;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
using Umbraco.Web.Models.Trees;
|
||||
using Umbraco.Web._Legacy.Actions;
|
||||
|
||||
namespace Umbraco.Web.Trees
|
||||
{
|
||||
/// <summary>
|
||||
/// Tree for displaying partial views in the settings app
|
||||
/// </summary>
|
||||
[Tree(Constants.Applications.Settings, Constants.Trees.PartialViews, "Partial Views", sortOrder: 2)]
|
||||
public class PartialViewsTreeController : FileSystemTreeController
|
||||
{
|
||||
protected override string FilePath
|
||||
{
|
||||
get { return SystemDirectories.MvcViews + "/Partials/"; }
|
||||
}
|
||||
|
||||
protected override IEnumerable<string> FileSearchPattern
|
||||
{
|
||||
get { return new[] {"cshtml"}; }
|
||||
}
|
||||
|
||||
protected override string EditFormUrl
|
||||
{
|
||||
get { return "Settings/Views/EditView.aspx?treeType=partialViews&file={0}"; }
|
||||
}
|
||||
|
||||
protected override bool EnableCreateOnFolder
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
protected override void OnRenderFileNode(TreeNode treeNode, FileInfo file)
|
||||
{
|
||||
treeNode.Icon = "icon-article";
|
||||
}
|
||||
}
|
||||
}
|
||||
48
src/Umbraco.Web/Trees/ScriptsTreeController.cs
Normal file
48
src/Umbraco.Web/Trees/ScriptsTreeController.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net.Http.Formatting;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Web.Models.Trees;
|
||||
|
||||
namespace Umbraco.Web.Trees
|
||||
{
|
||||
[Tree(Constants.Applications.Settings, Constants.Trees.Scripts, "Scripts", "icon-folder", "icon-folder", sortOrder: 2)]
|
||||
public class ScriptsTreeController : FileSystemTreeController
|
||||
{
|
||||
protected override string FilePath
|
||||
{
|
||||
get { return SystemDirectories.Scripts + "/"; }
|
||||
}
|
||||
|
||||
protected override IEnumerable<string> FileSearchPattern
|
||||
{
|
||||
get { return UmbracoConfig.For.UmbracoSettings().Content.ScriptFileTypes; }
|
||||
}
|
||||
|
||||
protected override string EditFormUrl
|
||||
{
|
||||
get { return "settings/scripts/editScript.aspx?file={0}"; }
|
||||
}
|
||||
|
||||
protected override bool EnableCreateOnFolder
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
protected override void OnRenderFolderNode(TreeNode treeNode)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnRenderFileNode(TreeNode treeNode, FileInfo file)
|
||||
{
|
||||
treeNode.Icon =
|
||||
file.Name.EndsWith(".js", StringComparison.OrdinalIgnoreCase) ?
|
||||
"icon-script" :
|
||||
"icon-code";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
107
src/Umbraco.Web/Trees/StylesheetsTreeController.cs
Normal file
107
src/Umbraco.Web/Trees/StylesheetsTreeController.cs
Normal file
@@ -0,0 +1,107 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Formatting;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Persistence.Repositories;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Models.Trees;
|
||||
using Umbraco.Web._Legacy.Actions;
|
||||
using File = System.IO.File;
|
||||
|
||||
namespace Umbraco.Web.Trees
|
||||
{
|
||||
[Tree(Constants.Applications.Settings, Constants.Trees.Stylesheets, "Stylesheets", "icon-folder", "icon-folder", sortOrder: 3)]
|
||||
public class StylesheetsTreeController : FileSystemTreeController
|
||||
{
|
||||
|
||||
protected override string FilePath
|
||||
{
|
||||
get { return SystemDirectories.Css + "/"; }
|
||||
}
|
||||
|
||||
protected override IEnumerable<string> FileSearchPattern
|
||||
{
|
||||
get { return new [] {"css"}; }
|
||||
}
|
||||
|
||||
protected override string EditFormUrl
|
||||
{
|
||||
get { return "settings/stylesheet/editStylesheet.aspx?id={0}"; }
|
||||
}
|
||||
|
||||
protected override bool EnableCreateOnFolder
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
|
||||
protected override void OnBeforeRenderMenu(MenuItemCollection menu, string id, FormDataCollection queryStrings)
|
||||
{
|
||||
if (File.Exists((IOHelper.MapPath(FilePath + "/" + id))))
|
||||
{
|
||||
menu.Items.Add<ActionNew>(Services.TextService.Localize("actions", ActionNew.Instance.Alias))
|
||||
//Since we haven't implemented anything for file systems in angular, this needs to be converted to
|
||||
//use the legacy format
|
||||
.ConvertLegacyFileSystemMenuItem(id, "stylesheet", queryStrings.GetValue<string>("application"));
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnAfterRenderMenu(MenuItemCollection menu, string id, FormDataCollection queryStrings)
|
||||
{
|
||||
if (File.Exists((IOHelper.MapPath(FilePath + "/" + id))))
|
||||
{
|
||||
menu.Items.Add<ActionSort>(Services.TextService.Localize("actions", ActionSort.Instance.Alias), true)
|
||||
.ConvertLegacyFileSystemMenuItem(id, "stylesheet", queryStrings.GetValue<string>("application"));
|
||||
|
||||
//refresh action
|
||||
menu.Items.Add<RefreshNode, ActionRefresh>(
|
||||
Services.TextService.Localize("actions", ActionRefresh.Instance.Alias), true);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnRenderFileNode(TreeNode treeNode, FileInfo file)
|
||||
{
|
||||
treeNode.Icon = "icon-brackets";
|
||||
treeNode.NodeType = "stylesheet";
|
||||
var styleSheet = Services.FileService.GetStylesheetByName(treeNode.Id.ToString().EnsureEndsWith(".css"));
|
||||
if (styleSheet != null)
|
||||
{
|
||||
treeNode.HasChildren = styleSheet.Properties.Any();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected override TreeNodeCollection GetTreeNodesForFile(string path, string id, FormDataCollection queryStrings)
|
||||
{
|
||||
var nodes = new TreeNodeCollection();
|
||||
|
||||
var sheet = Services.FileService.GetStylesheetByName(id.EnsureEndsWith(".css"));
|
||||
|
||||
foreach (var prop in sheet.Properties)
|
||||
{
|
||||
var node = CreateTreeNode(
|
||||
id + "_" + prop.Name,
|
||||
id, queryStrings,
|
||||
prop.Name,
|
||||
"icon-brackets",
|
||||
false,
|
||||
"/" + queryStrings.GetValue<string>("application") + "/framed/" +
|
||||
Uri.EscapeDataString("settings/stylesheet/property/editStylesheetProperty.aspx?id=" +
|
||||
sheet.Path + "&prop=" + prop.Name));
|
||||
node.NodeType = "stylesheetProperty";
|
||||
nodes.Add(node);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
return nodes;
|
||||
}
|
||||
}
|
||||
}
|
||||
41
src/Umbraco.Web/Trees/XsltTreeController.cs
Normal file
41
src/Umbraco.Web/Trees/XsltTreeController.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Web.Models.Trees;
|
||||
|
||||
namespace Umbraco.Web.Trees
|
||||
{
|
||||
[Tree(Constants.Applications.Settings, Constants.Trees.Xslt, "XSLT Files", "icon-folder", "icon-folder", sortOrder: 2)]
|
||||
public class XsltTreeController : FileSystemTreeController
|
||||
{
|
||||
protected override string FilePath
|
||||
{
|
||||
get { return SystemDirectories.Xslt + "/"; }
|
||||
}
|
||||
|
||||
protected override IEnumerable<string> FileSearchPattern
|
||||
{
|
||||
get { return new [] {"xslt"}; }
|
||||
}
|
||||
|
||||
protected override string EditFormUrl
|
||||
{
|
||||
get { return "developer/xslt/editXslt.aspx?file={0}"; }
|
||||
}
|
||||
|
||||
protected override bool EnableCreateOnFolder
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
protected override void OnRenderFileNode(TreeNode treeNode, FileInfo file)
|
||||
{
|
||||
treeNode.Icon = "icon-code";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -327,7 +327,10 @@
|
||||
<Compile Include="Editors\EditorModelEventManager.cs" />
|
||||
<Compile Include="HtmlHelperBackOfficeExtensions.cs" />
|
||||
<Compile Include="Trees\MacrosTreeController.cs" />
|
||||
<Compile Include="Trees\ScriptsTreeController.cs" />
|
||||
<Compile Include="Trees\StylesheetsTreeController.cs" />
|
||||
<Compile Include="Trees\UserTypesTreeController.cs" />
|
||||
<Compile Include="Trees\XsltTreeController.cs" />
|
||||
<Compile Include="_Legacy\Actions\Action.cs" />
|
||||
<Compile Include="_Legacy\Actions\ActionAssignDomain.cs" />
|
||||
<Compile Include="_Legacy\Actions\ActionAudit.cs" />
|
||||
@@ -1047,8 +1050,8 @@
|
||||
<Compile Include="Strategies\ServerRegistrationEventHandler.cs" />
|
||||
<Compile Include="Templates\TemplateRenderer.cs" />
|
||||
<Compile Include="Templates\TemplateUtilities.cs" />
|
||||
<Compile Include="Trees\PartialViewMacrosTree.cs" />
|
||||
<Compile Include="Trees\PartialViewsTree.cs" />
|
||||
<Compile Include="Trees\PartialViewMacrosTreeController.cs" />
|
||||
<Compile Include="Trees\PartialViewsTreeController.cs" />
|
||||
<Compile Include="UI\Controls\InsertMacroSplitButton.cs" />
|
||||
<Compile Include="UI\IAssignedApp.cs" />
|
||||
<Compile Include="_Legacy\PackageActions\addApplication.cs" />
|
||||
@@ -1546,16 +1549,11 @@
|
||||
<DependentUpon>xml.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\BaseTree.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\FileSystemTree.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadDictionary.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadMemberGroups.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadPackages.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadScripts.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadStylesheetProperty.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadStylesheets.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadTranslationTasks.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadUsers.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadXslt.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\NullTree.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\TreeDefinitionCollection.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\TreeDefinition.cs" />
|
||||
@@ -1759,7 +1757,9 @@
|
||||
<Content Include="umbraco.presentation\umbraco\settings\scripts\editScript.aspx">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Content>
|
||||
<Content Include="umbraco.presentation\umbraco\translation\default.aspx" />
|
||||
<Content Include="umbraco.presentation\umbraco\translation\default.aspx">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Content>
|
||||
<Content Include="umbraco.presentation\umbraco\translation\preview.aspx" />
|
||||
<Content Include="umbraco.presentation\umbraco\translation\xml.aspx" />
|
||||
<Content Include="umbraco.presentation\umbraco\developer\Macros\assemblyBrowser.aspx" />
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.IO;
|
||||
using Umbraco.Core.IO;
|
||||
|
||||
namespace umbraco.cms.presentation.Trees
|
||||
{
|
||||
public abstract class FileSystemTree : BaseTree
|
||||
{
|
||||
|
||||
public FileSystemTree(string application) : base(application) { }
|
||||
|
||||
public override abstract void RenderJS(ref System.Text.StringBuilder Javascript);
|
||||
protected override abstract void CreateRootNode(ref XmlTreeNode rootNode);
|
||||
|
||||
protected abstract string FilePath { get; }
|
||||
protected abstract string FileSearchPattern { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Inheritors can override this method to modify the file node that is created.
|
||||
/// </summary>
|
||||
/// <param name="xNode"></param>
|
||||
protected virtual void OnRenderFileNode(ref XmlTreeNode xNode) { }
|
||||
|
||||
/// <summary>
|
||||
/// Inheritors can override this method to modify the folder node that is created.
|
||||
/// </summary>
|
||||
/// <param name="xNode"></param>
|
||||
protected virtual void OnRenderFolderNode(ref XmlTreeNode xNode) { }
|
||||
|
||||
public override void Render(ref XmlTree tree)
|
||||
{
|
||||
string orgPath = "";
|
||||
string path = "";
|
||||
if (!string.IsNullOrEmpty(this.NodeKey))
|
||||
{
|
||||
orgPath = this.NodeKey;
|
||||
path = IOHelper.MapPath(FilePath + orgPath);
|
||||
orgPath += "/";
|
||||
}
|
||||
else
|
||||
{
|
||||
path = IOHelper.MapPath(FilePath);
|
||||
}
|
||||
|
||||
DirectoryInfo dirInfo = new DirectoryInfo(path);
|
||||
|
||||
|
||||
DirectoryInfo[] dirInfos = dirInfo.Exists ? dirInfo.GetDirectories() : new DirectoryInfo[] { };
|
||||
|
||||
var args = new TreeEventArgs(tree);
|
||||
OnBeforeTreeRender(dirInfo, args);
|
||||
|
||||
foreach (DirectoryInfo dir in dirInfos)
|
||||
{
|
||||
if ((dir.Attributes & FileAttributes.Hidden) == 0)
|
||||
{
|
||||
XmlTreeNode xDirNode = XmlTreeNode.Create(this);
|
||||
xDirNode.NodeID = orgPath + dir.Name;
|
||||
xDirNode.Menu.Clear();
|
||||
xDirNode.Text = dir.Name;
|
||||
xDirNode.Action = string.Empty;
|
||||
xDirNode.Source = GetTreeServiceUrl(orgPath + dir.Name);
|
||||
xDirNode.Icon = FolderIcon;
|
||||
xDirNode.OpenIcon = FolderIconOpen;
|
||||
xDirNode.HasChildren = dir.GetFiles().Length > 0 || dir.GetDirectories().Length > 0;
|
||||
|
||||
OnRenderFolderNode(ref xDirNode);
|
||||
OnBeforeNodeRender(ref tree, ref xDirNode, EventArgs.Empty);
|
||||
if (xDirNode != null)
|
||||
{
|
||||
tree.Add(xDirNode);
|
||||
OnAfterNodeRender(ref tree, ref xDirNode, EventArgs.Empty);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//this is a hack to enable file system tree to support multiple file extension look-up
|
||||
//so the pattern both support *.* *.xml and xml,js,vb for lookups
|
||||
string[] allowedExtensions = new string[0];
|
||||
bool filterByMultipleExtensions = FileSearchPattern.Contains(",");
|
||||
FileInfo[] fileInfo;
|
||||
|
||||
if (filterByMultipleExtensions)
|
||||
{
|
||||
fileInfo = dirInfo.Exists ? dirInfo.GetFiles() : new FileInfo[] {};
|
||||
allowedExtensions = FileSearchPattern.ToLower().Split(',');
|
||||
}
|
||||
else
|
||||
{
|
||||
fileInfo = dirInfo.Exists ? dirInfo.GetFiles(FileSearchPattern) : new FileInfo[] { };
|
||||
}
|
||||
|
||||
foreach (FileInfo file in fileInfo)
|
||||
{
|
||||
if ((file.Attributes & FileAttributes.Hidden) == 0)
|
||||
{
|
||||
if (filterByMultipleExtensions && Array.IndexOf<string>(allowedExtensions, file.Extension.ToLower().Trim('.')) < 0)
|
||||
continue;
|
||||
|
||||
XmlTreeNode xFileNode = XmlTreeNode.Create(this);
|
||||
xFileNode.NodeID = orgPath + file.Name;
|
||||
xFileNode.Text = file.Name;
|
||||
if (!((orgPath == "")))
|
||||
xFileNode.Action = "javascript:openFile('" + orgPath + file.Name + "');";
|
||||
else
|
||||
xFileNode.Action = "javascript:openFile('" + file.Name + "');";
|
||||
xFileNode.Icon = "doc.gif";
|
||||
xFileNode.OpenIcon = "doc.gif";
|
||||
|
||||
OnRenderFileNode(ref xFileNode);
|
||||
OnBeforeNodeRender(ref tree, ref xFileNode, EventArgs.Empty);
|
||||
if (xFileNode != null)
|
||||
{
|
||||
tree.Add(xFileNode);
|
||||
OnAfterNodeRender(ref tree, ref xFileNode, EventArgs.Empty);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
OnAfterTreeRender(dirInfo, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
|
||||
using Umbraco.Core.Services;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Umbraco.Core;
|
||||
|
||||
using Umbraco.Core.Configuration;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Web.Trees;
|
||||
using Umbraco.Web._Legacy.Actions;
|
||||
|
||||
|
||||
namespace umbraco
|
||||
{
|
||||
[Tree(Constants.Applications.Settings, "scripts", "Scripts", "icon-folder", "icon-folder", sortOrder: 2)]
|
||||
public class loadScripts : FileSystemTree
|
||||
{
|
||||
public loadScripts(string application) : base(application) { }
|
||||
protected override void CreateRootNode(ref XmlTreeNode rootNode)
|
||||
{
|
||||
rootNode.NodeType = "init" + TreeAlias;
|
||||
rootNode.NodeID = "init";
|
||||
rootNode.Text = Services.TextService.Localize("treeHeaders/scripts");
|
||||
}
|
||||
|
||||
public override void RenderJS(ref StringBuilder Javascript)
|
||||
{
|
||||
Javascript.Append(
|
||||
@"
|
||||
function openScriptEditor(id) {
|
||||
UmbClientMgr.contentFrame('settings/scripts/editScript.aspx?file=' + id);
|
||||
}
|
||||
function openScriptFolder(id) {
|
||||
return false;
|
||||
}
|
||||
");
|
||||
}
|
||||
|
||||
protected override string FilePath
|
||||
{
|
||||
get
|
||||
{
|
||||
return SystemDirectories.Scripts + "/";
|
||||
}
|
||||
}
|
||||
|
||||
protected override string FileSearchPattern
|
||||
{
|
||||
|
||||
get { return string.Join(",", UmbracoConfig.For.UmbracoSettings().Content.ScriptFileTypes); }
|
||||
}
|
||||
|
||||
protected override void OnRenderFolderNode(ref XmlTreeNode xNode)
|
||||
{
|
||||
|
||||
xNode.Menu = new List<IAction>(new IAction[]
|
||||
{
|
||||
ActionNew.Instance,
|
||||
ContextMenuSeperator.Instance,
|
||||
ActionDelete.Instance,
|
||||
ContextMenuSeperator.Instance,
|
||||
ActionRefresh.Instance
|
||||
});
|
||||
xNode.Action = "javascript:void(0)";
|
||||
xNode.NodeType = "scriptsFolder";
|
||||
xNode.Action = "javascript:void(0);";
|
||||
}
|
||||
|
||||
protected override void OnRenderFileNode(ref XmlTreeNode xNode)
|
||||
{
|
||||
xNode.Action = xNode.Action.Replace("openFile", "openScriptEditor");
|
||||
|
||||
// add special icons for javascript files
|
||||
if (xNode.Text.Contains(".js"))
|
||||
{
|
||||
xNode.Icon = "icon-script";
|
||||
xNode.OpenIcon = "icon-script";
|
||||
}
|
||||
else
|
||||
{
|
||||
xNode.Icon = "icon-code";
|
||||
xNode.OpenIcon = "icon-code";
|
||||
}
|
||||
|
||||
xNode.Text = xNode.Text.StripFileExtension();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Web.Trees;
|
||||
|
||||
|
||||
namespace umbraco
|
||||
{
|
||||
[Tree(Constants.Applications.Settings, "stylesheetProperty", "Stylesheet Property", "", "", initialize: false)]
|
||||
public class loadStylesheetProperty : BaseTree
|
||||
{
|
||||
public loadStylesheetProperty(string application) : base(application) { }
|
||||
|
||||
protected override void CreateRootNode(ref XmlTreeNode rootNode)
|
||||
{
|
||||
rootNode.NodeType = "init" + TreeAlias;
|
||||
rootNode.NodeID = "init";
|
||||
}
|
||||
|
||||
public override void RenderJS(ref StringBuilder Javascript)
|
||||
{
|
||||
Javascript.Append(
|
||||
@"
|
||||
function openStylesheetProperty(name, prop) {
|
||||
UmbClientMgr.contentFrame('settings/stylesheet/property/editStylesheetProperty.aspx?id=' + name + '&prop=' + prop);
|
||||
}
|
||||
");
|
||||
}
|
||||
|
||||
public override void Render(ref XmlTree tree)
|
||||
{
|
||||
var sheet = Services.FileService.GetStylesheetByName(NodeKey.EnsureEndsWith(".css"));
|
||||
|
||||
foreach (var prop in sheet.Properties)
|
||||
{
|
||||
var sheetId = sheet.Path.TrimEnd(".css");
|
||||
var xNode = XmlTreeNode.Create(this);
|
||||
xNode.NodeID = sheetId + "_" + prop.Name;
|
||||
xNode.Text = prop.Name;
|
||||
xNode.Action = "javascript:openStylesheetProperty('" +
|
||||
//Needs to be escaped for JS
|
||||
HttpUtility.UrlEncode(sheet.Path) +
|
||||
"','" + prop.Name + "');";
|
||||
xNode.Icon = "icon-brackets";
|
||||
xNode.OpenIcon = "icon-brackets";
|
||||
|
||||
OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty);
|
||||
if (xNode != null)
|
||||
{
|
||||
tree.Add(xNode);
|
||||
OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
using Umbraco.Core.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Web.Trees;
|
||||
using Umbraco.Web._Legacy.Actions;
|
||||
|
||||
|
||||
namespace umbraco
|
||||
{
|
||||
[Tree(Constants.Applications.Settings, Constants.Trees.Stylesheets, "Stylesheets")]
|
||||
public class loadStylesheets : BaseTree
|
||||
{
|
||||
public loadStylesheets(string application) : base(application) { }
|
||||
|
||||
protected override void CreateRootNode(ref XmlTreeNode rootNode)
|
||||
{
|
||||
rootNode.NodeType = "init" + TreeAlias;
|
||||
rootNode.NodeID = "init";
|
||||
rootNode.Text = Services.TextService.Localize("treeHeaders/stylesheets");
|
||||
}
|
||||
|
||||
public override void RenderJS(ref StringBuilder Javascript)
|
||||
{
|
||||
Javascript.Append(
|
||||
@"
|
||||
function openStylesheet(name) {
|
||||
UmbClientMgr.contentFrame('settings/stylesheet/editStylesheet.aspx?id=' + name);
|
||||
}
|
||||
");
|
||||
}
|
||||
|
||||
protected override void CreateAllowedActions(ref List<IAction> actions)
|
||||
{
|
||||
actions.Clear();
|
||||
actions.AddRange(new IAction[] { ActionNew.Instance, ActionDelete.Instance,
|
||||
ActionSort.Instance, ContextMenuSeperator.Instance, ActionRefresh.Instance });
|
||||
}
|
||||
|
||||
public override void Render(ref XmlTree tree)
|
||||
{
|
||||
foreach (var sheet in Services.FileService.GetStylesheets())
|
||||
{
|
||||
var nodeId = sheet.Path.TrimEnd(".css");
|
||||
var xNode = XmlTreeNode.Create(this);
|
||||
xNode.NodeID = nodeId;
|
||||
xNode.Text = nodeId;
|
||||
xNode.Action = "javascript:openStylesheet('" +
|
||||
//Needs to be escaped for JS
|
||||
HttpUtility.UrlEncode(sheet.Path) + "');";
|
||||
var styleSheetPropertyTree = new loadStylesheetProperty(this.app);
|
||||
xNode.Source = styleSheetPropertyTree.GetTreeServiceUrl(nodeId);
|
||||
xNode.HasChildren = sheet.Properties.Any();
|
||||
xNode.Icon = " icon-brackets";
|
||||
xNode.OpenIcon = "icon-brackets";
|
||||
xNode.NodeType = "stylesheet"; //this shouldn't be like this, it should be this.TreeAlias but the ui.config file points to this name.
|
||||
|
||||
OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty);
|
||||
if (xNode != null)
|
||||
{
|
||||
tree.Add(xNode);
|
||||
OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Web.Trees;
|
||||
using Umbraco.Web._Legacy.Actions;
|
||||
|
||||
namespace umbraco
|
||||
{
|
||||
/// <summary>
|
||||
/// Handles loading of the xslt files into the application tree
|
||||
/// </summary>
|
||||
[Tree(Constants.Applications.Developer, "xslt", "XSLT Files", sortOrder: 5)]
|
||||
public class loadXslt : FileSystemTree
|
||||
{
|
||||
|
||||
public loadXslt(string application) : base(application) { }
|
||||
|
||||
protected override void CreateRootNode(ref XmlTreeNode rootNode)
|
||||
{
|
||||
rootNode.NodeType = "init" + TreeAlias;
|
||||
rootNode.NodeID = "init";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Renders the Javascript
|
||||
/// </summary>
|
||||
/// <param name="Javascript">The javascript.</param>
|
||||
public override void RenderJS(ref StringBuilder Javascript)
|
||||
{
|
||||
Javascript.Append(
|
||||
@"
|
||||
function openXslt(id) {
|
||||
UmbClientMgr.contentFrame('developer/xslt/editXslt.aspx?file=' + id);
|
||||
}
|
||||
");
|
||||
}
|
||||
|
||||
protected override string FilePath
|
||||
{
|
||||
get { return SystemDirectories.Xslt + "/"; }
|
||||
}
|
||||
|
||||
protected override string FileSearchPattern
|
||||
{
|
||||
get { return "*.xslt"; }
|
||||
}
|
||||
|
||||
protected override void OnRenderFileNode(ref XmlTreeNode xNode)
|
||||
{
|
||||
xNode.Action = xNode.Action.Replace("openFile", "openXslt");
|
||||
xNode.Icon = "icon-code";
|
||||
xNode.OpenIcon = "icon-code";
|
||||
|
||||
xNode.Text = xNode.Text.StripFileExtension();
|
||||
}
|
||||
|
||||
protected override void OnRenderFolderNode(ref XmlTreeNode xNode)
|
||||
{
|
||||
xNode.Menu = new List<IAction>(new IAction[] { ActionDelete.Instance, ContextMenuSeperator.Instance, ActionRefresh.Instance });
|
||||
xNode.NodeType = "xsltFolder";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,7 +30,7 @@ namespace umbraco.cms.presentation.developer
|
||||
string file = Request.QueryString["file"];
|
||||
string path = BaseTree.GetTreePathFromFilePath(file);
|
||||
ClientTools
|
||||
.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadXslt>().Tree.Alias)
|
||||
.SetActiveTreeType(Constants.Trees.Xslt)
|
||||
.SyncTree(path, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace umbraco.cms.presentation.settings.scripts
|
||||
if (IsPostBack == false)
|
||||
{
|
||||
ClientTools
|
||||
.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadScripts>().Tree.Alias)
|
||||
.SetActiveTreeType(Constants.Trees.Scripts)
|
||||
.SyncTree(ScriptTreeSyncPath, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace umbraco.cms.presentation.settings.stylesheet
|
||||
|
||||
lttPath.Text = "<a id=\"" + lttPath.ClientID + "\" target=\"_blank\" href=\"" + stylesheet.VirtualPath + "\">" + stylesheet.VirtualPath + "</a>";
|
||||
editorSource.Text = stylesheet.Content;
|
||||
TreeSyncPath = BaseTree.GetTreePathFromFilePath(filename).TrimEnd(".css");
|
||||
TreeSyncPath = BaseTree.GetTreePathFromFilePath(filename);
|
||||
|
||||
// name derives from path, without the .css extension, clean for xss
|
||||
NameTxt.Text = stylesheet.Path.TrimEnd(".css").CleanForXss('\\', '/');
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace umbraco.cms.presentation.settings.stylesheet
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
|
||||
|
||||
_sheet = Services.FileService.GetStylesheetByName(Request.QueryString["id"]);
|
||||
if (_sheet == null) throw new InvalidOperationException("No stylesheet found with name: " + Request.QueryString["id"]);
|
||||
|
||||
@@ -70,9 +70,9 @@ namespace umbraco.cms.presentation.settings.stylesheet
|
||||
|
||||
prStyles.Attributes["style"] = _stylesheetproperty.Value;
|
||||
|
||||
var nodePath = string.Format("-1,init,{0},{0}_{1}", _sheet.Path
|
||||
//needs a double escape to work with JS
|
||||
.Replace("\\", "\\\\").TrimEnd(".css"), _stylesheetproperty.Name);
|
||||
var path = _sheet.Path.Replace('\\', '/');
|
||||
var nodePath = string.Format(BaseTree.GetTreePathFromFilePath(path) +
|
||||
",{0}_{1}", path, _stylesheetproperty.Name);
|
||||
|
||||
ClientTools
|
||||
.SetActiveTreeType(Constants.Trees.Stylesheets)
|
||||
|
||||
Reference in New Issue
Block a user