uComponents: Tidying up old comments, paths and references.

This commit is contained in:
leekelleher
2012-04-29 22:41:43 -01:00
parent e8303b255e
commit e26f0f96c2
27 changed files with 945 additions and 1287 deletions

View File

@@ -74,9 +74,9 @@ namespace umbraco.editorControls.MultiNodeTreePicker
case NodeSelectionType.Picker:
//if it is a picker, then find the start node id
var definedId = this.GetPersistedCookieValue(
x => x.MntpGetStartNodeId(this.GetDataTypeId()), uQuery.RootNodeId);
x => x.MntpGetStartNodeId(this.GetDataTypeId()), uQuery.RootNodeId);
//return a document with id -1 (don't set this up as it will exception!)
m_DefinedStartNodeDoc = (definedId > 0) ? new Document(definedId) : new Document(uQuery.RootNodeId, true);
m_DefinedStartNodeDoc = (definedId > 0) ? new Document(definedId) : new Document(uQuery.RootNodeId, true);
break;
case NodeSelectionType.XPathExpression:
//if it is an expression, then we need to find the start node based on the xpression type, etc...
@@ -106,7 +106,7 @@ namespace umbraco.editorControls.MultiNodeTreePicker
//if it's a FromCurrent expression, then we need to run the xpath from this node and below
var currId =
this.GetPersistedCookieValue(
x => x.MntpGetCurrentEditingNode(this.GetDataTypeId()), uQuery.RootNodeId);
x => x.MntpGetCurrentEditingNode(this.GetDataTypeId()), uQuery.RootNodeId);
var currNode = umbraco.library.GetXmlNodeById(currId.ToString());
if (currNode.MoveNext())
{
@@ -177,7 +177,7 @@ namespace umbraco.editorControls.MultiNodeTreePicker
var startNode = new Document(StartNodeID);
rootNode.Text = startNode.Text;
rootNode.Icon = startNode.ContentTypeIcon;
}
}
}
}
@@ -190,12 +190,12 @@ namespace umbraco.editorControls.MultiNodeTreePicker
{
base.OnRenderNode(ref xNode, doc);
var dataTypeId = this.GetDataTypeId();
var xpath = this.GetXPathFromCookie(dataTypeId);
var xPathType = this.GetXPathFilterTypeFromCookie(dataTypeId);
var dataTypeId = this.GetDataTypeId();
var xpath = this.GetXPathFromCookie(dataTypeId);
var xPathType = this.GetXPathFilterTypeFromCookie(dataTypeId);
// resolves any Umbraco params in the XPath
xpath = uQuery.ResolveXPath(xpath);
// resolves any Umbraco params in the XPath
xpath = uQuery.ResolveXPath(xpath);
var xDoc = new XmlDocument();
XmlNode xmlDoc;
@@ -214,8 +214,8 @@ namespace umbraco.editorControls.MultiNodeTreePicker
xNode.DetermineClickable(xpath, xPathType, xml);
//ensure that the NodeKey is passed through
xNode.Source = this.GetTreeServiceUrlWithParams(int.Parse(xNode.NodeID), dataTypeId);
}
xNode.Source = this.GetTreeServiceUrlWithParams(int.Parse(xNode.NodeID), dataTypeId);
}
#endregion
}
}

View File

@@ -6,29 +6,29 @@ using umbraco.cms.presentation.Trees;
namespace umbraco.editorControls.MultiNodeTreePicker
{
/// <summary>
/// FilteredMediaTree for the MultiNodeTreePicker.
/// </summary>
/// <summary>
/// FilteredMediaTree for the MultiNodeTreePicker.
/// </summary>
public class FilteredMediaTree : BaseMediaTree
{
/// <summary>
/// Initializes a new instance of the <see cref="FilteredMediaTree"/> class.
/// </summary>
/// <param name="app">The app.</param>
/// <summary>
/// Initializes a new instance of the <see cref="FilteredMediaTree"/> class.
/// </summary>
/// <param name="app">The app.</param>
public FilteredMediaTree(string app)
: base(app)
{
}
/// <summary>
///
/// </summary>
/// <summary>
///
/// </summary>
private Media m_UserStartNodeMedia;
/// <summary>
///
/// </summary>
private Media m_DefinedStartNodeMedia;
/// <summary>
///
/// </summary>
private Media m_DefinedStartNodeMedia;
/// <summary>
/// Returns the Media object of the starting node for the current User. This ensures
@@ -112,7 +112,7 @@ namespace umbraco.editorControls.MultiNodeTreePicker
var startNode = new Media(StartNodeID);
rootNode.Text = startNode.Text;
rootNode.Icon = startNode.ContentTypeIcon;
}
}
}
}
@@ -140,7 +140,7 @@ namespace umbraco.editorControls.MultiNodeTreePicker
node.Source = this.GetTreeServiceUrlWithParams(int.Parse(node.NodeID), this.GetDataTypeId());
base.OnBeforeNodeRender(ref sender, ref node, e);
}
}
#endregion
}
}

View File

@@ -39,7 +39,7 @@ namespace umbraco.editorControls.MultiNodeTreePicker
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("uComponents.DataTypes.MultiNodeTreePicker.MNTPResources", typeof(MNTPResources).Assembly);
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("umbraco.editorControls.MultiNodeTreePicker.MNTPResources", typeof(MNTPResources).Assembly);
resourceMan = temp;
}
return resourceMan;

View File

@@ -112,10 +112,10 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Desc_MaxItemsAllowed" xml:space="preserve">
<value>The maximum number of items that are allowed to be selected by a content editor. If an unlimited number of node selections should be allowed, then enter -1 as the value</value>
@@ -124,7 +124,7 @@
<value>The minimum number of items that are allowed to be selected by a content editor.</value>
</data>
<data name="Desc_NodeSelectionType" xml:space="preserve">
<value>Nodes can be selected from a parent node (Node Picker) or by an XPath expression. NOTE:When using an XPath expression, only published nodes can be shown.</value>
<value>Nodes can be selected from a parent node (Node Picker) or by an XPath expression. NOTE: When using an XPath expression, only published nodes can be shown.</value>
</data>
<data name="Desc_ShowThumbnails" xml:space="preserve">
<value>If enabled and 'media' is selected as the tree type then a thumbnail will be rendered for each item selected.</value>
@@ -139,13 +139,13 @@
<value>You can specify to store the data in Umbraco as comma seperated or as XML. By default it is stored as XML which makes it easier to use the saved value in XSLT, however, storing it as comma seperated makes it easier to work with the data using the API such as Node factory.</value>
</data>
<data name="Desc_XPathExpression" xml:space="preserve">
<value>This XPath expression is used to select a starting node and depends on the XPath expression type chosen (global or from current). IMPORTANT: This XPath expression should be written to match ONE node, if the expression matches more than one node, then the first node matched will be used as the start node.</value>
<value>This XPath expression is used to select a starting node and depends on the XPath expression type chosen (global or from current). &lt;u&gt;IMPORTANT&lt;/u&gt;: This XPath expression should be written to match &lt;b&gt;ONE&lt;/b&gt; node, if the expression matches more than one node, then the first node matched will be used as the start node.</value>
</data>
<data name="Desc_XPathExpressionType" xml:space="preserve">
<value>The XPath expression that is evaluated to match a start node can be evaluated at a global tree level, or matched from the current node being edited.</value>
</data>
<data name="Desc_XPathFilter" xml:space="preserve">
<value>An xpath filter to match nodes that will be either enabled or disabled from being clicked (depending on what is selected for the XPath filter type). This XPath filter is for one node only so it should be formatted to select only one node. The XML to XPath against is the same as the Umbraco XML for one node.&lt;br/&gt;&lt;br/&gt;Example: /*[name()='myNodeType' or name()='yourNodeType'] &lt;br/&gt;&lt;br/&gt;The above would make all nodes of types: myNodeType or yourNodeType not selectable in the tree</value>
<value>An xpath filter to match nodes that will be either enabled or disabled from being clicked (depending on what is selected for the XPath filter type). This XPath filter is for one node only so it should be formatted to select only one node. The XML to XPath against is the same as the Umbraco XML for one node.&lt;br/&gt;&lt;br/&gt;Example: &lt;code&gt;/*[self::'myNodeType or self::yourNodeType]&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;The above would make all nodes of types: myNodeType or yourNodeType not selectable in the tree</value>
</data>
<data name="Desc_XPathFilterType" xml:space="preserve">
<value>Should the XPath filter match nodes to enable nodes or disable nodes. If Enable is selected, this means that only nodes that match the XPath filter will be allowed to be selected in the tree picker and vise versa for Disabled</value>

View File

@@ -12,6 +12,9 @@ using umbraco.controls.Images;
using umbraco.controls.Tree;
using umbraco.IO;
[assembly: WebResource("umbraco.editorControls.MultiNodeTreePicker.MultiNodePickerStyles.css", "text/css")]
[assembly: WebResource("umbraco.editorControls.MultiNodeTreePicker.MultiNodePickerScripts.js", "application/x-javascript")]
namespace umbraco.editorControls.MultiNodeTreePicker
{
/// <summary>
@@ -53,8 +56,8 @@ namespace umbraco.editorControls.MultiNodeTreePicker
contentTree.Tree.Title,
contentTree.Tree.IconClosed,
contentTree.Tree.IconOpened,
"uComponents.Core",
"DataTypes.MultiNodeTreePicker.FilteredContentTree",
"umbraco.editorControls",
"MultiNodeTreePicker.FilteredContentTree",
contentTree.Tree.Action),
contentTree.App);
@@ -67,8 +70,8 @@ namespace umbraco.editorControls.MultiNodeTreePicker
contentTree.Tree.Title,
contentTree.Tree.IconClosed,
contentTree.Tree.IconOpened,
"uComponents.Core",
"DataTypes.MultiNodeTreePicker.FilteredMediaTree",
"umbraco.editorControls",
"MultiNodeTreePicker.FilteredMediaTree",
contentTree.Tree.Action),
contentTree.App);
@@ -561,7 +564,7 @@ namespace umbraco.editorControls.MultiNodeTreePicker
writer.RenderEndTag(); //end multiNodePicker div
var tooltipAjaxUrl = IOHelper.ResolveUrl(SystemDirectories.Umbraco) + @"/plugins/MultiNodePicker/CustomTreeService.asmx/GetNodeInfo";
var tooltipAjaxUrl = IOHelper.ResolveUrl(SystemDirectories.Umbraco) + @"/controls/Tree/CustomTreeService.asmx/GetNodeInfo";
//add jquery window load event to create the js tree picker
var jsMethod = string.Format("jQuery('#{0}').MultiNodeTreePicker('{1}', {2}, '{3}', {4}, {5}, '{6}', '{7}');",

View File

@@ -3,8 +3,6 @@ using System.Collections;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
// using uComponents.Core;
// using uComponents.DataTypes.Shared.Extensions;
using umbraco.cms.businesslogic.datatype;
using umbraco.interfaces;
using umbraco.uicontrols.TreePicker;
@@ -506,7 +504,7 @@ namespace umbraco.editorControls.MultiNodeTreePicker
{
var desc = new HtmlGenericControl("div");
var descSpan = new HtmlGenericControl("span");
descSpan.InnerText = description;
descSpan.InnerHtml = description;
desc.Attributes.Add("class", "description");
desc.Controls.Add(descSpan);
div.Controls.Add(desc);
@@ -577,12 +575,12 @@ namespace umbraco.editorControls.MultiNodeTreePicker
/// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter"/> object that receives the server control content.</param>
protected override void Render(HtmlTextWriter writer)
{
writer.AddAttribute(HtmlTextWriterAttribute.Class, "uComponents");
writer.RenderBeginTag(HtmlTextWriterTag.Div); //start 'uComponents'
writer.AddAttribute(HtmlTextWriterAttribute.Class, "PrevalueEditor");
writer.RenderBeginTag(HtmlTextWriterTag.Div); //start 'PrevalueEditor'
base.Render(writer);
writer.RenderEndTag(); //end 'uComponents'
writer.RenderEndTag(); //end 'PrevalueEditor'
}

View File

@@ -12,7 +12,6 @@ namespace umbraco.editorControls.MultiNodeTreePicker
/// </summary>
internal class SelectedItemsTemplate : ITemplate
{
#region ITemplate Members
/// <summary>

View File

@@ -5,9 +5,9 @@ using umbraco.cms.presentation.Trees;
namespace umbraco.editorControls.MultiNodeTreePicker
{
/// <summary>
/// XmlTreeNode extensions for the MultiNodeTreePicker.
/// </summary>
/// <summary>
/// XmlTreeNode extensions for the MultiNodeTreePicker.
/// </summary>
public static class XmlTreeNodeExtensions
{
//public static void DetermineSelected(this XmlTreeNode node)
@@ -52,12 +52,12 @@ namespace umbraco.editorControls.MultiNodeTreePicker
{
//ensure the individual node is the correct color
node.Style.AddCustom("uc-treenode-noclick");
}
}
}
}
catch (XPathException)
{
node.Text = "uComponents: XPath Error!";
node.Text = "umbraco.editorControls: MNTP: XPath Error!";
}
}
else
@@ -71,7 +71,7 @@ namespace umbraco.editorControls.MultiNodeTreePicker
{
//ensure the individual node is the correct color
node.Style.AddCustom("uc-treenode-noclick");
}
}
}
}
}

View File

@@ -1,118 +1,116 @@
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
// using uComponents.DataTypes.Shared.Extensions;
// using uComponents.DataTypes.Shared.PrevalueEditors;
using umbraco.cms.businesslogic.datatype;
namespace umbraco.editorControls.MultipleTextstring
{
/// <summary>
/// The PreValue Editor for the Multiple Textstring data-type.
/// </summary>
public class MultipleTextstringPrevalueEditor : AbstractJsonPrevalueEditor
{
/// <summary>
/// The TextBox control for the maximum value of the control.
/// </summary>
private TextBox TextBoxMaximum;
/// <summary>
/// The PreValue Editor for the Multiple Textstring data-type.
/// </summary>
public class MultipleTextstringPrevalueEditor : AbstractJsonPrevalueEditor
{
/// <summary>
/// The TextBox control for the maximum value of the control.
/// </summary>
private TextBox TextBoxMaximum;
/// <summary>
/// The TextBox control for the minimum value of the control.
/// </summary>
private TextBox TextBoxMinimum;
/// <summary>
/// The TextBox control for the minimum value of the control.
/// </summary>
private TextBox TextBoxMinimum;
/// <summary>
/// Initializes a new instance of the <see cref="MultipleTextstringPrevalueEditor"/> class.
/// </summary>
/// <param name="dataType">Type of the data.</param>
/// <summary>
/// Initializes a new instance of the <see cref="MultipleTextstringPrevalueEditor"/> class.
/// </summary>
/// <param name="dataType">Type of the data.</param>
public MultipleTextstringPrevalueEditor(umbraco.cms.businesslogic.datatype.BaseDataType dataType)
: base(dataType, umbraco.cms.businesslogic.datatype.DBTypes.Ntext)
{
}
{
}
/// <summary>
/// Saves this instance.
/// </summary>
public override void Save()
{
// set the options
var options = new MultipleTextstringOptions(true);
/// <summary>
/// Saves this instance.
/// </summary>
public override void Save()
{
// set the options
var options = new MultipleTextstringOptions(true);
// parse the maximum
int maximum;
if (int.TryParse(this.TextBoxMaximum.Text, out maximum))
{
if (maximum == 0)
{
maximum = -1;
}
// parse the maximum
int maximum;
if (int.TryParse(this.TextBoxMaximum.Text, out maximum))
{
if (maximum == 0)
{
maximum = -1;
}
options.Maximum = maximum;
}
options.Maximum = maximum;
}
// parse the minimum
int minimum;
if (int.TryParse(this.TextBoxMinimum.Text, out minimum))
{
if (minimum == 0)
{
minimum = -1;
}
// parse the minimum
int minimum;
if (int.TryParse(this.TextBoxMinimum.Text, out minimum))
{
if (minimum == 0)
{
minimum = -1;
}
options.Minimum = minimum;
}
options.Minimum = minimum;
}
// save the options as JSON
this.SaveAsJson(options);
}
// save the options as JSON
this.SaveAsJson(options);
}
/// <summary>
/// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
/// </summary>
protected override void CreateChildControls()
{
base.CreateChildControls();
/// <summary>
/// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
/// </summary>
protected override void CreateChildControls()
{
base.CreateChildControls();
// set-up child controls
this.TextBoxMaximum = new TextBox() { ID = "Maximum", CssClass = "guiInputText" };
this.TextBoxMinimum = new TextBox() { ID = "Minimum", CssClass = "guiInputText" };
// set-up child controls
this.TextBoxMaximum = new TextBox() { ID = "Maximum", CssClass = "guiInputText" };
this.TextBoxMinimum = new TextBox() { ID = "Minimum", CssClass = "guiInputText" };
// add the child controls
this.Controls.AddPrevalueControls(this.TextBoxMaximum, this.TextBoxMinimum);
}
// add the child controls
this.Controls.AddPrevalueControls(this.TextBoxMaximum, this.TextBoxMinimum);
}
/// <summary>
/// Raises the <see cref="E:System.Web.UI.Control.Load"/> event.
/// </summary>
/// <param name="e">The <see cref="T:System.EventArgs"/> object that contains the event data.</param>
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
/// <summary>
/// Raises the <see cref="E:System.Web.UI.Control.Load"/> event.
/// </summary>
/// <param name="e">The <see cref="T:System.EventArgs"/> object that contains the event data.</param>
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
// get PreValues, load them into the controls.
var options = this.GetPreValueOptions<MultipleTextstringOptions>();
// get PreValues, load them into the controls.
var options = this.GetPreValueOptions<MultipleTextstringOptions>();
// no options? use the default ones.
if (options == null)
{
options = new MultipleTextstringOptions(true);
}
// no options? use the default ones.
if (options == null)
{
options = new MultipleTextstringOptions(true);
}
// set the values
this.TextBoxMaximum.Text = options.Maximum.ToString();
this.TextBoxMinimum.Text = options.Minimum.ToString();
}
// set the values
this.TextBoxMaximum.Text = options.Maximum.ToString();
this.TextBoxMinimum.Text = options.Minimum.ToString();
}
/// <summary>
/// Renders the contents of the control to the specified writer. This method is used primarily by control developers.
/// </summary>
/// <param name="writer">A <see cref="T:System.Web.UI.HtmlTextWriter"/> that represents the output stream to render HTML content on the client.</param>
protected override void RenderContents(HtmlTextWriter writer)
{
// add property fields
writer.AddPrevalueRow("Minimum:", "Minimum number of rows to display.", this.TextBoxMinimum);
writer.AddPrevalueRow("Maximum:", "Maximum number of rows to display.", this.TextBoxMaximum);
}
}
/// <summary>
/// Renders the contents of the control to the specified writer. This method is used primarily by control developers.
/// </summary>
/// <param name="writer">A <see cref="T:System.Web.UI.HtmlTextWriter"/> that represents the output stream to render HTML content on the client.</param>
protected override void RenderContents(HtmlTextWriter writer)
{
// add property fields
writer.AddPrevalueRow("Minimum:", "Minimum number of rows to display.", this.TextBoxMinimum);
writer.AddPrevalueRow("Maximum:", "Maximum number of rows to display.", this.TextBoxMaximum);
}
}
}

View File

@@ -93,7 +93,7 @@ namespace umbraco.editorControls
writer.AddAttribute(HtmlTextWriterAttribute.Class, "description");
writer.RenderBeginTag(HtmlTextWriterTag.Div); // start 'description'
Label desc = new Label() { Text = description };
var desc = new Literal() { Text = description };
desc.RenderControl(writer);
writer.RenderEndTag(); // end 'description'

View File

@@ -1,5 +1,4 @@
using System;
// using uComponents.Core;
using umbraco.cms.businesslogic.datatype;
using umbraco.interfaces;

View File

@@ -1,5 +1,4 @@
using System.ComponentModel;
// using uComponents.DataTypes.Shared.PrevalueEditors;
using umbraco.cms.businesslogic.datatype;
namespace umbraco.editorControls.Slider

View File

@@ -1,8 +1,6 @@
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
// using uComponents.DataTypes.Shared.Extensions;
// using uComponents.DataTypes.Shared.PrevalueEditors;
using umbraco.cms.businesslogic.datatype;
namespace umbraco.editorControls.Slider

View File

@@ -4,7 +4,6 @@ using System.Linq;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Linq;
// using uComponents.Core;
using umbraco.interfaces;
namespace umbraco.editorControls.XPathCheckBoxList

View File

@@ -2,8 +2,6 @@
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.XPath;
// using uComponents.DataTypes.Shared.Extensions;
// using uComponents.DataTypes.Shared.PrevalueEditors;
using umbraco.cms.businesslogic.datatype;
namespace umbraco.editorControls.XPathCheckBoxList

View File

@@ -12,138 +12,138 @@ using umbraco.interfaces;
namespace umbraco.editorControls.XPathDropDownList
{
/// <summary>
/// XPath configurabale DropDownList Data Type
/// </summary>
public class XPathDropDownListDataEditor : CompositeControl, IDataEditor
{
/// <summary>
/// Field for the data.
/// </summary>
private IData m_Data;
/// <summary>
/// XPath configurabale DropDownList Data Type
/// </summary>
public class XPathDropDownListDataEditor : CompositeControl, IDataEditor
{
/// <summary>
/// Field for the data.
/// </summary>
private IData m_Data;
/// <summary>
/// Field for the options.
/// </summary>
private XPathDropDownListOptions m_Options;
/// <summary>
/// Field for the options.
/// </summary>
private XPathDropDownListOptions m_Options;
/// <summary>
/// Field for the CustomValidator.
/// </summary>
private CustomValidator m_CustomValidator = new CustomValidator();
/// <summary>
/// Field for the CustomValidator.
/// </summary>
private CustomValidator m_CustomValidator = new CustomValidator();
/// <summary>
/// Field for the DropDownList.
/// </summary>
private DropDownList m_DropDownList = new DropDownList();
/// <summary>
/// Field for the DropDownList.
/// </summary>
private DropDownList m_DropDownList = new DropDownList();
/// <summary>
/// Gets a value indicating whether [treat as rich text editor].
/// </summary>
/// <value>
/// <c>true</c> if [treat as rich text editor]; otherwise, <c>false</c>.
/// </value>
public virtual bool TreatAsRichTextEditor
{
get
{
return false;
}
}
/// <summary>
/// Gets a value indicating whether [treat as rich text editor].
/// </summary>
/// <value>
/// <c>true</c> if [treat as rich text editor]; otherwise, <c>false</c>.
/// </value>
public virtual bool TreatAsRichTextEditor
{
get
{
return false;
}
}
/// <summary>
/// Gets a value indicating whether [show label].
/// </summary>
/// <value><c>true</c> if [show label]; otherwise, <c>false</c>.</value>
public virtual bool ShowLabel
{
get
{
return true;
}
}
/// <summary>
/// Gets a value indicating whether [show label].
/// </summary>
/// <value><c>true</c> if [show label]; otherwise, <c>false</c>.</value>
public virtual bool ShowLabel
{
get
{
return true;
}
}
/// <summary>
/// Gets the editor.
/// </summary>
/// <value>The editor.</value>
public Control Editor
{
get
{
return this;
}
}
/// <summary>
/// Gets the editor.
/// </summary>
/// <value>The editor.</value>
public Control Editor
{
get
{
return this;
}
}
/// <summary>
/// Initializes a new instance of XPathCheckBoxListDataEditor
/// </summary>
/// <param name="data"></param>
/// <param name="options"></param>
internal XPathDropDownListDataEditor(IData data, XPathDropDownListOptions options)
{
this.m_Data = data;
this.m_Options = options;
}
/// <summary>
/// Initializes a new instance of XPathCheckBoxListDataEditor
/// </summary>
/// <param name="data"></param>
/// <param name="options"></param>
internal XPathDropDownListDataEditor(IData data, XPathDropDownListOptions options)
{
this.m_Data = data;
this.m_Options = options;
}
/// <summary>
/// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
/// </summary>
protected override void CreateChildControls()
{
this.m_DropDownList.DataSource = uQuery.GetNodesByXPath(this.m_Options.XPath).ToNameIds();
this.m_DropDownList.DataTextField = "Value";
this.m_DropDownList.DataValueField = this.m_Options.UseId ? "Key" : "Value";
this.m_DropDownList.DataBind();
/// <summary>
/// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
/// </summary>
protected override void CreateChildControls()
{
this.m_DropDownList.DataSource = uQuery.GetNodesByXPath(this.m_Options.XPath).ToNameIds();
this.m_DropDownList.DataTextField = "Value";
this.m_DropDownList.DataValueField = this.m_Options.UseId ? "Key" : "Value";
this.m_DropDownList.DataBind();
// Add a default please select value
this.m_DropDownList.Items.Insert(0, new ListItem(string.Empty, "-1"));
// Add a default please select value
this.m_DropDownList.Items.Insert(0, new ListItem(string.Concat(ui.Text("choose"), "..."), "-1"));
this.Controls.Add(this.m_CustomValidator);
this.Controls.Add(this.m_DropDownList);
}
this.Controls.Add(this.m_CustomValidator);
this.Controls.Add(this.m_DropDownList);
}
/// <summary>
/// Raises the <see cref="E:System.Web.UI.Control.Load"/> event.
/// </summary>
/// <param name="e">The <see cref="T:System.EventArgs"/> object that contains the event data.</param>
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
this.EnsureChildControls();
/// <summary>
/// Raises the <see cref="E:System.Web.UI.Control.Load"/> event.
/// </summary>
/// <param name="e">The <see cref="T:System.EventArgs"/> object that contains the event data.</param>
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
this.EnsureChildControls();
if (!this.Page.IsPostBack)
{
// Get selected items from Node Name or Node Id
var dropDownListItem = this.m_DropDownList.Items.FindByValue(this.m_Data.Value.ToString());
if (dropDownListItem != null)
{
dropDownListItem.Selected = true;
}
}
}
if (!this.Page.IsPostBack)
{
// Get selected items from Node Name or Node Id
var dropDownListItem = this.m_DropDownList.Items.FindByValue(this.m_Data.Value.ToString());
if (dropDownListItem != null)
{
dropDownListItem.Selected = true;
}
}
}
/// <summary>
/// Called by Umbraco when saving the node
/// </summary>
public void Save()
{
Property property = new Property(((DefaultData)this.m_Data).PropertyId);
if (property.PropertyType.Mandatory && this.m_DropDownList.SelectedValue == "-1")
{
// Property is mandatory, but no value selected in the DropDownList
this.m_CustomValidator.IsValid = false;
/// <summary>
/// Called by Umbraco when saving the node
/// </summary>
public void Save()
{
Property property = new Property(((umbraco.cms.businesslogic.datatype.DefaultData)this.m_Data).PropertyId);
if (property.PropertyType.Mandatory && this.m_DropDownList.SelectedValue == "-1")
{
// Property is mandatory, but no value selected in the DropDownList
this.m_CustomValidator.IsValid = false;
DocumentType documentType = new DocumentType(property.PropertyType.ContentTypeId);
ContentType.TabI tab = documentType.getVirtualTabs.Where(x => x.Id == property.PropertyType.TabId).FirstOrDefault();
DocumentType documentType = new DocumentType(property.PropertyType.ContentTypeId);
ContentType.TabI tab = documentType.getVirtualTabs.Where(x => x.Id == property.PropertyType.TabId).FirstOrDefault();
if (tab != null)
{
this.m_CustomValidator.ErrorMessage = ui.Text("errorHandling", "errorMandatory", new string[] { property.PropertyType.Alias, tab.Caption }, User.GetCurrent());
}
}
if (tab != null)
{
this.m_CustomValidator.ErrorMessage = ui.Text("errorHandling", "errorMandatory", new string[] { property.PropertyType.Alias, tab.Caption }, User.GetCurrent());
}
}
this.m_Data.Value = this.m_DropDownList.SelectedValue;
}
}
this.m_Data.Value = this.m_DropDownList.SelectedValue;
}
}
}

View File

@@ -2,8 +2,6 @@
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.XPath;
// using uComponents.DataTypes.Shared.Extensions;
// using uComponents.DataTypes.Shared.PrevalueEditors;
using umbraco.cms.businesslogic.datatype;
namespace umbraco.editorControls.XPathDropDownList