From f764445e2cbdf98c145923c24e522197e8048bed Mon Sep 17 00:00:00 2001 From: rxtur Date: Tue, 9 Feb 2016 22:14:57 -0600 Subject: [PATCH 001/152] Improvements to widget edit and validation --- .../datastore/widgets/be_WIDGET_ZONE.xml | 2 +- .../Custom/Widgets/RecentComments/edit.cshtml | 54 ++++++++++++------- .../Custom/Widgets/shared.cshtml | 31 ++++++----- .../app/custom/widgets/widgetController.js | 23 +++++--- .../admin/app/custom/widgets/widgetView.html | 9 ++-- 5 files changed, 73 insertions(+), 46 deletions(-) diff --git a/BlogEngine/BlogEngine.NET/App_Data/datastore/widgets/be_WIDGET_ZONE.xml b/BlogEngine/BlogEngine.NET/App_Data/datastore/widgets/be_WIDGET_ZONE.xml index 903a37e3f..badc5a7b8 100644 --- a/BlogEngine/BlogEngine.NET/App_Data/datastore/widgets/be_WIDGET_ZONE.xml +++ b/BlogEngine/BlogEngine.NET/App_Data/datastore/widgets/be_WIDGET_ZONE.xml @@ -5,7 +5,7 @@ Tag cloud TextBox Category list - RecentComments + RecentComments Page List Post List \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/edit.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/edit.cshtml index 81bbf48e5..122e33f5c 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/edit.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/edit.cshtml @@ -3,30 +3,46 @@ var NumberOfComments = 10; var widgetId = Request.QueryString["id"]; var settings = WidgetHelper.GetSettings(widgetId); - + Validation.Add("txtNumberOfComments", + Validator.Required("Field is required"), + Validator.Integer("Field is numeric") + ); if (IsPost) { - settings["numberofcomments"] = Request.Form["txtNumberOfComments"]; - WidgetHelper.SaveSettings(settings, widgetId); + if (Validation.IsValid() && settings["numberofcomments"] != Request.Form["txtNumberOfComments"]) + { + settings["numberofcomments"] = Request.Form["txtNumberOfComments"]; + WidgetHelper.SaveSettings(settings, widgetId); + @: + } } if (settings != null && settings.Count > 0) { NumberOfComments = int.Parse(settings["numberofcomments"]); } } - - - -
-
- - -
-
- -
-
\ No newline at end of file + + + + + + + + +
+
+ + + @Html.ValidationMessage("txtNumberOfComments") +
+
+ +
+
+ + \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/shared.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/shared.cshtml index 4cae59b65..a144c81f5 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/shared.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/shared.cshtml @@ -1,14 +1,17 @@ - - - -
-
- -
-
+ + + + + + + + +
+
+ +
+
+ + \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js index 21feeb257..fe4705d90 100644 --- a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js +++ b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js @@ -38,6 +38,7 @@ $scope.editId = id; $scope.editTitle = title; $("#txtWidgetTitle").val(title); + $("#titleValidation").hide(); $.ajax({ type: 'HEAD', url: customSrc, @@ -54,7 +55,6 @@ $scope.closeEditForm = function () { $("#edit-widget").modal("hide"); - $scope.load(); } $scope.moveObject = function (from, to, fromList, toList) { @@ -91,22 +91,29 @@ } $scope.updateTitle = function () { - if ($scope.editTitle != $("#txtWidgetTitle").val()) { - for (var i = 0; i < $scope.vm.WidgetZones.length; i++) { - for (var j = 0; j < $scope.vm.WidgetZones[i].Widgets.length; j++) { - if ($scope.vm.WidgetZones[i].Widgets[j].Id === $scope.editId) { - $scope.vm.WidgetZones[i].Widgets[j].Title = $("#txtWidgetTitle").val(); + if ($("#txtWidgetTitle").val().length > 0) { + if ($scope.editTitle != $("#txtWidgetTitle").val()) { + for (var i = 0; i < $scope.vm.WidgetZones.length; i++) { + for (var j = 0; j < $scope.vm.WidgetZones[i].Widgets.length; j++) { + if ($scope.vm.WidgetZones[i].Widgets[j].Id === $scope.editId) { + $scope.vm.WidgetZones[i].Widgets[j].Title = $("#txtWidgetTitle").val(); + } } } + $scope.save(); } - $scope.save(); - } + } + else { + $("#titleValidation").show(); + $("#txtWidgetTitle").focus(); + } } $scope.load(); $(document).ready(function () { bindCommon(); + $("#titleValidation").hide(); }); }]); diff --git a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html index 8b6ac6f7c..be4337160 100644 --- a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html +++ b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html @@ -1,9 +1,7 @@ 

{{lbl.widgets}}

@@ -23,6 +21,9 @@
+ + Field is required +
From 6765d936c11a2d8843fa272f90f07108ef0d0a91 Mon Sep 17 00:00:00 2001 From: rxtur Date: Fri, 12 Feb 2016 12:12:17 -0600 Subject: [PATCH 002/152] Widget improvements - validation and cancel save --- .../Custom/Widgets/Post List/edit.cshtml | 31 ++++++++++++------- .../Custom/Widgets/RecentComments/edit.cshtml | 4 +-- .../Custom/Widgets/Tag cloud/edit.cshtml | 2 +- .../Custom/Widgets/shared.cshtml | 4 +-- .../app/custom/widgets/widgetController.js | 6 +++- 5 files changed, 30 insertions(+), 17 deletions(-) diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/Post List/edit.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/Post List/edit.cshtml index 98fe04ee5..5d948a9b1 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/Post List/edit.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/Post List/edit.cshtml @@ -11,17 +11,24 @@ var widgetId = Request.QueryString["id"]; var settings = WidgetHelper.GetSettings(widgetId); - + Validation.Add("txtNumberOfPosts", + Validator.Required("Field is required"), + Validator.Integer("Field is numeric") + ); if (IsPost) { - settings["numberofposts"] = Request.Form["txtNumberOfPosts"]; - settings["cutegory"] = Request.Form["ddlCategories"]; - settings["author"] = Request.Form["ddlAuthors"]; - settings["sortorder"] = Request.Form["ddlSortBy"]; - settings["showimg"] = Request.Form["cbShowImg"] == "on" ? "true" : "false"; - settings["showdesc"] = Request.Form["cbShowDesc"] == "on" ? "true" : "false"; - settings["showdate"] = Request.Form["cbShowDate"] == "on" ? "true" : "false"; - WidgetHelper.SaveSettings(settings, widgetId); + if (Validation.IsValid()) + { + settings["numberofposts"] = Request.Form["txtNumberOfPosts"]; + settings["cutegory"] = Request.Form["ddlCategories"]; + settings["author"] = Request.Form["ddlAuthors"]; + settings["sortorder"] = Request.Form["ddlSortBy"]; + settings["showimg"] = Request.Form["cbShowImg"] == "on" ? "true" : "false"; + settings["showdesc"] = Request.Form["cbShowDesc"] == "on" ? "true" : "false"; + settings["showdate"] = Request.Form["cbShowDate"] == "on" ? "true" : "false"; + WidgetHelper.SaveSettings(settings, widgetId); + @: + } } if (settings != null && settings.Count > 0) { @@ -59,11 +66,13 @@ -
+
@Html.TextBox("txtNumberOfPosts", numberOfPosts, new { @class = "form-control" }) + @Html.ValidationMessage("txtNumberOfPosts")
@@ -93,7 +102,7 @@
-
diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/edit.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/edit.cshtml index 122e33f5c..4f9852599 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/edit.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/edit.cshtml @@ -32,14 +32,14 @@ - +
@Html.ValidationMessage("txtNumberOfComments")
-
diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/Tag cloud/edit.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/Tag cloud/edit.cshtml index 207439522..4d14a1a98 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/Tag cloud/edit.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/Tag cloud/edit.cshtml @@ -60,7 +60,7 @@
\ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/shared.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/shared.cshtml index a144c81f5..752c71b6d 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/shared.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/shared.cshtml @@ -6,9 +6,9 @@ -
+
-
diff --git a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js index fe4705d90..05fe6d7da 100644 --- a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js +++ b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js @@ -39,6 +39,7 @@ $scope.editTitle = title; $("#txtWidgetTitle").val(title); $("#titleValidation").hide(); + $("#settingsFrame").contents().find('.field-validation-error').hide(); $.ajax({ type: 'HEAD', url: customSrc, @@ -101,11 +102,14 @@ } } $scope.save(); + return true; } + return false; } else { $("#titleValidation").show(); $("#txtWidgetTitle").focus(); + return false; } } @@ -118,5 +122,5 @@ }]); var updateTitle = function () { - angular.element($('#edit-widget')).scope().updateTitle(); + return angular.element($('#edit-widget')).scope().updateTitle(); } \ No newline at end of file From 04328dfa68b01dfe86e3e08cfb89ab0f77fd2382 Mon Sep 17 00:00:00 2001 From: rxtur Date: Sat, 13 Feb 2016 12:27:48 -0600 Subject: [PATCH 003/152] Widgets refactoring, newsletter (3.2.1.2) --- .../BlogEngine.Core/BlogEngine.Core.csproj | 2 - BlogEngine/BlogEngine.Core/Post.cs | 14 +- .../Properties/AssemblyInfo.cs | 2 +- .../datastore/widgets/be_WIDGET_ZONE.xml | 8 +- .../BlogEngine.NET/BlogEngine.NET.csproj | 22 +- .../Custom/Extensions/Newsletter.cs | 29 +++ .../{Blog List => BlogList}/widget.cshtml | 0 .../Widgets/CategoryList/CategoryList.cs} | 12 +- .../widget.cshtml | 3 +- .../Custom/Widgets/Common.cs} | 14 +- .../Custom/Widgets/Newsletter/Newsletter.cs | 193 ++++++++++++++++++ .../Custom/Widgets/Newsletter/edit.cshtml | 50 +++++ .../Custom/Widgets/Newsletter/widget.cshtml | 52 +++++ .../{Page List => PageList}/widget.cshtml | 0 .../{Post List => PostList}/edit.cshtml | 6 +- .../{Post List => PostList}/widget.cshtml | 6 +- .../Custom/Widgets/RecentComments/edit.cshtml | 6 +- .../Widgets/RecentComments/widget.cshtml | 7 +- .../{Tag cloud => TagCloud}/edit.cshtml | 6 +- .../{Tag cloud => TagCloud}/widget.cshtml | 0 .../Custom/Widgets/TextBox/edit.cshtml | 6 +- .../Custom/Widgets/TextBox/widget.cshtml | 4 +- .../Widgets/{shared.cshtml => common.cshtml} | 0 .../app/custom/widgets/widgetController.js | 2 +- 24 files changed, 383 insertions(+), 61 deletions(-) create mode 100644 BlogEngine/BlogEngine.NET/Custom/Extensions/Newsletter.cs rename BlogEngine/BlogEngine.NET/Custom/Widgets/{Blog List => BlogList}/widget.cshtml (100%) rename BlogEngine/{BlogEngine.Core/Helpers/CategoryHelper.cs => BlogEngine.NET/Custom/Widgets/CategoryList/CategoryList.cs} (82%) rename BlogEngine/BlogEngine.NET/Custom/Widgets/{Category list => CategoryList}/widget.cshtml (93%) rename BlogEngine/{BlogEngine.Core/Helpers/WidgetHelper.cs => BlogEngine.NET/Custom/Widgets/Common.cs} (86%) create mode 100644 BlogEngine/BlogEngine.NET/Custom/Widgets/Newsletter/Newsletter.cs create mode 100644 BlogEngine/BlogEngine.NET/Custom/Widgets/Newsletter/edit.cshtml create mode 100644 BlogEngine/BlogEngine.NET/Custom/Widgets/Newsletter/widget.cshtml rename BlogEngine/BlogEngine.NET/Custom/Widgets/{Page List => PageList}/widget.cshtml (100%) rename BlogEngine/BlogEngine.NET/Custom/Widgets/{Post List => PostList}/edit.cshtml (96%) rename BlogEngine/BlogEngine.NET/Custom/Widgets/{Post List => PostList}/widget.cshtml (96%) rename BlogEngine/BlogEngine.NET/Custom/Widgets/{Tag cloud => TagCloud}/edit.cshtml (95%) rename BlogEngine/BlogEngine.NET/Custom/Widgets/{Tag cloud => TagCloud}/widget.cshtml (100%) rename BlogEngine/BlogEngine.NET/Custom/Widgets/{shared.cshtml => common.cshtml} (100%) diff --git a/BlogEngine/BlogEngine.Core/BlogEngine.Core.csproj b/BlogEngine/BlogEngine.Core/BlogEngine.Core.csproj index e03f8e295..45b053c34 100644 --- a/BlogEngine/BlogEngine.Core/BlogEngine.Core.csproj +++ b/BlogEngine/BlogEngine.Core/BlogEngine.Core.csproj @@ -118,8 +118,6 @@ - - diff --git a/BlogEngine/BlogEngine.Core/Post.cs b/BlogEngine/BlogEngine.Core/Post.cs index dff181ee4..98957295c 100644 --- a/BlogEngine/BlogEngine.Core/Post.cs +++ b/BlogEngine/BlogEngine.Core/Post.cs @@ -1601,29 +1601,29 @@ protected override void DataUpdate() if (AboutToPublishPost()) { var e = new CancelEventArgs(); - this.OnPublishing(e); + OnPublishing(e); if (e.Cancel) { - this.isPublished = false; + isPublished = false; } } BlogService.UpdatePost(this); Posts.Sort(); AddRelations(Posts); - this.ResetNestedComments(); + ResetNestedComments(); - if (this.isPublished) + if (isPublished && !IsDeleted) { - this.OnPublished(); + OnPublished(); } } bool AboutToPublishPost() { - if (this.isPublished) + if (isPublished && !IsDeleted) { - var p = DataSelect(this.Id); + var p = DataSelect(Id); if (p != null && !p.isPublished) { return true; diff --git a/BlogEngine/BlogEngine.Core/Properties/AssemblyInfo.cs b/BlogEngine/BlogEngine.Core/Properties/AssemblyInfo.cs index 09c3c2aa6..f78090b2f 100644 --- a/BlogEngine/BlogEngine.Core/Properties/AssemblyInfo.cs +++ b/BlogEngine/BlogEngine.Core/Properties/AssemblyInfo.cs @@ -19,5 +19,5 @@ [assembly: CLSCompliant(false)] [assembly: ComVisible(false)] [assembly: AllowPartiallyTrustedCallers] -[assembly: AssemblyVersion("3.2.1.1")] +[assembly: AssemblyVersion("3.2.1.2")] [assembly: SecurityRules(SecurityRuleSet.Level1)] diff --git a/BlogEngine/BlogEngine.NET/App_Data/datastore/widgets/be_WIDGET_ZONE.xml b/BlogEngine/BlogEngine.NET/App_Data/datastore/widgets/be_WIDGET_ZONE.xml index badc5a7b8..fc8f4fb2e 100644 --- a/BlogEngine/BlogEngine.NET/App_Data/datastore/widgets/be_WIDGET_ZONE.xml +++ b/BlogEngine/BlogEngine.NET/App_Data/datastore/widgets/be_WIDGET_ZONE.xml @@ -2,10 +2,8 @@ Administration Search - Tag cloud TextBox - Category list - RecentComments - Page List - Post List + CategoryList + PostList + Newsletter \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/BlogEngine.NET.csproj b/BlogEngine/BlogEngine.NET/BlogEngine.NET.csproj index 469de329b..55427d811 100644 --- a/BlogEngine/BlogEngine.NET/BlogEngine.NET.csproj +++ b/BlogEngine/BlogEngine.NET/BlogEngine.NET.csproj @@ -706,20 +706,22 @@ - - - - + + + + - + - - - + + + + + @@ -1893,6 +1895,7 @@ + @@ -2106,6 +2109,9 @@ site.master + + + default.aspx ASPXCodeBehind diff --git a/BlogEngine/BlogEngine.NET/Custom/Extensions/Newsletter.cs b/BlogEngine/BlogEngine.NET/Custom/Extensions/Newsletter.cs new file mode 100644 index 000000000..ef1dcc408 --- /dev/null +++ b/BlogEngine/BlogEngine.NET/Custom/Extensions/Newsletter.cs @@ -0,0 +1,29 @@ +using System; +using BlogEngine.Core; +using BlogEngine.Core.Web.Controls; +using BlogEngine.Core.Web.Extensions; + +/// +/// Sends emails to newsletter subscribers +/// +[Extension("Sends emails to newsletter subscribers", "3.3.0.0", "BlogEngine.NET")] +public class Newsletter +{ + #region Constructors and Destructors + + static Newsletter() + { + Post.Published += Post_Published; + } + + private static void Post_Published(object sender, EventArgs e) + { + if (!ExtensionManager.ExtensionEnabled("Newsletter")) + return; + + var publishable = (IPublishable)sender; + BlogEngine.NET.Custom.Widgets.Newsletter.SendEmails(publishable); + } + + #endregion +} \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/Blog List/widget.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/BlogList/widget.cshtml similarity index 100% rename from BlogEngine/BlogEngine.NET/Custom/Widgets/Blog List/widget.cshtml rename to BlogEngine/BlogEngine.NET/Custom/Widgets/BlogList/widget.cshtml diff --git a/BlogEngine/BlogEngine.Core/Helpers/CategoryHelper.cs b/BlogEngine/BlogEngine.NET/Custom/Widgets/CategoryList/CategoryList.cs similarity index 82% rename from BlogEngine/BlogEngine.Core/Helpers/CategoryHelper.cs rename to BlogEngine/BlogEngine.NET/Custom/Widgets/CategoryList/CategoryList.cs index 5c2d650ae..d562bb816 100644 --- a/BlogEngine/BlogEngine.Core/Helpers/CategoryHelper.cs +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/CategoryList/CategoryList.cs @@ -1,12 +1,10 @@ -using System.Collections.Generic; +using BlogEngine.Core; +using System.Collections.Generic; using System.Linq; -namespace BlogEngine.Core.Helpers +namespace BlogEngine.NET.Custom.Widgets { - /// - /// Helper for category list widget - /// - public class CategoryHelper + public class CategoryList { private static bool HasPosts(Category cat) { @@ -32,4 +30,4 @@ public static SortedDictionary SortCategories() return dic; } } -} +} \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/Category list/widget.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/CategoryList/widget.cshtml similarity index 93% rename from BlogEngine/BlogEngine.NET/Custom/Widgets/Category list/widget.cshtml rename to BlogEngine/BlogEngine.NET/Custom/Widgets/CategoryList/widget.cshtml index e82ec6919..b3bafbe1e 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/Category list/widget.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/CategoryList/widget.cshtml @@ -1,7 +1,8 @@ @using BlogEngine.Core +@using BlogEngine.NET.Custom.Widgets @{ var title = Model.Title; - var dic = BlogEngine.Core.Helpers.CategoryHelper.SortCategories(); + var dic = CategoryList.SortCategories(); }

@title

diff --git a/BlogEngine/BlogEngine.Core/Helpers/WidgetHelper.cs b/BlogEngine/BlogEngine.NET/Custom/Widgets/Common.cs similarity index 86% rename from BlogEngine/BlogEngine.Core/Helpers/WidgetHelper.cs rename to BlogEngine/BlogEngine.NET/Custom/Widgets/Common.cs index 85e36e9ee..337d88bd8 100644 --- a/BlogEngine/BlogEngine.Core/Helpers/WidgetHelper.cs +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/Common.cs @@ -1,12 +1,10 @@ -using BlogEngine.Core.DataStore; +using BlogEngine.Core; +using BlogEngine.Core.DataStore; using System.Collections.Specialized; -namespace BlogEngine.Core.Helpers +namespace BlogEngine.NET.Custom.Widgets { - /// - /// Widgets helper class - /// - public class WidgetHelper + public class Common { /// /// Gets widget settings @@ -37,6 +35,6 @@ public static void SaveSettings(StringDictionary settings, string widgetId) ws.SaveSettings(settings); Blog.CurrentInstance.Cache[cacheId] = settings; - } + } } -} +} \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/Newsletter/Newsletter.cs b/BlogEngine/BlogEngine.NET/Custom/Widgets/Newsletter/Newsletter.cs new file mode 100644 index 000000000..ae5ccbeb5 --- /dev/null +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/Newsletter/Newsletter.cs @@ -0,0 +1,193 @@ +using BlogEngine.Core; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net.Mail; +using System.Text; +using System.Web.Hosting; +using System.Xml; + +namespace BlogEngine.NET.Custom.Widgets +{ + public class Newsletter + { + private static readonly object syncRoot = new object(); + private static string filename = HostingEnvironment.MapPath( + Path.Combine(Blog.CurrentInstance.StorageLocation, "newsletter.xml")); + + /// + /// Add subscriber emal + /// + /// Email address + public static void AddEmail(string email) + { + var doc = GetXml(); + var node = doc.SelectSingleNode(string.Format("emails/email[text()='{0}']", email)); + if (node == null) + { + node = doc.CreateElement("email"); + node.InnerText = email; + doc.FirstChild.AppendChild(node); + SaveEmails(doc); + } + } + + /// + /// Remove email from subscription + /// + /// Email address + public static void RemoveEmail(string email) + { + var doc = GetXml(); + var node = doc.SelectSingleNode(string.Format("emails/email[text()='{0}']", email)); + if (node != null) + { + doc.FirstChild.RemoveChild(node); + SaveEmails(doc); + } + } + + /// + /// Load emails + /// + /// List of emails + public static List LoadEmails() + { + var emailList = new List(); + var doc = GetXml(); + var emails = doc.SelectNodes("emails/email"); + if (emails != null) + { + foreach (XmlNode node in emails) + { + emailList.Add(node.InnerText.Trim()); + } + } + return emailList.OrderBy(e => e).ToList(); + } + + /// + /// Send emails to newsletter subscribers + /// + public static void SendEmails(IPublishable publishable) + { + var emails = LoadEmails(); + if (emails != null && emails.Count > 0) + { + foreach (var email in emails) + { + if (!Utils.StringIsNullOrWhitespace(email) && Utils.IsEmailValid(email)) + { + MailMessage message = CreateEmail(publishable); + message.To.Add(email); + try + { + Utils.SendMailMessage(message); + //Utils.Log("sent to " + email + " on - " + publishable.Title); + } + catch (Exception ex) + { + Utils.Log("Custom.Widgets.Newsletter.SendEmails", ex); + } + } + } + } + } + + #region Private methods + + private static XmlDocument GetXml() + { + var doc = new XmlDocument(); + try + { + lock (syncRoot) + { + if (File.Exists(filename)) + { + doc.Load(filename); + } + else + { + doc.LoadXml(""); + } + } + } + catch (Exception ex) + { + Utils.Log("Custom.Widgets.Newsletter.GetXml", ex); + } + return doc; + } + + private static void SaveEmails(XmlDocument doc) + { + lock (syncRoot) + { + using (var ms = new MemoryStream()) + using (var fs = File.Open(filename, FileMode.Create, FileAccess.Write)) + { + doc.Save(ms); + ms.WriteTo(fs); + } + } + } + + private static string FormatBodyMail(IPublishable publishable) + { + var body = new StringBuilder(); + var urlbase = Path.Combine( + Path.Combine(Utils.AbsoluteWebRoot.AbsoluteUri, "themes"), BlogSettings.Instance.Theme); + var filePath = string.Format("~/Custom/Themes/{0}/newsletter.html", BlogSettings.Instance.Theme); + filePath = HostingEnvironment.MapPath(filePath); + if (File.Exists(filePath)) + { + body.Append(File.ReadAllText(filePath)); + } + else + { + // if custom theme doesn't have email template + // use email template from standard theme + filePath = HostingEnvironment.MapPath("~/Custom/Themes/Standard/newsletter.html"); + if (File.Exists(filePath)) + { + body.Append(File.ReadAllText(filePath)); + } + else + { + Utils.Log( + "When sending newsletter, newsletter.html does not exist " + + "in theme folder, and does not exist in the Standard theme " + + "folder."); + } + } + + body = body.Replace("[TITLE]", publishable.Title); + body = body.Replace("[LINK]", publishable.AbsoluteLink.AbsoluteUri); + body = body.Replace("[LINK_DESCRIPTION]", publishable.Description); + body = body.Replace("[WebRoot]", Utils.AbsoluteWebRoot.AbsoluteUri); + body = body.Replace("[httpBase]", urlbase); + return body.ToString(); + } + + private static MailMessage CreateEmail(IPublishable publishable) + { + var subject = publishable.Title; + //var settings = GetSettings(); + + //if (settings["subjectPrefix"] != null) + // subject = settings["subjectPrefix"] + subject; + + var mail = new MailMessage + { + Subject = subject, + Body = FormatBodyMail(publishable), + From = new MailAddress(BlogSettings.Instance.Email, BlogSettings.Instance.Name) + }; + return mail; + } + + #endregion + } +} \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/Newsletter/edit.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/Newsletter/edit.cshtml new file mode 100644 index 000000000..28978fe0b --- /dev/null +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/Newsletter/edit.cshtml @@ -0,0 +1,50 @@ +@using BlogEngine.NET.Custom.Widgets +@{ + if (IsPost) + { + var emailToDelete = Request.Form["hdnEmail"].Trim(); + if(emailToDelete.Length > 0) + { + Newsletter.RemoveEmail(emailToDelete); + } + } +} + + + + + + + + + + +
+

Subscriptions

+ @foreach (var email in Newsletter.LoadEmails()) + { + + } +
+
+ +
+ + + + \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/Newsletter/widget.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/Newsletter/widget.cshtml new file mode 100644 index 000000000..8cae65953 --- /dev/null +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/Newsletter/widget.cshtml @@ -0,0 +1,52 @@ +@using BlogEngine.NET.Custom.Widgets +@{ + var showThanks = false; + var showForm = false; + var showMsg = false; + var email = Request.Form["txtEmail"]; + + if (IsPost) + { + try + { + var addr = new System.Net.Mail.MailAddress(email); + Newsletter.AddEmail(email); + showThanks = true; + } + catch + { + showForm = true; + showMsg = true; + } + } + else + { + showForm = true; + } +} +
+

@Model.Title

+
+ @if (showThanks) + { +
+

@Resources.labels.thankYou

+
+ } + @if (showForm) + { +
+

@Resources.labels.notifiedPublished

+ + + @if (showMsg) + { + @Resources.labels.enterEmailAddress + } +
+ +
+
+ } +
+
\ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/Page List/widget.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/PageList/widget.cshtml similarity index 100% rename from BlogEngine/BlogEngine.NET/Custom/Widgets/Page List/widget.cshtml rename to BlogEngine/BlogEngine.NET/Custom/Widgets/PageList/widget.cshtml diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/Post List/edit.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/PostList/edit.cshtml similarity index 96% rename from BlogEngine/BlogEngine.NET/Custom/Widgets/Post List/edit.cshtml rename to BlogEngine/BlogEngine.NET/Custom/Widgets/PostList/edit.cshtml index 5d948a9b1..924e13ae8 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/Post List/edit.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/PostList/edit.cshtml @@ -1,4 +1,4 @@ -@using BlogEngine.Core.Helpers +@using BlogEngine.NET.Custom.Widgets @using BlogEngine.Core @{ var numberOfPosts = 10; @@ -10,7 +10,7 @@ var showDate = false; var widgetId = Request.QueryString["id"]; - var settings = WidgetHelper.GetSettings(widgetId); + var settings = Common.GetSettings(widgetId); Validation.Add("txtNumberOfPosts", Validator.Required("Field is required"), Validator.Integer("Field is numeric") @@ -26,7 +26,7 @@ settings["showimg"] = Request.Form["cbShowImg"] == "on" ? "true" : "false"; settings["showdesc"] = Request.Form["cbShowDesc"] == "on" ? "true" : "false"; settings["showdate"] = Request.Form["cbShowDate"] == "on" ? "true" : "false"; - WidgetHelper.SaveSettings(settings, widgetId); + Common.SaveSettings(settings, widgetId); @: } } diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/Post List/widget.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/PostList/widget.cshtml similarity index 96% rename from BlogEngine/BlogEngine.NET/Custom/Widgets/Post List/widget.cshtml rename to BlogEngine/BlogEngine.NET/Custom/Widgets/PostList/widget.cshtml index 4b9b763be..9ad4df617 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/Post List/widget.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/PostList/widget.cshtml @@ -1,9 +1,9 @@ -@using BlogEngine.Core.Helpers -@using BlogEngine.Core +@using BlogEngine.Core +@using BlogEngine.NET.Custom.Widgets @{ var title = Model.Title; var id = Model.Id; - var settings = WidgetHelper.GetSettings(id); + var settings = Common.GetSettings(id); var visiblePosts = Post.ApplicablePosts.FindAll(p => p.IsVisibleToPublic); var numberOfPosts = 10; diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/edit.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/edit.cshtml index 4f9852599..1b9c0d300 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/edit.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/edit.cshtml @@ -1,8 +1,8 @@ -@using BlogEngine.Core.Helpers +@using BlogEngine.NET.Custom.Widgets @{ var NumberOfComments = 10; var widgetId = Request.QueryString["id"]; - var settings = WidgetHelper.GetSettings(widgetId); + var settings = Common.GetSettings(widgetId); Validation.Add("txtNumberOfComments", Validator.Required("Field is required"), Validator.Integer("Field is numeric") @@ -12,7 +12,7 @@ if (Validation.IsValid() && settings["numberofcomments"] != Request.Form["txtNumberOfComments"]) { settings["numberofcomments"] = Request.Form["txtNumberOfComments"]; - WidgetHelper.SaveSettings(settings, widgetId); + Common.SaveSettings(settings, widgetId); @: } } diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/widget.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/widget.cshtml index adbf19ff1..356fbff57 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/widget.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/widget.cshtml @@ -1,10 +1,9 @@ @using BlogEngine.Core -@using BlogEngine.Core.Helpers +@using BlogEngine.NET.Custom.Widgets @using System.Text.RegularExpressions @{ - var title = Model.Title; var numberOfComments = 10; - var settings = WidgetHelper.GetSettings(Model.Id); + var settings = Common.GetSettings(Model.Id); if (settings != null && settings.Count > 0) { numberOfComments = int.Parse(settings["numberofcomments"]); @@ -25,7 +24,7 @@ }
-

@title

+

@Model.Title

    @if (list.Count > 0) diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/Tag cloud/edit.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/TagCloud/edit.cshtml similarity index 95% rename from BlogEngine/BlogEngine.NET/Custom/Widgets/Tag cloud/edit.cshtml rename to BlogEngine/BlogEngine.NET/Custom/Widgets/TagCloud/edit.cshtml index 4d14a1a98..a9bd93f78 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/Tag cloud/edit.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/TagCloud/edit.cshtml @@ -1,16 +1,16 @@ -@using BlogEngine.Core.Helpers +@using BlogEngine.NET.Custom.Widgets @{ var minPosts = 1; var maxSize = -1; var widgetId = Request.QueryString["id"]; - var settings = WidgetHelper.GetSettings(widgetId); + var settings = Common.GetSettings(widgetId); if (IsPost) { settings["minimumposts"] = Request.Form["ddMinPosts"]; settings["tagcloudsize"] = Request.Form["ddCloudSize"]; - WidgetHelper.SaveSettings(settings, widgetId); + Common.SaveSettings(settings, widgetId); } if (settings != null && settings.Count > 0) { diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/Tag cloud/widget.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/TagCloud/widget.cshtml similarity index 100% rename from BlogEngine/BlogEngine.NET/Custom/Widgets/Tag cloud/widget.cshtml rename to BlogEngine/BlogEngine.NET/Custom/Widgets/TagCloud/widget.cshtml diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/TextBox/edit.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/TextBox/edit.cshtml index 0f6fd274d..0169c93d8 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/TextBox/edit.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/TextBox/edit.cshtml @@ -1,13 +1,13 @@ -@using BlogEngine.Core.Helpers +@using BlogEngine.NET.Custom.Widgets @{ var widgetId = Request.QueryString["id"]; - var settings = WidgetHelper.GetSettings(widgetId); + var settings = Common.GetSettings(widgetId); var txt = "

    Type here...

    "; if (IsPost) { settings["content"] = Request.Form["txtContent"]; - WidgetHelper.SaveSettings(settings, widgetId); + Common.SaveSettings(settings, widgetId); } if (settings != null && settings.Count > 0) { diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/TextBox/widget.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/TextBox/widget.cshtml index 57a82569e..92e805ff0 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/TextBox/widget.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/TextBox/widget.cshtml @@ -1,6 +1,6 @@ -@using BlogEngine.Core.Helpers +@using BlogEngine.NET.Custom.Widgets @{ - var settings = WidgetHelper.GetSettings(Model.Id); + var settings = Common.GetSettings(Model.Id); var txt = ""; if (settings != null && settings.Count > 0) { diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/shared.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/common.cshtml similarity index 100% rename from BlogEngine/BlogEngine.NET/Custom/Widgets/shared.cshtml rename to BlogEngine/BlogEngine.NET/Custom/Widgets/common.cshtml diff --git a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js index 05fe6d7da..0613d8c77 100644 --- a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js +++ b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js @@ -33,7 +33,7 @@ } $scope.loadEditForm = function (id, name, title) { - var sharedSrc = SiteVars.ApplicationRelativeWebRoot + "Custom/Widgets/shared.cshtml"; + var sharedSrc = SiteVars.ApplicationRelativeWebRoot + "Custom/Widgets/common.cshtml"; var customSrc = SiteVars.ApplicationRelativeWebRoot + "Custom/Widgets/" + name + "/edit.cshtml"; $scope.editId = id; $scope.editTitle = title; From b907581f748845b7959b32876003af7a5ff700ef Mon Sep 17 00:00:00 2001 From: rxtur Date: Wed, 17 Feb 2016 12:29:24 -0600 Subject: [PATCH 004/152] Link list widget added, recent comments renamed to Comment list. --- .../datastore/widgets/be_WIDGET_ZONE.xml | 2 + .../BlogEngine.NET/BlogEngine.NET.csproj | 7 +- .../edit.cshtml | 0 .../widget.cshtml | 0 .../Custom/Widgets/LinkList/LinkList.cs | 147 +++++++++++++++ .../Custom/Widgets/LinkList/edit.cshtml | 171 ++++++++++++++++++ .../Custom/Widgets/LinkList/widget.cshtml | 27 +++ 7 files changed, 352 insertions(+), 2 deletions(-) rename BlogEngine/BlogEngine.NET/Custom/Widgets/{RecentComments => CommentList}/edit.cshtml (100%) rename BlogEngine/BlogEngine.NET/Custom/Widgets/{RecentComments => CommentList}/widget.cshtml (100%) create mode 100644 BlogEngine/BlogEngine.NET/Custom/Widgets/LinkList/LinkList.cs create mode 100644 BlogEngine/BlogEngine.NET/Custom/Widgets/LinkList/edit.cshtml create mode 100644 BlogEngine/BlogEngine.NET/Custom/Widgets/LinkList/widget.cshtml diff --git a/BlogEngine/BlogEngine.NET/App_Data/datastore/widgets/be_WIDGET_ZONE.xml b/BlogEngine/BlogEngine.NET/App_Data/datastore/widgets/be_WIDGET_ZONE.xml index fc8f4fb2e..587b490f2 100644 --- a/BlogEngine/BlogEngine.NET/App_Data/datastore/widgets/be_WIDGET_ZONE.xml +++ b/BlogEngine/BlogEngine.NET/App_Data/datastore/widgets/be_WIDGET_ZONE.xml @@ -6,4 +6,6 @@ CategoryList PostList Newsletter + CommentList + LinkList \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/BlogEngine.NET.csproj b/BlogEngine/BlogEngine.NET/BlogEngine.NET.csproj index 55427d811..55eb84d60 100644 --- a/BlogEngine/BlogEngine.NET/BlogEngine.NET.csproj +++ b/BlogEngine/BlogEngine.NET/BlogEngine.NET.csproj @@ -714,14 +714,16 @@ - - + + + + @@ -2111,6 +2113,7 @@ + default.aspx diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/edit.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/CommentList/edit.cshtml similarity index 100% rename from BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/edit.cshtml rename to BlogEngine/BlogEngine.NET/Custom/Widgets/CommentList/edit.cshtml diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/widget.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/CommentList/widget.cshtml similarity index 100% rename from BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/widget.cshtml rename to BlogEngine/BlogEngine.NET/Custom/Widgets/CommentList/widget.cshtml diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/LinkList/LinkList.cs b/BlogEngine/BlogEngine.NET/Custom/Widgets/LinkList/LinkList.cs new file mode 100644 index 000000000..7c14c6e04 --- /dev/null +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/LinkList/LinkList.cs @@ -0,0 +1,147 @@ +using System; +using System.Collections.Generic; +using System.Xml; + +namespace BlogEngine.NET.Custom.Widgets +{ + public class LinkList + { + private string _id; + public LinkList(string id) + { + _id = id; + } + + public void SaveLink(string id, string title, string url, string target) + { + var doc = Doc(); + var links = doc.SelectSingleNode("links"); + if (links == null) + { + links = doc.CreateElement("links"); + doc.AppendChild(links); + } + + var node = doc.SelectSingleNode(string.Format("links/link[@id='{0}']", id)); + if (node == null) + { + node = doc.CreateElement("link"); + + var atId = doc.CreateAttribute("id"); + var atUrl = doc.CreateAttribute("url"); + var atTarget = doc.CreateAttribute("target"); + + atId.Value = Guid.NewGuid().ToString(); + atUrl.Value = url; + atTarget.Value = target; + + node.Attributes.Append(atId); + node.Attributes.Append(atUrl); + node.Attributes.Append(atTarget); + node.InnerText = title; + + links.AppendChild(node); + } + else + { + node.Attributes["url"].Value = url; + node.Attributes["target"].Value = target; + node.InnerText = title; + } + SaveDoc(doc); + } + + public void RemoveLink(string id) + { + var doc = Doc(); + var links = doc.SelectSingleNode("links"); + if (links == null) + { + return; + } + var node = doc.SelectSingleNode(string.Format("links/link[@id='{0}']", id)); + if (node != null) + { + links.RemoveChild(node); + SaveDoc(doc); + } + } + + public List GetLinks() + { + var items = new List(); + var doc = Doc(); + var links = doc.SelectSingleNode("links"); + if (links != null) + { + if(links.ChildNodes != null && links.ChildNodes.Count > 0) + { + foreach (var node in links.ChildNodes) + { + var item = new LinkItem(); + var x = (XmlNode)node; + item.Id = x.Attributes["id"].Value; + item.Url = x.Attributes["url"].Value; + item.Target = x.Attributes["target"].Value; + item.Title = x.InnerText; + items.Add(item); + } + } + } + return items; + } + + public LinkItem GetLinkById(string id) + { + var item = new LinkItem(); + var doc = Doc(); + var links = doc.SelectSingleNode("links"); + if (links == null) + { + return item; + } + var node = doc.SelectSingleNode(string.Format("links/link[@id='{0}']", id)); + if (node != null) + { + item.Id = node.Attributes["id"].Value; + item.Url = node.Attributes["url"].Value; + item.Target = node.Attributes["target"].Value; + item.Title = node.InnerText; + } + return item; + } + + #region Private methods + + private XmlDocument Doc() + { + var settings = Common.GetSettings(_id); + var doc = new XmlDocument(); + if (settings["content"] != null) + { + doc.InnerXml = settings["content"]; + } + return doc; + } + + private void SaveDoc(XmlDocument doc) + { + var settings = Common.GetSettings(_id); + if(settings != null) + { + settings["content"] = doc.InnerXml; + } + Common.SaveSettings(settings, _id); + } + + #endregion + } + + public class LinkItem + { + public string Id { get; set; } + public string Url { get; set; } + public string Target { get; set; } + public string Title { get; set; } + } +} \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/LinkList/edit.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/LinkList/edit.cshtml new file mode 100644 index 000000000..f7d1d0e15 --- /dev/null +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/LinkList/edit.cshtml @@ -0,0 +1,171 @@ +@using BlogEngine.NET.Custom.Widgets +@{ + // check if edit exists, no need to process + if (Request.HttpMethod == "HEAD") { return; } + + var NumberOfLinks = 10; + var TitleAdd = ""; + var LinkAdd = ""; + var targetNew = false; + var hdnId = ""; + + var widgetId = Request.QueryString["id"]; + var updateLink = BlogEngine.Core.Utils.RelativeOrAbsoluteWebRoot + + "Custom/Widgets/LinkList/edit.cshtml?id=" + widgetId; + var settings = Common.GetSettings(widgetId); + var linkList = new LinkList(widgetId); + + Validation.Add("txtNumberOfLinks", + Validator.Required("Field is required"), + Validator.Integer("Field is numeric") + ); + + if (Request.Form["btnAdd"] != null || Request.Form["btnUpdate"] != null) + { + Validation.Add("txtTitle", Validator.Required("Field is required")); + Validation.Add("txtUrl", Validator.Required("Field is required")); + } + + var delId = Request.QueryString["delid"]; + if (!string.IsNullOrEmpty(delId)) + { + linkList.RemoveLink(delId); + } + var editId = Request.QueryString["editid"]; + if (!string.IsNullOrEmpty(editId)) + { + var item = linkList.GetLinkById(editId); + TitleAdd = item.Title; + LinkAdd = item.Url; + targetNew = item.Target == "on" ? true : false; + hdnId = item.Id; + } + + if (IsPost) + { + if (Validation.IsValid()) + { + if (settings["numberoflinks"] != Request.Form["txtNumberOfLinks"]) + { + settings["numberoflinks"] = Request.Form["txtNumberOfLinks"]; + Common.SaveSettings(settings, widgetId); + } + if (Request.Form["btnAdd"] != null) + { + linkList.SaveLink("", Request.Form["txtTitle"], Request.Form["txtUrl"], Request.Form["cbTarget"]); + } + if (!string.IsNullOrEmpty(Request.Form["hdnId"])) + { + linkList.SaveLink(Request.Form["hdnId"], Request.Form["txtTitle"], Request.Form["txtUrl"], Request.Form["cbTarget"]); + } + @: + } + } + if (settings != null && settings.Count > 0) + { + NumberOfLinks = int.Parse(settings["numberoflinks"]); + } + var links = linkList.GetLinks(); +} + + + + + + + + + +
    +
    + + + @Html.ValidationMessage("txtNumberOfLinks") +
    +
    + +
    +
     
    + + + + + + + + + + + + + @foreach (var link in links) + { + + + + + + + } + @if(links.Count == 0) + { + + } + +
     @Resources.labels.title@Resources.labels.url@Resources.labels.newWindow
    +   + + @link.Title@link.Url + @if (link.Target == "on") + { + + } +
    @Resources.labels.empty
    + +
    + + \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/LinkList/widget.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/LinkList/widget.cshtml new file mode 100644 index 000000000..42bd4bfa4 --- /dev/null +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/LinkList/widget.cshtml @@ -0,0 +1,27 @@ +@using BlogEngine.NET.Custom.Widgets +@{ + var linkList = new LinkList(Model.Id); + var links = linkList.GetLinks(); +} + \ No newline at end of file From 271ea42cac67cf15c6038e452d79d88cc4ccd69a Mon Sep 17 00:00:00 2001 From: rxtur Date: Wed, 17 Feb 2016 12:42:49 -0600 Subject: [PATCH 005/152] Restored couple supporting widget controls needed for Razor themes (3.2.1.3) --- .../Properties/AssemblyInfo.cs | 2 +- .../AppCode/Controls/WidgetBase.cs | 123 ++++++++ .../AppCode/Controls/WidgetContainer.cs | 262 ++++++++++++++++++ .../BlogEngine.NET/BlogEngine.NET.csproj | 6 + 4 files changed, 392 insertions(+), 1 deletion(-) create mode 100644 BlogEngine/BlogEngine.NET/AppCode/Controls/WidgetBase.cs create mode 100644 BlogEngine/BlogEngine.NET/AppCode/Controls/WidgetContainer.cs diff --git a/BlogEngine/BlogEngine.Core/Properties/AssemblyInfo.cs b/BlogEngine/BlogEngine.Core/Properties/AssemblyInfo.cs index f78090b2f..4175cd91c 100644 --- a/BlogEngine/BlogEngine.Core/Properties/AssemblyInfo.cs +++ b/BlogEngine/BlogEngine.Core/Properties/AssemblyInfo.cs @@ -19,5 +19,5 @@ [assembly: CLSCompliant(false)] [assembly: ComVisible(false)] [assembly: AllowPartiallyTrustedCallers] -[assembly: AssemblyVersion("3.2.1.2")] +[assembly: AssemblyVersion("3.2.1.3")] [assembly: SecurityRules(SecurityRuleSet.Level1)] diff --git a/BlogEngine/BlogEngine.NET/AppCode/Controls/WidgetBase.cs b/BlogEngine/BlogEngine.NET/AppCode/Controls/WidgetBase.cs new file mode 100644 index 000000000..e7152fe71 --- /dev/null +++ b/BlogEngine/BlogEngine.NET/AppCode/Controls/WidgetBase.cs @@ -0,0 +1,123 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// Widget Base +// +// -------------------------------------------------------------------------------------------------------------------- + +using BlogEngine.Core; + +namespace App_Code.Controls +{ + using System; + using System.Collections.Specialized; + using System.Web.UI; + + using BlogEngine.Core.DataStore; + + /// + /// Widget Base + /// + public abstract class WidgetBase : UserControl + { + #region Properties + + /// + /// Gets a value indicating whether the header is visible. This only takes effect if the widgets isn't editable. + /// + /// true if the header is visible; otherwise, false. + public virtual bool DisplayHeader + { + get + { + return true; + } + } + + /// + /// Gets a value indicating whether or not the widget can be edited. + /// + /// The only way a widget can be editable is by adding a edit.ascx file to the widget folder. + /// + /// + public abstract bool IsEditable { get; } + + /// + /// Gets the name. It must be exactly the same as the folder that contains the widget. + /// + public abstract string Name { get; } + + /// + /// Gets or sets a value indicating whether [show title]. + /// + /// true if [show title]; otherwise, false. + public bool ShowTitle { get; set; } + + /// + /// Gets or sets the title of the widget. It is mandatory for all widgets to set the Title. + /// + /// The title of the widget. + public string Title { get; set; } + + /// + /// Gets or sets the widget ID. + /// + /// The widget ID. + public Guid WidgetId { get; set; } + + /// + /// Gets or sets the name of the containing WidgetZone + /// + public string Zone { get; set; } + + #endregion + + #region Public Methods + + /// + /// Get settings from data store + /// + /// + /// The settings + /// + public StringDictionary GetSettings() + { + var cacheId = string.Format("be_widget_{0}", this.WidgetId); + if (Blog.CurrentInstance.Cache[cacheId] == null) + { + var ws = new WidgetSettings(this.WidgetId.ToString()); + Blog.CurrentInstance.Cache[cacheId] = ws.GetSettings(); + } + + return (StringDictionary)Blog.CurrentInstance.Cache[cacheId]; + } + + /// + /// This method works as a substitute for Page_Load. You should use this method for + /// data binding etc. instead of Page_Load. + /// + public abstract void LoadWidget(); + + #endregion + + #region Methods + + /// + /// Sends server control content to a provided + /// object, which writes the content to be rendered on the client. + /// + /// + /// The object that receives the server control content. + /// + protected override void Render(HtmlTextWriter writer) + { + if (string.IsNullOrEmpty(this.Name)) + { + throw new NullReferenceException("Name must be set on a widget"); + } + + base.Render(writer); + } + + #endregion + } +} \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/AppCode/Controls/WidgetContainer.cs b/BlogEngine/BlogEngine.NET/AppCode/Controls/WidgetContainer.cs new file mode 100644 index 000000000..0761f9c80 --- /dev/null +++ b/BlogEngine/BlogEngine.NET/AppCode/Controls/WidgetContainer.cs @@ -0,0 +1,262 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// Themeable class for displaying WidgetBase derived controls. +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace App_Code.Controls +{ + using System; + using System.IO; + using System.Text; + using System.Threading; + using System.Web.UI; + using System.Web.Hosting; + using BlogEngine.Core; + + using Resources; + + /// + /// Themeable class for displaying WidgetBase derived controls. + /// + /// + /// WidgetContainer is meant to be the themeable parent class of any control that derives from WidgetBase. This way a theme can automatically + /// apply some basic styling to the way widgets are displayed without having to edit each one or edit the WidgetBase class to change the + /// rendered output. + /// Inherited WidgetContainers must contain a control named phWidgetBody. This is the control that the WidgetContainer's child Widget is + /// injected inside of. phWidgetBody just needs to derive from Control to work, leaving flexibility for anyone creating a theme. + /// If phWidgetBody isn't found, an exception isn't thrown, but a warning label is applied to the page. + /// + public abstract class WidgetContainer : UserControl + { + #region "Properties" + + /// + /// Gets or sets the Widget this WidgetContainer holds. + /// + public WidgetBase Widget + { + get; + set; + } + + + /// + /// Gets a string representing the rendered html for administrative control of this WidgetContainer's child Widget. + /// + public string AdminLinks + { + get + { + if (Security.IsAuthorizedTo(Rights.ManageWidgets)) + { + if (this.Widget != null) + { + var sb = new StringBuilder(); + + var widgetId = this.Widget.WidgetId; + + sb.AppendFormat(" ", widgetId, labels.delete); + sb.AppendFormat(" ", this.Widget.Name, widgetId, labels.edit); + sb.AppendFormat(" ", widgetId, labels.move); + + return sb.ToString(); + } + } + + + return String.Empty; + } + } + + #endregion + + /// + /// Raises the event. + /// + /// The object that contains the event data. + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + ProcessLoad(); + } + + private bool _processedLoad; + /// + /// Manually run the Initialization process. + /// + public void ProcessLoad() + { + if (_processedLoad) { return; } + + // phWidgetBody is the control that the Widget control + // gets added to. + var widgetBody = this.FindControl("phWidgetBody"); + + if (widgetBody != null) + { + widgetBody.Controls.Add(this.Widget); + } + else + { + var warn = new LiteralControl + { + Text = "Unable to find control with id \"phWidgetBody\" in theme's WidgetContainer." + }; + this.Controls.Add(warn); + } + + _processedLoad = true; + } + + /// + /// Raises the event. + /// + /// An object that contains the event data. + protected override void OnPreRender(EventArgs e) + { + base.OnPreRender(e); + + // Hide the container if the Widget is null or also not visible. + this.Visible = (this.Widget != null) && this.Widget.Visible; + } + + /// + /// The container will be processed when invoked, rather than waiting + /// for the Load event to occur. + /// + public virtual void RenderContainer() { } + + /// + /// Returns the virtual path of where a theme's widget container would expect to be located. + /// + /// + /// When true, the path to the theme folder to check for the WidgetContainer existence + /// is returned. When false, the path to the control that will be loaded is returned. + /// If it's a Razor theme, the path will be RazorHost instead of the actual theme folder + /// name. + /// + /// + public static string GetThemeWidgetContainerVirtualPath(bool existenceCheck) + { + if (existenceCheck) + { + // if it's a Razor theme, check if WidgetContainer.cshtml exists. + string filename = BlogSettings.Instance.IsRazorTheme ? "WidgetContainer.cshtml" : "WidgetContainer.ascx"; + return string.Format("~/Custom/Themes/{0}/{1}", BlogSettings.Instance.Theme, filename); + } + else + { + // when existenceCheck == false, the actual file that will be loaded needs to be + // returned. if it's a Razor theme, we will load WidgetContainer.ascx in the + // RazorHost folder. we assume that the RazorHost folder contains WidgetContainer.ascx. + return string.Format("~/Custom/Themes/{0}/WidgetContainer.ascx", BlogSettings.Instance.GetThemeWithAdjustments(null)); + } + } + + /// + /// Returns the file path of where a theme's widget container would expect to be located. + /// + public static string GetThemeWidgetContainerFilePath(bool existenceCheck) + { + return HostingEnvironment.MapPath(GetThemeWidgetContainerVirtualPath(existenceCheck)); + } + + /// + /// Returns whether the theme contains a widget container file. + /// + public static bool DoesThemeWidgetContainerExist(bool existenceCheck) + { + // This is for compatibility with older themes that do not have a WidgetContainer control. + return File.Exists(GetThemeWidgetContainerFilePath(existenceCheck)); + } + + /// + /// Loads the widget container (either the one located in the theme folder, or the default one if + /// a theme widget container is missing), and adds the Widget to the widget container. + /// + public static WidgetContainer GetWidgetContainer( + WidgetBase widgetControl, bool widgetContainerExists, + string widgetContainerVirtualPath) + { + // If a custom WidgetContainer can't be found, create a new DefaultWidgetContainer instance as it + // provides backwards compatibility with existing themes that may have depended on WidgetBase's + // old rendering method. + var widgetContainer = widgetContainerExists ? (WidgetContainer)widgetControl.Page.LoadControl(widgetContainerVirtualPath) : new DefaultWidgetContainer(); + + widgetContainer.ID = "widgetContainer" + widgetControl.ID; + widgetContainer.Widget = widgetControl; + + return widgetContainer; + } + + /// + /// Loads the widget container (either the one located in the theme folder, or the default one if + /// a theme widget container is missing), and adds the Widget to the widget container. + /// + public static WidgetContainer GetWidgetContainer( + WidgetBase widgetControl) + { + return GetWidgetContainer(widgetControl, DoesThemeWidgetContainerExist(true), GetThemeWidgetContainerVirtualPath(false)); + } + } + + /// + /// Default implementation of WidgetContainer that provides backwards compatibility with themes that do not have + /// their own WidgetContainer user control. + /// + internal sealed class DefaultWidgetContainer : WidgetContainer + { + /// + /// The widgetBody instance needed by all WidgetContainers. + /// + private readonly System.Web.UI.WebControls.PlaceHolder widgetBody = new System.Web.UI.WebControls.PlaceHolder + { + ID = "phWidgetBody" + }; + + /// + /// Initializes a new instance of the class. + /// + internal DefaultWidgetContainer() + { + this.Controls.Add(this.widgetBody); + } + + /// + /// Sends server control content to a provided object, which writes the content to be rendered on the client. + /// + /// The object that receives the server control content. + protected override void Render(HtmlTextWriter writer) + { + if (this.Widget == null) + { + throw new NullReferenceException("WidgetContainer requires its Widget property be set to a valid WidgetBase derived control"); + } + + var widgetName = this.Widget.Name; + var widgetId = this.Widget.WidgetId; + + if (string.IsNullOrEmpty(this.Widget.Name)) + { + throw new NullReferenceException("Name must be set on a widget"); + } + + var sb = new StringBuilder(); + + sb.AppendFormat("
    ", widgetName.Replace(" ", string.Empty).ToLowerInvariant(), widgetId); + sb.Append(this.AdminLinks); + if (this.Widget.ShowTitle) + { + sb.AppendFormat("

    {0}

    ", this.Widget.Title); + } + + sb.Append("
    "); + + writer.Write(sb.ToString()); + base.Render(writer); + writer.Write("
    "); + writer.Write("
    "); + } + } +} \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/BlogEngine.NET.csproj b/BlogEngine/BlogEngine.NET/BlogEngine.NET.csproj index 55eb84d60..cecbb8490 100644 --- a/BlogEngine/BlogEngine.NET/BlogEngine.NET.csproj +++ b/BlogEngine/BlogEngine.NET/BlogEngine.NET.csproj @@ -1881,6 +1881,12 @@ + + ASPXCodeBehind + + + ASPXCodeBehind + From 82c90ed82a277c7fecb9b57ae7b776a6acbd1edf Mon Sep 17 00:00:00 2001 From: rxtur Date: Wed, 17 Feb 2016 22:32:49 -0600 Subject: [PATCH 006/152] Widget title textbox moved to popup header --- .../Custom/Widgets/CommentList/edit.cshtml | 2 +- .../Custom/Widgets/LinkList/edit.cshtml | 2 +- .../Custom/Widgets/Newsletter/edit.cshtml | 2 +- .../Custom/Widgets/PostList/edit.cshtml | 2 +- .../Custom/Widgets/TagCloud/edit.cshtml | 1 + .../Custom/Widgets/TextBox/edit.cshtml | 10 ++-- .../Custom/Widgets/common.cshtml | 11 +--- .../app/custom/widgets/widgetController.js | 17 ++++-- .../admin/app/custom/widgets/widgetView.html | 59 +++++++++++++++---- 9 files changed, 69 insertions(+), 37 deletions(-) diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/CommentList/edit.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/CommentList/edit.cshtml index 1b9c0d300..e46fb2fa0 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/CommentList/edit.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/CommentList/edit.cshtml @@ -32,7 +32,7 @@ -
    +
    diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/LinkList/edit.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/LinkList/edit.cshtml index f7d1d0e15..8236c3506 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/LinkList/edit.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/LinkList/edit.cshtml @@ -82,7 +82,7 @@ - +
    diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/Newsletter/edit.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/Newsletter/edit.cshtml index 28978fe0b..041a420a5 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/Newsletter/edit.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/Newsletter/edit.cshtml @@ -28,7 +28,7 @@ - +

    Subscriptions

    @foreach (var email in Newsletter.LoadEmails()) diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/PostList/edit.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/PostList/edit.cshtml index 924e13ae8..c9539b32e 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/PostList/edit.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/PostList/edit.cshtml @@ -68,7 +68,7 @@ body { background-color: #fff; } .field-validation-error { background-color: #d9534f; border-color: #d9534f; color: #fff; padding: 5px 15px; display: block; } - +
    @Html.TextBox("txtNumberOfPosts", numberOfPosts, new { @class = "form-control" }) diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/TagCloud/edit.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/TagCloud/edit.cshtml index a9bd93f78..1418311eb 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/TagCloud/edit.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/TagCloud/edit.cshtml @@ -11,6 +11,7 @@ settings["minimumposts"] = Request.Form["ddMinPosts"]; settings["tagcloudsize"] = Request.Form["ddCloudSize"]; Common.SaveSettings(settings, widgetId); + @: } if (settings != null && settings.Count > 0) { diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/TextBox/edit.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/TextBox/edit.cshtml index 0169c93d8..f594a4cfb 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/TextBox/edit.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/TextBox/edit.cshtml @@ -18,9 +18,7 @@ - -
    + +
    diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/common.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/common.cshtml index 752c71b6d..a845a8eac 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/common.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/common.cshtml @@ -1,17 +1,8 @@  - - - + Widget editor - -
    - -
    - \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js index 0613d8c77..71e3e9d75 100644 --- a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js +++ b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js @@ -4,6 +4,7 @@ $scope.editSrc = {}; $scope.editId = {}; $scope.editTitle = {}; + $scope.editZone = {}; $scope.load = function () { spinOn(); @@ -12,6 +13,7 @@ list1: [], list2: [], list3: [] }; $scope.vm = {}; + $("#txtWidgetTitle").removeClass("red-border"); dataService.getItems('/api/widgets', { }) .success(function (data) { @@ -32,23 +34,27 @@ }); } - $scope.loadEditForm = function (id, name, title) { + $scope.loadEditForm = function (id, name, title, zone) { var sharedSrc = SiteVars.ApplicationRelativeWebRoot + "Custom/Widgets/common.cshtml"; var customSrc = SiteVars.ApplicationRelativeWebRoot + "Custom/Widgets/" + name + "/edit.cshtml"; + $scope.editId = id; $scope.editTitle = title; + $scope.editZone = zone; + + $("#txtWidgetTitle").removeClass("red-border"); $("#txtWidgetTitle").val(title); - $("#titleValidation").hide(); $("#settingsFrame").contents().find('.field-validation-error').hide(); + $.ajax({ type: 'HEAD', url: customSrc, async: false, success: function () { - $scope.editSrc = customSrc + "?id=" + id; + $scope.editSrc = customSrc + "?id=" + id + "&zone=" + zone; }, error: function () { - $scope.editSrc = sharedSrc + "?id=" + id; + $scope.editSrc = sharedSrc + "?id=" + id + "&zone=" + zone; } }); $("#edit-widget").modal(); @@ -107,7 +113,7 @@ return false; } else { - $("#titleValidation").show(); + $("#txtWidgetTitle").addClass("red-border"); $("#txtWidgetTitle").focus(); return false; } @@ -117,7 +123,6 @@ $(document).ready(function () { bindCommon(); - $("#titleValidation").hide(); }); }]); diff --git a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html index be4337160..a7e82d442 100644 --- a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html +++ b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html @@ -1,5 +1,9 @@ 
    @@ -15,16 +19,12 @@

    {{lbl.widgets}}

    +
    +

    {{widgetZones.titles[3]}}

    +
    +
    Drag widget here
    +
    +
    +
    + {{ item.Title }} +
    + + +
    +
    +
    +
    +
    +
    +
    +

    {{widgetZones.titles[4]}}

    +
    +
    Drag widget here
    +
    +
    +
    + {{ item.Title }} +
    + + +
    +
    +
    +
    +
    +
    +
    From 276531230463577349db902926f0c0345f14ec61 Mon Sep 17 00:00:00 2001 From: rxtur Date: Fri, 19 Feb 2016 19:01:38 -0600 Subject: [PATCH 007/152] Added Month list widget --- .../datastore/widgets/be_WIDGET_ZONE.xml | 1 + .../BlogEngine.NET/BlogEngine.NET.csproj | 2 + .../Custom/Widgets/MonthList/MonthList.cs | 59 +++++++++++++++++++ .../Custom/Widgets/MonthList/widget.cshtml | 30 ++++++++++ .../Custom/Widgets/TagCloud/edit.cshtml | 2 +- .../Custom/Widgets/TextBox/edit.cshtml | 2 +- .../admin/app/custom/widgets/widgetView.html | 7 ++- 7 files changed, 98 insertions(+), 5 deletions(-) create mode 100644 BlogEngine/BlogEngine.NET/Custom/Widgets/MonthList/MonthList.cs create mode 100644 BlogEngine/BlogEngine.NET/Custom/Widgets/MonthList/widget.cshtml diff --git a/BlogEngine/BlogEngine.NET/App_Data/datastore/widgets/be_WIDGET_ZONE.xml b/BlogEngine/BlogEngine.NET/App_Data/datastore/widgets/be_WIDGET_ZONE.xml index 587b490f2..72981ebb8 100644 --- a/BlogEngine/BlogEngine.NET/App_Data/datastore/widgets/be_WIDGET_ZONE.xml +++ b/BlogEngine/BlogEngine.NET/App_Data/datastore/widgets/be_WIDGET_ZONE.xml @@ -8,4 +8,5 @@ Newsletter CommentList LinkList + MonthList \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/BlogEngine.NET.csproj b/BlogEngine/BlogEngine.NET/BlogEngine.NET.csproj index cecbb8490..63a4cbd2f 100644 --- a/BlogEngine/BlogEngine.NET/BlogEngine.NET.csproj +++ b/BlogEngine/BlogEngine.NET/BlogEngine.NET.csproj @@ -724,6 +724,7 @@ + @@ -2120,6 +2121,7 @@ + default.aspx diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/MonthList/MonthList.cs b/BlogEngine/BlogEngine.NET/Custom/Widgets/MonthList/MonthList.cs new file mode 100644 index 000000000..846c474e3 --- /dev/null +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/MonthList/MonthList.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using BlogEngine.Core; + +namespace BlogEngine.NET.Custom.Widgets +{ + public class MonthList + { + class DateComparer_Desc : IComparer + { + int IComparer.Compare(DateTime x, DateTime y) { return -x.CompareTo(y); } + } + class IntComparer_Desc : IComparer + { + int IComparer.Compare(int x, int y) { return -x.CompareTo(y); } + } + + private static readonly IComparer date_Desc = new DateComparer_Desc(); + private static readonly IComparer int_Desc = new IntComparer_Desc(); + + public MonthList() { } + + public SortedDictionary> GetList() + { + var months = new SortedDictionary(date_Desc); + var years = new SortedDictionary>(int_Desc); + + foreach (var month in Post.ApplicablePosts.Where(post => post.IsVisibleToPublic). + Select(post => new DateTime(post.DateCreated.Year, post.DateCreated.Month, 1))) + { + int count; + months.TryGetValue(month, out count); + ++count; + months[month] = count; + } + foreach (KeyValuePair aIt in months) + { + if (!years.Keys.Contains(aIt.Key.Year)) + { + years.Add(aIt.Key.Year, new List()); + } + var item = new MonthItem(); + item.Title = aIt.Key.ToString("MMMM"); + item.Url = string.Format("{0}{1}/{2}", Utils.RelativeOrAbsoluteWebRoot, aIt.Key.Year, aIt.Key.Month.ToString("00")); + item.Count = aIt.Value; + years[aIt.Key.Year].Add(item); + } + return years; + } + } + + public class MonthItem + { + public string Title { get; set; } + public string Url { get; set; } + public int Count { get; set; } + } +} \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/MonthList/widget.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/MonthList/widget.cshtml new file mode 100644 index 000000000..fa36c7666 --- /dev/null +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/MonthList/widget.cshtml @@ -0,0 +1,30 @@ +@using BlogEngine.NET.Custom.Widgets +@{ + var title = Model.Title; + var mList = new MonthList(); + var years = mList.GetList(); + var cnt = 0; + var cls = "open"; +} +
    +

    @title

    +
    +
      + @foreach (KeyValuePair> y in years) + { + var yId = "year" + @y.Key; + var tgl = "BlogEngine.toggleMonth('" + yId + "')"; + cnt = cnt + 1; + cls = cnt > 1 ? "close" : "open"; +
    • @y.Key +
        + @foreach (var item in y.Value) + { +
      • @item.Title (@item.Count)
      • + } +
      +
    • + } +
    +
    +
    \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/TagCloud/edit.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/TagCloud/edit.cshtml index 1418311eb..c9f5008cf 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/TagCloud/edit.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/TagCloud/edit.cshtml @@ -60,7 +60,7 @@ @Html.DropDownList("ddCloudSize", cloudSizeOptions, new { @class = "form-control" })
    -
    diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/TextBox/edit.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/TextBox/edit.cshtml index f594a4cfb..4a77eb3f0 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/TextBox/edit.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/TextBox/edit.cshtml @@ -44,7 +44,7 @@
    -
    diff --git a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html index a7e82d442..c76dac93e 100644 --- a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html +++ b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html @@ -1,6 +1,8 @@ 
    + + + + +
    + +
    + + + + + + + + + + + @foreach (var roll in rolls) + { + + + + + + } + @if (rolls == null || rolls.Count == 0) + { + + } + +
    @Resources.labels.title@Resources.labels.descriptionXFN
    + @roll.Title + + @roll.Description@roll.Xfn
    @Resources.labels.empty
    + + + + + \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/BlogRoll/widget.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/BlogRoll/widget.cshtml new file mode 100644 index 000000000..6a239af5b --- /dev/null +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/BlogRoll/widget.cshtml @@ -0,0 +1,43 @@ +@using BlogEngine.NET.Custom.Widgets +@using BlogEngine.Core +@{ + var title = Model.Title; + var rolls = BlogRollItem.BlogRolls; + var br = new BlogRoll(); + var imgPath = Utils.ApplicationRelativeWebRoot + "Content/images/blog"; + var opmlPath = Utils.ApplicationRelativeWebRoot + "opml.axd"; +} +
    +

    @title

    +
    + @if (rolls != null) + { +
      + @foreach (var roll in rolls) + { +
    • + + @roll.Description + + @roll.Title + @if (br.GetFeeds(roll.FeedUrl.ToString()).Count > 0) + { + + } +
    • + } +
    + } + + @Resources.labels.downloadOPML + OPML + +
    +
    \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/admin/app/content/blogs/blogView.html b/BlogEngine/BlogEngine.NET/admin/app/content/blogs/blogView.html index b587db510..eee9f54e0 100644 --- a/BlogEngine/BlogEngine.NET/admin/app/content/blogs/blogView.html +++ b/BlogEngine/BlogEngine.NET/admin/app/content/blogs/blogView.html @@ -109,9 +109,9 @@

    {{lbl.blogs}}

    - -
    - +
    + +
diff --git a/BlogEngine/BlogEngine.NET/admin/app/settings/settingController.js b/BlogEngine/BlogEngine.NET/admin/app/settings/settingController.js index 2ee198ef1..3f659c93d 100644 --- a/BlogEngine/BlogEngine.NET/admin/app/settings/settingController.js +++ b/BlogEngine/BlogEngine.NET/admin/app/settings/settingController.js @@ -105,6 +105,19 @@ .error(function () { toastr.error($rootScope.lbl.failed); }); } + $scope.clearCache = function () { + dataService.updateItem("/api/settings?action=clearCache", $scope.settings) + .success(function (data) { + if (data) { + toastr.error(data); + } + else { + toastr.success($rootScope.lbl.completed); + } + }) + .error(function () { toastr.error($rootScope.lbl.failed); }); + } + $scope.loadTheme = function () { var theme = $("#selDesktopTheme option:selected").text(); window.location.assign("#/shared/package?id=" + theme); From d37be24ab87096173d2018ebdadc24e8560d4f53 Mon Sep 17 00:00:00 2001 From: Farzin Seyfolahi Date: Mon, 14 Mar 2016 18:37:37 -0700 Subject: [PATCH 013/152] Toggle arrow in sidebar removed and toolbar is open by default and Widgets improved. --- .../admin/app/custom/widgets/widgetView.html | 207 ++++++++---------- .../admin/themes/standard/css/styles.css | 2 +- .../admin/themes/standard/css/styles.css.map | 4 +- .../themes/standard/sass/layout/_header.scss | 16 +- .../themes/standard/sass/layout/_sidebar.scss | 25 --- .../standard/sass/pages/custom/_widgets.scss | 71 ++++++ .../admin/themes/standard/sass/styles.scss | 5 +- .../admin/themes/standard/sidebar.cshtml | 3 +- 8 files changed, 181 insertions(+), 152 deletions(-) create mode 100644 BlogEngine/BlogEngine.NET/admin/themes/standard/sass/pages/custom/_widgets.scss diff --git a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html index c76dac93e..fbb6346a1 100644 --- a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html +++ b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html @@ -1,151 +1,134 @@ -
- +
+

{{lbl.widgets}}

- +
- -
public bool ShowTitle { get; set; } + /// + /// Show uninstall widget button if was installed from gallery + /// + public bool ShowUnistall { get; set; } } } diff --git a/BlogEngine/BlogEngine.Core/Properties/AssemblyInfo.cs b/BlogEngine/BlogEngine.Core/Properties/AssemblyInfo.cs index 069f71f5e..092644e94 100644 --- a/BlogEngine/BlogEngine.Core/Properties/AssemblyInfo.cs +++ b/BlogEngine/BlogEngine.Core/Properties/AssemblyInfo.cs @@ -19,5 +19,5 @@ [assembly: CLSCompliant(false)] [assembly: ComVisible(false)] [assembly: AllowPartiallyTrustedCallers] -[assembly: AssemblyVersion("3.2.2.0")] +[assembly: AssemblyVersion("3.2.2.1")] [assembly: SecurityRules(SecurityRuleSet.Level1)] diff --git a/BlogEngine/BlogEngine.Core/Web/BlogCulture.cs b/BlogEngine/BlogEngine.Core/Web/BlogCulture.cs index c0e2fbb75..79555c0a5 100644 --- a/BlogEngine/BlogEngine.Core/Web/BlogCulture.cs +++ b/BlogEngine/BlogEngine.Core/Web/BlogCulture.cs @@ -497,6 +497,7 @@ void AddJavaScriptResources() AddResource("incorrectSimpleCaptcha"); AddResource("indent"); AddResource("industry"); + AddResource("information"); AddResource("insertImage"); AddResource("insertVideo"); AddResource("install"); diff --git a/BlogEngine/BlogEngine.NET/App_Data/datastore/widgets/be_WIDGET_ZONE.xml b/BlogEngine/BlogEngine.NET/App_Data/datastore/widgets/be_WIDGET_ZONE.xml index 72981ebb8..01f7f9b5b 100644 --- a/BlogEngine/BlogEngine.NET/App_Data/datastore/widgets/be_WIDGET_ZONE.xml +++ b/BlogEngine/BlogEngine.NET/App_Data/datastore/widgets/be_WIDGET_ZONE.xml @@ -7,6 +7,6 @@ PostList Newsletter CommentList - LinkList MonthList + TwitterTimeline \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/App_Data/packagefiles.xml b/BlogEngine/BlogEngine.NET/App_Data/packagefiles.xml index c47afcfa8..b7e353dfa 100644 --- a/BlogEngine/BlogEngine.NET/App_Data/packagefiles.xml +++ b/BlogEngine/BlogEngine.NET/App_Data/packagefiles.xml @@ -1,3 +1,7 @@  + + + + \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/App_Data/packages.xml b/BlogEngine/BlogEngine.NET/App_Data/packages.xml index 3b8e67f8d..57343fc76 100644 --- a/BlogEngine/BlogEngine.NET/App_Data/packages.xml +++ b/BlogEngine/BlogEngine.NET/App_Data/packages.xml @@ -1,3 +1,4 @@  + \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/BlogEngine.NET.csproj b/BlogEngine/BlogEngine.NET/BlogEngine.NET.csproj index 56f320b80..b9fdf837c 100644 --- a/BlogEngine/BlogEngine.NET/BlogEngine.NET.csproj +++ b/BlogEngine/BlogEngine.NET/BlogEngine.NET.csproj @@ -585,19 +585,33 @@ + + + + + + + + + + + + + + diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/TwitterTimeline/edit.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/TwitterTimeline/edit.cshtml new file mode 100644 index 000000000..3498adc0e --- /dev/null +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/TwitterTimeline/edit.cshtml @@ -0,0 +1,53 @@ +@using BlogEngine.NET.Custom.Widgets +@{ + var appId = "717752735521636352"; + var twitId = "blogenginenet"; + + var widgetId = Request.QueryString["id"]; + var settings = Common.GetSettings(widgetId); + + Validation.Add("txtAppId", Validator.Required("Field is required")); + Validation.Add("txtTwitId", Validator.Required("Field is required")); + + if (IsPost) + { + if (Validation.IsValid()) + { + settings["appId"] = Request.Form["txtAppId"]; + settings["twitId"] = Request.Form["txtTwitId"]; + + Common.SaveSettings(settings, widgetId); + @: + } + } + if (settings != null && settings.Count > 0) + { + appId = settings["appId"]; + twitId = settings["twitId"]; + } +} + + + + + + + + +
+
+
+ + + @Html.ValidationMessage("txtAppId") +
+
+ + + @Html.ValidationMessage("txtTwitId") +
+ +
+
+ + \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/TwitterTimeline/widget.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/TwitterTimeline/widget.cshtml new file mode 100644 index 000000000..086e7c38f --- /dev/null +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/TwitterTimeline/widget.cshtml @@ -0,0 +1,28 @@ +@using BlogEngine.NET.Custom.Widgets +@{ + var settings = Common.GetSettings(Model.Id); + var TwitId = "blogenginenet"; + var AppId = "717752735521636352"; + if (settings != null && settings.Count > 0) + { + TwitId = HttpUtility.HtmlDecode(settings["TwitId"]); + AppId = HttpUtility.HtmlDecode(settings["AppId"]); + } +} +
+ @if (!string.IsNullOrEmpty(TwitId)) + { + + + } +
\ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/TwitterTimeline/widget.xml b/BlogEngine/BlogEngine.NET/Custom/Widgets/TwitterTimeline/widget.xml new file mode 100644 index 000000000..2feff635a --- /dev/null +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/TwitterTimeline/widget.xml @@ -0,0 +1,9 @@ + + + TwitterTimeline + Twitter Timeline widget for BlogEngine.NET 3.3 and above + BlogEngine.NET + + 3.3.0.0 + http://dnbe.net/v01/images/TwitterTimeline.png + \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js index 79a8c48a3..0edd90798 100644 --- a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js +++ b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js @@ -193,6 +193,19 @@ }); } + $scope.uninstallPackage = function (pkgId) { + spinOn(); + dataService.updateItem("/api/packages/uninstall/" + pkgId, pkgId) + .success(function (data) { + toastr.success($rootScope.lbl.completed); + $scope.load(); + }) + .error(function () { + toastr.error($rootScope.lbl.failed); + spinOff(); + }); + } + $scope.load(); $(document).ready(function () { diff --git a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetGalleryController.js b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetGalleryController.js index 9283609bd..f17d21931 100644 --- a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetGalleryController.js +++ b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetGalleryController.js @@ -100,6 +100,13 @@ $scope.selectedRating = rating; } + $scope.checkStar = function (item, rating) { + if (item === rating) { + return true; + } + return false; + } + $scope.load(); $(document).ready(function () { diff --git a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html index d1e001d6c..86c40548f 100644 --- a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html +++ b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html @@ -96,20 +96,22 @@

{{lbl.widgets}}

-
+

Available Widgets

  • {{ iw.Title }} -
    -
-
+

Widget Zone ({{widgetZones.titles[0]}})

From 804c37b322e44a838a3c8b4bf9985cd1dd66231c Mon Sep 17 00:00:00 2001 From: rxtur Date: Mon, 11 Apr 2016 13:01:18 -0500 Subject: [PATCH 033/152] Missed file. --- .../BlogEngine.NET/admin/app/custom/widgets/widgetView.html | 1 + 1 file changed, 1 insertion(+) diff --git a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html index 86c40548f..81bed76f7 100644 --- a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html +++ b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html @@ -105,6 +105,7 @@

Available Widgets

+
From a8a45e4a4d3df8c8c507094187cb499b236c05e3 Mon Sep 17 00:00:00 2001 From: geonewlitho Date: Thu, 14 Apr 2016 17:23:14 +1000 Subject: [PATCH 034/152] fix for #53 Contact form js is now working again --- BlogEngine/BlogEngine.NET/Scripts/contact.js | 116 +++++++++---------- BlogEngine/BlogEngine.NET/contact.aspx | 96 +++++++-------- 2 files changed, 106 insertions(+), 106 deletions(-) diff --git a/BlogEngine/BlogEngine.NET/Scripts/contact.js b/BlogEngine/BlogEngine.NET/Scripts/contact.js index 518171a64..03634fc92 100644 --- a/BlogEngine/BlogEngine.NET/Scripts/contact.js +++ b/BlogEngine/BlogEngine.NET/Scripts/contact.js @@ -1,59 +1,59 @@ -function beginSendMessage() { - if (BlogEngine.$('<%=txtAttachment.ClientID %>') && BlogEngine.$('<%=txtAttachment.ClientID %>').value.length > 0) - return true; - - if (!Page_ClientValidate('contact')) - return false; - - var recaptchaResponseField = document.getElementById('recaptcha_response_field'); - var recaptchaResponse = recaptchaResponseField ? recaptchaResponseField.value : ""; - - var recaptchaChallengeField = document.getElementById('recaptcha_challenge_field'); - var recaptchaChallenge = recaptchaChallengeField ? recaptchaChallengeField.value : ""; - - var name = BlogEngine.$('<%=txtName.ClientID %>').value; - var email = BlogEngine.$('<%=txtEmail.ClientID %>').value; - var subject = BlogEngine.$('<%=txtSubject.ClientID %>').value; - var message = BlogEngine.$('<%=txtMessage.ClientID %>').value; - var sep = '-||-'; - var arg = name + sep + email + sep + subject + sep + message + sep + recaptchaResponse + sep + recaptchaChallenge; - WebForm_DoCallback('__Page', arg, endSendMessage, 'contact', onSendError, false) - - BlogEngine.$('<%=btnSend.ClientID %>').disabled = true; - - return false; -} - -function endSendMessage(arg, context) { - - if (arg == "RecaptchaIncorrect") { - displayIncorrectCaptchaMessage(); - BlogEngine.$('<%=btnSend.ClientID %>').disabled = false; - - if (document.getElementById('recaptcha_response_field')) { - Recaptcha.reload(); - } - } - else { - if (document.getElementById("spnCaptchaIncorrect")) document.getElementById("spnCaptchaIncorrect").style.display = "none"; - - BlogEngine.$('<%=btnSend.ClientID %>').disabled = false; - var form = BlogEngine.$('<%=divForm.ClientID %>') - var thanks = BlogEngine.$('thanks'); - - form.style.display = 'none'; - thanks.innerHTML = arg; - } -} - -function displayIncorrectCaptchaMessage() { - if (document.getElementById("spnCaptchaIncorrect")) document.getElementById("spnCaptchaIncorrect").style.display = ""; -} - -function onSendError(err, context) { - if (document.getElementById('recaptcha_response_field')) { - Recaptcha.reload(); - } - BlogEngine.$('<%=btnSend.ClientID %>').disabled = false; - alert("Sorry, but the following occurred while attemping to send your message: " + err); +function beginSendMessage() { + if ($('[data-id="txtAttachment"]').length > 0 && $('[data-id="txtAttachment"]').val().length > 0) + return true; + + if (!Page_ClientValidate('contact')) + return false; + + var recaptchaResponseField = $('#recaptcha_response_field'); + var recaptchaResponse = recaptchaResponseField.length > 0 ? recaptchaResponseField.val() : ""; + + var recaptchaChallengeField = $('#recaptcha_challenge_field'); + var recaptchaChallenge = recaptchaChallengeField.length > 0 ? recaptchaChallengeField.val() : ""; + + var name = $('[data-id="txtName"]').val(); + var email = $('[data-id="txtEmail"]').val(); + var subject = $('[data-id="txtSubject"]').val(); + var message = $('[data-id="txtMessage"]').val(); + var sep = '-||-'; + var arg = name + sep + email + sep + subject + sep + message + sep + recaptchaResponse + sep + recaptchaChallenge; + WebForm_DoCallback('__Page', arg, endSendMessage, 'contact', onSendError, false) + + $('[data-id="btnSend"]').attr("disabled", true); + + return false; +} + +function endSendMessage(arg, context) { + + if (arg == "RecaptchaIncorrect") { + displayIncorrectCaptchaMessage(); + $('[data-id="btnSend"]').attr("disabled", ""); + + if ($('#recaptcha_response_field').length > 0) { + Recaptcha.reload(); + } + } + else { + if ($("#spnCaptchaIncorrect")) $("#spnCaptchaIncorrect").css("display", "none"); + + $('[data-id="btnSend').attr("disabled", ""); + var form = $('[data-id="divForm'); + var thanks = $('#thanks'); + + form.css("display", "none"); + thanks.html(arg); + } +} + +function displayIncorrectCaptchaMessage() { + if ($("#spnCaptchaIncorrect")) $("#spnCaptchaIncorrect").css("display", "none"); +} + +function onSendError(err, context) { + if ($('#recaptcha_response_field')) { + Recaptcha.reload(); + } + $('[data-id="btnSend"]').css("display", "none"); + alert("Sorry, but the following occurred while attemping to send your message: " + err); } \ No newline at end of file diff --git a/BlogEngine/BlogEngine.NET/contact.aspx b/BlogEngine/BlogEngine.NET/contact.aspx index 464ef2f97..96ea8a684 100644 --- a/BlogEngine/BlogEngine.NET/contact.aspx +++ b/BlogEngine/BlogEngine.NET/contact.aspx @@ -1,49 +1,49 @@ -<%@ Page Language="C#" AutoEventWireup="true" Inherits="contact" ValidateRequest="false" Codebehind="contact.aspx.cs" %> -<%@ Import Namespace="BlogEngine.Core" %> - - -
-
-

<%=Resources.labels.contact %>

-
<%=BlogSettings.Instance.ContactFormMessage %>
-
- - - -
-
- - - -
-
- - - -
-
- - - -
-
- - - - -
- - -
- - <%=BlogSettings.Instance.ContactErrorMessage %>. -
-
-
-
-
<%=BlogSettings.Instance.ContactThankMessage %>
-
-
-
- +<%@ Page Language="C#" AutoEventWireup="true" Inherits="contact" ValidateRequest="false" Codebehind="contact.aspx.cs" %> +<%@ Import Namespace="BlogEngine.Core" %> + + +
+
+

<%=Resources.labels.contact %>

+
<%=BlogSettings.Instance.ContactFormMessage %>
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + + +
+ + +
+ + <%=BlogSettings.Instance.ContactErrorMessage %>. +
+
+
+
+
<%=BlogSettings.Instance.ContactThankMessage %>
+
+
+
+
\ No newline at end of file From 720c28ee5e3165a494566865f4efd01cfa5a53c1 Mon Sep 17 00:00:00 2001 From: Farzin Seyfolahi Date: Sat, 16 Apr 2016 20:26:35 +0430 Subject: [PATCH 035/152] improve some style in the Widgets. --- .../admin/app/custom/widgets/widgetView.html | 169 +++++++++--------- .../admin/themes/standard/css/styles.css | 2 +- .../admin/themes/standard/css/styles.css.map | 2 +- .../standard/scss/pages/custom/_widgets.scss | 85 +++++++++ 4 files changed, 168 insertions(+), 90 deletions(-) diff --git a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html index 81bed76f7..0c88775b9 100644 --- a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html +++ b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html @@ -4,17 +4,14 @@