tree webforms cleanup

This commit is contained in:
Shannon
2018-10-16 16:56:28 +11:00
parent 286f7b3279
commit 831657537f
23 changed files with 0 additions and 1818 deletions

View File

@@ -198,13 +198,6 @@
<Compile Include="Umbraco\Masterpages\UmbracoPage.master.designer.cs">
<DependentUpon>umbracoPage.Master</DependentUpon>
</Compile>
<Compile Include="Umbraco\TreeInit.aspx.cs">
<DependentUpon>treeInit.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Umbraco\TreeInit.aspx.designer.cs">
<DependentUpon>treeInit.aspx</DependentUpon>
</Compile>
<Content Include="App_Plugins\ModelsBuilder\modelsbuilder.controller.js" />
<Content Include="App_Plugins\ModelsBuilder\modelsbuilder.htm" />
<Content Include="App_Plugins\ModelsBuilder\modelsbuilder.resource.js" />
@@ -325,7 +318,6 @@
<Content Include="Umbraco\Config\Lang\pt.xml" />
<Content Include="Umbraco\Config\Lang\ru.xml" />
<Content Include="Umbraco\Config\Lang\zh.xml" />
<Content Include="Umbraco\Controls\Tree\CustomTreeService.asmx" />
<Content Include="Umbraco\Developer\RelationTypes\EditRelationType.aspx" />
<Content Include="Umbraco\Developer\RelationTypes\Images\Bidirectional.png" />
<Content Include="Umbraco\Developer\RelationTypes\Images\ParentToChild.png" />
@@ -340,7 +332,6 @@
<Content Include="Umbraco\Config\Lang\ko.xml" />
<Content Include="Umbraco\Dashboard\FeedProxy.aspx" />
<Content Include="Umbraco\endPreview.aspx" />
<Content Include="Umbraco\Controls\Tree\TreeControl.ascx" />
<Content Include="default.aspx" />
<Content Include="Umbraco\Config\Lang\da.xml">
<SubType>Designer</SubType>
@@ -352,16 +343,13 @@
<Content Include="Umbraco\Config\Lang\nl.xml" />
<Content Include="Umbraco\Config\Lang\nb.xml" />
<Content Include="Umbraco\Config\Lang\sv.xml" />
<Content Include="Umbraco\Dialogs\empty.htm" />
<Content Include="Umbraco\Dialogs\republish.aspx" />
<Content Include="Umbraco\Dialogs\SendPublish.aspx" />
<Content Include="Umbraco\Developer\Packages\directoryBrowser.aspx" />
<Content Include="Umbraco\Developer\Packages\editPackage.aspx" />
<Content Include="Umbraco\Dialogs\create.aspx" />
<Content Include="Umbraco\Dialogs\protectPage.aspx" />
<Content Include="Umbraco\Dialogs\rollBack.aspx" />
<Content Include="Umbraco\Dialogs\sendToTranslation.aspx" />
<Content Include="Umbraco\Dialogs\treePicker.aspx" />
<Content Include="Umbraco\Config\Create\UI.xml" />
<Content Include="Umbraco\Config\Lang\en.xml">
<SubType>Designer</SubType>
@@ -445,7 +433,6 @@
<Content Include="Umbraco\ping.aspx">
<SubType>Form</SubType>
</Content>
<Content Include="Umbraco\treeInit.aspx" />
<!--<Content Include="Umbraco\users\PermissionEditor.aspx" />-->
<Content Include="Umbraco\Webservices\ajax.js" />
<Content Include="Umbraco\Webservices\codeEditorSave.asmx" />

View File

@@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using umbraco.cms.presentation.Trees;
namespace Umbraco.Web.UI.Umbraco
{
[Obsolete("Used the TreeControl control instead. This does however get used by the TreeService when requesting the tree init url.")]
public partial class TreeInit : Pages.UmbracoEnsuredPage
{
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
TreeParams = TreeRequestParams.FromQueryStrings().CreateTreeService();
DataBind();
}
protected TreeService TreeParams { get; private set; }
}
}

View File

@@ -1,69 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Umbraco.Web.UI.Umbraco {
public partial class TreeInit {
/// <summary>
/// Head1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlHead Head1;
/// <summary>
/// ClientLoader control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Umbraco.Web.UI.JavaScript.UmbracoClientDependencyLoader ClientLoader;
/// <summary>
/// CssInclude1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.CssInclude CssInclude1;
/// <summary>
/// form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// ScriptManager1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.ScriptManager ScriptManager1;
/// <summary>
/// JTree control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.controls.Tree.TreeControl JTree;
}
}

View File

@@ -1,28 +0,0 @@
using System;
using System.Collections.Generic;
using System.Configuration.Provider;
using System.Linq;
using System.Web;
using System.Web.Security;
namespace Umbraco.Web.UI.Umbraco.Controls
{
public partial class PasswordChanger : global::umbraco.controls.passwordChanger
{
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
//always reset the control vals
ResetPasswordCheckBox.Checked = false;
umbPasswordChanger_passwordCurrent.Text = null;
umbPasswordChanger_passwordNew.Text = null;
umbPasswordChanger_passwordNewConfirm.Text = null;
//reset the flag always
IsChangingPasswordField.Value = "false";
this.DataBind();
}
}
}

View File

@@ -1,69 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Umbraco.Web.UI.Umbraco.Controls {
public partial class PasswordChanger {
/// <summary>
/// ResetPlaceHolder control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder ResetPlaceHolder;
/// <summary>
/// CurrentPasswordPlaceHolder control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder CurrentPasswordPlaceHolder;
/// <summary>
/// CurrentPasswordValidator control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.RequiredFieldValidator CurrentPasswordValidator;
/// <summary>
/// NewPasswordRequiredValidator control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.RequiredFieldValidator NewPasswordRequiredValidator;
/// <summary>
/// NewPasswordLengthValidator control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.RegularExpressionValidator NewPasswordLengthValidator;
/// <summary>
/// Div1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl Div1;
}
}

View File

@@ -1 +0,0 @@
<%@ WebService language="C#" class="umbraco.controls.Tree.CustomTreeService" %>

View File

@@ -1,57 +0,0 @@
<%@ Control Language="C#" AutoEventWireup="true" Inherits="umbraco.controls.Tree.TreeControl" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<%@ Register TagPrefix="umbClient" Namespace="Umbraco.Web.UI.Bundles" Assembly="Umbraco.Web" %>
<umb:CssInclude ID="CssInclude1" runat="server" FilePath="Tree/Themes/umbraco/style.css" PathNameAlias="UmbracoClient" Priority="12" />
<umbClient:JsApplicationLib ID="JsUmbracoApplicationLib1" runat="server"/>
<umbClient:JsJQueryCore ID="JsJQueryCore1" runat="server"/>
<umbClient:JsJQueryPlugins ID="JsJQueryPlugins1" runat="server"/>
<umbClient:JsUmbracoTree runat="server"/>
<script type="text/javascript">
jQuery(document).ready(function() {
var ctxMenu = <%#GetJSONContextMenu() %>;
var app = "<%#App%>";
var showContext = <%#ShowContextMenu.ToString().ToLower()%>;
var isDialog = <%#IsDialog.ToString().ToLower()%>;
var dialogMode = "<%#DialogMode.ToString()%>";
var treeType = "<%#TreeType%>";
var functionToCall = "<%#FunctionToCall%>";
var nodeKey = "<%#NodeKey%>";
//create the javascript tree
jQuery("#<%=ClientID%>").UmbracoTree({
doNotInit: <%#ManualInitialization.ToString().ToLower()%>,
jsonFullMenu: ctxMenu,
appActions: UmbClientMgr.appActions(),
deletingText: '<%=Services.TextService.Localize("deleting")%>',
app: app,
showContext: showContext,
isDialog: isDialog,
dialogMode: dialogMode,
treeType: treeType,
functionToCall : functionToCall,
nodeKey : nodeKey,
treeMode: "<%#Mode.ToString().ToLower()%>",
dataUrl: "<%#global::Umbraco.Core.IO.IOHelper.ResolveUrl(global::Umbraco.Core.IO.SystemDirectories.Umbraco)%>/webservices/TreeDataService.ashx",
serviceUrl: "<%#global::Umbraco.Core.IO.IOHelper.ResolveUrl(global::Umbraco.Core.IO.SystemDirectories.Umbraco)%>/webservices/TreeClientService.asmx/GetInitAppTreeData"});
<%if(string.IsNullOrEmpty(SelectedNodePath) == false) {%>
setTimeout(function() {
treeApi = jQuery("#<%=ClientID%>").UmbracoTreeAPI();
treeApi.syncTree('<%=SelectedNodePath%>', true, true);
}, 500);
<% } %>
<%#GetLegacyIActionJavascript()%>
});
</script>
<div runat="server" id="TreeContainer">
<div id="<%=ClientID%>" class="<%#Mode.ToString().ToLower()%>">
</div>
</div>

View File

@@ -1,133 +0,0 @@
<%@ Control Language="C#" AutoEventWireup="True" CodeBehind="passwordChanger.ascx.cs" Inherits="Umbraco.Web.UI.Umbraco.Controls.PasswordChanger" %>
<script type="text/javascript">
(function ($) {
Umbraco.Sys.registerNamespace("Umbraco.Controls");
var enablePassRetrieval = <%=Provider.EnablePasswordRetrieval.ToString().ToLower()%>;
Umbraco.Controls.PasswordChanger = {
toggle: function (e) {
if (!$("#umbPasswordChanger").is(":visible")) {
this.togglePasswordInputValidators(true);
$(e).closest(".umb-el-wrap").replaceWith($("#umbPasswordChanger"));
$("#umbPasswordChanger").show();
$("#<%=IsChangingPasswordField.ClientID%>").val("true");
$(e).hide();
}
},
togglePasswordInputValidators: function(enable) {
if (enable) {
ValidatorEnable(document.getElementById('<%=NewPasswordRequiredValidator.ClientID %>'), true);
ValidatorEnable(document.getElementById('<%=ConfirmPasswordValidator.ClientID %>'), true);
ValidatorEnable(document.getElementById('<%=NewPasswordLengthValidator.ClientID %>'), true);
if (!enablePassRetrieval) {
var currPassVal = document.getElementById('<%=CurrentPasswordValidator.ClientID %>');
if (currPassVal) {
ValidatorEnable(currPassVal, true);
}
}
}
else {
var currPassVal = document.getElementById('<%=CurrentPasswordValidator.ClientID %>');
if (currPassVal) {
ValidatorEnable(currPassVal, false);
}
ValidatorEnable(document.getElementById('<%=ConfirmPasswordValidator.ClientID %>'), false);
ValidatorEnable(document.getElementById('<%=NewPasswordRequiredValidator.ClientID %>'), false);
ValidatorEnable(document.getElementById('<%=NewPasswordLengthValidator.ClientID %>'), false);
}
},
toggleReset: function(isChecked) {
if (isChecked) {
$("#passwordInputArea").hide();
this.togglePasswordInputValidators(false);
}
else {
$("#passwordInputArea").show();
this.togglePasswordInputValidators(true);
}
}
};
$(document).ready(function () {
$("#changePasswordButton").click(function() {
Umbraco.Controls.PasswordChanger.toggle(this);
});
$("#<%=ResetPasswordCheckBox.ClientID%>").change(function () {
Umbraco.Controls.PasswordChanger.toggleReset(
$("#<%=ResetPasswordCheckBox.ClientID%>").is(":checked"));
});
});
})(jQuery);
</script>
<a href="#" id="changePasswordButton"><%= Services.TextService.Localize("user/changePassword") %></a><br />
<div class="propertyItem" id="umbPasswordChanger" style="display: none;">
<asp:HiddenField runat="server" ID="IsChangingPasswordField" Value="false" />
<asp:PlaceHolder runat="server" ID="ResetPlaceHolder" Visible="<%#Provider.EnablePasswordReset %>">
<div class="umb-el-wrap">
<label class="control-label" for="<%=ResetPasswordCheckBox.ClientID %>"><%=Services.TextService.Localize("user/resetPassword")%></label>
<div class="controls controls-row">
<asp:CheckBox runat="server" ID="ResetPasswordCheckBox" />
</div>
</div>
</asp:PlaceHolder>
<div id="passwordInputArea">
<asp:PlaceHolder runat="server" ID="CurrentPasswordPlaceHolder" Visible="<%#ShowOldPassword %>">
<div class="umb-el-wrap ">
<label class="control-label" for="<%=umbPasswordChanger_passwordCurrent.ClientID %>"><%=Services.TextService.Localize("user/passwordCurrent")%></label>
<div class="controls controls-row">
<asp:TextBox ID="umbPasswordChanger_passwordCurrent" autocomplete="off" AutoCompleteType="None" TextMode="password" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="CurrentPasswordValidator" Enabled="False" runat="server"
Display="Dynamic"
ControlToValidate="umbPasswordChanger_passwordCurrent"
ErrorMessage="*" />
</div>
</div>
</asp:PlaceHolder>
<div class="umb-el-wrap ">
<label class="control-label" for="<%=umbPasswordChanger_passwordNew.ClientID %>"><%=Services.TextService.Localize("user/newPassword")%></label>
<div class="controls controls-row">
<asp:TextBox ID="umbPasswordChanger_passwordNew" autocomplete="off" AutoCompleteType="None" TextMode="password" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="NewPasswordRequiredValidator" Enabled="False" runat="server"
Display="Dynamic"
ControlToValidate="umbPasswordChanger_passwordNew"
ErrorMessage="*" />
<asp:RegularExpressionValidator ID="NewPasswordLengthValidator" runat="server"
Display="Dynamic"
ControlToValidate="umbPasswordChanger_passwordNew"
ErrorMessage='<%# "Minimum " + Provider.MinRequiredPasswordLength + " characters" %>'
ValidationExpression='<%# ".{" + Provider.MinRequiredPasswordLength + "}.*" %>' />
</div>
</div>
<div class="umb-el-wrap ">
<label class="control-label" for="<%=umbPasswordChanger_passwordNewConfirm.ClientID %>"><%=Services.TextService.Localize("user/confirmNewPassword")%></label>
<div class="controls controls-row">
<asp:TextBox ID="umbPasswordChanger_passwordNewConfirm" autocomplete="off" AutoCompleteType="None" TextMode="password" runat="server"></asp:TextBox>
<asp:CompareValidator ID="ConfirmPasswordValidator" runat="server" Enabled="False"
Display="Dynamic"
ErrorMessage="Passwords must match"
ControlToValidate="umbPasswordChanger_passwordNew"
ControlToCompare="umbPasswordChanger_passwordNewConfirm"
Operator="Equal" />
</div>
</div>
</div>
</div>
<div id="Div1" runat="server" class="alert alert-success" style="margin-top: 10px; width: 300px;" visible="<%# string.IsNullOrWhiteSpace(ChangingPasswordModel.GeneratedPassword) == false %>">
<p style="text-align: center">
Password has been reset to<br />
<br />
<strong><%# ChangingPasswordModel.GeneratedPassword %></strong>
</p>
</div>

