* Profile.aspx: * MyProfile.aspx: * AccountController.cs: renamed the Profile method to "MyProfile", could avoid issue at migrating to MVC5 * favicon.png: favicon now displays a ~"Yavsc" * BlogManager.cs: * BlogsApiController.cs: The authorisation for removing a post is now implemented at Manager's side * BlogsController.cs: Removes this odd call to a static method from the Api controller * CalendarApi.cs: * GoogleController.cs: no more json output for the calls to the Google Api * WorkFlowController.cs: sorted using clauses * Basket.cs: * Commande.cs: * EstimToPdfFormatter.cs: * Brand.cs: adds xml doc * RssFeedsFormatter.cs: modifies xml doc * TexToPdfFormatter.cs: refactoring * Global.asax.cs: Document formatting * BBCodeHelper.cs: encapsulates the url display from the BBCode in starting and closing characters : "<>" * OAuth2.cs: * SimpleJsonPostMethod.cs: using System.Runtime.Serialization.Json instead of Newtonsof.Json * App.master: updating the favicon * RegistrationPending.aspx: fixes the returnUrl usage * AssemblyInfo.aspx: better explanation for this list * Web.config: tried to migrate to MVC5 (using NuGets) * Estim.cs: * ChangePasswordModel.cs: adds xmldoc * BasketController.cs: * BlogProvidersConfigurationSection.cs: cosmetic change * GoogleErrorMessage.cs: - adds xml docs - renders ctor from JsonReaderException obsolete * MvcActionValueBinder.cs: not used * web.config: no more used, gave it up to migrate to MVC5
83 lines
2.3 KiB
C#
83 lines
2.3 KiB
C#
using System;
|
|
using Yavsc.Model.Blogs;
|
|
using Yavsc.Model.RolesAndMembers;
|
|
using System.Web;
|
|
using System.Web.Security;
|
|
|
|
|
|
namespace Yavsc.Model.Blogs
|
|
{
|
|
public static class BlogManager
|
|
{
|
|
public static long RemoveComment(long cmtid)
|
|
{
|
|
return Provider.RemoveComment (cmtid);
|
|
}
|
|
|
|
public static void Comment (string from, long postid, string content, bool visible)
|
|
{
|
|
provider.Comment (from, postid, content);
|
|
}
|
|
|
|
static BlogProvider provider;
|
|
|
|
public static BlogProvider Provider {
|
|
get {
|
|
if (provider == null)
|
|
provider = BlogHelper.GetProvider();
|
|
return provider;
|
|
}
|
|
}
|
|
public static BlogEntry GetPost (string username, string title)
|
|
{
|
|
return Provider.GetPost (username, title );
|
|
}
|
|
public static BlogEntry GetPost(long postid)
|
|
{
|
|
return Provider.GetPost (postid);
|
|
}
|
|
public static void Post(string username, string title, string content, bool visible)
|
|
{
|
|
Provider.Post(username, title, content, visible );
|
|
}
|
|
public static void UpdatePost(long postid, string title, string content, bool visible)
|
|
{
|
|
Provider.UpdatePost(postid, title, content, visible);
|
|
}
|
|
public static BlogEntryCollection FindPost (string pattern, FindBlogEntryFlags searchflags, int pageIndex, int pageSize, out int totalRecords)
|
|
{
|
|
return Provider.FindPost (pattern, searchflags, pageIndex, pageSize, out totalRecords);
|
|
}
|
|
public static void RemovePost (string username, string title)
|
|
{
|
|
if (!Roles.IsUserInRole ("Admin")) {
|
|
string rguser = Membership.GetUser ().UserName;
|
|
if (rguser != username) {
|
|
throw new AccessViolationException (
|
|
string.Format (
|
|
"{1}, Vous n'avez pas le droit de suprimer des billets du Blog de {0}",
|
|
username,rguser));
|
|
}
|
|
}
|
|
Provider.RemovePost (username, title);
|
|
}
|
|
public static BlogEntryCollection LastPosts (int pageIndex, int pageSize, out int totalRecords)
|
|
{
|
|
return Provider.LastPosts (pageIndex, pageSize, out totalRecords);
|
|
}
|
|
public static Comment[] GetComments(long postid, bool getHidden=true)
|
|
{
|
|
return Provider.GetComments (postid,getHidden);
|
|
}
|
|
/// <summary>
|
|
/// Tag the specified post by postid.
|
|
/// </summary>
|
|
/// <param name="postid">Postid.</param>
|
|
/// <returns>The tag identifier</returns>
|
|
public static long Tag(long postid, string tag) {
|
|
return Provider.Tag (postid, tag);
|
|
}
|
|
|
|
}
|
|
}
|
|
|