/// <summary>
        /// Method for performing special actions <b>before</b> creating the <see cref="IDataType" /> editor.
        /// </summary>
        /// <param name="dataType">The <see cref="IDataType" /> instance.</param>
        /// <param name="eventArgs">The <see cref="DataTypeLoadEventArgs"/> instance containing the event data.</param>
        /// <remarks>Called <b>before</b> the grid creates the editor controls for the specified <see cref="IDataType" />.</remarks>
        public override void Initialize(EnumDropDownListDataType dataType, DataTypeLoadEventArgs eventArgs)
        {
            var editor = dataType.DataEditor.Editor as EnumDropDownListDataEditor;

            if (editor != null)
            {
                // Set selected value
                if (dataType.Data.Value != null)
                {
                    // Ensure stored values are set
                    editor.DropDownList.Load += (sender, args) =>
                    {
                        if (editor.DropDownList.SelectedValue == "-1")
                        {
                            // Get selected items from Node Name or Node Id
                            var dropDownListItem = editor.DropDownList.Items.FindByValue(dataType.Data.Value.ToString());

                            if (dropDownListItem != null)
                            {
                                // Reset selected item
                                editor.DropDownList.SelectedItem.Selected = false;

                                // Set new selected item
                                dropDownListItem.Selected = true;
                            }
                        }
                    };
                }
            }
        }
예제 #2
0
 /// <summary>
 /// Method for performing special actions while creating the <see cref="IDataType">datatype</see> editor.
 /// </summary>
 /// <param name="dataType">The <see cref="IDataType">datatype</see> instance.</param>
 /// <param name="eventArgs">The <see cref="DataTypeLoadEventArgs"/> instance containing the event data.</param>
 /// <remarks>Called when the grid creates the editor controls for the specified <see cref="IDataType">datatype</see>.</remarks>
 public override void Initialize(MemberPickerDataType dataType, DataTypeLoadEventArgs eventArgs)
 {
     if (dataType.Data.Value == null)
     {
         dataType.Data.Value = string.Empty;
     }
 }
예제 #3
0
 /// <summary>
 /// Method for performing special actions while creating the <see cref="IDataType">datatype</see> editor.
 /// </summary>
 /// <param name="dataType">The <see cref="IDataType">datatype</see> instance.</param>
 /// <param name="eventArgs">The <see cref="DataTypeLoadEventArgs"/> instance containing the event data.</param>
 /// <remarks>Called when the grid creates the editor controls for the specified <see cref="IDataType">datatype</see>.</remarks>
 public override void Configure(UrlPickerDataType dataType, DataTypeLoadEventArgs eventArgs)
 {
     // Deserialize stored value
     if (dataType.Data.Value != null && !string.IsNullOrEmpty(dataType.Data.Value.ToString()) && dataType.ContentEditor.State == null)
     {
         dataType.ContentEditor.State = UrlPickerState.Deserialize((string)dataType.Data.Value) ?? new UrlPickerState();
     }
 }
예제 #4
0
        /// <summary>
        /// Method for performing special actions <b>before</b> creating the <see cref="IDataType" /> editor.
        /// </summary>
        /// <param name="dataType">The <see cref="IDataType" /> instance.</param>
        /// <param name="eventArgs">The <see cref="DataTypeLoadEventArgs"/> instance containing the event data.</param>
        /// <remarks>Called <b>before</b> the grid creates the editor controls for the specified <see cref="IDataType" />.</remarks>
        public override void Initialize(XPathAutoCompleteDataType dataType, DataTypeLoadEventArgs eventArgs)
        {
            var editor = dataType.DataEditor as XPathAutoCompleteDataEditor;

            if (editor != null && dataType.Data.Value != null)
            {
                editor.SelectedItemsHiddenField.Value = dataType.Data.Value.ToString();
            }
        }
        /// <summary>
        /// Method for performing special actions <b>before</b> creating the <see cref="IDataType" /> editor.
        /// </summary>
        /// <param name="dataType">The <see cref="IDataType" /> instance.</param>
        /// <param name="eventArgs">The <see cref="DataTypeLoadEventArgs"/> instance containing the event data.</param>
        /// <remarks>Called <b>before</b> the grid creates the editor controls for the specified <see cref="IDataType" />.</remarks>
        public override void Initialize(EnumCheckBoxListDataType dataType, DataTypeLoadEventArgs eventArgs)
        {
            var editor = dataType.DataEditor.Editor as EnumCheckBoxListDataEditor;

            if (editor != null && dataType.Data.Value != null)
            {
                // Ensure stored values are set
                editor.CheckBoxList.Load += (sender, args) =>
                {
                    if (editor.CheckBoxList.SelectedItem == null)
                    {
                        editor.SetSelectedValues(dataType.Data.Value.ToString());
                    }
                };
            }
        }
예제 #6
0
        /// <summary>
        /// Method for performing special actions while creating the <paramref name="dataType" /> editor.
        /// </summary>
        /// <param name="dataType">The <paramref name="dataType" /> instance.</param>
        /// <param name="eventArgs">The <see cref="DataTypeLoadEventArgs"/> instance containing the event data.</param>
        /// <remarks>Called when the grid creates the editor controls for the specified <paramref name="dataType" />.</remarks>
        public override void Configure(DateDataType dataType, DataTypeLoadEventArgs eventArgs)
        {
            var e = dataType.DataEditor as umbraco.editorControls.dateField;

            if (e != null)
            {
                // Datefield doesn't recreate ID's on load. Need to fix that
                e.Editor.Controls[0].ID             = e.ID + "_ctl0";
                e.Editor.Controls[0].Controls[0].ID = e.ID + "_ctl0_ctl0";

                DateTime d;

                if (dataType.Data.Value != null && DateTime.TryParse(dataType.Data.Value.ToString(), out d))
                {
                    // Manually set data to stored value
                    e.DateTime = d;
                }
            }
        }
        /// <summary>
        /// Method for performing special actions <b>before</b> creating the <see cref="IDataType" /> editor.
        /// </summary>
        /// <param name="dataType">The <see cref="IDataType" /> instance.</param>
        /// <param name="eventArgs">The <see cref="DataTypeLoadEventArgs"/> instance containing the event data.</param>
        /// <remarks>Called <b>before</b> the grid creates the editor controls for the specified <see cref="IDataType" />.</remarks>
        public override void Initialize(XPathDropDownListDataType dataType, DataTypeLoadEventArgs eventArgs)
        {
            var editor = dataType.DataEditor.Editor as XPathDropDownListDataEditor;

            if (editor != null)
            {
                // Set selected value
                if (dataType.Data.Value != null)
                {
                    var dropdown = editor.Controls[1] as DropDownList;

                    if (dropdown != null)
                    {
                        // Ensure stored values are set
                        dropdown.Load += (sender, args) =>
                        {
                            if (dropdown.SelectedValue == "-1")
                            {
                                // Get selected items from Node Name or Node Id
                                var dropDownListItem = dropdown.Items.FindByValue(dataType.Data.Value.ToString());

                                if (dropDownListItem != null)
                                {
                                    // Reset selected item
                                    dropdown.SelectedItem.Selected = false;

                                    // Set new selected item
                                    dropDownListItem.Selected = true;
                                }
                            }
                        };
                    }
                }
            }

            // Set default value to prevent YSOD
            if (dataType.Data.Value == null)
            {
                dataType.Data.Value = string.Empty;
            }
        }
예제 #8
0
        /// <summary>
        /// Method for performing special actions <b>before</b> creating the <see cref="IDataType" /> editor.
        /// </summary>
        /// <param name="dataType">The <see cref="IDataType" /> instance.</param>
        /// <param name="eventArgs">The <see cref="DataTypeLoadEventArgs"/> instance containing the event data.</param>
        /// <remarks>Called <b>before</b> the grid creates the editor controls for the specified <see cref="IDataType" />.</remarks>
        public override void Initialize(XPathCheckBoxListDataType dataType, DataTypeLoadEventArgs eventArgs)
        {
            var editor = dataType.DataEditor.Editor as XPathCheckBoxListDataEditor;

            if (editor != null && dataType.Data.Value != null)
            {
                var checkbox = editor.Controls[0] as CheckBoxList;

                if (checkbox != null)
                {
                    // Ensure stored values are set
                    checkbox.Load += (sender, args) =>
                    {
                        if (checkbox.SelectedItem == null)
                        {
                            this.SetSelectedValues(checkbox, dataType.Data.Value.ToString());
                        }
                    };
                }
            }
        }
예제 #9
0
 /// <summary>
 /// Method for performing special actions <b>before</b> creating the <see cref="IDataType" /> editor.
 /// </summary>
 /// <param name="dataType">The <see cref="IDataType" /> instance.</param>
 /// <param name="eventArgs">The <see cref="DataTypeLoadEventArgs"/> instance containing the event data.</param>
 /// <remarks>Called <b>before</b> the grid creates the editor controls for the specified <see cref="IDataType" />.</remarks>
 public virtual void Initialize(T dataType, DataTypeLoadEventArgs eventArgs)
 {
 }
예제 #10
0
 /// <summary>
 /// Method for performing special actions <b>after</b> the <see cref="IDataType" />
 /// <see cref="IDataEditor">editor</see> has been loaded.
 /// </summary>
 /// <param name="dataType">The <see cref="IDataType" /> instance.</param>
 /// <param name="eventArgs">The <see cref="DataTypeLoadEventArgs"/> instance containing the event data.</param>
 /// <remarks>Called <b>after</b> the grid creates the editor controls for the specified <see cref="IDataType" />.</remarks>
 public virtual void Configure(T dataType, DataTypeLoadEventArgs eventArgs)
 {
 }
 /// <summary>
 /// Method for performing special actions <b>after</b> the <see cref="IDataType" /> <see cref="IDataEditor">editor</see> has been loaded.
 /// </summary>
 /// <param name="dataType">The <see cref="IDataType" /> instance.</param>
 /// <param name="eventArgs">The <see cref="DataTypeLoadEventArgs"/> instance containing the event data.</param>
 /// <remarks>Called <b>after</b> the grid creates the editor controls for the specified <see cref="IDataType" />.</remarks>
 public override void Configure(IT_DataType dataType, DataTypeLoadEventArgs eventArgs)
 {
     eventArgs.Container.Page.ClientScript.RegisterClientScriptInclude(eventArgs.Container.Page.GetType(), "jquery.alphanumeric", "/umbraco_client/ui/jquery.alphanumeric.js");
 }
        /// <summary>
        /// Method for performing special actions <b>after</b> the <see cref="IDataType" /> <see cref="IDataEditor">editor</see> has been loaded.
        /// </summary>
        /// <param name="dataType">The <see cref="IDataType" /> instance.</param>
        /// <param name="eventArgs">The <see cref="DataTypeLoadEventArgs"/> instance containing the event data.</param>
        /// <remarks>Called <b>after</b> the grid creates the editor controls for the specified <see cref="IDataType" />.</remarks>
        public void Configure(IDataType dataType, DataTypeLoadEventArgs eventArgs)
        {
            var f = this.GetDataTypeFactory(dataType);

            f.GetType().GetMethod("Configure").Invoke(f, new object[] { dataType, eventArgs });
        }