Relation Types: Relocated the tree class to match the other back-office developer tree classes.
Added to trees.config (template and working/dev copy)
This commit is contained in:
@@ -44,10 +44,12 @@
|
||||
iconClosed="folder.gif" iconOpen="folder_o.gif" sortOrder="3" />
|
||||
<add application="developer" alias="packagerPackages" title="Packager Packages" assembly="umbraco" type="loadPackages"
|
||||
iconClosed="folder.gif" iconOpen="folder_o.gif" initialize="false" sortOrder="3" />
|
||||
<add application="developer" alias="relationTypes" title="Relation Types" assembly="umbraco" type="loadRelationTypes"
|
||||
iconClosed=".sprTreeFolder" iconOpen=".sprTreeFolder_o" sortOrder="4" />
|
||||
<add application="developer" alias="python" title="Scripting Files" assembly="umbraco" type="loadPython"
|
||||
iconClosed="folder.gif" iconOpen="folder_o.gif" sortOrder="4" />
|
||||
iconClosed="folder.gif" iconOpen="folder_o.gif" sortOrder="5" />
|
||||
<add application="developer" alias="xslt" title="XSLT Files" assembly="umbraco" type="loadXslt"
|
||||
iconClosed=".sprTreeFolder" iconOpen=".sprTreeFolder_o" sortOrder="5" />
|
||||
iconClosed=".sprTreeFolder" iconOpen=".sprTreeFolder_o" sortOrder="6" />
|
||||
|
||||
<!--Users-->
|
||||
<add application="users" alias="users" title="Users" assembly="umbraco" type="loadUsers"
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
<add application="developer" alias="macros" title="Macros" assembly="umbraco" type="loadMacros" iconClosed=".sprTreeFolder" iconOpen=".sprTreeFolder_o" sortOrder="2" />
|
||||
<add application="developer" alias="packager" title="Packages" assembly="umbraco" type="loadPackager" iconClosed="folder.gif" iconOpen="folder_o.gif" sortOrder="3" />
|
||||
<add application="developer" alias="packagerPackages" title="Packager Packages" assembly="umbraco" type="loadPackages" iconClosed="folder.gif" iconOpen="folder_o.gif" initialize="false" sortOrder="3" />
|
||||
<add application="developer" alias="relationTypes" title="Relation Types" assembly="umbraco" type="loadRelationTypes" iconClosed=".sprTreeFolder" iconOpen=".sprTreeFolder_o" sortOrder="4" />
|
||||
<add application="developer" alias="python" title="Scripting Files" assembly="umbraco" type="loadPython" iconClosed="folder.gif" iconOpen="folder_o.gif" sortOrder="4" />
|
||||
<add application="developer" alias="xslt" title="XSLT Files" assembly="umbraco" type="loadXslt" iconClosed=".sprTreeFolder" iconOpen=".sprTreeFolder_o" sortOrder="5" />
|
||||
<!--Users-->
|
||||
|
||||
@@ -1414,6 +1414,7 @@
|
||||
<Compile Include="umbraco\Trees\ITreeService.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="umbraco\Trees\loadRelationTypes.cs" />
|
||||
<Compile Include="umbraco\Trees\MediaRecycleBin.cs" />
|
||||
<Compile Include="umbraco\Trees\NodeActionsEventArgs.cs" />
|
||||
<Compile Include="umbraco\Trees\RelationTypes\EditRelationType.aspx.cs">
|
||||
@@ -1431,12 +1432,10 @@
|
||||
<DependentUpon>NewRelationType.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="umbraco\Trees\RelationTypes\ReadOnlyRelation.cs" />
|
||||
<Compile Include="umbraco\Trees\RelationTypes\RegisterRelationTypeTree.cs" />
|
||||
<Compile Include="umbraco\Trees\RelationTypes\RelationTypesWebService.asmx.cs">
|
||||
<DependentUpon>RelationTypesWebService.asmx</DependentUpon>
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="umbraco\Trees\RelationTypes\RelationTypeTree.cs" />
|
||||
<Compile Include="umbraco\Trees\RelationTypes\TreeMenu\ActionDeleteRelationType.cs" />
|
||||
<Compile Include="umbraco\Trees\RelationTypes\TreeMenu\ActionNewRelationType.cs" />
|
||||
<Compile Include="umbraco\Trees\TreeEventArgs.cs" />
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
|
||||
using umbraco.BusinessLogic.Actions;
|
||||
using umbraco.cms.businesslogic.relation;
|
||||
using umbraco.cms.presentation.Trees; // BaseTree
|
||||
using umbraco.DataLayer;
|
||||
using umbraco.interfaces;
|
||||
|
||||
using Umbraco.RelationTypes.TreeMenu;
|
||||
|
||||
namespace umbraco.cms.presentation.Trees.RelationTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// RelationTypes tree for developer section
|
||||
/// http://our.umbraco.org/wiki/reference/backoffice-apis/tree-api-to-create-custom-treesapplications
|
||||
/// (to comply with Umbraco naming conventions rename this class to loadRelationTypes)
|
||||
/// </summary>
|
||||
public class RelationTypeTree : BaseTree
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the RelationTypeTree class.
|
||||
/// </summary>
|
||||
/// <param name="application">name of umbraco app to which this tree has been added, (in this case "developer")</param>
|
||||
public RelationTypeTree(string application) : base(application)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builds the javascript methods for use by the nodes in this tree
|
||||
/// </summary>
|
||||
/// <param name="javascript">string container for javascript</param>
|
||||
public override void RenderJS(ref StringBuilder javascript)
|
||||
{
|
||||
javascript.Append(
|
||||
@"
|
||||
function openRelationType(id) {
|
||||
UmbClientMgr.contentFrame('Trees/RelationTypes/EditRelationType.aspx?id=' + id);
|
||||
}
|
||||
");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is called if the tree has been expanded, and it's used to render and child nodes for this tree
|
||||
/// </summary>
|
||||
/// <param name="tree">current tree</param>
|
||||
public override void Render(ref XmlTree tree)
|
||||
{
|
||||
XmlTreeNode node;
|
||||
|
||||
foreach (RelationType relationType in RelationType.GetAll().OrderBy(relationType => relationType.Name))
|
||||
{
|
||||
node = XmlTreeNode.Create(this);
|
||||
node.NodeID = relationType.Id.ToString();
|
||||
node.Text = relationType.Name;
|
||||
node.Icon = "settingAgent.gif";
|
||||
node.Action = "javascript:openRelationType('" + node.NodeID + "');";
|
||||
|
||||
tree.Add(node);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds right click context tree actions for each child node
|
||||
/// </summary>
|
||||
/// <param name="actions">collection of actions (expected to be empty)</param>
|
||||
protected override void CreateAllowedActions(ref List<IAction> actions)
|
||||
{
|
||||
actions.Clear();
|
||||
actions.Add(ActionDeleteRelationType.Instance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds right click context tree actions for the root 'Relation Types' node
|
||||
/// </summary>
|
||||
/// <param name="actions">collection of actions (expected to be empty)</param>
|
||||
protected override void CreateRootNodeActions(ref List<IAction> actions)
|
||||
{
|
||||
actions.Clear();
|
||||
actions.Add(ActionNewRelationType.Instance);
|
||||
actions.Add(ContextMenuSeperator.Instance);
|
||||
actions.Add(ActionRefresh.Instance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures root node 'Relation Types' properties
|
||||
/// </summary>
|
||||
/// <param name="rootNode">the 'Relation Types' root node</param>
|
||||
protected override void CreateRootNode(ref XmlTreeNode rootNode)
|
||||
{
|
||||
rootNode.Text = "Relation Types";
|
||||
rootNode.Icon = BaseTree.FolderIcon;
|
||||
rootNode.OpenIcon = BaseTree.FolderIconOpen;
|
||||
rootNode.NodeType = this.TreeAlias; // (Was prefixed with innit)
|
||||
rootNode.NodeID = "init";
|
||||
}
|
||||
}
|
||||
}
|
||||
98
src/umbraco.presentation/umbraco/Trees/loadRelationTypes.cs
Normal file
98
src/umbraco.presentation/umbraco/Trees/loadRelationTypes.cs
Normal file
@@ -0,0 +1,98 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using umbraco.BusinessLogic.Actions;
|
||||
using umbraco.cms.businesslogic.relation;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
using umbraco.DataLayer;
|
||||
using umbraco.interfaces;
|
||||
using Umbraco.RelationTypes.TreeMenu;
|
||||
using umbraco.businesslogic;
|
||||
|
||||
namespace umbraco
|
||||
{
|
||||
/// <summary>
|
||||
/// RelationTypes tree for developer section
|
||||
/// </summary>
|
||||
[Tree("developer", "relationTypes", "Relation Types", sortOrder: 4)]
|
||||
public class loadRelationTypes : BaseTree
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the RelationTypeTree class.
|
||||
/// </summary>
|
||||
/// <param name="application">name of umbraco app to which this tree has been added, (in this case "developer")</param>
|
||||
public loadRelationTypes(string application)
|
||||
: base(application)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builds the javascript methods for use by the nodes in this tree
|
||||
/// </summary>
|
||||
/// <param name="javascript">string container for javascript</param>
|
||||
public override void RenderJS(ref StringBuilder javascript)
|
||||
{
|
||||
javascript.Append(@"
|
||||
function openRelationType(id) {
|
||||
UmbClientMgr.contentFrame('Trees/RelationTypes/EditRelationType.aspx?id=' + id);
|
||||
}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is called if the tree has been expanded, and it's used to render and child nodes for this tree
|
||||
/// </summary>
|
||||
/// <param name="tree">current tree</param>
|
||||
public override void Render(ref XmlTree tree)
|
||||
{
|
||||
XmlTreeNode node;
|
||||
|
||||
foreach (RelationType relationType in RelationType.GetAll().OrderBy(relationType => relationType.Name))
|
||||
{
|
||||
node = XmlTreeNode.Create(this);
|
||||
node.NodeID = relationType.Id.ToString();
|
||||
node.Text = relationType.Name;
|
||||
node.Icon = "settingAgent.gif";
|
||||
node.Action = "javascript:openRelationType('" + node.NodeID + "');";
|
||||
|
||||
tree.Add(node);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds right click context tree actions for each child node
|
||||
/// </summary>
|
||||
/// <param name="actions">collection of actions (expected to be empty)</param>
|
||||
protected override void CreateAllowedActions(ref List<IAction> actions)
|
||||
{
|
||||
actions.Clear();
|
||||
actions.Add(ActionDeleteRelationType.Instance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds right click context tree actions for the root 'Relation Types' node
|
||||
/// </summary>
|
||||
/// <param name="actions">collection of actions (expected to be empty)</param>
|
||||
protected override void CreateRootNodeActions(ref List<IAction> actions)
|
||||
{
|
||||
actions.Clear();
|
||||
actions.Add(ActionNewRelationType.Instance);
|
||||
actions.Add(ContextMenuSeperator.Instance);
|
||||
actions.Add(ActionRefresh.Instance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures root node 'Relation Types' properties
|
||||
/// </summary>
|
||||
/// <param name="rootNode">the 'Relation Types' root node</param>
|
||||
protected override void CreateRootNode(ref XmlTreeNode rootNode)
|
||||
{
|
||||
rootNode.Text = "Relation Types";
|
||||
rootNode.Icon = BaseTree.FolderIcon;
|
||||
rootNode.OpenIcon = BaseTree.FolderIconOpen;
|
||||
rootNode.NodeType = this.TreeAlias; // (Was prefixed with init)
|
||||
rootNode.NodeID = "init";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user