This commit is contained in:
agrath@gmail.com
2012-06-11 14:48:51 -01:00
9 changed files with 36 additions and 46 deletions

View File

@@ -3,6 +3,7 @@ using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.XPath;
using umbraco.cms.businesslogic.datatype;
using System.Linq;
namespace umbraco.editorControls.XPathCheckBoxList
{
@@ -139,7 +140,7 @@ namespace umbraco.editorControls.XPathCheckBoxList
try
{
if (uQuery.GetNodesByXPath(xPath).Count >= 0)
if (uQuery.GetNodesByXPath(xPath).Count() >= 0)
{
isValid = true;
}

View File

@@ -1,4 +1,5 @@
using System;
using System.Linq;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.XPath;
@@ -119,7 +120,7 @@ namespace umbraco.editorControls.XPathDropDownList
try
{
if (uQuery.GetNodesByXPath(xPath).Count >= 0)
if (uQuery.GetNodesByXPath(xPath).Count() >= 0)
{
isValid = true;
}

View File

@@ -18,7 +18,7 @@ namespace umbraco.cms.presentation.Trees.RelationTypes
{
Application developerSection = Application.getByAlias("developer");
ApplicationTree relationTypesApplicationTree = new ApplicationTree(false, true, 1, "developer", "relationTypesTree", "Relation Types", ".sprTreeFolder", ".sprTreeFolder_0", "Umbraco.RelationTypes", "RelationTypeTree", null);
ApplicationTree relationTypesApplicationTree = new ApplicationTree(false, true, 3, "developer", "relationTypesTree", "Relation Types", ".sprTreeFolder", ".sprTreeFolder_0", "umbraco", "cms.presentation.Trees.RelationTypes.RelationTypeTree", null);
TreeDefinition relationTypesTreeDefinition = new TreeDefinition(typeof(umbraco.cms.presentation.Trees.RelationTypes.RelationTypeTree), relationTypesApplicationTree, developerSection);

View File

@@ -125,16 +125,16 @@ namespace umbraco
}
}
/// <summary>
/// Extension method on Meia obj to get it's depth
/// </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>
[Obsolete("Use .Level instead")]
public static int GetDepth(this Media media)
{
return media.Path.Split(',').ToList().Count;
}
/////// <summary>
/////// Extension method on Meia obj to get it's depth
/////// </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>
////[Obsolete("Use .Level instead")]
////public static int GetDepth(this Media media)
////{
//// return media.Path.Split(',').ToList().Count;
////}
/// <summary>
/// Tell me the level of this node (0 = root)

View File

@@ -576,18 +576,6 @@ namespace umbraco
return node.NiceUrl.Replace(library.RequestServerVariables("HTTP_HOST"), string.Concat((ssl ? "https://" : "http://"), domain.Name));
}
/// <summary>
/// Determines whether [the specified node] [is hidden from navigation].
/// </summary>
/// <param name="node">The node.</param>
/// <returns>
/// <c>true</c> if [the specified node] [is hidden from navigation]; otherwise, <c>false</c>.
/// </returns>
public static bool IsHiddenFromNavigation(this Node node)
{
// TODO: [OA] Document on Codeplex. Is this one really necessary? - [HR] this one could be confusing as depends on default naming convention
return node.GetProperty<bool>("umbracoNaviHide");
}
#pragma warning disable 0618
/// <summary>

View File

@@ -10,7 +10,7 @@ namespace umbraco
/// </summary>
/// <param name="csv">string csv of IDs</param>
/// <returns>collection or emtpy collection</returns>
public static List<Document> GetDocumentsByCsv(string csv)
public static IEnumerable<Document> GetDocumentsByCsv(string csv)
{
var documents = new List<Document>();
var ids = uQuery.GetCsvIds(csv);
@@ -35,7 +35,7 @@ namespace umbraco
/// </summary>
/// <param name="xml">The XML.</param>
/// <returns></returns>
public static List<Document> GetDocumentsByXml(string xml)
public static IEnumerable<Document> GetDocumentsByXml(string xml)
{
var documents = new List<Document>();
var ids = uQuery.GetXmlIds(xml);
@@ -130,7 +130,7 @@ namespace umbraco
/// </summary>
/// <param name="documents">generic list of Document objects</param>
/// <returns>a collection of document IDs and their text fields</returns>
public static Dictionary<int, string> ToNameIds(this List<Document> documents)
public static Dictionary<int, string> ToNameIds(this IEnumerable<Document> documents)
{
var dictionary = new Dictionary<int, string>();

View File

@@ -10,7 +10,7 @@ namespace umbraco
/// </summary>
/// <param name="xPath">XPath expression</param>
/// <returns>collection or empty collection</returns>
public static List<Media> GetMediaByXPath(string xPath)
public static IEnumerable<Media> GetMediaByXPath(string xPath)
{
var media = new List<Media>();
var xmlDocument = uQuery.GetPublishedXml(UmbracoObjectType.Media);
@@ -34,7 +34,7 @@ namespace umbraco
/// </summary>
/// <param name="csv">string csv of IDs</param>
/// <returns>collection or emtpy collection</returns>
public static List<Media> GetMediaByCsv(string csv)
public static IEnumerable<Media> GetMediaByCsv(string csv)
{
var media = new List<Media>();
var ids = uQuery.GetCsvIds(csv);
@@ -59,7 +59,7 @@ namespace umbraco
/// </summary>
/// <param name="xml">The XML.</param>
/// <returns></returns>
public static List<Media> GetMediaByXml(string xml)
public static IEnumerable<Media> GetMediaByXml(string xml)
{
var media = new List<Media>();
var ids = uQuery.GetXmlIds(xml);
@@ -84,7 +84,7 @@ namespace umbraco
/// </summary>
/// <param name="name">name of node to look for</param>
/// <returns>list of nodes, or empty list</returns>
public static List<Media> GetMediaByName(string name)
public static IEnumerable<Media> GetMediaByName(string name)
{
return uQuery.GetMediaByXPath(string.Concat("descendant::*[@nodeName='", name, "']"));
}
@@ -94,7 +94,7 @@ namespace umbraco
/// </summary>
/// <param name="mediaTypeAlias">The media type alias</param>
/// <returns>list of media, or empty list</returns>
public static List<Media> GetMediaByType(string mediaTypeAlias)
public static IEnumerable<Media> GetMediaByType(string mediaTypeAlias)
{
// Both XML schema versions have this attribute
return uQuery.GetMediaByXPath(string.Concat("descendant::*[@nodeTypeAlias='", mediaTypeAlias, "']"));
@@ -143,7 +143,7 @@ namespace umbraco
/// </summary>
/// <param name="media">generic list of Media objects</param>
/// <returns>a collection of mediaIDs and their text fields</returns>
public static Dictionary<int, string> ToNameIds(this List<Media> media)
public static Dictionary<int, string> ToNameIds(this IEnumerable<Media> media)
{
var dictionary = new Dictionary<int, string>();

View File

@@ -10,7 +10,7 @@ namespace umbraco
/// </summary>
/// <param name="xPath">XPath expression</param>
/// <returns>collection or empty collection</returns>
public static List<Member> GetMembersByXPath(string xPath)
public static IEnumerable<Member> GetMembersByXPath(string xPath)
{
var members = new List<Member>();
var xmlDocument = uQuery.GetPublishedXml(UmbracoObjectType.Member);
@@ -34,7 +34,7 @@ namespace umbraco
/// </summary>
/// <param name="csv">string csv of IDs</param>
/// <returns>collection or emtpy collection</returns>
public static List<Member> GetMembersByCsv(string csv)
public static IEnumerable<Member> GetMembersByCsv(string csv)
{
var members = new List<Member>();
var ids = uQuery.GetCsvIds(csv);
@@ -59,7 +59,7 @@ namespace umbraco
/// </summary>
/// <param name="xml">The XML.</param>
/// <returns></returns>
public static List<Member> GetMembersByXml(string xml)
public static IEnumerable<Member> GetMembersByXml(string xml)
{
var members = new List<Member>();
var ids = uQuery.GetXmlIds(xml);
@@ -81,7 +81,7 @@ namespace umbraco
/// </summary>
/// <param name="memberTypeAlias">The member type alias</param>
/// <returns>list of members, or empty list</returns>
public static List<Member> GetMembersByType(string memberTypeAlias)
public static IEnumerable<Member> GetMembersByType(string memberTypeAlias)
{
// Both XML schema versions have this attribute
return uQuery.GetMembersByXPath(string.Concat("descendant::*[@nodeTypeAlias='", memberTypeAlias, "']"));
@@ -131,7 +131,7 @@ namespace umbraco
/// </summary>
/// <param name="members">generic list of Member objects</param>
/// <returns>a collection of memberIDs and their login names</returns>
public static Dictionary<int, string> ToNameIds(this List<Member> members)
public static Dictionary<int, string> ToNameIds(this IEnumerable<Member> members)
{
var dictionary = new Dictionary<int, string>();

View File

@@ -23,7 +23,7 @@ namespace umbraco
/// <param name="xpath">XPath expression to get Nodes, can use $ancestorOrSelf which will use the current Node if published, else it'll use the nearest published parent
/// $currentPage will be depreciated</param>
/// <returns>an empty collection or a collection of nodes</returns>
public static List<Node> GetNodesByXPath(string xpath)
public static IEnumerable<Node> GetNodesByXPath(string xpath)
{
var nodes = new List<Node>();
@@ -72,7 +72,7 @@ namespace umbraco
/// </summary>
/// <param name="csv">string csv of Ids</param>
/// <returns>an empty collection or a collection or Nodes</returns>
public static List<Node> GetNodesByCsv(string csv)
public static IEnumerable<Node> GetNodesByCsv(string csv)
{
var nodes = new List<Node>();
var ids = uQuery.GetCsvIds(csv);
@@ -104,7 +104,7 @@ namespace umbraco
/// </MultiNodePicker>"
/// </param>
/// <returns>an empty list or a list of nodes</returns>
public static List<Node> GetNodesByXml(string xml)
public static IEnumerable<Node> GetNodesByXml(string xml)
{
var nodes = new List<Node>();
var ids = uQuery.GetXmlIds(xml);
@@ -129,7 +129,7 @@ namespace umbraco
/// </summary>
/// <param name="name">name of node to look for</param>
/// <returns>list of nodes, or empty list</returns>
public static List<Node> GetNodesByName(string name)
public static IEnumerable<Node> GetNodesByName(string name)
{
return uQuery.GetNodesByXPath(string.Concat("descendant::*[@nodeName='", name, "']"));
}
@@ -139,7 +139,7 @@ namespace umbraco
/// </summary>
/// <param name="documentTypeAlias">The document type alias</param>
/// <returns>list of nodes, or empty list</returns>
public static List<Node> GetNodesByType(string documentTypeAlias)
public static IEnumerable<Node> GetNodesByType(string documentTypeAlias)
{
if (uQuery.IsLegacyXmlSchema())
{
@@ -156,7 +156,7 @@ namespace umbraco
/// </summary>
/// <param name="documentTypeId">The document type id.</param>
/// <returns></returns>
public static List<Node> GetNodesByType(int documentTypeId)
public static IEnumerable<Node> GetNodesByType(int documentTypeId)
{
return uQuery.GetNodesByXPath(string.Concat("descendant::*[@nodeType='", documentTypeId, "']"));
}
@@ -346,7 +346,7 @@ namespace umbraco
/// </summary>
/// <param name="nodes">generic list of node objects</param>
/// <returns>a collection of nodeIDs and their names</returns>
public static Dictionary<int, string> ToNameIds(this List<Node> nodes)
public static Dictionary<int, string> ToNameIds(this IEnumerable<Node> nodes)
{
var dictionary = new Dictionary<int, string>();