Skip to content

Commit f7d2105

Browse files
committed
Some fixes, mostly in BlogRoll widget (3.2.1.5)
1 parent 162dc84 commit f7d2105

File tree

13 files changed

+83
-23
lines changed

13 files changed

+83
-23
lines changed

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

BlogEngine/BlogEngine.Core/Providers/CacheProvider/CacheBase.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ public abstract class CacheBase : IEnumerable
7979
///<returns></returns>
8080
public abstract object Remove(string key);
8181

82+
/// <summary>
83+
/// Reset cache provider
84+
/// </summary>
85+
public abstract void Reset();
86+
8287
IEnumerator IEnumerable.GetEnumerator()
8388
{
8489
return GetEnumerator();

BlogEngine/BlogEngine.Core/Providers/CacheProvider/CacheProvider.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,5 +154,29 @@ public override object Remove(string key)
154154
{
155155
return _cache.Remove(_keyPrefix + key);
156156
}
157+
158+
/// <summary>
159+
/// Reset cache provider
160+
/// </summary>
161+
public override void Reset()
162+
{
163+
var keys = new System.Collections.Specialized.StringCollection();
164+
foreach (var item in _cache)
165+
{
166+
var x = (DictionaryEntry)item;
167+
keys.Add(x.Key.ToString());
168+
}
169+
if (keys.Count > 0)
170+
{
171+
foreach (var key in keys)
172+
{
173+
if (key.StartsWith(_keyPrefix))
174+
{
175+
// Utils.Log(key);
176+
_cache.Remove(key);
177+
}
178+
}
179+
}
180+
}
157181
}
158182
}

BlogEngine/BlogEngine.Core/Providers/XmlProvider/BlogRoll.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,13 @@ public override List<BlogRollItem> FillBlogRoll()
101101
public override void InsertBlogRollItem(BlogRollItem blogRollItem)
102102
{
103103
var blogRolls = BlogRollItem.BlogRolls;
104+
if(blogRolls == null)
105+
{
106+
blogRolls = new List<BlogRollItem>();
107+
}
104108
blogRolls.Add(blogRollItem);
105109

106-
this.WriteBlogRollFile(blogRolls);
110+
WriteBlogRollFile(blogRolls);
107111
}
108112

109113
/// <summary>

BlogEngine/BlogEngine.NET/AppCode/Api/SettingsController.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ public HttpResponseMessage Put([FromBody]Settings settings, string action = "")
3838
return Request.CreateResponse(HttpStatusCode.OK, retMsg);
3939
}
4040
}
41+
else if(action == "clearCache")
42+
{
43+
BlogEngine.Core.Blog.CurrentInstance.Cache.Reset();
44+
}
4145
else
4246
{
4347
repository.Update(settings);

BlogEngine/BlogEngine.NET/App_GlobalResources/labels.ru.resx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,10 +1607,10 @@
16071607
<value>Разрешить</value>
16081608
</data>
16091609
<data name="AllPostsBy" xml:space="preserve">
1610-
<value>Все запили</value>
1610+
<value>Все записи</value>
16111611
</data>
16121612
<data name="AllPostsTagged" xml:space="preserve">
1613-
<value>Все запили отмеченные как</value>
1613+
<value>Все записи отмеченные как</value>
16141614
</data>
16151615
<data name="anotherEmail" xml:space="preserve">
16161616
<value>Пожалуйста выберите другой email адрес</value>

BlogEngine/BlogEngine.NET/Custom/Widgets/BlogRoll/BlogRoll.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,14 @@ public void Add(NameValueCollection form)
128128
br.Xfn = GetXfnString(form);
129129

130130
int largestSortIndex = -1;
131-
foreach (BlogRollItem brExisting in BlogRollItem.BlogRolls)
131+
if(BlogRollItem.BlogRolls != null && BlogRollItem.BlogRolls.Count > 0)
132132
{
133-
if (brExisting.SortIndex > largestSortIndex)
133+
foreach (BlogRollItem brExisting in BlogRollItem.BlogRolls)
134134
{
135-
largestSortIndex = brExisting.SortIndex;
135+
if (brExisting.SortIndex > largestSortIndex)
136+
{
137+
largestSortIndex = brExisting.SortIndex;
138+
}
136139
}
137140
}
138141
br.SortIndex = largestSortIndex + 1;

BlogEngine/BlogEngine.NET/Custom/Widgets/BlogRoll/edit.cshtml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -173,22 +173,25 @@
173173
<th width="20%">XFN <a href="http://gmpg.org/xfn/intro" title="XFN" target="_blank"><i class="fa fa-info-circle"></i></a></th>
174174
</tr>
175175
</thead>
176-
<tbody>
177-
@foreach (var roll in rolls)
178-
{
179-
<tr>
180-
<td class="item-title">
181-
<a title="@roll.Title" href="#" onclick="submitForm('@roll.Id')" class="text-ellipsis pull-left">@roll.Title</a>
182-
<a title="@roll.FeedUrl" class="external-link pull-right" target="_blank" href="@roll.FeedUrl"><i class="fa fa-external-link"></i></a>
183-
</td>
184-
<td>@roll.Description</td>
185-
<td>@roll.Xfn</td>
186-
</tr>
187-
}
176+
<tbody>
188177
@if (rolls == null || rolls.Count == 0)
189178
{
190179
<tr><td colspan="3">@Resources.labels.empty</td></tr>
191180
}
181+
else
182+
{
183+
foreach (var roll in rolls)
184+
{
185+
<tr>
186+
<td class="item-title">
187+
<a title="@roll.Title" href="#" onclick="submitForm('@roll.Id')" class="text-ellipsis pull-left">@roll.Title</a>
188+
<a title="@roll.FeedUrl" class="external-link pull-right" target="_blank" href="@roll.FeedUrl"><i class="fa fa-external-link"></i></a>
189+
</td>
190+
<td>@roll.Description</td>
191+
<td>@roll.Xfn</td>
192+
</tr>
193+
}
194+
}
192195
</tbody>
193196
</table>
194197
<input type="hidden" id="hdnId" name="hdnId" value="" />

BlogEngine/BlogEngine.NET/Custom/Widgets/LinkList/edit.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
var hdnId = "";
1111

1212
var widgetId = Request.QueryString["id"];
13-
var updateLink = BlogEngine.Core.Utils.RelativeOrAbsoluteWebRoot +
13+
var updateLink = BlogEngine.Core.Utils.RelativeWebRoot +
1414
"Custom/Widgets/LinkList/edit.cshtml?id=" + widgetId;
1515
var settings = Common.GetSettings(widgetId);
1616
var linkList = new LinkList(widgetId);

BlogEngine/BlogEngine.NET/Custom/Widgets/LinkList/widget.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<div class="widget linklist">
77
<h4 class="widget-header">@Model.Title</h4>
88
<div class="widget-content">
9-
<ul id="recentComments" class="recentcomments">
9+
<ul id="linkList" class="linklist">
1010
@foreach (var link in links)
1111
{
1212
if (link.Target == "on")

0 commit comments

Comments
 (0)