* Web.config:
* Web.csproj: * Web.config: * Blog.cs: * Index.aspx: * BBCodeHelper.cs: * Comment.cs: * yavscModel.csproj: * BlogEntry.cs: * UserPost.aspx: * UserPosts.aspx: * Estimate.cs: * RemovePost.aspx: * TitleNotFound.aspx: * BlogProvider.cs: * AccountController.cs: * BlogsApiController.cs: * WorkFlowController.cs: * BlogEditEntryModel.cs: * FindBlogEntryFlags.cs: * BlogEntryCollection.cs: * Comment.cs: * BlogEditCommentModel.cs: * NpgsqlBlogProvider.cs: * NpgsqlContentProvider.cs: * BlogEntry.cs: * NpgsqlBlogProvider.csproj: * NpgsqlMembershipProvider.cs: * FindBlogEntryFlags.cs: * BlogEntryCollection.cs: * BlogHelper.cs: refactoring: moving code from NpgsqlBlogProvider to yavscModel.Blogs * BlogManager.cs: NpgsqlBlogProvider/BlogHelper.cs * BlogsController.cs: a successfull confirmed removal * Blog.cs: refactoring
This commit is contained in:
@ -3,6 +3,7 @@ using System.Configuration;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using Npgsql.Web.Blog.Configuration;
|
using Npgsql.Web.Blog.Configuration;
|
||||||
|
using yavscModel.Blogs;
|
||||||
|
|
||||||
namespace Npgsql.Web.Blog
|
namespace Npgsql.Web.Blog
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using Npgsql.Web.Blog.DataModel;
|
using yavscModel.Blogs;
|
||||||
|
|
||||||
|
|
||||||
namespace Npgsql.Web.Blog
|
namespace Npgsql.Web.Blog
|
||||||
{
|
{
|
||||||
|
@ -2,9 +2,8 @@ using System;
|
|||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Configuration.Provider;
|
using System.Configuration.Provider;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Npgsql.Web.Blog.DataModel;
|
|
||||||
|
|
||||||
namespace Npgsql.Web.Blog
|
namespace yavscModel.Blogs
|
||||||
{
|
{
|
||||||
public abstract class BlogProvider: ProviderBase
|
public abstract class BlogProvider: ProviderBase
|
||||||
{
|
{
|
||||||
|
@ -2,8 +2,8 @@ using System;
|
|||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Configuration.Provider;
|
using System.Configuration.Provider;
|
||||||
using Npgsql;
|
using Npgsql;
|
||||||
using Npgsql.Web.Blog.DataModel;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using yavscModel.Blogs;
|
||||||
|
|
||||||
namespace Npgsql.Web.Blog
|
namespace Npgsql.Web.Blog
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProductVersion>10.0.0</ProductVersion>
|
<ProductVersion>8.0.30703</ProductVersion>
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
<ProjectGuid>{C6E9E91B-97D3-48D9-8AA7-05356929E162}</ProjectGuid>
|
<ProjectGuid>{C6E9E91B-97D3-48D9-8AA7-05356929E162}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
@ -33,19 +33,13 @@
|
|||||||
<Compile Include="Configuration\BlogProviderConfigurationElement.cs" />
|
<Compile Include="Configuration\BlogProviderConfigurationElement.cs" />
|
||||||
<Compile Include="Configuration\BlogProvidersConfigurationCollection.cs" />
|
<Compile Include="Configuration\BlogProvidersConfigurationCollection.cs" />
|
||||||
<Compile Include="Configuration\BlogProvidersConfigurationSection.cs" />
|
<Compile Include="Configuration\BlogProvidersConfigurationSection.cs" />
|
||||||
<Compile Include="DataModel\BlogEntry.cs" />
|
|
||||||
<Compile Include="DataModel\BlogEntryCollection.cs" />
|
|
||||||
<Compile Include="BlogHelper.cs" />
|
<Compile Include="BlogHelper.cs" />
|
||||||
<Compile Include="BlogManager.cs" />
|
<Compile Include="BlogManager.cs" />
|
||||||
<Compile Include="BlogProvider.cs" />
|
<Compile Include="BlogProvider.cs" />
|
||||||
<Compile Include="NpgsqlBlogProvider.cs" />
|
<Compile Include="NpgsqlBlogProvider.cs" />
|
||||||
<Compile Include="DataModel\FindBlogEntryFlags.cs" />
|
|
||||||
<Compile Include="AssemblyInfo.cs" />
|
<Compile Include="AssemblyInfo.cs" />
|
||||||
<Compile Include="DataModel\Blog.cs" />
|
|
||||||
<Compile Include="DataModel\Comment.cs" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="DataModel\" />
|
|
||||||
<Folder Include="Sql\" />
|
<Folder Include="Sql\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -67,4 +61,10 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Sql\BlogTable.sql" />
|
<None Include="Sql\BlogTable.sql" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\yavscModel\yavscModel.csproj">
|
||||||
|
<Project>{68F5B80A-616E-4C3C-91A0-828AA40000BD}</Project>
|
||||||
|
<Name>yavscModel</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -1123,10 +1123,13 @@ namespace Npgsql.Web
|
|||||||
{
|
{
|
||||||
MembershipUserCollection users = new MembershipUserCollection ();
|
MembershipUserCollection users = new MembershipUserCollection ();
|
||||||
using (NpgsqlConnection conn = new NpgsqlConnection (connectionString)) {
|
using (NpgsqlConnection conn = new NpgsqlConnection (connectionString)) {
|
||||||
|
conn.Open ();
|
||||||
using (NpgsqlCommand cmd = new NpgsqlCommand ("SELECT count(*)" +
|
using (NpgsqlCommand cmd = new NpgsqlCommand ("SELECT count(*)" +
|
||||||
" FROM Users " +
|
" FROM Users " +
|
||||||
" WHERE Username LIKE @UsernameSearch AND ApplicationName = @ApplicationName ", conn)) {
|
" WHERE Username LIKE @uns AND ApplicationName = @appn ", conn)) {
|
||||||
totalRecords = (int)cmd.ExecuteScalar ();
|
cmd.Parameters.Add ("@uns", usernameToMatch);
|
||||||
|
cmd.Parameters.Add ("@appn", ApplicationName);
|
||||||
|
totalRecords = (int)((long)cmd.ExecuteScalar ());
|
||||||
}
|
}
|
||||||
if (totalRecords > 0)
|
if (totalRecords > 0)
|
||||||
using (NpgsqlCommand cmd = new NpgsqlCommand ("SELECT PKID, Username, Email, PasswordQuestion," +
|
using (NpgsqlCommand cmd = new NpgsqlCommand ("SELECT PKID, Username, Email, PasswordQuestion," +
|
||||||
@ -1137,7 +1140,7 @@ namespace Npgsql.Web
|
|||||||
" ORDER BY Username Asc", conn)) {
|
" ORDER BY Username Asc", conn)) {
|
||||||
cmd.Parameters.Add ("@UsernameSearch", NpgsqlDbType.Varchar, 255).Value = usernameToMatch;
|
cmd.Parameters.Add ("@UsernameSearch", NpgsqlDbType.Varchar, 255).Value = usernameToMatch;
|
||||||
cmd.Parameters.Add ("@ApplicationName", NpgsqlDbType.Varchar, 255).Value = pApplicationName;
|
cmd.Parameters.Add ("@ApplicationName", NpgsqlDbType.Varchar, 255).Value = pApplicationName;
|
||||||
conn.Open ();
|
|
||||||
using (NpgsqlDataReader reader = cmd.ExecuteReader ()) {
|
using (NpgsqlDataReader reader = cmd.ExecuteReader ()) {
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
int startIndex = pageSize * pageIndex;
|
int startIndex = pageSize * pageIndex;
|
||||||
|
@ -11,11 +11,67 @@ namespace WorkFlowProvider
|
|||||||
{
|
{
|
||||||
public class NpgsqlContentProvider: ProviderBase, IContentProvider
|
public class NpgsqlContentProvider: ProviderBase, IContentProvider
|
||||||
{
|
{
|
||||||
public Estimate GetEstimate (long estimid)
|
public bool[] FinalStatuses {
|
||||||
|
get {
|
||||||
|
throw new NotImplementedException ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Order (IWFOrder c)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException ();
|
throw new NotImplementedException ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IContent GetBlob (string orderId)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException ();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetStatus (string orderId)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException ();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string[] StatusLabels {
|
||||||
|
get {
|
||||||
|
throw new NotImplementedException ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region IDisposable implementation
|
||||||
|
public void Dispose ()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public Estimate GetEstimate (long estimid)
|
||||||
|
{
|
||||||
|
using (NpgsqlConnection cnx = CreateConnection ()) {
|
||||||
|
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||||
|
cmd.CommandText =
|
||||||
|
"select title,username from estimate where _id = @estid";
|
||||||
|
|
||||||
|
cmd.Parameters.Add ("@estid", estimid);
|
||||||
|
cnx.Open ();
|
||||||
|
Estimate est = null;
|
||||||
|
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
|
||||||
|
if (!rdr.Read ()) {
|
||||||
|
throw new Exception (
|
||||||
|
string.Format("Estimate not found : {0}", estimid));
|
||||||
|
}
|
||||||
|
est = new Estimate ();
|
||||||
|
est.Title = rdr.GetString(
|
||||||
|
rdr.GetOrdinal("title"));
|
||||||
|
est.Owner = rdr.GetString(
|
||||||
|
rdr.GetOrdinal("username"));
|
||||||
|
}
|
||||||
|
cnx.Close ();
|
||||||
|
return est;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void SetTitle (long estid, string newTitle)
|
public void SetTitle (long estid, string newTitle)
|
||||||
{
|
{
|
||||||
using (NpgsqlConnection cnx = CreateConnection ()) {
|
using (NpgsqlConnection cnx = CreateConnection ()) {
|
||||||
@ -66,39 +122,6 @@ namespace WorkFlowProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool[] FinalStatuses {
|
|
||||||
get {
|
|
||||||
throw new NotImplementedException ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Order (IWFOrder c)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException ();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IContent GetBlob (string orderId)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException ();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int GetStatus (string orderId)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException ();
|
|
||||||
}
|
|
||||||
|
|
||||||
public string[] StatusLabels {
|
|
||||||
get {
|
|
||||||
throw new NotImplementedException ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#region IDisposable implementation
|
|
||||||
public void Dispose ()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
public long CreateEstimate (string client, string title)
|
public long CreateEstimate (string client, string title)
|
||||||
{
|
{
|
||||||
|
@ -163,7 +163,7 @@ namespace Yavsc.Controllers
|
|||||||
|
|
||||||
// ChangePassword will throw an exception rather
|
// ChangePassword will throw an exception rather
|
||||||
// than return false in certain failure scenarios.
|
// than return false in certain failure scenarios.
|
||||||
bool changePasswordSucceeded;
|
bool changePasswordSucceeded=false;
|
||||||
try {
|
try {
|
||||||
var users = Membership.FindUsersByName (model.Username);
|
var users = Membership.FindUsersByName (model.Username);
|
||||||
|
|
||||||
@ -172,9 +172,10 @@ namespace Yavsc.Controllers
|
|||||||
changePasswordSucceeded = user.ChangePassword (model.OldPassword, model.NewPassword);
|
changePasswordSucceeded = user.ChangePassword (model.OldPassword, model.NewPassword);
|
||||||
} else {
|
} else {
|
||||||
changePasswordSucceeded = false;
|
changePasswordSucceeded = false;
|
||||||
|
ModelState.AddModelError ("Username", "The user name not found.");
|
||||||
}
|
}
|
||||||
} catch (Exception) {
|
} catch (Exception ex) {
|
||||||
changePasswordSucceeded = false;
|
ViewData ["Error"] = ex.ToString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changePasswordSucceeded) {
|
if (changePasswordSucceeded) {
|
||||||
|
36
web/Controllers/BlogsApiController.cs
Normal file
36
web/Controllers/BlogsApiController.cs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
using System.Web.Mvc.Ajax;
|
||||||
|
using System.Web.Security;
|
||||||
|
using Npgsql.Web.Blog;
|
||||||
|
using yavscModel.Blogs;
|
||||||
|
|
||||||
|
namespace Yavsc.Controllers
|
||||||
|
{
|
||||||
|
public class BlogsApiController : Controller
|
||||||
|
{
|
||||||
|
public static HttpStatusCodeResult RemovePost(string user, string title) {
|
||||||
|
if (!Roles.IsUserInRole ("Admin")) {
|
||||||
|
string rguser = Membership.GetUser ().UserName;
|
||||||
|
if (rguser != user) {
|
||||||
|
throw new AccessViolationException (
|
||||||
|
string.Format (
|
||||||
|
"Vous n'avez pas le droit de suprimer des billets du Blog de {0}",
|
||||||
|
user));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BlogEntry e = BlogManager.GetPost (user, title);
|
||||||
|
if (e == null) {
|
||||||
|
return new HttpNotFoundResult (
|
||||||
|
string.Format("Aucun post portant le titre \"{0}\" pour l'utilisateur {1}",
|
||||||
|
title, user));
|
||||||
|
}
|
||||||
|
BlogManager.RemovePost (user, title);
|
||||||
|
return new HttpStatusCodeResult (200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -13,9 +13,9 @@ using System.Web.Profile;
|
|||||||
using System.Web.Security;
|
using System.Web.Security;
|
||||||
using CodeKicker.BBCode;
|
using CodeKicker.BBCode;
|
||||||
using Npgsql.Web.Blog;
|
using Npgsql.Web.Blog;
|
||||||
using Npgsql.Web.Blog.DataModel;
|
|
||||||
using Yavsc;
|
using Yavsc;
|
||||||
using yavscModel;
|
using yavscModel;
|
||||||
|
using yavscModel.Blogs;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
@ -206,6 +206,8 @@ namespace Yavsc.Controllers
|
|||||||
{
|
{
|
||||||
return string.Format ("{0}'s blog", user);
|
return string.Format ("{0}'s blog", user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Authorize]
|
||||||
public ActionResult Comment (BlogEditCommentModel model) {
|
public ActionResult Comment (BlogEditCommentModel model) {
|
||||||
string username = Membership.GetUser ().UserName;
|
string username = Membership.GetUser ().UserName;
|
||||||
ViewData ["SiteName"] = sitename;
|
ViewData ["SiteName"] = sitename;
|
||||||
@ -231,30 +233,22 @@ namespace Yavsc.Controllers
|
|||||||
return File (fia.OpenRead (), defaultAvatarMimetype);
|
return File (fia.OpenRead (), defaultAvatarMimetype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove the specified blog entry, by its author and title,
|
||||||
|
/// using returnUrl as the URL to return to,
|
||||||
|
/// and confirm as a proof you really know what you do.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">User.</param>
|
||||||
|
/// <param name="title">Title.</param>
|
||||||
|
/// <param name="returnUrl">Return URL.</param>
|
||||||
|
/// <param name="confirm">If set to <c>true</c> confirm.</param>
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public ActionResult Remove (string user, string title, string returnUrl)
|
public ActionResult RemovePost (string user, string title, string returnUrl, bool confirm=false)
|
||||||
{
|
{
|
||||||
if (!Roles.IsUserInRole ("Admin")) {
|
if (!confirm)
|
||||||
string rguser = Membership.GetUser ().UserName;
|
return View ("RemovePost");
|
||||||
if (rguser != user) {
|
HttpStatusCodeResult res = BlogsApiController.RemovePost (user,title);
|
||||||
ModelState.AddModelError (
|
return (res.StatusCode==200? Return(returnUrl):res);
|
||||||
"Title", string.Format (
|
|
||||||
"Vous n'avez pas de droits sur le Blog de {0}",
|
|
||||||
user));
|
|
||||||
return Return (returnUrl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
BlogEntry e = BlogManager.GetPost (user, title);
|
|
||||||
if (e == null) {
|
|
||||||
ModelState.AddModelError (
|
|
||||||
"Title",
|
|
||||||
string.Format (
|
|
||||||
"Aucun post portant le titre \"{0}\" pour l'utilisateur {1}",
|
|
||||||
title, user));
|
|
||||||
return Return (returnUrl);
|
|
||||||
}
|
|
||||||
BlogManager.RemovePost (user, title);
|
|
||||||
return Return (returnUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ActionResult Return (string returnUrl)
|
private ActionResult Return (string returnUrl)
|
||||||
|
@ -35,6 +35,17 @@ namespace Yavsc.ApiControllers
|
|||||||
return WFManager.Write(estid, desc, ucost, count, productid);
|
return WFManager.Write(estid, desc, ucost, count, productid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Authorize]
|
||||||
|
[HttpGet]
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the estimate.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The estimate.</returns>
|
||||||
|
/// <param name="estid">Estid.</param>
|
||||||
|
public Estimate GetEstimate (long estid)
|
||||||
|
{
|
||||||
|
return WFManager.ContentProvider.GetEstimate (estid);
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
public object Details(int id)
|
public object Details(int id)
|
||||||
{
|
{
|
||||||
|
@ -153,7 +153,9 @@ namespace Yavsc.Helpers
|
|||||||
|
|
||||||
static string DocPageContentTransformer (string instr)
|
static string DocPageContentTransformer (string instr)
|
||||||
{
|
{
|
||||||
return TocContentTransformer(instr)+instr;
|
string toc = TocContentTransformer(instr);
|
||||||
|
Init ();
|
||||||
|
return toc+instr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static string TagContentTransformer (string instr)
|
static string TagContentTransformer (string instr)
|
||||||
@ -286,7 +288,7 @@ namespace Yavsc.Helpers
|
|||||||
new BBAttribute ("title", "title", TitleContentTransformer),
|
new BBAttribute ("title", "title", TitleContentTransformer),
|
||||||
new BBAttribute ("para", "para", L1ContentTransformer));
|
new BBAttribute ("para", "para", L1ContentTransformer));
|
||||||
BBTag bbdp=new BBTag ("docpage",
|
BBTag bbdp=new BBTag ("docpage",
|
||||||
"<div class=docpage>${content}</div>", "",
|
"<div class=docpage>${content}", "</div>",
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
DocPageContentTransformer);
|
DocPageContentTransformer);
|
||||||
@ -296,14 +298,14 @@ namespace Yavsc.Helpers
|
|||||||
new BBTag ("i", "<span style=\"font-style:italic;\">", "</span>"),
|
new BBTag ("i", "<span style=\"font-style:italic;\">", "</span>"),
|
||||||
new BBTag ("u", "<span style=\"text-decoration:underline;\">", "</span>"),
|
new BBTag ("u", "<span style=\"text-decoration:underline;\">", "</span>"),
|
||||||
new BBTag ("code", "<span class=\"code\">", "</span>"),
|
new BBTag ("code", "<span class=\"code\">", "</span>"),
|
||||||
new BBTag ("img", "<img src=\"${content}\" style=\"${style}\"/>", "", false, true, new BBAttribute ("style", "style")),
|
new BBTag ("img", "<img src=\"${content}\" style=\"${style}\"/>", "", true, false, new BBAttribute ("style", "style")),
|
||||||
new BBTag ("quote", "<blockquote>", "</blockquote>"),
|
new BBTag ("quote", "<blockquote>", "</blockquote>"),
|
||||||
new BBTag ("div", "<div style=\"${style}\">", "</div>", new BBAttribute("style","style")),
|
new BBTag ("div", "<div style=\"${style}\">", "</div>", new BBAttribute("style","style")),
|
||||||
new BBTag ("p", "<p>", "</p>"),
|
new BBTag ("p", "<p>", "</p>"),
|
||||||
new BBTag ("h", "<h2>", "</h2>"),
|
new BBTag ("h", "<h2>", "</h2>"),
|
||||||
bblist,
|
bblist,
|
||||||
new BBTag ("*", "<li>", "</li>", true, false),
|
new BBTag ("*", "<li>", "</li>", true, false),
|
||||||
new BBTag ("url", "<a href=\"${href}\">", "</a>", new BBAttribute ("href", ""), new BBAttribute ("href", "href")),
|
new BBTag ("url", "<a href=\"${href}\">", "</a>", true, false, new BBAttribute ("href", ""), new BBAttribute ("href", "href")),
|
||||||
new BBTag ("br", "<br/>", "", true, false),
|
new BBTag ("br", "<br/>", "", true, false),
|
||||||
new BBTag ("video", "<video style=\"${style}\" controls>" +
|
new BBTag ("video", "<video style=\"${style}\" controls>" +
|
||||||
"<source src=\"${mp4}\" type=\"video/mp4\"/>" +
|
"<source src=\"${mp4}\" type=\"video/mp4\"/>" +
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<Npgsql.Web.Blog.DataModel.BlogEntryCollection>" MasterPageFile="~/Models/App.master"%>
|
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<BlogEntryCollection>" MasterPageFile="~/Models/App.master"%>
|
||||||
<%@ Register Assembly="Yavsc.WebControls" TagPrefix="yavsc" Namespace="Yavsc.WebControls" %>
|
<%@ Register Assembly="Yavsc.WebControls" TagPrefix="yavsc" Namespace="Yavsc.WebControls" %>
|
||||||
<asp:Content ContentPlaceHolderID="head" ID="head" runat="server">
|
<asp:Content ContentPlaceHolderID="head" ID="head" runat="server">
|
||||||
<%= "<title>Les dernières parutions - " + Html.Encode(YavscHelpers.SiteName) + "</title>" %>
|
<%= "<title>Les dernières parutions - " + Html.Encode(YavscHelpers.SiteName) + "</title>" %>
|
||||||
@ -8,7 +8,7 @@
|
|||||||
</asp:Content>
|
</asp:Content>
|
||||||
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
|
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
|
||||||
|
|
||||||
<% foreach (Npgsql.Web.Blog.DataModel.BlogEntry e in this.Model) { %>
|
<% foreach (BlogEntry e in this.Model) { %>
|
||||||
<div class="blogpost">
|
<div class="blogpost">
|
||||||
<h3 class="blogtitle">
|
<h3 class="blogtitle">
|
||||||
<%= Html.ActionLink(e.Title,"UserPost", new { user=e.UserName, title = e.Title }) %>
|
<%= Html.ActionLink(e.Title,"UserPost", new { user=e.UserName, title = e.Title }) %>
|
||||||
|
28
web/Views/Blogs/RemovePost.aspx
Normal file
28
web/Views/Blogs/RemovePost.aspx
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPage<BlogEntry>" MasterPageFile="~/Models/App.master" %>
|
||||||
|
|
||||||
|
|
||||||
|
<asp:Content ContentPlaceHolderID="titleContent" ID="titleContentContent" runat="server">
|
||||||
|
</asp:Content>
|
||||||
|
<asp:Content ContentPlaceHolderID="head" ID="headContent" runat="server">
|
||||||
|
</asp:Content>
|
||||||
|
<asp:Content ContentPlaceHolderID="header" ID="headerContent" runat="server">
|
||||||
|
</asp:Content>
|
||||||
|
|
||||||
|
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
|
||||||
|
<form runat="server">
|
||||||
|
<%= Html.ValidationSummary() %>
|
||||||
|
<% using (Html.BeginForm("Remove","Blogs")) { %>
|
||||||
|
suivant :
|
||||||
|
<%= Html.LabelFor(model => model.Title) %>:<br/>
|
||||||
|
<%= Html.TextBox( "Title" ) %>
|
||||||
|
<%= Html.ValidationMessage("Title", "*") %>
|
||||||
|
<label for="confirm">supprimer le billet</label>
|
||||||
|
<input type="checkbox" name="confirm" />
|
||||||
|
<%= Html.ValidationMessage("AgreeToRemove", "*") %>
|
||||||
|
|
||||||
|
<input type="submit"/>
|
||||||
|
<% } %>
|
||||||
|
</form>
|
||||||
|
</asp:Content>
|
||||||
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
|||||||
|
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<BlogEntryCollection>" MasterPageFile="~/Models/App.master"%>
|
||||||
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<Npgsql.Web.Blog.DataModel.BlogEntryCollection>" MasterPageFile="~/Models/App.master"%>
|
|
||||||
<asp:Content ContentPlaceHolderID="head" ID="head" runat="server">
|
<asp:Content ContentPlaceHolderID="head" ID="head" runat="server">
|
||||||
<title> </title>
|
<title> </title>
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
@ -7,11 +6,8 @@
|
|||||||
</asp:Content>
|
</asp:Content>
|
||||||
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
|
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
|
||||||
|
|
||||||
Pas d'article trouvé @ "<%= Html.Encode(ViewData["PostTitle"]) %>"
|
Pas d'article trouvé ici: <<%= Html.Encode(ViewData["BlogUser"]) %>/<%= Html.Encode(ViewData["PostTitle"]) %>>
|
||||||
<% if (ViewData["UserName"]!=null) { %>
|
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
<%= Html.ActionLink("Poster?","Post/", new { user=ViewData["UserName"], title = ViewData["PostTitle"]}, new { @class="actionlink" }) %>
|
<%= Html.ActionLink("Poster?","Post/", new { user = ViewData["BlogUser"], title = ViewData["PostTitle"]}, new { @class="actionlink" }) %>
|
||||||
<% } %>
|
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<%@ Page Title="Billet" Language="C#" Inherits="System.Web.Mvc.ViewPage<Npgsql.Web.Blog.DataModel.BlogEntry>" MasterPageFile="~/Models/App.master"%>
|
<%@ Page Title="Billet" Language="C#" Inherits="System.Web.Mvc.ViewPage<BlogEntry>" MasterPageFile="~/Models/App.master"%>
|
||||||
<asp:Content ContentPlaceHolderID="titleContent" ID="titleContent" runat="server"><%=Html.Encode(Model.Title)%> - <%=Html.Encode(ViewData["BlogTitle"])%></asp:Content>
|
<asp:Content ContentPlaceHolderID="titleContent" ID="titleContent" runat="server"><%=Html.Encode(Model.Title)%> - <%=Html.Encode(ViewData["BlogTitle"])%></asp:Content>
|
||||||
<asp:Content ContentPlaceHolderID="header" ID="headerContent" runat="server">
|
<asp:Content ContentPlaceHolderID="header" ID="headerContent" runat="server">
|
||||||
<h1 class="blogtitle"><%= Html.ActionLink(Model.Title,"UserPost",new{user=Model.UserName,title=Model.Title}) %> -
|
<h1 class="blogtitle"><%= Html.ActionLink(Model.Title,"UserPost",new{user=Model.UserName,title=Model.Title}) %> -
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<Npgsql.Web.Blog.DataModel.BlogEntryCollection>" MasterPageFile="~/Models/App.master"%>
|
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<BlogEntryCollection>" MasterPageFile="~/Models/App.master"%>
|
||||||
<%@ Register Assembly="Yavsc.WebControls" TagPrefix="yavsc" Namespace="Yavsc.WebControls" %>
|
<%@ Register Assembly="Yavsc.WebControls" TagPrefix="yavsc" Namespace="Yavsc.WebControls" %>
|
||||||
<asp:Content ContentPlaceHolderID="titleContent" ID="titleContent" runat="server"><%=Html.Encode(ViewData["BlogTitle"])%></asp:Content>
|
<asp:Content ContentPlaceHolderID="titleContent" ID="titleContent" runat="server"><%=Html.Encode(ViewData["BlogTitle"])%></asp:Content>
|
||||||
<asp:Content ContentPlaceHolderID="header" ID="headerContent" runat="server">
|
<asp:Content ContentPlaceHolderID="header" ID="headerContent" runat="server">
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
<add namespace="Yavsc.CatExts" />
|
<add namespace="Yavsc.CatExts" />
|
||||||
<add namespace="yavscModel.RolesAndMembers" />
|
<add namespace="yavscModel.RolesAndMembers" />
|
||||||
<add namespace="yavscModel.Admin" />
|
<add namespace="yavscModel.Admin" />
|
||||||
<add namespace="Npgsql.Web.Blog.DataModel" />
|
<add namespace="yavscModel.Blogs" />
|
||||||
</namespaces>
|
</namespaces>
|
||||||
</pages>
|
</pages>
|
||||||
</system.web>
|
</system.web>
|
||||||
|
@ -213,7 +213,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
|
|||||||
<add key="SmtpServer" value="smtp.free.fr" />
|
<add key="SmtpServer" value="smtp.free.fr" />
|
||||||
<add key="AdminEMail" value="paulschneider@free.fr" />
|
<add key="AdminEMail" value="paulschneider@free.fr" />
|
||||||
<add key="OwnerEMail" value="paul@127.0.0.1" />
|
<add key="OwnerEMail" value="paul@127.0.0.1" />
|
||||||
<add key="Name" value="O" />
|
<add key="Name" value="Psc" />
|
||||||
<add key="DefaultAvatar" value="/images/noavatar.png;image/png" />
|
<add key="DefaultAvatar" value="/images/noavatar.png;image/png" />
|
||||||
<add key="RegistrationMessage" value="/RegistrationMail.txt" />
|
<add key="RegistrationMessage" value="/RegistrationMail.txt" />
|
||||||
<add key="YavscWebApiUrl" value="http://localhost:8081" />
|
<add key="YavscWebApiUrl" value="http://localhost:8081" />
|
||||||
|
@ -62,7 +62,9 @@
|
|||||||
<Reference Include="Npgsql" />
|
<Reference Include="Npgsql" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Security" />
|
<Reference Include="System.Security" />
|
||||||
<Reference Include="nunit.framework, Version=2.6.0.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" />
|
<Reference Include="nunit.framework, Version=2.6.0.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
|
||||||
|
<Package>nunit</Package>
|
||||||
|
</Reference>
|
||||||
<Reference Include="CodeKicker.BBCode">
|
<Reference Include="CodeKicker.BBCode">
|
||||||
<HintPath>lib\CodeKicker.BBCode.dll</HintPath>
|
<HintPath>lib\CodeKicker.BBCode.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@ -142,6 +144,7 @@
|
|||||||
<Compile Include="FileInfoCollection.cs" />
|
<Compile Include="FileInfoCollection.cs" />
|
||||||
<Compile Include="Controllers\BasketImpact.cs" />
|
<Compile Include="Controllers\BasketImpact.cs" />
|
||||||
<Compile Include="MvcActionValueBinder.cs" />
|
<Compile Include="MvcActionValueBinder.cs" />
|
||||||
|
<Compile Include="Controllers\BlogsApiController.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Views\Web.config" />
|
<Content Include="Views\Web.config" />
|
||||||
@ -199,6 +202,7 @@
|
|||||||
<Content Include="Views\FrontOffice\Command.aspx" />
|
<Content Include="Views\FrontOffice\Command.aspx" />
|
||||||
<Content Include="Views\WorkFlow\NewProject.aspx" />
|
<Content Include="Views\WorkFlow\NewProject.aspx" />
|
||||||
<Content Include="Views\WorkFlow\Index.aspx" />
|
<Content Include="Views\WorkFlow\Index.aspx" />
|
||||||
|
<Content Include="Views\Blogs\RemovePost.aspx" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||||
@ -214,6 +218,9 @@
|
|||||||
<Target Name="">
|
<Target Name="">
|
||||||
<FileCopier Handler="MonoDevelop.Deployment.LocalFileCopyHandler" TargetDirectory="/srv/www/yavsc" ctype="LocalFileCopyConfiguration" />
|
<FileCopier Handler="MonoDevelop.Deployment.LocalFileCopyHandler" TargetDirectory="/srv/www/yavsc" ctype="LocalFileCopyConfiguration" />
|
||||||
</Target>
|
</Target>
|
||||||
|
<Target Name="">
|
||||||
|
<FileCopier Handler="MonoDevelop.Deployment.LocalFileCopyHandler" TargetDirectory="/srv/www/lua" ctype="LocalFileCopyConfiguration" />
|
||||||
|
</Target>
|
||||||
</WebDeployTargets>
|
</WebDeployTargets>
|
||||||
</Properties>
|
</Properties>
|
||||||
</MonoDevelop>
|
</MonoDevelop>
|
||||||
|
@ -3,13 +3,13 @@ using System.Configuration;
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace Npgsql.Web.Blog.DataModel
|
namespace yavscModel.Blogs
|
||||||
{
|
{
|
||||||
public class Blog
|
public class Blog
|
||||||
{
|
{
|
||||||
string title;
|
string title;
|
||||||
|
|
||||||
[StringValidator(MaxLength=512)]
|
[StringLength(512)]
|
||||||
[Required]
|
[Required]
|
||||||
[DisplayName("Titre")]
|
[DisplayName("Titre")]
|
||||||
public string Title {
|
public string Title {
|
@ -1,9 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Npgsql.Web.Blog.DataModel;
|
|
||||||
|
|
||||||
namespace yavscModel
|
namespace yavscModel.Blogs
|
||||||
{
|
{
|
||||||
public class BlogEditCommentModel:Comment
|
public class BlogEditCommentModel:Comment
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Npgsql.Web.Blog.DataModel;
|
|
||||||
|
|
||||||
namespace yavscModel
|
namespace yavscModel.Blogs
|
||||||
{
|
{
|
||||||
public class BlogEditEntryModel:BlogEntry
|
public class BlogEditEntryModel:BlogEntry
|
||||||
{
|
{
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Configuration.Provider;
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace Npgsql.Web.Blog.DataModel
|
namespace yavscModel.Blogs
|
||||||
{
|
{
|
||||||
public class BlogEntry
|
public class BlogEntry {
|
||||||
{
|
|
||||||
long id;
|
long id;
|
||||||
[DisplayName("Identifiant numérique de billet")]
|
[DisplayName("Identifiant numérique de billet")]
|
||||||
public long Id {
|
public long Id {
|
||||||
@ -21,7 +19,6 @@ namespace Npgsql.Web.Blog.DataModel
|
|||||||
|
|
||||||
string title;
|
string title;
|
||||||
|
|
||||||
[StringValidator(MaxLength=512)]
|
|
||||||
[DisplayName("Titre du billet")]
|
[DisplayName("Titre du billet")]
|
||||||
[StringLength(512)]
|
[StringLength(512)]
|
||||||
[RegularExpression("^[^:%&?]*$",ErrorMessage = "Les caratères suivants sont invalides pour un titre: :%&?")]
|
[RegularExpression("^[^:%&?]*$",ErrorMessage = "Les caratères suivants sont invalides pour un titre: :%&?")]
|
||||||
@ -50,7 +47,7 @@ namespace Npgsql.Web.Blog.DataModel
|
|||||||
|
|
||||||
string userName;
|
string userName;
|
||||||
|
|
||||||
[StringValidator(MaxLength=255)]
|
[StringLength(255)]
|
||||||
[DisplayName("Nom de l'auteur")]
|
[DisplayName("Nom de l'auteur")]
|
||||||
public string UserName {
|
public string UserName {
|
||||||
get {
|
get {
|
@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Configuration.Provider;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using yavscModel.Blogs;
|
||||||
|
|
||||||
namespace Npgsql.Web.Blog.DataModel
|
namespace yavscModel.Blogs
|
||||||
{
|
{
|
||||||
public class BlogEntryCollection : List<BlogEntry>
|
public class BlogEntryCollection : List<BlogEntry>
|
||||||
{
|
{
|
@ -3,7 +3,7 @@ using System.Configuration;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace Npgsql.Web.Blog.DataModel
|
namespace yavscModel.Blogs
|
||||||
{
|
{
|
||||||
public class Comment
|
public class Comment
|
||||||
{
|
{
|
@ -1,9 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Configuration.Provider;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Npgsql.Web.Blog.DataModel
|
namespace yavscModel.Blogs
|
||||||
{
|
{
|
||||||
|
|
||||||
public enum FindBlogEntryFlags : byte {
|
public enum FindBlogEntryFlags : byte {
|
@ -7,7 +7,9 @@ namespace yavscModel.WorkFlow
|
|||||||
public Estimate ()
|
public Estimate ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
public string Description { get; set; }
|
public string Title { get; set; }
|
||||||
|
public string Owner { get; set; }
|
||||||
|
|
||||||
public decimal Ciffer {
|
public decimal Ciffer {
|
||||||
get {
|
get {
|
||||||
decimal total = 0;
|
decimal total = 0;
|
||||||
|
@ -58,6 +58,11 @@
|
|||||||
<Compile Include="WorkFlow\IWFOrder.cs" />
|
<Compile Include="WorkFlow\IWFOrder.cs" />
|
||||||
<Compile Include="WorkFlow\OrderStatusChangedEventArgs.cs" />
|
<Compile Include="WorkFlow\OrderStatusChangedEventArgs.cs" />
|
||||||
<Compile Include="IProvider.cs" />
|
<Compile Include="IProvider.cs" />
|
||||||
|
<Compile Include="Blogs\BlogEntry.cs" />
|
||||||
|
<Compile Include="Blogs\Blog.cs" />
|
||||||
|
<Compile Include="Blogs\BlogEntryCollection.cs" />
|
||||||
|
<Compile Include="Blogs\Comment.cs" />
|
||||||
|
<Compile Include="Blogs\FindBlogEntryFlags.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -68,10 +73,6 @@
|
|||||||
<Folder Include="FileSystem\" />
|
<Folder Include="FileSystem\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\NpgsqlBlogProvider\NpgsqlBlogProvider.csproj">
|
|
||||||
<Project>{C6E9E91B-97D3-48D9-8AA7-05356929E162}</Project>
|
|
||||||
<Name>NpgsqlBlogProvider</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\SalesCatalog\SalesCatalog.csproj">
|
<ProjectReference Include="..\SalesCatalog\SalesCatalog.csproj">
|
||||||
<Project>{90BF2234-7252-4CD5-B2A4-17501B19279B}</Project>
|
<Project>{90BF2234-7252-4CD5-B2A4-17501B19279B}</Project>
|
||||||
<Name>SalesCatalog</Name>
|
<Name>SalesCatalog</Name>
|
||||||
|
Reference in New Issue
Block a user