diff --git a/components/editorControls/SettingControls/CheckBox.cs b/components/editorControls/SettingControls/CheckBox.cs new file mode 100644 index 0000000000..22e663e1e4 --- /dev/null +++ b/components/editorControls/SettingControls/CheckBox.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using umbraco.cms.businesslogic.datatype; + +namespace umbraco.editorControls.SettingControls +{ + public class CheckBox: DataEditorSettingType + { + private System.Web.UI.WebControls.CheckBox cb = new System.Web.UI.WebControls.CheckBox(); + + public override string Value + { + get + { + return cb.Checked.ToString(); + } + set + { + if (value == true.ToString()) + cb.Checked = true; + } + } + + public override System.Web.UI.Control RenderControl(DataEditorSetting sender) + { + cb.ID = sender.GetName(); + return cb; + } + } +} \ No newline at end of file diff --git a/components/editorControls/SettingControls/CheckBoxList.cs b/components/editorControls/SettingControls/CheckBoxList.cs new file mode 100644 index 0000000000..cd719948d0 --- /dev/null +++ b/components/editorControls/SettingControls/CheckBoxList.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using umbraco.cms.businesslogic.datatype; + +namespace umbraco.editorControls.SettingControls +{ + public class CheckBoxList : DataEditorSettingType + { + private System.Web.UI.WebControls.CheckBoxList cbl = new System.Web.UI.WebControls.CheckBoxList(); + + private string _val = string.Empty; + public override string Value + { + get + { + string retVal = string.Empty; + + foreach (System.Web.UI.WebControls.ListItem item in cbl.Items) + { + if (item.Selected) + retVal += item.Value + ";"; + } + return retVal; + + } + set + { + if (!string.IsNullOrEmpty(value)) + _val = value; + } + } + + public override System.Web.UI.Control RenderControl(DataEditorSetting sender) + { + cbl.ID = sender.GetName(); + + cbl.Items.Clear(); + + foreach (string s in Prevalues) + { + System.Web.UI.WebControls.ListItem item = new System.Web.UI.WebControls.ListItem(s); + + if(_val.Contains(s + ";")) + item.Selected = true; + + cbl.Items.Add(item); + + + + } + + + + return cbl; + } + } +} \ No newline at end of file diff --git a/components/editorControls/SettingControls/DropDownList.cs b/components/editorControls/SettingControls/DropDownList.cs new file mode 100644 index 0000000000..1a203c8fa2 --- /dev/null +++ b/components/editorControls/SettingControls/DropDownList.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using umbraco.cms.businesslogic.datatype; + +namespace umbraco.editorControls.SettingControls +{ + public class DropDownList: DataEditorSettingType + { + private System.Web.UI.WebControls.DropDownList ddl = new System.Web.UI.WebControls.DropDownList(); + + private string _val = string.Empty; + public override string Value + { + get + { + return ddl.SelectedValue; + } + set + { + if (!string.IsNullOrEmpty(value)) + _val = value; + } + } + + public override System.Web.UI.Control RenderControl(DataEditorSetting sender) + { + ddl.ID = sender.GetName(); + + ddl.Items.Clear(); + + foreach (string s in Prevalues) + { + ddl.Items.Add(s); + } + + ddl.SelectedValue = _val; + + return ddl; + } + } +} \ No newline at end of file diff --git a/components/editorControls/SettingControls/ListBox.cs b/components/editorControls/SettingControls/ListBox.cs new file mode 100644 index 0000000000..1202d00a84 --- /dev/null +++ b/components/editorControls/SettingControls/ListBox.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using umbraco.cms.businesslogic.datatype; + +namespace umbraco.editorControls.SettingControls +{ + public class ListBox : DataEditorSettingType + { + private System.Web.UI.WebControls.ListBox lb = new System.Web.UI.WebControls.ListBox(); + + private string _val = string.Empty; + public override string Value + { + get + { + return lb.SelectedValue; + } + set + { + if (!string.IsNullOrEmpty(value)) + _val = value; + } + } + + public override System.Web.UI.Control RenderControl(DataEditorSetting sender) + { + lb.ID = sender.GetName(); + + lb.CssClass = "guiInputStandardSize"; + + lb.Items.Clear(); + + foreach (string s in Prevalues) + { + lb.Items.Add(s); + } + + lb.SelectedValue = _val; + + return lb; + } + } +} \ No newline at end of file diff --git a/components/editorControls/SettingControls/ListBoxMultiple.cs b/components/editorControls/SettingControls/ListBoxMultiple.cs new file mode 100644 index 0000000000..832206d7a7 --- /dev/null +++ b/components/editorControls/SettingControls/ListBoxMultiple.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using umbraco.cms.businesslogic.datatype; + +namespace umbraco.editorControls.SettingControls +{ + public class ListBoxMultiple : DataEditorSettingType + { + private System.Web.UI.WebControls.ListBox lb = new System.Web.UI.WebControls.ListBox(); + + private string _val = string.Empty; + public override string Value + { + get + { + string retVal = string.Empty; + + foreach (System.Web.UI.WebControls.ListItem item in lb.Items) + { + if (item.Selected) + retVal += item.Value + ";"; + } + return retVal; + + } + set + { + if (!string.IsNullOrEmpty(value)) + _val = value; + } + } + + public override System.Web.UI.Control RenderControl(DataEditorSetting sender) + { + lb.ID = sender.GetName(); + lb.SelectionMode = System.Web.UI.WebControls.ListSelectionMode.Multiple; + lb.CssClass = "guiInputStandardSize"; + lb.Items.Clear(); + + foreach (string s in Prevalues) + { + System.Web.UI.WebControls.ListItem item = new System.Web.UI.WebControls.ListItem(s); + + if (_val.Contains(s + ";")) + item.Selected = true; + + lb.Items.Add(item); + + + + } + + + + return lb; + } + } +} \ No newline at end of file diff --git a/components/editorControls/SettingControls/Password.cs b/components/editorControls/SettingControls/Password.cs new file mode 100644 index 0000000000..1142315df3 --- /dev/null +++ b/components/editorControls/SettingControls/Password.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI.WebControls; +using umbraco.cms.businesslogic.datatype; + +namespace umbraco.editorControls.SettingControls +{ + public class Password : DataEditorSettingType + { + private TextBox tb = new TextBox(); + + public override string Value + { + get + { + return tb.Text; + } + set + { + tb.Text = value; + tb.Attributes["value"] = value; + } + } + + + public override System.Web.UI.Control RenderControl(DataEditorSetting sender) + { + tb.ID = sender.GetName(); + + tb.TextMode = TextBoxMode.Password; + tb.CssClass = "guiInputText guiInputStandardSize"; + return tb; + } + } +} \ No newline at end of file diff --git a/components/editorControls/SettingControls/Pickers/BasePicker.cs b/components/editorControls/SettingControls/Pickers/BasePicker.cs new file mode 100644 index 0000000000..478f46ad13 --- /dev/null +++ b/components/editorControls/SettingControls/Pickers/BasePicker.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using umbraco.cms.businesslogic.datatype; + +namespace umbraco.editorControls.SettingControls.Pickers +{ + public class BasePicker: DataEditorSettingType + { + public Guid ObjectGuid { get; set; } + + private System.Web.UI.WebControls.DropDownList ddl = new System.Web.UI.WebControls.DropDownList(); + + private string _val = string.Empty; + + public override string Value + { + get + { + return ddl.SelectedValue; + } + set + { + if (!string.IsNullOrEmpty(value)) + _val = value; + } + } + + public override System.Web.UI.Control RenderControl(DataEditorSetting sender) + { + + ddl.ID = sender.GetName(); + + ddl.Items.Clear(); + List> items = new List>(); + + if (ObjectGuid != Guid.Empty) + { + Guid[] guids = umbraco.cms.businesslogic.CMSNode.getAllUniquesFromObjectType(ObjectGuid); + foreach (Guid g in guids) + { + umbraco.cms.businesslogic.CMSNode node = new umbraco.cms.businesslogic.CMSNode(g); + items.Add(new KeyValuePair(node.Id.ToString(), node.Text)); + } + } + + items.Sort(delegate(KeyValuePair x, KeyValuePair y) { return x.Value.CompareTo(y.Value); }); + + foreach (KeyValuePair kv in items) + { + ddl.Items.Add(new System.Web.UI.WebControls.ListItem(kv.Value, kv.Key)); + } + + System.Web.UI.WebControls.ListItem li = new System.Web.UI.WebControls.ListItem("Choose...", ""); + li.Selected = true; + ddl.Items.Insert(0, li); + + + + ddl.SelectedValue = _val; + + return ddl; + } + } +} \ No newline at end of file diff --git a/components/editorControls/SettingControls/Pickers/Content.cs b/components/editorControls/SettingControls/Pickers/Content.cs new file mode 100644 index 0000000000..66df17812d --- /dev/null +++ b/components/editorControls/SettingControls/Pickers/Content.cs @@ -0,0 +1,180 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using umbraco.cms.businesslogic.datatype; +using System.Web.UI.WebControls; + +namespace umbraco.editorControls.SettingControls.Pickers +{ + public class Content : DataEditorSettingType + { + private ContentPickerWithXpathOption cc = new ContentPickerWithXpathOption(); + + private string _val = string.Empty; + public override string Value + { + get + { + return cc.Value; + } + set + { + if (!string.IsNullOrEmpty(value)) + _val = value; + } + } + + public override System.Web.UI.Control RenderControl(DataEditorSetting sender) + { + + cc.ShowXPath = false; + cc.ID = sender.GetName().Replace(" ", "_"); + + cc.Value = _val; + return cc; + } + } + + + public class ContentWithXpath : DataEditorSettingType + { + private ContentPickerWithXpathOption cc = new ContentPickerWithXpathOption(); + + private string _val = string.Empty; + public override string Value + { + get + { + return cc.Value; + } + set + { + if (!string.IsNullOrEmpty(value)) + _val = value; + } + } + + public override System.Web.UI.Control RenderControl(DataEditorSetting sender) + { + cc.ShowXPath = true; + cc.ID = sender.GetName().Replace(" ", "_"); + + cc.Value = _val; + return cc; + } + } + + + + public class ContentPickerWithXpathOption : WebControl + { + private bool _showXPath = true; + + public bool ShowXPath + { + get { return _showXPath; } + set { _showXPath = value; } + } + + private umbraco.controls.ContentPicker cc; + private TextBox tb; + + public ContentPickerWithXpathOption() + { + EnsureChildControls(); + } + + protected override void OnInit(EventArgs e) + { + + + Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "contentpickerxpath", @" + + function showXpathTextbox(control) + { + $('.picker',$('#' + control)).hide(); + $('.xpath',$('#' + control)).show(); + } + + function showContentPicker(control) + { + $('.xpath',$('#' + control)).hide(); + $('.xpath input',$('#' + control)).val(''); + $('.picker',$('#' + control)).show(); + } + ", true); + + base.OnInit(e); + } + + protected override void CreateChildControls() + { + cc = new umbraco.controls.ContentPicker(); + this.Controls.Add(cc); + + + if (_showXPath) + { + tb = new TextBox(); + tb.CssClass = "guiInputText guiInputStandardSize"; + this.Controls.Add(tb); + } + } + + protected override void RenderChildren(System.Web.UI.HtmlTextWriter writer) + { + + writer.Write(string.Format("
", tb.Text != string.Empty ? " style=\"display:none\"" : "")); + cc.RenderControl(writer); + + if (_showXPath) + { + writer.Write(string.Format( + " Or enter Xpath", + this.ClientID)); + + writer.Write("
"); + + writer.Write(string.Format("
", !(tb.Text != string.Empty) ? " style=\"display:none\"" : "")); + tb.RenderControl(writer); + + writer.Write(string.Format( + " Or pick node", + this.ClientID)); + } + + writer.Write("
"); + } + + + + + private string _val = string.Empty; + public string Value + { + get + { + + if (_showXPath && tb.Text != string.Empty) + return tb.Text; + else + return cc.Text; + } + set + { + if (!string.IsNullOrEmpty(value)) + { + _val = value; + + int nodeId; + + if (int.TryParse(_val, out nodeId)) + cc.Text = _val; + else if (ShowXPath) + tb.Text = _val; + } + } + } + } +} diff --git a/components/editorControls/SettingControls/Pickers/Date.cs b/components/editorControls/SettingControls/Pickers/Date.cs new file mode 100644 index 0000000000..c94498972f --- /dev/null +++ b/components/editorControls/SettingControls/Pickers/Date.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using umbraco.uicontrols.DatePicker; +using umbraco.cms.businesslogic.datatype; + +namespace umbraco.editorControls.SettingControls.Pickers +{ + public class Date: DataEditorSettingType + { + private DateTimePicker dp = new DateTimePicker(); + + private string _val = string.Empty; + public override string Value + { + get + { + return dp.DateTime.ToString(); + } + set + { + if (!string.IsNullOrEmpty(value)) + _val = value; + } + } + + public override System.Web.UI.Control RenderControl(DataEditorSetting sender) + { + + dp.ShowTime = false; + + dp.ID = sender.GetName().Replace(" ", "_"); + + if(!string.IsNullOrEmpty(_val)) + dp.DateTime = Convert.ToDateTime(_val); + + return dp; + } + } + +} \ No newline at end of file diff --git a/components/editorControls/SettingControls/Pickers/DateWithTime.cs b/components/editorControls/SettingControls/Pickers/DateWithTime.cs new file mode 100644 index 0000000000..d347bda8b6 --- /dev/null +++ b/components/editorControls/SettingControls/Pickers/DateWithTime.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using umbraco.uicontrols.DatePicker; +using umbraco.cms.businesslogic.datatype; + +namespace umbraco.editorControls.SettingControls.Pickers +{ + public class DateWithTime : DataEditorSettingType + { + private DateTimePicker dp = new DateTimePicker(); + + private string _val = string.Empty; + public override string Value + { + get + { + return dp.DateTime.ToString(); + } + set + { + if (!string.IsNullOrEmpty(value)) + _val = value; + } + } + + public override System.Web.UI.Control RenderControl(DataEditorSetting sender) + { + + dp.ShowTime = true; + + dp.ID = sender.GetName().Replace(" ", "_"); + + if (!string.IsNullOrEmpty(_val)) + dp.DateTime = Convert.ToDateTime(_val); + + return dp; + } + } +} \ No newline at end of file diff --git a/components/editorControls/SettingControls/Pickers/DocumentType.cs b/components/editorControls/SettingControls/Pickers/DocumentType.cs new file mode 100644 index 0000000000..de75772875 --- /dev/null +++ b/components/editorControls/SettingControls/Pickers/DocumentType.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace umbraco.editorControls.SettingControls.Pickers +{ + + public class DocumentType: BasePicker { + public DocumentType() { + ObjectGuid = new Guid("a2cb7800-f571-4787-9638-bc48539a0efb"); + } + } +} \ No newline at end of file diff --git a/components/editorControls/SettingControls/Pickers/Field.cs b/components/editorControls/SettingControls/Pickers/Field.cs new file mode 100644 index 0000000000..4aa88eaa2e --- /dev/null +++ b/components/editorControls/SettingControls/Pickers/Field.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using umbraco.DataLayer; +using umbraco.cms.businesslogic.datatype; + +namespace umbraco.editorControls.SettingControls.Pickers +{ + public class Field : DataEditorSettingType + { + private System.Web.UI.WebControls.DropDownList ddl = new System.Web.UI.WebControls.DropDownList(); + + private string _val = string.Empty; + + public override string Value + { + get + { + return ddl.SelectedValue; + } + set + { + if (!string.IsNullOrEmpty(value)) + _val = value; + } + } + + public override System.Web.UI.Control RenderControl(DataEditorSetting sender) + { + + ddl.ID = sender.GetName(); + + ddl.Items.Clear(); + List> items = new List>(); + + + string[] preValuesSource = { "@createDate", "@creatorName", "@level", "@nodeType", "@nodeTypeAlias", "@pageID", "@pageName", "@parentID", "@path", "@template", "@updateDate", "@writerID", "@writerName" }; + + string fieldSql = "select distinct alias from cmsPropertyType order by alias"; + + IRecordsReader dataTypes = umbraco.BusinessLogic.Application.SqlHelper.ExecuteReader(fieldSql); + ddl.DataTextField = "alias"; + ddl.DataValueField = "alias"; + ddl.DataSource = dataTypes; + ddl.DataBind(); + + foreach (string s in preValuesSource) + { + ddl.Items.Add(new System.Web.UI.WebControls.ListItem(s, s.Replace("@", ""))); + } + + + System.Web.UI.WebControls.ListItem li = new System.Web.UI.WebControls.ListItem("Choose...", ""); + li.Selected = true; + ddl.Items.Insert(0, li); + + ddl.SelectedValue = _val; + + return ddl; + } + } +} \ No newline at end of file diff --git a/components/editorControls/SettingControls/Pickers/Media.cs b/components/editorControls/SettingControls/Pickers/Media.cs new file mode 100644 index 0000000000..9e470c6850 --- /dev/null +++ b/components/editorControls/SettingControls/Pickers/Media.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using umbraco.cms.businesslogic.datatype; + +namespace umbraco.editorControls.SettingControls.Pickers +{ + public class Media : DataEditorSettingType + { + + private umbraco.controls.ContentPicker mp = new umbraco.controls.ContentPicker(); + + private string _val = string.Empty; + public override string Value + { + get + { + + return mp.Value; + } + set + { + int output; + if (!string.IsNullOrEmpty(value) && int.TryParse(value, out output)) + _val = value; + } + } + + public override System.Web.UI.Control RenderControl(DataEditorSetting sender) + { + + mp.ID = sender.GetName().Replace(" ", "_"); + + mp.AppAlias = "media"; + mp.TreeAlias = "media"; + + int output; + if (!string.IsNullOrEmpty(_val) && int.TryParse(_val, out output)) + { + mp.Value = _val; + + } + return mp; + } + + } + +} \ No newline at end of file diff --git a/components/editorControls/SettingControls/Pickers/MediaType.cs b/components/editorControls/SettingControls/Pickers/MediaType.cs new file mode 100644 index 0000000000..7650b705e1 --- /dev/null +++ b/components/editorControls/SettingControls/Pickers/MediaType.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace umbraco.editorControls.SettingControls.Pickers +{ + public class MediaType : BasePicker + { + public MediaType() + { + ObjectGuid = new Guid("4ea4382b-2f5a-4c2b-9587-ae9b3cf3602e"); + } + } +} \ No newline at end of file diff --git a/components/editorControls/SettingControls/Pickers/MemberGroup.cs b/components/editorControls/SettingControls/Pickers/MemberGroup.cs new file mode 100644 index 0000000000..cf58c3142b --- /dev/null +++ b/components/editorControls/SettingControls/Pickers/MemberGroup.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace umbraco.editorControls.SettingControls.Pickers +{ + public class MemberGroup : BasePicker + { + public MemberGroup() + { + ObjectGuid = new Guid("366e63b9-880f-4e13-a61c-98069b029728"); + } + } +} \ No newline at end of file diff --git a/components/editorControls/SettingControls/Pickers/MemberType.cs b/components/editorControls/SettingControls/Pickers/MemberType.cs new file mode 100644 index 0000000000..9054bed6e0 --- /dev/null +++ b/components/editorControls/SettingControls/Pickers/MemberType.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace umbraco.editorControls.SettingControls.Pickers +{ + public class MemberType : BasePicker + { + public MemberType() + { + ObjectGuid = new Guid("9b5416fb-e72f-45a9-a07b-5a9a2709ce43"); + } + } +} \ No newline at end of file diff --git a/components/editorControls/SettingControls/Pickers/Path.cs b/components/editorControls/SettingControls/Pickers/Path.cs new file mode 100644 index 0000000000..ae63867fef --- /dev/null +++ b/components/editorControls/SettingControls/Pickers/Path.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using umbraco.cms.businesslogic.datatype; +using System.Web.UI.WebControls; + + +namespace umbraco.editorControls.SettingControls.Pickers +{ + public class Path : DataEditorSettingType + { + private PathPicker pp = new PathPicker(); + + private string _val = string.Empty; + public override string Value + { + get + { + return pp.Value; + } + set + { + if (!string.IsNullOrEmpty(value)) + _val = value; + } + } + + public override System.Web.UI.Control RenderControl(DataEditorSetting sender) + { + + + pp.ID = sender.GetName().Replace(" ", "_"); + + pp.Value = _val; + return pp; + } + } + + + public class PathPicker : WebControl + { + private TextBox tb; + + public PathPicker() + { + EnsureChildControls(); + } + + protected override void CreateChildControls() + { + + tb = new TextBox(); + tb.CssClass = "guiInputText guiInputStandardSize"; + tb.ID = this.ID + "input"; + this.Controls.Add(tb); + + } + + protected override void Render(System.Web.UI.HtmlTextWriter writer) + { + tb.RenderControl(writer); + + writer.WriteLine(string.Format(" Select", + string.Format("javascript:UmbClientMgr.openModalWindow('developer/packages/directoryBrowser.aspx?target={0}', 'Choose a file or a folder', true, 400, 500, 0, 0); return false;", tb.ClientID))); + + } + + private string _val = string.Empty; + public string Value + { + get + { + return tb.Text; + + } + set + { + if (!string.IsNullOrEmpty(value)) + { + _val = value; + tb.Text = _val; + } + } + } + } + +} \ No newline at end of file diff --git a/components/editorControls/SettingControls/RadioButtonList.cs b/components/editorControls/SettingControls/RadioButtonList.cs new file mode 100644 index 0000000000..2ff04ca6f3 --- /dev/null +++ b/components/editorControls/SettingControls/RadioButtonList.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using umbraco.cms.businesslogic.datatype; + +namespace umbraco.editorControls.SettingControls +{ + public class RadioButtonList: DataEditorSettingType + { + private System.Web.UI.WebControls.RadioButtonList rbl = new System.Web.UI.WebControls.RadioButtonList(); + + private string _val = string.Empty; + public override string Value + { + get + { + return rbl.SelectedValue; + } + set + { + if (!string.IsNullOrEmpty(value)) + _val = value; + } + } + + public override System.Web.UI.Control RenderControl(DataEditorSetting sender) + { + rbl.ID = sender.GetName(); + + rbl.Items.Clear(); + + foreach (string s in Prevalues) + { + rbl.Items.Add(s); + } + + rbl.SelectedValue = _val; + + return rbl; + } + } +} \ No newline at end of file diff --git a/components/editorControls/SettingControls/TextArea.cs b/components/editorControls/SettingControls/TextArea.cs new file mode 100644 index 0000000000..eea077df0f --- /dev/null +++ b/components/editorControls/SettingControls/TextArea.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI.WebControls; +using umbraco.cms.businesslogic.datatype; + +namespace umbraco.editorControls.SettingControls +{ + public class TextArea : DataEditorSettingType + { + private TextBox tb = new TextBox(); + + public override string Value + { + get + { + return tb.Text; + } + set + { + tb.Text = value; + } + } + + public override System.Web.UI.Control RenderControl(DataEditorSetting sender) + { + tb.ID = sender.GetName(); + tb.TextMode = TextBoxMode.MultiLine; + tb.CssClass = "guiInputText guiInputStandardSize"; + tb.Rows = 7; + + if (string.IsNullOrEmpty(tb.Text) && this.Prevalues.Count > 0) + tb.Text = this.Prevalues[0]; + + return tb; + } + } +} \ No newline at end of file diff --git a/components/editorControls/SettingControls/TextField.cs b/components/editorControls/SettingControls/TextField.cs new file mode 100644 index 0000000000..37d124c1c9 --- /dev/null +++ b/components/editorControls/SettingControls/TextField.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using umbraco.cms.businesslogic.datatype; +using System.Web.UI.WebControls; + +namespace umbraco.editorControls.SettingControls +{ + public class TextField : DataEditorSettingType + { + private TextBox tb = new TextBox(); + + public override string Value + { + get + { + return tb.Text; + } + set + { + tb.Text = value; + } + } + + public override System.Web.UI.Control RenderControl(DataEditorSetting sender) + { + tb.ID = sender.GetName(); + tb.TextMode = TextBoxMode.SingleLine; + tb.CssClass = "guiInputText guiInputStandardSize"; + + + if (string.IsNullOrEmpty(tb.Text) && Prevalues.Count > 0) + tb.Text = Prevalues[0]; + + return tb; + } + } +} diff --git a/components/editorControls/SettingControls/Values.cs b/components/editorControls/SettingControls/Values.cs new file mode 100644 index 0000000000..5a05a70fb0 --- /dev/null +++ b/components/editorControls/SettingControls/Values.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI.WebControls; +using System.Web.UI.HtmlControls; +using umbraco.cms.businesslogic.datatype; + +[assembly: System.Web.UI.WebResource("umbraco.editorControls.SettingControls.js.Values.js", "text/js")] +[assembly: System.Web.UI.WebResource("umbraco.editorControls.SettingControls.css.Values.css", "text/css")] +namespace umbraco.editorControls.SettingControls +{ + + public class Values : DataEditorSettingType + { + + private Panel p = new Panel(); + private TextBox tb = new TextBox(); + + + public override string Value + { + get + { + return tb.Text; + } + set + { + tb.Text = value; + } + } + + public override System.Web.UI.Control RenderControl(DataEditorSetting sender) + { + tb.ID = sender.GetName(); + tb.CssClass = "valuesInput"; + tb.Attributes.Add("style", "display:none;"); + + + string html = "
"; + + html += "
"; + + html += ""; + html += " Add Value"; + + + p.Controls.Add(new System.Web.UI.LiteralControl("
")); + p.Controls.Add(new System.Web.UI.LiteralControl(html)); + p.Controls.Add(tb); + p.Controls.Add(new System.Web.UI.LiteralControl("
")); + + + System.Web.UI.Page page = (System.Web.UI.Page)HttpContext.Current.Handler; + + + page.ClientScript.RegisterClientScriptInclude( + "umbraco.editorControls.SettingControls.js.Values.js", + page.ClientScript.GetWebResourceUrl(typeof(Values), "umbraco.editorControls.SettingControls.js.Values.js")); + + + HtmlHead head = (HtmlHead)page.Header; + HtmlLink link = new HtmlLink(); + link.Attributes.Add("href", page.ClientScript.GetWebResourceUrl(typeof(Values), "umbraco.editorControls.SettingControls.css.Values.css")); + link.Attributes.Add("type", "text/css"); + link.Attributes.Add("rel", "stylesheet"); + head.Controls.Add(link); + + + return p; + } + } +} \ No newline at end of file diff --git a/components/editorControls/SettingControls/css/Values.css b/components/editorControls/SettingControls/css/Values.css new file mode 100644 index 0000000000..a5dda6905f --- /dev/null +++ b/components/editorControls/SettingControls/css/Values.css @@ -0,0 +1,15 @@ +.valuesDataEditorSettingType .value +{ + padding-bottom:5px; +} + +.valuesDataEditorSettingType .value .del +{ + color:Red; + cursor:pointer; +} + +.valuesDataEditorSettingType .value .handle +{ + cursor:move; +} \ No newline at end of file diff --git a/components/editorControls/SettingControls/js/Values.js b/components/editorControls/SettingControls/js/Values.js new file mode 100644 index 0000000000..66b372261e --- /dev/null +++ b/components/editorControls/SettingControls/js/Values.js @@ -0,0 +1,183 @@ +jQuery(document).ready(function () { + + + + jQuery(".valuesDataEditorSettingType").each(function () { + + var vals = jQuery(".valuesInput", this).val(); + + var values = jQuery(".values", this); + + var vals_array = vals.split(";"); + var part_num = 0; + while (part_num < vals_array.length) { + + if (vals_array[part_num] != "") { + var existingValue = "
" + vals_array[part_num] + " Delete Drag
"; + + values.append(existingValue); + } + part_num++; + } + + }); + + jQuery(".valuesDataEditorSettingType .value .del").click(function () { + jQuery(this).parent().remove(); + valuesDataEditorSettingTypeResetValues(); + }); + + + jQuery(".valuesDataEditorSettingType .value span").valuesInlineEdit(); + + + jQuery(".valuesDataEditorSettingType .values").sortable({ + handle : '.handle', + update : function () { + + valuesDataEditorSettingTypeResetValues(); + + } + }); + +}); + +function valuesDataEditorSettingTypeAddValue(sender) { + + + var valuesDataEditorSettingType = jQuery(sender).parent(); + + var value = jQuery(".valueInput", valuesDataEditorSettingType).val(); + + if (value != "") { + + var values = jQuery(".values", valuesDataEditorSettingType); + + var newValue = "
" + value + " Delete Drag
"; + + values.append(newValue); + + jQuery(".valuesDataEditorSettingType .value span").valuesInlineEdit(); + + jQuery(".valueInput", valuesDataEditorSettingType).val(""); + + + valuesDataEditorSettingTypeSetValues(values, jQuery(".valuesInput", valuesDataEditorSettingType)); + } + + + jQuery(".valuesDataEditorSettingType .value .del").click(function () { + jQuery(this).parent().remove(); + valuesDataEditorSettingTypeResetValues(); + }); + + jQuery(".valuesDataEditorSettingType .values").sortable({ + handle : '.handle', + update : function () { + + valuesDataEditorSettingTypeResetValues(); + + } + }); + +} + +function valuesDataEditorSettingTypeSetValues(valuesContainer,valuesInput) { + + var vals = ""; + jQuery(".value", valuesContainer).each(function () { + + vals += jQuery("span",this).html() + ";"; + }); + + valuesInput.val(vals); +} + +function valuesDataEditorSettingTypeResetValues() { + jQuery(".valuesDataEditorSettingType").each(function () { + + valuesDataEditorSettingTypeSetValues(jQuery(".values", this), jQuery(".valuesInput", this)); + }); +} + + + +(function ($) { + + $.fn.valuesInlineEdit = function (options) { + + options = $.extend({ + hover: 'hover', + value: '', + save: '', + placeholder: 'Click to edit' + }, options); + + return $.each(this, function () { + $.valuesInlineEdit(this, options); + }); + } + + $.valuesInlineEdit = function (obj, options) { + + var self = $(obj), + placeholderHtml = '' + options.placeholder + ''; + + self.value = function (newValue) { + if (arguments.length) { + self.data('value', $(newValue).hasClass('inlineEdit-placeholder') ? '' : newValue); + } + return self.data('value'); + } + + self.value($.trim(self.text()) || options.value); + + self.bind('click', function (event) { + var $this = $(event.target); + + if ($this.is(self[0].tagName) || $this.hasClass('inlineEdit-placeholder')) { + self + .html('') + .find('input') + .bind('blur', function () { + if ($this.children('input').val().length > 0) { + + try { + self.value($this.children('input').val()); + + + + } catch (err) { } + + + } + else { + self.value('Click to edit'); + } + if (self.timer) { + window.clearTimeout(self.timer); + } + self.timer = window.setTimeout(function () { + self.html(self.value() || placeholderHtml); + self.removeClass(options.hover); + valuesDataEditorSettingTypeResetValues(); + }, 200); + }) + .focus(); + } + }) + .hover( + function () { + $(this).addClass(options.hover); + }, + function () { + $(this).removeClass(options.hover); + } + ); + + if (!self.value()) { + self.html($(placeholderHtml)); + } + } + +})(jQuery); \ No newline at end of file diff --git a/components/editorControls/umbraco.editorControls.csproj b/components/editorControls/umbraco.editorControls.csproj index 9f7e84b9e1..c9ce3321f7 100644 --- a/components/editorControls/umbraco.editorControls.csproj +++ b/components/editorControls/umbraco.editorControls.csproj @@ -299,6 +299,27 @@ + + + + + + + + + + + + + + + + + + + + + Code @@ -396,7 +417,10 @@ + + + diff --git a/umbraco/cms/businesslogic/skinning/ProviderBase.cs b/umbraco/cms/businesslogic/ProviderBase.cs similarity index 80% rename from umbraco/cms/businesslogic/skinning/ProviderBase.cs rename to umbraco/cms/businesslogic/ProviderBase.cs index 9b6eed8279..0a6ca7052f 100644 --- a/umbraco/cms/businesslogic/skinning/ProviderBase.cs +++ b/umbraco/cms/businesslogic/ProviderBase.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -namespace umbraco.cms.businesslogic.skinning +namespace umbraco.cms.businesslogic { public abstract class ProviderBase { diff --git a/umbraco/cms/businesslogic/datatype/BaseDataType.cs b/umbraco/cms/businesslogic/datatype/BaseDataType.cs index 3f842fd39c..58efadb850 100644 --- a/umbraco/cms/businesslogic/datatype/BaseDataType.cs +++ b/umbraco/cms/businesslogic/datatype/BaseDataType.cs @@ -3,6 +3,7 @@ using System.Data; using umbraco.DataLayer; using umbraco.BusinessLogic; +using System.Collections.Generic; namespace umbraco.cms.businesslogic.datatype @@ -113,5 +114,52 @@ namespace umbraco.cms.businesslogic.datatype return "dataNvarchar"; } } + + internal bool HasSettings() + { + bool hasSettings = false; + foreach (System.Reflection.PropertyInfo p in this.GetType().GetProperties()) + { + object[] o = p.GetCustomAttributes(typeof(DataEditorSetting), true); + + if (o.Length > 0) + { + hasSettings = true; + break; + } + } + + return hasSettings; + } + + internal Dictionary Settings() + { + Dictionary s = new Dictionary(); + + foreach (System.Reflection.PropertyInfo p in this.GetType().GetProperties()) + { + + object[] o = p.GetCustomAttributes(typeof(DataEditorSetting), true); + + if (o.Length > 0) + s.Add(p.Name, (DataEditorSetting)o[0]); + } + + return s; + } + + internal void LoadSettings(List> settings) + { + foreach (Setting setting in settings) + { + try + { + this.GetType().InvokeMember(setting.Key, System.Reflection.BindingFlags.SetProperty, null, this, new object[] { setting.Value }); + + } + catch (MissingMethodException ex) { } + } + } + } } diff --git a/umbraco/cms/businesslogic/datatype/DataEditorSetting.cs b/umbraco/cms/businesslogic/datatype/DataEditorSetting.cs new file mode 100644 index 0000000000..1f85f204ef --- /dev/null +++ b/umbraco/cms/businesslogic/datatype/DataEditorSetting.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Reflection; + +namespace umbraco.cms.businesslogic.datatype +{ + [System.AttributeUsage(System.AttributeTargets.Property, AllowMultiple = false)] + public class DataEditorSetting: System.Attribute + { + string name; + public string description; + public string control; + public string assembly; + public string prevalues; + + public DataEditorSetting(string name) + { + this.name = name; + description = ""; + control = "umbraco.editorControls.SettingControls.TextField"; + assembly = "umbraco.editorControls"; + prevalues = ""; + } + + public string GetName() + { + return name; + } + + public List GetPrevalues() + { + List list = new List(); + list.AddRange(prevalues.Split(',')); + + return list; + } + + public DataEditorSettingType GetDataEditorSettingType() + { + Assembly a = string.IsNullOrEmpty(assembly) ? Assembly.GetExecutingAssembly() : Assembly.Load(assembly); + DataEditorSettingType dst = (DataEditorSettingType)a.CreateInstance(control); + + if (dst != null) + dst.Prevalues = GetPrevalues(); + + return dst; + } + } +} diff --git a/umbraco/cms/businesslogic/datatype/DataEditorSettingType.cs b/umbraco/cms/businesslogic/datatype/DataEditorSettingType.cs new file mode 100644 index 0000000000..750054285a --- /dev/null +++ b/umbraco/cms/businesslogic/datatype/DataEditorSettingType.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace umbraco.cms.businesslogic.datatype +{ + public abstract class DataEditorSettingType : ProviderBase, IDataEditorSettingType + { + public virtual string Value { get; set; } + public abstract System.Web.UI.Control RenderControl(DataEditorSetting setting); + + private List m_prevalues = new List(); + public List Prevalues + { + get { return m_prevalues; } + set { m_prevalues = value; } + } + } +} diff --git a/umbraco/cms/businesslogic/datatype/DataEditorSettingsStorage.cs b/umbraco/cms/businesslogic/datatype/DataEditorSettingsStorage.cs new file mode 100644 index 0000000000..f61a0e7109 --- /dev/null +++ b/umbraco/cms/businesslogic/datatype/DataEditorSettingsStorage.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using umbraco.DataLayer; + +namespace umbraco.cms.businesslogic.datatype +{ + public class DataEditorSettingsStorage + { + private ISqlHelper sqlHelper; + + public DataEditorSettingsStorage() + { + init( DataLayerHelper.CreateSqlHelper(umbraco.GlobalSettings.DbDSN)); + } + + private void init(ISqlHelper connection) { + sqlHelper = connection; + } + + public List> GetSettings(int dataTypeNodeID) + { + + string sql = "select * from cmsDataTypePreValues where datatypenodeid = @datatypenodeid"; + IRecordsReader settingsReader = sqlHelper.ExecuteReader(sql, sqlHelper.CreateParameter("@datatypenodeid", dataTypeNodeID)); + + List> settings = new List>(); + + while (settingsReader.Read()) + { + Setting setting = new Setting(); + setting.Key = settingsReader.GetString("alias"); + setting.Value = settingsReader.GetString("value"); + settings.Add(setting); + } + + settingsReader.Dispose(); + + return settings; + } + + + public void ClearSettings(int dataTypeNodeID) + { + string sql = "delete from cmsDataTypePreValues where datatypenodeid = @datatypenodeid"; + sqlHelper.ExecuteNonQuery(sql, sqlHelper.CreateParameter("@datatypenodeid", dataTypeNodeID)); + } + + + public void InsertSettings(int dataTypeNodeID, List> settings) + { + int i = 0; + foreach (Setting s in settings) + { + string sql = "insert into cmsDataTypePreValues (datatypenodeid,[value],sortorder,alias) values (@datatypenodeid,@value,@sortorder,@alias)"; + sqlHelper.ExecuteNonQuery(sql, + sqlHelper.CreateParameter("@datatypenodeid", dataTypeNodeID), + sqlHelper.CreateParameter("@alias", s.Key), + sqlHelper.CreateParameter("@value", s.Value), + sqlHelper.CreateParameter("@sortorder", i)); + + i++; + } + + } + + + public void InsertSetting(int dataTypeNodeID, string key, string value, int sortOrder) + { + + string sql = "insert into cmsDataTypePreValues (datatypenodeid,[value],sortorder,alias) values (@datatypenodeid,@value,@sortorder,@alias)"; + sqlHelper.ExecuteNonQuery(sql, + sqlHelper.CreateParameter("@datatypenodeid", dataTypeNodeID), + sqlHelper.CreateParameter("@alias", key), + sqlHelper.CreateParameter("@value", value), + sqlHelper.CreateParameter("@sortorder", sortOrder)); + + } + + public void UpdateSettings(int dataTypeNodeID, List> settings) + { + ClearSettings(dataTypeNodeID); + InsertSettings(dataTypeNodeID, settings); + } + + #region IDisposable Members + + public void Dispose() + { + sqlHelper.Dispose(); + sqlHelper = null; + } + + #endregion + } + + public struct Setting + { + public K Key { get; set; } + public V Value { get; set; } + } +} diff --git a/umbraco/cms/businesslogic/datatype/DefaultPreValueEditor.cs b/umbraco/cms/businesslogic/datatype/DefaultPreValueEditor.cs index fe6e197c91..b7268017d2 100644 --- a/umbraco/cms/businesslogic/datatype/DefaultPreValueEditor.cs +++ b/umbraco/cms/businesslogic/datatype/DefaultPreValueEditor.cs @@ -5,6 +5,7 @@ using System.Web.UI.WebControls; using umbraco.interfaces; using umbraco.BusinessLogic; using umbraco.DataLayer; +using System.Collections.Generic; namespace umbraco.cms.businesslogic.datatype { @@ -24,6 +25,10 @@ namespace umbraco.cms.businesslogic.datatype private string _prevalue; private bool _displayTextBox; + + private Dictionary dtSettings = new Dictionary(); + + public static ISqlHelper SqlHelper { get { return Application.SqlHelper; } @@ -39,32 +44,49 @@ namespace umbraco.cms.businesslogic.datatype // state it knows its datatypedefinitionid _displayTextBox = DisplayTextBox; _datatype = DataType; - setupChildControls(); + //setupChildControls(); } - private void setupChildControls() - { - _dropdownlist = new DropDownList(); - _dropdownlist.ID = "dbtype"; + //private void setupChildControls() + //{ + // DataEditorPropertyPanel pnlType = new DataEditorPropertyPanel(); + // pnlType.Text = ui.Text("dataBaseDatatype"); - _textbox = new TextBox(); - _textbox.ID = "prevalues"; - _textbox.Visible = _displayTextBox; + // _dropdownlist = new DropDownList(); + // _dropdownlist.ID = "dbtype"; - // put the childcontrols in context - ensuring that - // the viewstate is persisted etc. - Controls.Add(_textbox); - Controls.Add(_dropdownlist); + // _dropdownlist.Items.Add(DBTypes.Date.ToString()); + // _dropdownlist.Items.Add(DBTypes.Integer.ToString()); + // _dropdownlist.Items.Add(DBTypes.Ntext.ToString()); + // _dropdownlist.Items.Add(DBTypes.Nvarchar.ToString()); - _dropdownlist.Items.Add(DBTypes.Date.ToString()); - _dropdownlist.Items.Add(DBTypes.Integer.ToString()); - _dropdownlist.Items.Add(DBTypes.Ntext.ToString()); - _dropdownlist.Items.Add(DBTypes.Nvarchar.ToString()); - } + // DataEditorPropertyPanel pnlPrevalue = new DataEditorPropertyPanel(); + // pnlPrevalue.Text = ui.Text("prevalue"); + + // _textbox = new TextBox(); + // _textbox.ID = "prevalues"; + // _textbox.Visible = _displayTextBox; + + // // put the childcontrols in context - ensuring that + // // the viewstate is persisted etc. + + // pnlType.Controls.Add(_dropdownlist); + // Controls.Add(pnlType); + + // if (_displayTextBox) + // { + // pnlPrevalue.Controls.Add(_textbox); + // Controls.Add(pnlPrevalue); + // } + + + //} protected override void OnLoad(EventArgs e) { + LoadSettings(); + base.OnLoad(e); if (!Page.IsPostBack) { @@ -161,41 +183,177 @@ namespace umbraco.cms.businesslogic.datatype // If the prevalue editor has an prevalue textbox - save the textbox value as the prevalue Prevalue = _textbox.Text; } - } - protected override void Render(HtmlTextWriter writer) - { - writer.Write("
" + ui.Text("dataBaseDatatype") + "
"); - _dropdownlist.RenderControl(writer); - writer.Write("
"); + DataEditorSettingsStorage ss = new DataEditorSettingsStorage(); + ss.ClearSettings(_datatype.DataTypeDefinitionId); - if (_displayTextBox) + int i = 0; + foreach (KeyValuePair k in dtSettings) { - writer.Write("
" + ui.Text("prevalue") + "
"); - _textbox.RenderControl(writer); - writer.Write("
"); + ss.InsertSetting(_datatype.DataTypeDefinitionId, k.Key, k.Value.Value, i); + i++; + } - /* - writer.WriteLine("
"); - writer.WriteLine("Database datatype"); - _dropdownlist.RenderControl(writer); - writer.Write(""); - if (_displayTextBox) - writer.WriteLine("Prevalue: "); - _textbox.RenderControl(writer); - writer.WriteLine(""); - writer.Write("
"); - */ - + ss.Dispose(); } + //protected override void Render(HtmlTextWriter writer) + //{ + // writer.Write("
" + ui.Text("dataBaseDatatype") + "
"); + // _dropdownlist.RenderControl(writer); + // writer.Write("
"); + + + // if (_displayTextBox) + // { + // writer.Write("
" + ui.Text("prevalue") + "
"); + // _textbox.RenderControl(writer); + // writer.Write("
"); + // } + + // /* + // writer.WriteLine("
"); + // writer.WriteLine("Database datatype"); + // _dropdownlist.RenderControl(writer); + // writer.Write(""); + // if (_displayTextBox) + // writer.WriteLine("Prevalue: "); + // _textbox.RenderControl(writer); + // writer.WriteLine(""); + // writer.Write("
"); + // */ + + //} + [Obsolete("Use the PreValues class for data access instead")] public static string GetPrevalueFromId(int Id) { return SqlHelper.ExecuteScalar("Select [value] from cmsDataTypePreValues where id = @id", SqlHelper.CreateParameter("@id", Id)); } + + + + protected void LoadSettings() + { + DataEditorPropertyPanel pnlType = new DataEditorPropertyPanel(); + pnlType.Text = ui.Text("dataBaseDatatype"); + + _dropdownlist = new DropDownList(); + _dropdownlist.ID = "dbtype"; + + _dropdownlist.Items.Add(DBTypes.Date.ToString()); + _dropdownlist.Items.Add(DBTypes.Integer.ToString()); + _dropdownlist.Items.Add(DBTypes.Ntext.ToString()); + _dropdownlist.Items.Add(DBTypes.Nvarchar.ToString()); + + DataEditorPropertyPanel pnlPrevalue = new DataEditorPropertyPanel(); + pnlPrevalue.Text = ui.Text("prevalue"); + + _textbox = new TextBox(); + _textbox.ID = "prevalues"; + _textbox.Visible = _displayTextBox; + + // put the childcontrols in context - ensuring that + // the viewstate is persisted etc. + + pnlType.Controls.Add(_dropdownlist); + Controls.Add(pnlType); + + if (_displayTextBox) + { + pnlPrevalue.Controls.Add(_textbox); + Controls.Add(pnlPrevalue); + } + + + foreach (KeyValuePair kv in _datatype.Settings()) + { + DataEditorSettingType dst = kv.Value.GetDataEditorSettingType(); + dtSettings.Add(kv.Key, dst); + + DataEditorPropertyPanel panel = new DataEditorPropertyPanel(); + panel.Text = kv.Value.GetName(); + panel.Text += "
" + kv.Value.description + ""; + + + if (_datatype.HasSettings()) + { + DataEditorSettingsStorage ss = new DataEditorSettingsStorage(); + + List> s = ss.GetSettings(_datatype.DataTypeDefinitionId); + ss.Dispose(); + + if (s.Find(set => set.Key == kv.Key).Value != null) + dst.Value = s.Find(set => set.Key == kv.Key).Value; + + } + + panel.Controls.Add(dst.RenderControl(kv.Value)); + + this.Controls.Add(panel); + } + + } + } + + + public class DataEditorPropertyPanel : System.Web.UI.WebControls.Panel + { + public DataEditorPropertyPanel() + { + + } + + private string m_Text = string.Empty; + public string Text + { + get { return m_Text; } + set { m_Text = value; } + } + + + protected override void OnLoad(System.EventArgs EventArguments) + { + } + + protected override void Render(System.Web.UI.HtmlTextWriter writer) + { + + this.CreateChildControls(); + string styleString = ""; + + foreach (string key in this.Style.Keys) + { + styleString += key + ":" + this.Style[key] + ";"; + } + + writer.WriteLine("
"); + if (m_Text != string.Empty) + { + writer.WriteLine("
" + m_Text + "
"); + writer.WriteLine("
"); + } + + try + { + this.RenderChildren(writer); + } + catch (Exception ex) + { + writer.WriteLine("Error creating control
"); + writer.WriteLine(ex.ToString()); + } + + if (m_Text != string.Empty) + writer.WriteLine("
"); + + writer.WriteLine("
"); + + + } + } } diff --git a/umbraco/cms/businesslogic/datatype/IDataEditorSettingType.cs b/umbraco/cms/businesslogic/datatype/IDataEditorSettingType.cs new file mode 100644 index 0000000000..2351863b88 --- /dev/null +++ b/umbraco/cms/businesslogic/datatype/IDataEditorSettingType.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace umbraco.cms.businesslogic.datatype +{ + public interface IDataEditorSettingType + { + string Value { get; set; } + System.Web.UI.Control RenderControl(DataEditorSetting setting); + } +} diff --git a/umbraco/cms/umbraco.cms.csproj b/umbraco/cms/umbraco.cms.csproj index 27d40d54eb..ef803359d6 100644 --- a/umbraco/cms/umbraco.cms.csproj +++ b/umbraco/cms/umbraco.cms.csproj @@ -196,7 +196,11 @@ + + + + @@ -221,7 +225,7 @@ - +