Skip to content

Commit d15fc16

Browse files
committed
Added Post List widget (3.2.0.9)
1 parent b1817b5 commit d15fc16

14 files changed

Lines changed: 292 additions & 205 deletions

File tree

BlogEngine/BlogEngine.Core/Helpers/WidgetHelper.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
using BlogEngine.Core.DataStore;
2-
using System;
3-
using System.Collections.Generic;
42
using System.Collections.Specialized;
5-
using System.Linq;
6-
using System.Text;
7-
using System.Threading.Tasks;
83

94
namespace BlogEngine.Core.Helpers
105
{
@@ -42,6 +37,6 @@ public static void SaveSettings(StringDictionary settings, string widgetId)
4237
ws.SaveSettings(settings);
4338

4439
Blog.CurrentInstance.Cache[cacheId] = settings;
45-
}
40+
}
4641
}
4742
}

BlogEngine/BlogEngine.Core/Post.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,32 @@ public bool IsVisibleToPublic
693693
}
694694
}
695695

696+
/// <summary>
697+
/// URL of the first image in the post, if any
698+
/// </summary>
699+
public string FirstImgSrc
700+
{
701+
get
702+
{
703+
int idx = Content.IndexOf("<img src=");
704+
if (idx > 0)
705+
{
706+
try
707+
{
708+
idx = idx + 10;
709+
var idxEnd = Content.IndexOf("\"", idx);
710+
if (idxEnd > idx)
711+
{
712+
var len = idxEnd - idx;
713+
return Content.Substring(idx, len);
714+
}
715+
}
716+
catch (Exception) { }
717+
}
718+
return "";
719+
}
720+
}
721+
696722
#endregion
697723

698724
#region Comment Properties

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.0.8")]
22+
[assembly: AssemblyVersion("3.2.0.9")]
2323
[assembly: SecurityRules(SecurityRuleSet.Level1)]

BlogEngine/BlogEngine.NET/AppCode/Controls/PageList.cs

Lines changed: 0 additions & 122 deletions
This file was deleted.

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<widget id="a73fa604-cf51-41cc-abac-f1b11643db73" title="Tag cloud" showTitle="True">Tag cloud</widget>
66
<widget id="deb9fd7c-e0f4-4f24-964d-d5f67332bab0" title="TextBox" showTitle="True">TextBox</widget>
77
<widget id="47fdb964-2c19-4099-9834-7d6ef8eb424b" title="Category list" showTitle="True">Category list</widget>
8-
<widget id="ab97b0d9-01c7-498a-96f3-fad1c046216e" title="RecentPosts" showTitle="True">RecentPosts</widget>
98
<widget id="86a54bdc-32ad-4699-9494-d9969d825e8d" title="RecentComments" 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>
1011
</widgets>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<SerializableStringDictionary>
3+
<SerializableStringDictionary>
4+
<DictionaryEntry Key="author" Value="All" />
5+
<DictionaryEntry Key="showdesc" Value="true" />
6+
<DictionaryEntry Key="numberofposts" Value="10" />
7+
<DictionaryEntry Key="showdate" Value="true" />
8+
<DictionaryEntry Key="showimg" Value="true" />
9+
<DictionaryEntry Key="sortorder" Value="Published" />
10+
<DictionaryEntry Key="cutegory" Value="All" />
11+
</SerializableStringDictionary>
12+
</SerializableStringDictionary>
6.33 KB
Loading
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
2+
<post>
3+
<author>Admin</author>
4+
<title>Post two</title>
5+
<description>This is a post two. The variables searchTerm and selectCommand are initialized at the top. You're go</description>
6+
<content>&lt;p&gt;This post is just an example using Post List widget with image in the post body.&lt;/p&gt;
7+
&lt;p&gt;&lt;img src="/image.axd?picture=/350x150.png" alt="" /&gt;&lt;/p&gt;
8+
&lt;p&gt;Post List widget should find first image in the post body and display it in the post list when this option selected in the widget admin.&lt;/p&gt;</content>
9+
<ispublished>True</ispublished>
10+
<isdeleted>False</isdeleted>
11+
<iscommentsenabled>True</iscommentsenabled>
12+
<pubDate>2016-02-06 13:54:00</pubDate>
13+
<lastModified>2016-02-06 09:20:54</lastModified>
14+
<raters>0</raters>
15+
<rating>0</rating>
16+
<slug>post-two</slug>
17+
<tags />
18+
<comments />
19+
<categories />
20+
<notifications />
21+
</post>

BlogEngine/BlogEngine.NET/BlogEngine.NET.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -713,12 +713,13 @@
713713
<Content Include="Custom\Widgets\TextBox\edit.cshtml" />
714714
<Content Include="Custom\Widgets\TextBox\widget.cshtml" />
715715
<Content Include="Custom\Widgets\Category list\widget.cshtml" />
716-
<Content Include="Custom\Widgets\RecentPosts\widget.cshtml" />
717716
<Content Include="Custom\Widgets\Search\widget.cshtml" />
718-
<Content Include="Custom\Widgets\RecentPosts\edit.cshtml" />
719717
<Content Include="Custom\Widgets\RecentComments\edit.cshtml" />
720718
<Content Include="Custom\Widgets\RecentComments\widget.cshtml" />
721719
<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" />
722723
<None Include="Scripts\jquery-2.1.4.intellisense.js" />
723724
<Content Include="Scripts\i18n\angular-locale_aa-dj.js" />
724725
<Content Include="Scripts\i18n\angular-locale_aa-er.js" />
@@ -1881,7 +1882,6 @@
18811882
<Compile Include="AppCode\Controls\Blogroll.cs" />
18821883
<Compile Include="AppCode\Controls\MobileThemeSwitch.cs" />
18831884
<Compile Include="AppCode\Controls\MonthList.cs" />
1884-
<Compile Include="AppCode\Controls\PageList.cs" />
18851885
<Compile Include="AppCode\Controls\PageMenu.cs" />
18861886
<Compile Include="AppCode\Controls\PostCalendar.cs" />
18871887
<Compile Include="AppCode\Controls\PostPager.cs" />
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@using BlogEngine.Core
2+
@{
3+
var title = "Page List";
4+
}
5+
<div class="widget pagelist">
6+
<h4 class="widget-header">@title</h4>
7+
<div class="widget-content">
8+
<ul>
9+
@foreach (var page in BlogEngine.Core.Page.Pages.Where(page => page.ShowInList && page.IsVisibleToPublic))
10+
{
11+
var href = page.RelativeLink;
12+
if (BlogSettings.Instance.RemoveExtensionsFromUrls && !string.IsNullOrEmpty(BlogConfig.FileExtension))
13+
{
14+
href = href.Replace(BlogConfig.FileExtension, "");
15+
}
16+
<li><a href="@href" title="@page.Description">@page.Title</a></li>
17+
}
18+
</ul>
19+
</div>
20+
</div>

0 commit comments

Comments
 (0)