adds access by circle to blog posts
This commit is contained in:
parent
9da7064791
commit
f25aa8ff97
32 changed files with 465 additions and 274 deletions
|
|
@ -2,6 +2,8 @@ using System;
|
|||
using System.Configuration;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Yavsc.Model.Circles;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Yavsc.Model.Blogs
|
||||
{
|
||||
|
|
@ -121,11 +123,21 @@ namespace Yavsc.Model.Blogs
|
|||
/// <value><c>true</c> if visible; otherwise, <c>false</c>.</value>
|
||||
public bool Visible { get; set ; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the circles allowed to read this ticket.
|
||||
/// An empty collection specifies a public post.
|
||||
/// </summary>
|
||||
/// <value>The circles.</value>
|
||||
[Display(Name="Cercles autorisés")]
|
||||
public long[] AllowedCircles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the tags.
|
||||
/// </summary>
|
||||
/// <value>The tags.</value>
|
||||
public string [] Tags { get; set ; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ using Yavsc.Model.Blogs;
|
|||
using Yavsc.Model.RolesAndMembers;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using Yavsc.Model.Circles;
|
||||
using System.Web.Mvc;
|
||||
|
||||
|
||||
namespace Yavsc.Model.Blogs
|
||||
|
|
@ -17,10 +19,11 @@ namespace Yavsc.Model.Blogs
|
|||
/// </summary>
|
||||
/// <returns>The comment.</returns>
|
||||
/// <param name="cmtid">Cmtid.</param>
|
||||
public static long RemoveComment(long cmtid)
|
||||
public static long RemoveComment (long cmtid)
|
||||
{
|
||||
return Provider.RemoveComment (cmtid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Comment the specified from, postid, content and visible.
|
||||
/// </summary>
|
||||
|
|
@ -42,7 +45,7 @@ namespace Yavsc.Model.Blogs
|
|||
public static BlogProvider Provider {
|
||||
get {
|
||||
if (provider == null)
|
||||
provider = BlogHelper.GetProvider();
|
||||
provider = BlogHelper.GetProvider ();
|
||||
return provider;
|
||||
}
|
||||
}
|
||||
|
|
@ -55,7 +58,7 @@ namespace Yavsc.Model.Blogs
|
|||
/// <param name="title">Title.</param>
|
||||
public static BlogEntry GetPost (string username, string title)
|
||||
{
|
||||
return Provider.GetPost (username, title );
|
||||
return Provider.GetPost (username, title);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -63,7 +66,7 @@ namespace Yavsc.Model.Blogs
|
|||
/// </summary>
|
||||
/// <returns>The post.</returns>
|
||||
/// <param name="postid">Postid.</param>
|
||||
public static BlogEntry GetPost(long postid)
|
||||
public static BlogEntry GetPost (long postid)
|
||||
{
|
||||
return Provider.GetPost (postid);
|
||||
}
|
||||
|
|
@ -75,9 +78,10 @@ namespace Yavsc.Model.Blogs
|
|||
/// <param name="title">Title.</param>
|
||||
/// <param name="content">Content.</param>
|
||||
/// <param name="visible">If set to <c>true</c> visible.</param>
|
||||
public static void Post(string username, string title, string content, bool visible)
|
||||
/// <param name="cids">sets the circles.</param>
|
||||
public static long Post (string username, string title, string content, bool visible, long [] cids)
|
||||
{
|
||||
Provider.Post(username, title, content, visible );
|
||||
return Provider.Post (username, title, content, visible, cids);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -87,9 +91,10 @@ namespace Yavsc.Model.Blogs
|
|||
/// <param name="title">Title.</param>
|
||||
/// <param name="content">Content.</param>
|
||||
/// <param name="visible">If set to <c>true</c> visible.</param>
|
||||
public static void UpdatePost(long postid, string title, string content, bool visible)
|
||||
/// <param name="cids">sets the circles.</param>
|
||||
public static void UpdatePost (long postid, string title, string content, bool visible,long [] cids)
|
||||
{
|
||||
Provider.UpdatePost(postid, title, content, visible);
|
||||
Provider.UpdatePost (postid, title, content, visible,cids);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -101,10 +106,11 @@ namespace Yavsc.Model.Blogs
|
|||
/// <param name="pageIndex">Page index.</param>
|
||||
/// <param name="pageSize">Page size.</param>
|
||||
/// <param name="totalRecords">Total records.</param>
|
||||
public static BlogEntryCollection FindPost (string pattern, FindBlogEntryFlags searchflags, int pageIndex, int pageSize, out int totalRecords)
|
||||
public static BlogEntryCollection FindPost (string readersName, string pattern, FindBlogEntryFlags searchflags, int pageIndex, int pageSize, out int totalRecords)
|
||||
{
|
||||
return Provider.FindPost (pattern, searchflags, pageIndex, pageSize, out totalRecords);
|
||||
return Provider.FindPost (readersName, pattern, searchflags, pageIndex, pageSize, out totalRecords);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the post.
|
||||
/// </summary>
|
||||
|
|
@ -118,7 +124,7 @@ namespace Yavsc.Model.Blogs
|
|||
throw new AccessViolationException (
|
||||
string.Format (
|
||||
"{1}, Vous n'avez pas le droit de suprimer des billets du Blog de {0}",
|
||||
username,rguser));
|
||||
username, rguser));
|
||||
}
|
||||
}
|
||||
Provider.RemovePost (username, title);
|
||||
|
|
@ -142,17 +148,19 @@ namespace Yavsc.Model.Blogs
|
|||
/// <returns>The comments.</returns>
|
||||
/// <param name="postid">Postid.</param>
|
||||
/// <param name="getHidden">If set to <c>true</c> get hidden.</param>
|
||||
public static Comment[] GetComments(long postid, bool getHidden=true)
|
||||
public static Comment[] GetComments (long postid, bool getHidden = true)
|
||||
{
|
||||
return Provider.GetComments (postid,getHidden);
|
||||
return Provider.GetComments (postid, getHidden);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tag the specified post by postid.
|
||||
/// </summary>
|
||||
/// <param name="postid">Postid.</param>
|
||||
/// <param name="tag">Tag.</param>
|
||||
/// <returns>The tag identifier</returns>
|
||||
public static long Tag(long postid, string tag) {
|
||||
public static long Tag (long postid, string tag)
|
||||
{
|
||||
return Provider.Tag (postid, tag);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ using System;
|
|||
using System.Configuration;
|
||||
using System.Configuration.Provider;
|
||||
using System.Collections.Generic;
|
||||
using Yavsc.Model.Circles;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Yavsc.Model.Blogs
|
||||
{
|
||||
|
|
@ -25,14 +27,6 @@ namespace Yavsc.Model.Blogs
|
|||
/// <param name="title">Title.</param>
|
||||
public abstract BlogEntry GetPost (string username, string title);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the post identifier.
|
||||
/// </summary>
|
||||
/// <returns>The post identifier.</returns>
|
||||
/// <param name="username">Username.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
public abstract long GetPostId (string username, string title);
|
||||
|
||||
/// <summary>
|
||||
/// Post the specified username, title, content and visible.
|
||||
/// </summary>
|
||||
|
|
@ -40,7 +34,7 @@ namespace Yavsc.Model.Blogs
|
|||
/// <param name="title">Title.</param>
|
||||
/// <param name="content">Content.</param>
|
||||
/// <param name="visible">If set to <c>true</c> visible.</param>
|
||||
public abstract long Post (string username, string title, string content, bool visible);
|
||||
public abstract long Post (string username, string title, string content, bool visible, long[] allowedCircles);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the post.
|
||||
|
|
@ -49,7 +43,7 @@ namespace Yavsc.Model.Blogs
|
|||
/// <param name="title">Title.</param>
|
||||
/// <param name="content">Content.</param>
|
||||
/// <param name="visible">If set to <c>true</c> visible.</param>
|
||||
public abstract void UpdatePost (long postid, string title, string content, bool visible);
|
||||
public abstract void UpdatePost (long postid, string title, string content, bool visible, long[] allowedCircles);
|
||||
|
||||
/// <summary>
|
||||
/// Finds the post.
|
||||
|
|
@ -60,7 +54,7 @@ namespace Yavsc.Model.Blogs
|
|||
/// <param name="pageIndex">Page index.</param>
|
||||
/// <param name="pageSize">Page size.</param>
|
||||
/// <param name="totalRecords">Total records.</param>
|
||||
public abstract BlogEntryCollection FindPost (string pattern, FindBlogEntryFlags searchflags,
|
||||
public abstract BlogEntryCollection FindPost (string readersName, string pattern, FindBlogEntryFlags searchflags,
|
||||
int pageIndex, int pageSize, out int totalRecords);
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue