Bug & layout fixes

* Index.aspx:
* Title.aspx:
* YavscModel.csproj:
* BlogEntry.cs:
* yavsc.scrollnotif.js:
* AccountController.cs:
* BlogEntryCollection.cs: refactoring

* yavsc.tags.js: Implements a js call
to the tag & untag methods

* PostActions.ascx: a better html structure

* BasePost.cs: refactoring:
allows the "PostActions" user control to use a common base object as
  post reference

* NpgsqlBlogProvider.cs: implements the tag methods on db

* ResultPages.cs: A multi-pages result meta info when one page only

* yavsc.circles.js:
* AccountController.cs: code formatting

* BlogsController.cs: Untag a post

* style.css: yastyle, yet a better one.

* BlogsController.cs: View the Title after edition

* App.master:
* UserPosts.aspx: a nicer html structure

* yavsc.js: Fixes notice & dimiss js

* Login.aspx: refactoring

* Edit.aspx: better html

* UserPost.aspx: A promess to be allowed to tag.

* Web.csproj: Adds yavsc.tags.js and yavsc.scrollnotifs.js to the
  project decription.

* BlogManager.cs: Makes the blog manager expose of the new `UnTag`
  method

* BlogProvider.cs: introduces a method to `untag`

* FindBlogEntryFlags.cs: Find post entry by tag

* LocalizedText.resx:
* LocalizedText.Designer.cs: new translations: - "Tag"
- "Edit"

* LocalizedText.fr.resx:
* LocalizedText.fr.Designer.cs: nouvelles traductions: - "Tag"
- "Edit"

* Profile.cs: a nicer stack trace at buggy usage
This commit is contained in:
Paul Schneider 2015-10-13 22:53:39 +02:00
commit d04a68db01
41 changed files with 894 additions and 270 deletions

View file

@ -0,0 +1,137 @@
//
// BasePost.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
{
/// <summary>
/// Base post.
/// </summary>
public class BasePost {
/// <summary>
/// The identifier.
/// </summary>
long id;
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
[DisplayName("Identifiant numérique de billet")]
public long Id {
get {
return id;
}
set {
id = value;
}
}
/// <summary>
/// The posted.
/// </summary>
private DateTime posted;
/// <summary>
/// Gets or sets the posted.
/// </summary>
/// <value>The posted.</value>
[DisplayName("Date de creation")]
public DateTime Posted {
get {
return posted;
}
set {
posted = value;
}
}
/// <summary>
/// The modified.
/// </summary>
private DateTime modified;
/// <summary>
/// Gets or sets the modified.
/// </summary>
/// <value>The modified.</value>
[DisplayName("Date de modification")]
public DateTime Modified {
get {
return modified;
}
set {
modified = value;
}
}
private string title;
/// <summary>
/// Gets or sets the title.
/// </summary>
/// <value>The title.</value>
[DisplayName("Titre du billet")]
[StringLength(512)]
[RegularExpression("^[^:%&?]*$",ErrorMessage = "Les caratères suivants sont invalides pour un titre: :%&?")]
[Required(ErrorMessage = "S'il vous plait, saisissez un titre")]
public string Title {
get {
return title;
}
set {
title = value;
}
}
private string author;
/// <summary>
/// Gets or sets the name of the user.
/// </summary>
/// <value>The name of the user.</value>
[StringLength(255)]
[DisplayName("Auteur")]
public string Author {
get {
return author;
}
set {
author = value;
}
}
/// <summary>
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.Blogs.BlogEntry"/> is visible.
/// </summary>
/// <value><c>true</c> if visible; otherwise, <c>false</c>.</value>
public bool Visible { get; set ; }
}
}

View file