View File

@@ -1,67 +0,0 @@
<%@ Page Language="c#" MasterPageFile="../masterpages/umbracoDialog.Master"
AutoEventWireup="True" Inherits="umbraco.dialogs.create" %>
<%@ Import Namespace="Umbraco.Web" %>
<%@ Register Src="../controls/Tree/TreeControl.ascx" TagName="TreeControl" TagPrefix="umbraco" %>
<%@ Register TagPrefix="cc1" Namespace="Umbraco.Web._Legacy.Controls" Assembly="Umbraco.Web" %>
<asp:Content ContentPlaceHolderID="head" runat="server">
<script language="javascript" type="text/javascript">
var pageNameHolder = null;
var pageName = null;
jQuery(document).ready(function() {
pageNameHolder = jQuery("#<%=PageNameHolder.ClientID%>");
pageName = pageNameHolder.find("p");
});
function dialogHandler(id) {
document.getElementById("nodeId").value = id;
document.getElementById("ok").disabled = false;
// Get node name by xmlrequest
if (id > 0) {
umbraco.presentation.webservices.CMSNode.GetNodeName('<%=umbracoUserContextID%>', id, updateName);
}
else
pageName.html("<p><strong><%=Services.TextService.Localize(App)%></strong> <%= Services.TextService.Localize("moveOrCopy/nodeSelected") %></p>");
pageNameHolder.attr("class","success");
}
function updateName(result) {
pageName.html("<p><strong>" + result + "</strong> <%= Services.TextService.Localize("moveOrCopy/nodeSelected") %></p>");
pageNameHolder.attr("class","success");
}
function onNodeSelectionConfirmed() {
document.location.href = 'create.aspx?nodeType=<%=Request.CleanForXss("nodeType")%>&app=<%=App%>&nodeId=' + document.getElementById('nodeId').value
}
</script>
</asp:Content>
<asp:Content ContentPlaceHolderID="body" runat="server">
<input type="hidden" id="nodeId" name="nodeId" value="<%=Request.CleanForXss("nodeId")%>" />
<input type="hidden" id="path" name="path" value="" runat="server" />
<cc1:Pane ID="pane_chooseNode" runat="server" Style="overflow: auto; height: 250px;">
<umbraco:TreeControl runat="server" ID="JTree" App='<%#App %>'
IsDialog="true" DialogMode="id" ShowContextMenu="false" FunctionToCall="dialogHandler"
Height="230"></umbraco:TreeControl>
</cc1:Pane>
<asp:Panel runat="server" ID="panel_buttons">
<cc1:Feedback runat="server" ID="PageNameHolder" type="notice" Style="margin-top: 10px;"
Text='<%#Services.TextService.Localize("moveOrCopy/noNodeSelected")%>' />
<div style="padding-top: 10px;" class="guiDialogNormal">
<input type="button" id="ok" value="<%=Services.TextService.Localize("ok")%>" onclick="onNodeSelectionConfirmed();"
disabled="true" style="width: 100px" />
&nbsp; <em>
<%= Services.TextService.Localize("or") %></em>&nbsp; <a href="#" style="color: blue" onclick="UmbClientMgr.closeModalWindow()">
<%=Services.TextService.Localize("cancel")%></a>
</div>
</asp:Panel>
<cc1:Pane ID="pane_chooseName" Visible="false" runat="server">
<cc1:PropertyPanel runat="server">
<asp:PlaceHolder ID="phCreate" runat="server"></asp:PlaceHolder>
</cc1:PropertyPanel>
</cc1:Pane>
</asp:Content>

View File

@@ -1,9 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Umbraco - empty document</title>
</head>
<body>
</body>
</html>

View File

@@ -1,22 +0,0 @@
<%@ Page Language="c#" MasterPageFile="../masterpages/umbracoDialog.Master" CodeBehind="treePicker.aspx.cs"
AutoEventWireup="True" Inherits="umbraco.dialogs.treePicker" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<%@ Register TagPrefix="umb2" TagName="Tree" Src="../controls/Tree/TreeControl.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="body" runat="server">
<script type="text/javascript" language="javascript">
function dialogHandler(id) {
UmbClientMgr.closeModalWindow(id);
}
</script>
<umb2:Tree runat="server" ID="DialogTree" App='<%#TreeParams.App %>' TreeType='<%#TreeParams.TreeType %>'
IsDialog="true" ShowContextMenu="false" DialogMode="id" FunctionToCall="dialogHandler" NodeKey='<%#TreeParams.NodeKey %>' />
</asp:Content>

View File

@@ -1,47 +0,0 @@
<%@ Page Language="c#" CodeBehind="TreeInit.aspx.cs" AutoEventWireup="True" Inherits="Umbraco.Web.UI.Umbraco.TreeInit" %>
<%@ Register Src="controls/Tree/TreeControl.ascx" TagName="TreeControl" TagPrefix="umbraco" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<%@ Register TagPrefix="cc1" Namespace="Umbraco.Web.UI.JavaScript" Assembly="Umbraco.Web" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title></title>
<cc1:UmbracoClientDependencyLoader runat="server" id="ClientLoader" />
<umb:CssInclude ID="CssInclude1" runat="server" FilePath="css/umbracoGui.css" PathNameAlias="UmbracoRoot" />
<style type="text/css">
body
{
background: #fff;
margin: 0px;
padding: 0px;
}
</style>
<!--[if IE 6]>
<style type="text/css">
.sprTree{
background-image: url(images/umbraco/sprites_ie6.gif) !Important;
}
</style>
<![endif]-->
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" LoadScriptsBeforeUI="true">
</asp:ScriptManager>
<div>
<umbraco:TreeControl runat="server" ID="JTree"
App='<%#TreeParams.App %>' TreeType='<%#TreeParams.TreeType %>'
IsDialog="<%#TreeParams.IsDialog %>" ShowContextMenu="<%#TreeParams.ShowContextMenu %>"
DialogMode="<%#TreeParams.DialogMode %>" FunctionToCall="<%#TreeParams.FunctionToCall %>"
NodeKey="<%#TreeParams.NodeKey %>" StartNodeID="<%#TreeParams.StartNodeID %>" />
</div>
</form>
</body>
</html>

