Skip to content

Commit 04328df

Browse files
committed
Widgets refactoring, newsletter (3.2.1.2)
1 parent 6765d93 commit 04328df

File tree

24 files changed

+383
-61
lines changed

24 files changed

+383
-61
lines changed

BlogEngine/BlogEngine.Core/BlogEngine.Core.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@
118118
<Compile Include="Data\Contracts\IWidgetsRepository.cs" />
119119
<Compile Include="Data\Contracts\IDashboardRepository.cs" />
120120
<Compile Include="Data\Services\TagCloud.cs" />
121-
<Compile Include="Helpers\CategoryHelper.cs" />
122-
<Compile Include="Helpers\WidgetHelper.cs" />
123121
<Compile Include="Data\WidgetsRepository.cs" />
124122
<Compile Include="Data\DashboardRepository.cs" />
125123
<Compile Include="Data\Models\EditorOptions.cs" />

BlogEngine/BlogEngine.Core/Post.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,29 +1601,29 @@ protected override void DataUpdate()
16011601
if (AboutToPublishPost())
16021602
{
16031603
var e = new CancelEventArgs();
1604-
this.OnPublishing(e);
1604+
OnPublishing(e);
16051605
if (e.Cancel)
16061606
{
1607-
this.isPublished = false;
1607+
isPublished = false;
16081608
}
16091609
}
16101610

16111611
BlogService.UpdatePost(this);
16121612
Posts.Sort();
16131613
AddRelations(Posts);
1614-
this.ResetNestedComments();
1614+
ResetNestedComments();
16151615

1616-
if (this.isPublished)
1616+
if (isPublished && !IsDeleted)
16171617
{
1618-
this.OnPublished();
1618+
OnPublished();
16191619
}
16201620
}
16211621

