diff --git a/LinqToUmbraco/src/umbraco.Linq/Core/Node/NodeDataProvider.cs b/LinqToUmbraco/src/umbraco.Linq/Core/Node/NodeDataProvider.cs index c730bb67aa..b384df1ac4 100644 --- a/LinqToUmbraco/src/umbraco.Linq/Core/Node/NodeDataProvider.cs +++ b/LinqToUmbraco/src/umbraco.Linq/Core/Node/NodeDataProvider.cs @@ -260,7 +260,7 @@ namespace umbraco.Linq.Core.Node foreach (var ancestor in elements) { - var alias = Casing.SafeAlias(ancestor.Name.LocalName); + var alias = Casing.SafeAliasWithForcingCheck(ancestor.Name.LocalName); var t = KnownTypes[alias]; var instaceOfT = (DocTypeBase)Activator.CreateInstance(t); //create an instance of the type and down-cast so we can use it this.LoadFromXml(ancestor, instaceOfT); @@ -286,7 +286,7 @@ namespace umbraco.Linq.Core.Node }); foreach (var type in types) - this._knownTypes.Add(Casing.SafeAlias(type.Key), type.Value); + this._knownTypes.Add(Casing.SafeAliasWithForcingCheck(type.Key), type.Value); } @@ -337,7 +337,7 @@ namespace umbraco.Linq.Core.Node { var attr = ReflectionAssistance.GetUmbracoInfoAttribute(p); - var data = xml.Element(Casing.SafeAlias(attr.Alias)).Value; + var data = xml.Element(Casing.SafeAliasWithForcingCheck(attr.Alias)).Value; if (p.PropertyType == typeof(int) && string.IsNullOrEmpty(data)) data = "-1"; diff --git a/components/editorControls/macrocontainer/Editor.cs b/components/editorControls/macrocontainer/Editor.cs index 53f05c823d..9204277a28 100644 --- a/components/editorControls/macrocontainer/Editor.cs +++ b/components/editorControls/macrocontainer/Editor.cs @@ -19,6 +19,7 @@ namespace umbraco.editorControls.macrocontainer { [ClientDependency(ClientDependencyType.Javascript, "ui/jqueryui.js", "UmbracoClient")] + [ClientDependency(ClientDependencyType.Css, "/macroContainer/macroContainer.css", "UmbracoClient")] public class Editor : UpdatePanel, IDataEditor { private IData _data; @@ -65,7 +66,8 @@ namespace umbraco.editorControls.macrocontainer _addMacro.Click += new EventHandler(_addMacro_Click); - _addMacro.Text = "Add"; + _addMacro.Text = ui.Text("insertMacro"); + _addMacro.CssClass = "macroContainerAdd"; this.ContentTemplateContainer.Controls.Add(_addMacro); @@ -77,7 +79,13 @@ namespace umbraco.editorControls.macrocontainer this.ContentTemplateContainer.Controls.Add(_limit); - this.ContentTemplateContainer.Controls.Add(new LiteralControl("
")); + string widthHeight = ""; + if (_preferedHeight > 0 && _preferedWidth > 0) + { + widthHeight = String.Format(" style=\"min-width: {0}px; min-height: {1}px;\"", _preferedWidth, _preferedHeight); + } + + this.ContentTemplateContainer.Controls.Add(new LiteralControl(String.Format("
", widthHeight))); Regex tagregex = new Regex("<[^>]*(>|$)", RegexOptions.Singleline | RegexOptions.ExplicitCapture | RegexOptions.Compiled); MatchCollection tags = tagregex.Matches(_data.Value.ToString()); diff --git a/components/editorControls/macrocontainer/MacroEditor.cs b/components/editorControls/macrocontainer/MacroEditor.cs index c24c028fdd..7c1b5970f0 100644 --- a/components/editorControls/macrocontainer/MacroEditor.cs +++ b/components/editorControls/macrocontainer/MacroEditor.cs @@ -11,7 +11,7 @@ using System.Web; namespace umbraco.editorControls.macrocontainer { - public class MacroEditor: System.Web.UI.Control + public class MacroEditor : System.Web.UI.Control { private List _allowedMacros; private DropDownList _macroSelectDropdown; @@ -19,6 +19,7 @@ namespace umbraco.editorControls.macrocontainer private Table _formTable; private Hashtable _dataValues; private string _data; + private LiteralControl propertiesHeader = new LiteralControl("

" + ui.Text("macroContainerSettings") + " Show/Hide

"); public MacroEditor(string Data, List allowedMacros) { @@ -28,29 +29,33 @@ namespace umbraco.editorControls.macrocontainer protected override void OnInit(EventArgs e) { - base.OnInit(e); + base.OnInit(e); - _macroSelectDropdown = new DropDownList(); - _macroSelectDropdown.ID = ID + "_ddselectmacro"; - _macroSelectDropdown.SelectedIndexChanged += new EventHandler(_macroSelectDropdown_SelectedIndexChanged); - _macroSelectDropdown.Items.Add(new ListItem(umbraco.ui.Text("choose"), "")); - foreach (string item in _allowedMacros) - { - _macroSelectDropdown.Items.Add(new ListItem(Macro.GetByAlias(item).Name, item)); - } - _macroSelectDropdown.AutoPostBack = true; + _macroSelectDropdown = new DropDownList(); + _macroSelectDropdown.ID = ID + "_ddselectmacro"; + _macroSelectDropdown.SelectedIndexChanged += new EventHandler(_macroSelectDropdown_SelectedIndexChanged); + _macroSelectDropdown.Items.Add(new ListItem(umbraco.ui.Text("choose"), "")); + foreach (string item in _allowedMacros) + { + _macroSelectDropdown.Items.Add(new ListItem(Macro.GetByAlias(item).Name, item)); + } + _macroSelectDropdown.AutoPostBack = true; - _delete = new LinkButton(); - _delete.ID = ID + "_btndelete"; - _delete.Text = "Delete"; - _delete.Attributes.Add("style", "color:red;"); - _delete.Click += new EventHandler(_delete_Click); - _formTable = new Table(); - _formTable.ID = ID + "_tblform"; + _delete = new LinkButton(); + _delete.CssClass = "macroDelete"; + _delete.ID = ID + "_btndelete"; + _delete.Text = ui.Text("removeMacro"); + _delete.Attributes.Add("style", "color:red;"); + _delete.Click += new EventHandler(_delete_Click); + _formTable = new Table(); + _formTable.ID = ID + "_tblform"; + _formTable.CssClass = "macroSettings"; - this.Controls.Add(_macroSelectDropdown); - this.Controls.Add(_delete); - this.Controls.Add(_formTable); + propertiesHeader.Visible = false; + this.Controls.Add(_delete); + this.Controls.Add(_macroSelectDropdown); + this.Controls.Add(propertiesHeader); + this.Controls.Add(_formTable); } void _delete_Click(object sender, EventArgs e) @@ -61,89 +66,90 @@ namespace umbraco.editorControls.macrocontainer MacroContainerEvent.Delete(); } - + protected override void OnLoad(EventArgs e) { - base.OnLoad(e); + base.OnLoad(e); - if (!GlobalSettings.RequestIsInUmbracoApplication(HttpContext.Current) && umbraco.presentation.UmbracoContext.Current.LiveEditingContext.Enabled) - { - if (ViewState[ID + "init"] == null) - { - if (DataValues["macroalias"] != null) - { - //Data is available from the database, initialize the form with the data - string alias = DataValues["macroalias"].ToString(); + if (!GlobalSettings.RequestIsInUmbracoApplication(HttpContext.Current) && umbraco.presentation.UmbracoContext.Current.LiveEditingContext.Enabled) + { + if (ViewState[ID + "init"] == null) + { + if (DataValues["macroalias"] != null) + { + //Data is available from the database, initialize the form with the data + string alias = DataValues["macroalias"].ToString(); - //Set Pulldown selected value based on the macro alias - _macroSelectDropdown.SelectedValue = alias; + //Set Pulldown selected value based on the macro alias + _macroSelectDropdown.SelectedValue = alias; - //Create from with values based on the alias - InitializeForm(alias); - } - else - { - this.Visible = false; - } + //Create from with values based on the alias + InitializeForm(alias); + } + else + { + this.Visible = false; + } - ViewState[ID + "init"] = "ok"; - } - else - { - //Render form if properties are in the viewstate - if (SelectedProperties.Count > 0) - { - RendeFormControls(); - } - } - } - else - { + ViewState[ID + "init"] = "ok"; + } + else + { + //Render form if properties are in the viewstate + if (SelectedProperties.Count > 0) + { + RendeFormControls(); + } + } + } + else + { - if (!Page.IsPostBack) - { + if (!Page.IsPostBack) + { - //Handle Initial Request - if (DataValues["macroalias"] != null) - { - //Data is available from the database, initialize the form with the data - string alias = DataValues["macroalias"].ToString(); + //Handle Initial Request + if (DataValues["macroalias"] != null) + { + //Data is available from the database, initialize the form with the data + string alias = DataValues["macroalias"].ToString(); - //Set Pulldown selected value based on the macro alias - _macroSelectDropdown.SelectedValue = alias; + //Set Pulldown selected value based on the macro alias + _macroSelectDropdown.SelectedValue = alias; - //Create from with values based on the alias - InitializeForm(alias); - } - else - { - this.Visible = false; - } + //Create from with values based on the alias + InitializeForm(alias); + } + else + { + this.Visible = false; + } - } - else - { - //Render form if properties are in the viewstate - if (SelectedProperties.Count > 0) - { - RendeFormControls(); - } - } - } - //Make sure child controls get rendered - EnsureChildControls(); + } + else + { + //Render form if properties are in the viewstate + if (SelectedProperties.Count > 0) + { + RendeFormControls(); + } + } + } + //Make sure child controls get rendered + EnsureChildControls(); } protected override void Render(HtmlTextWriter writer) - { - + { writer.Write("
"); + _delete.RenderControl(writer); + writer.Write("

Macro:

"); _macroSelectDropdown.RenderControl(writer); writer.Write(" ");//Delete"); - _delete.RenderControl(writer); + propertiesHeader.RenderControl(writer); _formTable.RenderControl(writer); writer.Write("
"); } @@ -174,6 +180,10 @@ namespace umbraco.editorControls.macrocontainer ///Only render form when macro is found if (formMacro != null) { + if (formMacro.Properties.Length > 0) + { + propertiesHeader.Visible = true; + } foreach (MacroProperty macroProperty in formMacro.Properties) { //Only add properties that people may see. @@ -216,7 +226,7 @@ namespace umbraco.editorControls.macrocontainer caption.Text = prop.Name; //Get the MacroControl - Control macroControl = MacroControlFactory.GetMacroRenderControlByType(prop,ID + "_" + prop.Alias); + Control macroControl = MacroControlFactory.GetMacroRenderControlByType(prop, ID + "_" + prop.Alias); AddFormRow(caption, macroControl); @@ -286,7 +296,7 @@ namespace umbraco.editorControls.macrocontainer private string SelectedMacroAlias { - + get { return string.Format("{0}", ViewState[ID + "SelectedMacroAlias"]); } set { ViewState[ID + "SelectedMacroAlias"] = value; } } diff --git a/umbraco/cms/businesslogic/Content.cs b/umbraco/cms/businesslogic/Content.cs index efdf52563a..a94b6e45dc 100644 --- a/umbraco/cms/businesslogic/Content.cs +++ b/umbraco/cms/businesslogic/Content.cs @@ -533,7 +533,7 @@ namespace umbraco.cms.businesslogic protected virtual XmlNode generateXmlWithoutSaving(XmlDocument xd) { - string nodeName = UmbracoSettings.UseLegacyXmlSchema ? "node" : Casing.SafeAlias(ContentType.Alias); + string nodeName = UmbracoSettings.UseLegacyXmlSchema ? "node" : Casing.SafeAliasWithForcingCheck(ContentType.Alias); XmlNode x = xd.CreateNode(XmlNodeType.Element, nodeName, ""); XmlPopulate(xd, ref x, false); return x; diff --git a/umbraco/cms/businesslogic/propertytype/propertytype.cs b/umbraco/cms/businesslogic/propertytype/propertytype.cs index 5ae5608f49..76e3b8ca0e 100644 --- a/umbraco/cms/businesslogic/propertytype/propertytype.cs +++ b/umbraco/cms/businesslogic/propertytype/propertytype.cs @@ -262,7 +262,7 @@ namespace umbraco.cms.businesslogic.propertytype SqlHelper.ExecuteNonQuery("INSERT INTO cmsPropertyType (DataTypeId, ContentTypeId, alias, name) VALUES (@DataTypeId, @ContentTypeId, @alias, @name)", SqlHelper.CreateParameter("@DataTypeId", dt.Id), SqlHelper.CreateParameter("@ContentTypeId", ct.Id), - SqlHelper.CreateParameter("@alias", helpers.Casing.SafeAliasWithForcingCheck(alias)), + SqlHelper.CreateParameter("@alias", alias), SqlHelper.CreateParameter("@name", name)); pt = new PropertyType(SqlHelper.ExecuteScalar("SELECT MAX(id) FROM cmsPropertyType WHERE alias=@alias", SqlHelper.CreateParameter("@alias", alias))); diff --git a/umbraco/cms/helpers/Casing.cs b/umbraco/cms/helpers/Casing.cs index e92a524131..781b9ba2de 100644 --- a/umbraco/cms/helpers/Casing.cs +++ b/umbraco/cms/helpers/Casing.cs @@ -34,8 +34,9 @@ namespace umbraco.cms.helpers else { // first char should always be lowercase (camel style) - if (safeString.Length == 0) - currentChar = currentChar.ToLower(); + // Skipping this check as it can cause incompatibility issues with 3rd party packages +// if (safeString.Length == 0) +// currentChar = currentChar.ToLower(); if (i < aliasLength - 1 && i > 0 && alias.Substring(i - 1, 1) == " ") currentChar = currentChar.ToUpper(); diff --git a/umbraco/presentation/install/images/background.png b/umbraco/presentation/install/images/background.png index 208d9c259a..72767abb65 100644 Binary files a/umbraco/presentation/install/images/background.png and b/umbraco/presentation/install/images/background.png differ diff --git a/umbraco/presentation/install/images/logo.png b/umbraco/presentation/install/images/logo.png index b0637ce4de..156cdf0bc2 100644 Binary files a/umbraco/presentation/install/images/logo.png and b/umbraco/presentation/install/images/logo.png differ diff --git a/umbraco/presentation/install/steps/detect.ascx b/umbraco/presentation/install/steps/detect.ascx index 33c4415ab9..6f4a9badc1 100644 --- a/umbraco/presentation/install/steps/detect.ascx +++ b/umbraco/presentation/install/steps/detect.ascx @@ -26,7 +26,7 @@ AutoPostBack="True" onselectedindexchanged="DatabaseType_SelectedIndexChanged"> - + diff --git a/umbraco/presentation/library.cs b/umbraco/presentation/library.cs index 834d914731..33f5664d31 100644 --- a/umbraco/presentation/library.cs +++ b/umbraco/presentation/library.cs @@ -2279,6 +2279,12 @@ namespace umbraco } content.AfterUpdateDocumentCache += new content.DocumentCacheEventHandler(content_AfterUpdateDocumentCache); + content.AfterRefreshContent += new content.RefreshContentEventHandler(content_AfterRefreshContent); + } + + void content_AfterRefreshContent(Document sender, RefreshContentEventArgs e) + { + library.ClearNiceUrlCache(); } void content_AfterUpdateDocumentCache(Document sender, DocumentCacheEventArgs e) diff --git a/umbraco/presentation/umbraco/config/lang/en.xml b/umbraco/presentation/umbraco/config/lang/en.xml index ea5d485b30..50c2ccf05a 100644 --- a/umbraco/presentation/umbraco/config/lang/en.xml +++ b/umbraco/presentation/umbraco/config/lang/en.xml @@ -46,7 +46,9 @@ When items are deleted from the recycle bin, they will be gone forever The items in the recycle bin is now being deleted. Please do not close this window while this operation takes place Close this window - + Remove Macro + Click to add a Macro + Macro Settings Set a placeholder id by setting an ID on your placeholder you can inject content into this template from child templates, by refering this ID using a <asp:content /> element.]]> diff --git a/umbraco/presentation/umbraco_client/MacroContainer/macroContainer.css b/umbraco/presentation/umbraco_client/MacroContainer/macroContainer.css new file mode 100644 index 0000000000..d789de27fc --- /dev/null +++ b/umbraco/presentation/umbraco_client/MacroContainer/macroContainer.css @@ -0,0 +1,46 @@ +.macroeditor +{ + border: 2px dotted #33cc66; + padding: 8px 5px 10px 25px; + margin: 5px 0; +} +.macroeditor:hover +{ + border: 2px solid #33cc66; + cursor: move; +} + +.macroeditor td +{ + padding: 10px 0; +} + +.macroeditor h4 +{ + font-size: 14px; + font-weight: bold; +} + + +.macroeditor .macroDelete +{ + float: right; + border: 1px solid #f00; + background-color: #fcc; + padding: 3px; + text-decoration: none; +} + +.macroContainerAdd +{ + font-size: 14px; + font-weight: bold; + text-decoration: none; +} + +.macrocontainer +{ + margin: 5px 0; + border: 1px solid #ccc; + padding: 10px; +} \ No newline at end of file