From 8f2f81b558f84a654ca68da9456039570efc7171 Mon Sep 17 00:00:00 2001 From: boxbinary Date: Fri, 7 Jan 2011 01:23:09 +0000 Subject: [PATCH] Code env fix: Removes source control bindings from csproj files. Code env fix: Modified .hgignore to ignore .vs10x files and anything in App_Data\TEMP Fix: upon saving a document type, if the alias has changed, document Xml is regenerated in the db and the Xml caches are told to update. Fix: upon saving a document type, if the name has changed, the tree updates with that change Work Items: 29197, 28738 --- .hgignore | 4 +- .../Core/Node/NodeDataProvider.cs | 30 ++++++++++++-- .../Core/umbraco.Linq.Core.csproj | 14 ++++--- components/SQLCE4Umbraco/SqlCE4Umbraco.csproj | 12 ++++-- .../umbraco.editorControls.csproj | 12 ++++-- .../umbraco.macroRenderings.csproj | 12 ++++-- .../umbraco.controls/umbraco.controls.csproj | 12 ++++-- .../umbraco.webservices.csproj | 12 ++++-- .../umbraco.MacroEngines.csproj | 12 ++++-- .../umbraco.MacroEngines.Legacy.csproj | 12 ++++-- umbraco.Test/umbraco.Test.csproj | 12 ++++-- .../umbraco.businesslogic.csproj | 12 ++++-- umbraco/cms/umbraco.cms.csproj | 12 ++++-- umbraco/datalayer/umbraco.datalayer.csproj | 12 ++++-- umbraco/interfaces/umbraco.interfaces.csproj | 12 ++++-- umbraco/presentation/macro.cs | 24 +++++++++-- .../presentation/umbraco.presentation.csproj | 13 ++++-- .../presentation/umbraco/config/lang/en.xml | 2 +- .../controls/ContentTypeControlNew.ascx.cs | 40 +++++++++++++++++++ umbraco/presentation/web.config | 4 +- .../presentation/web.config.INDIGO64SSD.xslt | 24 +++++++++++ umbraco/providers/umbraco.providers.csproj | 12 ++++-- umbraco/umbraco.Legacy/umbraco.Legacy.csproj | 12 ++++-- 23 files changed, 248 insertions(+), 75 deletions(-) create mode 100644 umbraco/presentation/web.config.INDIGO64SSD.xslt diff --git a/.hgignore b/.hgignore index ada62c6083..9a2e686628 100644 --- a/.hgignore +++ b/.hgignore @@ -19,4 +19,6 @@ _ReSharper*/ *.suo [sS]ource [sS]andbox -umbraco.config \ No newline at end of file +umbraco.config +*.vs10x +App_Data\TEMP\* \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/Core/Node/NodeDataProvider.cs b/LinqToUmbraco/src/umbraco.Linq/Core/Node/NodeDataProvider.cs index 5ab8b4edd2..c372c56f95 100644 --- a/LinqToUmbraco/src/umbraco.Linq/Core/Node/NodeDataProvider.cs +++ b/LinqToUmbraco/src/umbraco.Linq/Core/Node/NodeDataProvider.cs @@ -352,18 +352,42 @@ namespace umbraco.Linq.Core.Node if (string.IsNullOrEmpty(data)) { //non-mandatory structs which have no value will be null - p.SetValue(node, null, null); + try + { + p.SetValue(node, null, null); + } + catch (FormatException ex) + { + throw new FormatException( + string.Format("Unable to cast '{0}' to the appropriate type ({1}) for node `{2}`. The alias of the property being parsed is {3}. Refer to inner exception for more details", data, p.PropertyType.FullName, node.Id, attr.Alias), ex); + } } else { //non-mandatory structs which do have a value have to be cast based on the type of their Nullable, found from the first (well, only) GenericArgument - p.SetValue(node, Convert.ChangeType(data, p.PropertyType.GetGenericArguments()[0]), null); + try + { + p.SetValue(node, Convert.ChangeType(data, p.PropertyType.GetGenericArguments()[0]), null); + } + catch (FormatException ex) + { + throw new FormatException( + string.Format("Unable to cast '{0}' to the appropriate type ({1}) for node `{2}`. The alias of the property being parsed is {3}. Refer to inner exception for more details", data, p.PropertyType.FullName, node.Id, attr.Alias), ex); + } } } else { // TODO: Address how Convert.ChangeType works in globalisation - p.SetValue(node, Convert.ChangeType(data, p.PropertyType), null); + try + { + p.SetValue(node, Convert.ChangeType(data, p.PropertyType), null); + } + catch (FormatException ex) + { + throw new FormatException( + string.Format("Unable to cast '{0}' to the appropriate type ({1}) for node `{2}`. The alias of the property being parsed is {3}. Refer to inner exception for more details", data, p.PropertyType.FullName, node.Id, attr.Alias), ex); + } } } } diff --git a/LinqToUmbraco/src/umbraco.Linq/Core/umbraco.Linq.Core.csproj b/LinqToUmbraco/src/umbraco.Linq/Core/umbraco.Linq.Core.csproj index 96e045563b..23653137dd 100644 --- a/LinqToUmbraco/src/umbraco.Linq/Core/umbraco.Linq.Core.csproj +++ b/LinqToUmbraco/src/umbraco.Linq/Core/umbraco.Linq.Core.csproj @@ -12,10 +12,14 @@ umbraco.Linq.Core v3.5 512 - SAK - SAK - SAK - SAK + + + + + + + + ..\..\..\..\..\umbraco\presentation\bin @@ -146,4 +150,4 @@ XCOPY "$(TargetPath)" "$(SolutionDir)\umbraco\presentation\bin" /Y - + \ No newline at end of file diff --git a/components/SQLCE4Umbraco/SqlCE4Umbraco.csproj b/components/SQLCE4Umbraco/SqlCE4Umbraco.csproj index 4204302e67..36d304b524 100644 --- a/components/SQLCE4Umbraco/SqlCE4Umbraco.csproj +++ b/components/SQLCE4Umbraco/SqlCE4Umbraco.csproj @@ -12,10 +12,14 @@ SQLCE4Umbraco v4.0 512 - SAK - SAK - SAK - SAK + + + + + + + + true diff --git a/components/editorControls/umbraco.editorControls.csproj b/components/editorControls/umbraco.editorControls.csproj index 4eaa7aa880..cca7713b4a 100644 --- a/components/editorControls/umbraco.editorControls.csproj +++ b/components/editorControls/umbraco.editorControls.csproj @@ -27,10 +27,14 @@ - SAK - SAK - SAK - SAK + + + + + + + + 3.5 true v3.5 diff --git a/components/macroRenderings/umbraco.macroRenderings.csproj b/components/macroRenderings/umbraco.macroRenderings.csproj index 8a2ac33a75..fd38bf3af1 100644 --- a/components/macroRenderings/umbraco.macroRenderings.csproj +++ b/components/macroRenderings/umbraco.macroRenderings.csproj @@ -27,10 +27,14 @@ - SAK - SAK - SAK - SAK + + + + + + + + 3.5 v3.5 publish\ diff --git a/components/umbraco.controls/umbraco.controls.csproj b/components/umbraco.controls/umbraco.controls.csproj index 22c2108413..6a0cb81460 100644 --- a/components/umbraco.controls/umbraco.controls.csproj +++ b/components/umbraco.controls/umbraco.controls.csproj @@ -10,10 +10,14 @@ Properties umbraco.uicontrols controls - SAK - SAK - SAK - SAK + + + + + + + + 3.5 diff --git a/components/umbraco.webservices/umbraco.webservices.csproj b/components/umbraco.webservices/umbraco.webservices.csproj index 45ade52df6..08cfae2b51 100644 --- a/components/umbraco.webservices/umbraco.webservices.csproj +++ b/components/umbraco.webservices/umbraco.webservices.csproj @@ -12,10 +12,14 @@ umbraco.webservices v3.5 512 - SAK - SAK - SAK - SAK + + + + + + + + 3.5 diff --git a/umbraco.MacroEngines.Juno/umbraco.MacroEngines.csproj b/umbraco.MacroEngines.Juno/umbraco.MacroEngines.csproj index 97a46c3337..55c7024c08 100644 --- a/umbraco.MacroEngines.Juno/umbraco.MacroEngines.csproj +++ b/umbraco.MacroEngines.Juno/umbraco.MacroEngines.csproj @@ -12,10 +12,14 @@ umbraco.MacroEngines v4.0 512 - SAK - SAK - SAK - SAK + + + + + + + + true diff --git a/umbraco.MacroEngines/umbraco.MacroEngines.Legacy.csproj b/umbraco.MacroEngines/umbraco.MacroEngines.Legacy.csproj index 75b5b8d5a9..85ec274857 100644 --- a/umbraco.MacroEngines/umbraco.MacroEngines.Legacy.csproj +++ b/umbraco.MacroEngines/umbraco.MacroEngines.Legacy.csproj @@ -12,10 +12,14 @@ umbraco.MacroEngines.Legacy v4.0 512 - SAK - SAK - SAK - SAK + + + + + + + + diff --git a/umbraco.Test/umbraco.Test.csproj b/umbraco.Test/umbraco.Test.csproj index cf66150518..080b28e0ca 100644 --- a/umbraco.Test/umbraco.Test.csproj +++ b/umbraco.Test/umbraco.Test.csproj @@ -13,10 +13,14 @@ v4.0 512 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - SAK - SAK - SAK - SAK + + + + + + + + 3.5 diff --git a/umbraco/businesslogic/umbraco.businesslogic.csproj b/umbraco/businesslogic/umbraco.businesslogic.csproj index 1c600ce937..42a6e40bbc 100644 --- a/umbraco/businesslogic/umbraco.businesslogic.csproj +++ b/umbraco/businesslogic/umbraco.businesslogic.csproj @@ -27,10 +27,14 @@ - SAK - SAK - SAK - SAK + + + + + + + + 3.5 true v3.5 diff --git a/umbraco/cms/umbraco.cms.csproj b/umbraco/cms/umbraco.cms.csproj index 3b311c40f1..a333f50e7c 100644 --- a/umbraco/cms/umbraco.cms.csproj +++ b/umbraco/cms/umbraco.cms.csproj @@ -27,10 +27,14 @@ - SAK - SAK - SAK - SAK + + + + + + + + 3.5 v3.5 publish\ diff --git a/umbraco/datalayer/umbraco.datalayer.csproj b/umbraco/datalayer/umbraco.datalayer.csproj index ff45e08945..7a0e46c82d 100644 --- a/umbraco/datalayer/umbraco.datalayer.csproj +++ b/umbraco/datalayer/umbraco.datalayer.csproj @@ -10,10 +10,14 @@ Properties umbraco.DataLayer umbraco.DataLayer - SAK - SAK - SAK - SAK + + + + + + + + 3.5 diff --git a/umbraco/interfaces/umbraco.interfaces.csproj b/umbraco/interfaces/umbraco.interfaces.csproj index 5b7d914f2c..a31e3b5fcb 100644 --- a/umbraco/interfaces/umbraco.interfaces.csproj +++ b/umbraco/interfaces/umbraco.interfaces.csproj @@ -27,10 +27,14 @@ - SAK - SAK - SAK - SAK + + + + + + + + 3.5 v3.5 publish\ diff --git a/umbraco/presentation/macro.cs b/umbraco/presentation/macro.cs index c2e063e325..4b1fc37c29 100644 --- a/umbraco/presentation/macro.cs +++ b/umbraco/presentation/macro.cs @@ -1203,7 +1203,9 @@ namespace umbraco return new LiteralControl(string.Format("Unable to create control {0} from assembly {1}", controlName, asm.FullName)); - /// Properties + AddCurrentNodeToControl(control, type); + + // Properties foreach (string propertyAlias in properties.Keys) { PropertyInfo prop = type.GetProperty(propertyAlias); @@ -1268,9 +1270,9 @@ namespace umbraco /// Loads an usercontrol using reflection into the macro object /// /// Filename of the usercontrol - ie. ~wulff.ascx + /// The attributes. + /// The page elements. /// - /// - /// public Control loadUserControl(string fileName, Hashtable attributes, Hashtable pageElements) { Debug.Assert(!string.IsNullOrEmpty(fileName), "fileName cannot be empty"); @@ -1305,6 +1307,8 @@ namespace umbraco return oControl; } + AddCurrentNodeToControl(oControl, type); + foreach (string propertyAlias in properties.Keys) { PropertyInfo prop = type.GetProperty(propertyAlias); @@ -1384,6 +1388,20 @@ namespace umbraco } } + private static void AddCurrentNodeToControl(Control control, Type type) + { + var currentNodeProperty = type.GetProperty("CurrentNode"); + if (currentNodeProperty != null && currentNodeProperty.CanWrite && currentNodeProperty.PropertyType.IsAssignableFrom(typeof(Node))) + { + currentNodeProperty.SetValue(control, Node.GetCurrent(), null); + } + currentNodeProperty = type.GetProperty("currentNode"); + if (currentNodeProperty != null && currentNodeProperty.CanWrite && currentNodeProperty.PropertyType.IsAssignableFrom(typeof(Node))) + { + currentNodeProperty.SetValue(control, Node.GetCurrent(), null); + } + } + private void TraceInfo(string category, string message) { if (HttpContext.Current != null) diff --git a/umbraco/presentation/umbraco.presentation.csproj b/umbraco/presentation/umbraco.presentation.csproj index 87a6e2c489..27d6b757a8 100644 --- a/umbraco/presentation/umbraco.presentation.csproj +++ b/umbraco/presentation/umbraco.presentation.csproj @@ -27,10 +27,14 @@ - SAK - SAK - SAK - SAK + + + + + + + + 3.5 v3.5 @@ -1645,6 +1649,7 @@ + diff --git a/umbraco/presentation/umbraco/config/lang/en.xml b/umbraco/presentation/umbraco/config/lang/en.xml index 56483a0cf9..451f8aa4fd 100644 --- a/umbraco/presentation/umbraco/config/lang/en.xml +++ b/umbraco/presentation/umbraco/config/lang/en.xml @@ -414,7 +414,7 @@ File saved File saved without any errors - Contenttype saved + Document Type saved Tab created Tab deleted Tab with id: %0% deleted diff --git a/umbraco/presentation/umbraco/controls/ContentTypeControlNew.ascx.cs b/umbraco/presentation/umbraco/controls/ContentTypeControlNew.ascx.cs index 60480098e3..60cd25f82f 100644 --- a/umbraco/presentation/umbraco/controls/ContentTypeControlNew.ascx.cs +++ b/umbraco/presentation/umbraco/controls/ContentTypeControlNew.ascx.cs @@ -9,9 +9,11 @@ using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using ClientDependency.Core; using umbraco.cms.helpers; +using umbraco.cms.presentation.Trees; using umbraco.IO; using umbraco.presentation; using umbraco.cms.businesslogic; +using umbraco.BasePages; namespace umbraco.controls { @@ -101,6 +103,14 @@ namespace umbraco.controls protected void save_click(object sender, System.Web.UI.ImageClickEventArgs e) { + // 2011 01 06 - APN - Modified method to update Xml caches if a doctype alias changed, + // also added calls to update the tree if the name has changed + // --- + + // Keep a reference of the original doctype alias and name + var originalDocTypeAlias = cType.Alias; + var originalDocTypeName = cType.Text; + cType.Text = txtName.Text; cType.Alias = txtAlias.Text; cType.IconUrl = ddlIcons.SelectedValue; @@ -117,12 +127,42 @@ namespace umbraco.controls // reload content type (due to caching) cType = new ContentType(cType.Id); + + // Check if the doctype alias has changed as a result of either the user input or + // the alias checking performed upon saving + var docTypeAliasChanged = (string.Compare(originalDocTypeAlias, cType.Alias, true) != 0); + var docTypeNameChanged = (string.Compare(originalDocTypeName, cType.Text, true) != 0); + + // Only if the doctype alias changed, cause a regeneration of the xml cache file since + // the xml element names will need to be updated to reflect the new alias + if (docTypeAliasChanged) + RegenerateXmlCaches(); + bindDataGenericProperties(true); // we need to re-bind the alias as the SafeAlias method can have changed it txtAlias.Text = cType.Alias; RaiseBubbleEvent(new object(), ea); + + if (docTypeNameChanged) + UpdateTreeNode(); + } + + /// + /// Regenerates the XML caches. Used after a document type alias has been changed. + /// + private void RegenerateXmlCaches() + { + umbraco.cms.businesslogic.web.Document.RePublishAll(); + library.RefreshContent(); + } + + private void UpdateTreeNode() + { + var clientTools = new ClientTools(this.Page); + clientTools + .SyncTree(cType.Path, true); } #region "Info" Pane diff --git a/umbraco/presentation/web.config b/umbraco/presentation/web.config index 2cb97f3c21..ec10d6c1d8 100644 --- a/umbraco/presentation/web.config +++ b/umbraco/presentation/web.config @@ -33,8 +33,8 @@ - - + + diff --git a/umbraco/presentation/web.config.INDIGO64SSD.xslt b/umbraco/presentation/web.config.INDIGO64SSD.xslt new file mode 100644 index 0000000000..926bad5e7f --- /dev/null +++ b/umbraco/presentation/web.config.INDIGO64SSD.xslt @@ -0,0 +1,24 @@ + + + + + + + Data Source=.\SQLEXPRESS;Initial Catalog=Dev.Umbraco.4x;integrated security=false;user id=umbraco;pwd=umbraco + + + + + + + + + + + + + + + + + diff --git a/umbraco/providers/umbraco.providers.csproj b/umbraco/providers/umbraco.providers.csproj index 47ad5c3226..d2bbb15523 100644 --- a/umbraco/providers/umbraco.providers.csproj +++ b/umbraco/providers/umbraco.providers.csproj @@ -10,10 +10,14 @@ Properties umbraco.providers umbraco.providers - SAK - SAK - SAK - SAK + + + + + + + + 3.5 diff --git a/umbraco/umbraco.Legacy/umbraco.Legacy.csproj b/umbraco/umbraco.Legacy/umbraco.Legacy.csproj index 49d92c05d8..f334e8a0f0 100644 --- a/umbraco/umbraco.Legacy/umbraco.Legacy.csproj +++ b/umbraco/umbraco.Legacy/umbraco.Legacy.csproj @@ -12,10 +12,14 @@ umbraco.Legacy umbraco.Legacy v3.5 - SAK - SAK - SAK - SAK + + + + + + + + 3.5