From 3921f88e309824a467342c0cb0fdc0f431e6181f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 9 Feb 2016 00:47:22 +0100 Subject: [PATCH 01/10] implemented functionality for changing the key for dictionary items --- .../settings/EditDictionaryItem.aspx.cs | 39 ++++++++++++++++--- src/umbraco.cms/businesslogic/Dictionary.cs | 6 +++ 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs index deb77f4bad..ca07004f44 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs @@ -25,6 +25,7 @@ namespace umbraco.settings protected uicontrols.TabView tbv = new uicontrols.TabView(); private System.Collections.ArrayList languageFields = new System.Collections.ArrayList(); private cms.businesslogic.Dictionary.DictionaryItem currentItem; + protected TextBox keyNameBox; protected void Page_Load(object sender, System.EventArgs e) { @@ -33,16 +34,16 @@ namespace umbraco.settings // Put user code to initialize the page here Panel1.hasMenu = true; Panel1.Text = ui.Text("editdictionary") + ": " + currentItem.key; - - uicontrols.Pane p = new uicontrols.Pane(); - var save = Panel1.Menu.NewButton(); + var save = Panel1.Menu.NewButton(); save.Text = ui.Text("save"); save.Click += save_Click; save.ToolTip = ui.Text("save"); save.ID = "save"; save.ButtonType = uicontrols.MenuButtonType.Primary; + uicontrols.Pane p = new uicontrols.Pane(); + Literal txt = new Literal(); txt.Text = "

" + ui.Text("dictionaryItem", "description", currentItem.key, base.getUser()) + "


"; p.addProperty(txt); @@ -63,7 +64,23 @@ namespace umbraco.settings } - if (!IsPostBack) + keyNameBox = new TextBox + { + ID = "editname-" + currentItem.id, + CssClass = "umbEditorTextField", + Text = currentItem.key + }; + + var txtChangeKey = new Literal + { + Text = "

 

" + + "

Change the key of the dictionary item. Carefull :)

" + }; + + p.addProperty(txtChangeKey); + p.addProperty(keyNameBox); + + if (!IsPostBack) { var path = BuildPath(currentItem); ClientTools @@ -71,7 +88,6 @@ namespace umbraco.settings .SyncTree(path, false); } - Panel1.Controls.Add(p); } @@ -92,8 +108,21 @@ namespace umbraco.settings currentItem.setValue(int.Parse(t.ID),t.Text); } } + + var newKey = keyNameBox.Text; + if (string.IsNullOrWhiteSpace(newKey) == false && newKey != currentItem.key) + { + currentItem.setKey(newKey); + + Panel1.title.InnerHtml = ui.Text("editdictionary") + ": " + currentItem.key; + + var path = BuildPath(currentItem); + ClientTools.SyncTree(path, true); + } + ClientTools.ShowSpeechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "dictionaryItemSaved"), ""); } + #region Web Form Designer generated code override protected void OnInit(EventArgs e) { diff --git a/src/umbraco.cms/businesslogic/Dictionary.cs b/src/umbraco.cms/businesslogic/Dictionary.cs index 8e76122175..206965168e 100644 --- a/src/umbraco.cms/businesslogic/Dictionary.cs +++ b/src/umbraco.cms/businesslogic/Dictionary.cs @@ -169,6 +169,12 @@ namespace umbraco.cms.businesslogic } } + public void setKey(string value) + { + key = value; + Save(); + } + public string Value(int languageId) { if (languageId == 0) From eec651c9d3d466d9f68afdc6b0757a0515a6fdfd Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 9 Feb 2016 00:47:22 +0100 Subject: [PATCH 02/10] implemented functionality for changing the key for dictionary items --- .../settings/EditDictionaryItem.aspx.cs | 39 ++++++++++++++++--- src/umbraco.cms/businesslogic/Dictionary.cs | 6 +++ 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs index deb77f4bad..ca07004f44 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs @@ -25,6 +25,7 @@ namespace umbraco.settings protected uicontrols.TabView tbv = new uicontrols.TabView(); private System.Collections.ArrayList languageFields = new System.Collections.ArrayList(); private cms.businesslogic.Dictionary.DictionaryItem currentItem; + protected TextBox keyNameBox; protected void Page_Load(object sender, System.EventArgs e) { @@ -33,16 +34,16 @@ namespace umbraco.settings // Put user code to initialize the page here Panel1.hasMenu = true; Panel1.Text = ui.Text("editdictionary") + ": " + currentItem.key; - - uicontrols.Pane p = new uicontrols.Pane(); - var save = Panel1.Menu.NewButton(); + var save = Panel1.Menu.NewButton(); save.Text = ui.Text("save"); save.Click += save_Click; save.ToolTip = ui.Text("save"); save.ID = "save"; save.ButtonType = uicontrols.MenuButtonType.Primary; + uicontrols.Pane p = new uicontrols.Pane(); + Literal txt = new Literal(); txt.Text = "

" + ui.Text("dictionaryItem", "description", currentItem.key, base.getUser()) + "


"; p.addProperty(txt); @@ -63,7 +64,23 @@ namespace umbraco.settings } - if (!IsPostBack) + keyNameBox = new TextBox + { + ID = "editname-" + currentItem.id, + CssClass = "umbEditorTextField", + Text = currentItem.key + }; + + var txtChangeKey = new Literal + { + Text = "

 

" + + "

Change the key of the dictionary item. Carefull :)

" + }; + + p.addProperty(txtChangeKey); + p.addProperty(keyNameBox); + + if (!IsPostBack) { var path = BuildPath(currentItem); ClientTools @@ -71,7 +88,6 @@ namespace umbraco.settings .SyncTree(path, false); } - Panel1.Controls.Add(p); } @@ -92,8 +108,21 @@ namespace umbraco.settings currentItem.setValue(int.Parse(t.ID),t.Text); } } + + var newKey = keyNameBox.Text; + if (string.IsNullOrWhiteSpace(newKey) == false && newKey != currentItem.key) + { + currentItem.setKey(newKey); + + Panel1.title.InnerHtml = ui.Text("editdictionary") + ": " + currentItem.key; + + var path = BuildPath(currentItem); + ClientTools.SyncTree(path, true); + } + ClientTools.ShowSpeechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "dictionaryItemSaved"), ""); } + #region Web Form Designer generated code override protected void OnInit(EventArgs e) { diff --git a/src/umbraco.cms/businesslogic/Dictionary.cs b/src/umbraco.cms/businesslogic/Dictionary.cs index 8e76122175..206965168e 100644 --- a/src/umbraco.cms/businesslogic/Dictionary.cs +++ b/src/umbraco.cms/businesslogic/Dictionary.cs @@ -169,6 +169,12 @@ namespace umbraco.cms.businesslogic } } + public void setKey(string value) + { + key = value; + Save(); + } + public string Value(int languageId) { if (languageId == 0) From 9427979b1c5b4a7ce0525779afe0cba22c623b54 Mon Sep 17 00:00:00 2001 From: Mads Krohn Date: Tue, 16 Feb 2016 00:06:56 +0100 Subject: [PATCH 03/10] Check if the new key already exists. Added error message. Enhanced error handling logic. --- .../settings/EditDictionaryItem.aspx.cs | 46 +++++++++++++------ 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs index ca07004f44..b0dd94c869 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs @@ -8,6 +8,7 @@ using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; +using umbraco.cms.businesslogic; using umbraco.cms.presentation.Trees; using Umbraco.Core; using Umbraco.Core.IO; @@ -25,7 +26,8 @@ namespace umbraco.settings protected uicontrols.TabView tbv = new uicontrols.TabView(); private System.Collections.ArrayList languageFields = new System.Collections.ArrayList(); private cms.businesslogic.Dictionary.DictionaryItem currentItem; - protected TextBox keyNameBox; + protected TextBox boxChangeKey; + protected Label labelChangeKey; protected void Page_Load(object sender, System.EventArgs e) { @@ -64,21 +66,26 @@ namespace umbraco.settings } - keyNameBox = new TextBox + boxChangeKey = new TextBox { - ID = "editname-" + currentItem.id, + ID = "changeKey-" + currentItem.id, CssClass = "umbEditorTextField", Text = currentItem.key }; - var txtChangeKey = new Literal + labelChangeKey = new Label + { + ID = "changeKeyLabel", + CssClass = "text-error" + }; + + p.addProperty(new Literal { Text = "

 

" + "

Change the key of the dictionary item. Carefull :)