@ -10,23 +10,7 @@ namespace Yavsc.Model.Blogs
/// <summary>
/// Blog entry.
/// </summary>
public class BlogEntry {
long id;
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
[DisplayName("Identifiant numérique de billet")]
public long Id {
get {
return id;
}
set {
id = value;
}
}
public class BlogEntry : BasePost {
/// <summary>
/// Gets or sets the photo.
@ -37,24 +21,7 @@ namespace Yavsc.Model.Blogs
set;
}
string title;
/// <summary>
/// Gets or sets the title.
/// </summary>
/// <value>The title.</value>
[DisplayName("Titre du billet")]
[StringLength(512)]
[RegularExpression("^[^:%&?]*$",ErrorMessage = "Les caratères suivants sont invalides pour un titre: :%&?")]
[Required(ErrorMessage = "S'il vous plait, saisissez un titre")]
public string Title {
get {
return title;
}
set {
title = value;
}
}
string content;
@ -73,65 +40,6 @@ namespace Yavsc.Model.Blogs
}
}
string userName;
/// <summary>
/// Gets or sets the name of the user.
/// </summary>
/// <value>The name of the user.</value>
[StringLength(255)]
[DisplayName("Auteur")]
public string Author {
get {
return userName;
}
set {
userName = value;
}
}
/// <summary>
/// The posted.
/// </summary>
public DateTime posted;
/// <summary>
/// Gets or sets the posted.
/// </summary>
/// <value>The posted.</value>
[DisplayName("Date de creation")]
public DateTime Posted {
get {
return posted;
}
set {
posted = value;
}
}
/// <summary>
/// The modified.
/// </summary>
public DateTime modified;
/// <summary>
/// Gets or sets the modified.
/// </summary>
/// <value>The modified.</value>
[DisplayName("Date de modification")]
public DateTime Modified {
get {
return modified;
}
set {
modified = value;
}
}
/// <summary>
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.Blogs.BlogEntry"/> is visible.
/// </summary>
/// <value><c>true</c> if visible; otherwise, <c>false</c>.</value>
public bool Visible { get; set ; }
/// <summary>
/// Gets or sets the circles allowed to read this ticket.
/// An empty collection specifies a public post.

View file