View File

@@ -1034,18 +1034,12 @@
<Compile Include="UI\Bundles\JsUmbracoApplicationUI.cs" />
<Compile Include="UI\Bundles\JsUmbracoTree.cs" />
<Compile Include="UI\CdfLogger.cs" />
<Compile Include="umbraco.presentation\umbraco\controls\Tree\TreeControl.ascx.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\create\simple.ascx.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\dialogs\ProtectPage.aspx.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\dialogs\create.aspx.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Controllers\UmbLoginController.cs" />
<Compile Include="UrlHelperExtensions.cs" />
<Compile Include="Editors\MediaController.cs" />
@@ -1205,9 +1199,6 @@
<Compile Include="umbraco.presentation\umbraco\dialogs\umbracoField.aspx.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\dialogs\treePicker.aspx.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\masterpages\umbracoPage.master.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
@@ -1265,17 +1256,6 @@
</Compile>
<Compile Include="umbraco.presentation\umbraco\controls\ContentPicker.cs" />
<Compile Include="umbraco.presentation\umbraco\controls\dualSelectBox.cs" />
<Compile Include="umbraco.presentation\umbraco\controls\Tree\CustomTreeControl.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\controls\Tree\CustomTreeService.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\controls\Tree\JTreeContextMenu.cs" />
<Compile Include="umbraco.presentation\umbraco\controls\Tree\JTreeContextMenuItem.cs" />
<Compile Include="umbraco.presentation\umbraco\controls\Tree\NodeInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\create\CreatedPackageTasks.cs" />
<Compile Include="umbraco.presentation\umbraco\create\dictionaryTasks.cs" />
<Compile Include="umbraco.presentation\umbraco\create\macroTasks.cs" />
@@ -1421,7 +1401,6 @@
<Content Include="umbraco.presentation\umbraco\webservices\legacyAjaxCalls.asmx" />
<Content Include="umbraco.presentation\umbraco\webservices\nodeSorter.asmx" />
<Content Include="PublishedCache\NuCache\notes.txt" />
<Content Include="umbraco.presentation\umbraco\controls\Tree\CustomTreeService.asmx" />
<Content Include="umbraco.presentation\umbraco\developer\RelationTypes\EditRelationType.aspx">
<SubType>ASPXCodeBehind</SubType>
</Content>
@@ -1430,7 +1409,6 @@
</Content>
<Content Include="umbraco.presentation\umbraco\developer\RelationTypes\RelationTypesWebService.asmx" />
<Content Include="umbraco.presentation\umbraco\dashboard\FeedProxy.aspx" />
<Content Include="umbraco.presentation\umbraco\dialogs\empty.htm" />
<Content Include="umbraco.presentation\umbraco\dialogs\insertMasterpageContent.aspx">
<SubType>ASPXCodeBehind</SubType>
</Content>

View File

@@ -1,123 +0,0 @@
using System;
using System.IO;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using ClientDependency.Core;
using umbraco.controls.Tree;
using Umbraco.Core.IO;
using Umbraco.Core.Services;
namespace umbraco.controls.Tree
{
/// <summary>
/// A custom tree control that uses a custom web service to return the initial node, this is required
/// due to a bug that exists in Umbraco 4.5.1 tree control/web service.
/// </summary>
/// <remarks>
/// Since we're inheriting from a UserControl and all of the ClientDependency registrations are done inline, we need
/// to re-register the ClientDependencies.
/// </remarks>
[ClientDependency(11, ClientDependencyType.Javascript, "Tree/jquery.tree.js", "UmbracoClient")]
[ClientDependency(12, ClientDependencyType.Javascript, "Tree/UmbracoContext.js", "UmbracoClient")]
[ClientDependency(12, ClientDependencyType.Javascript, "Tree/jquery.tree.contextmenu.js", "UmbracoClient")]
[ClientDependency(12, ClientDependencyType.Javascript, "Tree/jquery.tree.checkbox.js", "UmbracoClient")]
[ClientDependency(12, ClientDependencyType.Javascript, "Tree/NodeDefinition.js", "UmbracoClient")]
[ClientDependency(13, ClientDependencyType.Javascript, "Tree/UmbracoTree.js", "UmbracoClient")]
public class CustomTreeControl : TreeControl
{
/// <summary>
/// Ensure child controls are created on init
/// </summary>
/// <param name="e"></param>
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
this.EnsureChildControls();
}
/// <summary>
/// Create the child controls
/// </summary>
protected override void CreateChildControls()
{
base.CreateChildControls();
TreeContainer = new HtmlGenericControl();
TreeContainer.TagName = "div";
TreeContainer.ID = "TreeContainer";
this.Controls.Add(TreeContainer);
}
/// <summary>
/// Adds the internal markup to the TreeContainer control
/// </summary>
/// <param name="e"></param>
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
//add the internal markup to the TreeContainer
/* <div id="<%=ClientID%>" class="<%#Mode.ToString().ToLower()%>"></div> */
TreeContainer.Controls.Add(new LiteralControl(@"<div id=""" + ClientID + @""" class=""" + Mode.ToString().ToLower() + @"""></div>"));
}
/// <summary>
/// Render out the correct markup for the tree
/// </summary>
/// <remarks>
/// Since we're inheriting from a UserControl, we need to render out the markup manually
/// </remarks>
/// <param name="writer"></param>
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
//You'll notice that we're replacing the 'serviceUrl' parameter with our own custom web service!
writer.Write(@"
<script type=""text/javascript"">
jQuery(document).ready(function() {
var ctxMenu = " + GetJSONContextMenu() + @";
var app = """ + App + @""";
var showContext = " + ShowContextMenu.ToString().ToLower() + @";
var isDialog = " + IsDialog.ToString().ToLower() + @";
var dialogMode = """ + DialogMode.ToString() + @""";
var treeType = """ + TreeType + @""";
var functionToCall = """ + FunctionToCall + @""";
var nodeKey = """ + NodeKey + @""";
//create the javascript tree
jQuery(""#" + ClientID + @""").UmbracoTree({
doNotInit: " + ManualInitialization.ToString().ToLower() + @",
jsonFullMenu: ctxMenu,
appActions: UmbClientMgr.appActions(),
deletingText: '" + Services.TextService.Localize("deleting") + @"',
app: app,
showContext: showContext,
isDialog: isDialog,
dialogMode: dialogMode,
treeType: treeType,
functionToCall : functionToCall,
nodeKey : nodeKey,
treeMode: """ + Mode.ToString().ToLower() + @""",
dataUrl: """ + IOHelper.ResolveUrl(SystemDirectories.Umbraco) + @"/webservices/TreeDataService.ashx"",
serviceUrl: """ + IOHelper.ResolveUrl(SystemDirectories.Umbraco) + @"/controls/Tree/CustomTreeService.asmx/GetInitAppTreeData""});
//add event handler for ajax errors, this will refresh the whole application
var mainTree = UmbClientMgr.mainTree();
if (mainTree != null) {
mainTree.addEventHandler(""ajaxError"", function(e) {
if (e.msg == ""rebuildTree"") {
UmbClientMgr.mainWindow(""umbraco.aspx"");
}
});
}
});
</script>");
//render the controls
TreeContainer.RenderControl(writer);
}
}
}