" - }; - - p.addProperty(txtChangeKey); - p.addProperty(keyNameBox); + }); + p.addProperty(boxChangeKey); + p.addProperty(labelChangeKey); if (!IsPostBack) { @@ -109,15 +116,28 @@ namespace umbraco.settings } } - var newKey = keyNameBox.Text; + labelChangeKey.Text = ""; + var newKey = boxChangeKey.Text; if (string.IsNullOrWhiteSpace(newKey) == false && newKey != currentItem.key) { - currentItem.setKey(newKey); + // key already exists, save but inform + if (Dictionary.DictionaryItem.hasKey(newKey) == true) + { + labelChangeKey.Text = "The key '" + newKey + "' already exists, sorry.."; + boxChangeKey.Text = currentItem.key; // reset the key + } + else + { + // set the new key + currentItem.setKey(newKey); - Panel1.title.InnerHtml = ui.Text("editdictionary") + ": " + currentItem.key; + // update the title with the new key + Panel1.title.InnerHtml = ui.Text("editdictionary") + ": " + newKey; - var path = BuildPath(currentItem); - ClientTools.SyncTree(path, true); + // sync the content tree + var path = BuildPath(currentItem); + ClientTools.SyncTree(path, true); + } } ClientTools.ShowSpeechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "dictionaryItemSaved"), ""); From 56492cd1b20360490ab4749f18bc31b8b7214b8a Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 9 Feb 2016 00:47:22 +0100 Subject: [PATCH 04/10] implemented functionality for changing the key for dictionary items --- .../settings/EditDictionaryItem.aspx.cs | 39 ++++++++++++++++--- src/umbraco.cms/businesslogic/Dictionary.cs | 6 +++ 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs index deb77f4bad..ca07004f44 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs @@ -25,6 +25,7 @@ namespace umbraco.settings protected uicontrols.TabView tbv = new uicontrols.TabView(); private System.Collections.ArrayList languageFields = new System.Collections.ArrayList(); private cms.businesslogic.Dictionary.DictionaryItem currentItem; + protected TextBox keyNameBox; protected void Page_Load(object sender, System.EventArgs e) { @@ -33,16 +34,16 @@ namespace umbraco.settings // Put user code to initialize the page here Panel1.hasMenu = true; Panel1.Text = ui.Text("editdictionary") + ": " + currentItem.key; - - uicontrols.Pane p = new uicontrols.Pane(); - var save = Panel1.Menu.NewButton(); + var save = Panel1.Menu.NewButton(); save.Text = ui.Text("save"); save.Click += save_Click; save.ToolTip = ui.Text("save"); save.ID = "save"; save.ButtonType = uicontrols.MenuButtonType.Primary; + uicontrols.Pane p = new uicontrols.Pane(); + Literal txt = new Literal(); txt.Text = "

" + ui.Text("dictionaryItem", "description", currentItem.key, base.getUser()) + "


"; p.addProperty(txt); @@ -63,7 +64,23 @@ namespace umbraco.settings } - if (!IsPostBack) + keyNameBox = new TextBox + { + ID = "editname-" + currentItem.id, + CssClass = "umbEditorTextField", + Text = currentItem.key + }; + + var txtChangeKey = new Literal + { + Text = "

 

" + + "

Change the key of the dictionary item. Carefull :)