@ -76,22 +76,13 @@ namespace Yavsc.Model.Blogs
}
return res;
}
/// <summary>
/// Base post info.
/// </summary>
public class BasePostInfo {
/// <summary>
/// The identifier.
/// </summary>
public long Id;
/// <summary>
/// The posted.
/// </summary>
public DateTime Posted;
/// <summary>
/// The modified.
/// </summary>
public DateTime Modified;
public class BasePostInfo: BasePost {
/// <summary>
/// The intro.

View file

@ -183,9 +183,9 @@ namespace Yavsc.Model.Blogs
/// <param name="postid">Postid.</param>
/// <param name="tag">Tag.</param>
/// <returns>The tag identifier</returns>
public static long Tag (long postid, string tag)
public static void Tag (long postid, string tag)
{
return Provider.Tag (postid, tag);
Provider.Tag (postid, tag);
}
/// <summary>
@ -215,6 +215,16 @@ namespace Yavsc.Model.Blogs
return e;
}
/// <summary>
/// Untag the specified postid and tagname.
/// </summary>
/// <param name="postid">Postid.</param>
/// <param name="tagname">Tagname.</param>
public static void Untag (long postid, string tagname)
{
Provider.Untag (postid, tagname);
}
private static bool CanView (BlogEntry e, MembershipUser u = null)
{
if (e.AllowedCircles != null && e.AllowedCircles.Length > 0) {

View file

@ -143,14 +143,26 @@ namespace Yavsc.Model.Blogs
/// </summary>
/// <param name="postid">Postid.</param>
/// <param name="tag">Tag.</param>
public abstract long Tag (long postid,string tag);
public abstract long Tag (long postid, string tag);
/// <summary>
/// Uns the tag.
/// </summary>
/// <param name="postid">Postid.</param>
/// <param name="tagid">Tagid.</param>
public abstract void Untag (long postid, long tagid);
/// <summary>
/// Uns the tag.
/// </summary>
/// <param name="postid">Postid.</param>
/// <param name="name">Name.</param>
public abstract void Untag (long postid, string name);
/// <summary>
/// Removes the tag.
/// </summary>
/// <param name="tagid">Tagid.</param>
public abstract void RemoveTag (long tagid);
public abstract void DropTag (long tagid);
/// <summary>
/// Updates the post photo.
/// </summary>

View file

@ -23,7 +23,11 @@ namespace Yavsc.Model.Blogs
/// <summary>
/// The match invisible.
/// </summary>
MatchInvisible = 8
MatchInvisible = 8,
/// <summary>
/// The match tag.
/// </summary>
MatchTag = 16,
}
}

View file

@ -1,3 +1,31 @@
2015-10-13 Paul Schneider <paul@pschneider.fr>
* BasePost.cs: refactoring:
allows the "PostActions" user control to use a common base
object as post reference
* YavscModel.csproj:
* BlogEntry.cs:
* BlogEntryCollection.cs: refactoring
* BlogManager.cs: Makes the blog manager expose of the new
`UnTag` method
* BlogProvider.cs: introduces a method to `untag`
* FindBlogEntryFlags.cs: Find post entry by tag
* LocalizedText.resx:
* LocalizedText.Designer.cs: new translations: - "Tag"
- "Edit"
* LocalizedText.fr.resx:
* LocalizedText.fr.Designer.cs: nouvelles traductions: - "Tag"
- "Edit"
* Profile.cs: a nicer stack trace at buggy usage
2015-10-10 Paul Schneider <paul@pschneider.fr>
* YavscModel.csproj:

View file

@ -190,6 +190,18 @@ namespace Yavsc.Model {
}
}
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 {
get {
return ResourceManager.GetString("access_denied", resourceCulture);
@ -238,6 +250,12 @@ namespace Yavsc.Model {
}
}
public static string DoTag {
get {
return ResourceManager.GetString("DoTag", resourceCulture);
}
}
public static string Not_Approuved {
get {
return ResourceManager.GetString("Not_Approuved", resourceCulture);
@ -364,6 +382,12 @@ namespace Yavsc.Model {
}
}
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);
@ -376,6 +400,12 @@ namespace Yavsc.Model {
}
}
public static string Edit {
get {
return ResourceManager.GetString("Edit", resourceCulture);
}
}
public static string InternalServerError {
get {
return ResourceManager.GetString("InternalServerError", resourceCulture);

View file

@ -124,6 +124,12 @@ namespace Yavsc.Model {
}
}
public static string View_source {
get {
return ResourceManager.GetString("View_source", resourceCulture);
}
}
public static string Ciffer {
get {
return ResourceManager.GetString("Ciffer", resourceCulture);
@ -184,15 +190,21 @@ namespace Yavsc.Model {
}
}
public static string Hide_source {
get {
return ResourceManager.GetString("Hide_source", resourceCulture);
}
}
public static string access_denied {
get {
return ResourceManager.GetString("access_denied", resourceCulture);
}
}
public static string was_added_to_the_role {
public static string DoTag {
get {
return ResourceManager.GetString("was_added_to_the_role", resourceCulture);
return ResourceManager.GetString("DoTag", resourceCulture);
}
}
@ -352,6 +364,12 @@ namespace Yavsc.Model {
}
}
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);
@ -364,6 +382,12 @@ namespace Yavsc.Model {
}
}
public static string Edit {
get {
return ResourceManager.GetString("Edit", resourceCulture);
}
}
public static string InternalServerError {
get {
return ResourceManager.GetString("InternalServerError", resourceCulture);
@ -375,5 +399,11 @@ namespace Yavsc.Model {
return ResourceManager.GetString("entries", resourceCulture);
}
}
public static string was_added_to_the_role {
get {
return ResourceManager.GetString("was_added_to_the_role", resourceCulture);
}
}
}
}

View file

