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
commit 9494d6f353
26 changed files with 1015 additions and 828 deletions

View file

@ -10,6 +10,7 @@ using Yavsc.Model.Admin;
using Yavsc.Admin;
using System.IO;
using Yavsc.Model;
using Yavsc.Helpers;
namespace Yavsc.Controllers
{
@ -160,8 +161,7 @@ namespace Yavsc.Controllers
ViewData ["usertoremove"] = username;
if (submitbutton == "Supprimer") {
Membership.DeleteUser (username);
ViewData["Message"]=
string.Format("utilisateur \"{0}\" supprimé",username);
YavscHelpers.Notice(ViewData, string.Format("utilisateur \"{0}\" supprimé",username));
ViewData ["usertoremove"] = null;
}
return View ();
@ -236,7 +236,7 @@ namespace Yavsc.Controllers
public ActionResult DoAddRole (string rolename)
{
Roles.CreateRole(rolename);
ViewData["Message"] = LocalizedText.role_created+ " : "+rolename;
YavscHelpers.Notice(ViewData, LocalizedText.role_created+ " : "+rolename);
return View ();
}
@ -274,7 +274,7 @@ namespace Yavsc.Controllers
ViewData ["useritems"] = users;
if (ModelState.IsValid) {
Roles.AddUserToRole (model.UserName, adminRoleName);
ViewData ["Message"] = model.UserName + " "+LocalizedText.was_added_to_the_role+" '" + adminRoleName + "'";
YavscHelpers.Notice(ViewData, model.UserName + " "+LocalizedText.was_added_to_the_role+" '" + adminRoleName + "'");
} else {
if (admins.Length > 0) {
if (! admins.Contains (Membership.GetUser ().UserName)) {
@ -286,9 +286,9 @@ namespace Yavsc.Controllers
// No admin, gives the Admin Role to the current user
Roles.AddUserToRole (currentUser, adminRoleName);
admins = new string[] { currentUser };
ViewData ["Message"] += string.Format (
YavscHelpers.Notice(ViewData, string.Format (
LocalizedText.was_added_to_the_empty_role,
currentUser, adminRoleName);
currentUser, adminRoleName));
}
}
return View (model);

View file

@ -273,6 +273,8 @@ namespace Yavsc.Controllers
}
else
model.Id = BlogManager.Post (model.Author, model.Title, model.Content, model.Visible, model.AllowedCircles);
if (model.Photo != null)
BlogManager.UpdatePostPhoto (model.Id, model.Photo);
return RedirectToAction ("UserPosts", new { user = model.Author, title = model.Title });
}
ViewData ["AllowedCircles"] =

View file

@ -17,6 +17,7 @@ using Yavsc.Model.Google;
using Yavsc.Model.RolesAndMembers;
using Yavsc.Helpers.Google;
using Yavsc.Model.Calendar;
using Yavsc.Helpers;
namespace Yavsc.Controllers
{
@ -100,7 +101,7 @@ namespace Yavsc.Controllers
AuthToken gat = oa.GetToken (Request, (string)Session ["state"], out msg);
if (gat == null) {
ViewData ["Message"] = msg;
YavscHelpers.Notice(ViewData, msg);
return View ("Auth");
}
SaveToken (gat);
@ -137,7 +138,7 @@ namespace Yavsc.Controllers
OAuth2 oa = new OAuth2 (AuthGRU);
AuthToken gat = oa.GetToken (Request, (string)Session ["state"], out msg);
if (gat == null) {
ViewData ["Message"] = msg;
YavscHelpers.Notice(ViewData, msg);
return View ();
}
string returnUrl = (string)Session ["returnUrl"];

View file

@ -84,16 +84,9 @@ namespace Yavsc.Controllers
/// </summary>
public ActionResult Index ()
{
/*
* A very bad idea (a redirect permanent as home page):
*
* string startPage = WebConfigurationManager.AppSettings ["StartPage"];
if (startPage != null)
Redirect (startPage);
*/
ViewData ["Message"] = LocalizedText.Welcome;
return View ();
}
/// <summary>
/// Contact the specified email, reason and body.
/// </summary>
@ -123,8 +116,7 @@ namespace Yavsc.Controllers
using (System.Net.Mail.SmtpClient sc = new SmtpClient())
{
sc.Send (msg);
ViewData ["Message"] = LocalizedText.Message_sent;
YavscHelpers.Notice(ViewData, LocalizedText.Message_sent);
return View (new { email=email, reason="", body="" });
}
}