" + }; + + p.addProperty(txtChangeKey); + p.addProperty(keyNameBox); + + if (!IsPostBack) { var path = BuildPath(currentItem); ClientTools @@ -71,7 +88,6 @@ namespace umbraco.settings .SyncTree(path, false); } - Panel1.Controls.Add(p); } @@ -92,8 +108,21 @@ namespace umbraco.settings currentItem.setValue(int.Parse(t.ID),t.Text); } } + + var newKey = keyNameBox.Text; + if (string.IsNullOrWhiteSpace(newKey) == false && newKey != currentItem.key) + { + currentItem.setKey(newKey); + + Panel1.title.InnerHtml = ui.Text("editdictionary") + ": " + currentItem.key; + + var path = BuildPath(currentItem); + ClientTools.SyncTree(path, true); + } + ClientTools.ShowSpeechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "dictionaryItemSaved"), ""); } + #region Web Form Designer generated code override protected void OnInit(EventArgs e) { diff --git a/src/umbraco.cms/businesslogic/Dictionary.cs b/src/umbraco.cms/businesslogic/Dictionary.cs index 8e76122175..206965168e 100644 --- a/src/umbraco.cms/businesslogic/Dictionary.cs +++ b/src/umbraco.cms/businesslogic/Dictionary.cs @@ -169,6 +169,12 @@ namespace umbraco.cms.businesslogic } } + public void setKey(string value) + { + key = value; + Save(); + } + public string Value(int languageId) { if (languageId == 0) From 330cd7a4092b1b81325bb550ec7372c16999a1c5 Mon Sep 17 00:00:00 2001 From: Mads Krohn Date: Tue, 16 Feb 2016 00:06:56 +0100 Subject: [PATCH 05/10] Check if the new key already exists. Added error message. Enhanced error handling logic. --- .../settings/EditDictionaryItem.aspx.cs | 46 +++++++++++++------ 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs index ca07004f44..b0dd94c869 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs @@ -8,6 +8,7 @@ using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; +using umbraco.cms.businesslogic; using umbraco.cms.presentation.Trees; using Umbraco.Core; using Umbraco.Core.IO; @@ -25,7 +26,8 @@ namespace umbraco.settings protected uicontrols.TabView tbv = new uicontrols.TabView(); private System.Collections.ArrayList languageFields = new System.Collections.ArrayList(); private cms.businesslogic.Dictionary.DictionaryItem currentItem; - protected TextBox keyNameBox; + protected TextBox boxChangeKey; + protected Label labelChangeKey; protected void Page_Load(object sender, System.EventArgs e) { @@ -64,21 +66,26 @@ namespace umbraco.settings } - keyNameBox = new TextBox + boxChangeKey = new TextBox { - ID = "editname-" + currentItem.id, + ID = "changeKey-" + currentItem.id, CssClass = "umbEditorTextField", Text = currentItem.key }; - var txtChangeKey = new Literal + labelChangeKey = new Label + { + ID = "changeKeyLabel", + CssClass = "text-error" + }; + + p.addProperty(new Literal { Text = "

 

" + "

Change the key of the dictionary item. Carefull :)

" - }; - - p.addProperty(txtChangeKey); - p.addProperty(keyNameBox); + }); + p.addProperty(boxChangeKey); + p.addProperty(labelChangeKey); if (!IsPostBack) { @@ -109,15 +116,28 @@ namespace umbraco.settings } } - var newKey = keyNameBox.Text; + labelChangeKey.Text = ""; + var newKey = boxChangeKey.Text; if (string.IsNullOrWhiteSpace(newKey) == false && newKey != currentItem.key) { - currentItem.setKey(newKey); + // key already exists, save but inform + if (Dictionary.DictionaryItem.hasKey(newKey) == true) + { + labelChangeKey.Text = "The key '" + newKey + "' already exists, sorry.."; + boxChangeKey.Text = currentItem.key; // reset the key + } + else + { + // set the new key + currentItem.setKey(newKey); - Panel1.title.InnerHtml = ui.Text("editdictionary") + ": " + currentItem.key; + // update the title with the new key + Panel1.title.InnerHtml = ui.Text("editdictionary") + ": " + newKey; - var path = BuildPath(currentItem); - ClientTools.SyncTree(path, true); + // sync the content tree + var path = BuildPath(currentItem); + ClientTools.SyncTree(path, true); + } } ClientTools.ShowSpeechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "dictionaryItemSaved"), ""); From ce897509bae64ddc120fb6c720c1ed77cf077c1b Mon Sep 17 00:00:00 2001 From: Mads Krohn Date: Tue, 16 Feb 2016 10:44:43 +0100 Subject: [PATCH 06/10] added localization --- src/Umbraco.Web.UI/umbraco/config/lang/da.xml | 6 ++++++ src/Umbraco.Web.UI/umbraco/config/lang/en.xml | 6 ++++++ src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml | 6 ++++++ .../umbraco/settings/EditDictionaryItem.aspx.cs | 14 ++++++++------ 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/da.xml b/src/Umbraco.Web.UI/umbraco/config/lang/da.xml index 446796dd88..f90d3a5ec6 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/da.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/da.xml @@ -236,6 +236,12 @@ Rediger de forskellige sprogversioner for ordbogselementet '%0%' herunder. Du tilføjer flere sprog under 'sprog' i menuen til venstre Kulturnavn + Her kan du ændre nøglen på ordbogselementet. + + + Indtast dit brugernavn diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml index b14b101af7..c953e899cc 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml @@ -284,6 +284,12 @@ Edit the different language versions for the dictionary item '%0%' below
You can add additional languages under the 'languages' in the menu on the left ]]> Culture Name + Here you can change the key of the dictionary item. + + + Enter your username diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml index 1cc40abd1d..012d7074e7 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml @@ -285,6 +285,12 @@ Edit the different language versions for the dictionary item '%0%' below
You can add additional languages under the 'languages' in the menu on the left ]]> Culture Name + Here you can change the key of the dictionary item. + + + Enter your username diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs index b0dd94c869..c66a6ca37f 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs @@ -8,6 +8,7 @@ using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; +using umbraco.BusinessLogic; using umbraco.cms.businesslogic; using umbraco.cms.presentation.Trees; using Umbraco.Core; @@ -28,10 +29,12 @@ namespace umbraco.settings private cms.businesslogic.Dictionary.DictionaryItem currentItem; protected TextBox boxChangeKey; protected Label labelChangeKey; + protected User currentUser; protected void Page_Load(object sender, System.EventArgs e) { currentItem = new cms.businesslogic.Dictionary.DictionaryItem(int.Parse(Request.QueryString["id"])); + currentUser = getUser(); // Put user code to initialize the page here Panel1.hasMenu = true; @@ -47,7 +50,7 @@ namespace umbraco.settings uicontrols.Pane p = new uicontrols.Pane(); Literal txt = new Literal(); - txt.Text = "

" + ui.Text("dictionaryItem", "description", currentItem.key, base.getUser()) + "


"; + txt.Text = "

" + ui.Text("dictionaryItem", "description", currentItem.key, currentUser) + "


"; p.addProperty(txt); foreach (cms.businesslogic.language.Language l in cms.businesslogic.language.Language.getAll) @@ -81,8 +84,7 @@ namespace umbraco.settings p.addProperty(new Literal { - Text = "

 

" + - "

Change the key of the dictionary item. Carefull :)