View File

@@ -1 +0,0 @@
<%@ WebService language="C#" class="umbraco.controls.Tree.CustomTreeService" %>

View File

@@ -1,154 +0,0 @@
using System;
using Umbraco.Core.Security;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Script.Services;
using System.Web.Services;
using System.Web.UI;
using umbraco;
using umbraco.cms.businesslogic;
using umbraco.cms.presentation.Trees;
using umbraco.controls.Tree;
using Umbraco.Core.Services;
using Umbraco.Web;
using Umbraco.Web.Security;
using Umbraco.Web.WebServices;
namespace umbraco.controls.Tree
{
/// <summary>
/// Client side ajax utlities for the tree
/// </summary>
[ScriptService]
[WebService]
public class CustomTreeService : UmbracoWebService
{
/// <summary>
/// Returns some info about the node such as path and id
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public NodeInfo GetNodeInfo(int id)
{
Authorize();
//var node = new CMSNode(id);
var node = Services.EntityService.Get(id);
return new NodeInfo()
{
Id = node.Id,
Path = node.Path,
PathAsNames = string.Join("->",
GetPathNames(node.Path.Split(',')
.Select(x => int.Parse(x))
.ToArray()))
};
}
/// <summary>
/// returns the node names for each id passed in
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
private string[] GetPathNames(int[] ids)
{
return ids
.Where(x => x != -1)
//.Select(x => new CMSNode(x).Text).ToArray();
.Select(x => Services.EntityService.Get(x).Name).ToArray();
}
/// <summary>
/// Returns a key/value object with: json, app, js as the keys
/// </summary>
/// <returns></returns>
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public Dictionary<string, string> GetInitAppTreeData(string app, string treeType, bool showContextMenu, bool isDialog, TreeDialogModes dialogMode, string functionToCall, string nodeKey)
{
Authorize();
var treeCtl = new TreeControl()
{
ShowContextMenu = showContextMenu,
IsDialog = isDialog,
DialogMode = dialogMode,
App = app,
TreeType = string.IsNullOrEmpty(treeType) ? "" : treeType, //don't set the tree type unless explicitly set
NodeKey = string.IsNullOrEmpty(nodeKey) ? "" : nodeKey,
//StartNodeID = -1, //TODO: set this based on parameters!
FunctionToCall = string.IsNullOrEmpty(functionToCall) ? "" : functionToCall
};
var returnVal = new Dictionary<string, string>();
if (string.IsNullOrEmpty(treeType))
{
//if there's not tree type specified, then render out the tree as per normal with the normal
//way of doing things
returnVal.Add("json", treeCtl.GetJSONInitNode());
}
else
{
//since 4.5.1 has a bug in it, it ignores if the treeType is specified and will always only render
//the whole APP not just a specific tree.
//this is a work around for this bug until it is fixed (which should be fixed in 4.5.2
//get the tree that we need to render
var tree = TreeDefinitionCollection.Instance.FindTree(treeType).CreateInstance();
tree.ShowContextMenu = showContextMenu;
tree.IsDialog = isDialog;
tree.DialogMode = dialogMode;
tree.NodeKey = string.IsNullOrEmpty(nodeKey) ? "" : nodeKey;
tree.FunctionToCall = string.IsNullOrEmpty(functionToCall) ? "" : functionToCall;
//now render it's start node
var xTree = new XmlTree();
//we're going to hijack the node name here to make it say content/media
var node = tree.RootNode;
if (node.Text.Equals("[FilteredContentTree]")) node.Text = Services.TextService.Localize("content");
else if (node.Text.Equals("[FilteredMediaTree]")) node.Text = Services.TextService.Localize("media");
xTree.Add(node);
returnVal.Add("json", xTree.ToString());
}
returnVal.Add("app", app);
returnVal.Add("js", treeCtl.JSCurrApp);
return returnVal;
}
internal void Authorize()
{
if (ValidateCurrentUser() == false)
throw new Exception("Client authorization failed. User is not logged in");
}
/// <summary>
/// Validates the currently logged in user and ensures they are not timed out
/// </summary>
/// <returns></returns>
private bool ValidateCurrentUser()
{
var identity = Context.GetCurrentIdentity(
//DO NOT AUTO-AUTH UNLESS THE CURRENT HANDLER IS WEBFORMS!
// Without this check, anything that is using this legacy API, like ui.Text will
// automatically log the back office user in even if it is a front-end request (if there is
// a back office user logged in. This can cause problems becaues the identity is changing mid
// request. For example: http://issues.umbraco.org/issue/U4-4010
HttpContext.Current.CurrentHandler is Page);
if (identity != null)
{
return true;
}
return false;
}
}
}

View File

@@ -1,59 +0,0 @@
using System;
using System.Collections.Generic;
using System.Web.Script.Serialization;
using Umbraco.Core.Logging;
using Umbraco.Core;
using Umbraco.Web;
using Umbraco.Web.Composing;
using Umbraco.Web._Legacy.Actions;
using Action = Umbraco.Web._Legacy.Actions.Action;
namespace umbraco.controls.Tree
{
internal class JTreeContextMenu
{
public string RenderJSONMenu()
{
JavaScriptSerializer jSSerializer = new JavaScriptSerializer();
jSSerializer.RegisterConverters(new List<JavaScriptConverter>()
{
new JTreeContextMenuItem()
});
List<IAction> allActions = new List<IAction>();
foreach (var a in Current.Actions)
{
// NH: Added a try/catch block to this as an error in a 3rd party action can crash the whole menu initialization
try
{
if (!string.IsNullOrEmpty(a.Alias) && (!string.IsNullOrEmpty(a.JsFunctionName) || !string.IsNullOrEmpty(a.JsSource)))
{
// if the action is using invalid javascript we need to do something about this
if (!Action.ValidateActionJs(a))
{
// Make new Iaction
PlaceboAction pa = new PlaceboAction(a);
pa.JsFunctionName = "IActionProxy_" + pa.Alias.ToSafeAlias() + "()";
allActions.Add(pa);
}
else
{
allActions.Add(a);
}
}
}
catch (Exception ex)
{
Current.Logger.Error<JTreeContextMenu>(ex, "Error initializing tree action");
}
}
return jSSerializer.Serialize(allActions);
}
}
}

