From 49b5303efabba0010320cd76b91c81d7f62b370e Mon Sep 17 00:00:00 2001 From: slace Date: Thu, 12 Nov 2009 11:09:01 +0000 Subject: [PATCH] DO NOT DOWNLOAD. DOWNLOAD LATEST STABLE FROM RELEAST TAB fixing bug 25082 and the locallink bug [TFS Changeset #61298] --- .../Core/Node/NodeDataProvider.cs | 24 +++++++++++++++---- .../umbraco/Trees/BaseContentTree.cs | 5 ++-- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/LinqToUmbraco/src/umbraco.Linq/Core/Node/NodeDataProvider.cs b/LinqToUmbraco/src/umbraco.Linq/Core/Node/NodeDataProvider.cs index 528ea4abf8..69f7db0914 100644 --- a/LinqToUmbraco/src/umbraco.Linq/Core/Node/NodeDataProvider.cs +++ b/LinqToUmbraco/src/umbraco.Linq/Core/Node/NodeDataProvider.cs @@ -7,6 +7,7 @@ using System.IO; using System.Xml.Linq; using System.Xml.Schema; using System.Xml; +using System.Reflection; namespace umbraco.Linq.Core.Node { @@ -321,10 +322,25 @@ namespace umbraco.Linq.Core.Node { if (this._knownTypes == null) { - this._knownTypes = (from a in AppDomain.CurrentDomain.GetAssemblies() - from t in a.GetTypes() - where t.GetCustomAttributes(typeof(DocTypeAttribute), true).Length == 1 - select t).ToDictionary(k => ((UmbracoInfoAttribute)k.GetCustomAttributes(typeof(UmbracoInfoAttribute), true)[0]).Alias); + this._knownTypes = new Dictionary(); + foreach (var a in AppDomain.CurrentDomain.GetAssemblies()) + { + try + { + foreach (var p in (from t in a.GetTypes() + where t.GetCustomAttributes(typeof(DocTypeAttribute), true).Length == 1 + select t).ToDictionary(k => ((UmbracoInfoAttribute)k.GetCustomAttributes(typeof(UmbracoInfoAttribute), true)[0]).Alias)) + { + this._knownTypes.Add(p.Key, p.Value); + } + } + catch (ReflectionTypeLoadException) + { + //just ignore, this gets thrown if a reference doesn't exist on the server + //for example, the code generation assemblies, they need VS + //but if you're installing VS on a server you'd just doing it wrong... + } + } } return this._knownTypes; diff --git a/umbraco/presentation/umbraco/Trees/BaseContentTree.cs b/umbraco/presentation/umbraco/Trees/BaseContentTree.cs index 9e77753fb1..c35dd35d6d 100644 --- a/umbraco/presentation/umbraco/Trees/BaseContentTree.cs +++ b/umbraco/presentation/umbraco/Trees/BaseContentTree.cs @@ -213,13 +213,14 @@ function openContent(id) { } protected void SetActionAttribute(ref XmlTreeNode treeElement, Document dd) { + //TODO: Work out why the DialogMode isn't working // Check for dialog behaviour - if (this.DialogMode == TreeDialogModes.fulllink) + if (this.DialogMode == TreeDialogModes.fulllink && !this.IsDialog) { string nodeLink = CreateNodeLink(dd); treeElement.Action = String.Format("javascript:openContent('{0}');", nodeLink); } - else if (this.DialogMode == TreeDialogModes.locallink) + else if (this.IsDialog) //(this.DialogMode == TreeDialogModes.locallink) { string nodeLink = string.Format("{{localLink:{0}}}", dd.Id); // try to make a niceurl too