16221622
bool AboutToPublishPost()
16231623
{
1624-
if (this.isPublished)
1624+
if (isPublished && !IsDeleted)
16251625
{
1626-
var p = DataSelect(this.Id);
1626+
var p = DataSelect(Id);
16271627
if (p != null && !p.isPublished)
16281628
{
16291629
return true;

BlogEngine/BlogEngine.Core/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
[assembly: CLSCompliant(false)]
2020
[assembly: ComVisible(false)]
2121
[assembly: AllowPartiallyTrustedCallers]
22-
[assembly: AssemblyVersion("3.2.1.1")]
22+
[assembly: AssemblyVersion("3.2.1.2")]
2323
[assembly: SecurityRules(SecurityRuleSet.Level1)]

BlogEngine/BlogEngine.NET/App_Data/datastore/widgets/be_WIDGET_ZONE.xml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
<widgets>
33
<widget id="e53c0e19-c61b-4f6e-aa90-09da817488bc" title="Administration" showTitle="True">Administration</widget>
44
<widget id="a305a372-ba9f-49b3-ac49-1453faa3efc0" title="Search" showTitle="True">Search</widget>
5-
<widget id="a73fa604-cf51-41cc-abac-f1b11643db73" title="Tag cloud" showTitle="True">Tag cloud</widget>
65
<widget id="deb9fd7c-e0f4-4f24-964d-d5f67332bab0" title="TextBox" showTitle="True">TextBox</widget>
7-
<widget id="47fdb964-2c19-4099-9834-7d6ef8eb424b" title="Category list" showTitle="True">Category list</widget>
8-
<widget id="86a54bdc-32ad-4699-9494-d9969d825e8d" title="Recent Comments" showTitle="True">RecentComments</widget>
9-
<widget id="2c9454ad-9819-4f62-8b24-e92e45273c73" title="Page List" showTitle="True">Page List</widget>
10-
<widget id="c5535c01-4401-4b71-b9bb-8c3c794029d4" title="Post List" showTitle="True">Post List</widget>
6+
<widget id="21108331-e283-4807-a4f6-f1db31163608" title="Category List" showTitle="True">CategoryList</widget>
7+
<widget id="5bf32012-4aa3-4031-8346-4d36f0fda6d9" title="Post List" showTitle="True">PostList</widget>
8+
<widget id="abde36cb-9ba6-4645-afc3-c0e4292ce72e" title="Newsletter" showTitle="True">Newsletter</widget>
119
</widgets>

BlogEngine/BlogEngine.NET/BlogEngine.NET.csproj

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -706,20 +706,22 @@
706706
<Content Include="Custom\Themes\Standard\site.master" />
707707
<Content Include="Custom\Widgets\Administration\widget.cshtml" />
708708
<Content Include="Custom\Widgets\AuthorList\widget.cshtml" />
709-
<Content Include="Custom\Widgets\Blog List\widget.cshtml" />
710-
<Content Include="Custom\Widgets\Tag cloud\widget.cshtml" />
711-
<Content Include="Custom\Widgets\Tag cloud\edit.cshtml" />
712-
<Content Include="Custom\Widgets\shared.cshtml" />
709+
<Content Include="Custom\Widgets\BlogList\widget.cshtml" />
710+
<Content Include="Custom\Widgets\TagCloud\widget.cshtml" />
711+
<Content Include="Custom\Widgets\TagCloud\edit.cshtml" />
712+
<Content Include="Custom\Widgets\common.cshtml" />
713713
<Content Include="Custom\Widgets\TextBox\edit.cshtml" />
714714
<Content Include="Custom\Widgets\TextBox\widget.cshtml" />
715-
<Content Include="Custom\Widgets\Category list\widget.cshtml" />
715+
<Content Include="Custom\Widgets\CategoryList\widget.cshtml" />
716716
<Content Include="Custom\Widgets\Search\widget.cshtml" />
717717
<Content Include="Custom\Widgets\RecentComments\edit.cshtml" />
718718
<Content Include="Custom\Widgets\RecentComments\widget.cshtml" />
719719
<Content Include="AppCode\Wlw\TagMini.cshtml" />
720-
<Content Include="Custom\Widgets\Page List\widget.cshtml" />
721-
<Content Include="Custom\Widgets\Post List\edit.cshtml" />
722-
<Content Include="Custom\Widgets\Post List\widget.cshtml" />
720+
<Content Include="Custom\Widgets\PageList\widget.cshtml" />
721+
<Content Include="Custom\Widgets\PostList\edit.cshtml" />
722+
<Content Include="Custom\Widgets\PostList\widget.cshtml" />
723+
<Content Include="Custom\Widgets\Newsletter\edit.cshtml" />
724+
<Content Include="Custom\Widgets\Newsletter\widget.cshtml" />
723725
<None Include="Scripts\jquery-2.1.4.intellisense.js" />
724726
<Content Include="Scripts\i18n\angular-locale_aa-dj.js" />
725727
<Content Include="Scripts\i18n\angular-locale_aa-er.js" />
@@ -1893,6 +1895,7 @@
18931895
<Compile Include="Custom\Extensions\Recaptcha\RecaptchaValidator.cs" />
18941896
<Compile Include="Custom\Extensions\ResolveLinks.cs" />
18951897
<Compile Include="Custom\Extensions\SendCommentMail.cs" />
1898+
<Compile Include="Custom\Extensions\Newsletter.cs" />
18961899
<Compile Include="Custom\Extensions\SendPings.cs" />
18971900
<Compile Include="Custom\Extensions\SimpleCaptcha\SimpleCaptcha.cs" />
18981901
<Compile Include="Custom\Extensions\SimpleCaptcha\SimpleCaptchaControl.cs" />
@@ -2106,6 +2109,9 @@
21062109
<Compile Include="Custom\Themes\Standard-2015\site.master.designer.cs">
21072110
<DependentUpon>site.master</DependentUpon>
21082111
</Compile>
2112+
<Compile Include="Custom\Widgets\CategoryList\CategoryList.cs" />
2113+
<Compile Include="Custom\Widgets\Common.cs" />
2114+
<Compile Include="Custom\Widgets\Newsletter\Newsletter.cs" />
21092115
<Compile Include="default.aspx.cs">
21102116
<DependentUpon>default.aspx</DependentUpon>
21112117
<SubType>ASPXCodeBehind</SubType>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System;
2+
using BlogEngine.Core;
3+
using BlogEngine.Core.Web.Controls;
4+
using BlogEngine.Core.Web.Extensions;
5+
6+
/// <summary>
7+
/// Sends emails to newsletter subscribers
8+
/// </summary>
9+
[Extension("Sends emails to newsletter subscribers", "3.3.0.0", "BlogEngine.NET")]
10+
public class Newsletter
11+
{
12+
#region Constructors and Destructors
13+
14+
static Newsletter()
15+
{
16+
Post.Published += Post_Published;
17+
}
18+
19+
private static void Post_Published(object sender, EventArgs e)
20+
{
21+
if (!ExtensionManager.ExtensionEnabled("Newsletter"))
22+
return;
23+
24+
var publishable = (IPublishable)sender;
25+
BlogEngine.NET.Custom.Widgets.Newsletter.SendEmails(publishable);
26+
}
27+
28+
#endregion
29+
}
File renamed without changes.

BlogEngine/BlogEngine.Core/Helpers/CategoryHelper.cs renamed to BlogEngine/BlogEngine.NET/Custom/Widgets/CategoryList/CategoryList.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
using System.Collections.Generic;
1+
using BlogEngine.Core;
2+
using System.Collections.Generic;
23
using System.Linq;
34

4-
namespace BlogEngine.Core.Helpers
5+
namespace BlogEngine.NET.Custom.Widgets
56
{
6-
/// <summary>
7-
/// Helper for category list widget
8-
/// </summary>
9-
public class CategoryHelper
7+
public class CategoryList
108
{
119
private static bool HasPosts(Category cat)
1210
{
@@ -32,4 +30,4 @@ public static SortedDictionary<string, Category> SortCategories()
3230
return dic;
3331
}
3432
}
35-
}
33+
}

BlogEngine/BlogEngine.NET/Custom/Widgets/Category list/widget.cshtml renamed to BlogEngine/BlogEngine.NET/Custom/Widgets/CategoryList/widget.cshtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
@using BlogEngine.Core
2+
@using BlogEngine.NET.Custom.Widgets
23
@{
34
var title = Model.Title;
4-
var dic = BlogEngine.Core.Helpers.CategoryHelper.SortCategories();
5+
var dic = CategoryList.SortCategories();
56
}
67
<div class="widget categorylist">
78
<h4 class="widget-header">@title</h4>

BlogEngine/BlogEngine.Core/Helpers/WidgetHelper.cs renamed to BlogEngine/BlogEngine.NET/Custom/Widgets/Common.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
using BlogEngine.Core.DataStore;
1+
using BlogEngine.Core;
2+
using BlogEngine.Core.DataStore;
23
using System.Collections.Specialized;
34

4-
namespace BlogEngine.Core.Helpers
5+
namespace BlogEngine.NET.Custom.Widgets
56
{
6-
/// <summary>
7-
/// Widgets helper class
8-
/// </summary>
9-
public class WidgetHelper
7+
public class Common
108
{
119
/// <summary>
1210
/// Gets widget settings
@@ -37,6 +35,6 @@ public static void SaveSettings(StringDictionary settings, string widgetId)
3735
ws.SaveSettings(settings);
3836

3937
Blog.CurrentInstance.Cache[cacheId] = settings;
40-
}
38+
}
4139
}
42-
}
40+
}

0 commit comments

Comments
 (0)