* 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
main
Paul Schneider 10 years ago
parent 37188df28a
commit b7fa996dbc
30 changed files with 730 additions and 460 deletions

@ -1,3 +1,8 @@
2015-09-10 Paul Schneider <paul@pschneider.fr>
* NpgsqlCircleProvider.cs: * refactoring
* updates the circle
2015-08-20 Paul Schneider <paul@pschneider.fr> 2015-08-20 Paul Schneider <paul@pschneider.fr>
* NpgsqlCircleProvider.cs: circle members are now stored in bd * NpgsqlCircleProvider.cs: circle members are now stored in bd

@ -37,7 +37,106 @@ namespace WorkFlowProvider
public class NpgsqlCircleProvider : CircleProvider public class NpgsqlCircleProvider : CircleProvider
{ {
#region implemented abstract members of CircleProvider #region implemented abstract members of CircleProvider
/// <summary>
/// Updates the circle.
/// </summary>
/// <param name="c">C.</param>
public override void UpdateCircle (CircleBase c)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "update circle " +
"set title = :title, " +
"isprivate = :pv " +
"where _id = :cid ";
cmd.Parameters.AddWithValue ("title", c.Title);
cmd.Parameters.AddWithValue ("pv", c.IsPrivate);
cmd.Parameters.AddWithValue ("cid", c.Id);
cmd.ExecuteNonQuery ();
}
cnx.Close ();
}
}
/// <summary>
/// Get the specified circle by id, including all of its members.
/// </summary>
/// <param name="id">Identifier.</param>
/// <returns>The members.</returns>
public override Circle GetMembers (long id)
{
Circle circ = null;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select title, owner, public from circle where _id = :cid";
cmd.Parameters.AddWithValue ("cid", id);
using (NpgsqlDataReader dr = cmd.ExecuteReader ()) {
if (dr.Read ()) {
circ = new Circle ();
circ.Id = id;
circ.Title = dr.GetString (
dr.GetOrdinal ("title"));
circ.Owner = dr.GetString (
dr.GetOrdinal ("owner"));
circ.IsPrivate = !dr.GetBoolean (dr.GetOrdinal ("public"));
}
dr.Close ();
}
}
if (circ != null) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select member from circle_members where circle_id = :cid";
cmd.Parameters.AddWithValue ("cid", id);
cmd.Prepare ();
List<string> members = new List<string> ();
using (NpgsqlDataReader dr = cmd.ExecuteReader ()) {
while (dr.Read ())
members.Add (dr.GetString (0));
dr.Close ();
circ.Members = members.ToArray ();
}
}
}
cnx.Close ();
}
return circ;
}
/// <summary>
/// Gets the identifier.
/// </summary>
/// <returns>The identifier.</returns>
/// <param name="circle">Circle.</param>
/// <param name="username">Username.</param>
public override long GetId (string circle, string username)
{
long cid = 0;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select _id from circle where " +
"owner = :uname " +
"and title = :title " +
"and applicationname = :appname";
cmd.Parameters.AddWithValue ("uname", username);
cmd.Parameters.AddWithValue ("title", circle);
cmd.Parameters.AddWithValue ("appname", applicationName);
cid = (long)cmd.ExecuteScalar ();
}
cnx.Close ();
}
return cid;
}
/// <summary>
/// Removes the membership.
/// </summary>
/// <param name="circle_id">Circle identifier.</param>
/// <param name="member">Member.</param>
public override void RemoveMembership (long circle_id, string member) public override void RemoveMembership (long circle_id, string member)
{ {
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
@ -50,7 +149,10 @@ namespace WorkFlowProvider
cnx.Close (); cnx.Close ();
} }
} }
/// <summary>
/// Removes the member from all current user circles.
/// </summary>
/// <param name="member">Member.</param>
public override void RemoveMember (string member) public override void RemoveMember (string member)
{ {
throw new NotImplementedException (); throw new NotImplementedException ();
@ -97,7 +199,7 @@ namespace WorkFlowProvider
/// </summary> /// </summary>
/// <param name="id">circle Identifier.</param> /// <param name="id">circle Identifier.</param>
/// <param name="username">User name.</param> /// <param name="username">User name.</param>
public override void Add (long id, string username) public override void AddMember (long id, string username)
{ {
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) { using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
@ -110,47 +212,24 @@ namespace WorkFlowProvider
} }
} }
/// <summary> /// <summary>
/// Get the specified id. /// Get the specified circle by id.
/// </summary> /// </summary>
/// <param name="id">Identifier.</param> /// <param name="id">Identifier.</param>
public override Circle Get (long id) public override CircleBase Get (long id)
{ {
Circle circ=null; CircleBase circ = null;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) { using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open (); cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) { using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select title, owner, public from circle where _id = :cid"; cmd.CommandText = "select title, owner from circle where _id = :cid";
cmd.Parameters.AddWithValue ("cid", id); cmd.Parameters.AddWithValue ("cid", id);
using (NpgsqlDataReader dr = cmd.ExecuteReader ()) { using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
if (dr.Read ()) { if (rdr.Read ()) {
circ = new Circle (); circ = new CircleBase ();
circ.Id = id; circ.Id = id;
circ.Title = dr.GetString ( circ.Owner = rdr.GetString (1);
dr.GetOrdinal ("title")); circ.Title = rdr.GetString (0);
circ.Owner = dr.GetString (
dr.GetOrdinal ("owner"));
circ.IsPrivate = !dr.GetBoolean(dr.GetOrdinal("public"));
}
dr.Close ();
}
}
if (circ != null) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select member from circle_members where circle_id = :cid";
cmd.Parameters.AddWithValue ("cid", id);
cmd.Prepare ();
List<string> members = new List<string> ();
using (NpgsqlDataReader dr = cmd.ExecuteReader ()) {
while (dr.Read ())
members.Add (dr.GetString (0));
dr.Close ();
circ.Members = members.ToArray ();
} }
} }
} }
@ -159,6 +238,7 @@ namespace WorkFlowProvider
return circ; return circ;
} }
/// <summary> /// <summary>
/// Add the specified owner, title and users. /// Add the specified owner, title and users.
/// </summary> /// </summary>
@ -213,9 +293,9 @@ namespace WorkFlowProvider
/// List user's circles. /// List user's circles.
/// </summary> /// </summary>
/// <param name="user">User.</param> /// <param name="user">User.</param>
public override IEnumerable<Circle> List (string user) public override IEnumerable<CircleBase> List (string user)
{ {
List<Circle> cc = new List<Circle> (); List<CircleBase> cc = new List<CircleBase> ();
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) { using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) { using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select _id, title from circle where owner = :wnr"; cmd.CommandText = "select _id, title from circle where owner = :wnr";
@ -224,39 +304,18 @@ namespace WorkFlowProvider
cmd.Prepare (); cmd.Prepare ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) { using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
if (rdr.HasRows) { if (rdr.HasRows) {
while (rdr.Read ()) {
string title = null;
int ottl = rdr.GetOrdinal ("title");
if (!rdr.IsDBNull (ottl))
title = rdr.GetString (ottl);
long id = (long)rdr.GetInt64 (
rdr.GetOrdinal ("_id"));
cc.Add (new Circle { Id = id, Title = title });
}
}
rdr.Close ();
}
}
// select members
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select member from circle_members where circle_id = :cid";
cmd.Parameters.Add("cid",NpgsqlDbType.Bigint);
cmd.Prepare ();
foreach (Circle c in cc) {
cmd.Parameters ["cid"].Value = c.Id;
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
if (rdr.HasRows) {
var res = new List<string> ();
while (rdr.Read ()) { while (rdr.Read ()) {
res.Add (rdr.GetString (0)); CircleBase cb = new CircleBase ();
cb.Id = rdr.GetInt64 (0);
cb.Title = rdr.GetString (1);
cb.Owner = user;
cc.Add (cb);
} }
c.Members = res.ToArray ();
} }
rdr.Close (); rdr.Close ();
} }
} }
}
cnx.Close (); cnx.Close ();
} }
return cc; return cc;
@ -266,6 +325,7 @@ namespace WorkFlowProvider
string connectionString = null; string connectionString = null;
string applicationName = null; string applicationName = null;
/// <summary> /// <summary>
/// Initialize this object using the specified name and config. /// Initialize this object using the specified name and config.
/// </summary> /// </summary>

@ -1,3 +1,9 @@
2015-09-10 Paul Schneider <paul@pschneider.fr>
* InputCircle.cs: using the new CircleBase class
* ResultPages.cs: Using a new "None" attribute
2015-08-22 Paul Schneider <paul@pschneider.fr> 2015-08-22 Paul Schneider <paul@pschneider.fr>
* InputCircle.cs: this class is about to be removed * InputCircle.cs: this class is about to be removed

@ -29,6 +29,7 @@ using System.Web.Security;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Web.Mvc; using System.Web.Mvc;
using System.Linq;
namespace Yavsc.WebControls namespace Yavsc.WebControls
{ {
@ -154,15 +155,15 @@ namespace Yavsc.WebControls
} }
var u = Membership.GetUser (); var u = Membership.GetUser ();
if (u != null) { if (u != null) {
foreach (var ci in CircleManager.DefaultProvider.List(u.UserName)) { var circles = CircleManager.DefaultProvider.List (u.UserName);
foreach (SelectListItem sli in Value) foreach (SelectListItem sli in Value) {
if (sli.Value == ci.Id.ToString()) { if (circles.Any( x=> x.Title == sli.Text)) {
writer.AddAttribute ("selected", null); writer.AddAttribute ("selected", null);
break; break;
} }
writer.AddAttribute ("value", ci.Id.ToString() ); writer.AddAttribute ("value", sli.Value );
writer.RenderBeginTag ("option"); writer.RenderBeginTag ("option");
writer.Write (ci.Title); writer.Write (sli.Text);
writer.RenderEndTag (); writer.RenderEndTag ();
} }
} }

@ -26,6 +26,7 @@ namespace Yavsc.WebControls
/// </summary> /// </summary>
public ResultPages () public ResultPages ()
{ {
} }
@ -96,6 +97,18 @@ namespace Yavsc.WebControls
} }
} }
[Bindable (true)]
[DefaultValue("none")]
public string None {
get {
string s = (string) ViewState["None"];
return (s == null) ? String.Empty : s;
}
set {
ViewState["None"] = value;
}
}
/// <summary> /// <summary>
/// Gets or sets the current page. /// Gets or sets the current page.
@ -134,14 +147,11 @@ namespace Yavsc.WebControls
writer.Write ("&nbsp;"); writer.Write ("&nbsp;");
} }
} }
writer.Write ("(");
if (ResultCount == 0) { if (ResultCount == 0) {
writer.Write ("Pas de resultat"); writer.Write ("(");
} else { writer.Write (None);
writer.Write (ResultCount.ToString () + " resultat");
if (ResultCount>1) writer.Write("s");
}
writer.Write (")"); writer.Write (")");
}
} }
} }

@ -58,7 +58,7 @@ namespace Yavsc.ApiControllers
public void Add(long id, string username) public void Add(long id, string username)
{ {
checkIsOwner (CircleManager.DefaultProvider.Get (id)); checkIsOwner (CircleManager.DefaultProvider.Get (id));
CircleManager.DefaultProvider.Add (id, username); CircleManager.DefaultProvider.AddMember (id, username);
} }
@ -88,7 +88,7 @@ namespace Yavsc.ApiControllers
CircleManager.DefaultProvider.RemoveMembership (id,username); CircleManager.DefaultProvider.RemoveMembership (id,username);
} }
private void checkIsOwner(Circle c) private void checkIsOwner(CircleBase c)
{ {
string user = Membership.GetUser ().UserName; string user = Membership.GetUser ().UserName;
if (c.Owner != user) if (c.Owner != user)
@ -103,7 +103,7 @@ namespace Yavsc.ApiControllers
AcceptVerbs ("GET")] AcceptVerbs ("GET")]
public Circle Get(long id) public Circle Get(long id)
{ {
var c = CircleManager.DefaultProvider.Get (id); var c = CircleManager.DefaultProvider.GetMembers (id);
checkIsOwner (c); checkIsOwner (c);
return c; return c;
} }
@ -113,11 +113,26 @@ namespace Yavsc.ApiControllers
/// </summary> /// </summary>
[Authorize, [Authorize,
AcceptVerbs ("GET")] AcceptVerbs ("GET")]
public IEnumerable<Circle> List() public IEnumerable<CircleBase> List()
{ {
string user = Membership.GetUser ().UserName; string user = Membership.GetUser ().UserName;
return CircleManager.DefaultProvider.List (user); return CircleManager.DefaultProvider.List (user);
} }
/// <summary>
/// List the circles
/// </summary>
[Authorize,
AcceptVerbs ("POST")]
public void Update(CircleBase circle)
{
string user = Membership.GetUser ().UserName;
CircleBase current = CircleManager.DefaultProvider.Get (circle.Id);
if (current.Owner != user)
throw new AuthorizationDenied ("Your not owner of circle at id "+circle.Id);
CircleManager.DefaultProvider.UpdateCircle (circle);
}
} }
} }

@ -29,7 +29,6 @@ main {
fieldset { fieldset {
background-color: rgba(32,16,16,0.8); background-color: rgba(32,16,16,0.8);
border-radius:5px; border: solid 1px #000060; border-radius:5px; border: solid 1px #000060;
float:left;
} }
video,img { video,img {
@ -69,27 +68,30 @@ footer {
border-radius:5px; border-radius:5px;
margin:.5em; margin:.5em;
padding: .5em; padding: .5em;
float:left;
} }
.bsh { float: right; }
#login { #appmenu {
margin: .5em; margin: .5em;
padding: .5em; padding: .5em;
border-radius:10px; border-radius:10px;
color: #ff8;
background-color: rgba(32,16,16,.6); background-color: rgba(32,16,16,.6);
position: fixed;
top:0;
right:0;
justify-content: space-around;
text-align: center;
max-width:40%;
font-size:75%;
} }
#login img { max-height:5em; max-width:5em; } #appmenu img { max-height:2em; max-width:2em; }
.hint {
display: inline;
font-style: italic;
}
.hint::before {
content: "(";
}
.hint::after {
content: ")";
}
header { header {
background-color:rgba(16,16,0,0.8); background-color:rgba(16,16,0,0.8);
top:0; top:0;
@ -221,7 +223,10 @@ a.actionlink img { top:4px; }
border-radius:25px; border-radius:25px;
font-size: smaller; font-size: smaller;
} }
.menuitem {
display: block;
}
.onhover { .onhover {
display:none; display:none;
position: absolute; position: absolute;
@ -241,7 +246,7 @@ a.actionlink img { top:4px; }
@media print { @media print {
body {background-color:white;color:black;} body {background-color:white;color:black;}
header,footer,.postcomment,.actionlink,.metablog,#login header,footer,.postcomment,.actionlink,.metablog,#appmenu
{ display:none;} { display:none;}
} }
@ -250,11 +255,24 @@ a.actionlink img { top:4px; }
.bsh { display: none; } .bsh { display: none; }
.c3 { display:initial; } .c3 { display:initial; }
.c3-alt { display:none; } .c3-alt { display:none; }
#appmenu {position: fixed;
top:0;
right:0;}
} }
@media all and (max-width: 640px) { @media all and (max-width: 640px) {
#appmenu {position:relative;}
.menuitem {
display: inline;
}
.menuitem:not(:last-child):after {
content:' |';
}
.bshpanel { cursor:zoom-in; } .bshpanel { cursor:zoom-in; }
footer { footer {
clear:both;
font-size: x-small; font-size: x-small;
} }
.c2 { display:initial; } .c2 { display:initial; }

@ -1,3 +1,44 @@
2015-09-10 Paul Schneider <paul@pschneider.fr>
* yavsc.js:
* yavsc.circles.js: js refactoring
* Credits.aspx: A credit about to add
* 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
2015-08-22 Paul Schneider <paul@pschneider.fr> 2015-08-22 Paul Schneider <paul@pschneider.fr>
* yavsc.js: factorize some javascript * yavsc.js: factorize some javascript

@ -14,6 +14,8 @@ using System.Web.Mvc;
using Yavsc.Model.Circles; using Yavsc.Model.Circles;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Text; using System.Text;
using System.Net;
using System.Configuration;
namespace Yavsc.Controllers namespace Yavsc.Controllers
{ {
@ -24,7 +26,39 @@ namespace Yavsc.Controllers
{ {
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> /// <summary>
/// Gets or sets the avatar dir. /// Gets or sets the avatar dir.
/// This value is past to <c>Server.MapPath</c>, /// This value is past to <c>Server.MapPath</c>,
@ -69,7 +103,17 @@ namespace Yavsc.Controllers
ViewData ["returnUrl"] = returnUrl; ViewData ["returnUrl"] = returnUrl;
return View (model); 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> /// <summary>
/// Login the specified returnUrl. /// Login the specified returnUrl.

@ -27,7 +27,6 @@ namespace Yavsc.Controllers
/// </summary> /// </summary>
public class BlogsController : Controller public class BlogsController : Controller
{ {
string defaultAvatarMimetype;
private string sitename = private string sitename =
WebConfigurationManager.AppSettings ["Name"]; WebConfigurationManager.AppSettings ["Name"];
string avatarDir = "~/avatars"; string avatarDir = "~/avatars";
@ -41,17 +40,7 @@ namespace Yavsc.Controllers
set { avatarDir = value; } 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> /// <summary>
/// Index the specified user, title, pageIndex and pageSize. /// Index the specified user, title, pageIndex and pageSize.
@ -256,7 +245,7 @@ namespace Yavsc.Controllers
ViewData ["UserName"] = un; ViewData ["UserName"] = un;
ViewData ["AllowedCircles"] = CircleManager.DefaultProvider.List (Membership.GetUser ().UserName).Select (x => new SelectListItem { ViewData ["AllowedCircles"] = CircleManager.DefaultProvider.List (Membership.GetUser ().UserName).Select (x => new SelectListItem {
Value = x.Id.ToString(), Value = x.Id.ToString(),
Text = YavscHelpers.FormatCircle(x).ToHtmlString() Text = x.Title
}); });
return View ("Edit", new BlogEntry { Title = title }); return View ("Edit", new BlogEntry { Title = title });
@ -325,36 +314,7 @@ namespace Yavsc.Controllers
return GetPost (model.PostId); 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> /// <summary>
/// Remove the specified blog entry, by its author and title, /// Remove the specified blog entry, by its author and title,

@ -13,6 +13,7 @@ using System.Web.Mvc;
using Yavsc.Model.Circles; using Yavsc.Model.Circles;
using System.Web.UI; using System.Web.UI;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Web.Profile;
namespace Yavsc.Helpers namespace Yavsc.Helpers
{ {
@ -162,6 +163,14 @@ namespace Yavsc.Helpers
foreach (MembershipUser u in users) foreach (MembershipUser u in users)
YavscHelpers.SendActivationMessage (u); YavscHelpers.SendActivationMessage (u);
} }
public static string AvatarUrl (this HtmlHelper helper, string username) {
ProfileBase pr = ProfileBase.Create (username);
string avpath = (string ) pr.GetPropertyValue("avatar") ;
if (avpath != null)
return helper.Encode (avpath);
return "/avatars/" + helper.Encode(username)+".png";
}
} }
} }

@ -12,6 +12,9 @@ ViewState["orgtitle"] = Html.Translate(Page.Title);
<link rel="stylesheet" href="~/App_Themes/style.css" /> <link rel="stylesheet" href="~/App_Themes/style.css" />
<link rel="icon" type="image/png" href="/favicon.png?v=3" /> <link rel="icon" type="image/png" href="/favicon.png?v=3" />
<script type="text/javascript" src="<%=Url.Content("~/Scripts/jquery-2.1.4.min.js")%>"></script> <script type="text/javascript" src="<%=Url.Content("~/Scripts/jquery-2.1.4.min.js")%>"></script>
<script type="text/javascript">
var apiBaseUrl = '<%=Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative)%>';
</script>
<asp:ContentPlaceHolder id="head" runat="server"> <asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder> </asp:ContentPlaceHolder>
<link href='http://fonts.googleapis.com/css?family=Dancing+Script:400,700' rel='stylesheet' type='text/css'/> <link href='http://fonts.googleapis.com/css?family=Dancing+Script:400,700' rel='stylesheet' type='text/css'/>
@ -32,28 +35,39 @@ ViewState["orgtitle"] = Html.Translate(Page.Title);
%><div class="message"><%= Html.Encode(ViewData["Message"]) %></div><% } %><div class="message"><%= Html.Encode(ViewData["Message"]) %></div><% }
%> %>
</header> </header>
<div id="appmenu" >
<% if (Membership.GetUser()==null) { %>
<div class="menuitem">
<%= Html.ActionLink("Authentification", "Login", "Account", new { returnUrl=Request.Url.PathAndQuery },null) %>
<div class="hint">Pour pouvoir publier</div>
</div>
<% } else { %><div class="menuitem">
<a href="/Blog/<%= HttpContext.Current.User.Identity.Name%>">
<img src="<%=Html.AvatarUrl(HttpContext.Current.User.Identity.Name)%>" width="25%" alt="vos posts" /></a>
<div class="hint">Votre Blog</div>
</div>
<div class="menuitem">
<%= Html.ActionLink(HttpContext.Current.User.Identity.Name, "Profile", "Account", new { id = HttpContext.Current.User.Identity.Name }, null) %>
<div class="hint"> &Eacute;dition de votre profile </div></div>
<div class="menuitem">
<a href="/Blogs/Post" >Poster</a>
<div class="hint">
&Eacute;dition d'un nouveau billet </div></div>
<div class="menuitem">
<%= Html.ActionLink( "Deconnexion", "Logout", "Account", new { returnUrl=Request.Url.PathAndQuery }, null) %>
<% } %>
</div>
</div>
<main> <main>
<asp:ContentPlaceHolder ID="MainContent" runat="server"> <asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder> </asp:ContentPlaceHolder>
</main> </main>
<asp:ContentPlaceHolder ID="MASContent" runat="server"> <asp:ContentPlaceHolder ID="MASContent" runat="server">
</asp:ContentPlaceHolder> </asp:ContentPlaceHolder>
<div id="login" ><span class="ohinside">
<a href="<%= Url.Content("~/")%>">
<span ><%=Html.Encode(YavscHelpers.SiteName) %></span></a><br/>
<span class="onhover">Page d'accueil<br/></span></span>
<% if (Membership.GetUser()==null) { %>
<div class="ohinside"><%= Html.ActionLink("Authentification", "Login", "Account", new { returnUrl=Request.Url.PathAndQuery },null) %>
<span class="onhover">Pourquoi s'authentifier?</span></div><br/>
<% } else { %>
<a href="/Blog/<%= HttpContext.Current.User.Identity.Name%>"><img src="/favicon.png" width="25%"/> Votre Blog</a><br/>
<span class="ohinside">
<%= Html.ActionLink(HttpContext.Current.User.Identity.Name, "Profile", "Account", new { id = HttpContext.Current.User.Identity.Name }, null) %>
<span class="onhover"> &Eacute;dition de votre profile </span></span><br/>
<a href="/Blogs/Post" class="ohafter">Poster</a>
<span class="onhover"> &Eacute;dition d'un nouveau billet </span><br/>
<%= Html.ActionLink( "Deconnexion", "Logout", "Account", new { returnUrl=Request.Url.PathAndQuery }, null) %>
<% } %></div>
<footer> <footer>
<script src="/Scripts/yavsc.js" async defer> <script src="/Scripts/yavsc.js" async defer>
<script src="https://apis.google.com/js/platform.js" defer> <script src="https://apis.google.com/js/platform.js" defer>
@ -68,9 +82,7 @@ ViewState["orgtitle"] = Html.Translate(Page.Title);
<% }} %> <% }} %>
<div class="g-plusone" data-annotation="inline" data-width="230"></div> <div class="g-plusone" data-annotation="inline" data-width="230"></div>
</footer> </footer>
<script type="text/javascript">
var apiBaseUrl = '<%=Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative)%>';
</script>
</body> </body>
</html> </html>

@ -0,0 +1,106 @@

var errspanid="msg";
var CirclesApiUrl = apiBaseUrl + "/Circle";
function editNewCircle() {
if ($('#fncirc').hasClass('hidden')) $('#fncirc').removeClass('hidden')
$('#lgdnvcirc').html("Creation d'un cercle");
$('#fncirc').removeClass("dirty");
$("#title").val( '' );
$('#btnnewcircle').show();
$('#btneditcircle').hide();
}
function selectCircle() {
if ($('#fncirc').hasClass('hidden')) $('#fncirc').removeClass('hidden')
var id = $(this).attr('cid');
$('#lgdnvcirc').html("Edition du cercle");
$('#btnnewcircle').hide();
$('#btneditcircle').show();
// get it from the server
$.getJSON(CirclesApiUrl+"/Get/"+id, function(json) {
$("#title").val( json.Title); });
$('#id').val(id);
$('#fncirc').removeClass("dirty");
}
function onCircleChanged()
{ $('#fncirc').addClass("dirty"); }
function removeCircle() {
Yavsc.message(false);
var id = $(this).attr('cid');
$.ajax({
url: CirclesApiUrl+"/Delete/"+id,
type: "GET",
success: function (data) {
// Drops the row
$("#c_"+id).remove();
},
statusCode: {
400: function(data) {
$.each(data.responseJSON, function (key, value) {
var errspanid = "Err_cr_" + value.key.replace("model.","");
var errspan = document.getElementById(errspanid);
if (errspan==null)
alert('enoent '+errspanid);
else
errspan.innerHTML=value.errors.join("<br/>");
});
}
},
error: function (xhr, ajaxOptions, thrownError) {
if (xhr.status!=400)
Yavsc.message(xhr.status+" : "+xhr.responseText);
else Yavsc.message(false);
}});
}
function modifyCircle() {
Yavsc.message(false);
var circle = { title: $("#title").val(), id: $('#id').val(), isprivate: $('#isprivate').val() } ;
}
function addCircle()
{
Yavsc.message(false);
var circle = { title: $("#title").val() } ;
$("#title").text('');
$.ajax({
url: CirclesApiUrl+"/Create",
type: "POST",
data: circle,
success: function (id) {
// Adds a node rendering the new circle
$('<tr id="c_'+id+'"/>').addClass('selected row')
.appendTo('#tbcb');
$('<td>'+circle.title+' <br><i>'+
circle.members+
'</i></td></td>')
.appendTo('#c_'+id);
$('<td><input class="btnremovecircle actionlink" cid="'+id+'" type="button" value="Remove" onclick="removeCircle"></td>').appendTo('#c_'+id);
},
statusCode: {
400: function(data) {
$.each(data.responseJSON, function (key, value) {
var errspanid = "Err_cr_" + value.key.replace("model.","");
var errspan = document.getElementById(errspanid);
if (errspan==null)
alert('enoent '+errspanid);
else
errspan.innerHTML=value.errors.join("<br/>");
});
}
},
error: function (xhr, ajaxOptions, thrownError) {
if (xhr.status!=400)
Yavsc.message(xhr.status+" : "+xhr.responseText);
else Yavsc.message(false);
}});
}

@ -1,6 +1,9 @@
 var Yavsc = (function(apiBaseUrl){
var self = {};
function showHide() { self.apiBaseUrl = (apiBaseUrl || '/api');
self.showHide = function () {
var id = $(this).attr('did'); var id = $(this).attr('did');
var target = $('#'+id); var target = $('#'+id);
if (target.hasClass('hidden')) { if (target.hasClass('hidden')) {
@ -13,11 +16,14 @@ function showHide() {
target.addClass('hidden'); target.addClass('hidden');
$(this).html(this.oldhtml); $(this).html(this.oldhtml);
} }
} };
function message(msg) { self.message = function (msg) {
if (msg) { if (msg) {
$("#msg").removeClass("hidden"); $("#msg").removeClass("hidden");
$("#msg").text(msg); $("#msg").text(msg);
} else { $("#msg").addClass("hidden"); } } } else { $("#msg").addClass("hidden"); } };
return self;
})();

@ -14,9 +14,10 @@
</thead> </thead>
<tbody id="tbcb"> <tbody id="tbcb">
<% int lc=0; <% int lc=0;
foreach (var ci in (IEnumerable<Circle>) ViewData["Circles"]) { lc++; %> foreach (var ci in (IEnumerable<CircleBase>) ViewData["Circles"]) { lc++; %>
<tr class="<%= (lc%2==0)?"even ":"odd " %>row" id="c_<%=ci.Id%>"> <tr class="<%= (lc%2==0)?"even ":"odd " %>row" id="c_<%=ci.Id%>">
<td cid="<%=ci.Id%>" style="cursor: pointer;" class="btnselcircle" ><%=Html.FormatCircle(ci)%></td> <td cid="<%=ci.Id%>" style="cursor: pointer;" class="btnselcircle" >
<%=ci.Title%></td>
<td> <td>
<input type="button" value="<%=Html.Translate("Remove")%>" <input type="button" value="<%=Html.Translate("Remove")%>"
class="btnremovecircle actionlink" cid="<%=ci.Id%>"/> class="btnremovecircle actionlink" cid="<%=ci.Id%>"/>
@ -42,149 +43,35 @@ $("#tbc").stupidtable();
<fieldset> <fieldset>
<legend id="lgdnvcirc"></legend> <legend id="lgdnvcirc"></legend>
<span id="msg" class="field-validation-valid error"></span> <span id="msg" class="field-validation-valid error"></span>
<label for="title"><b><%=Html.Translate("Title")%></b></label> <label for="title"><b><%=Html.Translate("Title")%></b></label>
<input type="text" id="title" name="title" class="inputtext" onchange="onTitleChanged"/> <input type="text" id="title" name="title" class="inputtext" onchange="onCircleChanged"/>
<span id="Err_cr_title" class="field-validation-valid error"></span> <span id="Err_cr_title" class="field-validation-valid error"></span>
<table id="tbmbrs">
<thead>
<tr>
<th data-sort="string"><%=Html.Translate("Members")%>
<span id="Err_cr_users" class="field-validation-valid error"></span>
<yavsc:InputUserName
id="users"
name="users"
emptyvalue="[aucun]"
onchange="onmembersChange(this.value);"
multiple="true"
runat="server" >
</yavsc:InputUserName>
</th>
</tr>
</thead>
<tbody id="tbmbrsb">
</tbody>
</table>
<input type="button" id="btnnewcircle" value="<%=Html.Translate("Create")%>" class="actionlink rowbtnct" />
</fieldset>
</form>
<label for="isprivate"><b><%=Html.Translate("Private circle")%></b></label>
<input type="checkbox" name="isprivate" id="isprivate" onchange="onCircleChanged" />
<input type="button" id="btnnewcircle"
value="<%=Html.Translate("Create")%>" class="actionlink rowbtnct" />
<input type="button" id="btneditcircle"
value="<%=Html.Translate("Modify")%>" class="actionlink rowbtnct" />
<input type="hidden" name="id" id="id" />
</fieldset>
</form>
</div> </div>
</div> </div>
<script type="text/javascript" src="<%=Url.Content("~/Scripts/yavsc.circles.js")%>" >
</script>
<script type="text/javascript">
<script>
var cformhidden=true;
var errspanid="msg";
function getCircle(id)
{
$.getJSON("<%=Url.Content("~/api/Circle/Get/")%>"+id,
function(json) { $("#title").val( json.Title); $("#users").val( json.Members ) ; });
}
function editNewCircle() {
if ($('#fncirc').hasClass('hidden')) $('#fncirc').removeClass('hidden')
$('#lgdnvcirc').html("Creation d'un cercle");
$('#btnnewcircle').val("Créer");
$('#fncirc').removeClass("dirty");
}
function selectCircle() {
if ($('#fncirc').hasClass('hidden')) $('#fncirc').removeClass('hidden')
var id = $(this).attr('cid');
$('#lgdnvcirc').html("Edition du cercle");
$('#btnnewcircle').val("Modifier");
// get it from the server
getCircle(id);
$('#fncirc').removeClass("dirty");
}
function onmembersChange(newval)
{$('#fncirc').addClass("dirty");}
function onTitleChanged()
{ $('#fncirc').addClass("dirty"); }
function removeCircle() {
message(false);
var id = $(this).attr('cid');
$.ajax({
url: "<%=Url.Content("~/api/Circle/Delete/")%>"+id,
type: "GET",
success: function (data) {
// Drops the row
$("#c_"+id).remove();
},
statusCode: {
400: function(data) {
$.each(data.responseJSON, function (key, value) {
var errspanid = "Err_cr_" + value.key.replace("model.","");
var errspan = document.getElementById(errspanid);
if (errspan==null)
alert('enoent '+errspanid);
else
errspan.innerHTML=value.errors.join("<br/>");
});
}
},
error: function (xhr, ajaxOptions, thrownError) {
if (xhr.status!=400)
message(xhr.status+" : "+xhr.responseText);
else message(false);
}});
}
function addCircle()
{
message(false);
var circle = { title: $("#title").val(), members: $("#users").val() } ;
$("#title").text('');
$("#users").val('');
$.ajax({
url: "<%=Url.Content("~/api/Circle/Create")%>",
type: "POST",
data: circle,
success: function (id) {
// Adds a node rendering the new circle
$('<tr id="c_'+id+'"/>').addClass('selected row')
.appendTo('#tbcb');
$('<td>'+circle.title+' <br><i>'+
circle.members+
'</i></td></td>')
.appendTo('#c_'+id);
$('<td><input class="btnremovecircle actionlink" cid="'+id+'" type="button" value="Remove" onclick="removeCircle"></td>').appendTo('#c_'+id);
},
statusCode: {
400: function(data) {
$.each(data.responseJSON, function (key, value) {
var errspanid = "Err_cr_" + value.key.replace("model.","");
var errspan = document.getElementById(errspanid);
if (errspan==null)
alert('enoent '+errspanid);
else
errspan.innerHTML=value.errors.join("<br/>");
});
}
},
error: function (xhr, ajaxOptions, thrownError) {
if (xhr.status!=400)
message(xhr.status+" : "+xhr.responseText);
else message(false);
}});
}
$(document).ready(function () { $(document).ready(function () {
$('#btednvcirc').click(editNewCircle); $('#btednvcirc').click(editNewCircle);
$("#btnnewcircle").click(addCircle); $("#btnnewcircle").click(addCircle);
$("#btneditcircle").click(modifyCircle);
$(".btnremovecircle").click(removeCircle); $(".btnremovecircle").click(removeCircle);
$(".btnselcircle").click(selectCircle); $(".btnselcircle").click(selectCircle);
}); });
</script> </script>
</asp:Content> </asp:Content>

@ -17,144 +17,95 @@ table.layout TR TD { max-width:40%; }
<fieldset><legend>Informations publiques</legend> <fieldset><legend>Informations publiques</legend>
<table class="layout">
<tr><td align="right" style=""> <%= Html.LabelFor(model => model.Name) %> :
<%= Html.LabelFor(model => model.Name) %></td><td>
<%= Html.TextBox("Name") %> <%= Html.TextBox("Name") %>
<%= Html.ValidationMessage("Name", "*") %></td></tr> <%= Html.ValidationMessage("Name", "*") %>
<br>
<tr><td align="right"> <%= Html.LabelFor(model => model.WebSite) %> :
<%= Html.LabelFor(model => model.WebSite) %></td><td>
<%= Html.TextBox("WebSite") %> <%= Html.TextBox("WebSite") %>
<%= Html.ValidationMessage("WebSite", "*") %></td></tr> <%= Html.ValidationMessage("WebSite", "*") %>
<br>
<tr><td align="right"> Avatar : <img class="avatar" src="<%=Model.avatar%>?version=<%=Html.Encode(DateTime.Now.ToString())%>" alt=""/>
Avatar </td><td> <img class="avatar" src="<%=Model.avatar%>?version=<%=Html.Encode(DateTime.Now.ToString())%>" alt=""/>
<input type="file" id="AvatarFile" name="AvatarFile"/> <input type="file" id="AvatarFile" name="AvatarFile"/>
<%= Html.ValidationMessage("AvatarFile", "*") %></td></tr> <%= Html.ValidationMessage("AvatarFile", "*") %>
</table>
</fieldset> </fieldset>
<fieldset><legend>Blog</legend> <fieldset><legend>Blog</legend>
<table class="layout">
<tr><td align="right"> <%= Html.LabelFor(model => model.BlogVisible) %> :
<%= Html.LabelFor(model => model.BlogVisible) %></td><td>
<%= Html.CheckBox("BlogVisible") %> <%= Html.CheckBox("BlogVisible") %>
<%= Html.ValidationMessage("BlogVisible", "*") %></td></tr> <%= Html.ValidationMessage("BlogVisible", "*") %>
<tr><td align="right"> <br>
<%= Html.LabelFor(model => model.BlogTitle) %></td><td>
<%= Html.LabelFor(model => model.BlogTitle) %> :
<%= Html.TextBox("BlogTitle") %> <%= Html.TextBox("BlogTitle") %>
<%= Html.ValidationMessage("BlogTitle", "*") %></td></tr> <%= Html.ValidationMessage("BlogTitle", "*") %>
</table>
</fieldset> </fieldset>
<fieldset><legend>Contact</legend> <fieldset><legend>Contact</legend>
<table class="layout">
<tr><td align="right"> <%= Html.LabelFor(model => model.Phone) %>
<%= Html.LabelFor(model => model.Phone) %></td><td>
<%= Html.TextBox("Phone") %> <%= Html.TextBox("Phone") %>
<%= Html.ValidationMessage("Phone", "*") %></td></tr> <%= Html.ValidationMessage("Phone", "*") %>
<tr><td align="right">
<%= Html.LabelFor(model => model.Mobile) %></td><td> <%= Html.LabelFor(model => model.Mobile) %>
<%= Html.TextBox("Mobile") %> <%= Html.TextBox("Mobile") %>
<%= Html.ValidationMessage("Mobile", "*") %></td></tr> <%= Html.ValidationMessage("Mobile", "*") %>
<tr><td align="right">
<%= Html.LabelFor(model => model.Address) %></td><td> <%= Html.LabelFor(model => model.Address) %>
<%= Html.TextBox("Address") %> <%= Html.TextBox("Address") %>
<%= Html.ValidationMessage("Address", "*") %></td></tr> <%= Html.ValidationMessage("Address", "*") %>
<tr><td align="right">
<%= Html.LabelFor(model => model.CityAndState) %></td><td> <%= Html.LabelFor(model => model.CityAndState) %>
<%= Html.TextBox("CityAndState") %> <%= Html.TextBox("CityAndState") %>
<%= Html.ValidationMessage("CityAndState", "*") %></td></tr> <%= Html.ValidationMessage("CityAndState", "*") %>
<tr><td align="right">
<%= Html.LabelFor(model => model.ZipCode) %></td><td> <%= Html.LabelFor(model => model.ZipCode) %>
<%= Html.TextBox("ZipCode") %> <%= Html.TextBox("ZipCode") %>
<%= Html.ValidationMessage("ZipCode", "*") %></td></tr> <%= Html.ValidationMessage("ZipCode", "*") %>
<tr><td align="right">
<%= Html.LabelFor(model => model.Country) %></td><td> <%= Html.LabelFor(model => model.Country) %>
<%= Html.TextBox("Country") %> <%= Html.TextBox("Country") %>
<%= Html.ValidationMessage("Country", "*") %></td></tr> <%= Html.ValidationMessage("Country", "*") %>
</table>
</fieldset> </fieldset>
<fieldset><legend>Disponibilité</legend> <fieldset><legend>Disponibilité</legend>
<table class="layout">
<tr><td align="right">
<%= Html.LabelFor(model => model.GoogleCalendar) %> : <%= Html.LabelFor(model => model.GoogleCalendar) %> :
</td>
<td> <%= Html.Encode(Model.GoogleCalendar) %>
<%= Html.ActionLink("Choisir l'agenda","ChooseCalendar","Google",new { returnUrl= Request.Url.AbsolutePath }, new { @class="actionlink" }) %>
</td>
</tr>
</table>
<%= Html.Encode(Model.GoogleCalendar) %>
<%= Html.ActionLink("Choisir l'agenda","ChooseCalendar","Google",new { returnUrl= Request.Url.AbsolutePath }, new { @class="actionlink" }) %>
</fieldset> </fieldset>
<fieldset><legend>Informations de facturation</legend> <fieldset><legend>Informations de facturation</legend>
<table class="layout"> <%= Html.LabelFor(model => model.BankCode) %> :
<tr>
<td align="right">
<%= Html.LabelFor(model => model.BankCode) %>
</td>
<td>
<%= Html.TextBox("BankCode") %> <%= Html.TextBox("BankCode") %>
<%= Html.ValidationMessage("BankCode", "*") %> <%= Html.ValidationMessage("BankCode", "*") %>
</td> <br>
</tr>
<tr> <%= Html.LabelFor(model => model.WicketCode) %> :
<td align="right">
<%= Html.LabelFor(model => model.WicketCode) %></td>
<td>
<%= Html.TextBox("WicketCode") %> <%= Html.TextBox("WicketCode") %>
<%= Html.ValidationMessage("WicketCode", "*") %> <%= Html.ValidationMessage("WicketCode", "*") %>
</td> <br>
</tr>
<tr> <%= Html.LabelFor(model => model.AccountNumber) %> :
<td align="right">
<%= Html.LabelFor(model => model.AccountNumber) %></td>
<td>
<%= Html.TextBox("AccountNumber") %> <%= Html.TextBox("AccountNumber") %>
<%= Html.ValidationMessage("AccountNumber", "*") %> <%= Html.ValidationMessage("AccountNumber", "*") %>
</td> <br>
</tr> <%= Html.LabelFor(model => model.BankedKey) %> :
<tr>
<td align="right">
<%= Html.LabelFor(model => model.BankedKey) %></td>
<td>
<%= Html.TextBox("BankedKey") %> <%= Html.TextBox("BankedKey") %>
<%= Html.ValidationMessage("BankedKey", "*") %> <%= Html.ValidationMessage("BankedKey", "*") %>
</td> <br>
</tr> <%= Html.LabelFor(model => model.BIC) %> :
<tr>
<td align="right">
<%= Html.LabelFor(model => model.BIC) %></td>
<td>
<%= Html.TextBox("BIC") %> <%= Html.TextBox("BIC") %>
<%= Html.ValidationMessage("BIC", "*") %> <%= Html.ValidationMessage("BIC", "*") %>
</td> <br>
</tr> <%= Html.LabelFor(model => model.IBAN) %> :
<tr>
<td align="right">
<%= Html.LabelFor(model => model.IBAN) %></td>
<td>
<%= Html.TextBox("IBAN") %> <%= Html.TextBox("IBAN") %>
<%= Html.ValidationMessage("IBAN", "*") %> <%= Html.ValidationMessage("IBAN", "*") %>
</td>
</tr>
</table>
</fieldset> </fieldset>
<input type="submit"/> <input type="submit"/>

@ -28,7 +28,9 @@ le <%=p.Posted.ToString("D") %>
<form runat="server" id="form1" method="GET"> <form runat="server" id="form1" method="GET">
<% rp1.ResultCount = Model.Count; rp1.ResultsPerPage = 50; %> <% rp1.ResultCount = Model.Count; rp1.ResultsPerPage = 50; %>
<% rp1.CurrentPage = (int) ViewData["PageIndex"]; %> <% rp1.CurrentPage = (int) ViewData["PageIndex"]; %>
<yavsc:ResultPages id="rp1" Action = "?pageIndex={0}" runat="server" ></yavsc:ResultPages> <% rp1.None = Html.Translate("no content"); %>
<yavsc:ResultPages id="rp1" Action = "?pageIndex={0}" runat="server" >
</yavsc:ResultPages>
</form> </form>
</asp:Content> </asp:Content>

@ -0,0 +1,14 @@
<%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="initContent" ContentPlaceHolderID="init" runat="server">
</asp:Content>
<asp:Content ID="headContent" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="overHeaderOneContent" ContentPlaceHolderID="overHeaderOne" runat="server">
</asp:Content>
<asp:Content ID="headerContent" ContentPlaceHolderID="header" runat="server">
</asp:Content>
<asp:Content ID="MainContentContent" ContentPlaceHolderID="MainContent" runat="server">
<div>Icons made by <a href="http://www.flaticon.com/authors/vectorgraphit" title="Vectorgraphit">Vectorgraphit</a> from <a href="http://www.flaticon.com" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0">CC BY 3.0</a></div>
</asp:Content>
<asp:Content ID="MASContentContent" ContentPlaceHolderID="MASContent" runat="server">
</asp:Content>

@ -116,6 +116,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
<add name="NpgsqlProfileProvider" type="Npgsql.Web.NpgsqlProfileProvider, NpgsqlMRPProviders" connectionStringName="yavsc" applicationName="/" description="ProfileProvider for yavsc" /> <add name="NpgsqlProfileProvider" type="Npgsql.Web.NpgsqlProfileProvider, NpgsqlMRPProviders" connectionStringName="yavsc" applicationName="/" description="ProfileProvider for yavsc" />
</providers> </providers>
<properties> <properties>
<add name="avatar" />
<add name="BlogVisible" type="System.Boolean" /> <add name="BlogVisible" type="System.Boolean" />
<add name="Address" /> <add name="Address" />
<add name="BlogTitle" /> <add name="BlogTitle" />
@ -136,7 +137,6 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
<add name="grefreshtoken" /> <add name="grefreshtoken" />
<add name="gtokentype" /> <add name="gtokentype" />
<add name="gtokenexpir" /> <add name="gtokenexpir" />
<add name="avatar" />
<add name="gcalapi" /> <add name="gcalapi" />
<add name="gcalid" /> <add name="gcalid" />
<add name="gregid" /> <add name="gregid" />

@ -337,6 +337,8 @@
<Content Include="Scripts\jquery-2.1.4.min.js" /> <Content Include="Scripts\jquery-2.1.4.min.js" />
<Content Include="Scripts\MarkdownDeepLib.min.js" /> <Content Include="Scripts\MarkdownDeepLib.min.js" />
<Content Include="Scripts\yavsc.js" /> <Content Include="Scripts\yavsc.js" />
<Content Include="Scripts\yavsc.circles.js" />
<Content Include="Views\Home\Credits.aspx" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" /> <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

@ -648,31 +648,34 @@ CREATE TABLE histowritting
WITH ( WITH (
OIDS=FALSE OIDS=FALSE
); );
-- Table: circle -- Table: circle
-- DROP TABLE circle; -- DROP TABLE circle;
CREATE TABLE circle CREATE TABLE circle
( (
_id bigserial NOT NULL, -- Circle identifier _id bigserial NOT NULL, -- Circle identifier
owner character varying(255) NOT NULL, -- creator of this circle owner character varying(255) NOT NULL, -- creator of this circle
applicationname character varying(255) NOT NULL, -- Application name applicationname character varying(255) NOT NULL, -- Application name
title character varying(512) NOT NULL, title character varying(512) NOT NULL,
public boolean default FALSE, -- true when this circle is a public circle, from which the title would be available from an anonymous access to the owner's profile public boolean DEFAULT false, -- true when this circle is a public circle, from which the title would be available from an anonymous access to the owner's profile
CONSTRAINT circle_pkey PRIMARY KEY (_id), CONSTRAINT circle_pkey PRIMARY KEY (_id),
CONSTRAINT circle_owner_fkey FOREIGN KEY (owner, applicationname) CONSTRAINT circle_owner_fkey FOREIGN KEY (owner, applicationname)
REFERENCES users (username, applicationname) MATCH SIMPLE REFERENCES users (username, applicationname) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE, ON UPDATE CASCADE ON DELETE CASCADE,
CONSTRAINT circle_owner_title_key UNIQUE (owner, title) CONSTRAINT circle_owner_applicationname_title_key UNIQUE (owner, applicationname, title)
) )
WITH ( WITH (
OIDS=FALSE OIDS=FALSE
); );
ALTER TABLE circle
OWNER TO yavscdev;
COMMENT ON COLUMN circle._id IS 'Circle identifier'; COMMENT ON COLUMN circle._id IS 'Circle identifier';
COMMENT ON COLUMN circle.owner IS 'creator of this circle'; COMMENT ON COLUMN circle.owner IS 'creator of this circle';
COMMENT ON COLUMN circle.applicationname IS 'Application name'; COMMENT ON COLUMN circle.applicationname IS 'Application name';
COMMENT ON COLUMN circle.public IS 'true when this circle is a public circle, from which the title would be available from an anonymous access to the owner''s profile'; COMMENT ON COLUMN circle.public IS 'true when this circle is a public circle, from which the title would be available from an anonymous access to the owner''s profile';
-- Table: circle_members -- Table: circle_members
-- DROP TABLE circle_members; -- DROP TABLE circle_members;

@ -1,3 +1,21 @@
2015-09-10 Paul Schneider <paul@pschneider.fr>
* CircleBase.cs: The Circle base
* 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
2015-08-22 Paul Schneider <paul@pschneider.fr> 2015-08-22 Paul Schneider <paul@pschneider.fr>
* LocalizedText.Designer.cs: alphabetic order in ressource * LocalizedText.Designer.cs: alphabetic order in ressource

@ -26,24 +26,9 @@ namespace Yavsc.Model.Circles
/// <summary> /// <summary>
/// Circle. /// Circle.
/// </summary> /// </summary>
public class Circle public class Circle : CircleBase
{ {
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
public long Id { get; set; }
/// <summary>
/// Gets or sets the title.
/// </summary>
/// <value>The title.</value>
public string Title { get; set; }
/// <summary>
/// Gets or sets the owner.
/// </summary>
/// <value>The owner.</value>
public string Owner { get; set; }
/// <summary> /// <summary>
/// Gets or sets the users. /// Gets or sets the users.
@ -67,11 +52,6 @@ namespace Yavsc.Model.Circles
} }
return content.ToArray (); return content.ToArray ();
} }
/// <summary>
/// Gets or sets a value indicating whether this instance is private.
/// </summary>
/// <value><c>true</c> if this instance is private; otherwise, <c>false</c>.</value>
public bool IsPrivate { get; set; }
} }
} }

