big refactoring, and more

New routes, new juice flow, the tags on posts
This commit is contained in:
Paul Schneider 2015-10-17 14:45:57 +02:00
commit 1805cb3e17
46 changed files with 1339 additions and 515 deletions

View file

@ -1,3 +1,7 @@
2015-10-17 Paul Schneider <paul@pschneider.fr>
* NpgsqlBlogProvider.cs:
2015-10-13 Paul Schneider <paul@pschneider.fr> 2015-10-13 Paul Schneider <paul@pschneider.fr>
* NpgsqlBlogProvider.cs: implements the tag methods on db * NpgsqlBlogProvider.cs: implements the tag methods on db

View file

@ -33,8 +33,8 @@ namespace Npgsql.Web.Blog
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) { using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "INSERT INTO tagged (tagid,postid) VALUES (:tid,:pid)"; cmd.CommandText = "INSERT INTO tagged (tagid,postid) VALUES (:tid,:pid)";
cmd.Parameters.AddWithValue("tid",tid); cmd.Parameters.AddWithValue ("tid", tid);
cmd.Parameters.AddWithValue("pid",postid); cmd.Parameters.AddWithValue ("pid", postid);
cnx.Open (); cnx.Open ();
cmd.ExecuteNonQuery (); cmd.ExecuteNonQuery ();
return tid; return tid;
@ -47,8 +47,9 @@ namespace Npgsql.Web.Blog
/// <param name="postid">Postid.</param> /// <param name="postid">Postid.</param>
/// <param name="tagid">Tagid.</param> /// <param name="tagid">Tagid.</param>
/// <param name="name">Name.</param> /// <param name="name">Name.</param>
override public void Untag(long postid, string name) { override public void Untag (long postid, string name)
Untag(postid, GetTagId (name)); {
Untag (postid, GetTagId (name));
} }
/// <summary> /// <summary>
@ -57,7 +58,8 @@ namespace Npgsql.Web.Blog
/// <param name="postid">Postid.</param> /// <param name="postid">Postid.</param>
/// <param name="tagid">Tagid.</param> /// <param name="tagid">Tagid.</param>
/// <param name="tid">Tid.</param> /// <param name="tid">Tid.</param>
override public void Untag(long postid, long tid) { override public void Untag (long postid, long tid)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) { using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "DELETE FROM tagged WHERE postid = :pid AND tagid = :tid"; cmd.CommandText = "DELETE FROM tagged WHERE postid = :pid AND tagid = :tid";
@ -67,6 +69,7 @@ namespace Npgsql.Web.Blog
cmd.ExecuteNonQuery (); cmd.ExecuteNonQuery ();
} }
} }
/// <summary> /// <summary>
/// Gets the comments. /// Gets the comments.
/// </summary> /// </summary>
@ -77,32 +80,33 @@ namespace Npgsql.Web.Blog
{ {
List<Comment> cmts = new List<Comment> (); List<Comment> cmts = new List<Comment> ();
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString)) using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand()) { using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select _id, username, bcontent, modified, posted, visible from comment " + cmd.CommandText = "select _id, username, bcontent, modified, posted, visible from comment " +
"where applicationname = :appname and postid = :id" + "where applicationname = :appname and postid = :id" +
((getHidden) ? " and visible = true ":" ") + ((getHidden) ? " and visible = true " : " ") +
"order by posted asc" ; "order by posted asc";
cmd.Parameters.AddWithValue ("appname", applicationName); cmd.Parameters.AddWithValue ("appname", applicationName);
cmd.Parameters.AddWithValue ("id", postid); cmd.Parameters.AddWithValue ("id", postid);
cnx.Open (); cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader()) { using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
while (rdr.Read ()) { while (rdr.Read ()) {
Comment c = new Comment(); Comment c = new Comment ();
c.CommentText = rdr.GetString (rdr.GetOrdinal ("bcontent")); c.CommentText = rdr.GetString (rdr.GetOrdinal ("bcontent"));
c.From = rdr.GetString (rdr.GetOrdinal ("username")); c.From = rdr.GetString (rdr.GetOrdinal ("username"));
c.Modified = rdr.GetDateTime (rdr.GetOrdinal ("modified")); c.Modified = rdr.GetDateTime (rdr.GetOrdinal ("modified"));
c.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted")); c.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted"));
c.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible")); c.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible"));
c.PostId = postid; c.PostId = postid;
c.Id = rdr.GetInt64(rdr.GetOrdinal("_id")); c.Id = rdr.GetInt64 (rdr.GetOrdinal ("_id"));
cmts.Add (c); cmts.Add (c);
} }
} }
} }
return cmts.ToArray(); return cmts.ToArray ();
} }
/// <summary> /// <summary>
/// Updates the post. /// Updates the post.
/// </summary> /// </summary>
@ -112,9 +116,9 @@ namespace Npgsql.Web.Blog
/// <param name="visible">If set to <c>true</c> visible.</param> /// <param name="visible">If set to <c>true</c> visible.</param>
/// <param name="cids">Circle identifiers</param> /// <param name="cids">Circle identifiers</param>
public override void UpdatePost (long postid, string title, string content, public override void UpdatePost (long postid, string title, string content,
bool visible, long [] cids) bool visible, long[] cids)
{ {
using (NpgsqlConnection cnx = new NpgsqlConnection(connectionString)) { using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) { using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
DateTime now = DateTime.Now; DateTime now = DateTime.Now;
cmd.CommandText = cmd.CommandText =
@ -131,10 +135,11 @@ namespace Npgsql.Web.Blog
cnx.Open (); cnx.Open ();
cmd.ExecuteNonQuery (); cmd.ExecuteNonQuery ();
} }
cnx.Close(); cnx.Close ();
} }
UpdatePostCircles (postid, cids); UpdatePostCircles (postid, cids);
} }
/// <summary> /// <summary>
/// Removes the post. /// Removes the post.
/// </summary> /// </summary>
@ -146,9 +151,10 @@ namespace Npgsql.Web.Blog
cmd.CommandText = "delete from blog where _id = :id"; cmd.CommandText = "delete from blog where _id = :id";
cmd.Parameters.AddWithValue ("id", postid); cmd.Parameters.AddWithValue ("id", postid);
cnx.Open (); cnx.Open ();
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery ();
} }
} }
/// <summary> /// <summary>
/// Comment the specified from, postid and content. /// Comment the specified from, postid and content.
/// </summary> /// </summary>
@ -158,17 +164,17 @@ namespace Npgsql.Web.Blog
public override long Comment (string from, long postid, string content) public override long Comment (string from, long postid, string content)
{ {
if (from == null) if (from == null)
throw new ArgumentNullException("from"); throw new ArgumentNullException ("from");
if (content == null) if (content == null)
throw new ArgumentNullException("content"); throw new ArgumentNullException ("content");
bool visible = AutoValidatesComments; bool visible = AutoValidatesComments;
using (NpgsqlConnection cnx= using (NpgsqlConnection cnx =
new NpgsqlConnection(connectionString)) new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand()) { using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "insert into comment (postid,bcontent," + cmd.CommandText = "insert into comment (postid,bcontent," +
"modified,posted,visible,username,applicationname)" + "modified,posted,visible,username,applicationname)" +
"values (:postid,:bcontent,:modified,:posted," + "values (:postid,:bcontent,:modified,:posted," +
":visible,:username,:appname) returning _id"; ":visible,:username,:appname) returning _id";
cmd.Parameters.AddWithValue ("postid", postid); cmd.Parameters.AddWithValue ("postid", postid);
cmd.Parameters.AddWithValue ("bcontent", content); cmd.Parameters.AddWithValue ("bcontent", content);
DateTime now = DateTime.Now; DateTime now = DateTime.Now;
@ -178,9 +184,10 @@ namespace Npgsql.Web.Blog
cmd.Parameters.AddWithValue ("username", from); cmd.Parameters.AddWithValue ("username", from);
cmd.Parameters.AddWithValue ("appname", applicationName); cmd.Parameters.AddWithValue ("appname", applicationName);
cnx.Open (); cnx.Open ();
return (long) cmd.ExecuteScalar(); return (long)cmd.ExecuteScalar ();
} }
} }
/// <summary> /// <summary>
/// Validates the comment. /// Validates the comment.
/// </summary> /// </summary>
@ -189,6 +196,7 @@ namespace Npgsql.Web.Blog
{ {
throw new NotImplementedException (); throw new NotImplementedException ();
} }
/// <summary> /// <summary>
/// Updates the comment. /// Updates the comment.
/// </summary> /// </summary>
@ -202,6 +210,7 @@ namespace Npgsql.Web.Blog
} }
private bool autoValidateComment = true; private bool autoValidateComment = true;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether this <see cref="Npgsql.Web.Blog.NpgsqlBlogProvider"/> auto validate comment. /// Gets or sets a value indicating whether this <see cref="Npgsql.Web.Blog.NpgsqlBlogProvider"/> auto validate comment.
/// </summary> /// </summary>
@ -211,7 +220,7 @@ namespace Npgsql.Web.Blog
return autoValidateComment; return autoValidateComment;
} }
set { set {
autoValidateComment=value; autoValidateComment = value;
} }
} }
@ -227,6 +236,7 @@ namespace Npgsql.Web.Blog
} }
#endregion #endregion
/// <summary> /// <summary>
/// Initialize the specified name and config. /// Initialize the specified name and config.
/// </summary> /// </summary>
@ -240,10 +250,12 @@ namespace Npgsql.Web.Blog
config.Remove ("connectionStringName"); config.Remove ("connectionStringName");
applicationName = config ["applicationName"]; applicationName = config ["applicationName"];
config.Remove ("applicationName"); config.Remove ("applicationName");
defaultPageSize = int.Parse ( config ["pageLen"] ?? "10") ; defaultPageSize = int.Parse (config ["pageLen"] ?? "10");
base.Initialize (name, config); base.Initialize (name, config);
} }
#region implemented abstract members of BlogProvider #region implemented abstract members of BlogProvider
/// <summary> /// <summary>
/// Gets the post. /// Gets the post.
/// </summary> /// </summary>
@ -252,14 +264,14 @@ namespace Npgsql.Web.Blog
public override BlogEntry GetPost (long postid) public override BlogEntry GetPost (long postid)
{ {
BlogEntry be = null; BlogEntry be = null;
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString)) using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand()) { using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select username, title, bcontent, modified, posted, visible, photo from blog " + cmd.CommandText = "select username, title, bcontent, modified, posted, visible, photo from blog " +
"where applicationname = :appname and _id = :id"; "where applicationname = :appname and _id = :id";
cmd.Parameters.AddWithValue ("appname", applicationName); cmd.Parameters.AddWithValue ("appname", applicationName);
cmd.Parameters.AddWithValue ("id", postid); cmd.Parameters.AddWithValue ("id", postid);
cnx.Open (); cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader()) { using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
if (rdr.Read ()) { if (rdr.Read ()) {
be = new BlogEntry (); be = new BlogEntry ();
be.Title = rdr.GetString (rdr.GetOrdinal ("title")); be.Title = rdr.GetString (rdr.GetOrdinal ("title"));
@ -269,16 +281,18 @@ namespace Npgsql.Web.Blog
be.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted")); be.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted"));
be.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible")); be.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible"));
int oph = rdr.GetOrdinal ("photo"); int oph = rdr.GetOrdinal ("photo");
if (!rdr.IsDBNull(oph)) if (!rdr.IsDBNull (oph))
be.Photo = rdr.GetString (oph); be.Photo = rdr.GetString (oph);
be.Id = postid; be.Id = postid;
} }
} }
} }
if (be!=null) Populate (be); if (be != null)
Populate (be);
return be; return be;
} }
/// <summary> /// <summary>
/// Removes the comment. /// Removes the comment.
/// </summary> /// </summary>
@ -292,10 +306,11 @@ namespace Npgsql.Web.Blog
cmd.CommandText = "delete from comment where _id = :id returning postid"; cmd.CommandText = "delete from comment where _id = :id returning postid";
cmd.Parameters.AddWithValue ("id", cmtid); cmd.Parameters.AddWithValue ("id", cmtid);
cnx.Open (); cnx.Open ();
postid = (long) cmd.ExecuteScalar (); postid = (long)cmd.ExecuteScalar ();
} }
return postid; return postid;
} }
/// <summary> /// <summary>
/// Gets the post. /// Gets the post.
/// </summary> /// </summary>
@ -304,13 +319,13 @@ namespace Npgsql.Web.Blog
/// <param name="title">Title.</param> /// <param name="title">Title.</param>
public override UUTBlogEntryCollection GetPost (string username, string title) public override UUTBlogEntryCollection GetPost (string username, string title)
{ {
UUTBlogEntryCollection bec = new UUTBlogEntryCollection (username,title); UUTBlogEntryCollection bec = new UUTBlogEntryCollection (username, title);
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) { using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) { using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select _id,bcontent,modified,posted,visible,photo from blog " + cmd.CommandText = "select _id,bcontent,modified,posted,visible,photo from blog " +
"where applicationname = :appname and username = :username and title = :title"; "where applicationname = :appname and username = :username and title = :title";
cmd.Parameters.AddWithValue ("appname", NpgsqlDbType.Varchar, applicationName); cmd.Parameters.AddWithValue ("appname", NpgsqlDbType.Varchar, applicationName);
cmd.Parameters.AddWithValue ("username", NpgsqlDbType.Varchar ,username); cmd.Parameters.AddWithValue ("username", NpgsqlDbType.Varchar, username);
cmd.Parameters.AddWithValue ("title", NpgsqlDbType.Varchar, title); cmd.Parameters.AddWithValue ("title", NpgsqlDbType.Varchar, title);
cnx.Open (); cnx.Open ();
cmd.Prepare (); cmd.Prepare ();
@ -352,19 +367,20 @@ namespace Npgsql.Web.Blog
be.Tags = tags.ToArray (); be.Tags = tags.ToArray ();
} }
} }
if (bec!=null) Populate (bec); if (bec != null)
Populate (bec);
} }
} }
return bec; return bec;
} }
private void SetCirclesOn(BlogEntry be) private void SetCirclesOn (BlogEntry be)
{ {
List<long> circles = new List<long> (); List<long> circles = new List<long> ();
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmdcircles = cnx.CreateCommand ()) { using (NpgsqlCommand cmdcircles = cnx.CreateCommand ()) {
cmdcircles.CommandText = "select a.circle_id from blog_access a " + cmdcircles.CommandText = "select a.circle_id from blog_access a " +
"where a.post_id = :pid"; "where a.post_id = :pid";
cmdcircles.Parameters.AddWithValue ("pid", be.Id); cmdcircles.Parameters.AddWithValue ("pid", be.Id);
cnx.Open (); cnx.Open ();
using (NpgsqlDataReader rdr = cmdcircles.ExecuteReader ()) { using (NpgsqlDataReader rdr = cmdcircles.ExecuteReader ()) {
@ -380,12 +396,12 @@ namespace Npgsql.Web.Blog
/// Removes the tag. /// Removes the tag.
/// </summary> /// </summary>
/// <param name="tagid">Tagid.</param> /// <param name="tagid">Tagid.</param>
public override void DropTag(long tagid) public override void DropTag (long tagid)
{ {
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) { using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "DELETE from public.tag where _id = :tid"; cmd.CommandText = "DELETE from public.tag where _id = :tid";
cmd.Parameters.AddWithValue("tagid",tagid); cmd.Parameters.AddWithValue ("tagid", tagid);
cnx.Open (); cnx.Open ();
cmd.ExecuteNonQuery (); cmd.ExecuteNonQuery ();
cnx.Close (); cnx.Close ();
@ -393,7 +409,9 @@ namespace Npgsql.Web.Blog
} }
private static string SelectTagsSql = "SELECT tag.name, tag._id FROM public.tag WHERE name like :name"; private static string SelectTagsSql = "SELECT tag.name, tag._id FROM public.tag WHERE name like :name";
private IEnumerable<string> GetSuggestion (string pattern) {
private IEnumerable<string> GetSuggestion (string pattern)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) { using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = SelectTagsSql; cmd.CommandText = SelectTagsSql;
@ -402,7 +420,8 @@ namespace Npgsql.Web.Blog
} }
private static string InsertTagSql = "INSERT INTO tag (name) VALUES (:name) returning _id"; private static string InsertTagSql = "INSERT INTO tag (name) VALUES (:name) returning _id";
private void InsertTag(long postid, long tagid)
private void InsertTag (long postid, long tagid)
{ {
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) { using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
@ -410,8 +429,8 @@ namespace Npgsql.Web.Blog
throw new NotImplementedException (); throw new NotImplementedException ();
} }
} }
private long GetTagId(string tagname) private long GetTagId (string tagname)
{ {
long id = 0; long id = 0;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
@ -419,20 +438,30 @@ namespace Npgsql.Web.Blog
cmd.CommandText = "SELECT tag._id FROM public.tag WHERE name = :name"; cmd.CommandText = "SELECT tag._id FROM public.tag WHERE name = :name";
cmd.Parameters.AddWithValue ("name", tagname); cmd.Parameters.AddWithValue ("name", tagname);
cnx.Open (); cnx.Open ();
id = (long) cmd.ExecuteScalar (); id = (long)cmd.ExecuteScalar ();
} }
return id; return id;
} }
private long GetOrCreateTagId(string tagname)
private long GetOrCreateTagId (string tagname)
{ {
long id = 0; long id = 0;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) { try {
cmd.CommandText = "SELECT tag._id FROM public.tag WHERE name = :name;\n" + using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
"IF NOT FOUND THEN INSERT INTO tag (name) values (:name) RETURNING _id; ENDIF;\n"; cmd.CommandText = "SELECT tag._id FROM public.tag WHERE name = :name";
cmd.Parameters.AddWithValue ("name", tagname); cmd.Parameters.AddWithValue ("name", tagname);
cnx.Open (); cnx.Open ();
id = (long) cmd.ExecuteScalar (); id = (long)cmd.ExecuteScalar ();
}
} catch (NullReferenceException) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "INSERT INTO public.tag(name) VALUES (:name) RETURNING _id";
cmd.Parameters.AddWithValue ("name", tagname);
cnx.Open ();
id = (long)cmd.ExecuteScalar ();
}
}
} }
return id; return id;
} }
@ -440,13 +469,16 @@ namespace Npgsql.Web.Blog
private static string SelectPostTagsSql = "SELECT tag.name FROM public.tag, public.tagged\n" + private static string SelectPostTagsSql = "SELECT tag.name FROM public.tag, public.tagged\n" +
"WHERE tag._id = tagged.tagid AND tagged.postid = :pid \n"; "WHERE tag._id = tagged.tagid AND tagged.postid = :pid \n";
private void SetTagsOn(BlogEntryCollection bec){
private void SetTagsOn (BlogEntryCollection bec)
{
foreach (BlogEntry be in bec) { foreach (BlogEntry be in bec) {
SetTagsOn (be); SetTagsOn (be);
} }
} }
private void SetTagsOn(BlogEntry be)
private void SetTagsOn (BlogEntry be)
{ {
List<string> tags = new List<string> (); List<string> tags = new List<string> ();
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
@ -464,16 +496,18 @@ namespace Npgsql.Web.Blog
} }
// Assert(bec!=null); // Assert(bec!=null);
private void Populate(BlogEntryCollection bec) private void Populate (BlogEntryCollection bec)
{ {
foreach (BlogEntry be in bec) Populate(be); foreach (BlogEntry be in bec)
Populate (be);
} }
private void Populate(BlogEntry be) private void Populate (BlogEntry be)
{ {
SetTagsOn (be); SetTagsOn (be);
SetCirclesOn (be); SetCirclesOn (be);
} }
/// <summary> /// <summary>
/// Post the specified username, title, content and visible. /// Post the specified username, title, content and visible.
/// </summary> /// </summary>
@ -482,15 +516,15 @@ namespace Npgsql.Web.Blog
/// <param name="content">Content.</param> /// <param name="content">Content.</param>
/// <param name="visible">If set to <c>true</c> visible.</param> /// <param name="visible">If set to <c>true</c> visible.</param>
/// <param name="circles">.</param> /// <param name="circles">.</param>
public override long Post (string username, string title, string content, bool visible, long [] circles) public override long Post (string username, string title, string content, bool visible, long[] circles)
{ {
long pid = 0; long pid = 0;
if (username == null) if (username == null)
throw new ArgumentNullException("username"); throw new ArgumentNullException ("username");
if (title == null) if (title == null)
throw new ArgumentNullException("title"); throw new ArgumentNullException ("title");
if (content == null) if (content == null)
throw new ArgumentNullException("content"); throw new ArgumentNullException ("content");
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) { using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) { using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "insert into blog (title,bcontent,modified,posted,visible,username,applicationname)" + cmd.CommandText = "insert into blog (title,bcontent,modified,posted,visible,username,applicationname)" +
@ -511,12 +545,13 @@ namespace Npgsql.Web.Blog
UpdatePostCircles (pid, circles); UpdatePostCircles (pid, circles);
return pid; return pid;
} }
/// <summary> /// <summary>
/// Updates the post photo. /// Updates the post photo.
/// </summary> /// </summary>
/// <param name="pid">Pid.</param> /// <param name="pid">Pid.</param>
/// <param name="photo">Photo.</param> /// <param name="photo">Photo.</param>
public override void UpdatePostPhoto ( long pid, string photo) public override void UpdatePostPhoto (long pid, string photo)
{ {
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) { using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open (); cnx.Open ();
@ -530,7 +565,7 @@ namespace Npgsql.Web.Blog
} }
} }
private void UpdatePostCircles( long pid, long[] circles) private void UpdatePostCircles (long pid, long[] circles)
{ {
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) { using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open (); cnx.Open ();
@ -539,21 +574,22 @@ namespace Npgsql.Web.Blog
cmd.Parameters.AddWithValue ("pid", pid); cmd.Parameters.AddWithValue ("pid", pid);
cmd.ExecuteNonQuery (); cmd.ExecuteNonQuery ();
} }
if (circles!=null) if (circles != null)
if (circles.Length>0) if (circles.Length > 0)
using (NpgsqlCommand cmd = cnx.CreateCommand ()) { using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "insert into blog_access (post_id,circle_id) values (:pid,:cid)"; cmd.CommandText = "insert into blog_access (post_id,circle_id) values (:pid,:cid)";
cmd.Parameters.AddWithValue ("pid", NpgsqlTypes.NpgsqlDbType.Bigint, pid); cmd.Parameters.AddWithValue ("pid", NpgsqlTypes.NpgsqlDbType.Bigint, pid);
cmd.Parameters.Add ("cid", NpgsqlTypes.NpgsqlDbType.Bigint); cmd.Parameters.Add ("cid", NpgsqlTypes.NpgsqlDbType.Bigint);
cmd.Prepare (); cmd.Prepare ();
foreach (long ci in circles) { foreach (long ci in circles) {
cmd.Parameters ["cid"].Value = ci; cmd.Parameters ["cid"].Value = ci;
cmd.ExecuteNonQuery (); cmd.ExecuteNonQuery ();
}
} }
}
cnx.Close (); cnx.Close ();
} }
} }
/// <summary> /// <summary>
/// Finds the post. /// Finds the post.
/// </summary> /// </summary>
@ -568,40 +604,40 @@ namespace Npgsql.Web.Blog
{ {
BlogEntryCollection c = new BlogEntryCollection (); BlogEntryCollection c = new BlogEntryCollection ();
totalRecords = 0; totalRecords = 0;
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString)) using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand()) { using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
if (readersName != null) { if (readersName != null) {
cmd.CommandText = "select _id, title,bcontent, modified," + cmd.CommandText = "select _id, title,bcontent, modified," +
"posted,username,visible,photo " + "posted,username,visible,photo " +
"from blog b left outer join " + "from blog b left outer join " +
"(select count(*)>0 acc, a.post_id pid " + "(select count(*)>0 acc, a.post_id pid " +
"from blog_access a," + "from blog_access a," +
" circle_members m, users u where m.circle_id = a.circle_id " + " circle_members m, users u where m.circle_id = a.circle_id " +
" and m.member = u.username and u.username = :uname " + " and m.member = u.username and u.username = :uname " +
" and u.applicationname = :appname " + " and u.applicationname = :appname " +
" group by a.post_id) ma on (ma.pid = b._id) " + " group by a.post_id) ma on (ma.pid = b._id) " +
"where ( ((ma.acc IS NULL or ma.acc = TRUE) and b.Visible IS TRUE ) or b.username = :uname) "; "where ( ((ma.acc IS NULL or ma.acc = TRUE) and b.Visible IS TRUE ) or b.username = :uname) ";
cmd.Parameters.AddWithValue ("uname", readersName); cmd.Parameters.AddWithValue ("uname", readersName);
} else { } else {
cmd.CommandText = "select _id, title,bcontent,modified," + cmd.CommandText = "select _id, title,bcontent,modified," +
"posted,username,visible,photo " + "posted,username,visible,photo " +
"from blog b left outer join " + "from blog b left outer join " +
"(select count(*)>0 acc, a.post_id pid " + "(select count(*)>0 acc, a.post_id pid " +
"from blog_access a" + "from blog_access a" +
" group by a.post_id) ma on (ma.pid = b._id)" + " group by a.post_id) ma on (ma.pid = b._id)" +
" where " + " where " +
" ma.acc IS NULL and " + " ma.acc IS NULL and " +
" b.Visible IS TRUE and " + " b.Visible IS TRUE and " +
" applicationname = :appname"; " applicationname = :appname";
} }
cmd.Parameters.AddWithValue ("appname", applicationName); cmd.Parameters.AddWithValue ("appname", applicationName);
if (pattern != null) { if (pattern != null) {
if ((searchflags & FindBlogEntryFlags.MatchTag) > 0) { if ((searchflags & FindBlogEntryFlags.MatchTag) > 0) {
cmd.CommandText += cmd.CommandText +=
"AND EXISTS (SELECT tag._id FROM public.tag, public.tagged WHERE " + "AND EXISTS (SELECT tag._id FROM public.tag, public.tagged WHERE " +
"public.tag._id = public.tagged.tagid " + "public.tag._id = public.tagged.tagid " +
"AND public.tagged.postid = a.post_id " + "AND public.tagged.postid = a.post_id " +
"public.tag.name like :tagname) "; "public.tag.name like :tagname) ";
cmd.Parameters.AddWithValue ("tagname", pattern); cmd.Parameters.AddWithValue ("tagname", pattern);
} }
@ -624,11 +660,11 @@ namespace Npgsql.Web.Blog
cmd.CommandText += " order by posted desc"; cmd.CommandText += " order by posted desc";
cnx.Open (); cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader()) { using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
// pageIndex became one based // pageIndex became one based
int firstrec = pageIndex * pageSize; int firstrec = pageIndex * pageSize;
int lastrec = firstrec + pageSize - 1; int lastrec = firstrec + pageSize - 1;
while (rdr.Read()) { while (rdr.Read ()) {
if (totalRecords >= firstrec && totalRecords <= lastrec) { if (totalRecords >= firstrec && totalRecords <= lastrec) {
BlogEntry be = new BlogEntry (); BlogEntry be = new BlogEntry ();
be.Title = rdr.GetString (rdr.GetOrdinal ("title")); be.Title = rdr.GetString (rdr.GetOrdinal ("title"));
@ -637,7 +673,7 @@ namespace Npgsql.Web.Blog
be.Author = rdr.GetString (rdr.GetOrdinal ("username")); be.Author = rdr.GetString (rdr.GetOrdinal ("username"));
be.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted")); be.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted"));
be.Modified = rdr.GetDateTime (rdr.GetOrdinal ("modified")); be.Modified = rdr.GetDateTime (rdr.GetOrdinal ("modified"));
be.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible")); be.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible"));
{ {
int oph = rdr.GetOrdinal ("photo"); int oph = rdr.GetOrdinal ("photo");
if (!rdr.IsDBNull (oph)) if (!rdr.IsDBNull (oph))
@ -650,10 +686,12 @@ namespace Npgsql.Web.Blog
rdr.Close (); rdr.Close ();
} }
} }
if (c!=null) Populate (c); if (c != null)
Populate (c);
return c; return c;
} }
/// <summary> /// <summary>
/// Removes the post. /// Removes the post.
/// </summary> /// </summary>
@ -661,20 +699,21 @@ namespace Npgsql.Web.Blog
/// <param name="title">Title.</param> /// <param name="title">Title.</param>
public override void RemoveTitle (string username, string title) public override void RemoveTitle (string username, string title)
{ {
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString)) using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand()) { using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "delete from blog where username = :username and applicationname = :appname and title=:title"; cmd.CommandText = "delete from blog where username = :username and applicationname = :appname and title=:title";
cmd.Parameters.AddWithValue ("username",username); cmd.Parameters.AddWithValue ("username", username);
cmd.Parameters.AddWithValue ("appname", applicationName); cmd.Parameters.AddWithValue ("appname", applicationName);
cmd.Parameters.AddWithValue ("title",title); cmd.Parameters.AddWithValue ("title", title);
cnx.Open (); cnx.Open ();
cmd.ExecuteNonQuery (); cmd.ExecuteNonQuery ();
cnx.Close(); cnx.Close ();
} }
} }
int defaultPageSize = 10; int defaultPageSize = 10;
/// <summary> /// <summary>
/// Lasts the posts. /// Lasts the posts.
/// </summary> /// </summary>
@ -682,23 +721,23 @@ namespace Npgsql.Web.Blog
/// <param name="pageIndex">Page index.</param> /// <param name="pageIndex">Page index.</param>
/// <param name="pageSize">Page size.</param> /// <param name="pageSize">Page size.</param>
/// <param name="totalRecords">Total records.</param> /// <param name="totalRecords">Total records.</param>
public override BlogEntryCollection LastPosts(int pageIndex, int pageSize, out int totalRecords) public override BlogEntryCollection LastPosts (int pageIndex, int pageSize, out int totalRecords)
{ {
BlogEntryCollection c = new BlogEntryCollection (); BlogEntryCollection c = new BlogEntryCollection ();
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString)) using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand()) { using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select * " + cmd.CommandText = "select * " +
"from blog where applicationname = :appname and visible = true " + "from blog where applicationname = :appname and visible = true " +
" order by posted desc limit :len" ; " order by posted desc limit :len";
cmd.Parameters.AddWithValue ("appname", applicationName); cmd.Parameters.AddWithValue ("appname", applicationName);
cmd.Parameters.AddWithValue ("len", defaultPageSize*10); cmd.Parameters.AddWithValue ("len", defaultPageSize * 10);
cnx.Open (); cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader()) { using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
totalRecords = 0; totalRecords = 0;
int firstrec = pageIndex * pageSize; int firstrec = pageIndex * pageSize;
int lastrec = firstrec + pageSize - 1; int lastrec = firstrec + pageSize - 1;
while (rdr.Read()) { while (rdr.Read ()) {
if (totalRecords >= firstrec && totalRecords <= lastrec) { if (totalRecords >= firstrec && totalRecords <= lastrec) {
BlogEntry be = new BlogEntry (); BlogEntry be = new BlogEntry ();
be.Id = rdr.GetInt64 (rdr.GetOrdinal ("_id")); be.Id = rdr.GetInt64 (rdr.GetOrdinal ("_id"));
@ -719,9 +758,11 @@ namespace Npgsql.Web.Blog
} }
} }
} }
if (c!=null) Populate (c); if (c != null)
Populate (c);
return c; return c;
} }
#endregion #endregion
} }
} }

