Hallo now edits my images,

and each post can display a dedicated photo.

* NpgsqlBlogProvider.cs: implements a blog post photo storage

* BlogsController.cs: implements a method to update the photo url

* style.css: yastyle

* AdminController.cs: refactoring the notification:
Introduces a static `Notice` method, server side, to populate an array
in `ViewData`, used in the paster page.

* BlogsController.cs: Controls the photo update

* YavscHelpers.cs:
* yavsc.circles.js:
* HomeController.cs:
* GoogleController.cs: notification refactoring

* App.master: - notification refactoring
- html structure in the `nav`

* hallo.js: event 'hallomodified' now also occurs at image
  modifications

* to-markdown.js: ?Fixes? html images alt text and title to Markdown

* yavsc.js: implements the photo in database

* Edit.aspx: A nicer bill edition, with a photo

* UserPost.aspx: Displays the photo

* UserPosts.aspx: Fixes the new usage of `ResultPages`

* Web.config: totem custo

* instdbws.sql: adds a `photo` field in the `blog` table

* BlogEntry.cs: defines the photo in the model

* BlogManager.cs: a new method to set the photo on a blog post.

* BlogProvider.cs: the blog provider now also gives some photo

* LocalizedText.fr.Designer.cs: Reordering the french localisation
  resource

* LocalizedText.fr.resx: Reorders the french localisation resource
This commit is contained in:
Paul Schneider
2015-10-08 12:43:04 +02:00
parent 303e4fa57b
commit 9494d6f353
26 changed files with 773 additions and 586 deletions

View File

@ -0,0 +1,4 @@
2015-10-08 Paul Schneider <paul@pschneider.fr>
* NpgsqlBlogProvider.cs: implements a blog post photo storage

View File

@ -236,7 +236,7 @@ namespace Npgsql.Web.Blog
BlogEntry be = null;
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
cmd.CommandText = "select username, title, bcontent, modified, posted, visible from blog " +
cmd.CommandText = "select username, title, bcontent, modified, posted, visible, photo from blog " +
"where applicationname = @appname and _id = @id";
cmd.Parameters.AddWithValue ("@appname", applicationName);
cmd.Parameters.AddWithValue ("@id", postid);
@ -250,6 +250,7 @@ namespace Npgsql.Web.Blog
be.Modified = rdr.GetDateTime (rdr.GetOrdinal ("modified"));
be.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted"));
be.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible"));
be.Photo = rdr.GetString (rdr.GetOrdinal ("photo"));
be.Id = postid;
}
}
@ -285,7 +286,7 @@ namespace Npgsql.Web.Blog
UUTBlogEntryCollection bec = new UUTBlogEntryCollection (username,title);
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select _id,bcontent,modified,posted,visible from blog " +
cmd.CommandText = "select _id,bcontent,modified,posted,visible,photo from blog " +
"where applicationname = :appname and username = :username and title = :title";
cmd.Parameters.AddWithValue ("appname", NpgsqlDbType.Varchar, applicationName);
cmd.Parameters.AddWithValue ("username", NpgsqlDbType.Varchar ,username);
@ -302,6 +303,7 @@ namespace Npgsql.Web.Blog
be.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted"));
be.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible"));
be.Id = rdr.GetInt64 (rdr.GetOrdinal ("_id"));
be.Photo = rdr.GetString (rdr.GetOrdinal ("photo"));
bec.Add (be);
}
rdr.Close ();
@ -393,6 +395,24 @@ namespace Npgsql.Web.Blog
UpdatePostCircles (pid, circles);
return pid;
}
/// <summary>
/// Updates the post photo.
/// </summary>
/// <param name="pid">Pid.</param>
/// <param name="photo">Photo.</param>
public override void UpdatePostPhoto ( long pid, string photo)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "update blog set photo = :photo where _id = :pid";
cmd.Parameters.AddWithValue ("pid", pid);
cmd.Parameters.AddWithValue ("photo", photo);
cmd.ExecuteNonQuery ();
}
cnx.Close ();
}
}
private void UpdatePostCircles( long pid, long[] circles)
{