View File

@@ -1,82 +0,0 @@
using System;
using System.Collections.Generic;
using System.Web.Script.Serialization;
using System.Text;
using Umbraco.Core;
using Umbraco.Core.Services;
using Umbraco.Web;
using Umbraco.Web.Composing;
using Umbraco.Web._Legacy.Actions;
namespace umbraco.controls.Tree
{
internal class JTreeContextMenuItem : JavaScriptConverter
{
/// <summary>
/// Not implemented as we never need to Deserialize
/// </summary>
/// <param name="dictionary"></param>
/// <param name="type"></param>
/// <param name="serializer"></param>
/// <returns></returns>
public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
{
throw new NotImplementedException();
}
public override IDictionary<string, object> Serialize(object obj, JavaScriptSerializer serializer)
{
//{
// "id": "L",
// "label": "Create",
// "icon": "create.png",
// "visible": function(NODE, TREE_OBJ) { if (NODE.length != 1) return false; return TREE_OBJ.check("creatable", NODE); },
// "action": function(NODE, TREE_OBJ) { TREE_OBJ.create(false, NODE); },
//}
IAction a = (IAction)obj;
Dictionary<string, object> data = new Dictionary<string, object>();
data.Add("id", a.Letter);
data.Add("label", Current.Services.TextService.Localize(a.Alias));
if (a.Icon.StartsWith("."))
{
StringBuilder sb = new StringBuilder();
sb.Append(string.Format("<div class='menuSpr {0}'>", a.Icon.TrimStart('.')));
sb.Append("</div>");
sb.Append("<div class='menuLabel'>");
sb.Append(data["label"].ToString());
sb.Append("</div>");
data["label"] = sb.ToString();
}
else
{
data.Add("icon", a.Icon);
}
return data;
}
/// <summary>
/// TODO: Find out why we can't just return IAction as one type (JavaScriptSerializer doesn't seem to pick up on it)
/// </summary>
public override IEnumerable<Type> SupportedTypes
{
get
{
List<Type> types = new List<Type>();
foreach (var a in Current.Actions)
{
types.Add(a.GetType());
}
return types;
}
}
}
}

View File

@@ -1,32 +0,0 @@
namespace umbraco.controls.Tree
{
/// <summary>
/// Simple data object to hold information about a node
/// </summary>
public class NodeInfo
{
/// <summary>
/// Gets or sets the id.
/// </summary>
/// <value>The id.</value>
public int Id { get; set; }
/// <summary>
/// Gets or sets the path.
/// </summary>
/// <value>The path.</value>
public string Path { get; set; }
/// <summary>
/// Gets or sets the path as names.
/// </summary>
/// <value>The path as names.</value>
public string PathAsNames { get; set; }
/// <summary>
/// Gets or sets the type of the node.
/// </summary>
/// <value>The type of the node.</value>
public string NodeType { get; set; }
}
}

View File

