Changed the selection criteria for Content Items used by this template to only be published content and added a limit of 100 records returned

This commit is contained in:
agrath@gmail.com
2012-06-12 07:20:23 -01:00
parent 4be1a488b3
commit c58a1e2d97

View File

@@ -331,14 +331,20 @@ namespace umbraco.cms.businesslogic.template
{
return DocumentType.GetAllAsList().Where(x => x.allowedTemplates.Select(t => t.Id).Contains(this.Id));
}
public IEnumerable<object> GetContent()
public IEnumerable<System.Tuple<int, string>> GetContent()
{
List<System.Tuple<int, string>> list = new List<System.Tuple<int, string>>();
using (IRecordsReader dr = SqlHelper.ExecuteReader("Select nodeid, text from cmsDocument where templateId = " + this.Id))
using (IRecordsReader dr = SqlHelper.ExecuteReader("Select nodeid, text from cmsDocument where published = 1 and templateId = " + this.Id))
{
int i = 0;
while (dr.Read())
{
list.Add(new System.Tuple<int, string>(dr.GetInt("nodeid"), dr.GetString("text")));
i++;
if (i >= 100)
{
break;
}
}
dr.Close();
}