* bg.gif:
* asc.gif:
* desc.gif:
* style.css: moved to App_Themes
* style.css:
* bg.gif:
* asc.gif:
* bg.png:
* rect.png:
* asc.png:
* desc.gif:
* jquery-ui.css:
* mdd_styles.css:
* croix.png:
* desc.png:
* style.css:
* jquery-ui.min.css:
* mdd_gripper.png:
* mdd_toolbar.png:
* jquery.timepicker.css:
* mdd_ajax_loader.gif:
* mdd_modal_background.png: moved to /App_Themes
* NpgsqlBlogProvider.cs: * Remove post by id
* Manage collections of entries on a couple (user,title), not a single
post
* NpgsqlCircleProvider.cs: Fixes the "Match" method.
* IDbModule.cs:
* Edit.aspx:
* Estimates.aspx:
* WorkFlowManager.cs:
* NpgsqlContentProvider.cs: refactoring
* NpgsqlMRPProviders.csproj: new NpgsqlUserName provider
* NpgsqlRoleProvider.cs: simpler init method
* NpgsqlUserNameProvider.cs: impements a UserNameProvider
* MyClass.cs: refactoring from Yavsc.Model
* BlogsController.cs: access control simplified
* FrontOfficeController.cs: Pdf generation made public ni case of
formatting exception
* mdd_styles.css: Theme -> App_Themes
* style.css: yet another style impact
* AccountController.cs: Fixes the user name modification
* BlogsController.cs: * Fixes the removal process
* On a title and user name, we get collection of posts, not only one.
* Implements an Access on circle
* FrontOfficeController.cs: * implements a new Get method.
* ensure a membership existence before delivering an estimate.
* GoogleController.cs: Fixes the user name modification on a Google
account
* ErrorHtmlFormatter.cs: nice error message in html (using Markdown
helper)
* FormatterException.cs: formatter exception exposes error and
standard output of the process
* TexToPdfFormatter.cs: * generates temporary files in the folder
returned by Path.GetTempPath()
* throws FormatterException
* Global.asax.cs: new route map:
Blogs/{action}/{user}/{title}
Blog/{user}/{title}
B/{id}
{controller}/{action}/{id}
* App.master: * refactoring: Theme moved to App_Themes
* a link to the logged user's blog
*
* NoLogin.master: refactoring: Theme moved to App_Themes
* Circles.aspx: refactoring : circles now are given as select items
* Login.aspx: fixes the html presentation
* Register.aspx: Fixes a Typo
* Index.aspx: Implements a blog index, due to M&C changes with this
commit
* RemovePost.aspx: links to the new route to the "RemovePost" action,
giving it a post id
* RemoveTitle.aspx: fixes a not yet linked page to remove a post
collection under a given title
* EventPub.aspx: code refactoring
* Writting.ascx: cleans the code
* Web.config: fills the config with new names in the space
* Web.config: configures the new NpgsqlUserNameProvider
* Web.csproj: refactoring and others
* BlogEntryCollection.cs: implement the BlogEntryCollection
* BlogManager.cs: the manager helps to filter on access
* BlogProvider.cs: The title is not unique anymore, and one can modify
it, post a lot under it, drop all posts under it.
A Post is deleted by id.
* UUBlogEntryCollection.cs: implements a collection of post under a
given user name.
* UUTBlogEntryCollection.cs: implements a collection of post under a
given couple (user name, title).
* ListItem.cs: ListItem is declared obsolete in this model, helpers
can build MVC SelectListItem on data returned by the manager.
* LocalizedText.Designer.cs:
* LocalizedText.fr.Designer.cs: autogenerated from xml
* LocalizedText.resx:
* LocalizedText.fr.resx: new labels
* ChangeUserNameProvider.cs: xml doc
* Profile.cs: the UserName property is read only, and comes from
authentication, to change it, we set a Name and validate it agains
the "Profile" method
* UserManager.cs: simpler code a init time
* IContentProvider.cs: implements the new IDataProvider interface
* IDataProvider.cs: defines the new IDataProvider interface
* YavscModel.csproj: includes new classes
* UserPosts.aspx: adds a link to remove a post
* UserPost.aspx: now uses the new BlogEntryCollection object
This commit is contained in:
parent
294c54099c
commit
3355f9fed0
82 changed files with 1273 additions and 2455 deletions
|
|
@ -1,3 +1,10 @@
|
|||
2015-08-04 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* NpgsqlBlogProvider.cs: * Remove post by id
|
||||
* Manage collections of entries on a couple (user,title), not
|
||||
a single post
|
||||
|
||||
|
||||
2015-07-15 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* NpgsqlBlogProvider.csproj: Moves to Mono framework
|
||||
|
|
|
|||
|
|
@ -122,7 +122,13 @@ namespace Npgsql.Web.Blog
|
|||
/// <param name="postid">Postid.</param>
|
||||
public override void RemovePost (long postid)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||
cmd.CommandText = "delete from blog where _id = @id";
|
||||
cmd.Parameters.AddWithValue ("id", postid);
|
||||
cnx.Open ();
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Comment the specified from, postid and content.
|
||||
|
|
@ -136,7 +142,7 @@ namespace Npgsql.Web.Blog
|
|||
throw new ArgumentNullException("from");
|
||||
if (content == null)
|
||||
throw new ArgumentNullException("content");
|
||||
bool visible = AutoValidateComment;
|
||||
bool visible = AutoValidatesComments;
|
||||
using (NpgsqlConnection cnx=
|
||||
new NpgsqlConnection(connectionString))
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
|
||||
|
|
@ -181,7 +187,7 @@ namespace Npgsql.Web.Blog
|
|||
/// Gets or sets a value indicating whether this <see cref="Npgsql.Web.Blog.NpgsqlBlogProvider"/> auto validate comment.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if auto validate comment; otherwise, <c>false</c>.</value>
|
||||
public override bool AutoValidateComment {
|
||||
public override bool AutoValidatesComments {
|
||||
get {
|
||||
return autoValidateComment;
|
||||
}
|
||||
|
|
@ -273,52 +279,62 @@ namespace Npgsql.Web.Blog
|
|||
/// <returns>The post.</returns>
|
||||
/// <param name="username">Username.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
public override BlogEntry GetPost (string username, string title)
|
||||
public override UUTBlogEntryCollection GetPost (string username, string title)
|
||||
{
|
||||
BlogEntry be = null;
|
||||
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString))
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
|
||||
cmd.CommandText = "select _id,bcontent,modified,posted,visible from blog " +
|
||||
"where applicationname = :appname and username = :username and title = :title";
|
||||
cmd.Parameters.AddWithValue ("appname", applicationName);
|
||||
cmd.Parameters.AddWithValue ("username", username);
|
||||
cmd.Parameters.AddWithValue ("title", title);
|
||||
cnx.Open ();
|
||||
using (NpgsqlDataReader rdr = cmd.ExecuteReader()) {
|
||||
if (rdr.Read ()) {
|
||||
be = new BlogEntry ();
|
||||
be.Title = title;
|
||||
be.Content = rdr.GetString (rdr.GetOrdinal ("bcontent"));
|
||||
be.UserName = username;
|
||||
be.Modified = rdr.GetDateTime (rdr.GetOrdinal ("modified"));
|
||||
be.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted"));
|
||||
be.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible"));
|
||||
be.Id = rdr.GetInt64 (rdr.GetOrdinal ("_id"));
|
||||
}
|
||||
rdr.Close ();
|
||||
}
|
||||
if (be != null) {
|
||||
using (NpgsqlCommand cmdtags = cnx.CreateCommand ()) {
|
||||
List<string> tags = new List<string> ();
|
||||
cmd.CommandText = "select tag.name from tag,tagged where tag._id = tagged.tagid and tagged.postid = :pid";
|
||||
cmd.Parameters.AddWithValue ("pid", be.Id);
|
||||
using (NpgsqlDataReader rdrt = cmd.ExecuteReader ()) {
|
||||
while (rdrt.Read ()) {
|
||||
tags.Add (rdrt.GetString (0));
|
||||
}
|
||||
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 " +
|
||||
"where applicationname = :appname and username = :username and title = :title";
|
||||
cmd.Parameters.AddWithValue ("appname", applicationName);
|
||||
cmd.Parameters.AddWithValue ("username", username);
|
||||
cmd.Parameters.AddWithValue ("title", title);
|
||||
cnx.Open ();
|
||||
cmd.Prepare ();
|
||||
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
|
||||
while (rdr.Read ()) {
|
||||
BlogEntry be = new BlogEntry ();
|
||||
be.Title = title;
|
||||
be.Content = rdr.GetString (rdr.GetOrdinal ("bcontent"));
|
||||
be.UserName = username;
|
||||
be.Modified = rdr.GetDateTime (rdr.GetOrdinal ("modified"));
|
||||
be.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted"));
|
||||
be.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible"));
|
||||
be.Id = rdr.GetInt64 (rdr.GetOrdinal ("_id"));
|
||||
bec.Add (be);
|
||||
}
|
||||
be.Tags = tags.ToArray ();
|
||||
rdr.Close ();
|
||||
}
|
||||
SetCirclesOn (be);
|
||||
|
||||
}
|
||||
if (bec.Count != 0) {
|
||||
using (NpgsqlCommand cmdtags = cnx.CreateCommand ()) {
|
||||
long pid = 0;
|
||||
cmdtags.CommandText = "select tag.name from tag,tagged where tag._id = tagged.tagid and tagged.postid = :postid";
|
||||
cmdtags.Parameters.AddWithValue ("postid", NpgsqlTypes.NpgsqlDbType.Bigint, pid);
|
||||
cmdtags.Prepare ();
|
||||
foreach (BlogEntry be in bec) {
|
||||
List<string> tags = new List<string> ();
|
||||
cmdtags.Parameters ["postid"].Value = be.Id;
|
||||
using (NpgsqlDataReader rdrt = cmdtags.ExecuteReader ()) {
|
||||
while (rdrt.Read ()) {
|
||||
tags.Add (rdrt.GetString (0));
|
||||
}
|
||||
}
|
||||
be.Tags = tags.ToArray ();
|
||||
}
|
||||
}
|
||||
|
||||
SetCirclesOn (bec);
|
||||
}
|
||||
}
|
||||
return be;
|
||||
return bec;
|
||||
}
|
||||
|
||||
private void SetCirclesOn(BlogEntry be)
|
||||
{
|
||||
List<long> circles = new List<long> ();
|
||||
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString))
|
||||
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
|
||||
using (NpgsqlCommand cmdcircles = cnx.CreateCommand ()) {
|
||||
cmdcircles.CommandText = "select a.circle_id from blog_access a " +
|
||||
"where a.post_id = :pid";
|
||||
|
|
@ -326,11 +342,18 @@ namespace Npgsql.Web.Blog
|
|||
cnx.Open ();
|
||||
using (NpgsqlDataReader rdr = cmdcircles.ExecuteReader ()) {
|
||||
while (rdr.Read ()) {
|
||||
circles.Add ( rdr.GetInt64 (0) );
|
||||
circles.Add (rdr.GetInt64 (0));
|
||||
}
|
||||
}
|
||||
}
|
||||
be.AllowedCircles = circles.ToArray();
|
||||
be.AllowedCircles = circles.ToArray ();
|
||||
}
|
||||
|
||||
private void SetCirclesOn(BlogEntryCollection bec)
|
||||
{
|
||||
foreach (BlogEntry be in bec) {
|
||||
SetCirclesOn (be);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Post the specified username, title, content and visible.
|
||||
|
|
@ -460,6 +483,7 @@ namespace Npgsql.Web.Blog
|
|||
if (totalRecords >= firstrec && totalRecords <= lastrec) {
|
||||
BlogEntry be = new BlogEntry ();
|
||||
be.Title = rdr.GetString (rdr.GetOrdinal ("title"));
|
||||
be.Id = rdr.GetInt64 (rdr.GetOrdinal ("_id"));
|
||||
be.Content = rdr.GetString (rdr.GetOrdinal ("bcontent"));
|
||||
be.UserName = rdr.GetString (rdr.GetOrdinal ("username"));
|
||||
be.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted"));
|
||||
|
|
@ -482,7 +506,7 @@ namespace Npgsql.Web.Blog
|
|||
/// </summary>
|
||||
/// <param name="username">Username.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
public override void RemovePost (string username, string title)
|
||||
public override void RemoveTitle (string username, string title)
|
||||
{
|
||||
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString))
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
|
||||
|
|
@ -531,6 +555,7 @@ namespace Npgsql.Web.Blog
|
|||
while (rdr.Read()) {
|
||||
if (totalRecords >= firstrec && totalRecords <= lastrec) {
|
||||
BlogEntry be = new BlogEntry ();
|
||||
be.Id = rdr.GetInt64 (rdr.GetOrdinal ("_id"));
|
||||
be.Title = rdr.GetString (rdr.GetOrdinal ("title"));
|
||||
be.Content = rdr.GetString (rdr.GetOrdinal ("bcontent"));
|
||||
be.UserName = rdr.GetString (rdr.GetOrdinal ("username"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue