uComponents: Tidying up old comments, paths and references.
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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). <u>IMPORTANT</u>: This XPath expression should be written to match <b>ONE</b> 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.<br/><br/>Example: /*[name()='myNodeType' or name()='yourNodeType'] <br/><br/>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.<br/><br/>Example: <code>/*[self::'myNodeType or self::yourNodeType]</code><br/><br/>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>
|
||||
|
||||
@@ -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}');",
|
||||
|
||||
@@ -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'
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace umbraco.editorControls.MultiNodeTreePicker
|
||||
/// </summary>
|
||||
internal class SelectedItemsTemplate : ITemplate
|
||||
{
|
||||
|
||||
#region ITemplate Members
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
// using uComponents.Core;
|
||||
using umbraco.cms.businesslogic.datatype;
|
||||
using umbraco.interfaces;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.ComponentModel;
|
||||
// using uComponents.DataTypes.Shared.PrevalueEditors;
|
||||
using umbraco.cms.businesslogic.datatype;
|
||||
|
||||
namespace umbraco.editorControls.Slider
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -520,7 +520,6 @@
|
||||
<Compile Include="umbraco\controls\Tree\CustomTreeService.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="umbraco\controls\Tree\CustomTreeServiceResource.Designer.cs" />
|
||||
<Compile Include="umbraco\controls\Tree\JTreeContextMenu.cs" />
|
||||
<Compile Include="umbraco\controls\Tree\JTreeContextMenuItem.cs" />
|
||||
<Compile Include="umbraco\controls\Tree\NodeInfo.cs">
|
||||
@@ -1702,6 +1701,8 @@
|
||||
<Content Include="config\splashes\booting.aspx" />
|
||||
<Content Include="config\splashes\noNodes.aspx" />
|
||||
<Content Include="umbraco\controls\Tree\CustomTreeService.asmx" />
|
||||
<Content Include="umbraco\images\delete.gif" />
|
||||
<Content Include="umbraco\images\information.png" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\media\moxieplayer.swf" />
|
||||
<Content Include="umbraco_client\tinymce3\themes\umbraco\img\flash.gif" />
|
||||
<Content Include="umbraco_client\tinymce3\themes\umbraco\img\iframe.gif" />
|
||||
@@ -3224,7 +3225,6 @@
|
||||
<DependentUpon>welcome.ascx.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="umbraco\controls\Tree\CustomTreeServiceResource.resx" />
|
||||
<EmbeddedResource Include="umbraco\js\language.aspx.resx">
|
||||
<DependentUpon>language.aspx.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
@@ -8,117 +8,83 @@ using umbraco.IO;
|
||||
|
||||
namespace umbraco.controls.Tree
|
||||
{
|
||||
/// <summary>
|
||||
/// A custom tree control that uses a custom web service to return the initial node, this is required
|
||||
/// due to a bug that exists in Umbraco 4.5.1 tree control/web service.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Since we're inheriting from a UserControl and all of the ClientDependency registrations are done inline, we need
|
||||
/// to re-register the ClientDependencies.
|
||||
/// </remarks>
|
||||
[ClientDependency(10, ClientDependencyType.Css, "Tree/treeIcons.css", "UmbracoClient")]
|
||||
[ClientDependency(11, ClientDependencyType.Css, "Tree/menuIcons.css", "UmbracoClient")]
|
||||
[ClientDependency(12, ClientDependencyType.Css, "Tree/Themes/umbraco/style.css", "UmbracoClient")]
|
||||
[ClientDependency(0, ClientDependencyType.Javascript, "Application/NamespaceManager.js", "UmbracoClient")]
|
||||
[ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoClientManager.js", "UmbracoClient")]
|
||||
[ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoApplicationActions.js", "UmbracoClient")]
|
||||
[ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoUtils.js", "UmbracoClient")]
|
||||
[ClientDependency(0, ClientDependencyType.Javascript, "ui/jquery.js", "UmbracoClient")]
|
||||
[ClientDependency(10, ClientDependencyType.Javascript, "Application/JQuery/jquery.metadata.min.js", "UmbracoClient")]
|
||||
[ClientDependency(11, ClientDependencyType.Javascript, "Tree/jquery.tree.js", "UmbracoClient")]
|
||||
[ClientDependency(12, ClientDependencyType.Javascript, "Tree/UmbracoContext.js", "UmbracoClient")]
|
||||
[ClientDependency(12, ClientDependencyType.Javascript, "Tree/jquery.tree.contextmenu.js", "UmbracoClient")]
|
||||
[ClientDependency(12, ClientDependencyType.Javascript, "Tree/jquery.tree.checkbox.js", "UmbracoClient")]
|
||||
[ClientDependency(12, ClientDependencyType.Javascript, "Tree/NodeDefinition.js", "UmbracoClient")]
|
||||
[ClientDependency(13, ClientDependencyType.Javascript, "Tree/UmbracoTree.js", "UmbracoClient")]
|
||||
public class CustomTreeControl : TreeControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Static constructor to ensure that our web service is copied locally
|
||||
/// </summary>
|
||||
static CustomTreeControl()
|
||||
{
|
||||
var servicePath = Path.Combine(SystemDirectories.Umbraco, "plugins", "MultiNodePicker");
|
||||
/// <summary>
|
||||
/// A custom tree control that uses a custom web service to return the initial node, this is required
|
||||
/// due to a bug that exists in Umbraco 4.5.1 tree control/web service.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Since we're inheriting from a UserControl and all of the ClientDependency registrations are done inline, we need
|
||||
/// to re-register the ClientDependencies.
|
||||
/// </remarks>
|
||||
[ClientDependency(10, ClientDependencyType.Css, "Tree/treeIcons.css", "UmbracoClient")]
|
||||
[ClientDependency(11, ClientDependencyType.Css, "Tree/menuIcons.css", "UmbracoClient")]
|
||||
[ClientDependency(12, ClientDependencyType.Css, "Tree/Themes/umbraco/style.css", "UmbracoClient")]
|
||||
[ClientDependency(0, ClientDependencyType.Javascript, "Application/NamespaceManager.js", "UmbracoClient")]
|
||||
[ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoClientManager.js", "UmbracoClient")]
|
||||
[ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoApplicationActions.js", "UmbracoClient")]
|
||||
[ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoUtils.js", "UmbracoClient")]
|
||||
[ClientDependency(0, ClientDependencyType.Javascript, "ui/jquery.js", "UmbracoClient")]
|
||||
[ClientDependency(10, ClientDependencyType.Javascript, "Application/JQuery/jquery.metadata.min.js", "UmbracoClient")]
|
||||
[ClientDependency(11, ClientDependencyType.Javascript, "Tree/jquery.tree.js", "UmbracoClient")]
|
||||
[ClientDependency(12, ClientDependencyType.Javascript, "Tree/UmbracoContext.js", "UmbracoClient")]
|
||||
[ClientDependency(12, ClientDependencyType.Javascript, "Tree/jquery.tree.contextmenu.js", "UmbracoClient")]
|
||||
[ClientDependency(12, ClientDependencyType.Javascript, "Tree/jquery.tree.checkbox.js", "UmbracoClient")]
|
||||
[ClientDependency(12, ClientDependencyType.Javascript, "Tree/NodeDefinition.js", "UmbracoClient")]
|
||||
[ClientDependency(13, ClientDependencyType.Javascript, "Tree/UmbracoTree.js", "UmbracoClient")]
|
||||
public class CustomTreeControl : TreeControl
|
||||
{
|
||||
private static readonly object m_Locker = new object();
|
||||
|
||||
if (!Directory.Exists(servicePath))
|
||||
{
|
||||
lock (m_Locker)
|
||||
{
|
||||
//double check locking
|
||||
if (!Directory.Exists(servicePath))
|
||||
{
|
||||
//now create our new local web service
|
||||
var wServiceTxt = CustomTreeServiceResource.CustomTreeService;
|
||||
var dirMultiNodePicker = new DirectoryInfo(servicePath);
|
||||
if (!dirMultiNodePicker.Exists)
|
||||
{
|
||||
dirMultiNodePicker.Create();
|
||||
}
|
||||
var wServiceFile = new FileInfo(Path.Combine(dirMultiNodePicker.FullName, "CustomTreeService.asmx"));
|
||||
if (!wServiceFile.Exists)
|
||||
{
|
||||
using (var sw = new StreamWriter(wServiceFile.Create()))
|
||||
{
|
||||
sw.Write(wServiceTxt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Ensure child controls are created on init
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
base.OnInit(e);
|
||||
|
||||
private static readonly object m_Locker = new object();
|
||||
this.EnsureChildControls();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensure child controls are created on init
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
base.OnInit(e);
|
||||
/// <summary>
|
||||
/// Create the child controls
|
||||
/// </summary>
|
||||
protected override void CreateChildControls()
|
||||
{
|
||||
base.CreateChildControls();
|
||||
|
||||
this.EnsureChildControls();
|
||||
}
|
||||
TreeContainer = new HtmlGenericControl();
|
||||
TreeContainer.TagName = "div";
|
||||
TreeContainer.ID = "TreeContainer";
|
||||
|
||||
/// <summary>
|
||||
/// Create the child controls
|
||||
/// </summary>
|
||||
protected override void CreateChildControls()
|
||||
{
|
||||
base.CreateChildControls();
|
||||
this.Controls.Add(TreeContainer);
|
||||
}
|
||||
|
||||
TreeContainer = new HtmlGenericControl();
|
||||
TreeContainer.TagName = "div";
|
||||
TreeContainer.ID = "TreeContainer";
|
||||
/// <summary>
|
||||
/// Adds the internal markup to the TreeContainer control
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnPreRender(EventArgs e)
|
||||
{
|
||||
base.OnPreRender(e);
|
||||
|
||||
this.Controls.Add(TreeContainer);
|
||||
}
|
||||
//add the internal markup to the TreeContainer
|
||||
/* <div id="<%=ClientID%>" class="<%#Mode.ToString().ToLower()%>"></div> */
|
||||
TreeContainer.Controls.Add(new LiteralControl(@"<div id=""" + ClientID + @""" class=""" + Mode.ToString().ToLower() + @"""></div>"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the internal markup to the TreeContainer control
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnPreRender(EventArgs e)
|
||||
{
|
||||
base.OnPreRender(e);
|
||||
/// <summary>
|
||||
/// Render out the correct markup for the tree
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Since we're inheriting from a UserControl, we need to render out the markup manually
|
||||
/// </remarks>
|
||||
/// <param name="writer"></param>
|
||||
protected override void Render(System.Web.UI.HtmlTextWriter writer)
|
||||
{
|
||||
//You'll notice that we're replacing the 'serviceUrl' parameter with our own custom web service!
|
||||
|
||||
//add the internal markup to the TreeContainer
|
||||
/* <div id="<%=ClientID%>" class="<%#Mode.ToString().ToLower()%>"></div> */
|
||||
TreeContainer.Controls.Add(new LiteralControl(@"<div id=""" + ClientID + @""" class=""" + Mode.ToString().ToLower() + @"""></div>"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Render out the correct markup for the tree
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Since we're inheriting from a UserControl, we need to render out the markup manually
|
||||
/// </remarks>
|
||||
/// <param name="writer"></param>
|
||||
protected override void Render(System.Web.UI.HtmlTextWriter writer)
|
||||
{
|
||||
//You'll notice that we're replacing the 'serviceUrl' parameter with our own custom web service!
|
||||
|
||||
writer.Write(@"
|
||||
writer.Write(@"
|
||||
<script type=""text/javascript"">
|
||||
jQuery(document).ready(function() {
|
||||
var ctxMenu = " + GetJSONContextMenu() + @";
|
||||
@@ -145,7 +111,7 @@ jQuery(document).ready(function() {
|
||||
nodeKey : nodeKey,
|
||||
treeMode: """ + Mode.ToString().ToLower() + @""",
|
||||
dataUrl: """ + IOHelper.ResolveUrl(SystemDirectories.Umbraco) + @"/webservices/TreeDataService.ashx"",
|
||||
serviceUrl: """ + IOHelper.ResolveUrl(SystemDirectories.Umbraco) + @"/plugins/MultiNodePicker/CustomTreeService.asmx/GetInitAppTreeData""});
|
||||
serviceUrl: """ + IOHelper.ResolveUrl(SystemDirectories.Umbraco) + @"/controls/Tree/CustomTreeService.asmx/GetInitAppTreeData""});
|
||||
|
||||
//add event handler for ajax errors, this will refresh the whole application
|
||||
var mainTree = UmbClientMgr.mainTree();
|
||||
@@ -160,8 +126,8 @@ jQuery(document).ready(function() {
|
||||
|
||||
</script>");
|
||||
|
||||
//render the controls
|
||||
TreeContainer.RenderControl(writer);
|
||||
}
|
||||
}
|
||||
//render the controls
|
||||
TreeContainer.RenderControl(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,114 +10,114 @@ using umbraco.controls.Tree;
|
||||
|
||||
namespace umbraco.controls.Tree
|
||||
{
|
||||
/// <summary>
|
||||
/// Client side ajax utlities for the tree
|
||||
/// </summary>
|
||||
[ScriptService]
|
||||
[WebService]
|
||||
public class CustomTreeService : WebService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns some info about the node such as path and id
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[WebMethod]
|
||||
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
|
||||
public NodeInfo GetNodeInfo(int id)
|
||||
{
|
||||
Authorize();
|
||||
/// <summary>
|
||||
/// Client side ajax utlities for the tree
|
||||
/// </summary>
|
||||
[ScriptService]
|
||||
[WebService]
|
||||
public class CustomTreeService : WebService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns some info about the node such as path and id
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[WebMethod]
|
||||
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
|
||||
public NodeInfo GetNodeInfo(int id)
|
||||
{
|
||||
Authorize();
|
||||
|
||||
var node = new CMSNode(id);
|
||||
return new NodeInfo()
|
||||
{
|
||||
Id = node.Id,
|
||||
Path = node.Path,
|
||||
PathAsNames = string.Join("->",
|
||||
GetPathNames(node.Path.Split(',')
|
||||
.Select(x => int.Parse(x))
|
||||
.ToArray()))
|
||||
};
|
||||
}
|
||||
var node = new CMSNode(id);
|
||||
return new NodeInfo()
|
||||
{
|
||||
Id = node.Id,
|
||||
Path = node.Path,
|
||||
PathAsNames = string.Join("->",
|
||||
GetPathNames(node.Path.Split(',')
|
||||
.Select(x => int.Parse(x))
|
||||
.ToArray()))
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns the node names for each id passed in
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
private string[] GetPathNames(int[] ids)
|
||||
{
|
||||
return ids
|
||||
.Where(x => x != -1)
|
||||
.Select(x => new CMSNode(x).Text).ToArray();
|
||||
}
|
||||
/// <summary>
|
||||
/// returns the node names for each id passed in
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
private string[] GetPathNames(int[] ids)
|
||||
{
|
||||
return ids
|
||||
.Where(x => x != -1)
|
||||
.Select(x => new CMSNode(x).Text).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a key/value object with: json, app, js as the keys
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[WebMethod]
|
||||
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
|
||||
public Dictionary<string, string> GetInitAppTreeData(string app, string treeType, bool showContextMenu, bool isDialog, TreeDialogModes dialogMode, string functionToCall, string nodeKey)
|
||||
{
|
||||
Authorize();
|
||||
/// <summary>
|
||||
/// Returns a key/value object with: json, app, js as the keys
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[WebMethod]
|
||||
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
|
||||
public Dictionary<string, string> GetInitAppTreeData(string app, string treeType, bool showContextMenu, bool isDialog, TreeDialogModes dialogMode, string functionToCall, string nodeKey)
|
||||
{
|
||||
Authorize();
|
||||
|
||||
var treeCtl = new TreeControl()
|
||||
{
|
||||
ShowContextMenu = showContextMenu,
|
||||
IsDialog = isDialog,
|
||||
DialogMode = dialogMode,
|
||||
App = app,
|
||||
TreeType = string.IsNullOrEmpty(treeType) ? "" : treeType, //don't set the tree type unless explicitly set
|
||||
NodeKey = string.IsNullOrEmpty(nodeKey) ? "" : nodeKey,
|
||||
//StartNodeID = -1, //TODO: set this based on parameters!
|
||||
FunctionToCall = string.IsNullOrEmpty(functionToCall) ? "" : functionToCall
|
||||
};
|
||||
var treeCtl = new TreeControl()
|
||||
{
|
||||
ShowContextMenu = showContextMenu,
|
||||
IsDialog = isDialog,
|
||||
DialogMode = dialogMode,
|
||||
App = app,
|
||||
TreeType = string.IsNullOrEmpty(treeType) ? "" : treeType, //don't set the tree type unless explicitly set
|
||||
NodeKey = string.IsNullOrEmpty(nodeKey) ? "" : nodeKey,
|
||||
//StartNodeID = -1, //TODO: set this based on parameters!
|
||||
FunctionToCall = string.IsNullOrEmpty(functionToCall) ? "" : functionToCall
|
||||
};
|
||||
|
||||
var returnVal = new Dictionary<string, string>();
|
||||
var returnVal = new Dictionary<string, string>();
|
||||
|
||||
if (string.IsNullOrEmpty(treeType))
|
||||
{
|
||||
//if there's not tree type specified, then render out the tree as per normal with the normal
|
||||
//way of doing things
|
||||
returnVal.Add("json", treeCtl.GetJSONInitNode());
|
||||
}
|
||||
else
|
||||
{
|
||||
//since 4.5.1 has a bug in it, it ignores if the treeType is specified and will always only render
|
||||
//the whole APP not just a specific tree.
|
||||
//this is a work around for this bug until it is fixed (which should be fixed in 4.5.2
|
||||
if (string.IsNullOrEmpty(treeType))
|
||||
{
|
||||
//if there's not tree type specified, then render out the tree as per normal with the normal
|
||||
//way of doing things
|
||||
returnVal.Add("json", treeCtl.GetJSONInitNode());
|
||||
}
|
||||
else
|
||||
{
|
||||
//since 4.5.1 has a bug in it, it ignores if the treeType is specified and will always only render
|
||||
//the whole APP not just a specific tree.
|
||||
//this is a work around for this bug until it is fixed (which should be fixed in 4.5.2
|
||||
|
||||
//get the tree that we need to render
|
||||
var tree = TreeDefinitionCollection.Instance.FindTree(treeType).CreateInstance();
|
||||
tree.ShowContextMenu = showContextMenu;
|
||||
tree.IsDialog = isDialog;
|
||||
tree.DialogMode = dialogMode;
|
||||
tree.NodeKey = string.IsNullOrEmpty(nodeKey) ? "" : nodeKey;
|
||||
tree.FunctionToCall = string.IsNullOrEmpty(functionToCall) ? "" : functionToCall;
|
||||
//get the tree that we need to render
|
||||
var tree = TreeDefinitionCollection.Instance.FindTree(treeType).CreateInstance();
|
||||
tree.ShowContextMenu = showContextMenu;
|
||||
tree.IsDialog = isDialog;
|
||||
tree.DialogMode = dialogMode;
|
||||
tree.NodeKey = string.IsNullOrEmpty(nodeKey) ? "" : nodeKey;
|
||||
tree.FunctionToCall = string.IsNullOrEmpty(functionToCall) ? "" : functionToCall;
|
||||
|
||||
//now render it's start node
|
||||
var xTree = new XmlTree();
|
||||
//now render it's start node
|
||||
var xTree = new XmlTree();
|
||||
|
||||
//we're going to hijack the node name here to make it say content/media
|
||||
var node = tree.RootNode;
|
||||
if (node.Text.Equals("[FilteredContentTree]")) node.Text = ui.GetText("content");
|
||||
else if (node.Text.Equals("[FilteredMediaTree]")) node.Text = ui.GetText("media");
|
||||
xTree.Add(node);
|
||||
//we're going to hijack the node name here to make it say content/media
|
||||
var node = tree.RootNode;
|
||||
if (node.Text.Equals("[FilteredContentTree]")) node.Text = ui.GetText("content");
|
||||
else if (node.Text.Equals("[FilteredMediaTree]")) node.Text = ui.GetText("media");
|
||||
xTree.Add(node);
|
||||
|
||||
returnVal.Add("json", xTree.ToString());
|
||||
}
|
||||
returnVal.Add("json", xTree.ToString());
|
||||
}
|
||||
|
||||
returnVal.Add("app", app);
|
||||
returnVal.Add("js", treeCtl.JSCurrApp);
|
||||
returnVal.Add("app", app);
|
||||
returnVal.Add("js", treeCtl.JSCurrApp);
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
internal static void Authorize()
|
||||
{
|
||||
if (!umbraco.BasePages.BasePage.ValidateUserContextID(umbraco.BasePages.BasePage.umbracoUserContextID))
|
||||
throw new Exception("Client authorization failed. User is not logged in");
|
||||
}
|
||||
}
|
||||
internal static void Authorize()
|
||||
{
|
||||
if (!umbraco.BasePages.BasePage.ValidateUserContextID(umbraco.BasePages.BasePage.umbracoUserContextID))
|
||||
throw new Exception("Client authorization failed. User is not logged in");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.488
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace umbraco.controls.Tree
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class CustomTreeServiceResource {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal CustomTreeServiceResource() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("uComponents.Core.Shared.Tree.CustomTreeServiceResource", typeof(CustomTreeServiceResource).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to <%@ WebService language="C#" class="uComponents.Core.Shared.Tree.CustomTreeService" %>.
|
||||
/// </summary>
|
||||
internal static string CustomTreeService {
|
||||
get {
|
||||
return ResourceManager.GetString("CustomTreeService", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<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>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="CustomTreeService" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>customtreeservice.asmx;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -71,9 +71,7 @@ namespace umbraco
|
||||
/// <returns>
|
||||
/// empty string, or property value as string
|
||||
/// </returns>
|
||||
// TODO: [LK] Move to uComponents.Legacy project
|
||||
[Obsolete("Use .GetProperty<string>(propertyAlias) instead.", false)]
|
||||
public static string GetPropertyAsString(this Content item, string propertyAlias)
|
||||
internal static string GetPropertyAsString(this Content item, string propertyAlias)
|
||||
{
|
||||
var propertyValue = string.Empty;
|
||||
var property = item.getProperty(propertyAlias);
|
||||
@@ -94,9 +92,7 @@ namespace umbraco
|
||||
/// <returns>
|
||||
/// true if can cast value, else false for all other circumstances
|
||||
/// </returns>
|
||||
// TODO: [LK] Move to uComponents.Legacy project
|
||||
[Obsolete("Use .GetProperty<bool>(propertyAlias) instead.", false)]
|
||||
public static bool GetPropertyAsBoolean(this Content item, string propertyAlias)
|
||||
internal static bool GetPropertyAsBoolean(this Content item, string propertyAlias)
|
||||
{
|
||||
var propertyValue = false;
|
||||
var property = item.getProperty(propertyAlias);
|
||||
@@ -117,52 +113,6 @@ namespace umbraco
|
||||
return propertyValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a DateTime value from a content item's property.
|
||||
/// </summary>
|
||||
/// <param name="item">The content item.</param>
|
||||
/// <param name="propertyAlias">alias of propety to get</param>
|
||||
/// <returns>
|
||||
/// DateTime value or DateTime.MinValue for all other circumstances
|
||||
/// </returns>
|
||||
// TODO: [LK] Move to uComponents.Legacy project
|
||||
[Obsolete("Use .GetProperty<DateTime>(propertyAlias) instead.", false)]
|
||||
public static DateTime GetPropertyAsDateTime(this Content item, string propertyAlias)
|
||||
{
|
||||
var propertyValue = DateTime.MinValue;
|
||||
var property = item.getProperty(propertyAlias);
|
||||
|
||||
if (property != null && property.Value != null)
|
||||
{
|
||||
DateTime.TryParse(Convert.ToString(property.Value), out propertyValue);
|
||||
}
|
||||
|
||||
return propertyValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get an int value from a content item's property.
|
||||
/// </summary>
|
||||
/// <param name="item">The content item.</param>
|
||||
/// <param name="propertyAlias">alias of propety to get</param>
|
||||
/// <returns>
|
||||
/// int value of property or int.MinValue for all other circumstances
|
||||
/// </returns>
|
||||
// TODO: [LK] Move to uComponents.Legacy project
|
||||
[Obsolete("Use .GetProperty<int>(propertyAlias) instead.", false)]
|
||||
public static int GetPropertyAsInt(this Content item, string propertyAlias)
|
||||
{
|
||||
var propertyValue = int.MinValue;
|
||||
var property = item.getProperty(propertyAlias);
|
||||
|
||||
if (property != null && property.Value != null)
|
||||
{
|
||||
int.TryParse(Convert.ToString(property.Value), out propertyValue);
|
||||
}
|
||||
|
||||
return propertyValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the random content item.
|
||||
/// </summary>
|
||||
|
||||
@@ -130,7 +130,6 @@ namespace umbraco
|
||||
/// </summary>
|
||||
/// <param name="media">an umbraco.cms.businesslogic.media.Media object</param>
|
||||
/// <returns>an int representing the depth of the Media object in the tree</returns>
|
||||
// TODO: [LK] Move to uComponents.Legacy project
|
||||
[Obsolete("Use .Level instead")]
|
||||
public static int GetDepth(this Media media)
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,4 @@
|
||||
//using uComponents.Core.Shared;
|
||||
//using uComponents.Core.Shared.Extensions;
|
||||
using umbraco.cms.businesslogic.datatype;
|
||||
using umbraco.cms.businesslogic.datatype;
|
||||
|
||||
namespace umbraco
|
||||
{
|
||||
|
||||
@@ -166,7 +166,6 @@ namespace umbraco
|
||||
/// </summary>
|
||||
/// <param name="url">url to search for</param>
|
||||
/// <returns>null or node matching supplied url</returns>
|
||||
/// <remarks>Uses <c>uComponents.Core.XsltExtensions.Nodes.GetNodeIdByUrl</c></remarks>
|
||||
public static Node GetNodeByUrl(string url)
|
||||
{
|
||||
return uQuery.GetNode(uQuery.GetNodeIdByUrl(url));
|
||||
|
||||
Reference in New Issue
Block a user