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
vnext
Paul Schneider 9 years ago
parent 501199ed70
commit 5f40448890
11 changed files with 131 additions and 75 deletions

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

@ -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>
* UserPost.aspx: Fixes the anonymous access !

@ -38,7 +38,7 @@ namespace Yavsc.Controllers
public ActionResult Avatar (string user)
{
ProfileBase pr = ProfileBase.Create (user);
string avpath = (string ) pr.GetPropertyValue("avatar") ;
string avpath = (string ) pr.GetPropertyValue("Avatar") ;
if (avpath == null) {
FileInfo fia = new FileInfo (Server.MapPath (defaultAvatar));
return File (fia.OpenRead (), defaultAvatarMimetype);
@ -291,7 +291,7 @@ namespace Yavsc.Controllers
string logdu = Membership.GetUser ().UserName;
ViewData ["UserName"] = id;
bool editsMyName = (string.Compare(id,model.Name)==0);
bool editsMyName = (string.Compare(id,logdu)==0);
if (!editsMyName)
if (!Roles.IsUserInRole ("Admin"))
if (!Roles.IsUserInRole ("FrontOffice"))
@ -312,7 +312,7 @@ namespace Yavsc.Controllers
AvatarFile.ContentType, "image/png"));
}
/* 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 (ModelState.IsValid) {
@ -321,9 +321,9 @@ namespace Yavsc.Controllers
prf.SetPropertyValue ("BlogVisible", model.BlogVisible);
prf.SetPropertyValue ("BlogTitle", model.BlogTitle);
if (AvatarFile != null) {
prf.SetPropertyValue ("avatar", model.avatar);
prf.SetPropertyValue ("Avatar", model.avatar);
} else {
model.avatar = (string) prf.GetPropertyValue ("avatar");
model.avatar = (string) prf.GetPropertyValue ("Avatar");
}
prf.SetPropertyValue ("Address", model.Address);
prf.SetPropertyValue ("CityAndState", model.CityAndState);
@ -346,7 +346,7 @@ namespace Yavsc.Controllers
UserManager.ChangeName (id, model.Name);
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);
}

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

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

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

@ -19,12 +19,50 @@
var apiBaseUrl = '<%=Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative)%>';
$(document).ready(function(){
var $window = $(window);
$('[data-type="background"]').each(function(){
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() {
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
var coords = '50% '+ yPos + 'px';
var coords = '' + xPos + $bgobj.attr('orgbgpxu') + yPos + $bgobj.attr('orgbgpyu');
// Move the background
$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'/>
</head>
<body>
<header data-type="background" data-speed="10">
<header data-type="background" data-speed="10" >
<asp:ContentPlaceHolder ID="overHeaderOne" runat="server">
@ -55,32 +93,32 @@ $(document).ready(function(){
</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) { %>
<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>
<% } 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>
<div class="hint">Vos billets</div>
</div>
<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="menuitem">
<a href="/Blogs/Post" >Poster</a>
<a href="/Blogs/Post" accesskey="P"><u>P</u>oster</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) %>
<%= Html.ActionLink( "Deconnexion", "Logout", "Account", new { returnUrl=Request.Url.PathAndQuery }, new { accesskey = "L" }) %>
<% } %>
</div>
</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>
<asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder>
@ -104,7 +142,10 @@ $(document).ready(function(){
{lang: 'fr'}
</script>
<div class="g-plusone" data-annotation="inline" data-width="230"></div>
<% #else %>
<p><i>(Version de développement, G+1 desactivé)</i></p>
<% #endif %>
</footer>
</body>
</html>

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

@ -120,36 +120,27 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
<add name="Name" />
<add name="Phone" />
<add name="Mobile" />
<add name="avatar" />
<add name="Avatar" />
<add name="BlogVisible" type="System.Boolean" />
<add name="BlogTitle" />
<add name="WebSite" />
<group name="address">
<add name="address" />
<add name="cityandstate" />
<add name="zipcode" />
<add name="country" />
</group>
<group name="bank">
<add name="Code" />
<add name="IBAN" />
<add name="BIC" />
<add name="WicketCode" />
<add name="AccountNumber" />
<add name="Key" />
</group>
<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>
<add name="Address" />
<add name="CityAndState" />
<add name="ZipCode" />
<add name="Country" />
<add name="BankCode" />
<add name="IBAN" />
<add name="BIC" />
<add name="WicketCode" />
<add name="AccountNumber" />
<add name="BankedKey" />
<add name="gtoken" />
<add name="grefreshtoken" />
<add name="gtokentype" />
<add name="gtokenexpir" />
<add name="gcalapi" />
<add name="gcalid" />
<add name="gregid" />
</properties>
</profile>
<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="AdminEMail" 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="DefaultAvatar" value="/images/noavatar.png;image/png" />
<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="PayPalLogger" value="PayPal.Log.Log4netLogger" />
</appSettings>
</configuration>
</configuration>

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

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

Loading…