@ -0,0 +1,56 @@
//
// CircleBase.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;
namespace Yavsc.Model.Circles
{
public class CircleBase
{
public CircleBase ()
{
}
/// <summary>
/// Gets or sets the owner.
/// </summary>
/// <value>The owner.</value>
public string Owner { get; set; }
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
public long Id { get; set; }
/// <summary>
/// Gets or sets the title.
/// </summary>
/// <value>The title.</value>
public string Title { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is private.
/// </summary>
/// <value><c>true</c> if this instance is private; otherwise, <c>false</c>.</value>
public bool IsPrivate { get; set; }
}
}

@ -48,7 +48,7 @@ namespace Yavsc.Model.Circles
/// </summary> /// </summary>
/// <param name="id">circle Identifier.</param> /// <param name="id">circle Identifier.</param>
/// <param name="username">User name.</param> /// <param name="username">User name.</param>
public abstract void Add(long id, string username); public abstract void AddMember(long id, string username);
/// <summary> /// <summary>
/// Delete the specified circle by its id. /// Delete the specified circle by its id.
@ -57,15 +57,21 @@ namespace Yavsc.Model.Circles
public abstract void Delete(long id) ; public abstract void Delete(long id) ;
/// <summary> /// <summary>
/// Get the specified id. /// Get the specified circle by id, including all of its members.
/// </summary> /// </summary>
/// <param name="id">Identifier.</param> /// <param name="id">Identifier.</param>
public abstract Circle Get(long id); public abstract Circle GetMembers(long id);
/// <summary>
/// Get the specified circle by id.
/// </summary>
/// <param name="id">Identifier.</param>
public abstract CircleBase Get (long id);
public abstract long GetId (string circle, string username);
/// <summary> /// <summary>
/// List circle's user. /// List circle's user.
/// </summary> /// </summary>
public abstract IEnumerable<Circle> List(string user); public abstract IEnumerable<CircleBase> List(string user);
/// <summary> /// <summary>
/// True when the specified user is listed in one of /// True when the specified user is listed in one of
@ -88,6 +94,12 @@ namespace Yavsc.Model.Circles
/// <param name="member">Member.</param> /// <param name="member">Member.</param>
public abstract void RemoveMember(string member); public abstract void RemoveMember(string member);
/// <summary>
/// Updates the circle.
/// </summary>
/// <param name="c">C.</param>
public abstract void UpdateCircle(CircleBase c);
} }
} }

