diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/da.xml b/src/Umbraco.Web.UI/umbraco/config/lang/da.xml index 40f4a79ed2..130878323e 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/da.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/da.xml @@ -304,8 +304,16 @@ Vælg editor - 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. + + + 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 92160e85f0..38376231b7 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml @@ -327,6 +327,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 aa896185d3..cb7de0339c 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml @@ -328,6 +328,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 deb77f4bad..dcece3d955 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,8 @@ 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; using Umbraco.Core.IO; @@ -25,26 +27,30 @@ 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 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; 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()) + "


"; + txt.Text = "

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


"; p.addProperty(txt); foreach (cms.businesslogic.language.Language l in cms.businesslogic.language.Language.getAll) @@ -63,7 +69,27 @@ namespace umbraco.settings } - if (!IsPostBack) + boxChangeKey = new TextBox + { + ID = "changeKey-" + currentItem.id, + CssClass = "umbEditorTextField", + Text = currentItem.key + }; + + labelChangeKey = new Label + { + ID = "changeKeyLabel", + CssClass = "text-error" + }; + + p.addProperty(new Literal + { + Text = "

 

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

" + }); + p.addProperty(boxChangeKey); + p.addProperty(labelChangeKey); + + if (!IsPostBack) { var path = BuildPath(currentItem); ClientTools @@ -71,7 +97,6 @@ namespace umbraco.settings .SyncTree(path, false); } - Panel1.Controls.Add(p); } @@ -92,8 +117,34 @@ namespace umbraco.settings currentItem.setValue(int.Parse(t.ID),t.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 = ui.Text("dictionaryItem", "changeKeyError", newKey, currentUser); + boxChangeKey.Text = currentItem.key; // reset key + } + else + { + // set the new key + currentItem.setKey(newKey); + + // update the title with the new key + Panel1.title.InnerHtml = ui.Text("editdictionary") + ": " + newKey; + + // sync the content tree + 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)