" + Text = "

 

" + ui.Text("dictionaryItem", "changeKey") + "

" }); p.addProperty(boxChangeKey); p.addProperty(labelChangeKey); @@ -116,15 +118,15 @@ namespace umbraco.settings } } - labelChangeKey.Text = ""; + labelChangeKey.Text = ""; // reset error text var newKey = boxChangeKey.Text; if (string.IsNullOrWhiteSpace(newKey) == false && newKey != currentItem.key) { // key already exists, save but inform if (Dictionary.DictionaryItem.hasKey(newKey) == true) { - labelChangeKey.Text = "The key '" + newKey + "' already exists, sorry.."; - boxChangeKey.Text = currentItem.key; // reset the key + labelChangeKey.Text = ui.Text("dictionaryItem", "changeKeyError", newKey, currentUser); + boxChangeKey.Text = currentItem.key; // reset key } else { From d8eaab2aa4f4e9207c1b3c569a8f3943ef7c3218 Mon Sep 17 00:00:00 2001 From: Mads Krohn Date: Tue, 16 Feb 2016 11:02:29 +0100 Subject: [PATCH 07/10] added a missing
to the danish translation. added current user to the changeKey text. --- src/Umbraco.Web.UI/umbraco/config/lang/da.xml | 4 +++- .../umbraco/settings/EditDictionaryItem.aspx.cs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/da.xml b/src/Umbraco.Web.UI/umbraco/config/lang/da.xml index f90d3a5ec6..9e24a6e167 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/da.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/da.xml @@ -234,7 +234,9 @@ Se Cache Item - Rediger de forskellige sprogversioner for ordbogselementet '%0%' herunder. Du tilføjer flere sprog under 'sprog' i menuen til venstre + Du tilføjer flere sprog under 'sprog' i menuen til venstre + ]]> Kulturnavn Her kan du ændre nøglen på ordbogselementet. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs index c66a6ca37f..dcece3d955 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs @@ -84,7 +84,7 @@ namespace umbraco.settings p.addProperty(new Literal { - Text = "

 

" + ui.Text("dictionaryItem", "changeKey") + "

" + Text = "

 

" + ui.Text("dictionaryItem", "changeKey", currentUser) + "

" }); p.addProperty(boxChangeKey); p.addProperty(labelChangeKey); From 40b0a62cc3894c7d74c6363adee2b09f843d008d Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Wed, 19 Oct 2016 14:58:56 +0200 Subject: [PATCH 08/10] Use int.MaxValue instead of 0 --- .../listview/layouts/list/list.listviewlayout.controller.js | 4 ++-- src/Umbraco.Web/Models/Mapping/MemberModelMapper.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/list/list.listviewlayout.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/list/list.listviewlayout.controller.js index a4df51b252..f3039f9faf 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/list/list.listviewlayout.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/list/list.listviewlayout.controller.js @@ -36,8 +36,8 @@ } function clickItem(item) { - // if item.id is 0 use item.key - $location.path($scope.entityType + '/' +$scope.entityType + '/edit/' + (item.id === 0 ? item.key : item.id)); + // if item.id is 2147483647 (int.MaxValue) use item.key + $location.path($scope.entityType + '/' +$scope.entityType + '/edit/' + (item.id === 2147483647 ? item.key : item.id)); } function isSortDirection(col, direction) { diff --git a/src/Umbraco.Web/Models/Mapping/MemberModelMapper.cs b/src/Umbraco.Web/Models/Mapping/MemberModelMapper.cs index b3c466db59..1a3f8862ee 100644 --- a/src/Umbraco.Web/Models/Mapping/MemberModelMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/MemberModelMapper.cs @@ -38,7 +38,7 @@ namespace Umbraco.Web.Models.Mapping config.CreateMap() .ConstructUsing(user => MemberService.CreateGenericMembershipProviderMember(user.UserName, user.Email, user.UserName, "")) //we're giving this entity an ID of 0 - we cannot really map it but it needs an id so the system knows it's not a new entity - .ForMember(member => member.Id, expression => expression.MapFrom(user => 0)) + .ForMember(member => member.Id, expression => expression.MapFrom(user => int.MaxValue)) .ForMember(member => member.Comments, expression => expression.MapFrom(user => user.Comment)) .ForMember(member => member.CreateDate, expression => expression.MapFrom(user => user.CreationDate)) .ForMember(member => member.UpdateDate, expression => expression.MapFrom(user => user.LastActivityDate)) @@ -119,7 +119,7 @@ namespace Umbraco.Web.Models.Mapping //FROM MembershipUser TO MemberBasic config.CreateMap() //we're giving this entity an ID of 0 - we cannot really map it but it needs an id so the system knows it's not a new entity - .ForMember(member => member.Id, expression => expression.MapFrom(user => 0)) + .ForMember(member => member.Id, expression => expression.MapFrom(user => int.MaxValue)) .ForMember(member => member.CreateDate, expression => expression.MapFrom(user => user.CreationDate)) .ForMember(member => member.UpdateDate, expression => expression.MapFrom(user => user.LastActivityDate)) .ForMember(member => member.Key, expression => expression.MapFrom(user => user.ProviderUserKey.TryConvertTo().Result.ToString("N"))) From 21426610adcc2b99277fda513c117f4884215367 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Wed, 19 Oct 2016 17:01:15 +0200 Subject: [PATCH 09/10] Need to take the current schema into account for the ExcessiveHeadersCheck --- .../Checks/Security/ExcessiveHeadersCheck.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web/HealthCheck/Checks/Security/ExcessiveHeadersCheck.cs b/src/Umbraco.Web/HealthCheck/Checks/Security/ExcessiveHeadersCheck.cs index af1b15818a..83275450e4 100644 --- a/src/Umbraco.Web/HealthCheck/Checks/Security/ExcessiveHeadersCheck.cs +++ b/src/Umbraco.Web/HealthCheck/Checks/Security/ExcessiveHeadersCheck.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Net; using System.Web; +using Umbraco.Core.Configuration; using Umbraco.Core.Services; namespace Umbraco.Web.HealthCheck.Checks.Security @@ -45,10 +46,11 @@ namespace Umbraco.Web.HealthCheck.Checks.Security { var message = string.Empty; var success = false; - var url = HealthCheckContext.HttpContext.Request.Url; - - // Access the site home page and check for the headers - var address = string.Format("http://{0}:{1}", url.Host.ToLower(), url.Port); + var url = HealthCheckContext.HttpContext.Request.Url; + + // Access the site home page and check for the headers + var useSsl = GlobalSettings.UseSSL || HealthCheckContext.HttpContext.Request.ServerVariables["SERVER_PORT"] == "443"; + var address = string.Format("http{0}://{1}:{2}", useSsl ? "s" : "", url.Host.ToLower(), url.Port); var request = WebRequest.Create(address); request.Method = "HEAD"; try From f753dfa2a710917ca863c5c0b33ad21425f9a2f6 Mon Sep 17 00:00:00 2001 From: Claus Date: Thu, 20 Oct 2016 13:56:52 +0200 Subject: [PATCH 10/10] minor updates and a little reformatting. --- src/Umbraco.Web.UI/umbraco/config/lang/da.xml | 4 +- src/Umbraco.Web.UI/umbraco/config/lang/en.xml | 2 +- .../umbraco/config/lang/en_us.xml | 2 +- .../settings/EditDictionaryItem.aspx.cs | 216 +++++++++--------- 4 files changed, 107 insertions(+), 117 deletions(-) diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/da.xml b/src/Umbraco.Web.UI/umbraco/config/lang/da.xml index 130878323e..ffb0a9d96b 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/da.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/da.xml @@ -308,10 +308,10 @@ Rediger de forskellige sprogversioner for ordbogselementet '%0%' herunder.
Du tilføjer flere sprog under 'sprog' i menuen til venstre
]]> Kulturnavn - Her kan du ændre nøglen på ordbogselementet. + Rediger navnet på ordbogselementet. diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml index 38376231b7..f710e54215 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml @@ -327,7 +327,7 @@ Edit the different language versions for the dictionary item '%0%' below
You can add additional languages under the 'languages' in the menu on the left ]]> Culture Name - Here you can change the key of the dictionary item. + Edit the key of the dictionary item. %0%' below
You can add additional languages under the 'languages' in the menu on the left ]]>
Culture Name - Here you can change the key of the dictionary item. + Edit the key of the dictionary item. - /// Summary description for EditDictionaryItem. - /// + /// + /// Summary description for EditDictionaryItem. + /// [WebformsPageTreeAuthorize(Constants.Trees.Dictionary)] - public partial class EditDictionaryItem : BasePages.UmbracoEnsuredPage - { - - protected LiteralControl keyTxt = new LiteralControl(); - protected uicontrols.TabView tbv = new uicontrols.TabView(); - private System.Collections.ArrayList languageFields = new System.Collections.ArrayList(); + public partial class EditDictionaryItem : BasePages.UmbracoEnsuredPage + { + + protected LiteralControl keyTxt = new LiteralControl(); + protected uicontrols.TabView tbv = new uicontrols.TabView(); + private System.Collections.ArrayList languageFields = new System.Collections.ArrayList(); private cms.businesslogic.Dictionary.DictionaryItem currentItem; - protected TextBox boxChangeKey; - protected Label labelChangeKey; - protected User currentUser; + protected TextBox boxChangeKey; + protected Label labelChangeKey; + protected Literal txt; + protected User currentUser; - protected void Page_Load(object sender, System.EventArgs e) - { - currentItem = new cms.businesslogic.Dictionary.DictionaryItem(int.Parse(Request.QueryString["id"])); - currentUser = getUser(); + protected void Page_Load(object sender, System.EventArgs e) + { + currentItem = new cms.businesslogic.Dictionary.DictionaryItem(int.Parse(Request.QueryString["id"])); + currentUser = getUser(); - // Put user code to initialize the page here - Panel1.hasMenu = true; - Panel1.Text = ui.Text("editdictionary") + ": " + currentItem.key; + // Put user code to initialize the page here + Panel1.hasMenu = true; + Panel1.Text = ui.Text("editdictionary") + ": " + currentItem.key; - var save = Panel1.Menu.NewButton(); + var save = Panel1.Menu.NewButton(); save.Text = ui.Text("save"); save.Click += save_Click; - save.ToolTip = ui.Text("save"); + save.ToolTip = ui.Text("save"); save.ID = "save"; save.ButtonType = uicontrols.MenuButtonType.Primary; uicontrols.Pane p = new uicontrols.Pane(); - Literal txt = new Literal(); - txt.Text = "

" + ui.Text("dictionaryItem", "description", currentItem.key, currentUser) + "


"; - p.addProperty(txt); - - foreach (cms.businesslogic.language.Language l in cms.businesslogic.language.Language.getAll) - { - - TextBox languageBox = new TextBox(); - languageBox.TextMode = TextBoxMode.MultiLine; - languageBox.ID = l.id.ToString(); - languageBox.CssClass = "umbEditorTextFieldMultiple"; - - if (!IsPostBack) - languageBox.Text = currentItem.Value(l.id); - - languageFields.Add(languageBox); - p.addProperty(l.FriendlyName, languageBox); - - } - boxChangeKey = new TextBox { ID = "changeKey-" + currentItem.id, @@ -81,42 +54,64 @@ namespace umbraco.settings ID = "changeKeyLabel", CssClass = "text-error" }; - + p.addProperty(new Literal { - Text = "

 

" + ui.Text("dictionaryItem", "changeKey", currentUser) + "

" + Text = "

" + ui.Text("dictionaryItem", "changeKey", currentUser) + "

" }); p.addProperty(boxChangeKey); p.addProperty(labelChangeKey); + + txt = new Literal(); + txt.Text = "

" + ui.Text("dictionaryItem", "description", currentItem.key, currentUser) + "


"; + p.addProperty(txt); + + foreach (cms.businesslogic.language.Language l in cms.businesslogic.language.Language.getAll) + { + + TextBox languageBox = new TextBox(); + languageBox.TextMode = TextBoxMode.MultiLine; + languageBox.ID = l.id.ToString(); + languageBox.CssClass = "umbEditorTextFieldMultiple"; + + if (!IsPostBack) + languageBox.Text = currentItem.Value(l.id); + + languageFields.Add(languageBox); + p.addProperty(l.FriendlyName, languageBox); + + } + + if (!IsPostBack) - { - var path = BuildPath(currentItem); - ClientTools - .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree().Tree.Alias) - .SyncTree(path, false); - } + { + var path = BuildPath(currentItem); + ClientTools + .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree().Tree.Alias) + .SyncTree(path, false); + } Panel1.Controls.Add(p); - } + } - private string BuildPath(cms.businesslogic.Dictionary.DictionaryItem current) - { - var parentPath = current.IsTopMostItem() ? "" : BuildPath(current.Parent) + ","; - return parentPath + current.id; - } + private string BuildPath(cms.businesslogic.Dictionary.DictionaryItem current) + { + var parentPath = current.IsTopMostItem() ? "" : BuildPath(current.Parent) + ","; + return parentPath + current.id; + } void save_Click(object sender, EventArgs e) { - foreach (TextBox t in languageFields) + foreach (TextBox t in languageFields) { //check for null but allow empty string! // http://issues.umbraco.org/issue/U4-1931 - if (t.Text != null) + if (t.Text != null) { - currentItem.setValue(int.Parse(t.ID),t.Text); - } - } + currentItem.setValue(int.Parse(t.ID), t.Text); + } + } labelChangeKey.Text = ""; // reset error text var newKey = boxChangeKey.Text; @@ -140,55 +135,50 @@ namespace umbraco.settings var path = BuildPath(currentItem); ClientTools.SyncTree(path, true); } - } + } + txt.Text = "

" + ui.Text("dictionaryItem", "description", currentItem.key, currentUser) + "


"; + ClientTools.ShowSpeechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "dictionaryItemSaved"), ""); + } - ClientTools.ShowSpeechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "dictionaryItemSaved"), ""); - } + #region Web Form Designer generated code - #region Web Form Designer generated code - override protected void OnInit(EventArgs e) - { - // - // CODEGEN: This call is required by the ASP.NET Web Form Designer. - // - /* - tbv.ID="tabview1"; - tbv.Width = 400; - tbv.Height = 200; - */ + override protected void OnInit(EventArgs e) + { + InitializeComponent(); + base.OnInit(e); + } - InitializeComponent(); - base.OnInit(e); - } - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - } - #endregion + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + } + + #endregion + private class languageTextbox : TextBox + { - private class languageTextbox : TextBox - { - - private int _languageid; - public int languageid - { - set {_languageid = value;} - get {return _languageid;} - } - public languageTextbox(int languageId) : base() { - this.TextMode = TextBoxMode.MultiLine; - this.Rows = 10; - this.Columns = 40; - this.Attributes.Add("style", "margin: 3px; width: 98%;"); - - this.languageid = languageId; - } - } - } + private int _languageid; + + public int languageid + { + set { _languageid = value; } + get { return _languageid; } + } + + public languageTextbox(int languageId) : base() + { + this.TextMode = TextBoxMode.MultiLine; + this.Rows = 10; + this.Columns = 40; + this.Attributes.Add("style", "margin: 3px; width: 98%;"); + + this.languageid = languageId; + } + } + } }