View file

@ -1,5 +1,5 @@
// //
// NUnitTestClass.cs // AllTests.cs
// //
// Author: // Author:
// Paul Schneider <paul@pschneider.fr> // Paul Schneider <paul@pschneider.fr>
@ -18,24 +18,35 @@
// //
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
using NUnit.Framework; using NUnit.Framework;
using System; using System;
using Yavsc.Model.Blogs;
using Yavsc.Controllers;
using System.Web.Mvc;
using System.Web.Security;
using System.Web.Configuration;
using System.Configuration;
using System.IO;
using System.Web.Http;
using Mono.WebServer;
using System.Net;
using System.Collections;
namespace Yavsc namespace Yavsc
{ {
/// <summary> public class AllTests
/// N unit test class.
/// </summary>
[TestFixture ()]
public class NUnitTestClass
{ {
/// <summary> [Suite]
/// Tests the case. public static IEnumerable Suite
/// </summary>
[Test ()]
public void TestCase ()
{ {
get
{
ArrayList suite = new ArrayList ();
suite.Add(new BlogUnitTestCase());
return suite;
}
} }
} }
} }

View file

@ -25,7 +25,7 @@ using Yavsc.Model.Blogs;
namespace Yavsc namespace Yavsc
{ {
[TestFixture ()] [TestFixture ()]
public class BlogUnitTestCase: AccountUnitTestCase public class BlogUnitTestCase: ServerTestCase
{ {
[TestFixtureSetUp] [TestFixtureSetUp]

11
TestAPI/ChangeLog Normal file
View file

@ -0,0 +1,11 @@
2015-10-17 Paul Schneider <paul@pschneider.fr>
* AllTests.cs:
* HelloWorld.cs:
* DebugServer.cs:
* TestAPI.csproj:
* TestAutomate.cs:
* ServerTestCase.cs:
* BlogUnitTestCase.cs:
* test-domain-TestAPI.config:

View file

@ -1,5 +1,5 @@
// //
// parralax.js // DebugServer.cs
// //
// Author: // Author:
// Paul Schneider <paul@pschneider.fr> // Paul Schneider <paul@pschneider.fr>
@ -19,19 +19,33 @@
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
$(document).ready(function(){ using System;
var $window = $(window); using NUnit.Framework;
$(window).scroll(function() { using System.Net;
var $ns = $('#notifications'); using Mono.WebServer.XSP;
if ($ns.has('*').length>0) {
if ($window.scrollTop()>375) { namespace Mono.WebServer.Test
$ns.css('position','fixed'); {
$ns.css('z-index',2);
$ns.css('top',0); public class DebugServer : IDisposable
{
#region IDisposable implementation
public void Dispose ()
{
// would have a sense when managing the Xsp server instance:
// server.Stop();
} }
else {
$ns.css('position','static'); #endregion
$ns.css('z-index',1);
}} string physicalPath = @"/home/paul/workspace/totem/web/";
});
}); public int Run ()
{
return Server.Main (new [] { "--applications", "/:"+physicalPath, "--port", "8080", "--nonstop" });
}
}
}

73
TestAPI/HelloWorld.cs Normal file
View file

@ -0,0 +1,73 @@
//
// HelloWorld.cs
//
//
// HelloWorld.cs
//
// Author:
// Leonardo Taglialegne <leonardo.taglialegne@gmail.com>
//
// Copyright (c) 2013 Leonardo Taglialegne.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using NUnit.Framework;
using System.Net;
using Mono.WebServer.XSP;
namespace Mono.WebServer.Test
{
[TestFixture]
public class HelloWorld
{
[Test]
public void TestCase ()
{
using (var server = new DebugServer()) {
Assert.AreEqual (0, server.Run ());
var wc = new WebClient ();
try {
string downloaded = wc.DownloadString ("http://localhost:8080/");
//Assert.AreEqual (Environment.CurrentDirectory, downloaded);
// ResponseHeaders {
// Date: Thu, 15 Oct 2015 16:12:00 GMT
// Server: Mono.WebServer.XSP/3.8.0.0 Linux
// X-AspNetMvc-Version: 3.0
// X-AspNet-Version: 4.0.30319
// Content-Length: 2180
// Cache-Control: private
// Content-Type: text/html
// Set-Cookie: ASP.NET_SessionId=ED208D636A4312B9745E396D; path=/
// Keep-Alive: timeout=15, max=100
// Connection: Keep-Alive } System.Net.WebHeaderCollection
Assert.Greater(wc.ResponseHeaders["Set-Cookie"].Length, 10);
} catch (WebException e) {
Assert.Fail (e.Message);
}
}
}
}
}

View file

@ -28,12 +28,17 @@ using System.Web.Configuration;
using System.Configuration; using System.Configuration;
using System.IO; using System.IO;
using System.Web.Http; using System.Web.Http;
using Mono.WebServer;
using System.Net;
using System.Web.Hosting;
using Mono.Web.Util;
using Mono.WebServer.Options;
namespace Yavsc namespace Yavsc
{ {
[TestFixture ()] [TestFixture ()]
public class AccountUnitTestCase public class ServerTestCase
{ {
public string UserName { get; set; } public string UserName { get; set; }
@ -47,33 +52,70 @@ namespace Yavsc
return accountController; return accountController;
} }
} }
string defaultMembershipProvider = null;
[Test]
public virtual void Init()
{
webSource = new XSPWebSource (configurationManager.Address, configurationManager.Port, !root);
var server = new ApplicationServer (webSource, configurationManager.Root) { ApplicationServer WebAppServer;
Verbose = configurationManager.Verbose,
SingleApplication = !root string defaultMembershipProvider = null;
};
[Test]
public virtual void Start()
{
// get the web config
string physicalPath = @"/home/paul/workspace/totem/web/";
string physicalPathToConfig = physicalPath + "/Web.config";
ExeConfigurationFileMap exemap = new ExeConfigurationFileMap ();
exemap.ExeConfigFilename = physicalPathToConfig ;
Configuration config = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration (exemap, ConfigurationUserLevel.None);
string basedir = AppDomain.CurrentDomain.BaseDirectory; string basedir = AppDomain.CurrentDomain.BaseDirectory;
string curdir = Directory.GetCurrentDirectory (); string curdir = Directory.GetCurrentDirectory ();
string dummyVirtualPath = "/"; string dummyVirtualPath = "/";
string physicalPath = @"/home/paul/workspace/totem/web/"; int Port=8080;
WebConfigurationFileMap map = new WebConfigurationFileMap (); XSPWebSource websource=new XSPWebSource(IPAddress.Any,Port);
map.VirtualDirectories.Add(dummyVirtualPath, new VirtualDirectoryMapping(physicalPath, true)); WebAppServer=new ApplicationServer(websource,physicalPath);
Configuration configuration = WebConfigurationManager.OpenMappedWebConfiguration(map, dummyVirtualPath);
accountController = new AccountController (); var broker = new XSPRequestBroker ();
string da = (string) configuration.AppSettings.Settings ["DefaultAvatar"].Value; var host = new XSPApplicationHost ();
MembershipSection s = configuration.GetSection ("system.web/membership") as MembershipSection;
defaultMembershipProvider = s.DefaultProvider; host.RequestBroker = broker;
host.Server = WebAppServer;
broker.InitializeLifetimeService ();
host.InitializeLifetimeService ();
// ApplicationHost h = new XSPApplicationHost();
//"[[hostname:]port:]VPath:realpath"
string cmdLine=Port+":/:"+physicalPath;
WebAppServer.AddApplicationsFromCommandLine (cmdLine);
WebAppServer.Broker = broker;
WebAppServer.AppHost = host;
// WebAppServer.AddApplicationsFromConfigFile (physicalPath+"/Web.config");
// WebConfigurationFileMap map = new WebConfigurationFileMap ();
// map.VirtualDirectories.Add (dummyVirtualPath, new VirtualDirectoryMapping (physicalPath, true));
// TODO why not? Configuration configuration = WebConfigurationManager.OpenMappedWebConfiguration (map, dummyVirtualPath);
// string da = (string)config.AppSettings.Settings ["DefaultAvatar"].Value;
// MembershipSection s = config.GetSection ("system.web/membership") as MembershipSection;
// defaultMembershipProvider = s.DefaultProvider;
// ??? WebConfigurationManager.ConfigPath
Configuration cfg = WebConfigurationManager.OpenWebConfiguration (dummyVirtualPath);
// WebConfigurationManager.AppSettings.Clear ();
// WebConfigurationManager.ConnectionStrings.Clear ();
// var mbrssect = WebConfigurationManager.GetWebApplicationSection ("system.web/membership") as MembershipSection;
//
// mbrssect.Providers.Clear ();
var syswebcfg = WebConfigurationManager.GetWebApplicationSection ("system.web") as ConfigurationSection;
WebAppServer.Start (true,2000);
// System.Threading.Thread.Sleep(30000);
} }
[Test ()] [Test ()]
public virtual void Register () public virtual void Register ()
{ {
accountController = new AccountController ();
ViewResult actionResult = accountController.Register ( ViewResult actionResult = accountController.Register (
new Yavsc.Model.RolesAndMembers.RegisterViewModel () { new Yavsc.Model.RolesAndMembers.RegisterViewModel () {
UserName = UserName, Email = Email, UserName = UserName, Email = Email,
@ -93,7 +135,11 @@ namespace Yavsc
Assert.True (u.IsApproved); Assert.True (u.IsApproved);
} }
[TestFixtureTearDown()] [Test()]
public virtual void Stop() {
WebAppServer.Stop();
}
public virtual void Unregister() public virtual void Unregister()
{ {
ViewResult actionResult = ViewResult actionResult =

View file

@ -58,11 +58,37 @@
<Reference Include="System.Web.Mvc" /> <Reference Include="System.Web.Mvc" />
<Reference Include="System.Web.ApplicationServices" /> <Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web" /> <Reference Include="System.Web" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Routing" />
<Reference Include="System.Web.Http" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Security" />
<Reference Include="System.Net" />
<Reference Include="Mono.WebServer2">
<HintPath>..\..\..\..\..\usr\lib\mono\4.5\Mono.WebServer2.dll</HintPath>
</Reference>
<Reference Include="xsp4">
<HintPath>..\..\..\..\..\usr\lib\mono\4.5\xsp4.exe</HintPath>
</Reference>
<Reference Include="nunit.util, Version=2.6.3.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
<Package>nunit</Package>
</Reference>
<Reference Include="nunit.mocks, Version=2.6.3.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
<Package>nunit</Package>
</Reference>
<Reference Include="nunit-console-runner, Version=2.6.3.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
<Package>nunit</Package>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestAutomate.cs" /> <Compile Include="TestAutomate.cs" />
<Compile Include="BlogUnitTest.cs" /> <Compile Include="BlogUnitTestCase.cs" />
<Compile Include="TestByteA.cs" />
<Compile Include="AllTests.cs" />
<Compile Include="HelloWorld.cs" />
<Compile Include="ServerTestCase.cs" />
<Compile Include="DebugServer.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup> <ItemGroup>
@ -74,8 +100,28 @@
<Project>{77044C92-D2F1-45BD-80DD-AA25B311B027}</Project> <Project>{77044C92-D2F1-45BD-80DD-AA25B311B027}</Project>
<Name>Web</Name> <Name>Web</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\NpgsqlBlogProvider\NpgsqlBlogProvider.csproj">
<Project>{C6E9E91B-97D3-48D9-8AA7-05356929E162}</Project>
<Name>NpgsqlBlogProvider</Name>
</ProjectReference>
<ProjectReference Include="..\NpgsqlContentProvider\NpgsqlContentProvider.csproj">
<Project>{821FF72D-9F4B-4A2C-B95C-7B965291F119}</Project>
<Name>NpgsqlContentProvider</Name>
</ProjectReference>
<ProjectReference Include="..\NpgsqlMRPProviders\NpgsqlMRPProviders.csproj">
<Project>{BBA7175D-7F92-4278-96FC-84C495A2B5A6}</Project>
<Name>NpgsqlMRPProviders</Name>
</ProjectReference>
<ProjectReference Include="..\SalesCatalog\SalesCatalog.csproj">
<Project>{90BF2234-7252-4CD5-B2A4-17501B19279B}</Project>
<Name>SalesCatalog</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="test-domain-TestAPI.config">
<Gettext-ScanForTranslations>False</Gettext-ScanForTranslations>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -55,7 +55,9 @@ namespace TestAPI
[Test] [Test]
public void DoTheTest() public void DoTheTest()
{ {
// Establish
context.Invoke (); context.Invoke ();
// Because
of.Invoke (); of.Invoke ();
should_be_in_state_0.Invoke (); should_be_in_state_0.Invoke ();
should_not_be_in_state_1.Invoke (); should_not_be_in_state_1.Invoke ();

View file

@ -21,38 +21,38 @@ namespace Yavsc.ApiControllers
/// </summary> /// </summary>
public class BlogsController : YavscApiController public class BlogsController : YavscApiController
{ {
private const string adminRoleName = "Admin";
/// <summary>
/// Initialize the specified controllerContext.
/// </summary>
/// <param name="controllerContext">Controller context.</param>
protected override void Initialize (System.Web.Http.Controllers.HttpControllerContext controllerContext)
{
base.Initialize (controllerContext);
if (!Roles.RoleExists (adminRoleName)) {
Roles.CreateRole (adminRoleName);
}
}
/// <summary> /// <summary>
/// Tag the specified postid and tag. /// Tag the specified postid and tag.
/// </summary> /// </summary>
/// <param name="postid">Postid.</param> /// <param name="id">Postid.</param>
/// <param name="tag">Tag.</param> /// <param name="tag">Tag.</param>
public void Tag (long postid,string tag) { [Authorize,
BlogManager.GetForEditing (postid); AcceptVerbs ("POST")]
BlogManager.Tag (postid, tag); public void Tag (PostTag model) {
if (ModelState.IsValid) {
BlogManager.GetForEditing (model.PostId);
BlogManager.Tag (model.PostId, model.Tag);
}
}
/// <summary>
/// Tags the specified pattern.
/// </summary>
/// <param name="pattern">Pattern.</param>
[ValidateAjaxAttribute]
public IEnumerable<string> Tags(string pattern)
{
return new string[] { "Artistes", "Accueil", "Mentions juridique", "Admin", "Web" } ;
} }
/// <summary> /// <summary>
/// Untag the specified postid and tag. /// Untag the specified postid and tag.
/// </summary> /// </summary>
/// <param name="postid">Postid.</param> /// <param name="id">Postid.</param>
/// <param name="tag">Tag.</param> /// <param name="tag">Tag.</param>
public void Untag (long postid,string tag) { [Authorize, ValidateAjaxAttribute, HttpPost]
BlogManager.GetForEditing (postid); public void Untag (long id, [FromBody] string tag) {
BlogManager.Untag (postid, tag); BlogManager.GetForEditing (id);
BlogManager.Untag (id, tag);
} }
/// <summary> /// <summary>
@ -60,8 +60,8 @@ namespace Yavsc.ApiControllers
/// </summary> /// </summary>
/// <param name="user">User.</param> /// <param name="user">User.</param>
/// <param name="title">Title.</param> /// <param name="title">Title.</param>
[Authorize] [Authorize, ValidateAjaxAttribute, HttpPost]
public void RemoveTitle(string user, string title) { public void RemoveTitle(string user, string title) {
if (Membership.GetUser ().UserName != user) if (Membership.GetUser ().UserName != user)
if (!Roles.IsUserInRole("Admin")) if (!Roles.IsUserInRole("Admin"))
throw new AuthorizationDenied (user); throw new AuthorizationDenied (user);
@ -72,7 +72,8 @@ namespace Yavsc.ApiControllers
/// Removes the tag. /// Removes the tag.
/// </summary> /// </summary>
/// <param name="tagid">Tagid.</param> /// <param name="tagid">Tagid.</param>
public void RemoveTag(long tagid) { [Authorize, ValidateAjaxAttribute, HttpPost]
public void RemoveTag([FromBody] long tagid) {
throw new NotImplementedException (); throw new NotImplementedException ();
} }
@ -96,7 +97,7 @@ namespace Yavsc.ApiControllers
/// Posts the file. /// Posts the file.
/// </summary> /// </summary>
/// <returns>The file.</returns> /// <returns>The file.</returns>
[Authorize,HttpPost] [Authorize, HttpPost]
public async Task<HttpResponseMessage> PostFile(long id) { public async Task<HttpResponseMessage> PostFile(long id) {
if (!(Request.Content.Headers.ContentType.MediaType=="multipart/form-data")) if (!(Request.Content.Headers.ContentType.MediaType=="multipart/form-data"))
throw new HttpRequestException ("not a multipart/form-data request"); throw new HttpRequestException ("not a multipart/form-data request");
@ -142,10 +143,10 @@ namespace Yavsc.ApiControllers
/// Searchs the file. /// Searchs the file.
/// </summary> /// </summary>
/// <returns>The file.</returns> /// <returns>The file.</returns>
/// <param name="postid">Postid.</param> /// <param name="id">Postid.</param>
/// <param name="terms">Terms.</param> /// <param name="terms">Terms.</param>
[Authorize,HttpGet] [HttpGet]
public async Task<HttpResponseMessage> SearchFile(long postid, string terms) { public async Task<HttpResponseMessage> SearchFile(long id, string terms) {
throw new NotImplementedException (); throw new NotImplementedException ();
} }
@ -154,8 +155,8 @@ namespace Yavsc.ApiControllers
/// </summary> /// </summary>
/// <param name="id">Identifier.</param> /// <param name="id">Identifier.</param>
/// <param name="photo">Photo.</param> /// <param name="photo">Photo.</param>
[Authorize,HttpPost] [Authorize, HttpPost, ValidateAjaxAttribute]
public void SetPhoto(long id, string photo) public void SetPhoto(long id, [FromBody] string photo)
{ {
BlogManager.Provider.UpdatePostPhoto (id, photo); BlogManager.Provider.UpdatePostPhoto (id, photo);
} }
@ -164,6 +165,7 @@ namespace Yavsc.ApiControllers
/// Import the specified id. /// Import the specified id.
/// </summary> /// </summary>
/// <param name="id">Identifier.</param> /// <param name="id">Identifier.</param>
[Authorize, HttpPost, ValidateAjaxAttribute]
public async Task<HttpResponseMessage> Import(long id) { public async Task<HttpResponseMessage> Import(long id) {
if (!(Request.Content.Headers.ContentType.MediaType=="multipart/form-data")) if (!(Request.Content.Headers.ContentType.MediaType=="multipart/form-data"))
throw new HttpRequestException ("not a multipart/form-data request"); throw new HttpRequestException ("not a multipart/form-data request");

View file

@ -7,24 +7,53 @@ body {
padding: 0; padding: 0;
margin: 0; margin: 0;
} }
/* Start by setting display:none to make this hidden.
Then we position it in relation to the viewport window
with position:fixed. Width, height, top and left speak
for themselves. Background we set to 80% white with
our animation centered, and no-repeating */
.modal {
display: none;
position: fixed;
z-index: 1000;
top: 0;
left: 0;
height: 100%;
width: 100%;
background: rgba( 255, 255, 255, .8 )
url('http://i.stack.imgur.com/FhHRx.gif')
50% 50%
no-repeat;
}
/* When the body has the loading class, we turn
the scrollbar off with overflow:hidden */
body.loading {
overflow: hidden;
}
/* Anytime the body has the loading class, our
modal element will be visible */
body.loading .modal {
display: block;
}
.iconsmall { max-height: 1.3em; max-width: 1.3em; } .iconsmall { max-height: 1.3em; max-width: 1.3em; }
.photo { width: 100%; } .photo { width: 100%; }
.blogbanner { float: left; top:0; } .blogbanner { float: left; top:0; }
.subtitle { font-size:small; font-style: italic; }
header { header {
padding: 0; padding: 0;
margin: 0; margin: 0;
margin-top: 0;
padding-top: 201px; padding-top: 201px;
margin-bottom:2em; padding-bottom:2em;
display: block; display: block;
text-align: center;
background: url("/images/totem-banner.xs.jpg") 0 0 no-repeat fixed; background: url("/images/totem-banner.xs.jpg") 0 0 no-repeat fixed;
} }
header h1, header a { header h1, header a {
background-color: rgba(0,0,0,.5); background-color: rgba(0,0,0,.5);
margin:0; padding:1em;
} }
nav { nav {
@ -34,12 +63,11 @@ nav {
border-radius:1em; border-radius:1em;
background: url("/images/live-concert-388160_1280.jpg") 50% 10em repeat fixed ; background: url("/images/live-concert-388160_1280.jpg") 50% 10em repeat fixed ;
justify-content: space-around; justify-content: space-around;
min-height:5em;
} }
main { main {
margin: 2em; margin: 2em;
padding: 6em 2em 6em 2em; padding: 2em;
display: block; display: block;
border-radius:1em; border-radius:1em;
background: url("/images/musician-923526_1.nbb.jpg") 50% 20em repeat fixed ; background: url("/images/musician-923526_1.nbb.jpg") 50% 20em repeat fixed ;
@ -54,29 +82,26 @@ footer {
clear: both; clear: both;
font-size: smaller; font-size: smaller;
justify-content: space-around; justify-content: space-around;
} }
footer a { footer a {
border-radius:5px; border-radius:1em;
margin:.5em;
padding:1em; padding:1em;
} }
legend { legend {
border-radius:5px; border-radius:5px;
margin:.5em; padding:.5em;
padding:1.5em;
background-color: rgba(0,0,32,.5); background-color: rgba(0,0,32,.5);
} }
#copyr { text-align: center; display: block; background-color: rgba(20,20,20,.8); } #copyr { text-align: center; display: block; background-color: rgba(20,20,20,.8); }
footer p { display:inline-block; } footer p { display:inline-block; }
footer img { max-height: 2em; vertical-align: middle; } footer img { max-height: 3em; vertical-align: middle; }
a img, h1 img, .menuitem img { max-height: 1em; vertical-align: middle; } a img, h1 img, .menuitem img { max-height: 1em; vertical-align: middle; }
#gspacer { #gspacer {
background-color: rgba(20,20,20,.8); background-color: rgba(20,20,20,.8);
border-radius:5px; border-radius:1em;
margin:.5em; padding:1em; display: inline-block } margin:1em; padding:1em; display: inline-block }
fieldset { fieldset {
background-color: rgba(16,16,64,0.8); background-color: rgba(16,16,64,0.8);
border-radius:5px; border: solid 1px #000060; border-radius:5px; border: solid 1px #000060;
@ -85,7 +110,7 @@ fieldset {
main video, main img { main video, main img {
max-width:100%; max-width:100%;
max-height:75%; max-height:75%;
padding: .5em; padding: 1em;
} }
aside { aside {
@ -97,10 +122,9 @@ aside {
.postpreview { .postpreview {
display: inline-block; display: inline-block;
max-width: 40em; max-width: 40em;
padding: .5em; padding: 1em;
margin: .5em;
background-color: rgba(0,0,32,0.8); background-color: rgba(0,0,32,0.8);
border-radius:10px; border-radius:1em;
} }
.postpreview video, .postpreview img { .postpreview video, .postpreview img {
max-width:100%; max-width:100%;
@ -108,11 +132,10 @@ aside {
} }
.post { .post {
display:block; display:block;
margin:1em; padding: 1em;
padding:1em;
background-color: rgba(0,0,32,0.8); background-color: rgba(0,0,32,0.8);
color: #eee; color: #eee;
border-radius:10px; border-radius:1em;
} }
.hiddenpost { background-color: rgba(16,16,16,0.5); } .hiddenpost { background-color: rgba(16,16,16,0.5); }
.fullwidth { width: 100%; } .fullwidth { width: 100%; }
@ -129,24 +152,23 @@ textarea.fullwidth { min-height:10em; }
.panel,.bshpanel, aside { .panel,.bshpanel, aside {
background-color: rgba(20,20,20,.8); background-color: rgba(20,20,20,.8);
border-radius: 5px; border-radius: 1em;
margin: .5em; padding: 1em;
padding: .5em;
} }
.spanel { .spanel {
max-width: 24em; max-width: 24em;
display: inline-block; display: inline-block;
margin: .3em; padding: .3em;
} }
.xspanel { .xspanel {
max-width:13em; max-width:13em;
display: inline-block; display: inline-block;
margin:.2em; padding:.2em;
} }
.xxspanel { .xxspanel {
max-width:7em; max-width:7em;
display: inline-block; display: inline-block;
margin:.1em; padding:.1em;
} }
.hint { .hint {
display: inline; display: inline;
@ -162,7 +184,7 @@ content: ")";
.usertitleref { .usertitleref {
border-radius: 5px; border-radius: 1em;
background-color:rgba(0,0,32,0.6); background-color:rgba(0,0,32,0.6);
font-family: 'Arial', cursive; font-family: 'Arial', cursive;
padding: 1em; padding: 1em;
@ -180,8 +202,7 @@ label {
border: dashed rgb(020,20,256) 2px; border: dashed rgb(020,20,256) 2px;
} }
#notifications { #notifications {
margin: 2em; padding: 1em;
padding: 2em;
} }
.notification { .notification {
@ -230,7 +251,6 @@ a {
cursor: pointer; cursor: pointer;
font-family: 'Arial', cursive; font-family: 'Arial', cursive;
padding: 1em; padding: 1em;
margin:1em;
} }
input, select, textarea { input, select, textarea {
@ -299,22 +319,33 @@ input, select, textarea {
.c3-alt { display:none; } .c3-alt { display:none; }
@media all and (max-width: 640px) { @media all and (max-width: 640px) {
header {
padding-bottom:1em;
}
header h1, header a , .actionlink, .menuitem, a { padding:.5em;}
nav { nav {
margin: 1em; margin: 1em;
padding: 1em; padding: 1em;
min-height:4em;
background: url("/images/live-concert-388160_1280.s.jpg") 50% 10% repeat fixed ; background: url("/images/live-concert-388160_1280.s.jpg") 50% 10% repeat fixed ;
} }
main { main {
margin: 1em; margin: 1em;
padding: 4em 1em 4em 1em; padding: 1em;
background: url("/images/musician-923526_1.nbb.xs.jpg") 50% 20em repeat fixed ; background: url("/images/musician-923526_1.nbb.xs.jpg") 50% 20em repeat fixed ;
} }
footer { footer {
background: url("/images/drummer-652345_1280.xs.jpg") 50% 90% repeat fixed ; background: url("/images/drummer-652345_1280.s.jpg") 50% 90% repeat fixed ;
padding: 1em;
margin: 1em;
} }
footer a {
border-radius:.5em;
margin:.5em;
padding:.5em;
}
#notifications {
padding: .5em;
}
.menuitem { .menuitem {
display: block; display: block;
} }
@ -326,7 +357,6 @@ input, select, textarea {
padding:.3em; padding:.3em;
} }
.bshpanel { cursor:zoom-in; } .bshpanel { cursor:zoom-in; }
footer { clear:both; }
.c2 { display:initial; } .c2 { display:initial; }
.c2-alt { display:none; } .c2-alt { display:none; }
@ -336,30 +366,30 @@ input, select, textarea {
@media all and (max-width: 350px) { @media all and (max-width: 350px) {
header { header {
padding: 0;
margin: 0;
margin-top: 0;
padding-top: 101px; padding-top: 101px;
margin-bottom:1em; padding-bottom:1em;
background: url("/images/totem-banner.xxs.jpg") 0 0 no-repeat fixed; background: url("/images/totem-banner.xxs.jpg") 0 0 no-repeat fixed;
} }
header h1, header a { padding:.2em;}
nav { nav {
margin: .5em; margin: .5em;
padding: .5em; padding: .5em;
min-height:3em;
background: url("/images/live-concert-388160_1280.xxs.jpg") 50% 10% repeat fixed ; background: url("/images/live-concert-388160_1280.xxs.jpg") 50% 10% repeat fixed ;
} }
main { main {
margin: .5em; margin: .5em;
padding: 3em .5em 3em .5em; padding: .5em;
background: url("/images/musician-923526_1.nbb.xxs.jpg") 50% 20em repeat fixed ; background: url("/images/musician-923526_1.nbb.xxs.jpg") 50% 20em repeat fixed ;
} }
footer { footer {
background: url("/images/drummer-652345_1280.xxs.jpg") 50% 90% repeat fixed ; background: url("/images/drummer-652345_1280.xxs.jpg") 50% 90% repeat fixed ;
margin: 0.5em;
padding: 0.5em;
} }
footer a {
border-radius:.2em;
margin:.2em;
padding:.2em;
}
.c2 { display:none; } .c2 { display:none; }
.c2-alt { display:initial; } .c2-alt { display:initial; }
} }

View file

@ -1,3 +1,29 @@
2015-10-17 Paul Schneider <paul@pschneider.fr>
* Web.csproj:
* Global.asax.cs:
* yavsc.js:
* App.master:
* style.css:
* Edit.aspx:
* Title.aspx:
* Index.aspx:
* YavscHelpers.cs:
* UserPost.aspx:
* UserPosts.aspx:
* PageLinks.ascx:
* TagControl.ascx:
* PostActions.ascx:
* HomeController.cs:
* AdminController.cs:
* BlogsController.cs:
* GoogleController.cs:
* Estimate.aspx:
* AccountController.cs:
* BlogsController.cs:
* knockout-jqAutocomplete.js:
* knockout-jqAutocomplete.min.js:
2015-10-13 Paul Schneider <paul@pschneider.fr> 2015-10-13 Paul Schneider <paul@pschneider.fr>
* Index.aspx: * Index.aspx:

View file

@ -388,20 +388,20 @@ namespace Yavsc.Controllers
{ {
MembershipUser u = Membership.GetUser (id, false); MembershipUser u = Membership.GetUser (id, false);
if (u == null) { if (u == null) {
ViewData ["Error"] = YavscHelpers.Notify( ViewData,
string.Format ("Cet utilisateur n'existe pas ({0})", id); string.Format ("Cet utilisateur n'existe pas ({0})", id));
} else if (u.ProviderUserKey.ToString () == key) { } else if (u.ProviderUserKey.ToString () == key) {
if (u.IsApproved) { if (u.IsApproved) {
ViewData ["Message"] = YavscHelpers.Notify( ViewData,
string.Format ("Votre compte ({0}) est déjà validé.", id); string.Format ("Votre compte ({0}) est déjà validé.", id));
} else { } else {
u.IsApproved = true; u.IsApproved = true;
Membership.UpdateUser (u); Membership.UpdateUser (u);
ViewData ["Message"] = YavscHelpers.Notify( ViewData,
string.Format ("La création de votre compte ({0}) est validée.", id); string.Format ("La création de votre compte ({0}) est validée.", id));
} }
} else } else
ViewData ["Error"] = "La clé utilisée pour valider ce compte est incorrecte"; YavscHelpers.Notify( ViewData, "La clé utilisée pour valider ce compte est incorrecte" );
return View (); return View ();
} }

View file

@ -165,7 +165,7 @@ namespace Yavsc.Controllers
ViewData ["usertoremove"] = username; ViewData ["usertoremove"] = username;
if (submitbutton == "Supprimer") { if (submitbutton == "Supprimer") {
Membership.DeleteUser (username); Membership.DeleteUser (username);
YavscHelpers.Notice(ViewData, string.Format("utilisateur \"{0}\" supprimé",username)); YavscHelpers.Notify(ViewData, string.Format("utilisateur \"{0}\" supprimé",username));
ViewData ["usertoremove"] = null; ViewData ["usertoremove"] = null;
} }
return View (); return View ();
@ -240,7 +240,7 @@ namespace Yavsc.Controllers
public ActionResult DoAddRole (string rolename) public ActionResult DoAddRole (string rolename)
{ {
Roles.CreateRole(rolename); Roles.CreateRole(rolename);
YavscHelpers.Notice(ViewData, LocalizedText.role_created+ " : "+rolename); YavscHelpers.Notify(ViewData, LocalizedText.role_created+ " : "+rolename);
return View (); return View ();
} }
@ -278,7 +278,7 @@ namespace Yavsc.Controllers
ViewData ["useritems"] = users; ViewData ["useritems"] = users;
if (ModelState.IsValid) { if (ModelState.IsValid) {
Roles.AddUserToRole (model.UserName, adminRoleName); Roles.AddUserToRole (model.UserName, adminRoleName);
YavscHelpers.Notice(ViewData, model.UserName + " "+LocalizedText.was_added_to_the_role+" '" + adminRoleName + "'"); YavscHelpers.Notify(ViewData, model.UserName + " "+LocalizedText.was_added_to_the_role+" '" + adminRoleName + "'");
} else { } else {
if (admins.Length > 0) { if (admins.Length > 0) {
if (! admins.Contains (Membership.GetUser ().UserName)) { if (! admins.Contains (Membership.GetUser ().UserName)) {
@ -290,7 +290,7 @@ namespace Yavsc.Controllers
// No admin, gives the Admin Role to the current user // No admin, gives the Admin Role to the current user
Roles.AddUserToRole (currentUser, adminRoleName); Roles.AddUserToRole (currentUser, adminRoleName);
admins = new string[] { currentUser }; admins = new string[] { currentUser };
YavscHelpers.Notice(ViewData, string.Format ( YavscHelpers.Notify(ViewData, string.Format (
LocalizedText.was_added_to_the_empty_role, LocalizedText.was_added_to_the_empty_role,
currentUser, adminRoleName)); currentUser, adminRoleName));
} }

View file

@ -36,8 +36,11 @@ namespace Yavsc.Controllers
/// <param name="title">Title.</param> /// <param name="title">Title.</param>
/// <param name="pageIndex">Page index.</param> /// <param name="pageIndex">Page index.</param>
/// <param name="pageSize">Page size.</param> /// <param name="pageSize">Page size.</param>
public ActionResult Index (int pageIndex = 0, int pageSize = 10) public ActionResult Index (string title, int pageIndex = 0, int pageSize = 10)
{ {
if (title != null)
return Title (title, pageIndex, pageSize);
return BlogList (pageIndex, pageSize); return BlogList (pageIndex, pageSize);
} }
/// <summary> /// <summary>
@ -45,7 +48,7 @@ namespace Yavsc.Controllers
/// </summary> /// </summary>
/// <returns>The media.</returns> /// <returns>The media.</returns>
/// <param name="id">Identifier.</param> /// <param name="id">Identifier.</param>
public ActionResult ChooseMedia(long id) public ActionResult ChooseMedia(long postid)
{ {
return View (); return View ();
} }
@ -76,20 +79,20 @@ namespace Yavsc.Controllers
/// <param name="pageSize">Page size.</param> /// <param name="pageSize">Page size.</param>
/// ///
[HttpGet] [HttpGet]
public ActionResult Title (string id, int pageIndex = 0, int pageSize = 10) public ActionResult Title (string title, int pageIndex = 0, int pageSize = 10)
{ {
int recordCount; int recordCount;
MembershipUser u = Membership.GetUser (); MembershipUser u = Membership.GetUser ();
string username = u == null ? null : u.UserName; string username = u == null ? null : u.UserName;
FindBlogEntryFlags sf = FindBlogEntryFlags.MatchTitle; FindBlogEntryFlags sf = FindBlogEntryFlags.MatchTitle;
BlogEntryCollection c = BlogEntryCollection c =
BlogManager.FindPost (username, id, sf, pageIndex, pageSize, out recordCount); BlogManager.FindPost (username, title, sf, pageIndex, pageSize, out recordCount);
var utc = new UTBlogEntryCollection (id); var utc = new UTBlogEntryCollection (title);
utc.AddRange (c); utc.AddRange (c);
ViewData ["RecordCount"] = recordCount; ViewData ["RecordCount"] = recordCount;
ViewData ["PageIndex"] = pageIndex; ViewData ["PageIndex"] = pageIndex;
ViewData ["PageSize"] = pageSize; ViewData ["PageSize"] = pageSize;
return View (utc); return View ("Title", utc);
} }
/// <summary> /// <summary>
@ -100,27 +103,30 @@ namespace Yavsc.Controllers
/// <param name="pageIndex">Page index.</param> /// <param name="pageIndex">Page index.</param>
/// <param name="pageSize">Page size.</param> /// <param name="pageSize">Page size.</param>
[HttpGet] [HttpGet]
public ActionResult UserPosts (string id, int pageIndex = 0, int pageSize = 10) public ActionResult UserPosts (string user, string title=null, int pageIndex = 0, int pageSize = 10)
{ {
if (title != null) return UserPost (user, title, pageIndex, pageSize);
int recordcount=0; int recordcount=0;
MembershipUser u = Membership.GetUser (); MembershipUser u = Membership.GetUser ();
FindBlogEntryFlags sf = FindBlogEntryFlags.MatchUserName; FindBlogEntryFlags sf = FindBlogEntryFlags.MatchUserName;
ViewData ["SiteName"] = sitename; ViewData ["SiteName"] = sitename;
ViewData ["BlogUser"] = id; ViewData ["BlogUser"] = user;
string readersName = null; string readersName = null;
ViewData ["PageIndex"] = pageIndex; ViewData ["PageIndex"] = pageIndex;
ViewData ["pageSize"] = pageSize; ViewData ["pageSize"] = pageSize;
// displays invisible items when the logged user is also the author // displays invisible items when the logged user is also the author
if (u != null) { if (u != null) {
if (u.UserName == id || Roles.IsUserInRole ("Admin")) if (u.UserName == user || Roles.IsUserInRole ("Admin"))
sf |= FindBlogEntryFlags.MatchInvisible; sf |= FindBlogEntryFlags.MatchInvisible;
readersName = u.UserName; readersName = u.UserName;
if (user == null)
user = u.UserName;
} }
// find entries // find entries
BlogEntryCollection c = BlogEntryCollection c =
BlogManager.FindPost (readersName, id, sf, pageIndex, pageSize, out recordcount); BlogManager.FindPost (readersName, user, sf, pageIndex, pageSize, out recordcount);
// Get author's meta data // Get author's meta data
var pr = ProfileBase.Create (id); var pr = ProfileBase.Create (user);
if (pr != null) { if (pr != null) {
Profile bupr = new Profile (pr); Profile bupr = new Profile (pr);
ViewData ["BlogUserProfile"] = bupr; ViewData ["BlogUserProfile"] = bupr;
@ -130,7 +136,7 @@ namespace Yavsc.Controllers
ViewData ["Avatar"] = bupr.avatar; ViewData ["Avatar"] = bupr.avatar;
} }
ViewData ["RecordCount"] = recordcount; ViewData ["RecordCount"] = recordcount;
UUBlogEntryCollection uuc = new UUBlogEntryCollection (id, c); UUBlogEntryCollection uuc = new UUBlogEntryCollection (user, c);
return View ("UserPosts", uuc); return View ("UserPosts", uuc);
} }
@ -147,14 +153,14 @@ namespace Yavsc.Controllers
} }
/// <summary> /// <summary>
/// Returns the post. /// Gets the post.
/// </summary> /// </summary>
/// <returns>The post.</returns> /// <returns>The post.</returns>
/// <param name="id">Identifier.</param> /// <param name="postid">Postid.</param>
public ActionResult GetPost (long id) public ActionResult GetPost (long postid)
{ {
ViewData ["id"] = id; ViewData ["id"] = postid;
BlogEntry e = BlogManager.GetForReading (id); BlogEntry e = BlogManager.GetForReading (postid);
UUTBlogEntryCollection c = new UUTBlogEntryCollection (e.Author,e.Title); UUTBlogEntryCollection c = new UUTBlogEntryCollection (e.Author,e.Title);
c.Add (e); c.Add (e);
ViewData ["user"] = c.Author; ViewData ["user"] = c.Author;
@ -306,15 +312,15 @@ namespace Yavsc.Controllers
/// </summary> /// </summary>
/// <param name="id">Identifier.</param> /// <param name="id">Identifier.</param>
[Authorize] [Authorize]
public ActionResult Edit (long id) public ActionResult Edit (long postid)
{ {
BlogEntry e = BlogManager.GetForEditing (id); BlogEntry e = BlogManager.GetForEditing (postid);
string user = Membership.GetUser ().UserName; string user = Membership.GetUser ().UserName;
Profile pr = new Profile (ProfileBase.Create(e.Author)); Profile pr = new Profile (ProfileBase.Create(e.Author));
ViewData ["BlogTitle"] = pr.BlogTitle; ViewData ["BlogTitle"] = pr.BlogTitle;
ViewData ["LOGIN"] = user; ViewData ["LOGIN"] = user;
ViewData ["Id"] = id; ViewData ["Id"] = postid;
// Populates the circles combo items // Populates the circles combo items
if (e.AllowedCircles == null) if (e.AllowedCircles == null)
@ -356,21 +362,21 @@ namespace Yavsc.Controllers
/// <param name="returnUrl">Return URL.</param> /// <param name="returnUrl">Return URL.</param>
/// <param name="confirm">If set to <c>true</c> confirm.</param> /// <param name="confirm">If set to <c>true</c> confirm.</param>
[Authorize] [Authorize]
public ActionResult RemoveTitle (string id, string user, string returnUrl, bool confirm = false) public ActionResult RemoveTitle (string user, string title, string returnUrl, bool confirm = false)
{ {
if (returnUrl == null) if (returnUrl == null)
if (Request.UrlReferrer != null) if (Request.UrlReferrer != null)
returnUrl = Request.UrlReferrer.AbsoluteUri; returnUrl = Request.UrlReferrer.AbsoluteUri;
ViewData ["returnUrl"] = returnUrl; ViewData ["returnUrl"] = returnUrl;
ViewData ["Author"] = user; ViewData ["Author"] = user;
ViewData ["Title"] = id; ViewData ["Title"] = title;
if (Membership.GetUser ().UserName != user) if (Membership.GetUser ().UserName != user)
if (!Roles.IsUserInRole("Admin")) if (!Roles.IsUserInRole("Admin"))
throw new AuthorizationDenied (user); throw new AuthorizationDenied (user);
if (!confirm) if (!confirm)
return View ("RemoveTitle"); return View ("RemoveTitle");
BlogManager.RemoveTitle (user, id); BlogManager.RemoveTitle (user, title);
if (returnUrl == null) if (returnUrl == null)
RedirectToAction ("Index", new { user = user }); RedirectToAction ("Index", new { user = user });
return Redirect (returnUrl); return Redirect (returnUrl);
@ -384,19 +390,19 @@ namespace Yavsc.Controllers
/// <param name="returnUrl">Return URL.</param> /// <param name="returnUrl">Return URL.</param>
/// <param name="confirm">If set to <c>true</c> confirm.</param> /// <param name="confirm">If set to <c>true</c> confirm.</param>
[Authorize] [Authorize]
public ActionResult RemovePost (long id, string returnUrl, bool confirm = false) public ActionResult RemovePost (long postid, string returnUrl, bool confirm = false)
{ {
// ensures the access control // ensures the access control
BlogEntry e = BlogManager.GetForEditing (id); BlogEntry e = BlogManager.GetForEditing (postid);
if (e == null) if (e == null)
return new HttpNotFoundResult ("post id "+id.ToString()); return new HttpNotFoundResult ("post id "+postid.ToString());
ViewData ["id"] = id; ViewData ["id"] = postid;
ViewData ["returnUrl"] = string.IsNullOrWhiteSpace(returnUrl)? ViewData ["returnUrl"] = string.IsNullOrWhiteSpace(returnUrl)?
Request.UrlReferrer.AbsoluteUri.ToString(): returnUrl; Request.UrlReferrer.AbsoluteUri.ToString(): returnUrl;
// TODO: cleaner way to disallow deletion // TODO: cleaner way to disallow deletion
if (!confirm) if (!confirm)
return View ("RemovePost",e); return View ("RemovePost",e);
BlogManager.RemovePost (id); BlogManager.RemovePost (postid);
if (string.IsNullOrWhiteSpace(returnUrl)) if (string.IsNullOrWhiteSpace(returnUrl))
return RedirectToAction ("Index"); return RedirectToAction ("Index");
return Redirect (returnUrl); return Redirect (returnUrl);

View file

@ -106,7 +106,7 @@ namespace Yavsc.Controllers
AuthToken gat = oa.GetToken (Request, (string)Session ["state"], out msg); AuthToken gat = oa.GetToken (Request, (string)Session ["state"], out msg);
if (gat == null) { if (gat == null) {
YavscHelpers.Notice(ViewData, msg); YavscHelpers.Notify(ViewData, msg);
return View ("Auth"); return View ("Auth");
} }
SaveToken (gat); SaveToken (gat);
@ -143,7 +143,7 @@ namespace Yavsc.Controllers
OAuth2 oa = new OAuth2 (AuthGRU); OAuth2 oa = new OAuth2 (AuthGRU);
AuthToken gat = oa.GetToken (Request, (string)Session ["state"], out msg); AuthToken gat = oa.GetToken (Request, (string)Session ["state"], out msg);
if (gat == null) { if (gat == null) {
YavscHelpers.Notice(ViewData, msg); YavscHelpers.Notify(ViewData, msg);
return View (); return View ();
} }
string returnUrl = (string)Session ["returnUrl"]; string returnUrl = (string)Session ["returnUrl"];

View file

@ -121,7 +121,7 @@ namespace Yavsc.Controllers
using (System.Net.Mail.SmtpClient sc = new SmtpClient()) using (System.Net.Mail.SmtpClient sc = new SmtpClient())
{ {
sc.Send (msg); sc.Send (msg);
YavscHelpers.Notice(ViewData, LocalizedText.Message_sent); YavscHelpers.Notify(ViewData, LocalizedText.Message_sent);
return View (new { email=email, reason="", body="" }); return View (new { email=email, reason="", body="" });
} }
} }

View file

@ -47,17 +47,33 @@ namespace Yavsc
routes.IgnoreRoute ("favicon.png"); // favorite icon routes.IgnoreRoute ("favicon.png"); // favorite icon
routes.IgnoreRoute ("robots.txt"); // for search engine robots routes.IgnoreRoute ("robots.txt"); // for search engine robots
routes.MapRoute ( routes.MapRoute (
"View", "Titles",
"v/{title}", "t/{title}",
new { controller = "Blogs", action = "Index", new { controller = "Blogs", action = "Index",
title=UrlParameter.Optional } title=UrlParameter.Optional }
); );
routes.MapRoute ( routes.MapRoute (
"Blogs", "Blogs",
"b/{user}/{title}", "b/{user}",
new { controller = "Blogs",
action = "UserPosts",
user="Paul Schneider" }
);
routes.MapRoute (
"BlogByTitle",
"by/{user}/{title}/{id}",
new { controller = "Blogs",
action = "UserPosts",
user="Paul Schneider",
title=UrlParameter.Optional,
id=UrlParameter.Optional }
);
routes.MapRoute (
"BlogById",
"b/{action}/{postid}",
new { controller = "Blogs", action = "Index", new { controller = "Blogs", action = "Index",
user=UrlParameter.Optional, postid=UrlParameter.Optional }
title=UrlParameter.Optional }
); );
/* routes.MapRoute ( /* routes.MapRoute (
"Artistes", "Artistes",

View file

@ -13,6 +13,7 @@ using System.Web.UI;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Web.Profile; using System.Web.Profile;
using System.Web.Script.Serialization; using System.Web.Script.Serialization;
using System.Web.Mvc;
namespace Yavsc.Helpers namespace Yavsc.Helpers
{ {
@ -214,14 +215,22 @@ namespace Yavsc.Helpers
return serializer.Serialize(obj); return serializer.Serialize(obj);
} }
/// <summary> /// <summary>
/// Notice the specified ViewData with message. /// Notifies
/// </summary> /// </summary>
/// <param name="ViewData">View data.</param> /// <param name="ViewData">View data.</param>
/// <param name="message">Message.</param> /// <param name="message">Message.</param>
public static void Notice (System.Web.Mvc.ViewDataDictionary ViewData, string message) { public static void Notify (this HtmlHelper helper, string message) {
if (ViewData ["Notifications"] == null) Notify (helper.ViewData, message);
ViewData ["Notifications"] = new List<string> (); }
(ViewData ["Notifications"] as List<string>).Add (message.Replace("\'","\\\'")); /// <summary>
/// Notify the specified viewData and message.
/// </summary>
/// <param name="viewData">View data.</param>
/// <param name="message">Message.</param>
public static void Notify(ViewDataDictionary viewData, string message) {
if (viewData ["Notifications"] == null)
viewData ["Notifications"] = new List<string> ();
(viewData ["Notifications"] as List<string>).Add (message.Replace("\'","\\\'"));
} }
/// <summary> /// <summary>
/// Files the list. /// Files the list.
@ -279,6 +288,53 @@ namespace Yavsc.Helpers
return new System.Web.Mvc.MvcHtmlString (str.ToString ()); return new System.Web.Mvc.MvcHtmlString (str.ToString ());
} }
/// <summary>
/// Renders the page links.
/// </summary>
/// <returns>The page links.</returns>
/// <param name="helper">Helper.</param>
/// <param name="ResultCount">Result count.</param>
/// <param name="PageSize">Page size.</param>
/// <param name="PageIndex">Page index.</param>
public static IHtmlString RenderPageLinks (
this HtmlHelper helper,
int PageIndex, int PageSize, int ResultCount,
string args="?PageIndex={0}",
string pagesLabel="Pages: ", string singlePage="",
string none="néant"
)
{
StringWriter strwr = new StringWriter ();
HtmlTextWriter writer = new HtmlTextWriter(strwr);
if (ResultCount > 0 && ResultCount > PageSize ) {
int pageCount = ((ResultCount-1) / PageSize) + 1;
if ( pageCount > 1 ) {
writer.WriteEncodedText (pagesLabel);
for (int pi = (PageIndex < 5) ? 0 : PageIndex - 5; pi < pageCount && pi < PageIndex + 5; pi++) {
if (PageIndex == pi)
writer.RenderBeginTag ("b");
else {
writer.AddAttribute (HtmlTextWriterAttribute.Href,
string.Format (args, pi));
writer.RenderBeginTag ("a");
}
writer.Write (pi + 1);
writer.RenderEndTag ();
writer.Write ("&nbsp;");
}
}
else {
writer.Write (singlePage);
}
}
if (ResultCount == 0) {
writer.Write (none);
}
return new MvcHtmlString(strwr.ToString());
}
} }
} }

View file

@ -19,8 +19,9 @@
<script type="text/javascript"> <script type="text/javascript">
var apiBaseUrl = '<%=Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative)%>'; var apiBaseUrl = '<%=Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative)%>';
</script> </script>
<script src="<%=Url.Content("~/Scripts/yavsc.js")%>"></script> <script src="<%=Url.Content("~/Scripts/yavsc.js")%>">
<script src="<%=Url.Content("~/Scripts/yavsc.scrollnotif.js")%>"></script>
</script>
<asp:ContentPlaceHolder id="head" runat="server"> <asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder> </asp:ContentPlaceHolder>
</head> </head>
@ -29,34 +30,38 @@ var apiBaseUrl = '<%=Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative)%>';
<asp:ContentPlaceHolder ID="overHeaderOne" runat="server"> <asp:ContentPlaceHolder ID="overHeaderOne" runat="server">
<h1><a href="<%= Url.Content("~/") %>"> <h1><a href="<%= Url.Content("~/") %>">
<%=ViewState["orgtitle"]%></a> <%=ViewState["orgtitle"]%></a>
<span> - - <a href="<%= Url.Content("~/") %>"><%= YavscHelpers.SiteName %></a>
<a href="<%= Url.Content("~/") %>"><%= YavscHelpers.SiteName %></a> </h1>
</span></h1>
</asp:ContentPlaceHolder> </asp:ContentPlaceHolder>
<asp:ContentPlaceHolder ID="header" runat="server"></asp:ContentPlaceHolder> <asp:ContentPlaceHolder ID="header" runat="server"></asp:ContentPlaceHolder>
<div id="notifications"></div> <div id="notifications"></div>
<%if (ViewData ["Notifications"]!=null) { %>
<script> <script>
$(document).ready(function(){ $(document).ready(function(){
<%if (ViewData ["Notifications"]!=null) { %>
<% foreach (string notice in (IEnumerable<string>) ViewData ["Notifications"] ) { %> <% foreach (string notice in (IEnumerable<string>) ViewData ["Notifications"] ) { %>
Yavsc.notice('<%=notice%>'); Yavsc.notice('<%=notice%>');
<% } %> <% } %>
<% } %>
$body = $("body");
$(document).on({
ajaxStart: function() { $body.addClass("loading"); },
ajaxStop: function() { $body.removeClass("loading"); }
});
}); });
</script> </script>
<% } %>
</header> </header>
<nav data-type="background" data-speed="2"> <nav data-type="background" data-speed="2">
<% if (Membership.GetUser()==null) { %> <% if (Membership.GetUser()==null) { %>
<a href="<%= Url.Content("~/Account/Login/?returnUrl=") + Url.Encode( Request.Url.PathAndQuery )%>" class="menuitem" > <a href="<%= Url.RouteUrl("Default", new { controller = "Account", action = "Login", returnUrl=Request.Url.PathAndQuery}) %>" class="menuitem" accesskey = "C">
<i class="fa fa-sign-in">Connexion</i> <i class="fa fa-sign-in">Connexion</i>
</a> </a>
<% } else { %> <% } else { %>
<a href="<%=Url.Content("~/b/"+HttpContext.Current.User.Identity.Name)%>" accesskey = "B" class="menuitem" > <a href="<%=Url.RouteUrl("Blogs", new { user = HttpContext.Current.User.Identity.Name } )%>" accesskey = "B" class="menuitem" >
<img src="<%=Url.AvatarUrl(HttpContext.Current.User.Identity.Name)%>" alt="vos billets" class="iconsmall" /> <img src="<%=Url.AvatarUrl(HttpContext.Current.User.Identity.Name)%>" alt="vos billets" class="iconsmall" />
<span class="hint">Vos billets</span> <span class="hint">Vos billets</span>
</a> </a>
<a href="<%= Url.Content("~/Account/Profile/" + HttpContext.Current.User.Identity.Name) %>" accesskey="L" class="menuitem"> <a href="<%= Url.RouteUrl("Default", new { controller = "Account", action = "Profile", id = HttpContext.Current.User.Identity.Name} ) %>" accesskey="P" class="menuitem">
<i class="fa fa-user"><%= HttpContext.Current.User.Identity.Name %> <i class="fa fa-user"><%= HttpContext.Current.User.Identity.Name %>
<span class="hint"> &Eacute;dition de votre profile </span></i> <span class="hint"> &Eacute;dition de votre profile </span></i>
</a> </a>
@ -65,7 +70,7 @@ Yavsc.notice('<%=notice%>');
<span class="hint">&Eacute;dition d'un nouveau billet </span></i> <span class="hint">&Eacute;dition d'un nouveau billet </span></i>
</a> </a>
<a href="<%= Url.Content( "~/Account/Logout/?returnUrl=")+Url.Encode(Request.Url.PathAndQuery)%>" accesskey = "P" class="menuitem"> <a href="<%= Url.RouteUrl("Default", new { controller = "Account", action = "Logout", returnUrl=Request.Url.PathAndQuery}) %>" accesskey = "C" class="menuitem">
<i class="fa fa-sign-out">Deconnexion</i></a> <i class="fa fa-sign-out">Deconnexion</i></a>
<% } %> <% } %>
</nav> </nav>
@ -93,6 +98,6 @@ Yavsc.notice('<%=notice%>');
<div id="gspacer" class="control"><div class="g-plusone" data-annotation="inline" data-width="170"></div> <div id="gspacer" class="control"><div class="g-plusone" data-annotation="inline" data-width="170"></div>
</div> </div>
</div> </div>
</footer> </footer><div class="modal"></div>
</body> </body>
</html> </html>

View file

@ -0,0 +1,189 @@
// knockout-jqAutocomplete 0.4.3 | (c) 2015 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license
;(function(factory) {
if (typeof define === "function" && define.amd) {
// AMD anonymous module
define(["knockout", "jquery", "jquery-ui/autocomplete"], factory);
} else {
// No module loader - put directly in global namespace
factory(window.ko, jQuery);
}
})(function(ko, $) {
var JqAuto = function() {
var self = this,
unwrap = ko.utils.unwrapObservable; //support older KO versions that did not have ko.unwrap
//binding's init function
this.init = function(element, valueAccessor, allBindings, data, context) {
var existingSelect, existingChange,
options = unwrap(valueAccessor()),
config = {},
filter = typeof options.filter === "function" ? options.filter : self.defaultFilter;
//extend with global options
ko.utils.extend(config, self.options);
//override with options passed in binding
ko.utils.extend(config, options.options);
//get source from a function (can be remote call)
if (typeof options.source === "function" && !ko.isObservable(options.source)) {
config.source = function(request, response) {
//provide a wrapper to the normal response callback
var callback = function(data) {
self.processOptions(valueAccessor, null, data, request, response);
};
//call the provided function for retrieving data
options.source.call(context.$data, request.term, callback);
};
}
else {
//process local data
config.source = self.processOptions.bind(self, valueAccessor, filter, options.source);
}
//save any passed in select/change calls
existingSelect = typeof config.select === "function" && config.select;
existingChange = typeof config.change === "function" && config.change;
//handle updating the actual value
config.select = function(event, ui) {
if (ui.item && ui.item.actual) {
options.value(ui.item.actual);
if (ko.isWriteableObservable(options.dataValue)) {
options.dataValue(ui.item.data);
}
}
if (existingSelect) {
existingSelect.apply(this, arguments);
}
};
//user made a change without selecting a value from the list
config.change = function(event, ui) {
if (!ui.item || !ui.item.actual) {
options.value(event.target && event.target.value);
if (ko.isWriteableObservable(options.dataValue)) {
options.dataValue(null);
}
}
if (existingChange) {
existingChange.apply(this, arguments);
}
};
//initialize the widget
var widget = $(element).autocomplete(config).data("ui-autocomplete");
//render a template for the items
if (options.template) {
widget._renderItem = self.renderItem.bind(self, options.template, context);
}
//destroy the widget if KO removes the element
ko.utils.domNodeDisposal.addDisposeCallback(element, function() {
if (widget && typeof widget.destroy === "function") {
widget.destroy();
widget = null;
}
});
};
//the binding's update function. keep value in sync with model
this.update = function(element, valueAccessor) {
var propNames, sources,
options = unwrap(valueAccessor()),
value = unwrap(options && options.value);
if (!value && value !== 0) {
value = "";
}
// find the appropriate value for the input
sources = unwrap(options.source);
propNames = self.getPropertyNames(valueAccessor);
// if there is local data, then try to determine the appropriate value for the input
if ($.isArray(sources) && propNames.value) {
value = ko.utils.arrayFirst(sources, function (opt) {
return opt[propNames.value] == value;
}
) || value;
}
if (propNames.input && value && typeof value === "object") {
element.value = value[propNames.input];
}
else {
element.value = value;
}
};
//if dealing with local data, the default filtering function
this.defaultFilter = function(item, term) {
term = term && term.toLowerCase();
return (item || item === 0) && ko.toJSON(item).toLowerCase().indexOf(term) > -1;
};
//filter/map options to be in a format that autocomplete requires
this.processOptions = function(valueAccessor, filter, data, request, response) {
var item, index, length,
items = unwrap(data) || [],
results = [],
props = this.getPropertyNames(valueAccessor);
//filter/map items
for (index = 0, length = items.length; index < length; index++) {
item = items[index];
if (!filter || filter(item, request.term)) {
results.push({
label: props.label ? item[props.label] : item.toString(),
value: props.input ? item[props.input] : item.toString(),
actual: props.value ? item[props.value] : item,
data: item
});
}
}
//call autocomplete callback to display list
response(results);
};
//if specified, use a template to render an item
this.renderItem = function(templateName, context, ul, item) {
var $li = $("<li></li>").appendTo(ul),
itemContext = context.createChildContext(item.data);
//apply the template binding
ko.applyBindingsToNode($li[0], { template: templateName }, itemContext);
//clean up
$li.one("remove", ko.cleanNode.bind(ko, $li[0]));
return $li;
};
//retrieve the property names to use for the label, input, and value
this.getPropertyNames = function(valueAccessor) {
var options = ko.toJS(valueAccessor());
return {
label: options.labelProp || options.valueProp,
input: options.inputProp || options.labelProp || options.valueProp,
value: options.valueProp
};
};
//default global options passed into autocomplete widget
this.options = {
autoFocus: true,
delay: 50
};
};
ko.bindingHandlers.jqAuto = new JqAuto();
});

View file

@ -0,0 +1,2 @@
// knockout-jqAutocomplete 0.4.3 | (c) 2015 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license
!function(a){"function"==typeof define&&define.amd?define(["knockout","jquery","jquery-ui/autocomplete"],a):a(window.ko,jQuery)}(function(a,b){var c=function(){var c=this,d=a.utils.unwrapObservable;this.init=function(e,f,g,h,i){var j,k,l=d(f()),m={},n="function"==typeof l.filter?l.filter:c.defaultFilter;a.utils.extend(m,c.options),a.utils.extend(m,l.options),m.source="function"!=typeof l.source||a.isObservable(l.source)?c.processOptions.bind(c,f,n,l.source):function(a,b){var d=function(d){c.processOptions(f,null,d,a,b)};l.source.call(i.$data,a.term,d)},j="function"==typeof m.select&&m.select,k="function"==typeof m.change&&m.change,m.select=function(b,c){c.item&&c.item.actual&&(l.value(c.item.actual),a.isWriteableObservable(l.dataValue)&&l.dataValue(c.item.data)),j&&j.apply(this,arguments)},m.change=function(b,c){c.item&&c.item.actual||(l.value(b.target&&b.target.value),a.isWriteableObservable(l.dataValue)&&l.dataValue(null)),k&&k.apply(this,arguments)};var o=b(e).autocomplete(m).data("ui-autocomplete");l.template&&(o._renderItem=c.renderItem.bind(c,l.template,i)),a.utils.domNodeDisposal.addDisposeCallback(e,function(){o&&"function"==typeof o.destroy&&(o.destroy(),o=null)})},this.update=function(e,f){var g,h,i=d(f()),j=d(i&&i.value);j||0===j||(j=""),h=d(i.source),g=c.getPropertyNames(f),b.isArray(h)&&g.value&&(j=a.utils.arrayFirst(h,function(a){return a[g.value]==j})||j),e.value=g.input&&j&&"object"==typeof j?j[g.input]:j},this.defaultFilter=function(b,c){return c=c&&c.toLowerCase(),(b||0===b)&&a.toJSON(b).toLowerCase().indexOf(c)>-1},this.processOptions=function(a,b,c,e,f){var g,h,i,j=d(c)||[],k=[],l=this.getPropertyNames(a);for(h=0,i=j.length;i>h;h++)g=j[h],(!b||b(g,e.term))&&k.push({label:l.label?g[l.label]:g.toString(),value:l.input?g[l.input]:g.toString(),actual:l.value?g[l.value]:g,data:g});f(k)},this.renderItem=function(c,d,e,f){var g=b("<li></li>").appendTo(e),h=d.createChildContext(f.data);return a.applyBindingsToNode(g[0],{template:c},h),g.one("remove",a.cleanNode.bind(a,g[0])),g},this.getPropertyNames=function(b){var c=a.toJS(b());return{label:c.labelProp||c.valueProp,input:c.inputProp||c.labelProp||c.valueProp,value:c.valueProp}},this.options={autoFocus:!0,delay:50}};a.bindingHandlers.jqAuto=new c});

View file

@ -1,6 +1,13 @@
var Yavsc = (function(apiBaseUrl){ var Yavsc = (function(apiBaseUrl){
var self = {}; var self = {};
function dumpprops(obj) {
var str = "";
for(var k in obj)
if (obj.hasOwnProperty(k))
str += k + " = " + obj[k] + "\n";
return (str); }
self.apiBaseUrl = (apiBaseUrl || '/api'); self.apiBaseUrl = (apiBaseUrl || '/api');
self.showHide = function () { self.showHide = function () {
@ -33,8 +40,11 @@ self.notice = function (msg, msgok) {
self.onAjaxBadInput = function (data) self.onAjaxBadInput = function (data)
{ {
if (!data) { Yavsc.notice('no data'); return; }
if (!data.responseJSON) { Yavsc.notice('no json data:'+data); return; }
if (!Array.isArray(data.responseJSON)) { Yavsc.notice('Bad Input: '+data.responseJSON); return; }
$.each(data.responseJSON, function (key, value) { $.each(data.responseJSON, function (key, value) {
var errspanid = "Err_cr_" + value.key.replace("model.",""); var errspanid = "Err_" + value.key;
var errspan = document.getElementById(errspanid); var errspan = document.getElementById(errspanid);
if (errspan==null) if (errspan==null)
alert('enoent '+errspanid); alert('enoent '+errspanid);
@ -47,9 +57,24 @@ self.notice = function (msg, msgok) {
self.onAjaxError = function (xhr, ajaxOptions, thrownError) { self.onAjaxError = function (xhr, ajaxOptions, thrownError) {
if (xhr.status!=400) if (xhr.status!=400)
Yavsc.notice(xhr.status+" : "+xhr.responseText); Yavsc.notice(xhr.status+" : "+xhr.responseText);
else Yavsc.notice(false);
}; };
return self; return self;
})(); })();
$(document).ready(function(){
var $window = $(window);
$(window).scroll(function() {
var $ns = $('#notifications');
if ($ns.has('*').length>0) {
if ($window.scrollTop()>375) {
$ns.css('position','fixed');
$ns.css('z-index',2);
$ns.css('top',0);
}
else {
$ns.css('position','static');
$ns.css('z-index',1);
}}
});
});

View file

@ -25,25 +25,19 @@
<hr> <hr>
<script> <script>
function dumpprops(obj) {
var str = "";
for(var k in obj)
if (obj.hasOwnProperty(k))
str += k + " = " + obj[k] + "\n";
return (str); }
$(document).ready(function(){ $(document).ready(function(){
$('#hidesource').click(function(){ $('#hidesource').click(function(){
$('#source').addClass('hidden'); $('#source').addClass('hidden');
$('#viewsource').removeClass('hidden'); $('#viewsource').removeClass('hidden');
$('#hidesource').addClass('hidden'); $('#hidesource').addClass('hidden');
}); });
$('#viewsource').click(function(){ $('#viewsource').click(function(){
$('#source').removeClass('hidden'); $('#source').removeClass('hidden');
$('#viewsource').addClass('hidden'); $('#viewsource').addClass('hidden');
$('#hidesource').removeClass('hidden'); $('#hidesource').removeClass('hidden');
}); });
jQuery('.placard').hallo({plugins: {'hallo-image-insert-edit': { lang: 'fr' } } }); jQuery('.placard').hallo({plugins: {'hallo-image-insert-edit': { lang: 'fr' } } });

View file

@ -4,7 +4,7 @@
<div> <div>
<% foreach (var g in Model.GroupByTitle()) { %> <% foreach (var g in Model.GroupByTitle()) { %>
<h2><%=Html.ActionLink(g.Key, "Title", "Blogs", new { id = g.Key } , new { @class="userref" } )%></h2> <h2><a href="<%= Url.RouteUrl("Titles", new { title = g.Key }) %>" class="usertitleref"><%=Html.Encode(g.Key)%></a></h2>
<% foreach (var p in g) { %> <% foreach (var p in g) { %>
<div class="postpreview"> <div class="postpreview">
<p><%= Html.Markdown(p.Intro,"/bfiles/"+p.Id+"/") %></p> <p><%= Html.Markdown(p.Intro,"/bfiles/"+p.Id+"/") %></p>
@ -12,16 +12,5 @@
</div> <% } %> </div> <% } %>
<% } %> <% } %>
</div> </div>
<form runat="server" id="form1" method="GET"> <%= Html.RenderPageLinks((int)ViewData["PageIndex"],(int)ViewData["PageSize"],(int)ViewData["ResultCount"])%>
<%
rp1.ResultCount = (int) ViewData["ResultCount"];
rp1.PageSize = (int) ViewData ["PageSize"];
rp1.PageIndex = (int) ViewData["PageIndex"];
rp1.None = Html.Translate("no content");
%>
<yavsc:ResultPages id="rp1" runat="server" >
<None>Aucun résultat</None>
</yavsc:ResultPages>
</form>
</asp:Content> </asp:Content>

View file

@ -0,0 +1,8 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%= (int) ViewData["ResultCount"] %>
rp1.PageSize = (int) ViewData ["PageSize"];
rp1.PageIndex = (int) ViewData["PageIndex"];
rp1.None = Html.Translate("no content");

View file

@ -1,15 +1,15 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BasePost>" %> <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BasePost>" %>
<aside> <aside>
(<%= Model.Posted.ToString("yyyy/MM/dd") %> (<%= Model.Posted.ToString("D") %>
- <%= Model.Modified.ToString("yyyy/MM/dd") %> <%= Model.Visible? "":", Invisible!" %>) - <%= Model.Modified.ToString("D") %> <%= Model.Visible? "":", Invisible!" %>)
<% if (Membership.GetUser()!=null) { <% if (Membership.GetUser()!=null) {
if (Membership.GetUser().UserName==Model.Author || Roles.IsUserInRole("Admin")) if (Membership.GetUser().UserName==Model.Author || Roles.IsUserInRole("Admin"))
{ %> { %>
<i class="fa fa-tag"><%=Html.Translate("DoTag")%></i> <% if (Model is BlogEntry) { %><%= Html.Partial("TagControl",Model)%><% } %>
<a href="<%= Url.RouteUrl("Default", new { action = "Edit", controller = "Blogs", id = Model.Id })%>" class="actionlink"> <a href="<%= Url.RouteUrl("BlogById", new { action = "Edit", postid = Model.Id })%>" class="actionlink">
<i class="fa fa-pencil"><%=Html.Translate("Edit")%></i> <i class="fa fa-pencil"><%=Html.Translate("Edit")%></i>
</a> </a>
<a href="<%= Url.RouteUrl("Default", new { action = "RemovePost", controller = "Blogs", id = Model.Id })%>" class="actionlink"> <a href="<%= Url.RouteUrl("BlogById", new { action = "RemovePost", postid = Model.Id })%>" class="actionlink">
<i class="fa fa-remove"><%=Html.Translate("Remove")%></i></a> <i class="fa fa-remove"><%=Html.Translate("Remove")%></i></a>
<% }} %> <% }} %>
</aside> </aside>

View file

@ -0,0 +1,97 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BlogEntry>" %>
<ul id="tags">
<% if (Model.Tags != null) foreach (string tagname in Model.Tags) { %>
<li><%= tagname %></li>
<% } %>
</ul>
<% if (Membership.GetUser()!=null) { %>
<% if (Membership.GetUser().UserName==Model.Author || Roles.IsUserInRole("Admin"))
{ // grant all permissions: to choose a given set of tags, also create some new tags %>
<span id="viewtagger">
<i class="fa fa-tag menuitem" id="viewtaggerbtn"><%=Html.Translate("DoTag")%></i></span>
<span id="hidetagger" class="hidden">
<i class="fa fa-tag menuitem" id="hidetaggerbtn" ><%=Html.Translate("Hide")%></i>
Note: Ils sont utilisé pour classifier le document. Par exemple, le tag <code>Accueil</code> rend le document
éligible à une place en page d'Accueil.
</span>
<form id="tagger" class="hidden">
<fieldset>
<legend>Associer des tags au billet</legend>
<label for="newtag"><%= Html.Translate("Tag_name")%>: </label>
<span id="Err_tag" class="error"></span>
<input type="text" id="newtag">
<span id="Err_model" class="error"></span>
<input id="sendnewtag" type="submit" class="fa fa-tag" value="<%=Html.Translate("Submit")%>">
</fieldset>
</form>
<script>
$(document).ready(function(){
$('#hidetaggerbtn').click(function(){
$('#tagger').addClass('hidden');
$('#viewtagger').removeClass('hidden');
$('#hidetagger').addClass('hidden');
});
$('#viewtaggerbtn').click(function(){
$('#tagger').removeClass('hidden');
$('#viewtagger').addClass('hidden');
$('#hidetagger').removeClass('hidden');
});
$('#newtag').autocomplete({
minLength: 0,
delay: 200,
source: function( request, response ) {
$.ajax({
url: "/api/Blogs/Tags",
type: "POST",
data: {
pattern: request.term
},
success: function( data ) {
response( data );
}
});
},
select: function( event, ui ) {
console.log( ui.item ?
"Selected: " + ui.item.label :
"Nothing selected, input was " + this.value);
},
open: function() {
$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
},
close: function() {
$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
}
});
$('#tagger').on('submit', function(e) { e.preventDefault(); });
$('#sendnewtag').click(function(){
var data = {
postid: <%= Model.Id %>,
tag: $('#newtag').val()
}
$.ajax({
url: '/api/Blogs/Tag/',
type: 'POST',
data: data,
success: function() {
$('<li>'+data.tag+'</li>').appendTo('#tags');
$('#newtag').val('');
},
statusCode: {
400: Yavsc.onAjaxBadInput
},
error: Yavsc.onAjaxError
});
});
});
</script>
<% } %>
<% } %>

View file

@ -6,8 +6,8 @@
<asp:Content ContentPlaceHolderID="overHeaderOne" ID="header1" runat="server"> <asp:Content ContentPlaceHolderID="overHeaderOne" ID="header1" runat="server">
<h1 class="post"> <h1 class="post">
<%=Html.ActionLink(Model.Title, "Title", new{id=Model.Title}, null)%> <%=Html.ActionLink(Model.Title, "Title", new{title=Model.Title}, null)%>
- <a href="<%= Url.Content("~/") %>"><%= YavscHelpers.SiteName %></a> - <a href="<%= Url.RouteUrl("Default") %>"><%= YavscHelpers.SiteName %></a>
</h1> </h1>
</asp:Content> </asp:Content>

View file

@ -30,7 +30,8 @@
<% string username = Membership.GetUser()==null ? null : Membership.GetUser().UserName; %> <% string username = Membership.GetUser()==null ? null : Membership.GetUser().UserName; %>
<% foreach (var c in (Comment[]) BlogManager.GetComments(be.Id)) { %> <% foreach (var c in (Comment[]) BlogManager.GetComments(be.Id)) { %>
<div class="comment" style="min-height:32px;"> <img style="clear:left;float:left;max-width:32px;max-height:32px;margin:.3em;" src="<%= Url.Content("~/Account/Avatar/"+c.From) %>" alt="<%=c.From%>"/> <div class="comment" style="min-height:32px;">
<img style="clear:left;float:left;max-width:32px;max-height:32px;margin:.3em;" src="<%= Url.RouteUrl("Blogs", new { user = c.From } ) %>" alt="<%=c.From%>"/>
<%= Html.Markdown(c.CommentText) %> <%= Html.Markdown(c.CommentText) %>
<% if (Model.Author == username || c.From == username ) { %> <% if (Model.Author == username || c.From == username ) { %>
<%= Html.ActionLink("Supprimer","RemoveComment", new { cmtid = c.Id } , new { @class="actionlink" })%> <%= Html.ActionLink("Supprimer","RemoveComment", new { cmtid = c.Id } , new { @class="actionlink" })%>

View file

@ -7,25 +7,26 @@
<asp:Content ContentPlaceHolderID="overHeaderOne" ID="header1" runat="server"> <asp:Content ContentPlaceHolderID="overHeaderOne" ID="header1" runat="server">
<% if (!string.IsNullOrEmpty((string)ViewData["Avatar"])) { %> <% if (!string.IsNullOrEmpty((string)ViewData["Avatar"])) { %>
<a href="<%=Url.Content("~/Blog/"+Model.Author)%>" id="avatar"> <a href="<%=Url.RouteUrl( "Blogs", new { user = Model.Author } )%>" id="avatar">
<img src="<%=ViewData["Avatar"]%>" /> <img src="<%=ViewData["Avatar"]%>" />
</a> </a>
<% } %> <% } %>
<h1 class="blogtitle"> <h1 class="blogtitle">
<a href="<%=Url.Content("~/Blog/"+Model.Author)%>"> <a href="<%=Url.RouteUrl( "Blogs", new { user = Model.Author } )%>">
<%=Html.Encode(ViewData["BlogTitle"])%></a> <%=Html.Encode(ViewData["BlogTitle"])%></a>
- <a href="<%= Url.Content("~/") %>"><%= YavscHelpers.SiteName %></a> - <a href="<%= Url.RouteUrl( "Default") %>"><%= YavscHelpers.SiteName %></a>
</h1> </h1>
</asp:Content> </asp:Content>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server"> <asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<% foreach (BlogEntry e in this.Model) { %> <% foreach (BlogEntry e in this.Model) { %>
<div class="postpreview<% if (!e.Visible) { %> hiddenpost<% } %>" > <div class="postpreview<% if (!e.Visible) { %> hiddenpost<% } %>" >
<h2><%= Html.ActionLink(e.Title,"UserPost", new { user=e.Author, title=e.Title, id = e.Id }, new { @class = "usertitleref" }) %></h2> <h2><a href="<%= Url.RouteUrl("BlogByTitle", new { user=e.Author, title=e.Title, id = e.Id })%>" class="usertitleref">
<%=Html.Markdown(e.Title)%></a></h2>
<% bool truncated = false; %> <% bool truncated = false; %>
<%= Html.MarkdownToHtmlIntro(out truncated, e.Content,"/bfiles/"+e.Id+"/") %> <%= Html.MarkdownToHtmlIntro(out truncated, e.Content,"/bfiles/"+e.Id+"/") %>
<% if (truncated) { %> <% if (truncated) { %>
<a href="<%= Url.RouteUrl( "View", new { action="Title", title=e.Title}) %>"> <a href="<%= Url.RouteUrl( "BlogByTitle", new { user=e.Author , title=e.Title, id = e.Id}) %>">
<i>Html.Translate("ReadMore")</i></a> <i>Html.Translate("ReadMore")</i></a>
<% } %> <% } %>
<%= Html.Partial("PostActions",e)%> <%= Html.Partial("PostActions",e)%>

View file

@ -3,9 +3,6 @@
<asp:Content ContentPlaceHolderID="head" ID="head1" runat="server" > <asp:Content ContentPlaceHolderID="head" ID="head1" runat="server" >
<script type="text/javascript" src="<%=Url.Content("~/Scripts/stupidtable.js")%>"></script> <script type="text/javascript" src="<%=Url.Content("~/Scripts/stupidtable.js")%>"></script>
<script> <script>
$(function(){
$("#tbwrts").stupidtable();
});
</script> </script>
</asp:Content> </asp:Content>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server"> <asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
@ -352,6 +349,9 @@ function addRow(){
$("#wr_Count").val(1); $("#wr_Count").val(1);
$("#wr_UnitaryCost").val(0); $("#wr_UnitaryCost").val(0);
}); });
$("#tbwrts").stupidtable();
}); });
</script> </script>

View file

@ -142,7 +142,6 @@
<Folder Include="fonts\" /> <Folder Include="fonts\" />
<Folder Include="lib\" /> <Folder Include="lib\" />
<Folder Include="App_Data\" /> <Folder Include="App_Data\" />
<Folder Include="Test\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Controllers\HomeController.cs" /> <Compile Include="Controllers\HomeController.cs" />
@ -190,7 +189,6 @@
<Compile Include="Formatters\EstimToPdfFormatter.MSAN.cs" /> <Compile Include="Formatters\EstimToPdfFormatter.MSAN.cs" />
<Compile Include="Helpers\TemplateException.cs" /> <Compile Include="Helpers\TemplateException.cs" />
<Compile Include="Formatters\FormatterException.cs" /> <Compile Include="Formatters\FormatterException.cs" />
<Compile Include="NUnitTestClass.cs" />
<Compile Include="TestExec.cs" /> <Compile Include="TestExec.cs" />
<Compile Include="ApiControllers\WorkFlowController.cs" /> <Compile Include="ApiControllers\WorkFlowController.cs" />
<Compile Include="ApiControllers\BasketController.cs" /> <Compile Include="ApiControllers\BasketController.cs" />
@ -432,7 +430,10 @@
<Content Include="Views\Blogs\Title.aspx" /> <Content Include="Views\Blogs\Title.aspx" />
<Content Include="Views\Blogs\PostActions.ascx" /> <Content Include="Views\Blogs\PostActions.ascx" />
<Content Include="Scripts\yavsc.tags.js" /> <Content Include="Scripts\yavsc.tags.js" />
<Content Include="Scripts\yavsc.scrollnotif.js" /> <Content Include="Views\Blogs\TagControl.ascx" />
<Content Include="Scripts\knockout-jqAutocomplete.js" />
<Content Include="Scripts\knockout-jqAutocomplete.min.js" />
<Content Include="Views\Blogs\PageLinks.ascx" />
</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" />

View file

@ -30,6 +30,8 @@ using System.ComponentModel.DataAnnotations;
namespace Yavsc.Model.Blogs namespace Yavsc.Model.Blogs
{ {
/// <summary> /// <summary>
/// Base post. /// Base post.
/// </summary> /// </summary>
@ -52,6 +54,9 @@ namespace Yavsc.Model.Blogs
id = value; id = value;
} }
} }
/// <summary> /// <summary>
/// The posted. /// The posted.
/// </summary> /// </summary>
@ -125,13 +130,21 @@ namespace Yavsc.Model.Blogs
} }
} }
/// <summary>
/// Gets or sets the photo.
/// </summary>
/// <value>The photo.</value>
public string Photo {
get;
set;
}
/// <summary> /// <summary>
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.Blogs.BlogEntry"/> is visible. /// Gets or sets a value indicating whether this <see cref="Yavsc.Model.Blogs.BlogEntry"/> is visible.
/// </summary> /// </summary>
/// <value><c>true</c> if visible; otherwise, <c>false</c>.</value> /// <value><c>true</c> if visible; otherwise, <c>false</c>.</value>
public bool Visible { get; set ; } public bool Visible { get; set ; }
} }
} }

View file

@ -12,16 +12,20 @@ namespace Yavsc.Model.Blogs
/// </summary> /// </summary>
public class BlogEntry : BasePost { public class BlogEntry : BasePost {
/// <summary> /// <summary>
/// Gets or sets the photo. /// Gets or sets the circles allowed to read this ticket.
/// An empty collection specifies a public post.
/// </summary> /// </summary>
/// <value>The photo.</value> /// <value>The circles.</value>
public string Photo { [Display(Name="Cercles autorisés")]
get; public long[] AllowedCircles { get; set; }
set;
}
/// <summary>
/// Gets or sets the tags.
/// </summary>
/// <value>The tags.</value>
public string [] Tags { get; set ; }
string content; string content;
@ -40,21 +44,6 @@ namespace Yavsc.Model.Blogs
} }
} }
/// <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 ; }
} }
} }

View file

@ -122,7 +122,11 @@ namespace Yavsc.Model.Blogs
orderby be.Posted descending orderby be.Posted descending
group group
new PostInfoByTitle { Author=be.Author, Id=be.Id, new PostInfoByTitle { Author=be.Author, Id=be.Id,
Posted=be.Posted, Modified=be.Modified, Intro = MarkdownHelper.MarkdownIntro(be.Content, out truncated) } Posted=be.Posted, Modified=be.Modified,
Intro = MarkdownHelper.MarkdownIntro(be.Content, out truncated),
Visible = be.Visible,
Photo = be.Photo
}
by be.Title by be.Title
into titlegroup into titlegroup
select titlegroup; select titlegroup;
@ -137,8 +141,15 @@ namespace Yavsc.Model.Blogs
return from be in this return from be in this
orderby be.Posted descending orderby be.Posted descending
group group
new PostInfoByUser { Title=be.Title, Id=be.Id, new PostInfoByUser {
Posted=be.Posted, Modified=be.Modified, Intro = MarkdownHelper.MarkdownIntro(be.Content, out truncated) } Title=be.Title,
Id=be.Id,
Posted=be.Posted,
Modified=be.Modified,
Intro = MarkdownHelper.MarkdownIntro(be.Content, out truncated) ,
Photo = be.Photo,
Visible = be.Visible
}
by be.Author by be.Author
into usergroup into usergroup
select usergroup; select usergroup;

View file

@ -0,0 +1,45 @@
//
// PostTag.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Configuration;
using System.Collections.Generic;
using Yavsc.Model.Blogs;
using System.Linq;
using Yavsc.Model.Circles;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Model.Blogs
{
public class PostTag {
public long PostId { get; set; }
[StringLength(512)]
[RegularExpression(@"^[a-zA-Z0-9 ]+$",ErrorMessage = "Un tag n'est composé que de lettres et de chiffres, les espaces" +
"sont autorisés")]
[Required(ErrorMessage = "S'il vous plait, saisissez nom de tag")]
public string Tag { get; set; }
}
}

View file

@ -1,3 +1,16 @@
2015-10-17 Paul Schneider <paul@pschneider.fr>
* PostTag.cs:
* BasePost.cs:
* YavscModel.csproj:
* BlogEntry.cs:
* LocalizedText.resx:
* Automate.cs:
* LocalizedText.fr.resx:
* LocalizedText.Designer.cs:
* BlogEntryCollection.cs:
* LocalizedText.fr.Designer.cs:
2015-10-13 Paul Schneider <paul@pschneider.fr> 2015-10-13 Paul Schneider <paul@pschneider.fr>
* BasePost.cs: refactoring: * BasePost.cs: refactoring:

View file

@ -46,81 +46,27 @@ namespace Yavsc.Model {
} }
} }
public static string was_added_to_the_empty_role { public static string EventWebPage {
get { get {
return ResourceManager.GetString("was_added_to_the_empty_role", resourceCulture); return ResourceManager.GetString("EventWebPage", resourceCulture);
} }
} }
public static string Bill_edition { public static string ProviderId {
get { get {
return ResourceManager.GetString("Bill_edition", resourceCulture); return ResourceManager.GetString("ProviderId", resourceCulture);
} }
} }
public static string Tex_version { public static string Pdf_version {
get { get {
return ResourceManager.GetString("Tex_version", resourceCulture); return ResourceManager.GetString("Pdf_version", resourceCulture);
} }
} }
public static string Message_sent { public static string Circles {
get { get {
return ResourceManager.GetString("Message_sent", resourceCulture); return ResourceManager.GetString("Circles", resourceCulture);
}
}
public static string Count {
get {
return ResourceManager.GetString("Count", resourceCulture);
}
}
public static string Create {
get {
return ResourceManager.GetString("Create", resourceCulture);
}
}
public static string Description {
get {
return ResourceManager.GetString("Description", resourceCulture);
}
}
public static string Profile_edition {
get {
return ResourceManager.GetString("Profile_edition", resourceCulture);
}
}
public static string Title {
get {
return ResourceManager.GetString("Title", resourceCulture);
}
}
public static string My_Estimates {
get {
return ResourceManager.GetString("My_Estimates", resourceCulture);
}
}
public static string Google_error {
get {
return ResourceManager.GetString("Google_error", resourceCulture);
}
}
public static string StartDate {
get {
return ResourceManager.GetString("StartDate", resourceCulture);
}
}
public static string no_content {
get {
return ResourceManager.GetString("no_content", resourceCulture);
} }
} }
@ -130,27 +76,21 @@ namespace Yavsc.Model {
} }
} }
public static string Ciffer { public static string Preview {
get { get {
return ResourceManager.GetString("Ciffer", resourceCulture); return ResourceManager.GetString("Preview", resourceCulture);
} }
} }
public static string Modify { public static string DisplayName {
get { get {
return ResourceManager.GetString("Modify", resourceCulture); return ResourceManager.GetString("DisplayName", resourceCulture);
} }
} }
public static string MaxDate { public static string none {
get { get {
return ResourceManager.GetString("MaxDate", resourceCulture); return ResourceManager.GetString("none", resourceCulture);
}
}
public static string younotadmin {
get {
return ResourceManager.GetString("younotadmin", resourceCulture);
} }
} }
@ -160,9 +100,27 @@ namespace Yavsc.Model {
} }
} }
public static string Date_search { public static string Not_Approuved {
get { get {
return ResourceManager.GetString("Date_search", resourceCulture); return ResourceManager.GetString("Not_Approuved", resourceCulture);
}
}
public static string User_name {
get {
return ResourceManager.GetString("User_name", resourceCulture);
}
}
public static string Estimate_not_found {
get {
return ResourceManager.GetString("Estimate_not_found", resourceCulture);
}
}
public static string was_added_to_the_empty_role {
get {
return ResourceManager.GetString("was_added_to_the_empty_role", resourceCulture);
} }
} }
@ -172,42 +130,96 @@ namespace Yavsc.Model {
} }
} }
public static string Google_calendar {
get {
return ResourceManager.GetString("Google_calendar", resourceCulture);
}
}
public static string Welcome {
get {
return ResourceManager.GetString("Welcome", resourceCulture);
}
}
public static string Private_circle {
get {
return ResourceManager.GetString("Private_circle", resourceCulture);
}
}
public static string ImportException { public static string ImportException {
get { get {
return ResourceManager.GetString("ImportException", resourceCulture); return ResourceManager.GetString("ImportException", resourceCulture);
} }
} }
public static string Preview {
get {
return ResourceManager.GetString("Preview", resourceCulture);
}
}
public static string Register {
get {
return ResourceManager.GetString("Register", resourceCulture);
}
}
public static string View_source {
get {
return ResourceManager.GetString("View_source", resourceCulture);
}
}
public static string Hide_source {
get {
return ResourceManager.GetString("Hide_source", resourceCulture);
}
}
public static string access_denied { public static string access_denied {
get { get {
return ResourceManager.GetString("access_denied", resourceCulture); return ResourceManager.GetString("access_denied", resourceCulture);
} }
} }
public static string Ciffer {
get {
return ResourceManager.GetString("Ciffer", resourceCulture);
}
}
public static string Create {
get {
return ResourceManager.GetString("Create", resourceCulture);
}
}
public static string Submit {
get {
return ResourceManager.GetString("Submit", resourceCulture);
}
}
public static string ImgLocator {
get {
return ResourceManager.GetString("ImgLocator", resourceCulture);
}
}
public static string entries {
get {
return ResourceManager.GetString("entries", resourceCulture);
}
}
public static string Description {
get {
return ResourceManager.GetString("Description", resourceCulture);
}
}
public static string Google_error {
get {
return ResourceManager.GetString("Google_error", resourceCulture);
}
}
public static string Comment {
get {
return ResourceManager.GetString("Comment", resourceCulture);
}
}
public static string Tex_version {
get {
return ResourceManager.GetString("Tex_version", resourceCulture);
}
}
public static string Item_added_to_basket {
get {
return ResourceManager.GetString("Item_added_to_basket", resourceCulture);
}
}
public static string DuplicateUserName { public static string DuplicateUserName {
get { get {
return ResourceManager.GetString("DuplicateUserName", resourceCulture); return ResourceManager.GetString("DuplicateUserName", resourceCulture);
@ -220,69 +232,21 @@ namespace Yavsc.Model {
} }
} }
public static string EndDate { public static string Hide {
get { get {
return ResourceManager.GetString("EndDate", resourceCulture); return ResourceManager.GetString("Hide", resourceCulture);
} }
} }
public static string Google_calendar { public static string Register {
get { get {
return ResourceManager.GetString("Google_calendar", resourceCulture); return ResourceManager.GetString("Register", resourceCulture);
} }
} }
public static string Consultant { public static string younotadmin {
get { get {
return ResourceManager.GetString("Consultant", resourceCulture); return ResourceManager.GetString("younotadmin", resourceCulture);
}
}
public static string EventWebPage {
get {
return ResourceManager.GetString("EventWebPage", resourceCulture);
}
}
public static string ImgLocator {
get {
return ResourceManager.GetString("ImgLocator", resourceCulture);
}
}
public static string DoTag {
get {
return ResourceManager.GetString("DoTag", resourceCulture);
}
}
public static string Not_Approuved {
get {
return ResourceManager.GetString("Not_Approuved", resourceCulture);
}
}
public static string Private_circle {
get {
return ResourceManager.GetString("Private_circle", resourceCulture);
}
}
public static string DocTemplateException {
get {
return ResourceManager.GetString("DocTemplateException", resourceCulture);
}
}
public static string Unitary_cost {
get {
return ResourceManager.GetString("Unitary_cost", resourceCulture);
}
}
public static string Circles {
get {
return ResourceManager.GetString("Circles", resourceCulture);
} }
} }
@ -292,9 +256,15 @@ namespace Yavsc.Model {
} }
} }
public static string Remember_me { public static string New_Tag {
get { get {
return ResourceManager.GetString("Remember_me", resourceCulture); return ResourceManager.GetString("New_Tag", resourceCulture);
}
}
public static string Modify {
get {
return ResourceManager.GetString("Modify", resourceCulture);
} }
} }
@ -304,45 +274,21 @@ namespace Yavsc.Model {
} }
} }
public static string none { public static string Title {
get { get {
return ResourceManager.GetString("none", resourceCulture); return ResourceManager.GetString("Title", resourceCulture);
} }
} }
public static string User_List { public static string Tag_name {
get { get {
return ResourceManager.GetString("User_List", resourceCulture); return ResourceManager.GetString("Tag_name", resourceCulture);
} }
} }
public static string Estimate_not_found { public static string Message_sent {
get { get {
return ResourceManager.GetString("Estimate_not_found", resourceCulture); return ResourceManager.GetString("Message_sent", resourceCulture);
}
}
public static string ProviderId {
get {
return ResourceManager.GetString("ProviderId", resourceCulture);
}
}
public static string Welcome {
get {
return ResourceManager.GetString("Welcome", resourceCulture);
}
}
public static string Online {
get {
return ResourceManager.GetString("Online", resourceCulture);
}
}
public static string Home {
get {
return ResourceManager.GetString("Home", resourceCulture);
} }
} }
@ -352,57 +298,9 @@ namespace Yavsc.Model {
} }
} }
public static string MinDate { public static string Bill_edition {
get { get {
return ResourceManager.GetString("MinDate", resourceCulture); return ResourceManager.GetString("Bill_edition", resourceCulture);
}
}
public static string Comment {
get {
return ResourceManager.GetString("Comment", resourceCulture);
}
}
public static string User_name {
get {
return ResourceManager.GetString("User_name", resourceCulture);
}
}
public static string DisplayName {
get {
return ResourceManager.GetString("DisplayName", resourceCulture);
}
}
public static string Pdf_version {
get {
return ResourceManager.GetString("Pdf_version", resourceCulture);
}
}
public static string ReadMore {
get {
return ResourceManager.GetString("ReadMore", resourceCulture);
}
}
public static string Item_added_to_basket {
get {
return ResourceManager.GetString("Item_added_to_basket", resourceCulture);
}
}
public static string role_created {
get {
return ResourceManager.GetString("role_created", resourceCulture);
}
}
public static string Edit {
get {
return ResourceManager.GetString("Edit", resourceCulture);
} }
} }
@ -412,9 +310,81 @@ namespace Yavsc.Model {
} }
} }
public static string entries { public static string MaxDate {
get { get {
return ResourceManager.GetString("entries", resourceCulture); return ResourceManager.GetString("MaxDate", resourceCulture);
}
}
public static string Count {
get {
return ResourceManager.GetString("Count", resourceCulture);
}
}
public static string Edit {
get {
return ResourceManager.GetString("Edit", resourceCulture);
}
}
public static string Date_search {
get {
return ResourceManager.GetString("Date_search", resourceCulture);
}
}
public static string View_source {
get {
return ResourceManager.GetString("View_source", resourceCulture);
}
}
public static string role_created {
get {
return ResourceManager.GetString("role_created", resourceCulture);
}
}
public static string ReadMore {
get {
return ResourceManager.GetString("ReadMore", resourceCulture);
}
}
public static string EndDate {
get {
return ResourceManager.GetString("EndDate", resourceCulture);
}
}
public static string MinDate {
get {
return ResourceManager.GetString("MinDate", resourceCulture);
}
}
public static string User_List {
get {
return ResourceManager.GetString("User_List", resourceCulture);
}
}
public static string Remember_me {
get {
return ResourceManager.GetString("Remember_me", resourceCulture);
}
}
public static string Home {
get {
return ResourceManager.GetString("Home", resourceCulture);
}
}
public static string Consultant {
get {
return ResourceManager.GetString("Consultant", resourceCulture);
} }
} }
@ -423,5 +393,59 @@ namespace Yavsc.Model {
return ResourceManager.GetString("was_added_to_the_role", resourceCulture); return ResourceManager.GetString("was_added_to_the_role", resourceCulture);
} }
} }
public static string DoTag {
get {
return ResourceManager.GetString("DoTag", resourceCulture);
}
}
public static string DocTemplateException {
get {
return ResourceManager.GetString("DocTemplateException", resourceCulture);
}
}
public static string no_content {
get {
return ResourceManager.GetString("no_content", resourceCulture);
}
}
public static string Unitary_cost {
get {
return ResourceManager.GetString("Unitary_cost", resourceCulture);
}
}
public static string Online {
get {
return ResourceManager.GetString("Online", resourceCulture);
}
}
public static string StartDate {
get {
return ResourceManager.GetString("StartDate", resourceCulture);
}
}
public static string Hide_source {
get {
return ResourceManager.GetString("Hide_source", resourceCulture);
}
}
public static string Profile_edition {
get {
return ResourceManager.GetString("Profile_edition", resourceCulture);
}
}
public static string My_Estimates {
get {
return ResourceManager.GetString("My_Estimates", resourceCulture);
}
}
} }
} }

View file

@ -148,9 +148,9 @@ namespace Yavsc.Model {
} }
} }
public static string younotadmin { public static string New_Tag {
get { get {
return ResourceManager.GetString("younotadmin", resourceCulture); return ResourceManager.GetString("New_Tag", resourceCulture);
} }
} }
@ -250,6 +250,12 @@ namespace Yavsc.Model {
} }
} }
public static string Submit {
get {
return ResourceManager.GetString("Submit", resourceCulture);
}
}
public static string Not_Approuved { public static string Not_Approuved {
get { get {
return ResourceManager.GetString("Not Approuved", resourceCulture); return ResourceManager.GetString("Not Approuved", resourceCulture);
@ -286,6 +292,12 @@ namespace Yavsc.Model {
} }
} }
public static string Tag_name {
get {
return ResourceManager.GetString("Tag_name", resourceCulture);
}
}
public static string Remove { public static string Remove {
get { get {
return ResourceManager.GetString("Remove", resourceCulture); return ResourceManager.GetString("Remove", resourceCulture);
@ -298,6 +310,12 @@ namespace Yavsc.Model {
} }
} }
public static string Hide {
get {
return ResourceManager.GetString("Hide", resourceCulture);
}
}
public static string Estimate_not_found { public static string Estimate_not_found {
get { get {
return ResourceManager.GetString("Estimate_not_found", resourceCulture); return ResourceManager.GetString("Estimate_not_found", resourceCulture);
@ -370,6 +388,12 @@ namespace Yavsc.Model {
} }
} }
public static string younotadmin {
get {
return ResourceManager.GetString("younotadmin", resourceCulture);
}
}
public static string Item_added_to_basket { public static string Item_added_to_basket {
get { get {
return ResourceManager.GetString("Item_added_to_basket", resourceCulture); return ResourceManager.GetString("Item_added_to_basket", resourceCulture);

View file

@ -35,6 +35,7 @@
<data name="Google_error"><value>Erreur Google : {0}</value></data> <data name="Google_error"><value>Erreur Google : {0}</value></data>
<data name="Hide_source"><value>Cacher le texte source du billet</value></data> <data name="Hide_source"><value>Cacher le texte source du billet</value></data>
<data name="Home"><value>Accueil</value></data> <data name="Home"><value>Accueil</value></data>
<data name="Hide"><value>Cacher</value></data>
<data name="ImgLocator"><value>URI de l'image</value></data> <data name="ImgLocator"><value>URI de l'image</value></data>
<data name="ImportException"><value>Exception à l'import</value></data> <data name="ImportException"><value>Exception à l'import</value></data>
<data name="InternalServerError"><value>Erreur serveur interne</value></data> <data name="InternalServerError"><value>Erreur serveur interne</value></data>
@ -46,6 +47,7 @@
<data name="MinDate"><value>Date minimale du rendez-vous</value></data> <data name="MinDate"><value>Date minimale du rendez-vous</value></data>
<data name="Modify"><value>Modifier</value></data> <data name="Modify"><value>Modifier</value></data>
<data name="My_Estimates"><value>Mes estimations</value></data> <data name="My_Estimates"><value>Mes estimations</value></data>
<data name="New_Tag"><value>Nouveau Tag</value></data>
<data name="none"><value>aucun(e)</value></data> <data name="none"><value>aucun(e)</value></data>
<data name="Not Approuved"><value>Non approuvé</value></data> <data name="Not Approuved"><value>Non approuvé</value></data>
<data name="no_content"><value>pas de contenu</value></data> <data name="no_content"><value>pas de contenu</value></data>
@ -63,8 +65,10 @@
<data name="Remove"><value>Supprimer</value></data> <data name="Remove"><value>Supprimer</value></data>
<data name="role_created"><value>Rôle créé</value></data> <data name="role_created"><value>Rôle créé</value></data>
<data name="StartDate"><value>Date de démarrage</value></data> <data name="StartDate"><value>Date de démarrage</value></data>
<data name="Submit"><value>Soumettre</value></data>
<data name="Tex_version"><value>Version LaTeX</value></data> <data name="Tex_version"><value>Version LaTeX</value></data>
<data name="Title"><value>Titre</value></data> <data name="Title"><value>Titre</value></data>
<data name="Tag_name"><value>Nom du tag</value></data>
<data name="Unitary_cost"><value>Coût unitaire</value></data> <data name="Unitary_cost"><value>Coût unitaire</value></data>
<data name="User List"><value>Liste des utilisateurs</value><comment></comment></data> <data name="User List"><value>Liste des utilisateurs</value><comment></comment></data>
<data name="User_name"><value>Nom d'utilisateur</value></data> <data name="User_name"><value>Nom d'utilisateur</value></data>

View file

@ -33,6 +33,7 @@
<data name="Estimate_not_found"><value>Estimate not found</value></data> <data name="Estimate_not_found"><value>Estimate not found</value></data>
<data name="EventWebPage"><value>Event Web page</value></data> <data name="EventWebPage"><value>Event Web page</value></data>
<data name="Home"><value>Home</value></data> <data name="Home"><value>Home</value></data>
<data name="Hide"><value>Hide</value></data>
<data name="Hide_source"><value>Hide the bill source text</value></data> <data name="Hide_source"><value>Hide the bill source text</value></data>
<data name="entries"><value>entries</value></data> <data name="entries"><value>entries</value></data>
<data name="Google_calendar"><value>Google calendar</value></data> <data name="Google_calendar"><value>Google calendar</value></data>
@ -48,6 +49,7 @@
<data name="MinDate"><value>Minimal date for the rendez-vous</value></data> <data name="MinDate"><value>Minimal date for the rendez-vous</value></data>
<data name="Modify"><value>Modify</value></data> <data name="Modify"><value>Modify</value></data>
<data name="My_Estimates"><value>My estimates</value></data> <data name="My_Estimates"><value>My estimates</value></data>
<data name="New_Tag"><value>New Tag</value></data>
<data name="none"><value>none</value></data> <data name="none"><value>none</value></data>
<data name="no_content"><value>no content</value></data> <data name="no_content"><value>no content</value></data>
<data name="Not_Approuved"><value>Not Approuved</value></data> <data name="Not_Approuved"><value>Not Approuved</value></data>
@ -66,8 +68,10 @@
<data name="Remove"><value>Remove</value></data> <data name="Remove"><value>Remove</value></data>
<data name="role_created"><value>role created</value></data> <data name="role_created"><value>role created</value></data>
<data name="StartDate"><value>Start date</value></data> <data name="StartDate"><value>Start date</value></data>
<data name="Submit"><value>Submit</value></data>
<data name="Tex_version"><value>LaTeX version</value></data> <data name="Tex_version"><value>LaTeX version</value></data>
<data name="Title"><value>Title</value></data> <data name="Title"><value>Title</value></data>
<data name="Tag_name"><value>Tag name</value></data>
<data name="Unitary_cost"><value>Unitary_cost</value></data> <data name="Unitary_cost"><value>Unitary_cost</value></data>
<data name="User_List"><value>User List</value><comment></comment></data> <data name="User_List"><value>User List</value><comment></comment></data>
<data name="User_name"><value>User name</value></data> <data name="User_name"><value>User name</value></data>

View file

@ -31,7 +31,7 @@ namespace Yavsc.Model.WorkFlow
/// <summary> /// <summary>
/// Initializes a new instance of the Automate class. /// Initializes a new instance of the Automate class.
/// </summary> /// </summary>
public Automate () public Automate ()
{ {
} }
private Dictionary<TState,Dictionary<TLetter,TState>> transitions = private Dictionary<TState,Dictionary<TLetter,TState>> transitions =

View file

@ -173,6 +173,7 @@
<Compile Include="Blogs\MarkdownHelper.cs" /> <Compile Include="Blogs\MarkdownHelper.cs" />
<Compile Include="Blogs\UTBlogEntryCollection.cs" /> <Compile Include="Blogs\UTBlogEntryCollection.cs" />
<Compile Include="Blogs\BasePost.cs" /> <Compile Include="Blogs\BasePost.cs" />
<Compile Include="Blogs\PostTag.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup> <ItemGroup>