Fixes profile edition,

refactoring profile property names, because of
of weird NpgsqlException about the property group name.

* style.css: more space

* Web.config:
* YavscHelpers.cs:
* OAuth2.cs:
* AccountController.cs:
* Profile.cs: refactoring

* BlogsController.cs: A new page, to become a media chooser

* App.master: nice small parralax.js, could work on android browers

* Web.config: unix line endings
This commit is contained in:
Paul Schneider
2015-10-01 22:38:47 +02:00
parent 501199ed70
commit 5f40448890
11 changed files with 131 additions and 75 deletions

View File

@ -16,41 +16,43 @@ input, textarea, checkbox {
header { header {
border-radius:10px; border-radius:10px;
margin: .5em; margin: 1em;
padding: .5em; padding: 3em;
padding-top: 5em;
display: block; display: block;
background: url("/images/helix-nebula-1400x1400.s.jpg") 50% 0 repeat fixed; background: url("/images/helix-nebula-1400x1400.s.jpg") 50% 0 repeat fixed;
min-height: 25em; min-height: 10em;
} }
nav { nav {
border-radius:10px; border-radius:10px;
margin: .5em; margin: 1em;
padding: .5em; padding: 1em;
display: block; display: block;
background: url("/images/live-concert-388160_1280.s.jpg") 50% 0 repeat fixed ; background: url("/images/live-concert-388160_1280.s.jpg") 50% 0 repeat fixed ;
min-height: 25em; min-height: 10em;
} }
main { main {
border-radius:10px; border-radius:10px;
margin: .5em; margin: 1em;
padding: .5em; padding: 1em;
display: block; display: block;
background: url("/images/musician-923526_1280.s.jpg") 50% 0 repeat fixed ; background: url("/images/musician-923526_1280.s.jpg") 50% 0 repeat fixed ;
min-height: 25em; min-height: 10em;
} }
footer { footer {
border-radius:10px; border-radius:10px;
margin: .5em; margin: 1em;
padding: .5em; padding: 1em;
display: block; display: block;
background: url("/images/drummer-652345_1280.s.jpg") 50% 0 repeat fixed ; background: url("/images/drummer-652345_1280.s.jpg") 50% 0 repeat fixed ;
min-height: 25em; min-height: 10em;
clear: both; clear: both;
display: flex; display: flex;
font-size: smaller; font-size: smaller;
justify-content: center;
} }
fieldset { fieldset {

View File

@ -1,3 +1,19 @@
2015-10-01 Paul Schneider <paul@pschneider.fr>
* style.css: more space
* Web.config:
* YavscHelpers.cs:
* OAuth2.cs:
* AccountController.cs: refactoring
* BlogsController.cs: A new page, to become a media chooser
* App.master: nice small parralax.js, could work on android
browers
* Web.config: unix line endings
2015-10-01 Paul Schneider <paul@pschneider.fr> 2015-10-01 Paul Schneider <paul@pschneider.fr>
* UserPost.aspx: Fixes the anonymous access ! * UserPost.aspx: Fixes the anonymous access !

View File

@ -38,7 +38,7 @@ namespace Yavsc.Controllers
public ActionResult Avatar (string user) public ActionResult Avatar (string user)
{ {
ProfileBase pr = ProfileBase.Create (user); ProfileBase pr = ProfileBase.Create (user);
string avpath = (string ) pr.GetPropertyValue("avatar") ; string avpath = (string ) pr.GetPropertyValue("Avatar") ;
if (avpath == null) { if (avpath == null) {
FileInfo fia = new FileInfo (Server.MapPath (defaultAvatar)); FileInfo fia = new FileInfo (Server.MapPath (defaultAvatar));
return File (fia.OpenRead (), defaultAvatarMimetype); return File (fia.OpenRead (), defaultAvatarMimetype);
@ -291,7 +291,7 @@ namespace Yavsc.Controllers
string logdu = Membership.GetUser ().UserName; string logdu = Membership.GetUser ().UserName;
ViewData ["UserName"] = id; ViewData ["UserName"] = id;
bool editsMyName = (string.Compare(id,model.Name)==0); bool editsMyName = (string.Compare(id,logdu)==0);
if (!editsMyName) if (!editsMyName)
if (!Roles.IsUserInRole ("Admin")) if (!Roles.IsUserInRole ("Admin"))
if (!Roles.IsUserInRole ("FrontOffice")) if (!Roles.IsUserInRole ("FrontOffice"))
@ -312,7 +312,7 @@ namespace Yavsc.Controllers
AvatarFile.ContentType, "image/png")); AvatarFile.ContentType, "image/png"));
} }
/* Sync the property in the Profile model to display : /* Sync the property in the Profile model to display :
* string cAvat = HttpContext.Profile.GetPropertyValue ("avatar") as string; * string cAvat = HttpContext.Profile.GetPropertyValue ("Avatar") as string;
if (cAvat != null) if (model.avatar == null) model.avatar = cAvat; if (cAvat != null) if (model.avatar == null) model.avatar = cAvat;
*/ */
if (ModelState.IsValid) { if (ModelState.IsValid) {
@ -321,9 +321,9 @@ namespace Yavsc.Controllers
prf.SetPropertyValue ("BlogVisible", model.BlogVisible); prf.SetPropertyValue ("BlogVisible", model.BlogVisible);
prf.SetPropertyValue ("BlogTitle", model.BlogTitle); prf.SetPropertyValue ("BlogTitle", model.BlogTitle);
if (AvatarFile != null) { if (AvatarFile != null) {
prf.SetPropertyValue ("avatar", model.avatar); prf.SetPropertyValue ("Avatar", model.avatar);
} else { } else {
model.avatar = (string) prf.GetPropertyValue ("avatar"); model.avatar = (string) prf.GetPropertyValue ("Avatar");
} }
prf.SetPropertyValue ("Address", model.Address); prf.SetPropertyValue ("Address", model.Address);
prf.SetPropertyValue ("CityAndState", model.CityAndState); prf.SetPropertyValue ("CityAndState", model.CityAndState);
@ -346,7 +346,7 @@ namespace Yavsc.Controllers
UserManager.ChangeName (id, model.Name); UserManager.ChangeName (id, model.Name);
FormsAuthentication.SetAuthCookie (model.Name, model.RememberMe); FormsAuthentication.SetAuthCookie (model.Name, model.RememberMe);
} }
ViewData ["Message"] = "Profile enregistré"+((editsMyName)?", nom public inclus.":""); ViewData ["Message"] = "Profile enregistré"+((editsMyName)?", nom public inclu.":"");
} }
return View (model); return View (model);
} }

