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
parent c962998aaa
commit d04a68db01
41 changed files with 896 additions and 272 deletions

View File

@ -39,10 +39,11 @@ namespace Yavsc.ApiControllers
/// Register the specified model.
/// </summary>
/// <param name="model">Model.</param>
[Authorize()]
[Authorize ()]
[ValidateAjaxAttribute]
public HttpResponseMessage Register ([FromBody] RegisterClientModel model)
{
if (ModelState.IsValid) {
if (model.IsApprouved)
if (!Roles.IsUserInRole ("Admin"))
@ -54,32 +55,32 @@ namespace Yavsc.ApiControllers
}
MembershipCreateStatus mcs;
var user = Membership.CreateUser (
model.UserName,
model.Password,
model.Email,
model.Question,
model.Answer,
model.IsApprouved,
out mcs);
model.UserName,
model.Password,
model.Email,
model.Question,
model.Answer,
model.IsApprouved,
out mcs);
switch (mcs) {
case MembershipCreateStatus.DuplicateEmail:
ModelState.AddModelError ("Email", "Cette adresse e-mail correspond " +
"à un compte utilisateur existant");
"à un compte utilisateur existant");
break;
case MembershipCreateStatus.DuplicateUserName:
ModelState.AddModelError ("UserName", "Ce nom d'utilisateur est " +
"déjà enregistré");
"déjà enregistré");
break;
case MembershipCreateStatus.Success:
if (!model.IsApprouved)
Url.SendActivationMessage (user);
ProfileBase prtu = ProfileBase.Create (model.UserName);
prtu.SetPropertyValue("Name",model.Name);
prtu.SetPropertyValue("Address",model.Address);
prtu.SetPropertyValue("CityAndState",model.CityAndState);
prtu.SetPropertyValue("Mobile",model.Mobile);
prtu.SetPropertyValue("Phone",model.Phone);
prtu.SetPropertyValue("ZipCode",model.ZipCode);
prtu.SetPropertyValue ("Name", model.Name);
prtu.SetPropertyValue ("Address", model.Address);
prtu.SetPropertyValue ("CityAndState", model.CityAndState);
prtu.SetPropertyValue ("Mobile", model.Mobile);
prtu.SetPropertyValue ("Phone", model.Phone);
prtu.SetPropertyValue ("ZipCode", model.ZipCode);
break;
default:
break;
@ -88,15 +89,12 @@ namespace Yavsc.ApiControllers
return DefaultResponse ();
}
/// <summary>
/// Resets the password.
/// </summary>
/// <param name="model">Model.</param>
[ValidateAjax]
public void ResetPassword(LostPasswordModel model)
public void ResetPassword (LostPasswordModel model)
{
StringDictionary errors;
MembershipUser user;
@ -108,4 +106,3 @@ namespace Yavsc.ApiControllers
}
}
}

View File

@ -40,9 +40,19 @@ namespace Yavsc.ApiControllers
/// </summary>
/// <param name="postid">Postid.</param>
/// <param name="tag">Tag.</param>
public long Tag (long postid,string tag) {
public void Tag (long postid,string tag) {
BlogManager.GetForEditing (postid);
return BlogManager.Tag (postid, tag);
BlogManager.Tag (postid, tag);
}
/// <summary>
/// Untag the specified postid and tag.
/// </summary>
/// <param name="postid">Postid.</param>
/// <param name="tag">Tag.</param>
public void Untag (long postid,string tag) {
BlogManager.GetForEditing (postid);
BlogManager.Untag (postid, tag);
}
/// <summary>
@ -57,6 +67,7 @@ namespace Yavsc.ApiControllers
throw new AuthorizationDenied (user);
BlogManager.RemoveTitle (user, title);
}
/// <summary>
/// Removes the tag.
/// </summary>
@ -65,6 +76,7 @@ namespace Yavsc.ApiControllers
throw new NotImplementedException ();
}
/// <summary>
/// The allowed media types.
/// </summary>
@ -125,9 +137,9 @@ namespace Yavsc.ApiControllers
}
}
/// <summary>
/// Searchs the files accociated to the given post id,
/// or related to the given terms.
/// Searchs the file.
/// </summary>
/// <returns>The file.</returns>
/// <param name="postid">Postid.</param>
@ -165,7 +177,8 @@ namespace Yavsc.ApiControllers
try
{
// Read the form data.
IEnumerable<HttpContent> data = await Request.Content.ReadAsMultipartAsync(provider) ;
//IEnumerable<HttpContent> data =
await Request.Content.ReadAsMultipartAsync(provider) ;
var invalidChars = Path.GetInvalidFileNameChars();
List<string> bodies = new List<string>();
@ -182,10 +195,7 @@ namespace Yavsc.ApiControllers
FileInfo fp = new FileInfo (Path.Combine(root,filename));
if (fi.Exists) fi.Delete();
fp.MoveTo(fi.FullName);
// Get the mime type
// TODO Get the mime type
using (Process p = new Process ()) {
p.StartInfo.WorkingDirectory = root;
p.StartInfo = new ProcessStartInfo ();