minor updates and a little reformatting.

This commit is contained in:
Claus
2016-10-20 13:56:52 +02:00
parent 8fa02913be
commit f753dfa2a7
4 changed files with 107 additions and 117 deletions

View File

@@ -308,10 +308,10 @@
Rediger de forskellige sprogversioner for ordbogselementet '%0%' herunder.<br />Du tilføjer flere sprog under 'sprog' i menuen til venstre </key>
]]></key>
<key alias="displayName">Kulturnavn</key>
<key alias="changeKey">Her kan du ændre nøglen på ordbogselementet.</key>
<key alias="changeKey">Rediger navnet på ordbogselementet.</key>
<key alias="changeKeyError">
<![CDATA[
Nøglen '%0%' eksisterer allerede.
Navnet '%0%' eksisterer allerede.
]]>
</key>
</area>

View File

@@ -327,7 +327,7 @@
Edit the different language versions for the dictionary item '<em>%0%</em>' below<br/>You can add additional languages under the 'languages' in the menu on the left
]]></key>
<key alias="displayName">Culture Name</key>
<key alias="changeKey">Here you can change the key of the dictionary item.</key>
<key alias="changeKey">Edit the key of the dictionary item.</key>
<key alias="changeKeyError">
<![CDATA[
The key '%0%' already exists.

View File

@@ -328,7 +328,7 @@
Edit the different language versions for the dictionary item '<em>%0%</em>' below<br/>You can add additional languages under the 'languages' in the menu on the left
]]></key>
<key alias="displayName">Culture Name</key>
<key alias="changeKey">Here you can change the key of the dictionary item.</key>
<key alias="changeKey">Edit the key of the dictionary item.</key>
<key alias="changeKeyError">
<![CDATA[
The key '%0%' already exists.

View File

@@ -1,74 +1,47 @@
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
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;
namespace umbraco.settings
{
/// <summary>
/// Summary description for EditDictionaryItem.
/// </summary>
/// <summary>
/// Summary description for EditDictionaryItem.
/// </summary>
[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 = "<p>" + ui.Text("dictionaryItem", "description", currentItem.key, currentUser) + "</p><br/>";
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 = "<p>&nbsp;</p><p>" + ui.Text("dictionaryItem", "changeKey", currentUser) + "</p>"
Text = "<p>" + ui.Text("dictionaryItem", "changeKey", currentUser) + "</p>"
});
p.addProperty(boxChangeKey);
p.addProperty(labelChangeKey);
txt = new Literal();
txt.Text = "<br/><p>" + ui.Text("dictionaryItem", "description", currentItem.key, currentUser) + "</p><br/>";
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<loadDictionary>().Tree.Alias)
.SyncTree(path, false);
}
{
var path = BuildPath(currentItem);
ClientTools
.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadDictionary>().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 = "<br/><p>" + ui.Text("dictionaryItem", "description", currentItem.key, currentUser) + "</p><br/>";
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);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
#endregion
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}
}
}