View File

@ -69,6 +69,11 @@ namespace Yavsc.Controllers
} }
} }
public ActionResult ChooseMedia(long id)
{
return View ();
}
/// <summary> /// <summary>
/// Blogs the list. /// Blogs the list.
/// </summary> /// </summary>

View File

@ -243,7 +243,7 @@ namespace Yavsc.Helpers.Google
} }
pr.SetPropertyValue ("gtoken", token); pr.SetPropertyValue ("gtoken", token);
pr.Save (); pr.Save ();
// ASSERT gat.token_type == pr.GetPropertyValue("token_type") // ASSERT gat.token_type == pr.GetPropertyValue("gtokentype")
} }
return token_type + " " + token; return token_type + " " + token;
} }

View File

@ -166,7 +166,7 @@ namespace Yavsc.Helpers
public static string AvatarUrl (this HtmlHelper helper, string username) { public static string AvatarUrl (this HtmlHelper helper, string username) {
ProfileBase pr = ProfileBase.Create (username); ProfileBase pr = ProfileBase.Create (username);
string avpath = (string ) pr.GetPropertyValue("avatar") ; string avpath = (string ) pr.GetPropertyValue("Avatar") ;
if (avpath != null) if (avpath != null)
return helper.Encode (avpath); return helper.Encode (avpath);
return "/avatars/" + helper.Encode(username)+".png"; return "/avatars/" + helper.Encode(username)+".png";

View File

@ -19,12 +19,50 @@
var apiBaseUrl = '<%=Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative)%>'; var apiBaseUrl = '<%=Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative)%>';
$(document).ready(function(){ $(document).ready(function(){
var $window = $(window); var $window = $(window);
$('[data-type="background"]').each(function(){ $('[data-type="background"]').each(function(){
var $bgobj = $(this); // assigning the object var $bgobj = $(this); // assigning the object
// get the initial background position, assumes a "X% Yem" ?
var orgpos = $bgobj.css('backgroundPosition');
var bgpos = orgpos.split(" ");
var bgposx = bgpos[0];
var bgposy = bgpos[1];
if (/%$/.test(bgposx)){
bgposx = bgposx.substr(0,bgposx.length-1);
$bgobj.attr('orgbgpxu','% ');
}
else if (/em$/.test(bgposx)){
bgposx = bgposx.substr(0,bgposx.length-2);
$bgobj.attr('orgbgpxu','em ');
}
else if (/px$/.test(bgposx)){
bgposx = bgposx.substr(0,bgposx.length-2);
$bgobj.attr('orgbgpxu','px ');
}
else { $bgobj.attr('orgbgpxu','px '); }
if (/%$/.test(bgposy)){
bgposy = bgposy.substr(0,bgposy.length-1);
$bgobj.attr('orgbgpyu','% ');
}
else if (/em$/.test(bgposy)){
bgposy = bgposy.substr(0,bgposy.length-2);
$bgobj.attr('orgbgpyu','em ');
}
else if (/px$/.test(bgposy)){
bgposy = bgposy.substr(0,bgposy.length-2);
$bgobj.attr('orgbgpyu','px ');
}
else { $bgobj.attr('orgbgpyu','px '); }
$bgobj.attr('orgbgpx',parseInt(bgposx));
$bgobj.attr('orgbgpy',parseInt(bgposy));
$(window).scroll(function() { $(window).scroll(function() {
var yPos = -($window.scrollTop() / $bgobj.data('speed')); var xPos = $bgobj.attr('orgbgpx') - ($window.scrollLeft() / $bgobj.data('speed'));
var yPos = $bgobj.attr('orgbgpy') - ($window.scrollTop() / $bgobj.data('speed'));
// Put together our final background position // Put together our final background position
var coords = '50% '+ yPos + 'px'; var coords = '' + xPos + $bgobj.attr('orgbgpxu') + yPos + $bgobj.attr('orgbgpyu');
// Move the background // Move the background
$bgobj.css({ backgroundPosition: coords }); $bgobj.css({ backgroundPosition: coords });
}); });
@ -37,7 +75,7 @@ $(document).ready(function(){
<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'/>
</head> </head>
<body> <body>
<header data-type="background" data-speed="10"> <header data-type="background" data-speed="10" >
<asp:ContentPlaceHolder ID="overHeaderOne" runat="server"> <asp:ContentPlaceHolder ID="overHeaderOne" runat="server">
@ -55,32 +93,32 @@ $(document).ready(function(){
</header> </header>
<nav data-type="background" data-speed="10"> <nav data-type="background" data-speed="10" data-emheight="10" data-posx="0" data-posy="11" >
<% if (Membership.GetUser()==null) { %> <% if (Membership.GetUser()==null) { %>
<div class="menuitem"> <div class="menuitem">
<%= Html.ActionLink("Authentification", "Login", "Account", new { returnUrl=Request.Url.PathAndQuery },null) %> <%= Html.ActionLink("Authentification", "Login", "Account", new { returnUrl=Request.Url.PathAndQuery }, new { accesskey = "L" } ) %>
<div class="hint">Pour pouvoir publier, facturer</div> <div class="hint">Pour pouvoir publier, facturer</div>
</div> </div>
<% } else { %><div class="menuitem"> <% } else { %><div class="menuitem">
<a href="/Blog/<%= HttpContext.Current.User.Identity.Name%>"> <a href="/Blog/<%= HttpContext.Current.User.Identity.Name%>" accesskey = "B" >
<img src="<%=Html.AvatarUrl(HttpContext.Current.User.Identity.Name)%>" alt="vos billets" class="iconsmall" /></a> <img src="<%=Html.AvatarUrl(HttpContext.Current.User.Identity.Name)%>" alt="vos billets" class="iconsmall" /></a>
<div class="hint">Vos billets</div> <div class="hint">Vos billets</div>
</div> </div>
<div class="menuitem"> <div class="menuitem">
<%= Html.ActionLink(HttpContext.Current.User.Identity.Name, "Profile", "Account", new { id = HttpContext.Current.User.Identity.Name }, null) %> <%= Html.ActionLink(HttpContext.Current.User.Identity.Name, "Profile", "Account", new { id = HttpContext.Current.User.Identity.Name }, new { accesskey = "P" } ) %>
<div class="hint"> &Eacute;dition de votre profile </div></div> <div class="hint"> &Eacute;dition de votre profile </div></div>
<div class="menuitem"> <div class="menuitem">
<a href="/Blogs/Post" >Poster</a> <a href="/Blogs/Post" accesskey="P"><u>P</u>oster</a>
<div class="hint"> <div class="hint">
&Eacute;dition d'un nouveau billet </div></div> &Eacute;dition d'un nouveau billet </div></div>
<div class="menuitem"> <div class="menuitem">
<%= Html.ActionLink( "Deconnexion", "Logout", "Account", new { returnUrl=Request.Url.PathAndQuery }, null) %> <%= Html.ActionLink( "Deconnexion", "Logout", "Account", new { returnUrl=Request.Url.PathAndQuery }, new { accesskey = "L" }) %>
<% } %> <% } %>
</div> </div>
</nav> </nav>
<main data-type="background" data-speed="10"> <main data-type="background" data-speed="10" data-emheight="10" data-posx="0" data-posy="22" >
<div> <div>
<asp:ContentPlaceHolder ID="MainContent" runat="server"> <asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder> </asp:ContentPlaceHolder>
@ -104,7 +142,10 @@ $(document).ready(function(){
{lang: 'fr'} {lang: 'fr'}
</script> </script>
<div class="g-plusone" data-annotation="inline" data-width="230"></div> <div class="g-plusone" data-annotation="inline" data-width="230"></div>
<% #else %>
<p><i>(Version de développement, G+1 desactivé)</i></p>
<% #endif %> <% #endif %>
</footer> </footer>
</body> </body>
</html> </html>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<system.web> <system.web>
<httpHandlers> <httpHandlers>

View File

@ -120,36 +120,27 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
<add name="Name" /> <add name="Name" />
<add name="Phone" /> <add name="Phone" />
<add name="Mobile" /> <add name="Mobile" />
<add name="avatar" /> <add name="Avatar" />
<add name="BlogVisible" type="System.Boolean" /> <add name="BlogVisible" type="System.Boolean" />
<add name="BlogTitle" /> <add name="BlogTitle" />
<add name="WebSite" /> <add name="WebSite" />
<add name="Address" />
<group name="address"> <add name="CityAndState" />
<add name="address" /> <add name="ZipCode" />
<add name="cityandstate" /> <add name="Country" />
<add name="zipcode" /> <add name="BankCode" />
<add name="country" /> <add name="IBAN" />
</group> <add name="BIC" />
<add name="WicketCode" />
<group name="bank"> <add name="AccountNumber" />
<add name="Code" /> <add name="BankedKey" />
<add name="IBAN" /> <add name="gtoken" />
<add name="BIC" /> <add name="grefreshtoken" />
<add name="WicketCode" /> <add name="gtokentype" />
<add name="AccountNumber" /> <add name="gtokenexpir" />
<add name="Key" /> <add name="gcalapi" />
</group> <add name="gcalid" />
<add name="gregid" />
<group name="google">
<add name="token" />
<add name="refreshtoken" />
<add name="tokentype" />
<add name="tokenexpir" />
<add name="calapi" />
<add name="calid" />
<add name="regid" />
</group>
</properties> </properties>
</profile> </profile>
<blog defaultProvider="NpgsqlBlogProvider"> <blog defaultProvider="NpgsqlBlogProvider">
@ -268,7 +259,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
<add key="SmtpServer" value="smtp.free.fr" /> <add key="SmtpServer" value="smtp.free.fr" />
<add key="AdminEMail" value="paulschneider@free.fr" /> <add key="AdminEMail" value="paulschneider@free.fr" />
<add key="OwnerEMail" value="paulschneider@free.fr" /> <add key="OwnerEMail" value="paulschneider@free.fr" />
<add key="Name" value="Psc" /> <add key="Name" value="PSc" />
<add key="DefaultController" value="Blogs" /> <add key="DefaultController" value="Blogs" />
<add key="DefaultAvatar" value="/images/noavatar.png;image/png" /> <add key="DefaultAvatar" value="/images/noavatar.png;image/png" />
<add key="RegistrationMessage" value="/RegistrationMail.txt" /> <add key="RegistrationMessage" value="/RegistrationMail.txt" />
@ -276,4 +267,4 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
<add key="UnobtrusiveJavaScriptEnabled" value="true" /> <add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="PayPalLogger" value="PayPal.Log.Log4netLogger" /> <add key="PayPalLogger" value="PayPal.Log.Log4netLogger" />
</appSettings> </appSettings>
</configuration> </configuration>

View File

@ -1,3 +1,7 @@
2015-10-01 Paul Schneider <paul@pschneider.fr>
* Profile.cs: refactoring
2015-09-30 Paul Schneider <paul@pschneider.fr> 2015-09-30 Paul Schneider <paul@pschneider.fr>
* Profile.cs: Groups profile properties * Profile.cs: Groups profile properties

View File

@ -243,21 +243,20 @@ namespace Yavsc.Model.RolesAndMembers
object s = profile.GetPropertyValue ("BlogTitle"); object s = profile.GetPropertyValue ("BlogTitle");
BlogTitle = (s is DBNull) ? null : (string)s; BlogTitle = (s is DBNull) ? null : (string)s;
s = profile.GetPropertyValue ("avatar"); s = profile.GetPropertyValue ("Avatar");
avatar = (s is DBNull) ? null : (string)s; avatar = (s is DBNull) ? null : (string)s;
var address = profile.GetProfileGroup ("address");
s = address.GetPropertyValue ("address"); s = profile.GetPropertyValue ("Address");
Address = (s is DBNull) ? null : (string)s; Address = (s is DBNull) ? null : (string)s;
s = address.GetPropertyValue ("cityandstate"); s = profile.GetPropertyValue ("CityAndState");
CityAndState = (s is DBNull) ? null : (string)s; CityAndState = (s is DBNull) ? null : (string)s;
s = address.GetPropertyValue ("country"); s = profile.GetPropertyValue ("Country");
Country = (s is DBNull) ? null : (string)s; Country = (s is DBNull) ? null : (string)s;
s = address.GetPropertyValue ("zipcode"); s = profile.GetPropertyValue ("ZipCode");
ZipCode = (s is DBNull) ? null : (string)s; ZipCode = (s is DBNull) ? null : (string)s;
s = profile.GetPropertyValue ("WebSite"); s = profile.GetPropertyValue ("WebSite");
@ -274,28 +273,26 @@ namespace Yavsc.Model.RolesAndMembers
userName = profile.UserName; userName = profile.UserName;
var bank = profile.GetProfileGroup ("bank");
s = bank.GetPropertyValue ("Code"); s = profile.GetPropertyValue ("BankCode");
BankCode = (s is DBNull) ? null : (string)s; BankCode = (s is DBNull) ? null : (string)s;
s = bank.GetPropertyValue ("IBAN"); s = profile.GetPropertyValue ("IBAN");
IBAN = (s is DBNull) ? null : (string)s; IBAN = (s is DBNull) ? null : (string)s;
s = bank.GetPropertyValue ("BIC"); s = profile.GetPropertyValue ("BIC");
BIC = (s is DBNull) ? null : (string)s; BIC = (s is DBNull) ? null : (string)s;
s = bank.GetPropertyValue ("WicketCode"); s = profile.GetPropertyValue ("WicketCode");
WicketCode = (s is DBNull) ? null : (string)s; WicketCode = (s is DBNull) ? null : (string)s;
s = bank.GetPropertyValue ("AccountNumber"); s = profile.GetPropertyValue ("AccountNumber");
this.AccountNumber = (s is DBNull) ? null : (string)s; this.AccountNumber = (s is DBNull) ? null : (string)s;
s = bank.GetPropertyValue ("Key"); s = profile.GetPropertyValue ("BankedKey");
BankedKey = (s == null) ? 0 : (s is DBNull)? 0 : (int)s; BankedKey = (s == null) ? 0 : (s is DBNull)? 0 : (int)s;
var google = profile.GetProfileGroup ("google"); s = profile.GetPropertyValue ("gcalid");
s = google.GetPropertyValue ("calid");
GoogleCalendar = (s is DBNull)? null : (string) s; GoogleCalendar = (s is DBNull)? null : (string) s;
} }
} }