@@ -1,593 +0,0 @@
using System;
using Umbraco.Core.Security;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Umbraco.Core.Models;
using Umbraco.Web.Trees;
using Umbraco.Web.UI.Controls;
using System.Text;
using umbraco.cms.presentation.Trees;
using System.Drawing;
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Services;
using Umbraco.Web.Security;
namespace umbraco.controls.Tree
{
/// <summary>
/// The Umbraco tree control.
/// <remarks>If this control doesn't exist on an UmbracoEnsuredPage it will not work.</remarks>
/// </summary>
public partial class TreeControl : UmbracoUserControl, ITreeService
{
/// <summary>
/// Set the defaults
/// </summary>
public TreeControl()
{
Width = Unit.Empty;
Height = Unit.Empty;
BackColor = Color.Empty;
CssClass = "";
ManualInitialization = false;
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
EnableViewState = false;
}
public enum TreeMode
{
Standard, Checkbox, InheritedCheckBox
}
/// <summary>
/// If there is not application or tree specified in a query string then this is the application to load.
/// </summary>
private const string DEFAULT_APP = Constants.Applications.Content;
private List<BaseTree> m_ActiveTrees = new List<BaseTree>();
private List<BaseTree> m_AllAppTrees = new List<BaseTree>();
private List<ApplicationTree> m_ActiveTreeDefs = null;
private TreeMode m_TreeType = TreeMode.Standard;
private bool m_IsInit = false;
private TreeService m_TreeService = new TreeService();
private string m_SelectedNodePath;
#region Public Properties
#region Style Properties
public string CssClass { get; set; }
public Unit Height { get; set; }
public Unit Width { get; set; }
public Color BackColor { get; set; }
#endregion
#region TreeService parameters.
public string FunctionToCall
{
get { return m_TreeService.FunctionToCall; }
set
{
m_TreeService.FunctionToCall = value;
}
}
public string NodeKey
{
get { return m_TreeService.NodeKey; }
set
{
m_TreeService.NodeKey = value;
}
}
public int StartNodeID
{
get { return m_TreeService.StartNodeID; }
set
{
m_TreeService.StartNodeID = value;
}
}
public string SelectedNodePath
{
get { return m_SelectedNodePath; }
set
{
m_SelectedNodePath = value;
}
}
public string TreeType
{
get { return m_TreeService.TreeType; }
set
{
m_TreeService.TreeType = value;
}
}
public bool ShowContextMenu
{
get { return m_TreeService.ShowContextMenu; }
set
{
m_TreeService.ShowContextMenu = value;
}
}
public bool IsDialog
{
get { return m_TreeService.IsDialog; }
set
{
m_TreeService.IsDialog = value;
}
}
public TreeDialogModes DialogMode
{
get { return m_TreeService.DialogMode; }
set
{
m_TreeService.DialogMode = value;
}
}
public string App
{
get
{
return GetCurrentApp();
}
set
{
m_TreeService.App = value;
}
}
#endregion
/// <summary>
/// Allows for checkboxes to be used with the tree. Default is standard.
/// </summary>
public TreeMode Mode
{
get
{
return m_TreeType;
}
set
{
m_TreeType = value;
}
}
/// <summary>
/// Returns the required JavaScript as a string for the current application
/// </summary>
public string JSCurrApp
{
get
{
StringBuilder javascript = new StringBuilder();
foreach (BaseTree bTree in m_AllAppTrees)
bTree.RenderJS(ref javascript);
return javascript.ToString();
}
}
/// <summary>
/// By default this is false. If set to true, then the code in the client side of the tree will force calling rebuildTree
/// to be called explicitly for the tree to render
/// </summary>
public bool ManualInitialization { get; set; }
#endregion
/// <summary>
/// Can be set explicitly which will override what is in query strings or what has been set by properties.
/// Useful for rendering out a tree dynamically with an instance of anoterh TreeService.
/// By using this method, it will undo any of the tree service public properties that may be set
/// on this object.
/// </summary>
public void SetTreeService(TreeService srv)
{
m_TreeService = srv;
Initialize();
}
/// <summary>
/// Initializes the control and looks up the tree structures that are required to be rendered.
/// Properties of the control (or SetTreeService) need to be set before pre render or calling
/// GetJSONContextMenu or GetJSONNode
/// </summary>
protected void Initialize()
{
//use the query strings if the TreeParams isn't explicitly set
if (m_TreeService == null)
{
m_TreeService = TreeRequestParams.FromQueryStrings().CreateTreeService();
}
m_TreeService.App = GetCurrentApp();
// Validate permissions
if (ValidateCurrentUser() == false)
return;
if (!Security.ValidateUserApp(GetCurrentApp()))
throw new ArgumentException("The current user doesn't have access to this application. Please contact the system administrator.");
//find all tree definitions that have the current application alias that are ACTIVE.
//if an explicit tree has been requested, then only load that tree in.
//m_ActiveTreeDefs = TreeDefinitionCollection.Instance.FindActiveTrees(GetCurrentApp());
m_ActiveTreeDefs = Services.ApplicationTreeService.GetApplicationTrees(GetCurrentApp(), true).ToList();
if (!string.IsNullOrEmpty(this.TreeType))
{
m_ActiveTreeDefs = m_ActiveTreeDefs
.Where(x => x.Alias == this.TreeType)
.ToList(); //this will only return 1
}
//find all tree defs that exists for the current application regardless of if they are active
var appTreeDefs = Services.ApplicationTreeService.GetApplicationTrees(GetCurrentApp()).ToList();
//Create the BaseTree's based on the tree definitions found
foreach (var treeDef in appTreeDefs)
{
//create the tree and initialize it
var bTree = LegacyTreeDataConverter.GetLegacyTreeForLegacyServices(treeDef);
//BaseTree bTree = treeDef.CreateInstance();
bTree.SetTreeParameters(m_TreeService);
//store the created tree
m_AllAppTrees.Add(bTree);
if (treeDef.Initialize)
m_ActiveTrees.Add(bTree);
}
m_IsInit = true;
}
/// <summary>
/// Validates the currently logged in user and ensures they are not timed out
/// </summary>
/// <returns></returns>
private bool ValidateCurrentUser()
{
var identity = Context.GetCurrentIdentity(
//DO NOT AUTO-AUTH UNLESS THE CURRENT HANDLER IS WEBFORMS!
// Without this check, anything that is using this legacy API, like ui.Text will
// automatically log the back office user in even if it is a front-end request (if there is
// a back office user logged in. This can cause problems becaues the identity is changing mid
// request. For example: http://issues.umbraco.org/issue/U4-4010
HttpContext.Current.CurrentHandler is Page);
if (identity != null)
{
return true;
}
return false;
}
/// <summary>
/// This calls the databind method to bind the data binding syntax on the front-end.
/// <remarks>
/// Databinding was used instead of inline tags in case the tree properties needed to be set
/// by other classes at runtime
/// </remarks>
/// </summary>
/// <param name="e"></param>
/// <remarks>
/// This will initialize the control so all TreeService properties need to be set before hand
/// </remarks>
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
if (!m_IsInit)
Initialize();
//Render out the JavaScript associated with all of the trees for the application
RenderTreeJS();
//apply the styles
if (Width != Unit.Empty)
TreeContainer.Style.Add(HtmlTextWriterStyle.Width, Width.ToString());
if (Height != Unit.Empty)
TreeContainer.Style.Add(HtmlTextWriterStyle.Height, Height.ToString());
if (BackColor != Color.Empty)
TreeContainer.Style.Add(HtmlTextWriterStyle.BackgroundColor, ColorTranslator.ToHtml(BackColor));
if (CssClass != "")
{
TreeContainer.Attributes.Add("class", CssClass);
}
else
{
//add the default class
TreeContainer.Attributes.Add("class", "treeContainer");
}
DataBind();
}
/// <summary>
/// Returns the JSON markup for the full context menu
/// </summary>
public string GetJSONContextMenu()
{
if (ShowContextMenu)
{
JTreeContextMenu menu = new JTreeContextMenu();
return menu.RenderJSONMenu();
}
else
{
return "{}";
}
}
/// <summary>
/// Returns a string with javascript proxy methods for IActions that are using old javascript
/// </summary>
/// <returns></returns>
public string GetLegacyIActionJavascript()
{
return LegacyTreeJavascript.GetLegacyIActionJavascript();
}
/// <summary>
/// Returns the JSON markup for one node
/// </summary>
/// <param name="treeAlias"></param>
/// <param name="nodeId"></param>
/// <returns></returns>
/// <remarks>
/// This will initialize the control so all TreeService properties need to be set before hand
/// </remarks>
public string GetJSONNode(string nodeId)
{
if (!m_IsInit)
Initialize();
if (string.IsNullOrEmpty(m_TreeService.TreeType))
{
throw new ArgumentException("The TreeType is not set on the tree service");
}
BaseTree tree = m_ActiveTrees.Find(
delegate(BaseTree t)
{
return (t.TreeAlias == m_TreeService.TreeType);
}
);
return tree.GetSerializedNodeData(nodeId);
}
/// <summary>
/// Returns the JSON markup for the first node in the tree
/// </summary>
public string GetJSONInitNode()
{
if (!m_IsInit)
Initialize();
//if there is only one tree to render, we don't want to have a node to hold sub trees, we just want the
//stand alone tree, so we'll just add a TreeType to the TreeService and ensure that the right method gets loaded in tree.aspx
if (m_ActiveTrees.Count == 1)
{
m_TreeService.TreeType = m_ActiveTreeDefs[0].Alias;
//convert the menu to a string
//string initActions = (TreeSvc.ShowContextMenu ? Action.ToString(m_ActiveTrees[0].RootNodeActions) : "");
//Since there's only 1 tree, render out the tree's RootNode properties
XmlTree xTree = new XmlTree();
xTree.Add(m_ActiveTrees[0].RootNode);
return xTree.ToString();
}
else
{
//If there is more than 1 tree for the application than render out a
//container node labelled with the current application.
XmlTree xTree = new XmlTree();
XmlTreeNode xNode = XmlTreeNode.CreateRoot(new NullTree(GetCurrentApp()));
xNode.Text = Services.TextService.Localize("sections", GetCurrentApp());
xNode.Source = m_TreeService.GetServiceUrl();
xNode.Action = "javascript:" + global::Umbraco.Web.UI.Pages.ClientTools.Scripts.OpenDashboard(GetCurrentApp());
xNode.NodeType = m_TreeService.App.ToLower();
xNode.NodeID = "-1";
xNode.Icon = ".sprTreeFolder";
xTree.Add(xNode);
return xTree.ToString();
}
}
private void RenderTreeJS()
{
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Trees_" + GetCurrentApp(), JSCurrApp, true);
}
/// <summary>
/// Return the current application alias. If neither the TreeType of Application is specified
/// than return the default application. If the Application is null but there is a TreeType then
/// find the application that the tree type is associated with.
/// </summary>
private string GetCurrentApp()
{
//if theres an treetype specified but no application
if (string.IsNullOrEmpty(m_TreeService.App) &&
!string.IsNullOrEmpty(m_TreeService.TreeType))
{
TreeDefinition treeDef = TreeDefinitionCollection.Instance.FindTree(m_TreeService.TreeType);
if (treeDef != null)
return treeDef.App.Alias;
}
else if (!string.IsNullOrEmpty(m_TreeService.App))
return m_TreeService.App;
//if everything is null then return the default app
return DEFAULT_APP;
}
/// <summary>
/// CssInclude2 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.CssInclude CssInclude2;
/// <summary>
/// CssInclude3 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.CssInclude CssInclude3;
/// <summary>
/// CssInclude1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.CssInclude CssInclude1;
/// <summary>
/// JsInclude1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude1;
/// <summary>
/// JsInclude2 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude2;
/// <summary>
/// JsInclude3 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude3;
/// <summary>
/// JsInclude4 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude4;
/// <summary>
/// JsInclude5 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude5;
/// <summary>
/// JsInclude6 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude6;
/// <summary>
/// JsInclude8 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude8;
/// <summary>
/// JsInclude11 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude11;
/// <summary>
/// JsInclude7 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude7;
/// <summary>
/// JsInclude12 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude12;
/// <summary>
/// JsInclude9 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude9;
/// <summary>
/// JsInclude10 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude10;
/// <summary>
/// TreeContainer control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl TreeContainer;
}
}

