* yavsc.js:

* yavsc.circles.js: js refactoring

* Credits.aspx: A credit about to add

* CircleBase.cs: The Circle base

* NpgsqlCircleProvider.cs: * refactoring
* updates the circle

* InputCircle.cs: using the new CircleBase class

* ResultPages.cs: Using a new "None" attribute

* CircleController.cs: refactoring : drops the NewCircle class The
  `List` method now resterns collection of circlebase

* style.css: * a new `dirty` css class, could be used to tag data to
  validate ala ajax
* removed quite all of the `float` usages

* AccountController.cs: xml doc

* BlogsController.cs: Avatar method moved to the Account controller

* YavscHelpers.cs: An avatar url

* App.master: Login div moved up

* Circles.aspx: a new `private` filed in the `Circle` object, in order
  to keep circle names from being published as user's information,
should be true by default

* Profile.aspx: removed the tables

* Index.aspx: Un message plus explicite

* Web.config: nothing to view

* Web.csproj: * new page : Credit
* new script: yavsc.circle.js

* instdbws.sql: circles are uniques for a given user against a given
  app

* Circle.cs: Now inherits CircleBase to implement a member list

* CircleProvider.cs: implements a circle update method

* LocalizedText.resx:
* LocalizedText.Designer.cs: no content!!!

* LocalizedText.fr.resx:
* LocalizedText.fr.Designer.cs: pas content

* YavscModel.csproj: a new CircleBAse class
This commit is contained in:
Paul Schneider 2015-09-10 00:55:19 +02:00
commit b7fa996dbc
30 changed files with 730 additions and 460 deletions

View file

@ -14,6 +14,8 @@ using System.Web.Mvc;
using Yavsc.Model.Circles;
using System.Collections.Specialized;
using System.Text;
using System.Net;
using System.Configuration;
namespace Yavsc.Controllers
{
@ -23,8 +25,40 @@ namespace Yavsc.Controllers
public class AccountController : Controller
{
string avatarDir = "~/avatars";
string avatarDir = "~/avatars";
string defaultAvatar;
string defaultAvatarMimetype;
/// <summary>
/// Avatar the specified user.
/// </summary>
/// <param name="user">User.</param>
[AcceptVerbs (HttpVerbs.Get)]
public ActionResult Avatar (string user)
{
ProfileBase pr = ProfileBase.Create (user);
string avpath = (string ) pr.GetPropertyValue("avatar") ;
if (avpath == null) {
FileInfo fia = new FileInfo (Server.MapPath (defaultAvatar));
return File (fia.OpenRead (), defaultAvatarMimetype);
}
if (avpath.StartsWith ("~/")) {
avpath = Server.MapPath (avpath);
}
WebRequest wr = WebRequest.Create (avpath);
FileContentResult res;
using (WebResponse resp = wr.GetResponse ()) {
using (Stream str = resp.GetResponseStream ()) {
byte[] content = new byte[str.Length];
str.Read (content, 0, (int)str.Length);
res = File (content, resp.ContentType);
wr.Abort ();
return res;
}
}
}
/// <summary>
/// Gets or sets the avatar dir.
/// This value is past to <c>Server.MapPath</c>,
@ -69,7 +103,17 @@ namespace Yavsc.Controllers
ViewData ["returnUrl"] = returnUrl;
return View (model);
}
/// <summary>
/// Initializes a new instance of the <see cref="Yavsc.Controllers.BlogsController"/> class.
/// </summary>
private void GetAvatarConfig ()
{
string[] defaultAvatarSpec = ConfigurationManager.AppSettings.Get ("DefaultAvatar").Split (';');
if (defaultAvatarSpec.Length != 2)
throw new ConfigurationErrorsException ("the DefaultAvatar spec should be found as <fileName>;<mime-type> ");
defaultAvatar = defaultAvatarSpec [0];
defaultAvatarMimetype = defaultAvatarSpec [1];
}
/// <summary>
/// Login the specified returnUrl.

View file

@ -27,7 +27,6 @@ namespace Yavsc.Controllers
/// </summary>
public class BlogsController : Controller
{
string defaultAvatarMimetype;
private string sitename =
WebConfigurationManager.AppSettings ["Name"];
string avatarDir = "~/avatars";
@ -41,17 +40,7 @@ namespace Yavsc.Controllers
set { avatarDir = value; }
}
/// <summary>
/// Initializes a new instance of the <see cref="Yavsc.Controllers.BlogsController"/> class.
/// </summary>
public BlogsController ()
{
string[] defaultAvatarSpec = ConfigurationManager.AppSettings.Get ("DefaultAvatar").Split (';');
if (defaultAvatarSpec.Length != 2)
throw new ConfigurationErrorsException ("the DefaultAvatar spec should be found as <fileName>;<mime-type> ");
defaultAvatar = defaultAvatarSpec [0];
defaultAvatarMimetype = defaultAvatarSpec [1];
}
/// <summary>
/// Index the specified user, title, pageIndex and pageSize.
@ -256,7 +245,7 @@ namespace Yavsc.Controllers
ViewData ["UserName"] = un;
ViewData ["AllowedCircles"] = CircleManager.DefaultProvider.List (Membership.GetUser ().UserName).Select (x => new SelectListItem {
Value = x.Id.ToString(),
Text = YavscHelpers.FormatCircle(x).ToHtmlString()
Text = x.Title
});
return View ("Edit", new BlogEntry { Title = title });
@ -325,36 +314,7 @@ namespace Yavsc.Controllers
return GetPost (model.PostId);
}
string defaultAvatar;
/// <summary>
/// Avatar the specified user.
/// </summary>
/// <param name="user">User.</param>
[AcceptVerbs (HttpVerbs.Get)]
public ActionResult Avatar (string user)
{
ProfileBase pr = ProfileBase.Create (user);
string avpath = (string)pr.GetPropertyValue ("avatar");
if (avpath == null) {
FileInfo fia = new FileInfo (Server.MapPath (defaultAvatar));
return File (fia.OpenRead (), defaultAvatarMimetype);
}
if (avpath.StartsWith ("~/")) {
}
WebRequest wr = WebRequest.Create (avpath);
FileContentResult res;
using (WebResponse resp = wr.GetResponse ()) {
using (Stream str = resp.GetResponseStream ()) {
byte[] content = new byte[str.Length];
str.Read (content, 0, (int)str.Length);
res = File (content, resp.ContentType);
wr.Abort ();
return res;
}
}
}
/// <summary>
/// Remove the specified blog entry, by its author and title,