Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion BlogEngine/BlogEngine.Core/Data/WidgetsRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public bool Update(List<WidgetZone> items)
if(widget.Id.Length < 30)
{
widget.Id = System.Guid.NewGuid().ToString();
widget.ShowTitle = true;
}
id.InnerText = widget.Id;
node.Attributes.Append(id);
Expand All @@ -61,7 +62,7 @@ public bool Update(List<WidgetZone> 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);
Expand Down
15 changes: 8 additions & 7 deletions BlogEngine/BlogEngine.NET/AppCode/Controls/PostPager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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}");
}
Expand Down
2 changes: 1 addition & 1 deletion BlogEngine/BlogEngine.NET/AppCode/Controls/WidgetZone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,25 +193,50 @@ protected override void Render(HtmlTextWriter writer)
/// </param>
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();
Expand Down
2 changes: 1 addition & 1 deletion BlogEngine/BlogEngine.NET/archive.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down