diff --git a/.hgignore b/.hgignore index 4df9ef46fd..1f2e0a7968 100644 --- a/.hgignore +++ b/.hgignore @@ -44,3 +44,4 @@ build/UmbracoCms.zip src/Umbraco.Tests/config/applications.config src/Umbraco.Tests/config/trees.config src/Umbraco.Web.UI/web.config +*.orig diff --git a/src/umbraco.cms/businesslogic/datatype/AbstractDataEditorControl.cs b/src/umbraco.cms/businesslogic/datatype/AbstractDataEditorControl.cs index 313073440c..a5fb28fed9 100644 --- a/src/umbraco.cms/businesslogic/datatype/AbstractDataEditorControl.cs +++ b/src/umbraco.cms/businesslogic/datatype/AbstractDataEditorControl.cs @@ -26,7 +26,13 @@ namespace umbraco.cms.businesslogic.datatype /// /// The save event handler /// - public event EventHandler OnSave; + /// The instance containing the event data. + public delegate void SaveEventHandler(EventArgs e); + + /// + /// Occurs when [on save]. + /// + public event SaveEventHandler OnSave; /// /// Gets or sets the control. @@ -141,7 +147,7 @@ namespace umbraco.cms.businesslogic.datatype { if (this.OnSave != null) { - this.OnSave(this, e); + this.OnSave(e); } } } diff --git a/src/umbraco.editorControls/MultiNodeTreePicker/MNTP_DataType.cs b/src/umbraco.editorControls/MultiNodeTreePicker/MNTP_DataType.cs index 2cc5de8052..f37ff146e1 100644 --- a/src/umbraco.editorControls/MultiNodeTreePicker/MNTP_DataType.cs +++ b/src/umbraco.editorControls/MultiNodeTreePicker/MNTP_DataType.cs @@ -13,9 +13,9 @@ namespace umbraco.editorControls.MultiNodeTreePicker public class MNTP_DataType : AbstractDataEditor { - /// - /// Initializes a new instance of the class. - /// + /// + /// Initializes a new instance of the class. + /// public MNTP_DataType() { RenderControl = m_Tree; @@ -30,12 +30,12 @@ namespace umbraco.editorControls.MultiNodeTreePicker /// /// The internal tree picker control to render /// - readonly MNTP_DataEditor m_Tree = new MNTP_DataEditor(); + private readonly MNTP_DataEditor m_Tree = new MNTP_DataEditor(); /// /// Internal pre value editor to render /// - MNTP_PrevalueEditor m_PreValues; + private MNTP_PrevalueEditor m_PreValues; /// /// @@ -65,7 +65,9 @@ namespace umbraco.editorControls.MultiNodeTreePicker { if (this.m_Data == null) { - m_Data = StoreAsCommaDelimited ? new umbraco.cms.businesslogic.datatype.DefaultData(this) : new XmlData(this); + m_Data = StoreAsCommaDelimited + ? new umbraco.cms.businesslogic.datatype.DefaultData(this) + : new XmlData(this); } return m_Data; @@ -89,8 +91,8 @@ namespace umbraco.editorControls.MultiNodeTreePicker /// /// /// - void Tree_Init(object sender, EventArgs e) - { + private void Tree_Init(object sender, EventArgs e) + { var preVal = ((MNTP_PrevalueEditor)PrevalueEditor); m_Tree.TreeToRender = preVal.SelectedTreeType; m_Tree.XPathFilter = preVal.XPathFilter; @@ -107,7 +109,7 @@ namespace umbraco.editorControls.MultiNodeTreePicker m_Tree.ControlHeight = preVal.ControlHeight; m_Tree.MinNodeCount = preVal.MinNodeCount; - + } /// @@ -115,7 +117,7 @@ namespace umbraco.editorControls.MultiNodeTreePicker /// /// /// - void Tree_Load(object sender, EventArgs e) + private void Tree_Load(object sender, EventArgs e) { if (!m_Tree.Page.IsPostBack) { @@ -154,7 +156,7 @@ namespace umbraco.editorControls.MultiNodeTreePicker } } } - + } /// @@ -162,7 +164,7 @@ namespace umbraco.editorControls.MultiNodeTreePicker /// /// The source of the event. /// The instance containing the event data. - void DataEditorControl_OnSave(object sender, EventArgs e) + private void DataEditorControl_OnSave(EventArgs e) { string val; if (StoreAsCommaDelimited) @@ -182,7 +184,10 @@ namespace umbraco.editorControls.MultiNodeTreePicker /// public override IDataPrevalue PrevalueEditor { - get { return m_PreValues ?? (m_PreValues = new MNTP_PrevalueEditor(this)); } + get + { + return m_PreValues ?? (m_PreValues = new MNTP_PrevalueEditor(this)); + } } internal const string PersistenceCookieName = "MultiNodeTreePicker"; @@ -203,6 +208,5 @@ namespace umbraco.editorControls.MultiNodeTreePicker HttpContext.Current.Response.Cookies[PersistenceCookieName].Expires = DateTime.Now.AddDays(-1); } } - } } diff --git a/src/umbraco.editorControls/MultipleTextstring/MultipleTextstringDataType.cs b/src/umbraco.editorControls/MultipleTextstring/MultipleTextstringDataType.cs index c83e73e544..7a94406e30 100644 --- a/src/umbraco.editorControls/MultipleTextstring/MultipleTextstringDataType.cs +++ b/src/umbraco.editorControls/MultipleTextstring/MultipleTextstringDataType.cs @@ -4,132 +4,133 @@ using umbraco.interfaces; namespace umbraco.editorControls.MultipleTextstring { - /// - /// Data Editor for the Multiple Textstring data type. - /// - public class MultipleTextstringDataType : AbstractDataEditor - { - /// - /// The control for the Multiple Textstring data-editor. - /// - private MultipleTextstringControl m_Control = new MultipleTextstringControl(); + /// + /// Data Editor for the Multiple Textstring data type. + /// + public class MultipleTextstringDataType : AbstractDataEditor + { + /// + /// The control for the Multiple Textstring data-editor. + /// + private MultipleTextstringControl m_Control = new MultipleTextstringControl(); - /// - /// The Data object for the data-type. - /// - private IData m_Data; + /// + /// The Data object for the data-type. + /// + private IData m_Data; - /// - /// The PreValue Editor for the data-type. - /// - private IDataPrevalue m_PreValueEditor; + /// + /// The PreValue Editor for the data-type. + /// + private IDataPrevalue m_PreValueEditor; - /// - /// Initializes a new instance of the class. - /// - public MultipleTextstringDataType() - { - // set the render control as the placeholder - this.RenderControl = this.m_Control; + /// + /// Initializes a new instance of the class. + /// + public MultipleTextstringDataType() + { + // set the render control as the placeholder + this.RenderControl = this.m_Control; - // assign the initialise event for the control - this.m_Control.Init += new EventHandler(this.m_Control_Init); + // assign the initialise event for the control + this.m_Control.Init += new EventHandler(this.m_Control_Init); - // assign the save event for the data-type/editor - this.DataEditorControl.OnSave += this.DataEditorControl_OnSave; - } + // assign the save event for the data-type/editor + this.DataEditorControl.OnSave += this.DataEditorControl_OnSave; + } - /// - /// Gets the id of the data-type. - /// - /// The id of the data-type. - public override Guid Id - { - get - { - return new Guid(DataTypeGuids.MultipleTextstringId); - } - } + /// + /// Gets the id of the data-type. + /// + /// The id of the data-type. + public override Guid Id + { + get + { + return new Guid(DataTypeGuids.MultipleTextstringId); + } + } - /// - /// Gets the name of the data type. - /// - /// The name of the data type. - public override string DataTypeName - { - get - { - return "Multiple Textstring"; - } - } + /// + /// Gets the name of the data type. + /// + /// The name of the data type. + public override string DataTypeName + { + get + { + return "Multiple Textstring"; + } + } - /// - /// Gets the data for the data-type. - /// - /// The data for the data-type. - public override IData Data - { - get - { - if (this.m_Data == null) - { - this.m_Data = new CsvToXmlData(this, "values", "value", new[] { Environment.NewLine }); - } + /// + /// Gets the data for the data-type. + /// + /// The data for the data-type. + public override IData Data + { + get + { + if (this.m_Data == null) + { + this.m_Data = new CsvToXmlData(this, "values", "value", new[] { Environment.NewLine }); + } - return this.m_Data; - } - } + return this.m_Data; + } + } - /// - /// Gets the prevalue editor. - /// - /// The prevalue editor. - public override IDataPrevalue PrevalueEditor - { - get - { - if (this.m_PreValueEditor == null) - { - this.m_PreValueEditor = new MultipleTextstringPrevalueEditor(this); - } + /// + /// Gets the prevalue editor. + /// + /// The prevalue editor. + public override IDataPrevalue PrevalueEditor + { + get + { + if (this.m_PreValueEditor == null) + { + this.m_PreValueEditor = new MultipleTextstringPrevalueEditor(this); + } - return this.m_PreValueEditor; - } - } + return this.m_PreValueEditor; + } + } - /// - /// Handles the Init event of the control. - /// - /// The source of the event. - /// The instance containing the event data. - private void m_Control_Init(object sender, EventArgs e) - { - var options = ((MultipleTextstringPrevalueEditor)this.PrevalueEditor).GetPreValueOptions(); + /// + /// Handles the Init event of the control. + /// + /// The source of the event. + /// The instance containing the event data. + private void m_Control_Init(object sender, EventArgs e) + { + var options = + ((MultipleTextstringPrevalueEditor)this.PrevalueEditor).GetPreValueOptions(); - if (options == null) - { - // load defaults - options = new MultipleTextstringOptions(true); - } + if (options == null) + { + // load defaults + options = new MultipleTextstringOptions(true); + } - // check if the data value is available... - if (this.Data.Value != null) - { - // set the value of the control - this.m_Control.Values = this.Data.Value.ToString(); - } + // check if the data value is available... + if (this.Data.Value != null) + { + // set the value of the control + this.m_Control.Values = this.Data.Value.ToString(); + } - // set the controls options - this.m_Control.Options = options; - } + // set the controls options + this.m_Control.Options = options; + } - /// - /// Saves the data for the editor control. - /// - /// The instance containing the event data. - private void DataEditorControl_OnSave(object sender, EventArgs e) - { - this.Data.Value = this.m_Control.Values; - } - } + /// + /// Saves the data for the editor control. + /// + /// The instance containing the event data. + private void DataEditorControl_OnSave(EventArgs e) + { + this.Data.Value = this.m_Control.Values; + } + } } diff --git a/src/umbraco.editorControls/Slider/SliderDataType.cs b/src/umbraco.editorControls/Slider/SliderDataType.cs index becbd416df..ccd7ecc6e9 100644 --- a/src/umbraco.editorControls/Slider/SliderDataType.cs +++ b/src/umbraco.editorControls/Slider/SliderDataType.cs @@ -4,153 +4,154 @@ using umbraco.interfaces; namespace umbraco.editorControls.Slider { - /// - /// A jQuery UI Slider data-type for Umbraco. - /// - public class SliderDataType : AbstractDataEditor - { - /// - /// The SliderControl. - /// - private SliderControl m_Control = new SliderControl(); + /// + /// A jQuery UI Slider data-type for Umbraco. + /// + public class SliderDataType : AbstractDataEditor + { + /// + /// The SliderControl. + /// + private SliderControl m_Control = new SliderControl(); - /// - /// The PreValue Editor for the data-type. - /// - private SliderPrevalueEditor m_PreValueEditor; + /// + /// The PreValue Editor for the data-type. + /// + private SliderPrevalueEditor m_PreValueEditor; - /// - /// Initializes a new instance of the class. - /// - public SliderDataType() - : base() - { - // set the render control as the placeholder - this.RenderControl = this.m_Control; + /// + /// Initializes a new instance of the class. + /// + public SliderDataType() + : base() + { + // set the render control as the placeholder + this.RenderControl = this.m_Control; - // assign the initialise event for the placeholder - this.m_Control.Init += new EventHandler(this.m_Control_Init); + // assign the initialise event for the placeholder + this.m_Control.Init += new EventHandler(this.m_Control_Init); - // assign the save event for the data-type/editor - this.DataEditorControl.OnSave += this.DataEditorControl_OnSave; - } + // assign the save event for the data-type/editor + this.DataEditorControl.OnSave += this.DataEditorControl_OnSave; + } - /// - /// Gets the id of the data-type. - /// - /// The id of the data-type. - public override Guid Id - { - get - { - return new Guid(DataTypeGuids.SliderId); - } - } + /// + /// Gets the id of the data-type. + /// + /// The id of the data-type. + public override Guid Id + { + get + { + return new Guid(DataTypeGuids.SliderId); + } + } - /// - /// Gets the name of the data type. - /// - /// The name of the data type. - public override string DataTypeName - { - get - { - return "Slider"; - } - } + /// + /// Gets the name of the data type. + /// + /// The name of the data type. + public override string DataTypeName + { + get + { + return "Slider"; + } + } - /// - /// Gets the prevalue editor. - /// - /// The prevalue editor. - public override IDataPrevalue PrevalueEditor - { - get - { - if (this.m_PreValueEditor == null) - { - this.m_PreValueEditor = new SliderPrevalueEditor(this); - } + /// + /// Gets the prevalue editor. + /// + /// The prevalue editor. + public override IDataPrevalue PrevalueEditor + { + get + { + if (this.m_PreValueEditor == null) + { + this.m_PreValueEditor = new SliderPrevalueEditor(this); + } - return this.m_PreValueEditor; - } - } + return this.m_PreValueEditor; + } + } - /// - /// Handles the Init event of the m_Placeholder control. - /// - /// The source of the event. - /// The instance containing the event data. - private void m_Control_Init(object sender, EventArgs e) - { - // get the slider options from the Prevalue Editor. - var options = ((SliderPrevalueEditor)this.PrevalueEditor).GetPreValueOptions(); + /// + /// Handles the Init event of the m_Placeholder control. + /// + /// The source of the event. + /// The instance containing the event data. + private void m_Control_Init(object sender, EventArgs e) + { + // get the slider options from the Prevalue Editor. + var options = ((SliderPrevalueEditor)this.PrevalueEditor).GetPreValueOptions(); - // set the value of the control (not on PostBack) - if (!this.m_Control.Page.IsPostBack && this.Data.Value != null) - { - var data = this.Data.Value.ToString(); - if (data.Length > 0) - { - double value1, value2; - var values = data.Split(','); + // set the value of the control (not on PostBack) + if (!this.m_Control.Page.IsPostBack && this.Data.Value != null) + { + var data = this.Data.Value.ToString(); + if (data.Length > 0) + { + double value1, value2; + var values = data.Split(','); - if (double.TryParse(values[0], out value1)) - { - options.Value = value1; + if (double.TryParse(values[0], out value1)) + { + options.Value = value1; - if (values.Length > 1 && double.TryParse(values[1], out value2)) - { - options.Value2 = value2; - } - } - } - } + if (values.Length > 1 && double.TryParse(values[1], out value2)) + { + options.Value2 = value2; + } + } + } + } - // set the slider options - this.m_Control.Options = options; - } + // set the slider options + this.m_Control.Options = options; + } - /// - /// Saves the editor control value. - /// - /// The instance containing the event data. - private void DataEditorControl_OnSave(object sender, EventArgs e) - { - // set the values (on PostBack) - var value1 = this.m_Control.Options.MinValue; - var value2 = this.m_Control.Options.MaxValue; - var values = this.m_Control.Text.Split(','); + /// + /// Saves the editor control value. + /// + /// The instance containing the event data. + private void DataEditorControl_OnSave(EventArgs e) + { + // set the values (on PostBack) + var value1 = this.m_Control.Options.MinValue; + var value2 = this.m_Control.Options.MaxValue; + var values = this.m_Control.Text.Split(','); - if (double.TryParse(values[0], out value1)) - { - this.m_Control.Options.Value = value1; + if (double.TryParse(values[0], out value1)) + { + this.m_Control.Options.Value = value1; - if (values.Length > 1 && double.TryParse(values[1], out value2)) - { - this.m_Control.Options.Value2 = value2; - } - } + if (values.Length > 1 && double.TryParse(values[1], out value2)) + { + this.m_Control.Options.Value2 = value2; + } + } - // save the value of the control - if (values.Length > 1 && value2 >= this.m_Control.Options.MinValue && value2 <= this.m_Control.Options.MaxValue) - { - this.Data.Value = string.Concat(value1, ',', value2); - } - else if (value1 >= this.m_Control.Options.MinValue && value1 <= this.m_Control.Options.MaxValue) - { - int value1int; + // save the value of the control + if (values.Length > 1 && value2 >= this.m_Control.Options.MinValue + && value2 <= this.m_Control.Options.MaxValue) + { + this.Data.Value = string.Concat(value1, ',', value2); + } + else if (value1 >= this.m_Control.Options.MinValue && value1 <= this.m_Control.Options.MaxValue) + { + int value1int; - // return an integer instead of double if applicable - if (this.m_Control.Options.DBType == DBTypes.Integer && int.TryParse(value1.ToString(), out value1int)) - { - this.Data.Value = value1int; - } - else - { - this.Data.Value = value1; - } - } - } - } + // return an integer instead of double if applicable + if (this.m_Control.Options.DBType == DBTypes.Integer && int.TryParse(value1.ToString(), out value1int)) + { + this.Data.Value = value1int; + } + else + { + this.Data.Value = value1; + } + } + } + } } \ No newline at end of file