Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

Commit

Permalink
Added two new methods to branch 1.3
Browse files Browse the repository at this point in the history
Data.GetSubCategories(int catId) returns a CategoryCollection of categories whos parent is the specified category id.
Macros.QueryString(string key) returns the specified query string from the url.

git-svn-id: https://graffiticms.svn.codeplex.com/svn/Branches/v1.3@63905 2327b42d-5241-43d6-9e2a-de5ac946f064
  • Loading branch information
SND\jkillebrew_cp authored and SND\jkillebrew_cp committed Nov 18, 2010
1 parent 162760d commit 79ad083
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Graffiti.Core/Data/Data.cs
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,24 @@ public Category GetCategory(string categoryName)
return category;
}

/// <summary>
/// Gets all Sub-Categories by the specified Category Id
/// </summary>
/// <param name="categoryId"></param>
/// <returns></returns>
public CategoryCollection GetSubCategories(int categoryId)
{
CategoryCollection categories = new CategoryCollection();

Query q = Category.CreateQuery();
q.AndWhere(Category.Columns.ParentId, categoryId);
q.OrderByDesc(Category.Columns.Name);

categories.LoadAndCloseReader(q.ExecuteReader());

return categories;
}

/// <summary>
/// Gets the last x amount specified of recent comments
/// </summary>
Expand Down
9 changes: 9 additions & 0 deletions src/Graffiti.Core/UI/Macros.cs
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,15 @@ public string SearchQuery
get { return HttpUtility.HtmlEncode(HttpContext.Current.Request.QueryString["q"]); }
}

/// <summary>
/// Returns the specified search query string value
/// </summary>
public string QueryString(string Key)
{
return HttpUtility.HtmlEncode(HttpContext.Current.Request[Key]);

}

/// <summary>
/// Returns the search url from $urls.Search
/// </summary>
Expand Down

0 comments on commit 79ad083

Please sign in to comment.