diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 00000000..5a340de1 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,4 @@ +2015-10-09 Paul Schneider + + * Makefile: reloads config after each rsync call + diff --git a/Makefile b/Makefile index 61d2d5e2..71861def 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,7 @@ rsync_% : DESTDIR = $(DESTDIR_$@) rsync_% : deploy echo "!Deploying to $(HOST)!" $(RSYNCCMD) build/web/$(CONFIG)/ root@$(HOST):$(DESTDIR) + ssh root@$(HOST) "service apache2 reload" build: xbuild /p:Configuration=$(CONFIG) /t:Build Yavsc.sln diff --git a/NpgsqlBlogProvider/ChangeLog b/NpgsqlBlogProvider/ChangeLog index d4b30291..bbbab81c 100644 --- a/NpgsqlBlogProvider/ChangeLog +++ b/NpgsqlBlogProvider/ChangeLog @@ -1,3 +1,8 @@ +2015-10-09 Paul Schneider + + * NpgsqlBlogProvider.cs: - Fixes access on bills + - Fixes usage of bill without photo + 2015-10-08 Paul Schneider * NpgsqlBlogProvider.cs: Fixes last commit in case of DBNull diff --git a/NpgsqlBlogProvider/NpgsqlBlogProvider.cs b/NpgsqlBlogProvider/NpgsqlBlogProvider.cs index 2bc62a5b..c623f560 100644 --- a/NpgsqlBlogProvider/NpgsqlBlogProvider.cs +++ b/NpgsqlBlogProvider/NpgsqlBlogProvider.cs @@ -250,13 +250,16 @@ namespace Npgsql.Web.Blog be.Modified = rdr.GetDateTime (rdr.GetOrdinal ("modified")); be.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted")); be.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible")); - be.Photo = rdr.GetString (rdr.GetOrdinal ("photo")); + int oph = rdr.GetOrdinal ("photo"); + if (!rdr.IsDBNull(oph)) + be.Photo = rdr.GetString (oph); be.Id = postid; } } } if (be!=null) SetCirclesOn (be); return be; + } /// /// Removes the comment. @@ -459,16 +462,16 @@ namespace Npgsql.Web.Blog using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString)) using (NpgsqlCommand cmd = cnx.CreateCommand()) { if (readersName != null) { - cmd.CommandText = "select _id, title,bcontent,modified," + + cmd.CommandText = "select _id, title,bcontent, modified," + "posted,username,visible " + "from blog b left outer join " + "(select count(*)>0 acc, a.post_id pid " + "from blog_access a," + " circle_members m, users u where m.circle_id = a.circle_id " + - " and m.member = u.pkid and u.username = :uname " + + " and m.member = u.username and u.username = :uname " + " and u.applicationname = :appname " + " group by a.post_id) ma on (ma.pid = b._id) " + - "where ( ma.acc IS NULL or ma.acc = TRUE or b.username = :uname) "; + "where ( ((ma.acc IS NULL or ma.acc = TRUE) and b.Visible IS TRUE ) or b.username = :uname) "; cmd.Parameters.AddWithValue ("uname", readersName); } else { cmd.CommandText = "select _id, title,bcontent,modified," + @@ -478,7 +481,8 @@ namespace Npgsql.Web.Blog "from blog_access a" + " group by a.post_id) ma on (ma.pid = b._id)" + " where " + - " ma.acc IS NULL and " + + " ma.acc IS NULL and " + + " b.Visible IS TRUE and " + " applicationname = :appname"; } cmd.Parameters.AddWithValue ("@appname", applicationName); diff --git a/web/App_Themes/style.css b/web/App_Themes/style.css index 146dea03..4969e97e 100644 --- a/web/App_Themes/style.css +++ b/web/App_Themes/style.css @@ -4,10 +4,11 @@ body { background-color: black; color: #D0FFD0; font-family: 'Arial', cursive; - padding: 0em; + padding: 0; margin: 0; } + .iconsmall { max-height: 1.3em; max-width: 1.3em; } input, textarea, checkbox { @@ -15,62 +16,69 @@ input, textarea, checkbox { background-color: black; } +.photo { width: 100%; } +.blogbanner { float: left; top:0; } header { - border-radius:10px; - margin: 1em; - padding: 1em; - padding-top: 5em; + padding: 0; + margin: 0; + margin-top: 0; + padding-top: 201px; + margin-bottom:2em; display: block; text-align: center; - background: url("/images/totemprod.png") 50% 0 no-repeat fixed; + background: url("/images/totem-banner.xs.jpg") 0 0 no-repeat fixed; } header h1, header a { background-color: rgba(0,0,0,.5); } nav { - border-radius:1em; - margin: 1em; - padding: 1em; + margin: 2em; + padding: 2em; display: block; + border-radius:1em; background: url("/images/live-concert-388160_1280.s.jpg") 50% 10em repeat fixed ; - min-height: 10em; + justify-content: space-around; } main { - border-radius:1em; - margin: 1em; - padding: 1em; + margin: 2em; + padding: 2em; display: block; + border-radius:1em; background: url("/images/musician-923526_1280.s.jpg") 50% 20em repeat fixed ; - min-height: 10em; } footer { background: url("/images/drummer-652345_1280.s.jpg") 50% 30em repeat fixed ; - border-radius:1em; - margin: 1em; - padding: 1em; + margin: 0; + margin-top: 2em; + padding: 2em; display: block; - min-height: 10em; clear: both; font-size: smaller; - justify-content: center; + justify-content: space-around; + } footer a { border-radius:5px; margin:.5em; padding:1em; } - -#copyr { text-align: center; display: block; background-color: rgba(20,20,20,.5); } +legend { + border-radius:5px; + margin:.5em; + padding:1.5em; + background-color: rgba(0,0,32,.5); + } +#copyr { text-align: center; display: block; background-color: rgba(20,20,20,.8); } footer p { display:inline-block; } footer img { max-height: 2em; vertical-align: middle; } a.actionlink img, h1 img, .menuitem img { vertical-align: middle; } #gspacer { - background-color: rgba(0,0,40,.8); + background-color: rgba(20,20,20,.8); border-radius:5px; margin:.5em; padding:1em; display: inline-block } fieldset { @@ -78,7 +86,7 @@ fieldset { border-radius:5px; border: solid 1px #000060; } -video, img { +main video, main img { max-width:100%; max-height:75%; padding: .5em; @@ -124,12 +132,26 @@ textarea.fullwidth { min-height:10em; } } .panel,.bshpanel, aside { - background-color: rgba(0,0,128,.5); - border-radius:5px; - margin:.5em; - padding: .5em; + background-color: rgba(20,20,20,.8); + border-radius:5px; + margin:.5em; + padding: .5em; +} +.spanel { + max-width:24em; + display: inline-block; + margin:.3em; +} +.xspanel { + max-width:13em; + display: inline-block; + margin:.2em; +} +.xxspanel { + max-width:7em; + display: inline-block; + margin:.1em; } - .hint { display: inline; font-style: italic; @@ -143,12 +165,6 @@ content: ")"; } -a { - text-decoration: none; - color: #B0B080; - background-color:rgba(20,20,20,0.5); - text-decoration: none; -} .usertitleref { color: #B0B080; border-radius: 5px; @@ -156,16 +172,18 @@ a { font-family: 'Arial', cursive; padding: 1em; } -a:hover { - text-decoration: underline; -} a:visited { color: #90B090; } label { font-size: medium; } - +.editable { +margin 1em; +min-height:1em; +border-radius: 1em; +border: dashed rgb(020,20,256) 2px; +} #notifications { padding: .5em; } @@ -203,27 +221,33 @@ ul.preview li:nth-child(n) { color: #f88; } -.actionlink { +a { + text-decoration: none; +} + +.actionlink, .menuitem, a { color: #B0B080; - border-radius: 5px; - background-color:rgba(0,0,32,0.5); + border-radius:1em; + border: solid black 1px; + background-color: rgba(20,20,20,.8); cursor: pointer; font-family: 'Arial', cursive; padding: .2em; + display: inline-block; } input, select { color: #B0B080; border: solid 1px rgb(128,128,128); - border-radius:5px; + border-radius:1em; background-color:rgba(0,0,32,0.8); font-family: 'Arial', cursive; } -.actionlink:hover { +.actionlink:hover, fa:hover, .menuitem:hover, a:hover, input:hover { background-color:rgba(30,0,124,0.9); - text-decoration: underline; + border: solid green 1px; } .code { @@ -237,8 +261,10 @@ input, select { max-width: 64px; max-height: 64px; } + #avatar { float: left; + margin:1em; } .comment { @@ -246,15 +272,6 @@ input, select { font-size: smaller; } - -.menuitem { - background-color: rgba(0,0,40,.8); - border-radius:5px; - margin:.5em; - padding:.5em; - display: inline-block; -} - .onhover { display:none; position: absolute; @@ -285,28 +302,24 @@ input, select { } @media all and (max-width: 640px) { - header { - margin: .5em; - padding: .5em; - padding-top: 5em; - } +header { + margin-bottom:1em; + background: url("/images/totem-banner.xs.jpg") 0 0 no-repeat fixed; + } + nav { - margin: .5em; - padding: .5em; - min-height: 3em; + margin: 1em; + padding: 1em; background: url("/images/live-concert-388160_1280.xxs.jpg") 50% 10% repeat fixed ; } main { - margin: .5em; - padding: .5em; - min-height: 7em; + margin: 1em; + padding: 1em; background: url("/images/musician-923526_1280.xxs.jpg") 50% 20em repeat fixed ; } footer { - margin: .5em; - padding: .5em; - min-height: 3em; background: url("/images/drummer-652345_1280.xxs.jpg") 50% 90% repeat fixed ; + padding: 1em; } .menuitem { display: block; @@ -328,6 +341,20 @@ input, select { } @media all and (max-width: 350px) { +header { + padding-top: 101px; + background: url("/images/totem-banner.xxs.jpg") 0 0 no-repeat fixed; + } + nav { + margin: 0.3em; + padding: 0.3em; + } + main { + margin: 0.3em; + padding: 0.3em;} + + padding: 0em; + margin: 0em; .c2 { display:none; } .c2-alt { display:initial; } } diff --git a/web/ChangeLog b/web/ChangeLog index 387885f3..f4ae7dba 100644 --- a/web/ChangeLog +++ b/web/ChangeLog @@ -1,3 +1,35 @@ +2015-10-09 Paul Schneider + + * totem-banner.png: + * totem-banner.xs.jpg: + * totem-banner.xxs.jpg: totem custo + + * style.css: yastyle + + * AccountController.cs: - Fixes route usage with n ovalue for + `id` + - better code at getting the avatar url + + + * BlogsController.cs: Fixes a Post request without user name + in the route + + * YavscHelpers.cs: Implements a file list html rendering + + * App.master: + * UserPost.aspx: + * Profile.aspx: + * AssemblyInfo.aspx: yahtmlstructure + + * Edit.aspx: Displays a list a attached files + + * UserPosts.aspx: yahtmlstrucure + + * Web.csproj: new images + + * instdbws.sql: returns to the flat list of properies (groups + are not working) + 2015-10-08 Paul Schneider * Contact.aspx: a form background color diff --git a/web/Controllers/AccountController.cs b/web/Controllers/AccountController.cs index 02572bd0..7b2f8dec 100644 --- a/web/Controllers/AccountController.cs +++ b/web/Controllers/AccountController.cs @@ -290,6 +290,8 @@ namespace Yavsc.Controllers // ASSERT("Membership.GetUser ().UserName is made of simple characters, no slash nor backslash" string logdu = Membership.GetUser ().UserName; + if (string.IsNullOrWhiteSpace (id)) + id = logdu; ViewData ["UserName"] = id; bool editsMyName = (string.Compare(id,logdu)==0); if (!editsMyName) @@ -297,15 +299,17 @@ namespace Yavsc.Controllers if (!Roles.IsUserInRole ("FrontOffice")) throw new UnauthorizedAccessException ("Your are not authorized to modify this profile"); - if (AvatarFile != null) { // if said valid, move as avatar file // else invalidate the model if (AvatarFile.ContentType == "image/png") { string avdir = Server.MapPath (AvatarDir); + var di = new DirectoryInfo (avdir); + if (!di.Exists) + di.Create (); string avpath = Path.Combine (avdir, id + ".png"); AvatarFile.SaveAs (avpath); - model.avatar = Request.Url.Scheme + "://" + Request.Url.Authority + AvatarDir.Substring (1) + "/" + id + ".png"; + model.avatar = Url.Content( AvatarDir + "/" + id + ".png"); } else ModelState.AddModelError ("Avatar", string.Format ("Image type {0} is not supported (suported formats : {1})", @@ -323,7 +327,9 @@ namespace Yavsc.Controllers if (AvatarFile != null) { prf.SetPropertyValue ("Avatar", model.avatar); } else { - model.avatar = (string) prf.GetPropertyValue ("Avatar"); + var av = prf.GetPropertyValue ("Avatar"); + if (av != null) + model.avatar = av as string; } prf.SetPropertyValue ("Address", model.Address); prf.SetPropertyValue ("CityAndState", model.CityAndState); diff --git a/web/Controllers/BlogsController.cs b/web/Controllers/BlogsController.cs index 42f32b47..29c01273 100644 --- a/web/Controllers/BlogsController.cs +++ b/web/Controllers/BlogsController.cs @@ -230,28 +230,24 @@ namespace Yavsc.Controllers } /// - /// Post the specified user and title. + /// Post the specified title. /// - /// User. /// Title. [Authorize] - public ActionResult Post (string user, string title) + public ActionResult Post ( string title) { - ViewData ["BlogUser"] = user; - ViewData ["PostTitle"] = title; - ViewData ["SiteName"] = sitename; string un = Membership.GetUser ().UserName; - if (String.IsNullOrEmpty (user)) - user = un; if (String.IsNullOrEmpty (title)) title = ""; + ViewData ["SiteName"] = sitename; ViewData ["Author"] = un; - ViewData ["AllowedCircles"] = CircleManager.DefaultProvider.List (Membership.GetUser ().UserName).Select (x => new SelectListItem { + ViewData ["AllowedCircles"] = CircleManager.DefaultProvider.List (un) + .Select (x => new SelectListItem { Value = x.Id.ToString(), Text = x.Title }); - return View ("Edit", new BlogEntry { Title = title }); + return View ("Edit", new BlogEntry { Title = title, Author = un }); } /// diff --git a/web/Helpers/YavscHelpers.cs b/web/Helpers/YavscHelpers.cs index 341d5c1c..d6bf7ff0 100644 --- a/web/Helpers/YavscHelpers.cs +++ b/web/Helpers/YavscHelpers.cs @@ -176,23 +176,92 @@ namespace Yavsc.Helpers if (a == null || a is DBNull) return "/avatars/" + helper.Encode(username)+".png"; return helper.Encode ((string)a); } - + /// + /// Javas the script. + /// + /// The script. + /// Html. + /// Object. public static string JavaScript(this HtmlHelper html, object obj) { return JavaScript (obj); } - + /// + /// Javas the script. + /// + /// The script. + /// Object. public static string JavaScript(object obj) { JavaScriptSerializer serializer = new JavaScriptSerializer(); return serializer.Serialize(obj); } - + /// + /// Notice the specified ViewData with message. + /// + /// View data. + /// Message. public static void Notice (ViewDataDictionary ViewData, string message) { if (ViewData ["Notifications"] == null) ViewData ["Notifications"] = new List (); (ViewData ["Notifications"] as List).Add (message.Replace("\'","\\\'")); } + /// + /// Files the list. + /// + /// The list. + /// Html. + /// Path. + /// Patterns. + public static IHtmlString FileList(this HtmlHelper html, string path, string [] patterns = null) { + StringWriter str = new StringWriter(); + HtmlTextWriter writter = new HtmlTextWriter (str); + DirectoryInfo di = new DirectoryInfo (HttpContext.Current.Server.MapPath(path)); + if (!di.Exists) + return new MvcHtmlString (""); + var files = new List (); + if (patterns == null) + patterns = new string[] { "*" }; + var url = new UrlHelper(html.ViewContext.RequestContext, + html.RouteCollection); + + foreach (string pattern in patterns) + files.AddRange( + di.EnumerateFiles ( + pattern, + SearchOption.TopDirectoryOnly)); + writter.RenderBeginTag ("table"); + writter.RenderBeginTag ("tr"); + writter.RenderBeginTag ("td"); + writter.Write (html.Translate ("Name")); + writter.RenderEndTag (); + writter.RenderBeginTag ("td"); + writter.Write (html.Translate ("Created")); + writter.RenderEndTag (); + writter.RenderBeginTag ("td"); + writter.Write (html.Translate ("Modified")); + writter.RenderEndTag (); + writter.RenderEndTag (); + foreach (FileInfo fi in files) { + writter.RenderBeginTag ("tr"); + writter.RenderBeginTag ("td"); + writter.AddAttribute ("href", url.Content(path+"/"+fi.Name)); + writter.RenderBeginTag ("a"); + writter.Write (fi.Name); + writter.RenderEndTag (); + writter.RenderEndTag (); + writter.RenderBeginTag ("td"); + writter.Write (fi.LastWriteTime.ToString ("U")); + writter.RenderEndTag (); + writter.RenderBeginTag ("td"); + writter.Write (fi.CreationTime.ToString("U")); + writter.RenderEndTag (); + writter.RenderEndTag (); + } + writter.RenderEndTag (); + return new MvcHtmlString (str.ToString ()); + } + } } diff --git a/web/Models/App.master b/web/Models/App.master index b11a9173..41bc220d 100644 --- a/web/Models/App.master +++ b/web/Models/App.master @@ -33,9 +33,7 @@ var apiBaseUrl = '<%=Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative)%>'; - -
-
+
<%if (ViewData ["Notifications"]!=null) { %> -
+
diff --git a/web/Views/Account/Profile.aspx b/web/Views/Account/Profile.aspx index 33f2d8ea..0aac44b0 100644 --- a/web/Views/Account/Profile.aspx +++ b/web/Views/Account/Profile.aspx @@ -1,7 +1,7 @@ -<%@ Page Title="Profile" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> +<%@ Page Title="Profile_edition" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> -<% Title = ViewData["UserName"]+" at "+ YavscHelpers.SiteName +" - profile edition" ; %> +<% Title = ViewData["UserName"] + " : " +Html.Translate("Profile_edition"); %> @@ -36,77 +36,81 @@ Avatar :
Blog - +
<%= Html.LabelFor(model => model.BlogVisible) %> : <%= Html.CheckBox("BlogVisible") %> <%= Html.ValidationMessage("BlogVisible", "*") %> -
+
<%= Html.LabelFor(model => model.BlogTitle) %> : <%= Html.TextBox("BlogTitle") %> <%= Html.ValidationMessage("BlogTitle", "*") %> - +
Contact - +
<%= Html.LabelFor(model => model.Phone) %> <%= Html.TextBox("Phone") %> <%= Html.ValidationMessage("Phone", "*") %> - +
<%= Html.LabelFor(model => model.Mobile) %> <%= Html.TextBox("Mobile") %> <%= Html.ValidationMessage("Mobile", "*") %> - +
<%= Html.LabelFor(model => model.Address) %> <%= Html.TextBox("Address") %> <%= Html.ValidationMessage("Address", "*") %> - +
<%= Html.LabelFor(model => model.CityAndState) %> <%= Html.TextBox("CityAndState") %> <%= Html.ValidationMessage("CityAndState", "*") %> - +
<%= Html.LabelFor(model => model.ZipCode) %> <%= Html.TextBox("ZipCode") %> <%= Html.ValidationMessage("ZipCode", "*") %> - +
<%= Html.LabelFor(model => model.Country) %> <%= Html.TextBox("Country") %> <%= Html.ValidationMessage("Country", "*") %> +
Disponibilité +
<%= Html.LabelFor(model => model.GoogleCalendar) %> : <%= Html.Encode(Model.GoogleCalendar) %> <%= Html.ActionLink("Choisir l'agenda","ChooseCalendar","Google",new { returnUrl= Request.Url.AbsolutePath }, new { @class="actionlink" }) %> -
+
Informations de facturation - + +
<%= Html.LabelFor(model => model.BankCode) %> : <%= Html.TextBox("BankCode") %> <%= Html.ValidationMessage("BankCode", "*") %> -
+
<%= Html.LabelFor(model => model.WicketCode) %> : <%= Html.TextBox("WicketCode") %> <%= Html.ValidationMessage("WicketCode", "*") %> -
+
<%= Html.LabelFor(model => model.AccountNumber) %> : <%= Html.TextBox("AccountNumber") %> <%= Html.ValidationMessage("AccountNumber", "*") %> -
+
<%= Html.LabelFor(model => model.BankedKey) %> : <%= Html.TextBox("BankedKey") %> <%= Html.ValidationMessage("BankedKey", "*") %> -
+
<%= Html.LabelFor(model => model.BIC) %> : <%= Html.TextBox("BIC") %> <%= Html.ValidationMessage("BIC", "*") %> -
+
<%= Html.LabelFor(model => model.IBAN) %> : <%= Html.TextBox("IBAN") %> <%= Html.ValidationMessage("IBAN", "*") %> +
@@ -119,13 +123,13 @@ Avatar : This user is Admin. <% } %> - HasBankAccount:<%= Model.HasBankAccount %> - <% if (!Model.HasBankAccount) { %> - (IBAN+BIC ou Codes banque, guichet, compte et clé RIB) - <% } %>, IsBillable:<%=Model.IsBillable%> + HasBankAccount:<%= Model.HasBankAccount %> + <% if (!Model.HasBankAccount) { %> + IBAN+BIC ou Codes banque, guichet, compte et clé RIB + <% } %>, IsBillable:<%=Model.IsBillable%> <% if (!Model.IsBillable) { %> - (un nom et au choix, une adresse postale valide, - ou un téléphone, ou un email, ou un Mobile) <% } %> + un nom et au choix, une adresse postale valide, + ou un téléphone, ou un email, ou un Mobile <% } %>
diff --git a/web/Views/Blogs/Edit.aspx b/web/Views/Blogs/Edit.aspx index ea5d05ca..c62b9fb8 100644 --- a/web/Views/Blogs/Edit.aspx +++ b/web/Views/Blogs/Edit.aspx @@ -15,16 +15,15 @@ photo -

<%=Html.Markdown(Model.Title)%>

+

<%=Html.Markdown(Model.Title)%>

<%=Html.Markdown(Model.Content,"/bfiles/"+Model.Id+"/")%>
- -View Source - +

Fichiers attachées

+ +<%= Html.FileList("~/bfiles/"+Model.Id) %> +