2014-06-08 09:51:06 -07:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using Umbraco.Web.Mvc;
|
2014-06-09 16:42:57 +01:00
|
|
|
|
using Umbraco.Web.WebApi;
|
2014-10-23 18:52:11 +10:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Diagnostics;
|
2016-06-10 16:37:28 +02:00
|
|
|
|
using Umbraco.Core.Models.PublishedContent;
|
2014-10-23 18:52:11 +10:00
|
|
|
|
using Umbraco.Web.Models.TemplateQuery;
|
2017-05-12 14:49:44 +02:00
|
|
|
|
using Umbraco.Core.Services;
|
2014-06-08 09:51:06 -07:00
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Web.Editors
|
|
|
|
|
|
{
|
2016-09-01 19:06:08 +02:00
|
|
|
|
|
2014-06-10 08:40:33 +01:00
|
|
|
|
|
2014-06-08 09:51:06 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The API controller used for building content queries within the template
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[PluginController("UmbracoApi")]
|
2014-06-09 16:42:57 +01:00
|
|
|
|
[JsonCamelCaseFormatter]
|
2014-06-08 09:51:06 -07:00
|
|
|
|
public class TemplateQueryController : UmbracoAuthorizedJsonController
|
|
|
|
|
|
{
|
2017-05-12 14:49:44 +02:00
|
|
|
|
private IEnumerable<OperathorTerm> Terms
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
2014-06-09 16:42:57 +01:00
|
|
|
|
{
|
2017-05-12 14:49:44 +02:00
|
|
|
|
return new List<OperathorTerm>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new OperathorTerm(Services.TextService.Localize("template/is"), Operathor.Equals, new [] {"string"}),
|
|
|
|
|
|
new OperathorTerm(Services.TextService.Localize("template/isNot"), Operathor.NotEquals, new [] {"string"}),
|
|
|
|
|
|
new OperathorTerm(Services.TextService.Localize("template/before"), Operathor.LessThan, new [] {"datetime"}),
|
|
|
|
|
|
new OperathorTerm(Services.TextService.Localize("template/beforeIncDate"), Operathor.LessThanEqualTo, new [] {"datetime"}),
|
|
|
|
|
|
new OperathorTerm(Services.TextService.Localize("template/after"), Operathor.GreaterThan, new [] {"datetime"}),
|
|
|
|
|
|
new OperathorTerm(Services.TextService.Localize("template/afterIncDate"), Operathor.GreaterThanEqualTo, new [] {"datetime"}),
|
|
|
|
|
|
new OperathorTerm(Services.TextService.Localize("template/equals"), Operathor.Equals, new [] {"int"}),
|
|
|
|
|
|
new OperathorTerm(Services.TextService.Localize("template/doesNotEqual"), Operathor.NotEquals, new [] {"int"}),
|
|
|
|
|
|
new OperathorTerm(Services.TextService.Localize("template/contains"), Operathor.Contains, new [] {"string"}),
|
|
|
|
|
|
new OperathorTerm(Services.TextService.Localize("template/doesNotContain"), Operathor.NotContains, new [] {"string"}),
|
|
|
|
|
|
new OperathorTerm(Services.TextService.Localize("template/greaterThan"), Operathor.GreaterThan, new [] {"int"}),
|
|
|
|
|
|
new OperathorTerm(Services.TextService.Localize("template/greaterThanEqual"), Operathor.GreaterThanEqualTo, new [] {"int"}),
|
|
|
|
|
|
new OperathorTerm(Services.TextService.Localize("template/lessThan"), Operathor.LessThan, new [] {"int"}),
|
|
|
|
|
|
new OperathorTerm(Services.TextService.Localize("template/lessThanEqual"), Operathor.LessThanEqualTo, new [] {"int"})
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-06-08 10:20:34 -07:00
|
|
|
|
|
2017-05-12 14:49:44 +02:00
|
|
|
|
private IEnumerable<PropertyModel> Properties
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return new List<PropertyModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new PropertyModel() {Name = Services.TextService.Localize("template/id"), Alias = "Id", Type = "int"},
|
|
|
|
|
|
new PropertyModel() {Name = Services.TextService.Localize("template/name"), Alias = "Name", Type = "string"},
|
|
|
|
|
|
//new PropertyModel() { Name = "Url", Alias = "url", Type = "string" },
|
|
|
|
|
|
new PropertyModel() {Name = Services.TextService.Localize("template/createdDate"), Alias = "CreateDate", Type = "datetime"},
|
|
|
|
|
|
new PropertyModel() {Name = Services.TextService.Localize("template/lastUpdatedDate"), Alias = "UpdateDate", Type = "datetime"}
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-06-09 16:42:57 +01:00
|
|
|
|
|
|
|
|
|
|
public QueryResultModel PostTemplateQuery(QueryModel model)
|
2014-06-08 09:51:06 -07:00
|
|
|
|
{
|
2016-09-01 19:06:08 +02:00
|
|
|
|
var umbraco = new UmbracoHelper(UmbracoContext, Services, ApplicationCache);
|
2014-06-08 09:51:06 -07:00
|
|
|
|
|
|
|
|
|
|
var queryResult = new QueryResultModel();
|
|
|
|
|
|
|
|
|
|
|
|
var sb = new StringBuilder();
|
2017-05-12 14:49:44 +02:00
|
|
|
|
var indention = Environment.NewLine + "\t\t\t\t\t\t";
|
|
|
|
|
|
|
|
|
|
|
|
sb.Append("Model.Content.Site()");
|
|
|
|
|
|
|
2014-06-08 22:39:01 +01:00
|
|
|
|
var timer = new Stopwatch();
|
2016-09-01 19:06:08 +02:00
|
|
|
|
|
2014-06-08 22:39:01 +01:00
|
|
|
|
timer.Start();
|
|
|
|
|
|
|
2016-06-30 18:35:43 +02:00
|
|
|
|
var currentPage = umbraco.ContentAtRoot().FirstOrDefault();
|
2014-06-08 22:39:01 +01:00
|
|
|
|
timer.Stop();
|
2014-06-08 09:51:06 -07:00
|
|
|
|
|
2014-06-09 13:18:35 +01:00
|
|
|
|
|
|
|
|
|
|
var pointerNode = currentPage;
|
|
|
|
|
|
|
2014-06-08 09:51:06 -07:00
|
|
|
|
// adjust the "FROM"
|
2014-06-09 16:42:57 +01:00
|
|
|
|
if (model != null && model.Source.Id > 0)
|
2014-06-08 09:51:06 -07:00
|
|
|
|
{
|
2016-06-30 18:35:43 +02:00
|
|
|
|
var targetNode = umbraco.Content(model.Source.Id);
|
2014-06-08 09:51:06 -07:00
|
|
|
|
|
2015-08-11 10:40:18 +02:00
|
|
|
|
if (targetNode != null)
|
2014-06-09 13:18:35 +01:00
|
|
|
|
{
|
2015-08-11 10:40:18 +02:00
|
|
|
|
var aliases = this.GetChildContentTypeAliases(targetNode, currentPage).Reverse();
|
2014-06-09 13:18:35 +01:00
|
|
|
|
|
2015-08-11 10:40:18 +02:00
|
|
|
|
foreach (var contentTypeAlias in aliases)
|
|
|
|
|
|
{
|
|
|
|
|
|
timer.Start();
|
2014-06-09 13:18:35 +01:00
|
|
|
|
|
2015-08-11 10:40:18 +02:00
|
|
|
|
pointerNode = pointerNode.FirstChild(x => x.DocumentTypeAlias == contentTypeAlias);
|
2014-06-09 13:18:35 +01:00
|
|
|
|
|
2015-08-11 10:40:18 +02:00
|
|
|
|
if (pointerNode == null) break;
|
2014-06-09 13:18:35 +01:00
|
|
|
|
|
2015-08-11 10:40:18 +02:00
|
|
|
|
timer.Stop();
|
|
|
|
|
|
|
|
|
|
|
|
sb.AppendFormat(".FirstChild(\"{0}\")", contentTypeAlias);
|
|
|
|
|
|
}
|
2014-06-09 23:23:31 +01:00
|
|
|
|
|
2015-08-11 10:40:18 +02:00
|
|
|
|
if (pointerNode == null || pointerNode.Id != model.Source.Id)
|
|
|
|
|
|
{
|
|
|
|
|
|
// we did not find the path
|
|
|
|
|
|
sb.Clear();
|
2017-05-12 14:49:44 +02:00
|
|
|
|
sb.AppendFormat("Umbraco.TypedContent({0})", model.Source.Id);
|
2015-08-11 10:40:18 +02:00
|
|
|
|
pointerNode = targetNode;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-06-08 09:51:06 -07:00
|
|
|
|
}
|
2016-09-01 19:06:08 +02:00
|
|
|
|
|
|
|
|
|
|
// TYPE to return if filtered by type
|
2014-06-08 09:51:06 -07:00
|
|
|
|
IEnumerable<IPublishedContent> contents;
|
2014-06-09 16:42:57 +01:00
|
|
|
|
if (model != null && string.IsNullOrEmpty(model.ContentType.Alias) == false)
|
2014-06-08 09:51:06 -07:00
|
|
|
|
{
|
2014-06-08 22:39:01 +01:00
|
|
|
|
timer.Start();
|
2014-06-09 13:18:35 +01:00
|
|
|
|
|
2014-06-09 16:42:57 +01:00
|
|
|
|
contents = pointerNode.Children.OfTypes(new[] { model.ContentType.Alias });
|
2014-06-08 09:51:06 -07:00
|
|
|
|
|
2014-06-08 22:39:01 +01:00
|
|
|
|
timer.Stop();
|
2014-06-09 13:18:35 +01:00
|
|
|
|
// TODO change to .Children({0})
|
2014-06-09 16:42:57 +01:00
|
|
|
|
sb.AppendFormat(".Children(\"{0}\")", model.ContentType.Alias);
|
2014-06-08 09:51:06 -07:00
|
|
|
|
}
|
2014-06-08 22:39:01 +01:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
timer.Start();
|
2014-06-09 13:18:35 +01:00
|
|
|
|
contents = pointerNode.Children;
|
2014-06-08 22:39:01 +01:00
|
|
|
|
timer.Stop();
|
2017-05-12 14:49:44 +02:00
|
|
|
|
sb.Append(".Children()");
|
2014-06-08 22:39:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-05-12 14:49:44 +02:00
|
|
|
|
//setup 2 clauses, 1 for returning, 1 for testing
|
2014-06-08 22:39:01 +01:00
|
|
|
|
var clause = string.Empty;
|
2017-05-12 14:49:44 +02:00
|
|
|
|
var tokenizedClause = string.Empty;
|
2014-06-08 09:51:06 -07:00
|
|
|
|
|
|
|
|
|
|
// WHERE
|
2014-06-09 23:23:31 +01:00
|
|
|
|
var token = 0;
|
2014-06-10 14:05:57 +01:00
|
|
|
|
|
|
|
|
|
|
if (model != null)
|
2014-06-08 09:51:06 -07:00
|
|
|
|
{
|
2014-06-10 14:05:57 +01:00
|
|
|
|
model.Filters = model.Filters.Where(x => x.ConstraintValue != null);
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var condition in model.Filters)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(string.IsNullOrEmpty( condition.ConstraintValue)) continue;
|
2017-05-12 14:49:44 +02:00
|
|
|
|
|
|
|
|
|
|
//x is passed in as the parameter alias for the linq where statement clause
|
|
|
|
|
|
var operation = condition.BuildCondition("x");
|
|
|
|
|
|
var tokenizedOperation = condition.BuildTokenizedCondition(token);
|
2014-06-08 09:51:06 -07:00
|
|
|
|
|
2014-06-10 14:05:57 +01:00
|
|
|
|
clause = string.IsNullOrEmpty(clause) ? operation : string.Concat(new[] { clause, " && ", operation });
|
2017-05-12 14:49:44 +02:00
|
|
|
|
tokenizedClause = string.IsNullOrEmpty(tokenizedClause) ? tokenizedOperation : string.Concat(new[] { tokenizedClause, " && ", tokenizedOperation });
|
2014-06-08 22:39:01 +01:00
|
|
|
|
|
2014-06-10 14:05:57 +01:00
|
|
|
|
token++;
|
|
|
|
|
|
}
|
2014-06-08 22:39:01 +01:00
|
|
|
|
|
2014-06-10 14:05:57 +01:00
|
|
|
|
if (string.IsNullOrEmpty(clause) == false)
|
|
|
|
|
|
{
|
2014-06-09 23:23:31 +01:00
|
|
|
|
|
2014-06-10 14:05:57 +01:00
|
|
|
|
timer.Start();
|
2014-06-09 23:23:31 +01:00
|
|
|
|
|
2017-05-12 14:49:44 +02:00
|
|
|
|
//trial-run the tokenized clause to time the execution
|
|
|
|
|
|
//for review - this uses a tonized query rather then the normal linq query.
|
2016-06-30 16:39:05 +02:00
|
|
|
|
// fixme - that cannot work anymore now that we have killed dynamic support
|
|
|
|
|
|
//contents = contents.AsQueryable().Where(clause, model.Filters.Select(this.GetConstraintValue).ToArray());
|
2017-05-12 14:49:44 +02:00
|
|
|
|
throw new NotImplementedException();
|
2016-06-30 16:39:05 +02:00
|
|
|
|
|
2014-06-10 14:05:57 +01:00
|
|
|
|
contents = contents.Where(x => x.IsVisible());
|
2014-06-10 08:40:33 +01:00
|
|
|
|
|
2014-06-10 14:05:57 +01:00
|
|
|
|
timer.Stop();
|
2017-05-12 14:49:44 +02:00
|
|
|
|
|
|
|
|
|
|
//the query to output to the editor
|
|
|
|
|
|
sb.Append(indention);
|
|
|
|
|
|
sb.Append(".Where(x => x.IsVisible())");
|
2014-06-10 08:40:33 +01:00
|
|
|
|
|
2017-05-12 14:49:44 +02:00
|
|
|
|
sb.Append(indention);
|
|
|
|
|
|
sb.AppendFormat(".Where(x => {0})", clause);
|
2014-06-08 22:39:01 +01:00
|
|
|
|
|
2014-06-10 14:05:57 +01:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
timer.Start();
|
2014-06-10 08:40:33 +01:00
|
|
|
|
|
2014-06-10 14:05:57 +01:00
|
|
|
|
contents = contents.Where(x => x.IsVisible());
|
2014-06-10 08:40:33 +01:00
|
|
|
|
|
2014-06-10 14:05:57 +01:00
|
|
|
|
timer.Stop();
|
2014-06-10 08:40:33 +01:00
|
|
|
|
|
2017-05-12 14:49:44 +02:00
|
|
|
|
sb.Append(indention);
|
|
|
|
|
|
sb.Append(".Where(x => x.IsVisible())");
|
2014-06-10 08:40:33 +01:00
|
|
|
|
|
2014-06-10 14:05:57 +01:00
|
|
|
|
}
|
2014-06-08 09:51:06 -07:00
|
|
|
|
|
2014-06-10 14:05:57 +01:00
|
|
|
|
if (model.Sort != null && string.IsNullOrEmpty(model.Sort.Property.Alias) == false)
|
|
|
|
|
|
{
|
|
|
|
|
|
timer.Start();
|
2014-06-09 13:18:35 +01:00
|
|
|
|
|
2014-06-10 14:05:57 +01:00
|
|
|
|
contents = this.SortByDefaultPropertyValue(contents, model.Sort);
|
2014-06-09 13:18:35 +01:00
|
|
|
|
|
2014-06-10 14:05:57 +01:00
|
|
|
|
timer.Stop();
|
2014-06-09 13:18:35 +01:00
|
|
|
|
|
2014-06-10 14:05:57 +01:00
|
|
|
|
var direction = model.Sort.Direction == "ascending" ? string.Empty : " desc";
|
2014-06-09 13:18:35 +01:00
|
|
|
|
|
2017-05-12 14:49:44 +02:00
|
|
|
|
sb.Append(indention);
|
2014-06-10 16:43:28 +01:00
|
|
|
|
sb.AppendFormat(".OrderBy(\"{0}{1}\")", model.Sort.Property.Alias, direction);
|
2014-06-10 14:05:57 +01:00
|
|
|
|
}
|
2014-06-09 13:18:35 +01:00
|
|
|
|
|
2014-06-10 14:05:57 +01:00
|
|
|
|
if (model.Take > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
timer.Start();
|
2014-06-09 13:18:35 +01:00
|
|
|
|
|
2014-06-10 14:05:57 +01:00
|
|
|
|
contents = contents.Take(model.Take);
|
2014-06-09 13:18:35 +01:00
|
|
|
|
|
2014-06-10 14:05:57 +01:00
|
|
|
|
timer.Stop();
|
2014-06-09 13:18:35 +01:00
|
|
|
|
|
2017-05-12 14:49:44 +02:00
|
|
|
|
sb.Append(indention);
|
2014-06-10 14:05:57 +01:00
|
|
|
|
sb.AppendFormat(".Take({0})", model.Take);
|
|
|
|
|
|
}
|
2014-06-09 13:18:35 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2014-06-08 09:51:06 -07:00
|
|
|
|
queryResult.QueryExpression = sb.ToString();
|
2014-06-08 22:39:01 +01:00
|
|
|
|
queryResult.ExecutionTime = timer.ElapsedMilliseconds;
|
|
|
|
|
|
queryResult.ResultCount = contents.Count();
|
|
|
|
|
|
queryResult.SampleResults = contents.Take(20).Select(x => new TemplateQueryResult()
|
|
|
|
|
|
{
|
|
|
|
|
|
Icon = "icon-file",
|
|
|
|
|
|
Name = x.Name
|
|
|
|
|
|
});
|
2014-06-08 09:51:06 -07:00
|
|
|
|
|
2014-06-09 13:18:35 +01:00
|
|
|
|
|
2017-05-12 14:49:44 +02:00
|
|
|
|
return queryResult;
|
2014-06-08 09:51:06 -07:00
|
|
|
|
}
|
2014-06-09 13:18:35 +01:00
|
|
|
|
|
2014-06-09 23:23:31 +01:00
|
|
|
|
private object GetConstraintValue(QueryCondition condition)
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (condition.Property.Type)
|
|
|
|
|
|
{
|
|
|
|
|
|
case "int" :
|
|
|
|
|
|
return int.Parse(condition.ConstraintValue);
|
|
|
|
|
|
case "datetime":
|
|
|
|
|
|
DateTime dt;
|
|
|
|
|
|
return DateTime.TryParse(condition.ConstraintValue, out dt) ? dt : DateTime.Today;
|
|
|
|
|
|
default:
|
|
|
|
|
|
return condition.ConstraintValue;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private IEnumerable<IPublishedContent> SortByDefaultPropertyValue(IEnumerable<IPublishedContent> contents, SortExpression sortExpression)
|
2014-06-09 09:14:26 -07:00
|
|
|
|
{
|
2014-06-09 23:23:31 +01:00
|
|
|
|
switch (sortExpression.Property.Alias)
|
2014-06-09 09:14:26 -07:00
|
|
|
|
{
|
|
|
|
|
|
case "id" :
|
2014-06-09 23:23:31 +01:00
|
|
|
|
return sortExpression.Direction == "ascending"
|
|
|
|
|
|
? contents.OrderBy(x => x.Id)
|
|
|
|
|
|
: contents.OrderByDescending(x => x.Id);
|
2014-06-09 09:14:26 -07:00
|
|
|
|
case "createDate" :
|
2016-09-01 19:06:08 +02:00
|
|
|
|
|
2014-06-09 23:23:31 +01:00
|
|
|
|
return sortExpression.Direction == "ascending"
|
|
|
|
|
|
? contents.OrderBy(x => x.CreateDate)
|
|
|
|
|
|
: contents.OrderByDescending(x => x.CreateDate);
|
2014-06-09 09:14:26 -07:00
|
|
|
|
case "publishDate":
|
2016-09-01 19:06:08 +02:00
|
|
|
|
|
2014-06-09 23:23:31 +01:00
|
|
|
|
return sortExpression.Direction == "ascending"
|
|
|
|
|
|
? contents.OrderBy(x => x.UpdateDate)
|
|
|
|
|
|
: contents.OrderByDescending(x => x.UpdateDate);
|
2014-06-09 09:14:26 -07:00
|
|
|
|
case "name":
|
2014-06-09 23:23:31 +01:00
|
|
|
|
return sortExpression.Direction == "ascending"
|
|
|
|
|
|
? contents.OrderBy(x => x.Name)
|
|
|
|
|
|
: contents.OrderByDescending(x => x.Name);
|
2014-06-09 09:14:26 -07:00
|
|
|
|
default :
|
2014-06-09 23:23:31 +01:00
|
|
|
|
|
|
|
|
|
|
return sortExpression.Direction == "ascending"
|
|
|
|
|
|
? contents.OrderBy(x => x.Name)
|
|
|
|
|
|
: contents.OrderByDescending(x => x.Name);
|
2014-06-09 09:14:26 -07:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2016-09-01 19:06:08 +02:00
|
|
|
|
|
2014-06-09 13:18:35 +01:00
|
|
|
|
private IEnumerable<string> GetChildContentTypeAliases(IPublishedContent targetNode, IPublishedContent current)
|
|
|
|
|
|
{
|
|
|
|
|
|
var aliases = new List<string>();
|
2016-09-01 19:06:08 +02:00
|
|
|
|
|
2014-06-09 13:18:35 +01:00
|
|
|
|
if (targetNode.Id == current.Id) return aliases;
|
|
|
|
|
|
if (targetNode.Id != current.Id)
|
|
|
|
|
|
{
|
|
|
|
|
|
aliases.Add(targetNode.DocumentTypeAlias);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
aliases.AddRange(this.GetChildContentTypeAliases(targetNode.Parent, current));
|
|
|
|
|
|
|
|
|
|
|
|
return aliases;
|
|
|
|
|
|
}
|
2014-06-09 16:42:57 +01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets a list of all content types
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public IEnumerable<ContentTypeModel> GetContentTypes()
|
|
|
|
|
|
{
|
2016-09-01 19:06:08 +02:00
|
|
|
|
var contentTypes = Services.ContentTypeService.GetAll()
|
2017-05-12 14:49:44 +02:00
|
|
|
|
.Select(x => new ContentTypeModel { Alias = x.Alias, Name = Services.TextService.Localize("template/contentOfType", tokens: new string[] { x.Name } ) })
|
2016-09-01 19:06:08 +02:00
|
|
|
|
.OrderBy(x => x.Name).ToList();
|
2017-05-12 14:49:44 +02:00
|
|
|
|
|
|
|
|
|
|
contentTypes.Insert(0, new ContentTypeModel { Alias = string.Empty, Name = Services.TextService.Localize("template/allContent") });
|
2014-06-09 23:23:31 +01:00
|
|
|
|
|
|
|
|
|
|
return contentTypes;
|
2014-06-09 16:42:57 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Returns a collection of allowed properties.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public IEnumerable<PropertyModel> GetAllowedProperties()
|
|
|
|
|
|
{
|
2014-10-23 18:52:11 +10:00
|
|
|
|
return Properties.OrderBy(x => x.Name);
|
2014-06-09 16:42:57 +01:00
|
|
|
|
}
|
2014-06-09 13:18:35 +01:00
|
|
|
|
|
2014-06-08 09:51:06 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Returns a collection of constraint conditions that can be used in the query
|
|
|
|
|
|
/// </summary>
|
2014-06-09 16:42:57 +01:00
|
|
|
|
public IEnumerable<object> GetFilterConditions()
|
2014-06-08 09:51:06 -07:00
|
|
|
|
{
|
2014-10-23 18:52:11 +10:00
|
|
|
|
return Terms;
|
2014-06-08 09:51:06 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|