@ -112,6 +112,12 @@ namespace Yavsc.Model {
} }
} }
public static string no_content {
get {
return ResourceManager.GetString("no_content", resourceCulture);
}
}
public static string DuplicateEmail { public static string DuplicateEmail {
get { get {
return ResourceManager.GetString("DuplicateEmail", resourceCulture); return ResourceManager.GetString("DuplicateEmail", resourceCulture);
@ -124,9 +130,9 @@ namespace Yavsc.Model {
} }
} }
public static string Pdf_version { public static string Modify {
get { get {
return ResourceManager.GetString("Pdf_version", resourceCulture); return ResourceManager.GetString("Modify", resourceCulture);
} }
} }
@ -232,9 +238,9 @@ namespace Yavsc.Model {
} }
} }
public static string Remember_me { public static string Private_circle {
get { get {
return ResourceManager.GetString("Remember_me", resourceCulture); return ResourceManager.GetString("Private_circle", resourceCulture);
} }
} }
@ -262,15 +268,21 @@ namespace Yavsc.Model {
} }
} }
public static string Remember_me {
get {
return ResourceManager.GetString("Remember_me", resourceCulture);
}
}
public static string Remove { public static string Remove {
get { get {
return ResourceManager.GetString("Remove", resourceCulture); return ResourceManager.GetString("Remove", resourceCulture);
} }
} }
public static string was_added_to_the_role { public static string none {
get { get {
return ResourceManager.GetString("was_added_to_the_role", resourceCulture); return ResourceManager.GetString("none", resourceCulture);
} }
} }
@ -334,6 +346,12 @@ namespace Yavsc.Model {
} }
} }
public static string Pdf_version {
get {
return ResourceManager.GetString("Pdf_version", resourceCulture);
}
}
public static string Item_added_to_basket { public static string Item_added_to_basket {
get { get {
return ResourceManager.GetString("Item_added_to_basket", resourceCulture); return ResourceManager.GetString("Item_added_to_basket", resourceCulture);
@ -357,5 +375,11 @@ namespace Yavsc.Model {
return ResourceManager.GetString("entries", resourceCulture); return ResourceManager.GetString("entries", resourceCulture);
} }
} }
public static string was_added_to_the_role {
get {
return ResourceManager.GetString("was_added_to_the_role", resourceCulture);
}
}
} }
} }

