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:
parent
c962998aaa
commit
d04a68db01
41 changed files with 894 additions and 270 deletions
137
yavscModel/Blogs/BasePost.cs
Normal file
137
yavscModel/Blogs/BasePost.cs
Normal 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 ; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,11 @@ namespace Yavsc.Model.Blogs
|
|||
/// <summary>
|
||||
/// The match invisible.
|
||||
/// </summary>
|
||||
MatchInvisible = 8
|
||||
MatchInvisible = 8,
|
||||
/// <summary>
|
||||
/// The match tag.
|
||||
/// </summary>
|
||||
MatchTag = 16,
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue