From a0e35895025b8a8cae9c73def932c553aa59e973 Mon Sep 17 00:00:00 2001 From: Shandem Date: Tue, 7 Jul 2009 14:27:03 +0000 Subject: [PATCH] DO NOT DOWNLOAD. DOWNLOAD LATEST STABLE FROM RELEASE TAB ClientDependency fixes and implementation. Tagged some files for removal. [TFS Changeset #56112] --- .../ClientDependencyAttribute.cs | 37 +-- .../ClientDependencyHelper.cs | 22 +- .../ClientDependencyList.cs | 46 ++++ .../IClientDependencyFile.cs | 2 +- .../Providers/ClientDependencyProvider.cs | 106 ++++----- ...braco.presentation.ClientDependency.csproj | 1 + .../presentation/umbraco.presentation.csproj | 16 +- .../umbraco/ClientDependencyTest.aspx.cs | 10 +- .../presentation/umbraco/Trees/loadContent.cs | 4 + .../presentation/umbraco/Trees/loadMedia.cs | 21 +- .../{edit.aspx => __TODELETE__edit.aspx} | 2 +- ...{edit.aspx.cs => __TODELETE__edit.aspx.cs} | 0 ...r.cs => __TODELETE__edit.aspx.designer.cs} | 0 ...t.aspx.resx => __TODELETE__edit.aspx.resx} | 0 .../umbraco/controls/ContentPicker.cs | 222 ++++++++++-------- .../umbraco/controls/TreeControl.ascx | 17 +- .../controls/TreeControl.ascx.designer.cs | 42 +++- ...boxTree.cs => __TODELETE__CheckboxTree.cs} | 0 .../umbraco/masterpages/umbracoPage.Master | 32 ++- .../umbraco/masterpages/umbracoPage.Master.cs | 15 +- .../umbracoPage.Master.designer.cs | 74 +++++- umbraco/presentation/umbraco/treeInit.aspx | 22 +- umbraco/presentation/umbraco/treeInit.aspx.cs | 7 +- .../umbraco/treeInit.aspx.designer.cs | 20 +- umbraco/presentation/umbraco/umbraco.aspx | 23 +- .../umbraco/umbraco.aspx.designer.cs | 2 +- 26 files changed, 489 insertions(+), 254 deletions(-) create mode 100644 umbraco/presentation.ClientDependency/ClientDependencyList.cs rename umbraco/presentation/umbraco/__TODELETE__ContentItem/{edit.aspx => __TODELETE__edit.aspx} (91%) rename umbraco/presentation/umbraco/__TODELETE__ContentItem/{edit.aspx.cs => __TODELETE__edit.aspx.cs} (100%) rename umbraco/presentation/umbraco/__TODELETE__ContentItem/{edit.aspx.designer.cs => __TODELETE__edit.aspx.designer.cs} (100%) rename umbraco/presentation/umbraco/__TODELETE__ContentItem/{edit.aspx.resx => __TODELETE__edit.aspx.resx} (100%) rename umbraco/presentation/umbraco/controls/{CheckboxTree.cs => __TODELETE__CheckboxTree.cs} (100%) diff --git a/umbraco/presentation.ClientDependency/ClientDependencyAttribute.cs b/umbraco/presentation.ClientDependency/ClientDependencyAttribute.cs index c085959750..419d90fb31 100644 --- a/umbraco/presentation.ClientDependency/ClientDependencyAttribute.cs +++ b/umbraco/presentation.ClientDependency/ClientDependencyAttribute.cs @@ -35,7 +35,7 @@ namespace umbraco.presentation.ClientDependency /// performance on the client side. /// Though both javascript and css files may have the same group name specified, they will be treated seperately. /// - public string CompositeGroupName { get; set; } + //public string CompositeGroupName { get; set; } /// /// Gets or sets the priority. @@ -69,6 +69,14 @@ namespace umbraco.presentation.ClientDependency /// The name of the method. public string InvokeJavascriptMethodOnLoad { get; set; } + public ClientDependencyAttribute(ClientDependencyType dependencyType, string fullFilePath) + : this(DefaultPriority, dependencyType, fullFilePath, string.Empty, string.Empty) + { } + + public ClientDependencyAttribute(ClientDependencyType dependencyType, string fileName, string pathNameAlias) + : this(DefaultPriority, dependencyType, fileName, pathNameAlias, string.Empty) + { } + /// /// Initializes a new instance of the class. /// @@ -101,25 +109,22 @@ namespace umbraco.presentation.ClientDependency /// The file path to the dependency. /// if set to true the current umbraco path will be prefixed to the filePath. /// The name of the Javascript method to invoke when the dependency is loaded. - public ClientDependencyAttribute(int priority, ClientDependencyType dependencyType, string fileName, string pathNameAlias, string invokeJavascriptMethodOnLoad) - : this(priority, dependencyType, fileName, pathNameAlias, invokeJavascriptMethodOnLoad, string.Empty) - { } + public ClientDependencyAttribute(int priority, ClientDependencyType dependencyType, string fileName, string pathNameAlias, string invokeJavascriptMethodOnLoad) + { + if (String.IsNullOrEmpty(fileName)) + throw new ArgumentNullException("fileName"); - public ClientDependencyAttribute(int priority, ClientDependencyType dependencyType, string fileName, string pathNameAlias, string invokeJavascriptMethodOnLoad, string compositeGroupName) - { - if (String.IsNullOrEmpty(fileName)) - throw new ArgumentNullException("fileName"); - - Priority = priority; + Priority = priority; - FilePath = fileName; - PathNameAlias = pathNameAlias; - CompositeGroupName = compositeGroupName; + FilePath = fileName; + PathNameAlias = pathNameAlias; + //CompositeGroupName = compositeGroupName; - DependencyType = dependencyType; - InvokeJavascriptMethodOnLoad = invokeJavascriptMethodOnLoad ?? string.Empty; - } + DependencyType = dependencyType; + InvokeJavascriptMethodOnLoad = invokeJavascriptMethodOnLoad ?? string.Empty; + } + } diff --git a/umbraco/presentation.ClientDependency/ClientDependencyHelper.cs b/umbraco/presentation.ClientDependency/ClientDependencyHelper.cs index 2193503aef..3c4f598560 100644 --- a/umbraco/presentation.ClientDependency/ClientDependencyHelper.cs +++ b/umbraco/presentation.ClientDependency/ClientDependencyHelper.cs @@ -127,18 +127,22 @@ namespace umbraco.presentation.ClientDependency service.ProcessDependencies(); } + /// + /// This class is used to find all dependencies for the current request, d + /// internal class ClientDependencyRegistrationService { public ClientDependencyRegistrationService(Control control, ClientDependencyPathCollection paths, ClientDependencyProvider provider) { m_RenderingControl = control; m_Paths = paths; + //find all dependencies m_Dependencies = FindDependencies(m_RenderingControl); m_Provider = provider; } private Control m_RenderingControl; - private List m_Dependencies = new List(); + private ClientDependencyList m_Dependencies = new ClientDependencyList(); private ClientDependencyPathCollection m_Paths; private ClientDependencyProvider m_Provider; @@ -147,11 +151,11 @@ namespace umbraco.presentation.ClientDependency /// /// /// - private List FindDependencies(Control control) + private ClientDependencyList FindDependencies(Control control) { // find dependencies Type controlType = control.GetType(); - List dependencies = new List(); + ClientDependencyList dependencies = new ClientDependencyList(); foreach (Attribute attribute in Attribute.GetCustomAttributes(controlType)) { if (attribute is ClientDependencyAttribute) @@ -166,13 +170,13 @@ namespace umbraco.presentation.ClientDependency if (child.GetType().Equals(typeof(ClientDependencyInclude))) { ClientDependencyInclude include = (ClientDependencyInclude)child; - //dependencies.Add(new ClientDependencyAttribute(include.Priority, include.DependencyType, include.FilePath, include.PathName, include.InvokeJavascriptMethodOnLoad, include.CompositeGroupName)); - dependencies.Add(include); - } - else if (child.HasControls()) + dependencies.Add(include); + } + else { - dependencies.AddRange(FindDependencies(child)); - } + //recurse and de-duplicate! + dependencies.UnionWith(FindDependencies(child)); + } } return dependencies; diff --git a/umbraco/presentation.ClientDependency/ClientDependencyList.cs b/umbraco/presentation.ClientDependency/ClientDependencyList.cs new file mode 100644 index 0000000000..0eb12643dd --- /dev/null +++ b/umbraco/presentation.ClientDependency/ClientDependencyList.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace umbraco.presentation.ClientDependency +{ + + /// + /// Wraps a HashSet object for the client dependency file type and declares a equality operator + /// + public class ClientDependencyList : HashSet + { + + public ClientDependencyList() : base(new ClientDependencyComparer()) { } + + internal class ClientDependencyComparer : IEqualityComparer + { + #region IEqualityComparer Members + + /// + /// If the lowercased combination of the file path, dependency type and path name aliases are the same, + /// then they are the same dependency. + /// + /// + /// + /// + public bool Equals(IClientDependencyFile x, IClientDependencyFile y) + { + return (x.FilePath.ToLower().Trim() + x.DependencyType.ToString().ToLower() + x.PathNameAlias.ToLower().Trim() == + y.FilePath.ToLower().Trim() + y.DependencyType.ToString().ToLower() + y.PathNameAlias.ToLower().Trim()); + } + + public int GetHashCode(IClientDependencyFile obj) + { + return (obj.FilePath.ToLower().Trim() + obj.DependencyType.ToString().ToLower() + obj.PathNameAlias.ToLower().Trim()) + .GetHashCode(); + } + + #endregion + } + + } + + +} diff --git a/umbraco/presentation.ClientDependency/IClientDependencyFile.cs b/umbraco/presentation.ClientDependency/IClientDependencyFile.cs index 7cb04ab08e..6cf6751768 100644 --- a/umbraco/presentation.ClientDependency/IClientDependencyFile.cs +++ b/umbraco/presentation.ClientDependency/IClientDependencyFile.cs @@ -10,7 +10,7 @@ namespace umbraco.presentation.ClientDependency ClientDependencyType DependencyType { get; set; } string InvokeJavascriptMethodOnLoad { get; set; } int Priority { get; set; } - string CompositeGroupName { get; set; } + //string CompositeGroupName { get; set; } string PathNameAlias { get; set; } } } diff --git a/umbraco/presentation.ClientDependency/Providers/ClientDependencyProvider.cs b/umbraco/presentation.ClientDependency/Providers/ClientDependencyProvider.cs index 812ca577c4..3c73de75d0 100644 --- a/umbraco/presentation.ClientDependency/Providers/ClientDependencyProvider.cs +++ b/umbraco/presentation.ClientDependency/Providers/ClientDependencyProvider.cs @@ -34,10 +34,10 @@ namespace umbraco.presentation.ClientDependency.Providers base.Initialize(name, config); } - public void RegisterDependencies(Control dependantControl, List dependencies, ClientDependencyPathCollection paths) + public void RegisterDependencies(Control dependantControl, ClientDependencyList dependencies, ClientDependencyPathCollection paths) { DependantControl = dependantControl; - AllDependencies = dependencies; + AllDependencies = new List(dependencies); FolderPaths = paths; UpdateFilePaths(); @@ -46,18 +46,18 @@ namespace umbraco.presentation.ClientDependency.Providers List jsDependencies = AllDependencies.FindAll( delegate(IClientDependencyFile a) { - if (!IsDebugMode) - return a.DependencyType == ClientDependencyType.Javascript && string.IsNullOrEmpty(a.CompositeGroupName); - else + //if (!IsDebugMode) + // return a.DependencyType == ClientDependencyType.Javascript && string.IsNullOrEmpty(a.CompositeGroupName); + //else return a.DependencyType == ClientDependencyType.Javascript; } ); List cssDependencies = AllDependencies.FindAll( delegate(IClientDependencyFile a) { - if (!IsDebugMode) - return a.DependencyType == ClientDependencyType.Css && string.IsNullOrEmpty(a.CompositeGroupName); - else + //if (!IsDebugMode) + // return a.DependencyType == ClientDependencyType.Css && string.IsNullOrEmpty(a.CompositeGroupName); + //else return a.DependencyType == ClientDependencyType.Css; } ); @@ -66,36 +66,36 @@ namespace umbraco.presentation.ClientDependency.Providers jsDependencies.Sort((a, b) => a.Priority.CompareTo(b.Priority)); cssDependencies.Sort((a, b) => a.Priority.CompareTo(b.Priority)); - if (!IsDebugMode) RegisterCssFiles(ProcessCompositeGroups(ClientDependencyType.Css)); + //if (!IsDebugMode) RegisterCssFiles(ProcessCompositeGroups(ClientDependencyType.Css)); RegisterCssFiles(cssDependencies.ConvertAll(a => { return (IClientDependencyFile)a; })); - if (!IsDebugMode) RegisterJsFiles(ProcessCompositeGroups(ClientDependencyType.Javascript)); + //if (!IsDebugMode) RegisterJsFiles(ProcessCompositeGroups(ClientDependencyType.Javascript)); RegisterJsFiles(jsDependencies.ConvertAll(a => { return (IClientDependencyFile)a; })); } - private List ProcessCompositeGroups(ClientDependencyType type) - { - List dependencies = AllDependencies.FindAll( - delegate(IClientDependencyFile a) - { - return a.DependencyType == type && !string.IsNullOrEmpty(a.CompositeGroupName); - } - ); + //private List ProcessCompositeGroups(ClientDependencyType type) + //{ + // List dependencies = AllDependencies.FindAll( + // delegate(IClientDependencyFile a) + // { + // return a.DependencyType == type && !string.IsNullOrEmpty(a.CompositeGroupName); + // } + // ); - List groups = new List(); - List files = new List(); - foreach (IClientDependencyFile a in dependencies) - { - if (!groups.Contains(a.CompositeGroupName)) - { - string url = ProcessCompositeGroup(dependencies, a.CompositeGroupName, type); - groups.Add(a.CompositeGroupName); - files.Add(new SimpleDependencyFile(url, type)); - DependantControl.Page.Trace.Write("ClientDependency", "Composite group " + a.CompositeGroupName + " URL: " + url); - } - } - return files; - } + // List groups = new List(); + // List files = new List(); + // foreach (IClientDependencyFile a in dependencies) + // { + // if (!groups.Contains(a.CompositeGroupName)) + // { + // string url = ProcessCompositeGroup(dependencies, a.CompositeGroupName, type); + // groups.Add(a.CompositeGroupName); + // files.Add(new SimpleDependencyFile(url, type)); + // DependantControl.Page.Trace.Write("ClientDependency", "Composite group " + a.CompositeGroupName + " URL: " + url); + // } + // } + // return files; + //} /// /// Returns a full url with the encoded query strings for the handler which will process the composite group. @@ -103,26 +103,26 @@ namespace umbraco.presentation.ClientDependency.Providers /// /// /// - private string ProcessCompositeGroup(List dependencies, string groupName, ClientDependencyType type) - { - string handler = "{0}?s={1}&t={2}"; - StringBuilder files = new StringBuilder(); - List byGroup = dependencies.FindAll( - delegate(IClientDependencyFile a) - { - return a.CompositeGroupName == groupName; - } - ); - byGroup.Sort((a, b) => a.Priority.CompareTo(b.Priority)); - foreach (IClientDependencyFile a in byGroup) - { - files.Append(a.FilePath + ";"); - } - string url = string.Format(handler, CompositeDependencyHandler.HandlerFileName, HttpContext.Current.Server.UrlEncode(EncodeTo64(files.ToString())), type.ToString()); - if (url.Length > CompositeDependencyHandler.MaxHandlerUrlLength) - throw new ArgumentOutOfRangeException("The number of files in the composite group " + groupName + " creates a url handler address that exceeds the CompositeDependencyHandler MaxHandlerUrlLength. Reducing the amount of files in this composite group should fix the issue"); - return url; - } + //private string ProcessCompositeGroup(List dependencies, string groupName, ClientDependencyType type) + //{ + // string handler = "{0}?s={1}&t={2}"; + // StringBuilder files = new StringBuilder(); + // List byGroup = dependencies.FindAll( + // delegate(IClientDependencyFile a) + // { + // return a.CompositeGroupName == groupName; + // } + // ); + // byGroup.Sort((a, b) => a.Priority.CompareTo(b.Priority)); + // foreach (IClientDependencyFile a in byGroup) + // { + // files.Append(a.FilePath + ";"); + // } + // string url = string.Format(handler, CompositeDependencyHandler.HandlerFileName, HttpContext.Current.Server.UrlEncode(EncodeTo64(files.ToString())), type.ToString()); + // if (url.Length > CompositeDependencyHandler.MaxHandlerUrlLength) + // throw new ArgumentOutOfRangeException("The number of files in the composite group " + groupName + " creates a url handler address that exceeds the CompositeDependencyHandler MaxHandlerUrlLength. Reducing the amount of files in this composite group should fix the issue"); + // return url; + //} private string EncodeTo64(string toEncode) { @@ -176,7 +176,7 @@ namespace umbraco.presentation.ClientDependency.Providers public ClientDependencyType DependencyType { get; set; } public string InvokeJavascriptMethodOnLoad { get; set; } public int Priority { get; set; } - public string CompositeGroupName { get; set; } + //public string CompositeGroupName { get; set; } public string PathNameAlias { get; set; } } diff --git a/umbraco/presentation.ClientDependency/umbraco.presentation.ClientDependency.csproj b/umbraco/presentation.ClientDependency/umbraco.presentation.ClientDependency.csproj index f9c184543e..e819cc132f 100644 --- a/umbraco/presentation.ClientDependency/umbraco.presentation.ClientDependency.csproj +++ b/umbraco/presentation.ClientDependency/umbraco.presentation.ClientDependency.csproj @@ -49,6 +49,7 @@ + diff --git a/umbraco/presentation/umbraco.presentation.csproj b/umbraco/presentation/umbraco.presentation.csproj index 535017640d..b916aac50b 100644 --- a/umbraco/presentation/umbraco.presentation.csproj +++ b/umbraco/presentation/umbraco.presentation.csproj @@ -415,14 +415,14 @@ ClientDependencyTest.aspx - - edit.aspx + + __TODELETE__edit.aspx ASPXCodeBehind - - edit.aspx + + __TODELETE__edit.aspx - + Code @@ -2032,7 +2032,7 @@ - + UserControl @@ -3514,8 +3514,8 @@ cacheBrowser.aspx.cs Designer - - edit.aspx.cs + + __TODELETE__edit.aspx.cs Designer diff --git a/umbraco/presentation/umbraco/ClientDependencyTest.aspx.cs b/umbraco/presentation/umbraco/ClientDependencyTest.aspx.cs index ffb631c036..5ce73105ee 100644 --- a/umbraco/presentation/umbraco/ClientDependencyTest.aspx.cs +++ b/umbraco/presentation/umbraco/ClientDependencyTest.aspx.cs @@ -10,11 +10,11 @@ namespace umbraco.presentation.umbraco [ClientDependency(1, ClientDependencyType.Javascript, "Application/NamespaceManager.js", "UmbracoClient")] [ClientDependency(0, ClientDependencyType.Javascript, "ui/jquery.js", "UmbracoClient")] - [ClientDependency(0, ClientDependencyType.Css, "css/umbracoGui.css", "UmbracoRoot", CompositeGroupName = "CSSFiles")] - [ClientDependency(0, ClientDependencyType.Css, "css/treeIcons.css", "UmbracoRoot", CompositeGroupName = "CSSFiles")] - [ClientDependency(0, ClientDependencyType.Javascript, "ui/jqueryui.js", "UmbracoClient", CompositeGroupName = "JQueryUI")] - [ClientDependency(1, ClientDependencyType.Javascript, "ui/accordian.js", "UmbracoClient", CompositeGroupName = "JQueryUI")] - [ClientDependency(2, ClientDependencyType.Javascript, "ui/jQueryWresize.js", "UmbracoClient", CompositeGroupName = "JQueryUI")] + [ClientDependency(0, ClientDependencyType.Css, "css/umbracoGui.css", "UmbracoRoot" )] + [ClientDependency(0, ClientDependencyType.Css, "css/treeIcons.css", "UmbracoRoot")] + [ClientDependency(0, ClientDependencyType.Javascript, "ui/jqueryui.js", "UmbracoClient")] + [ClientDependency(1, ClientDependencyType.Javascript, "ui/accordian.js", "UmbracoClient")] + [ClientDependency(2, ClientDependencyType.Javascript, "ui/jQueryWresize.js", "UmbracoClient")] public partial class ClientDependencyTest : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) diff --git a/umbraco/presentation/umbraco/Trees/loadContent.cs b/umbraco/presentation/umbraco/Trees/loadContent.cs index 7064aaa7d1..e88a947401 100644 --- a/umbraco/presentation/umbraco/Trees/loadContent.cs +++ b/umbraco/presentation/umbraco/Trees/loadContent.cs @@ -131,6 +131,10 @@ namespace umbraco } + /// + /// If the user is an admin, always return entire tree structure, otherwise + /// return the user's start node id. + /// public override int StartNodeID { get diff --git a/umbraco/presentation/umbraco/Trees/loadMedia.cs b/umbraco/presentation/umbraco/Trees/loadMedia.cs index e1241c5f67..f2582ed570 100644 --- a/umbraco/presentation/umbraco/Trees/loadMedia.cs +++ b/umbraco/presentation/umbraco/Trees/loadMedia.cs @@ -51,6 +51,20 @@ namespace umbraco } + private User m_user; + + /// + /// Returns the current User. This ensures that we don't instantiate a new User object + /// each time. + /// + protected User CurrentUser + { + get + { + return (m_user == null ? (m_user = UmbracoEnsuredPage.CurrentUser) : m_user); + } + } + protected override void CreateRootNode(ref XmlTreeNode rootNode) { //TODO: SD: Find out what openMedia does!? @@ -81,12 +95,15 @@ namespace umbraco actions.Add(ActionRefresh.Instance); } + /// + /// If the user is an admin, always return entire tree structure, otherwise + /// return the user's start node id. + /// public override int StartNodeID { get { - UmbracoEnsuredPage page = new UmbracoEnsuredPage(); - return page.getUser().StartMediaId; + return CurrentUser.StartMediaId; } } diff --git a/umbraco/presentation/umbraco/__TODELETE__ContentItem/edit.aspx b/umbraco/presentation/umbraco/__TODELETE__ContentItem/__TODELETE__edit.aspx similarity index 91% rename from umbraco/presentation/umbraco/__TODELETE__ContentItem/edit.aspx rename to umbraco/presentation/umbraco/__TODELETE__ContentItem/__TODELETE__edit.aspx index aa9ad9432e..b0980a8ee8 100644 --- a/umbraco/presentation/umbraco/__TODELETE__ContentItem/edit.aspx +++ b/umbraco/presentation/umbraco/__TODELETE__ContentItem/__TODELETE__edit.aspx @@ -1,4 +1,4 @@ -<%@ Page language="c#" Codebehind="edit.aspx.cs" AutoEventWireup="True" Inherits="umbraco.cms.presentation.edit" %> +<%@ Page language="c#" Codebehind="__TODELETE__edit.aspx.cs" AutoEventWireup="True" Inherits="umbraco.cms.presentation.edit" %> "); + //"" + //""); + //" + //" + //""); - private string _treeAlias = "content"; - public string TreeAlias - { - get { return _treeAlias; } - set { _treeAlias = value; } - } + [ClientDependency(ClientDependencyType.Javascript, "js/xmlextras.js", "UmbracoRoot")] + [ClientDependency(ClientDependencyType.Javascript, "js/xmlRequest.js", "UmbracoRoot")] + [ClientDependency(ClientDependencyType.Javascript, "webservices/ajax.js", "UmbracoRoot")] + [ClientDependency(ClientDependencyType.Javascript, "js/submodal/common.js", "UmbracoRoot")] + [ClientDependency(ClientDependencyType.Javascript, "js/submodal/subModal.js", "UmbracoRoot")] + [ClientDependency(ClientDependencyType.Css, "js/submodal/subModal.css", "UmbracoRoot")] + public class ContentPicker : System.Web.UI.WebControls.WebControl + { - private bool _showDelete = true; - public bool ShowDelete - { - get { return _showDelete; } - set { _showDelete = value; } - } + public System.Web.UI.Control Editor { get { return this; } } - private int m_modalWidth = 300; - public int ModalWidth - { - get { return m_modalWidth; } - set { m_modalWidth = value; } - } + private string _text = ""; + public string Text + { + get + { + if (Page.IsPostBack && !String.IsNullOrEmpty(helper.Request(this.ClientID))) + { + _text = helper.Request(this.ClientID); + } + return _text; + } + set { _text = value; } + } - private int m_modalHeight = 400; - public int ModalHeight - { - get { return m_modalHeight; } - set { m_modalHeight = value; } - } + private string _appAlias = "content"; + public string AppAlias + { + get { return _appAlias; } + set { _appAlias = value; } + } - protected override void OnInit(EventArgs e) - { - base.OnInit(e); - base.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ajax", ""); - base.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ajax1", ""); - base.Page.ClientScript.RegisterClientScriptBlock(GetType(), "subModal", ""); + private string _treeAlias = "content"; + public string TreeAlias + { + get { return _treeAlias; } + set { _treeAlias = value; } + } - // We need to make sure we have a reference to the legacy ajax calls in the scriptmanager - presentation.webservices.ajaxHelpers.EnsureLegacyCalls(base.Page); - } + private bool _showDelete = true; + public bool ShowDelete + { + get { return _showDelete; } + set { _showDelete = value; } + } + + private int m_modalWidth = 300; + public int ModalWidth + { + get { return m_modalWidth; } + set { m_modalWidth = value; } + } + + private int m_modalHeight = 400; + public int ModalHeight + { + get { return m_modalHeight; } + set { m_modalHeight = value; } + } - protected override void Render(System.Web.UI.HtmlTextWriter writer) - { + protected override void OnInit(EventArgs e) + { + base.OnInit(e); + //base.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ajax", ""); + //base.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ajax1", ""); + //base.Page.ClientScript.RegisterClientScriptBlock(GetType(), "subModal", ""); - string tempTitle = ""; - string deleteLink = "   " + ui.Text("delete") + "   "; - try - { - if (this.Text != "" && this.Text != "-1") - { - tempTitle = new cms.businesslogic.CMSNode(int.Parse(this.Text)).Text; - } - else - { - tempTitle = (!string.IsNullOrEmpty(_treeAlias) ? ui.Text(_treeAlias) : ui.Text(_appAlias)); + // We need to make sure we have a reference to the legacy ajax calls in the scriptmanager + presentation.webservices.ajaxHelpers.EnsureLegacyCalls(base.Page); + } - } - } - catch { } - writer.WriteLine(""); + protected override void Render(System.Web.UI.HtmlTextWriter writer) + { - // Clear remove link if text if empty - if (this.Text == "" || !_showDelete) - deleteLink = ""; - writer.WriteLine("" + tempTitle + "" + deleteLink + " " + ui.Text("choose") + "...   "); - base.Render(writer); - } + string tempTitle = ""; + string deleteLink = "   " + ui.Text("delete") + "   "; + try + { + if (this.Text != "" && this.Text != "-1") + { + tempTitle = new cms.businesslogic.CMSNode(int.Parse(this.Text)).Text; + } + else + { + tempTitle = (!string.IsNullOrEmpty(_treeAlias) ? ui.Text(_treeAlias) : ui.Text(_appAlias)); - } + } + } + catch { } + + writer.WriteLine(""); + + // Clear remove link if text if empty + if (this.Text == "" || !_showDelete) + deleteLink = ""; + writer.WriteLine("" + tempTitle + "" + deleteLink + " " + ui.Text("choose") + "...   "); + base.Render(writer); + } + + } } diff --git a/umbraco/presentation/umbraco/controls/TreeControl.ascx b/umbraco/presentation/umbraco/controls/TreeControl.ascx index 0d5b514d67..0656df369c 100644 --- a/umbraco/presentation/umbraco/controls/TreeControl.ascx +++ b/umbraco/presentation/umbraco/controls/TreeControl.ascx @@ -1,15 +1,18 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TreeControl.ascx.cs" Inherits="umbraco.presentation.umbraco.controls.TreeControl" %> - <%@ Register TagPrefix="umb" Namespace="umbraco.presentation.ClientDependency" Assembly="umbraco.presentation.ClientDependency" %> - - - - - - + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + +
diff --git a/umbraco/presentation/umbraco/masterpages/umbracoPage.Master.cs b/umbraco/presentation/umbraco/masterpages/umbracoPage.Master.cs index 0160e2c4d7..18ca34034c 100644 --- a/umbraco/presentation/umbraco/masterpages/umbracoPage.Master.cs +++ b/umbraco/presentation/umbraco/masterpages/umbracoPage.Master.cs @@ -4,10 +4,13 @@ using System.Web; using System.Web.UI; using System.Web.UI.WebControls; -namespace umbraco.presentation.umbraco.masterpages { - public partial class umbracoPage : System.Web.UI.MasterPage { - protected void Page_Load(object sender, EventArgs e) { - - } - } +namespace umbraco.presentation.umbraco.masterpages +{ + public partial class umbracoPage : System.Web.UI.MasterPage + { + protected void Page_Load(object sender, EventArgs e) + { + ClientLoader.DataBind(); + } + } } diff --git a/umbraco/presentation/umbraco/masterpages/umbracoPage.Master.designer.cs b/umbraco/presentation/umbraco/masterpages/umbracoPage.Master.designer.cs index f2a7e22528..b47b3d371f 100644 --- a/umbraco/presentation/umbraco/masterpages/umbracoPage.Master.designer.cs +++ b/umbraco/presentation/umbraco/masterpages/umbracoPage.Master.designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.1433 +// Runtime Version:2.0.50727.3053 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -22,6 +22,78 @@ namespace umbraco.presentation.umbraco.masterpages { /// protected global::System.Web.UI.WebControls.ContentPlaceHolder head; + /// + /// ClientLoader control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::umbraco.presentation.ClientDependency.ClientDependencyLoader ClientLoader; + + /// + /// ClientDependencyInclude1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::umbraco.presentation.ClientDependency.ClientDependencyInclude ClientDependencyInclude1; + + /// + /// ClientDependencyInclude8 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::umbraco.presentation.ClientDependency.ClientDependencyInclude ClientDependencyInclude8; + + /// + /// ClientDependencyInclude6 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::umbraco.presentation.ClientDependency.ClientDependencyInclude ClientDependencyInclude6; + + /// + /// ClientDependencyInclude2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::umbraco.presentation.ClientDependency.ClientDependencyInclude ClientDependencyInclude2; + + /// + /// ClientDependencyInclude11 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::umbraco.presentation.ClientDependency.ClientDependencyInclude ClientDependencyInclude11; + + /// + /// ClientDependencyInclude12 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::umbraco.presentation.ClientDependency.ClientDependencyInclude ClientDependencyInclude12; + + /// + /// ClientDependencyInclude13 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::umbraco.presentation.ClientDependency.ClientDependencyInclude ClientDependencyInclude13; + /// /// form1 control. /// diff --git a/umbraco/presentation/umbraco/treeInit.aspx b/umbraco/presentation/umbraco/treeInit.aspx index 5771630970..d88cc3e7b5 100644 --- a/umbraco/presentation/umbraco/treeInit.aspx +++ b/umbraco/presentation/umbraco/treeInit.aspx @@ -1,13 +1,12 @@ <%@ Page Language="c#" CodeBehind="treeInit.aspx.cs" AutoEventWireup="True" Inherits="umbraco.cms.presentation.TreeInit" %> - <%@ Register Src="~/umbraco/controls/TreeControl.ascx" TagName="TreeControl" TagPrefix="umbraco" %> +<%@ Register TagPrefix="umb" Namespace="umbraco.presentation.ClientDependency" Assembly="umbraco.presentation.ClientDependency" %> + - -