U4-8187 Removed legacy loadLanguages and loadTemplates tree classes
This commit is contained in:
@@ -17,7 +17,6 @@ using Constants = Umbraco.Core.Constants;
|
||||
namespace Umbraco.Web.Trees
|
||||
{
|
||||
[UmbracoTreeAuthorize(Constants.Trees.Languages)]
|
||||
[LegacyBaseTree(typeof(loadLanguages))]
|
||||
[Tree(Constants.Applications.Settings, Constants.Trees.Languages, null, sortOrder: 4)]
|
||||
[PluginController("UmbracoTrees")]
|
||||
[CoreTree]
|
||||
|
||||
@@ -21,7 +21,6 @@ using Constants = Umbraco.Core.Constants;
|
||||
namespace Umbraco.Web.Trees
|
||||
{
|
||||
[UmbracoTreeAuthorize(Constants.Trees.Templates)]
|
||||
[LegacyBaseTree(typeof (loadTemplates))]
|
||||
[Tree(Constants.Applications.Settings, Constants.Trees.Templates, "Templates", sortOrder:1)]
|
||||
[PluginController("UmbracoTrees")]
|
||||
[CoreTree]
|
||||
|
||||
@@ -1577,14 +1577,12 @@
|
||||
<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\loadLanguages.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadMacros.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\loadTemplates.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" />
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
using umbraco.cms.businesslogic.language;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
using Umbraco.Core;
|
||||
|
||||
|
||||
namespace umbraco
|
||||
{
|
||||
[Obsolete("This is no longer used and will be removed from the codebase in the future")]
|
||||
//[Tree(Constants.Applications.Settings, "languages", "Languages", sortOrder: 4)]
|
||||
public class loadLanguages : BaseTree
|
||||
{
|
||||
public loadLanguages(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 openLanguage(id) {
|
||||
UmbClientMgr.contentFrame('settings/editLanguage.aspx?id=' + id);
|
||||
}");
|
||||
}
|
||||
|
||||
public override void Render(ref XmlTree tree)
|
||||
{
|
||||
foreach (Language l in Language.getAll)
|
||||
{
|
||||
XmlTreeNode xNode = XmlTreeNode.Create(this);
|
||||
xNode.NodeID = l.id.ToString(); //"language_" + l.id.ToString();
|
||||
xNode.Text = l.FriendlyName;
|
||||
xNode.Action = "javascript:openLanguage(" + l.id + ");";
|
||||
xNode.Icon = "icon-flag-alt";
|
||||
xNode.OpenIcon = "icon-flag-alt";
|
||||
|
||||
OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty);
|
||||
if (xNode != null)
|
||||
{
|
||||
tree.Add(xNode);
|
||||
OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,230 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
|
||||
using Umbraco.Core.Services;
|
||||
using umbraco.cms.businesslogic.template;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
using Umbraco.Web._Legacy.Actions;
|
||||
|
||||
|
||||
namespace umbraco
|
||||
{
|
||||
[Obsolete("This is no longer used and will be removed from the codebase in the future")]
|
||||
public class loadTemplates : BaseTree
|
||||
{
|
||||
public loadTemplates(string application) : base(application) {}
|
||||
|
||||
private ViewHelper _viewHelper = new ViewHelper(new PhysicalFileSystem(SystemDirectories.MvcViews));
|
||||
|
||||
protected override void CreateRootNode(ref XmlTreeNode rootNode)
|
||||
{
|
||||
rootNode.NodeType = "init" + TreeAlias;
|
||||
rootNode.NodeID = "init";
|
||||
}
|
||||
|
||||
|
||||
public override void RenderJS(ref StringBuilder Javascript)
|
||||
{
|
||||
|
||||
Javascript.Append(
|
||||
@"
|
||||
function openTemplate(id) {
|
||||
UmbClientMgr.contentFrame('settings/editTemplate.aspx?templateID=' + id);
|
||||
}
|
||||
|
||||
function openView(id) {
|
||||
UmbClientMgr.contentFrame('settings/views/editView.aspx?treeType=templates&templateID=' + id);
|
||||
}
|
||||
|
||||
function openSkin(id) {
|
||||
UmbClientMgr.contentFrame('settings/editSkin.aspx?skinID=' + id);
|
||||
}
|
||||
");
|
||||
}
|
||||
|
||||
|
||||
public override void Render(ref XmlTree tree)
|
||||
{
|
||||
string folder = umbraco.library.Request("folder");
|
||||
string folderPath = umbraco.library.Request("folderPath");
|
||||
|
||||
if (!string.IsNullOrEmpty(folder))
|
||||
RenderTemplateFolderItems(folder, folderPath, ref tree);
|
||||
else
|
||||
{
|
||||
if (UmbracoConfig.For.UmbracoSettings().Templates.EnableTemplateFolders)
|
||||
RenderTemplateFolders(ref tree);
|
||||
|
||||
RenderTemplates(ref tree);
|
||||
}
|
||||
}
|
||||
|
||||
private void RenderTemplateFolderItems(string folder, string folderPath, ref XmlTree tree)
|
||||
{
|
||||
string relPath = SystemDirectories.Masterpages + "/" + folder;
|
||||
if (string.IsNullOrEmpty(folderPath) == false)
|
||||
relPath += folderPath;
|
||||
|
||||
string fullPath = IOHelper.MapPath(relPath);
|
||||
|
||||
foreach (string dir in System.IO.Directory.GetDirectories(fullPath))
|
||||
{
|
||||
System.IO.DirectoryInfo directoryInfo = new DirectoryInfo(dir);
|
||||
XmlTreeNode xNode = XmlTreeNode.Create(this);
|
||||
xNode.Menu.Clear();
|
||||
xNode.Menu.Add(ActionRefresh.Instance);
|
||||
xNode.NodeID = "-1";
|
||||
xNode.Text = directoryInfo.Name;
|
||||
xNode.HasChildren = true;
|
||||
xNode.Icon = "icon-folder";
|
||||
xNode.OpenIcon = "icon-folder";
|
||||
xNode.Source = GetTreeServiceUrl(directoryInfo.Name) + "&folder=" + folder + "&folderPath=" + folderPath + "/" + directoryInfo.Name;
|
||||
tree.Add(xNode);
|
||||
}
|
||||
|
||||
foreach (string file in System.IO.Directory.GetFiles(fullPath))
|
||||
{
|
||||
System.IO.FileInfo fileinfo = new FileInfo(file);
|
||||
string ext = fileinfo.Extension.ToLower().Trim('.');
|
||||
|
||||
XmlTreeNode xNode = XmlTreeNode.Create(this);
|
||||
xNode.Menu.Clear();
|
||||
xNode.Menu.Add(ActionRefresh.Instance);
|
||||
xNode.NodeID = "-1";
|
||||
xNode.Text = Path.GetFileName(file);
|
||||
xNode.HasChildren = false;
|
||||
xNode.Action = "javascript:openScriptEditor('" + relPath + "/" + Path.GetFileName(file) + "');";
|
||||
|
||||
//tree.Add(xNode);
|
||||
|
||||
|
||||
switch (ext)
|
||||
{
|
||||
case "master":
|
||||
xNode.Icon = "icon-newspaper-alt";
|
||||
xNode.OpenIcon = "icon-newspaper-alt";
|
||||
tree.Add(xNode);
|
||||
break;
|
||||
case "css":
|
||||
case "js":
|
||||
xNode.Icon = "icon-brackets";
|
||||
xNode.OpenIcon = "icon-brackets";
|
||||
tree.Add(xNode);
|
||||
break;
|
||||
case "xml":
|
||||
if (xNode.Text == "skin.xml")
|
||||
{
|
||||
xNode.Icon = "icon-code";
|
||||
xNode.OpenIcon = "icon-code";
|
||||
tree.Add(xNode);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//xNode.Source = GetTreeServiceUrl(s.Alias) + "&skin=" + skin + "&path=" + path;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void RenderTemplateFolders(ref XmlTree tree)
|
||||
{
|
||||
if (base.m_id == -1)
|
||||
{
|
||||
var dir = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.Masterpages));
|
||||
if (dir.Exists)
|
||||
{
|
||||
foreach (var s in dir.GetDirectories())
|
||||
{
|
||||
var _s = Path.GetFileNameWithoutExtension(s.FullName);
|
||||
|
||||
XmlTreeNode xNode = XmlTreeNode.Create(this);
|
||||
xNode.NodeID = _s;
|
||||
xNode.Text = _s;
|
||||
xNode.Icon = "icon-folder";
|
||||
xNode.OpenIcon = "icon-folder";
|
||||
xNode.Source = GetTreeServiceUrl(_s) + "&folder=" + _s;
|
||||
xNode.HasChildren = true;
|
||||
xNode.Menu.Clear();
|
||||
xNode.Menu.Add(ActionRefresh.Instance);
|
||||
|
||||
OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty);
|
||||
if (xNode != null)
|
||||
{
|
||||
tree.Add(xNode);
|
||||
OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RenderTemplates(ref XmlTree tree)
|
||||
{
|
||||
List<Template> templates = null;
|
||||
if (m_id == -1)
|
||||
templates = Template.GetAllAsList().FindAll(t => t.HasMasterTemplate == false);
|
||||
else
|
||||
templates = Template.GetAllAsList().FindAll(t => t.MasterTemplate == m_id);
|
||||
|
||||
foreach (Template t in templates)
|
||||
{
|
||||
XmlTreeNode xNode = XmlTreeNode.Create(this);
|
||||
xNode.NodeID = t.Id.ToString(CultureInfo.InvariantCulture);
|
||||
xNode.Text = t.Text;
|
||||
xNode.Source = GetTreeServiceUrl(t.Id);
|
||||
xNode.HasChildren = t.HasChildren;
|
||||
|
||||
if (UmbracoConfig.For.UmbracoSettings().Templates.DefaultRenderingEngine == RenderingEngine.Mvc && _viewHelper.ViewExists(t.TemplateEntity))
|
||||
{
|
||||
xNode.Action = "javascript:openView(" + t.Id + ");";
|
||||
xNode.Icon = "icon-newspaper-alt";
|
||||
xNode.OpenIcon = "icon-newspaper-alt";
|
||||
}
|
||||
else
|
||||
{
|
||||
xNode.Action = "javascript:openTemplate(" + t.Id + ");";
|
||||
xNode.Icon = "icon-newspaper-alt";
|
||||
xNode.OpenIcon = "icon-newspaper-alt";
|
||||
}
|
||||
|
||||
if (t.HasChildren)
|
||||
{
|
||||
xNode.Icon = "icon-newspaper";
|
||||
xNode.OpenIcon = "icon-newspaper";
|
||||
//do not show the delete option if it has children
|
||||
xNode.Menu.Remove(ActionDelete.Instance);
|
||||
}
|
||||
|
||||
OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty);
|
||||
|
||||
if (xNode != null)
|
||||
{
|
||||
tree.Add(xNode);
|
||||
OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected override void CreateAllowedActions(ref List<IAction> actions) {
|
||||
actions.Clear();
|
||||
actions.AddRange(new IAction[] { ActionNew.Instance, ActionDelete.Instance,
|
||||
ContextMenuSeperator.Instance, ActionRefresh.Instance });
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user