using System;
using System.Collections.Generic;
using CMS.GlobalHelper;
///
/// Forum methods - wrapping methods for macro resolver.
///
public static class ForumMethods
{
///
/// Registers all forum methods to macro resolver.
///
public static void RegisterMethods()
{
// Get post URL
MacroMethod getPostURL = new MacroMethod("GetPostURL", GetPostURL)
{
Comment = "Returns link to selected post.",
Type = typeof(string),
MinimumParameters = 2,
AllowedTypes = new List() { typeof(TransformationNamespace) }
};
getPostURL.AddParameter("postIdPath", typeof(object), "Post ID path.");
getPostURL.AddParameter("forumId", typeof(object), "Forum ID.");
getPostURL.AddParameter("aliasPath", typeof(object), "Alias path.");
MacroMethods.RegisterMethod(getPostURL);
}
///
/// Returns link to selected post.
///
/// (Post ID path; Forum ID) OR (Post ID path; Forum ID; Alias path)
public static object GetPostURL(params object[] parameters)
{
switch (parameters.Length)
{
case 2:
return ForumFunctions.GetPostURL(parameters[0], parameters[1]);
case 3:
return ForumFunctions.GetPostURL(parameters[0], parameters[1], parameters[2]);
default:
throw new NotSupportedException();
}
}
}