diff --git a/ChangeLog b/ChangeLog index abc93c00..97da2aa7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2015-10-04 Paul Schneider + + * Makefile: my deploy config + 2015-08-20 Paul Schneider * Yavsc.sln: Adds the `Presta` project diff --git a/Makefile b/Makefile index c1305b83..54cdfa7f 100644 --- a/Makefile +++ b/Makefile @@ -4,17 +4,17 @@ CONFIG=Debug LDYDESTDIR=build/web/$(CONFIG) COPYUNCHANGED="false" -HOST_rsync_local=localhost -DESTDIR_rsync_local=/srv/www/yavsc +HOST_rsync_yavsc=lua.pschneider.fr +DESTDIR_rsync_yavsc=/srv/www/yavsc -HOST_rsync_test=localhost -DESTDIR_rsync_test=/srv/www/lua +HOST_rsync_lua=lua.pschneider.fr +DESTDIR_rsync_lua=/srv/www/lua -HOST_rsync_pre=lua.localdomain -DESTDIR_rsync_pre=/srv/www/yavsc +HOST_rsync_pre=lua.pschneider.fr +DESTDIR_rsync_pre=/srv/www/yavscpre -HOST_rsync_prod=lua.localdomain -DESTDIR_rsync_prod=/srv/www/lua +HOST_rsync_prod=lua.pschneider.fr +DESTDIR_rsync_prod=/srv/www/yavsc DOCASSBS=NpgsqlBlogProvider.dll WorkFlowProvider.dll Yavsc.WebControls.dll ITContentProvider.dll NpgsqlMRPProviders.dll Yavsc.dll SalesCatalog.dll YavscModel.dll @@ -38,7 +38,6 @@ rsync_% : DESTDIR = $(DESTDIR_$@) rsync_% : deploy echo "!Deploying to $(HOST)!" $(RSYNCCMD) build/web/$(CONFIG)/ root@$(HOST):$(DESTDIR) - ssh root@$(HOST) apachectl restart build: xbuild /p:Configuration=$(CONFIG) /t:Build Yavsc.sln @@ -46,6 +45,8 @@ build: clean: xbuild /t:Clean find -name "StyleCop.Cache" -exec rm {} \; + +distclean: clean rm -rf $(LDYDESTDIR) sourcepkg: @@ -63,14 +64,10 @@ htmldoc: xmldoc docdeploy-prod: htmldoc rsync -ravu web/htmldoc root@$(PRODHOSTDIR) -rsync_local: +rsync_lua: -rsync_test: +rsync_yavsc: rsync_pre: rsync_prod: - -bigrsync: rsync_test rsync_local rsync_pre rsync_prod - - diff --git a/NpgsqlMRPProviders/ChangeLog b/NpgsqlMRPProviders/ChangeLog index 4ae9c1df..47f4f1ec 100644 --- a/NpgsqlMRPProviders/ChangeLog +++ b/NpgsqlMRPProviders/ChangeLog @@ -1,3 +1,8 @@ +2015-10-04 Paul Schneider + + * NpgsqlMembershipProvider.cs: Fixes a Bug introduced by + Npgsql driver upgrade + 2015-08-04 Paul Schneider * NpgsqlMRPProviders.csproj: new NpgsqlUserName provider diff --git a/NpgsqlMRPProviders/NpgsqlMembershipProvider.cs b/NpgsqlMRPProviders/NpgsqlMembershipProvider.cs index 278d955a..4e6a8240 100644 --- a/NpgsqlMRPProviders/NpgsqlMembershipProvider.cs +++ b/NpgsqlMRPProviders/NpgsqlMembershipProvider.cs @@ -358,7 +358,10 @@ namespace Npgsql.Web } MembershipUser u = GetUser (username, false); - + if (passwordQuestion == null) + passwordQuestion = ""; + if (passwordAnswer == null) + passwordAnswer = ""; if (u == null) { DateTime createDate = DateTime.Now; diff --git a/WebControls/ChangeLog b/WebControls/ChangeLog index a859b82b..efe3e9e7 100644 --- a/WebControls/ChangeLog +++ b/WebControls/ChangeLog @@ -1,3 +1,7 @@ +2015-10-04 Paul Schneider + + * ResultPages.cs: . + 2015-09-23 Paul Schneider * InputUserName.cs: formatting diff --git a/WebControls/ResultPages.cs b/WebControls/ResultPages.cs index ed1d3a3d..f3232106 100644 --- a/WebControls/ResultPages.cs +++ b/WebControls/ResultPages.cs @@ -4,6 +4,7 @@ using System.Security.Permissions; using System.Web.UI; using System.Web.UI.WebControls; using System.ComponentModel; +using System.Collections; namespace Yavsc.WebControls { @@ -29,19 +30,16 @@ namespace Yavsc.WebControls } - /// /// Gets or sets the results per page. /// /// The results per page. - [Bindable (true)] - [DefaultValue(10)] - public int ResultsPerPage { + public int PageSize { get { - return (int)( ViewState["ResultsPerPage"]==null?10:ViewState["ResultsPerPage"]); + return (int)( ViewState["PageSize"]==null?10:ViewState["PageSize"]); } set { - ViewState["ResultsPerPage"]=value; + ViewState["PageSize"]=value; } } @@ -50,11 +48,8 @@ namespace Yavsc.WebControls /// Gets or sets the result count. /// /// The result count. - [Bindable (true)] - [DefaultValue(0)] public int ResultCount { get { - return (int)( ViewState["ResultCount"]==null?0:ViewState["ResultCount"]); } set { @@ -66,7 +61,6 @@ namespace Yavsc.WebControls /// Gets or sets the text. /// /// The text. - [Bindable (true)] [DefaultValue("Pages:")] [Localizable(true)] public string Text { @@ -85,25 +79,27 @@ namespace Yavsc.WebControls /// /// The action. [Bindable (true)] - [DefaultValue("")] + [DefaultValue("?pageIndex=")] public string Action { get { string s = (string)ViewState["Action"]; - return (s == null) ? String.Empty : s; + return (s == null) ? "?pageIndex=" : s; } set { ViewState["Action"] = value; } } + /// + /// Gets or sets the none. + /// + /// The none. [Bindable (true)] [DefaultValue("none")] public string None { get { - - string s = (string) ViewState["None"]; - return (s == null) ? String.Empty : s; + return (string) ViewState["None"]; } set { ViewState["None"] = value; @@ -116,41 +112,42 @@ namespace Yavsc.WebControls /// The current page. [Bindable (true)] [DefaultValue(0)] - public int CurrentPage { + public int PageIndex { get { - int i = (int)(ViewState["CurrentPage"]==null?0:ViewState["CurrentPage"]); + int i = (int)(ViewState["PageIndex"]==null?0:ViewState["PageIndex"]); return i; } set { - ViewState["CurrentPage"] = value; + ViewState["PageIndex"] = value; } } + /// /// Renders the contents as the list of links to pages of results. /// /// Writer. protected override void RenderContents (HtmlTextWriter writer) { - if (ResultCount > 0 && ResultCount > ResultsPerPage ) { + if (ResultCount > 0 && ResultCount > PageSize ) { writer.WriteEncodedText (Text); - int pageCount = ((ResultCount-1) / ResultsPerPage) + 1; - for (int pi = (CurrentPage < 5) ? 0 : CurrentPage - 5; pi < pageCount && pi < CurrentPage + 5; pi++) { - if (CurrentPage == pi) - writer.RenderBeginTag ("b"); - else { - writer.AddAttribute (HtmlTextWriterAttribute.Href, - string.Format (Action, pi)); - writer.RenderBeginTag ("a"); + int pageCount = ((ResultCount-1) / PageSize) + 1; + if ( pageCount > 1 ) { + for (int pi = (PageIndex < 5) ? 0 : PageIndex - 5; pi < pageCount && pi < PageIndex + 5; pi++) { + if (PageIndex == pi) + writer.RenderBeginTag ("b"); + else { + writer.AddAttribute (HtmlTextWriterAttribute.Href, + string.Format (Action, pi)); + writer.RenderBeginTag ("a"); + } + writer.Write (pi + 1); + writer.RenderEndTag (); + writer.Write (" "); } - writer.Write (pi+1); - writer.RenderEndTag (); - writer.Write (" "); } } if (ResultCount == 0) { - writer.Write ("("); writer.Write (None); - writer.Write (")"); } } diff --git a/web/App_Themes/style.css b/web/App_Themes/style.css index bb2b24f2..be9389a6 100644 --- a/web/App_Themes/style.css +++ b/web/App_Themes/style.css @@ -4,7 +4,7 @@ body { background-color: black; color: #D0FFD0; font-family: 'Arial', cursive; - padding: 0em; + padding: 2em; } .iconsmall { max-height: 1.3em; max-width: 1.3em; } @@ -20,7 +20,7 @@ header { margin: 1em; padding: 3em; min-height: 10em; - background: url("/images/star-939235_1280.jpg") 0 0 no-repeat fixed; + background: url("/images/star-939235_1280.jpg") 0 0 no-repeat fixed; } nav { @@ -88,7 +88,7 @@ aside { max-width: 40em; padding: .5em; margin: .5em; - background-color: rgba(32,32,64,0.8); + background-color: rgba(32,32,32,0.8); border-radius:10px; } .postpreview video, .postpreview img { @@ -99,11 +99,11 @@ aside { display:block; margin:1em; padding:1em; - background-color: rgba(32,32,64,0.8); + background-color: rgba(32,32,32,0.8); color: #aaa; border-radius:10px; } -.hiddenpost { background-color: rgba(16,16,0,0.3); } +.hiddenpost { background-color: rgba(16,16,16,0.5); } .fullwidth { width: 100%; } textarea.fullwidth { min-height:10em; } @@ -117,7 +117,7 @@ textarea.fullwidth { min-height:10em; } } .panel,.bshpanel, aside { - background-color: rgba(32,16,16,0.8); + background-color: rgba(32,32,16,0.8); border-radius:5px; margin:.5em; padding: .5em; @@ -139,13 +139,13 @@ content: ")"; a { text-decoration: none; color: #B0B080; - background-color:rgba(20,0,20,0.5); + background-color:rgba(20,20,20,0.5); text-decoration: none; } .usertitleref { color: #B0B080; border-radius: 5px; - background-color:rgba(0,0,32,0.8); + background-color:rgba(0,0,32,0.6); font-family: 'Arial', cursive; padding: 1em; } @@ -161,19 +161,19 @@ label { .message, #message { font-size: large; - background-color: rgba(0,64,0,0.1); + background-color: rgba(64,64,0,0.5); } .dirty { - background-color: rgba(128,128,0,0.3); + background-color: rgba(128,128,0,0.5); } .error, #error { color: #f88; font-size: large; - background-color: rgba(128,0,0,0.3); + background-color: rgba(256,0,0,0.5); } .validation-summary-errors{ color: #f88; - background-color: rgba(64,0,0,0.3); + background-color: rgba(256,0,0,0.5); } @@ -195,7 +195,7 @@ ul.preview li:nth-child(n) { .actionlink { color: #B0B080; border-radius: 5px; - background-color:rgba(0,0,32,0.8); + background-color:rgba(0,0,32,0.5); cursor: pointer; font-family: 'Arial', cursive; padding: .2em; diff --git a/web/ChangeLog b/web/ChangeLog index 941e5c1b..af30c548 100644 --- a/web/ChangeLog +++ b/web/ChangeLog @@ -1,3 +1,23 @@ +2015-10-04 Paul Schneider + + * style.css: other colors + + * BlogsController.cs: code cleaning + + * GoogleController.cs: refactoring + + * ErrorHtmlFormatter.cs: MarkdownDeep calls now come from + yavscModel + + * YavscHelpers.cs: xmldoc + + * Index.aspx: code formatting + + * UserPosts.aspx: nothing to note + + * Web.csproj: MarkdownHelper has gone to the yavscModel + project + 2015-10-02 Paul Schneider * style.css: yauniformisation small & large screens. diff --git a/web/Controllers/BlogsController.cs b/web/Controllers/BlogsController.cs index aec2210b..96c39f60 100644 --- a/web/Controllers/BlogsController.cs +++ b/web/Controllers/BlogsController.cs @@ -82,11 +82,10 @@ namespace Yavsc.Controllers /// Page size. public ActionResult BlogList (int pageIndex = 0, int pageSize = 10) { - ViewData ["SiteName"] = sitename; int totalRecords; var bs = BlogManager.LastPosts (pageIndex, pageSize, out totalRecords); - ViewData ["RecordCount"] = totalRecords; - ViewData ["pageSize"] = pageSize; + ViewData ["ResultCount"] = totalRecords; + ViewData ["PageSize"] = pageSize; ViewData ["PageIndex"] = pageIndex; return View ("Index", new BlogEntryCollection(bs) ); } diff --git a/web/Controllers/GoogleController.cs b/web/Controllers/GoogleController.cs index ef84deb5..93d93e77 100644 --- a/web/Controllers/GoogleController.cs +++ b/web/Controllers/GoogleController.cs @@ -212,7 +212,7 @@ namespace Yavsc.Controllers HttpContext.Profile.SetPropertyValue ("Name", me.displayName); // TODO use image if (me.image != null) { - HttpContext.Profile.SetPropertyValue ("avatar", me.image.url); + HttpContext.Profile.SetPropertyValue ("Avatar", me.image.url); } if (me.placesLived != null) { People.Place pplace = me.placesLived.Where (x => x.primary).First (); @@ -341,4 +341,4 @@ namespace Yavsc.Controllers return View (model); } } -} \ No newline at end of file +} diff --git a/web/Formatters/ErrorHtmlFormatter.cs b/web/Formatters/ErrorHtmlFormatter.cs index 8f823547..e8b4ddcd 100644 --- a/web/Formatters/ErrorHtmlFormatter.cs +++ b/web/Formatters/ErrorHtmlFormatter.cs @@ -29,6 +29,7 @@ using System.Web.Mvc; using System.Net; using MarkdownDeep; using Yavsc.Helpers; +using Yavsc.Model.Blogs; namespace Yavsc.Formatters { diff --git a/web/Helpers/YavscHelpers.cs b/web/Helpers/YavscHelpers.cs index cccc5545..b64e507b 100644 --- a/web/Helpers/YavscHelpers.cs +++ b/web/Helpers/YavscHelpers.cs @@ -163,13 +163,17 @@ namespace Yavsc.Helpers foreach (MembershipUser u in users) YavscHelpers.SendActivationMessage (u); } - + /// + /// Avatars the URL. + /// + /// The URL. + /// Helper. + /// Username. 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"; + var a = pr.GetPropertyValue("Avatar") ; + if (a == null || a is DBNull) return "/avatars/" + helper.Encode(username)+".png"; + return helper.Encode ((string)a); } } } diff --git a/web/Views/Blogs/Index.aspx b/web/Views/Blogs/Index.aspx index c6190120..3877671c 100644 --- a/web/Views/Blogs/Index.aspx +++ b/web/Views/Blogs/Index.aspx @@ -10,7 +10,7 @@
<%= Html.ActionLink(p.Title, "UserPost", new { user = g.Key, title = p.Title }, new { @class = "usertitleref" } ) %> - +

<%= Html.Markdown(p.Intro,"/bfiles/"+p.Id+"/") %>

<% } %> <% } %> - -
- <% rp1.ResultCount = Model.Count; rp1.ResultsPerPage = 50; %> -<% rp1.CurrentPage = (int) ViewData["PageIndex"]; %> -<% rp1.None = Html.Translate("no content"); %> - + +<% rp1.ResultCount = (int) ViewData["ResultCount"]; + rp1.PageSize = (int) ViewData ["PageSize"]; + rp1.PageIndex = (int) ViewData["PageIndex"]; + rp1.None = Html.Translate("no content"); +%> + + Aucun résultat - - + diff --git a/web/Views/Blogs/UserPosts.aspx b/web/Views/Blogs/UserPosts.aspx index d714ef92..5aea9ed0 100644 --- a/web/Views/Blogs/UserPosts.aspx +++ b/web/Views/Blogs/UserPosts.aspx @@ -33,22 +33,19 @@ <%= Html.ActionLink("Editer","Edit", new { id = e.Id }, new { @class="actionlink" }) %> <%= Html.ActionLink("Supprimer","RemovePost", new { id = e.Id }, new { @class="actionlink" } ) %> <% } %> - + + + <% } %> - -
+
\ No newline at end of file diff --git a/web/Web.csproj b/web/Web.csproj index 3d5775f5..eb947fc5 100644 --- a/web/Web.csproj +++ b/web/Web.csproj @@ -188,7 +188,6 @@ - diff --git a/yavscModel/Blogs/BlogEntryCollection.cs b/yavscModel/Blogs/BlogEntryCollection.cs index 5d6fc5b3..e0306b59 100644 --- a/yavscModel/Blogs/BlogEntryCollection.cs +++ b/yavscModel/Blogs/BlogEntryCollection.cs @@ -56,15 +56,11 @@ namespace Yavsc.Model.Blogs { return this.Where (x => x.Title == title).ToArray (); } + /// - /// Post info. + /// Base post info. /// - public struct PostInfoByTitle { - - /// - /// The name of the user. - /// - public string Author; + public class BasePostInfo { /// /// The identifier. /// @@ -78,29 +74,32 @@ namespace Yavsc.Model.Blogs /// public DateTime Modified; + /// + /// The intro. + /// + public string Intro; } + /// - /// Post info by user. + /// Post info. /// - public struct PostInfoByUser { + public class PostInfoByTitle : BasePostInfo { /// /// The name of the user. /// - public string Title; - /// - /// The identifier. - /// - public long Id; - /// - /// The posted. - /// - public DateTime Posted; + public string Author; + + } + /// + /// Post info by user. + /// + public class PostInfoByUser : BasePostInfo { + /// - /// The modified. + /// The name of the user. /// - public DateTime Modified; - + public string Title; } /// @@ -108,11 +107,12 @@ namespace Yavsc.Model.Blogs /// public IEnumerable> GroupByTitle() { + bool truncated; return from be in this orderby be.Posted descending group new PostInfoByTitle { Author=be.Author, Id=be.Id, - Posted=be.Posted, Modified=be.Modified } + Posted=be.Posted, Modified=be.Modified, Intro = MarkdownHelper.MarkdownIntro(be.Content, out truncated) } by be.Title into titlegroup select titlegroup; @@ -123,11 +123,12 @@ namespace Yavsc.Model.Blogs /// The by user. public IEnumerable> GroupByUser() { + bool truncated; return from be in this orderby be.Posted descending group new PostInfoByUser { Title=be.Title, Id=be.Id, - Posted=be.Posted, Modified=be.Modified } + Posted=be.Posted, Modified=be.Modified, Intro = MarkdownHelper.MarkdownIntro(be.Content, out truncated) } by be.Author into usergroup select usergroup; diff --git a/web/Helpers/MarkdownHelper.cs b/yavscModel/Blogs/MarkdownHelper.cs similarity index 72% rename from web/Helpers/MarkdownHelper.cs rename to yavscModel/Blogs/MarkdownHelper.cs index 100a3dbe..422835ca 100644 --- a/web/Helpers/MarkdownHelper.cs +++ b/yavscModel/Blogs/MarkdownHelper.cs @@ -2,7 +2,7 @@ using System.Web.Mvc; using MarkdownDeep; -namespace Yavsc.Helpers +namespace Yavsc.Model.Blogs { /// /// Helper class for transforming Markdown. @@ -44,27 +44,47 @@ namespace Yavsc.Helpers return new MvcHtmlString(html); } - public static IHtmlString MarkdownToHtmlIntro(this HtmlHelper helper, out bool truncated, string text, string urlBaseLocation="") - { + public static string MarkdownIntro(string markdown, out bool truncated) { int maxLen = 250; - // Transform the supplied text (Markdown) into HTML. - var markdownTransformer = new Markdown(); - markdownTransformer.ExtraMode = true; - markdownTransformer.UrlBaseLocation = urlBaseLocation; - if (text.Length < maxLen) { + if (markdown.Length < maxLen) { truncated = false; - return new MvcHtmlString(markdownTransformer.Transform(text)); + return markdown; } - string intro = text.Remove (maxLen); + string intro = markdown.Remove (maxLen); truncated = true; int inl = intro.LastIndexOf ("\n"); if (inl > 20) intro = intro.Remove (inl); intro += " ..."; - - string html = markdownTransformer.Transform(intro); + return intro; + } + /// + /// Markdowns to html intro. + /// + /// The to html intro. + /// Truncated. + /// Text. + /// URL base location. + public static string MarkdownToHtmlIntro(out bool truncated, string text, string urlBaseLocation="") { + var md = MarkdownIntro(text, out truncated); + var markdownTransformer = new Markdown(); + markdownTransformer.ExtraMode = true; + markdownTransformer.UrlBaseLocation = urlBaseLocation; + string html = markdownTransformer.Transform(md); + return html; + } + /// + /// Markdowns to html intro. + /// + /// The to html intro. + /// Helper. + /// Truncated. + /// Text. + /// URL base location. + public static IHtmlString MarkdownToHtmlIntro(this HtmlHelper helper, out bool truncated, string text, string urlBaseLocation="") + { // Wrap the html in an MvcHtmlString otherwise it'll be HtmlEncoded and displayed to the user as HTML :( - return new MvcHtmlString(html); + return new MvcHtmlString(MarkdownToHtmlIntro (out truncated, text, urlBaseLocation)); } /// diff --git a/yavscModel/ChangeLog b/yavscModel/ChangeLog index c459a9b4..1de591d9 100644 --- a/yavscModel/ChangeLog +++ b/yavscModel/ChangeLog @@ -1,3 +1,11 @@ +2015-10-04 Paul Schneider + + * MarkdownHelper.cs: + * BlogEntryCollection.cs: refactoring + extract an intro from + Markdown for PostInfo* + + * YavscModel.csproj: MarkdownHelper integration + 2015-10-01 Paul Schneider * Profile.cs: refactoring diff --git a/yavscModel/YavscModel.csproj b/yavscModel/YavscModel.csproj index 925ec5f6..feb09ae1 100644 --- a/yavscModel/YavscModel.csproj +++ b/yavscModel/YavscModel.csproj @@ -41,6 +41,9 @@ + + ..\web\lib\MarkdownDeep.dll + @@ -167,6 +170,7 @@ +