@ -46,6 +46,12 @@ namespace Yavsc.Model {
} }
} }
public static string was_added_to_the_empty_role {
get {
return ResourceManager.GetString("was_added_to_the_empty_role", resourceCulture);
}
}
public static string Bill_edition { public static string Bill_edition {
get { get {
return ResourceManager.GetString("Bill_edition", resourceCulture); return ResourceManager.GetString("Bill_edition", resourceCulture);
@ -88,9 +94,9 @@ namespace Yavsc.Model {
} }
} }
public static string was_added_to_the_empty_role { public static string Title {
get { get {
return ResourceManager.GetString("was_added_to_the_empty_role", resourceCulture); return ResourceManager.GetString("Title", resourceCulture);
} }
} }
@ -112,6 +118,12 @@ namespace Yavsc.Model {
} }
} }
public static string no_content {
get {
return ResourceManager.GetString("no_content", resourceCulture);
}
}
public static string DocTemplateException { public static string DocTemplateException {
get { get {
return ResourceManager.GetString("DocTemplateException", resourceCulture); return ResourceManager.GetString("DocTemplateException", resourceCulture);
@ -124,9 +136,9 @@ namespace Yavsc.Model {
} }
} }
public static string Title { public static string Modify {
get { get {
return ResourceManager.GetString("Title", resourceCulture); return ResourceManager.GetString("Modify", resourceCulture);
} }
} }
@ -262,6 +274,12 @@ namespace Yavsc.Model {
} }
} }
public static string none {
get {
return ResourceManager.GetString("none", resourceCulture);
}
}
public static string Estimate_not_found { public static string Estimate_not_found {
get { get {
return ResourceManager.GetString("Estimate_not_found", resourceCulture); return ResourceManager.GetString("Estimate_not_found", resourceCulture);

@ -14,6 +14,9 @@
</resheader> </resheader>
<data name="Count"><value>Nombre</value></data> <data name="Count"><value>Nombre</value></data>
<data name="Ciffer"><value>Chiffre</value></data> <data name="Ciffer"><value>Chiffre</value></data>
<data name="none"><value>aucun(e)</value></data>
<data name="Modify"><value>Modifier</value></data>
<data name="no_content"><value>pas de contenu</value></data>
<data name="Title"><value>Titre</value></data> <data name="Title"><value>Titre</value></data>
<data name="Description"><value>Description</value></data> <data name="Description"><value>Description</value></data>
<data name="Product_reference"><value>Référence produit</value></data> <data name="Product_reference"><value>Référence produit</value></data>

@ -42,12 +42,17 @@
<data name="Members"><value>Members</value></data> <data name="Members"><value>Members</value></data>
<data name="Message_sent"><value>Your message has been sent.</value></data> <data name="Message_sent"><value>Your message has been sent.</value></data>
<data name="MinDate"><value>Minimal date for the rendez-vous</value></data> <data name="MinDate"><value>Minimal date for the rendez-vous</value></data>
<data name="Modify"><value>Modify</value></data>
<data name="My_Estimates"><value>My estimates</value></data> <data name="My_Estimates"><value>My estimates</value></data>
<data name="none"><value>none</value></data>
<data name="no_content"><value>no content</value></data>
<data name="Not_Approuved"><value>Not Approuved</value></data> <data name="Not_Approuved"><value>Not Approuved</value></data>
<data name="Online"><value>Online</value></data> <data name="Online"><value>Online</value></data>
<data name="Offline"><value>Offline</value></data> <data name="Offline"><value>Offline</value></data>
<data name="Pdf_version"><value>Pdf version</value></data> <data name="Pdf_version"><value>Pdf version</value></data>
<data name="Preview"><value>Preview</value><comment>comment on preview</comment></data> <data name="Preview"><value>Preview</value><comment>comment on preview</comment></data>
<data name="Private_circle"><value>Private circle</value></data>
<data name="ProviderId"><value>Provider identifier</value></data> <data name="ProviderId"><value>Provider identifier</value></data>
<data name="ProviderName"><value>Provider name</value></data> <data name="ProviderName"><value>Provider name</value></data>
<data name="Product_reference"><value>Product_reference</value></data> <data name="Product_reference"><value>Product_reference</value></data>
@ -65,4 +70,5 @@
<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="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> <data name="Welcome"><value>Welcome</value><comment></comment></data>
<data name="younotadmin"><value>You're not administrator</value></data> <data name="younotadmin"><value>You're not administrator</value></data>
</root> </root>

@ -166,6 +166,7 @@
<Compile Include="Blogs\PostNotFoundException.cs" /> <Compile Include="Blogs\PostNotFoundException.cs" />
<Compile Include="RolesAndMembers\ChangeUserNameProvider.cs" /> <Compile Include="RolesAndMembers\ChangeUserNameProvider.cs" />
<Compile Include="RolesAndMembers\UserManager.cs" /> <Compile Include="RolesAndMembers\UserManager.cs" />
<Compile Include="Circles\CircleBase.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup> <ItemGroup>

Loading…