* Tags and files for posts and writtings
* TryAssert(Title ~ H1)
This commit is contained in:
@ -12,6 +12,19 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
public class BlogsApiController : Controller
|
||||
{
|
||||
public void Tag (long postid,string tag) {
|
||||
BlogEntry e = BlogManager.GetPost (postid);
|
||||
if (!Roles.IsUserInRole ("Admin")) {
|
||||
string rguser = Membership.GetUser ().UserName;
|
||||
if (rguser != e.UserName) {
|
||||
throw new AccessViolationException (
|
||||
string.Format (
|
||||
"Vous n'avez pas le droit de tagger des billets du Blog de {0}",
|
||||
e.UserName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static HttpStatusCodeResult RemovePost(string user, string title) {
|
||||
if (!Roles.IsUserInRole ("Admin")) {
|
||||
string rguser = Membership.GetUser ().UserName;
|
||||
|
@ -21,13 +21,27 @@ namespace Yavsc.ApiControllers
|
||||
return WFManager.CreateEstimate (
|
||||
Membership.GetUser().UserName,title);
|
||||
}
|
||||
[HttpGet]
|
||||
[Authorize]
|
||||
public void DropWritting(long wrid)
|
||||
{
|
||||
WFManager.DropWritting (wrid);
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
[Authorize]
|
||||
public void DropEstimate(long estid)
|
||||
{
|
||||
WFManager.DropEstimate (estid);
|
||||
}
|
||||
[HttpGet]
|
||||
[Authorize]
|
||||
public object Index()
|
||||
{
|
||||
|
||||
return new { test="Hello World" };
|
||||
// TODO inform user on its roles and alerts
|
||||
string username = Membership.GetUser ().UserName;
|
||||
return new { test=string.Format("Hello {0}!",username) };
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
|
@ -1,28 +1,25 @@
|
||||
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<BlogEditEntryModel>" MasterPageFile="~/Models/App.master"%>
|
||||
<asp:Content ContentPlaceHolderID="head" ID="head" runat="server">
|
||||
<title><%= Html.Encode(ViewData["BlogTitle"]) %> edition
|
||||
- <%=Html.Encode(YavscHelpers.SiteName) %>
|
||||
</title>
|
||||
<asp:Content ContentPlaceHolderID="init" ID="init1" runat="server">
|
||||
<% Title = Model.Title+" (édition) - "+ViewData["BlogTitle"]; %>
|
||||
</asp:Content>
|
||||
<asp:Content ContentPlaceHolderID="header" ID="headerContent" runat="server">
|
||||
|
||||
<h1 class="blogtitle">
|
||||
<a href="/Blog/<%=ViewData["UserName"]%>">
|
||||
<img class="avatar" src="/Blogs/Avatar?user=<%=ViewData["UserName"]%>" alt="from <%=ViewData["UserName"]%>"/>
|
||||
<%= Html.Encode(ViewData["BlogTitle"]) %> </a> -
|
||||
<%= Html.Encode(Model.Title) %> -
|
||||
Édition </h1>
|
||||
|
||||
<asp:Content ContentPlaceHolderID="overHeaderOne" ID="header1" runat="server">
|
||||
<h1 class="blogtitle"><%= Html.ActionLink(Model.Title,"UserPost",new{user=Model.UserName,title=Model.Title}) %> (édition) -
|
||||
<a href="/Blog/<%=Model.UserName%>"><img class="avatar" src="/Blogs/Avatar?user=<%=Model.UserName%>" alt=""/> <%=ViewData["BlogTitle"]%></a>
|
||||
<asp:Literal runat="server" Text=" - " />
|
||||
<a href="/"> <%= YavscHelpers.SiteName %> </a> </h1>
|
||||
|
||||
|
||||
<div class="message">
|
||||
<%= Html.Encode(ViewData["Message"]) %>
|
||||
</div>
|
||||
<div class="metablog">(Id:<a href="/Blogs/UserPost/<%=Model.Id%>"><i><%=Model.Id%></i></a>, <%= Model.Posted.ToString("yyyy/MM/dd") %>
|
||||
- <%= Model.Modified.ToString("yyyy/MM/dd") %> <%= Model.Visible? "":", Invisible!" %>)
|
||||
<% if (Membership.GetUser()!=null)
|
||||
if (Membership.GetUser().UserName==Model.UserName)
|
||||
{ %>
|
||||
<%= Html.ActionLink("Editer","Edit", new { user=Model.UserName, title = Model.Title }, new { @class="actionlink" }) %>
|
||||
<%= Html.ActionLink("Supprimer","RemovePost", new { user=Model.UserName, title = Model.Title }, new { @class="actionlink" } ) %>
|
||||
<% } %>
|
||||
</div>
|
||||
</asp:Content>
|
||||
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
|
||||
|
||||
|
||||
<% if (Model != null ) if (Model.Content != null ) {
|
||||
<% if (Model != null ) if (Model.Content != null ) {
|
||||
BBCodeHelper.Init (); %>
|
||||
<%= Html.ActionLink(Model.Title,"UserPost",new{user=Model.UserName,title=Model.Title}) %>
|
||||
<div class="blogpost">
|
||||
|
Reference in New Issue
Block a user