diff --git a/BlogEngine/BlogEngine.Core/Data/WidgetsRepository.cs b/BlogEngine/BlogEngine.Core/Data/WidgetsRepository.cs index de10a4152..373f33041 100644 --- a/BlogEngine/BlogEngine.Core/Data/WidgetsRepository.cs +++ b/BlogEngine/BlogEngine.Core/Data/WidgetsRepository.cs @@ -52,6 +52,7 @@ public bool Update(List items) if(widget.Id.Length < 30) { widget.Id = System.Guid.NewGuid().ToString(); + widget.ShowTitle = true; } id.InnerText = widget.Id; node.Attributes.Append(id); @@ -61,7 +62,7 @@ public bool Update(List items) node.Attributes.Append(title); var show = doc.CreateAttribute("showTitle"); - show.InnerText = "True"; + show.InnerText = widget.ShowTitle.ToString(); //"True"; node.Attributes.Append(show); widgets.AppendChild(node); diff --git a/BlogEngine/BlogEngine.NET/AppCode/Controls/PostPager.cs b/BlogEngine/BlogEngine.NET/AppCode/Controls/PostPager.cs index 77046c16a..61e605c33 100644 --- a/BlogEngine/BlogEngine.NET/AppCode/Controls/PostPager.cs +++ b/BlogEngine/BlogEngine.NET/AppCode/Controls/PostPager.cs @@ -184,13 +184,14 @@ private static string PageUrl() path += "?"; } - if(!path.Contains(".aspx", StringComparison.OrdinalIgnoreCase)) - { - if(path.EndsWith("?") && !path.EndsWith("/?")) - { - path = path.Replace("?", "/?"); - } - } + // www.mysite.com/blog/?page=2 dont work so rem this code + //if(!path.Contains(".aspx", StringComparison.OrdinalIgnoreCase)) + //{ + // if(path.EndsWith("?") && !path.EndsWith("/?")) + // { + // path = path.Replace("?", "/?"); + // } + //} return HttpUtility.HtmlEncode(path + "page={0}"); } diff --git a/BlogEngine/BlogEngine.NET/AppCode/Controls/WidgetZone.cs b/BlogEngine/BlogEngine.NET/AppCode/Controls/WidgetZone.cs index 9bb64a4e9..599fec69c 100644 --- a/BlogEngine/BlogEngine.NET/AppCode/Controls/WidgetZone.cs +++ b/BlogEngine/BlogEngine.NET/AppCode/Controls/WidgetZone.cs @@ -83,7 +83,7 @@ protected override void OnLoad(EventArgs e) widget.InnerText); try { - var model = new { Id = widget.Attributes["id"].Value, Name = widget.InnerText, Title = widget.Attributes["title"].Value }; + var model = new { Id = widget.Attributes["id"].Value, Name = widget.InnerText, Title = widget.Attributes["title"].Value, ShowTitle = bool.Parse(widget.Attributes["showTitle"].Value) }; var lit = new Literal { Text = RazorHelpers.ParseRazor(fileName, model) }; Controls.Add(lit); } diff --git a/BlogEngine/BlogEngine.NET/Custom/Extensions/SimpleCaptcha/SimpleCaptcha.cs b/BlogEngine/BlogEngine.NET/Custom/Extensions/SimpleCaptcha/SimpleCaptcha.cs index c2db66742..cebf94f41 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Extensions/SimpleCaptcha/SimpleCaptcha.cs +++ b/BlogEngine/BlogEngine.NET/Custom/Extensions/SimpleCaptcha/SimpleCaptcha.cs @@ -69,11 +69,17 @@ private static ExtensionSettings Settings settings = new ExtensionSettings("SimpleCaptcha") { IsScalar = true }; settings.AddParameter("CaptchaLabel", "Your captcha's label", 30, true, true, ParameterType.String); - settings.AddValue("CaptchaLabel", "5+5 = "); + Random r = new Random(); + int a = r.Next(1, 9); + int b = r.Next(0, 9); + int c = a + b; + //settings.AddValue("CaptchaLabel", "5+5 = "); + settings.AddValue("CaptchaLabel", a.ToString() + " + " + b.ToString() + " = "); settings.AddParameter( "CaptchaAnswer", "Your captcha's expected value", MaxCaptchaLength, true, true, ParameterType.String); - settings.AddValue("CaptchaAnswer", "10"); + //settings.AddValue("CaptchaAnswer", "10"); + settings.AddValue("CaptchaAnswer", c.ToString()); settings.AddParameter( "ShowForAuthenticatedUsers", diff --git a/BlogEngine/BlogEngine.NET/Custom/Extensions/SimpleCaptcha/SimpleCaptchaControl.cs b/BlogEngine/BlogEngine.NET/Custom/Extensions/SimpleCaptcha/SimpleCaptchaControl.cs index 8f7b543e0..ba47ac290 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Extensions/SimpleCaptcha/SimpleCaptchaControl.cs +++ b/BlogEngine/BlogEngine.NET/Custom/Extensions/SimpleCaptcha/SimpleCaptchaControl.cs @@ -193,25 +193,50 @@ protected override void Render(HtmlTextWriter writer) /// protected override void RenderContents(HtmlTextWriter output) { - output.RenderBeginTag(HtmlTextWriterTag.P); + //output.RenderBeginTag(HtmlTextWriterTag.P); + //output.AddAttribute(HtmlTextWriterAttribute.For, SimpleCaptchaAnswerField); + //output.AddAttribute(HtmlTextWriterAttribute.Style, "margin-right: 5px;"); + //output.RenderBeginTag(HtmlTextWriterTag.Label); + //output.Write(this.simpleCaptchaLabel); + //output.RenderEndTag(); + + //output.AddAttribute(HtmlTextWriterAttribute.Id, SimpleCaptchaAnswerField); + //output.AddAttribute(HtmlTextWriterAttribute.Name, SimpleCaptchaAnswerField); + //output.AddAttribute(HtmlTextWriterAttribute.Type, "text"); + //output.AddAttribute(HtmlTextWriterAttribute.Tabindex, this.TabIndex.ToString()); + //output.AddAttribute(HtmlTextWriterAttribute.Maxlength, Convert.ToString(SimpleCaptcha.MaxCaptchaLength)); + //output.AddAttribute(HtmlTextWriterAttribute.Value, string.Empty); + //output.RenderBeginTag(HtmlTextWriterTag.Input); + //output.RenderEndTag(); + + //output.AddAttribute(HtmlTextWriterAttribute.Id, "spnSimpleCaptchaIncorrect"); + //output.AddStyleAttribute(HtmlTextWriterStyle.Display, "none"); + //output.AddStyleAttribute(HtmlTextWriterStyle.Color, "Red"); + //output.RenderBeginTag(HtmlTextWriterTag.Span); + //output.WriteLine(this.ErrorMessage); + //output.RenderEndTag(); + //output.RenderEndTag(); + + // classes instead of inline style ( + output.AddAttribute(HtmlTextWriterAttribute.Class, "form-inline simpleCaptcha"); + output.RenderBeginTag(HtmlTextWriterTag.Div); output.AddAttribute(HtmlTextWriterAttribute.For, SimpleCaptchaAnswerField); - output.AddAttribute(HtmlTextWriterAttribute.Style, "margin-right: 5px;"); output.RenderBeginTag(HtmlTextWriterTag.Label); output.Write(this.simpleCaptchaLabel); output.RenderEndTag(); - output.AddAttribute(HtmlTextWriterAttribute.Id, SimpleCaptchaAnswerField); - output.AddAttribute(HtmlTextWriterAttribute.Name, SimpleCaptchaAnswerField); - output.AddAttribute(HtmlTextWriterAttribute.Type, "text"); - output.AddAttribute(HtmlTextWriterAttribute.Tabindex, this.TabIndex.ToString()); - output.AddAttribute(HtmlTextWriterAttribute.Maxlength, Convert.ToString(SimpleCaptcha.MaxCaptchaLength)); - output.AddAttribute(HtmlTextWriterAttribute.Value, string.Empty); - output.RenderBeginTag(HtmlTextWriterTag.Input); - output.RenderEndTag(); + output.WriteBeginTag("input"); + output.WriteAttribute(HtmlTextWriterAttribute.Name.ToString(), SimpleCaptchaAnswerField); + output.WriteAttribute(HtmlTextWriterAttribute.Type.ToString(), "text"); + output.WriteAttribute(HtmlTextWriterAttribute.Tabindex.ToString(), this.TabIndex.ToString()); + output.WriteAttribute(HtmlTextWriterAttribute.Maxlength.ToString(), Convert.ToString(SimpleCaptcha.MaxCaptchaLength)); + output.WriteAttribute(HtmlTextWriterAttribute.Value.ToString(), string.Empty); + output.WriteAttribute(HtmlTextWriterAttribute.Class.ToString(), "form-control inputSimpleCaptcha"); + output.Write(HtmlTextWriter.SelfClosingTagEnd); output.AddAttribute(HtmlTextWriterAttribute.Id, "spnSimpleCaptchaIncorrect"); + output.AddAttribute(HtmlTextWriterAttribute.Class, "text-danger"); output.AddStyleAttribute(HtmlTextWriterStyle.Display, "none"); - output.AddStyleAttribute(HtmlTextWriterStyle.Color, "Red"); output.RenderBeginTag(HtmlTextWriterTag.Span); output.WriteLine(this.ErrorMessage); output.RenderEndTag(); diff --git a/BlogEngine/BlogEngine.NET/archive.aspx.cs b/BlogEngine/BlogEngine.NET/archive.aspx.cs index b35933034..be935b534 100644 --- a/BlogEngine/BlogEngine.NET/archive.aspx.cs +++ b/BlogEngine/BlogEngine.NET/archive.aspx.cs @@ -151,7 +151,7 @@ private static void CreateTableRow(HtmlTable table, Post post) HtmlTableRow row = new HtmlTableRow(); HtmlTableCell date = new HtmlTableCell(); - date.InnerHtml = post.DateCreated.ToString("yyyy-MM-dd"); + date.InnerHtml = post.DateCreated.ToShortDateString(); date.Attributes.Add("class", "date"); row.Cells.Add(date);