Reverted some changes to AbstractDataEditorControl in 7260 to retain backwards compatibility.
This commit is contained in:
@@ -4,132 +4,133 @@ using umbraco.interfaces;
|
||||
|
||||
namespace umbraco.editorControls.MultipleTextstring
|
||||
{
|
||||
/// <summary>
|
||||
/// Data Editor for the Multiple Textstring data type.
|
||||
/// </summary>
|
||||
public class MultipleTextstringDataType : AbstractDataEditor
|
||||
{
|
||||
/// <summary>
|
||||
/// The control for the Multiple Textstring data-editor.
|
||||
/// </summary>
|
||||
private MultipleTextstringControl m_Control = new MultipleTextstringControl();
|
||||
/// <summary>
|
||||
/// Data Editor for the Multiple Textstring data type.
|
||||
/// </summary>
|
||||
public class MultipleTextstringDataType : AbstractDataEditor
|
||||
{
|
||||
/// <summary>
|
||||
/// The control for the Multiple Textstring data-editor.
|
||||
/// </summary>
|
||||
private MultipleTextstringControl m_Control = new MultipleTextstringControl();
|
||||
|
||||
/// <summary>
|
||||
/// The Data object for the data-type.
|
||||
/// </summary>
|
||||
private IData m_Data;
|
||||
/// <summary>
|
||||
/// The Data object for the data-type.
|
||||
/// </summary>
|
||||
private IData m_Data;
|
||||
|
||||
/// <summary>
|
||||
/// The PreValue Editor for the data-type.
|
||||
/// </summary>
|
||||
private IDataPrevalue m_PreValueEditor;
|
||||
/// <summary>
|
||||
/// The PreValue Editor for the data-type.
|
||||
/// </summary>
|
||||
private IDataPrevalue m_PreValueEditor;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MultipleTextstringDataType"/> class.
|
||||
/// </summary>
|
||||
public MultipleTextstringDataType()
|
||||
{
|
||||
// set the render control as the placeholder
|
||||
this.RenderControl = this.m_Control;
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MultipleTextstringDataType"/> class.
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the id of the data-type.
|
||||
/// </summary>
|
||||
/// <value>The id of the data-type.</value>
|
||||
public override Guid Id
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Guid(DataTypeGuids.MultipleTextstringId);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the id of the data-type.
|
||||
/// </summary>
|
||||
/// <value>The id of the data-type.</value>
|
||||
public override Guid Id
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Guid(DataTypeGuids.MultipleTextstringId);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the data type.
|
||||
/// </summary>
|
||||
/// <value>The name of the data type.</value>
|
||||
public override string DataTypeName
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Multiple Textstring";
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the name of the data type.
|
||||
/// </summary>
|
||||
/// <value>The name of the data type.</value>
|
||||
public override string DataTypeName
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Multiple Textstring";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the data for the data-type.
|
||||
/// </summary>
|
||||
/// <value>The data for the data-type.</value>
|
||||
public override IData Data
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_Data == null)
|
||||
{
|
||||
this.m_Data = new CsvToXmlData(this, "values", "value", new[] { Environment.NewLine });
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the data for the data-type.
|
||||
/// </summary>
|
||||
/// <value>The data for the data-type.</value>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the prevalue editor.
|
||||
/// </summary>
|
||||
/// <value>The prevalue editor.</value>
|
||||
public override IDataPrevalue PrevalueEditor
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_PreValueEditor == null)
|
||||
{
|
||||
this.m_PreValueEditor = new MultipleTextstringPrevalueEditor(this);
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the prevalue editor.
|
||||
/// </summary>
|
||||
/// <value>The prevalue editor.</value>
|
||||
public override IDataPrevalue PrevalueEditor
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_PreValueEditor == null)
|
||||
{
|
||||
this.m_PreValueEditor = new MultipleTextstringPrevalueEditor(this);
|
||||
}
|
||||
|
||||
return this.m_PreValueEditor;
|
||||
}
|
||||
}
|
||||
return this.m_PreValueEditor;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Init event of the control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
|
||||
private void m_Control_Init(object sender, EventArgs e)
|
||||
{
|
||||
var options = ((MultipleTextstringPrevalueEditor)this.PrevalueEditor).GetPreValueOptions<MultipleTextstringOptions>();
|
||||
/// <summary>
|
||||
/// Handles the Init event of the control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
|
||||
private void m_Control_Init(object sender, EventArgs e)
|
||||
{
|
||||
var options =
|
||||
((MultipleTextstringPrevalueEditor)this.PrevalueEditor).GetPreValueOptions<MultipleTextstringOptions>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data for the editor control.
|
||||
/// </summary>
|
||||
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
|
||||
private void DataEditorControl_OnSave(object sender, EventArgs e)
|
||||
{
|
||||
this.Data.Value = this.m_Control.Values;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Saves the data for the editor control.
|
||||
/// </summary>
|
||||
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
|
||||
private void DataEditorControl_OnSave(EventArgs e)
|
||||
{
|
||||
this.Data.Value = this.m_Control.Values;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user