View File

@@ -1,160 +0,0 @@
using System;
using System.Linq;
using System.Globalization;
using System.Web.UI;
using System.Xml;
using Umbraco.Core.IO;
using Umbraco.Web;
using Umbraco.Core;
using Umbraco.Core.Services;
using Umbraco.Web.UI.Pages;
using Umbraco.Web._Legacy.Actions;
using Button = System.Web.UI.WebControls.Button;
using UserControl = System.Web.UI.UserControl;
namespace umbraco.dialogs
{
/// <summary>
/// Summary description for create.
/// </summary>
public partial class create : UmbracoEnsuredPage
{
protected Button ok;
private string _app;
protected string App
{
get
{
if (_app == null)
{
_app = Request.CleanForXss("app");
//validate the app
if (Services.SectionService.GetSections().Any(x => x.Alias.InvariantEquals(_app)) == false)
{
throw new InvalidOperationException("A requested app: " + Request.GetItemAsString("app") + " was not found");
}
}
return _app;
}
}
protected void Page_Load(object sender, EventArgs e)
{
// Put user code to initialize the page here
if (Request.GetItemAsString("nodeId") == "")
{
var appType = Services.TextService.Localize("sections", App).ToLower();
pane_chooseNode.Text = Services.TextService.Localize("create/chooseNode", new[] { appType }) + "?";
DataBind();
}
else
{
int nodeId = Request.GetItemAs<int>("nodeId");
//ensure they have access to create under this node!!
if (App.InvariantEquals(Constants.Applications.Media) || CheckCreatePermissions(nodeId))
{
//var c = new CMSNode(nodeId);
var c = Services.EntityService.Get(nodeId);
path.Value = c.Path;
pane_chooseNode.Visible = false;
panel_buttons.Visible = false;
pane_chooseName.Visible = true;
var createDef = new XmlDocument();
var defReader = new XmlTextReader(Server.MapPath(IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/config/create/UI.xml"));
createDef.Load(defReader);
defReader.Close();
// Find definition for current nodeType
XmlNode def = createDef.SelectSingleNode("//nodeType [@alias = '" + App + "']");
phCreate.Controls.Add(new UserControl().LoadControl(IOHelper.ResolveUrl(SystemDirectories.Umbraco) + def.SelectSingleNode("./usercontrol").FirstChild.Value));
}
else
{
PageNameHolder.type = Umbraco.Web._Legacy.Controls.Feedback.feedbacktype.error;
PageNameHolder.Text = Services.TextService.Localize("rights") + " " + Services.TextService.Localize("error");
JTree.DataBind();
}
}
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference(IOHelper.ResolveUrl(SystemDirectories.WebServices) + "/legacyAjaxCalls.asmx"));
}
private bool CheckCreatePermissions(int nodeId)
{
var c = Services.EntityService.Get(nodeId);
var permission = Services.UserService.GetPermissions(Security.CurrentUser, c.Path);
return permission.AssignedPermissions.Contains(ActionNew.Instance.Letter.ToString(CultureInfo.InvariantCulture), StringComparer.Ordinal);
}
/// <summary>
/// path control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlInputHidden path;
/// <summary>
/// pane_chooseNode control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Umbraco.Web._Legacy.Controls.Pane pane_chooseNode;
/// <summary>
/// JTree control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.controls.Tree.TreeControl JTree;
/// <summary>
/// panel_buttons control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel panel_buttons;
/// <summary>
/// PageNameHolder control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Umbraco.Web._Legacy.Controls.Feedback PageNameHolder;
/// <summary>
/// pane_chooseName control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Umbraco.Web._Legacy.Controls.Pane pane_chooseName;
/// <summary>
/// phCreate control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder phCreate;
}
}

View File

@@ -1,9 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Umbraco - empty document</title>
</head>
<body>
</body>
</html>

View File

@@ -1,47 +0,0 @@
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using umbraco.cms.presentation.Trees;
namespace umbraco.dialogs
{
[Obsolete("Use the TreeControl instead. This does however get used by the TreeService when requesting the tree init url.")]
public partial class treePicker : Umbraco.Web.UI.Pages.UmbracoEnsuredPage
{
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
TreeParams = TreeRequestParams.FromQueryStrings().CreateTreeService();
DataBind();
if(Request.QueryString["selected"] != null && TreeParams.TreeType == "content")
{
var currContent = Services.ContentService.GetById(int.Parse(Request.QueryString["selected"]));
if (currContent != null)
{
if (currContent.ParentId > 0)
DialogTree.SelectedNodePath = currContent.Path;
}
}
}
protected TreeService TreeParams { get; private set; }
/// <summary>
/// DialogTree control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.controls.Tree.TreeControl DialogTree;
}
}