@ -25,12 +25,15 @@
<data name="DocTemplateException"><value>Une erreur est survenue à la génération de votre document</value></data>
<data name="Description"><value>Description</value></data>
<data name="DisplayName"><value>Nom affiché</value></data>
<data name="DoTag"><value>Tagger</value></data>
<data name="entries"><value>entrées</value></data>
<data name="Edit"><value>Éditer</value></data>
<data name="EndDate"><value>Date de fin</value></data>
<data name="Estimate_not_found"><value>Devis non trouvé</value></data>
<data name="EventWebPage"><value>Page web de l'événement</value></data>
<data name="Google_calendar"><value>Agenda Google</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="Home"><value>Accueil</value></data>
<data name="ImgLocator"><value>URI de l'image</value></data>
<data name="ImportException"><value>Exception à l'import</value></data>
@ -52,6 +55,7 @@
<data name="Preview"><value>Prévisualiser</value><comment>Prévisualiser le document</comment></data>
<data name="Profile_edition"><value>Édition du profile</value></data>
<data name="Product_reference"><value>Référence produit</value></data>
<data name="ReadMore"><value>Lire la suite ...</value></data>
<data name="ProviderId"><value>Identifiant du fournisseur</value></data>
<data name="ProviderName"><value>Nom du fournisseur</value></data>
<data name="Register"><value>Enregistez-vous</value></data>
@ -64,6 +68,7 @@
<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_name"><value>Nom d'utilisateur</value></data>
<data name="View_source"><value>Voir le texte source du billet</value></data>
<data name="was_added_to_the_role"><value>a été ajouté au rôle</value></data>
<data name="was_added_to_the_empty_role"><value>Il n'y avait pas 'utilisateur dans le rôle '{1}'. Vous ({0}) avez été ajouté au rôle '{1}'.</value></data>
<data name="Welcome"><value>Bienvenue</value><comment></comment></data>

View file

@ -25,12 +25,15 @@
<data name="Description"><value>Description</value></data>
<data name="DisplayName"><value>Display Name</value></data>
<data name="DocTemplateException"><value>Exception occured when rendering your document</value></data>
<data name="DoTag"><value>Tag</value></data>
<data name="DuplicateEmail"><value>This email adress is already used ({0}).</value></data>
<data name="DuplicateUserName"><value>This user name is already used ({0}).</value></data>
<data name="Edit"><value>Edit</value></data>
<data name="EndDate"><value>End date</value></data>
<data name="Estimate_not_found"><value>Estimate not found</value></data>
<data name="EventWebPage"><value>Event Web page</value></data>
<data name="Home"><value>Home</value></data>
<data name="Hide_source"><value>Hide the bill source text</value></data>
<data name="entries"><value>entries</value></data>
<data name="Google_calendar"><value>Google calendar</value></data>
<data name="Google_error"><value>Google error : {0}</value></data>
@ -57,6 +60,7 @@
<data name="ProviderId"><value>Provider identifier</value></data>
<data name="ProviderName"><value>Provider name</value></data>
<data name="Product_reference"><value>Product_reference</value></data>
<data name="ReadMore"><value>Read more ...</value></data>
<data name="Register"><value>Register</value></data>
<data name="Remember_me"><value>Remember me</value></data>
<data name="Remove"><value>Remove</value></data>
@ -67,6 +71,7 @@
<data name="Unitary_cost"><value>Unitary_cost</value></data>
<data name="User_List"><value>User List</value><comment></comment></data>
<data name="User_name"><value>User name</value></data>
<data name="View_source"><value>View source</value></data>
<data name="was_added_to_the_role"><value>was added to the role</value></data>
<data name="was_added_to_the_empty_role"><value>There was no user in the '{1}' role. You ({0}) was just added as firt user in the '{1}' role.</value></data>
<data name="Welcome"><value>Welcome</value><comment></comment></data>

View file

@ -237,6 +237,9 @@ namespace Yavsc.Model.RolesAndMembers
/// <param name="profile">Profile.</param>
public Profile (ProfileBase profile)
{
if (profile == null)
throw new Exception ("No profile");
object b = profile.GetPropertyValue ("BlogVisible");
BlogVisible = (b == null) ? true : (b is DBNull)? true : (bool)b;

View file

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