Skip to content

Commit 4517728

Browse files
committed
v6.13
1 parent d044576 commit 4517728

39 files changed

+345
-283
lines changed

SS.CMS.nuspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<copyright>Copyright © SiteServer CMS</copyright>
1313
<tags>SiteServer CMS</tags>
1414
<releaseNotes>
15-
SiteServer CMS V6.12正式版
15+
SiteServer CMS V6.13正式版
1616
</releaseNotes>
1717
</metadata>
1818
</package>

SiteServer.BackgroundPages/Cms/PageContentAdd.cs

+1
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ public override void Submit_OnClick(object sender, EventArgs e)
253253
ChannelId = _channelInfo.Id,
254254
SiteId = SiteId,
255255
AddUserName = AuthRequest.AdminName,
256+
AdminId = AuthRequest.AdminId,
256257
LastEditDate = DateTime.Now,
257258
GroupNameCollection = ControlUtils.SelectedItemsValueToStringCollection(CblContentGroups.Items),
258259
Title = TbTitle.Text

SiteServer.CMS/DataCache/Content/ContentManager.ListCache.cs

+12-26
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using SiteServer.CMS.Core;
44
using SiteServer.CMS.DataCache.Core;
55
using SiteServer.CMS.Model;
6-
using SiteServer.CMS.Model.Enumerations;
76
using SiteServer.Utils;
87
using SiteServer.Utils.Enumerations;
98

@@ -43,41 +42,28 @@ public static List<int> GetContentIdList(int channelId, int adminId)
4342
}
4443
}
4544

46-
public static void Add(ChannelInfo channelInfo, ContentInfo contentInfo)
45+
public static void Set(ContentInfo contentInfo)
4746
{
48-
if (ETaxisTypeUtils.Equals(ETaxisType.OrderByTaxisDesc, channelInfo.Additional.DefaultTaxisType))
47+
var contentIdList = GetContentIdList(contentInfo.ChannelId, 0);
48+
if (!contentIdList.Contains(contentInfo.Id))
4949
{
50-
var contentIdList = GetContentIdList(channelInfo.Id, 0);
51-
contentIdList.Insert(0, contentInfo.Id);
52-
53-
contentIdList = GetContentIdList(channelInfo.Id, contentInfo.AdminId);
54-
contentIdList.Insert(0, contentInfo.Id);
50+
contentIdList.Add(contentInfo.Id);
5551
}
56-
else
52+
53+
contentIdList = GetContentIdList(contentInfo.ChannelId, contentInfo.AdminId);
54+
if (!contentIdList.Contains(contentInfo.Id))
5755
{
58-
Remove(channelInfo.Id);
56+
contentIdList.Add(contentInfo.Id);
5957
}
6058
}
61-
62-
public static bool IsChanged(ChannelInfo channelInfo, ContentInfo contentInfo1, ContentInfo contentInfo2)
63-
{
64-
if (contentInfo1.IsTop != contentInfo2.IsTop) return true;
65-
66-
var orderAttributeName =
67-
ETaxisTypeUtils.GetContentOrderAttributeName(
68-
ETaxisTypeUtils.GetEnumType(channelInfo.Additional.DefaultTaxisType));
69-
70-
return contentInfo1.Get(orderAttributeName) != contentInfo2.Get(orderAttributeName);
71-
}
7259
}
7360

7461
public static List<(int ChannelId, int ContentId)> GetChannelContentIdList(SiteInfo siteInfo, ChannelInfo channelInfo, int adminId, bool isAllContents, int offset, int limit)
7562
{
7663
var tableName = ChannelManager.GetTableName(siteInfo, channelInfo);
7764

7865
var channelContentIdList = new List<(int ChannelId, int ContentId)>();
79-
var list = ListCache.GetContentIdList(channelInfo.Id, adminId);
80-
foreach (var contentId in list)
66+
foreach (var contentId in ListCache.GetContentIdList(channelInfo.Id, adminId))
8167
{
8268
channelContentIdList.Add((channelInfo.Id, contentId));
8369
}
@@ -90,8 +76,7 @@ public static bool IsChanged(ChannelInfo channelInfo, ContentInfo contentInfo1,
9076
var channelTableName = ChannelManager.GetTableName(siteInfo, contentChannelInfo);
9177
if (!StringUtils.EqualsIgnoreCase(tableName, channelTableName)) continue;
9278

93-
list = ListCache.GetContentIdList(contentChannelId, adminId);
94-
foreach (var contentId in list)
79+
foreach (var contentId in ListCache.GetContentIdList(contentChannelId, adminId))
9580
{
9681
channelContentIdList.Add((contentChannelId, contentId));
9782
}
@@ -103,7 +88,7 @@ public static bool IsChanged(ChannelInfo channelInfo, ContentInfo contentInfo1,
10388
return channelContentIdList.Skip(offset).Take(limit).ToList();
10489
}
10590

106-
if (list.Count == offset)
91+
if (channelContentIdList.Count == offset)
10792
{
10893
var dict = ContentCache.GetContentDict(channelInfo.Id);
10994

@@ -112,6 +97,7 @@ public static bool IsChanged(ChannelInfo channelInfo, ContentInfo contentInfo1,
11297

11398
foreach (var contentInfo in pageContentInfoList)
11499
{
100+
ListCache.Set(contentInfo);
115101
dict[contentInfo.Id] = contentInfo;
116102
}
117103

SiteServer.CMS/DataCache/Content/ContentManager.cs

-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ public static void InsertCache(SiteInfo siteInfo, ChannelInfo channelInfo, Conte
3333
{
3434
if (contentInfo.SourceId == SourceManager.Preview) return;
3535

36-
ListCache.Add(channelInfo, contentInfo);
37-
3836
var dict = ContentCache.GetContentDict(contentInfo.ChannelId);
3937
dict[contentInfo.Id] = contentInfo;
4038

SiteServer.CMS/DataCache/SpecialManager.cs

+4
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ public static string GetSpecialDirectoryPath(SiteInfo siteInfo, string url)
188188
public static string GetSpecialUrl(SiteInfo siteInfo, string url)
189189
{
190190
var virtualPath = PageUtils.RemoveFileNameFromUrl(url);
191+
if (!PageUtils.IsVirtualUrl(virtualPath))
192+
{
193+
virtualPath = $"@/{StringUtils.TrimSlash(virtualPath)}";
194+
}
191195
return PageUtility.ParseNavigationUrl(siteInfo, virtualPath, false);
192196
}
193197

SiteServer.CMS/Provider/SitePermissionsDao.cs

+25
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ public class SitePermissionsDao : DataProviderBase
5151

5252
private const string SqlSelectAllByRoleName = "SELECT RoleName, SiteId, ChannelIdCollection, ChannelPermissions, WebsitePermissions FROM siteserver_SitePermissions WHERE RoleName = @RoleName ORDER BY SiteId DESC";
5353

54+
private const string SqlSelectAllByRoleNameAndSiteId = "SELECT RoleName, SiteId, ChannelIdCollection, ChannelPermissions, WebsitePermissions FROM siteserver_SitePermissions WHERE RoleName = @RoleName AND SiteId = @SiteId";
55+
5456
private const string SqlInsert = "INSERT INTO siteserver_SitePermissions (RoleName, SiteId, ChannelIdCollection, ChannelPermissions, WebsitePermissions) VALUES (@RoleName, @SiteId, @ChannelIdCollection, @ChannelPermissions, @WebsitePermissions)";
5557

5658
private const string SqlDelete = "DELETE FROM siteserver_SitePermissions WHERE RoleName = @RoleName";
@@ -109,6 +111,29 @@ public List<SitePermissionsInfo> GetSystemPermissionsInfoList(string roleName)
109111
return list;
110112
}
111113

114+
public SitePermissionsInfo GetSystemPermissionsInfo(string roleName, int siteId)
115+
{
116+
SitePermissionsInfo permissionsInfo = null;
117+
118+
var parameters = new IDataParameter[]
119+
{
120+
GetParameter(ParamRoleName, DataType.VarChar, 255, roleName),
121+
GetParameter(ParamSiteId, DataType.Integer, siteId)
122+
};
123+
124+
using (var rdr = ExecuteReader(SqlSelectAllByRoleNameAndSiteId, parameters))
125+
{
126+
if (rdr.Read())
127+
{
128+
var i = 0;
129+
permissionsInfo = new SitePermissionsInfo(GetString(rdr, i++), GetInt(rdr, i++), GetString(rdr, i++), GetString(rdr, i++), GetString(rdr, i));
130+
}
131+
rdr.Close();
132+
}
133+
134+
return permissionsInfo;
135+
}
136+
112137
public Dictionary<int, List<string>> GetWebsitePermissionSortedList(IEnumerable<string> roles)
113138
{
114139
var sortedList = new Dictionary<int, List<string>>();

SiteServer.CMS/StlParser/Model/ChannelIdContentId.cs

+24
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using System;
2+
using System.Collections.Generic;
3+
using SiteServer.Utils;
24

35
namespace SiteServer.CMS.StlParser.Model
46
{
@@ -7,5 +9,27 @@ public class MinContentInfo
79
public int Id { get; set; }
810

911
public int ChannelId { get; set; }
12+
13+
public static List<MinContentInfo> ParseMinContentInfoList(string channelContentIdsString)
14+
{
15+
var channelContentIds = new List<MinContentInfo>();
16+
if (!string.IsNullOrEmpty(channelContentIdsString))
17+
{
18+
foreach (var channelContentId in TranslateUtils.StringCollectionToStringList(channelContentIdsString))
19+
{
20+
var arr = channelContentId.Split('_');
21+
if (arr.Length == 2)
22+
{
23+
channelContentIds.Add(new MinContentInfo
24+
{
25+
ChannelId = TranslateUtils.ToInt(arr[0]),
26+
Id = TranslateUtils.ToInt(arr[1])
27+
});
28+
}
29+
}
30+
}
31+
32+
return channelContentIds;
33+
}
1034
}
1135
}

SiteServer.CMS/StlParser/Model/DynamicInfo.Func.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ public string GetScript(string apiUrl)
3636
var values = TranslateUtils.EncryptStringBySecretKey(TranslateUtils.JsonSerialize(this));
3737

3838
return $@"
39-
<div id=""{AjaxDivId}_loading"">{LoadingTemplate}</div>
40-
<div id=""{AjaxDivId}_success"" style=""display: none""></div>
41-
<div id=""{AjaxDivId}_failure"" style=""display: none""></div>
39+
<span id=""{AjaxDivId}_loading"">{LoadingTemplate}</span>
40+
<span id=""{AjaxDivId}_success"" style=""display: none""></span>
41+
<span id=""{AjaxDivId}_failure"" style=""display: none""></span>
4242
<script type=""text/javascript"" language=""javascript"">
4343
function stlDynamic{AjaxDivId}(page)
4444
{{

SiteServer.CMS/StlParser/StlElement/StlContent.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,14 @@ public static object Parse(PageInfo pageInfo, ContextInfo contextInfo)
120120
}
121121
else if (StringUtils.EqualsIgnoreCase(name, StartIndex))
122122
{
123-
isClearTags = true;
124123
startIndex = TranslateUtils.ToInt(value);
125124
}
126125
else if (StringUtils.EqualsIgnoreCase(name, Length))
127126
{
128-
isClearTags = true;
129127
length = TranslateUtils.ToInt(value);
130128
}
131129
else if (StringUtils.EqualsIgnoreCase(name, WordNum))
132130
{
133-
isClearTags = true;
134131
wordNum = TranslateUtils.ToInt(value);
135132
}
136133
else if (StringUtils.EqualsIgnoreCase(name, Ellipsis))
@@ -339,6 +336,10 @@ private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, stri
339336
{
340337
parsedContent = DateUtils.Format(contentInfo.LastEditDate, formatString);
341338
}
339+
else if (ContentAttribute.LastHitsDate.ToLower().Equals(type))
340+
{
341+
parsedContent = DateUtils.Format(contentInfo.LastHitsDate, formatString);
342+
}
342343
else if (BackgroundContentAttribute.ImageUrl.ToLower().Equals(type))
343344
{
344345
if (no == "all")

SiteServer.CMS/StlParser/StlElement/StlDynamic.cs

+19-26
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ internal static string Parse(PageInfo pageInfo, ContextInfo contextInfo)
7171
}
7272
}
7373

74-
string loading;
75-
string template;
76-
StlParserUtility.GetLoading(contextInfo.InnerHtml, out loading, out template);
74+
StlParserUtility.GetLoading(contextInfo.InnerHtml, out var loading, out var template);
7775
if (!string.IsNullOrEmpty(loading))
7876
{
7977
var innerBuilder = new StringBuilder(loading);
@@ -171,20 +169,18 @@ public static string ParseDynamicContent(DynamicInfo dynamicInfo, string templat
171169
var stlPageChannelsElementReplaceString = stlElement;
172170

173171
var pageChannelsElementParser = new StlPageChannels(stlPageChannelsElement, pageInfo, contextInfo);
174-
int totalNum;
175-
var pageCount = pageChannelsElementParser.GetPageCount(out totalNum);
172+
var pageCount = pageChannelsElementParser.GetPageCount(out var totalNum);
176173

177174
for (var currentPageIndex = 0; currentPageIndex < pageCount; currentPageIndex++)
178175
{
179-
if (currentPageIndex == pageIndex)
180-
{
181-
var pageHtml = pageChannelsElementParser.Parse(currentPageIndex, pageCount);
182-
contentBuilder.Replace(stlPageChannelsElementReplaceString, pageHtml);
176+
if (currentPageIndex != pageIndex) continue;
183177

184-
StlParserManager.ReplacePageElementsInDynamicPage(contentBuilder, pageInfo, stlElementList, currentPageIndex, pageCount, totalNum, false, dynamicInfo.AjaxDivId);
178+
var pageHtml = pageChannelsElementParser.Parse(currentPageIndex, pageCount);
179+
contentBuilder.Replace(stlPageChannelsElementReplaceString, pageHtml);
185180

186-
break;
187-
}
181+
StlParserManager.ReplacePageElementsInDynamicPage(contentBuilder, pageInfo, stlElementList, currentPageIndex, pageCount, totalNum, false, dynamicInfo.AjaxDivId);
182+
183+
break;
188184
}
189185
}
190186
//如果标签中存在<stl:pageSqlContents>
@@ -195,20 +191,18 @@ public static string ParseDynamicContent(DynamicInfo dynamicInfo, string templat
195191
var stlPageSqlContentsElementReplaceString = stlElement;
196192

197193
var pageSqlContentsElementParser = new StlPageSqlContents(stlPageSqlContentsElement, pageInfo, contextInfo);
198-
int totalNum;
199-
var pageCount = pageSqlContentsElementParser.GetPageCount(out totalNum);
194+
var pageCount = pageSqlContentsElementParser.GetPageCount(out var totalNum);
200195

201196
for (var currentPageIndex = 0; currentPageIndex < pageCount; currentPageIndex++)
202197
{
203-
if (currentPageIndex == pageIndex)
204-
{
205-
var pageHtml = pageSqlContentsElementParser.Parse(totalNum, currentPageIndex, pageCount, false);
206-
contentBuilder.Replace(stlPageSqlContentsElementReplaceString, pageHtml);
198+
if (currentPageIndex != pageIndex) continue;
207199

208-
StlParserManager.ReplacePageElementsInDynamicPage(contentBuilder, pageInfo, stlElementList, currentPageIndex, pageCount, totalNum, false, dynamicInfo.AjaxDivId);
200+
var pageHtml = pageSqlContentsElementParser.Parse(totalNum, currentPageIndex, pageCount, false);
201+
contentBuilder.Replace(stlPageSqlContentsElementReplaceString, pageHtml);
209202

210-
break;
211-
}
203+
StlParserManager.ReplacePageElementsInDynamicPage(contentBuilder, pageInfo, stlElementList, currentPageIndex, pageCount, totalNum, false, dynamicInfo.AjaxDivId);
204+
205+
break;
212206
}
213207
}
214208

@@ -220,12 +214,11 @@ public static string ParseDynamicContent(DynamicInfo dynamicInfo, string templat
220214

221215
for (var currentPageIndex = 0; currentPageIndex < pageCount; currentPageIndex++)
222216
{
223-
if (currentPageIndex == pageIndex)
224-
{
225-
StlParserManager.ReplacePageElementsInDynamicPage(contentBuilder, pageInfo, stlElementList, currentPageIndex, pageCount, totalNum, false, pageContentsAjaxDivId);
217+
if (currentPageIndex != pageIndex) continue;
226218

227-
break;
228-
}
219+
StlParserManager.ReplacePageElementsInDynamicPage(contentBuilder, pageInfo, stlElementList, currentPageIndex, pageCount, totalNum, false, pageContentsAjaxDivId);
220+
221+
break;
229222
}
230223
}
231224

SiteServer.CMS/StlParser/StlElement/StlIf.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ internal static string Parse(PageInfo pageInfo, ContextInfo contextInfo)
129129
}
130130
else if (StringUtils.EqualsIgnoreCase(name, Value) || StringUtils.EqualsIgnoreCase(name, "testValue"))
131131
{
132-
testValue = value;
132+
testValue = StlEntityParser.ReplaceStlEntitiesForAttributeValue(value, pageInfo, contextInfo);
133133
if (string.IsNullOrEmpty(testOperate))
134134
{
135135
testOperate = OperateEquals;

SiteServer.CMS/StlParser/Utility/StlParserUtility.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public static bool IsStlEntityInclude(string content)
169169
{
170170
if (content == null) return false;
171171
content = content.ToLower();
172-
return StringUtils.Contains(content, "}") && (StringUtils.Contains(content, "{stl.") || StringUtils.Contains(content, "{content.") || StringUtils.Contains(content, "{channel."));
172+
return StringUtils.Contains(content, "}") && (StringUtils.Contains(content, "{stl:") || StringUtils.Contains(content, "{stl.") || StringUtils.Contains(content, "{content.") || StringUtils.Contains(content, "{channel."));
173173
}
174174

175175
public static bool IsSpecifiedStlElement(string stlElement, string elementName)

SiteServer.Utils/WebConfigUtils.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ public static string GetConnectionString(DatabaseType databaseType, string serve
353353
connectionString = $"Server={server};";
354354
if (!isDefaultPort && port > 0)
355355
{
356-
connectionString += $"Port={port};";
356+
connectionString = $"Server={server},{port};";
357357
}
358358
connectionString += $"Uid={userName};Pwd={password};";
359359
if (!string.IsNullOrEmpty(database))

SiteServer.Web/Controllers/Home/HomeContentsLayerCheckController.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public IHttpActionResult GetConfig()
5454
retVal.Add(dict);
5555
}
5656

57-
var isChecked = CheckManager.GetUserCheckLevel(request.AdminPermissionsImpl, siteInfo, siteId, out var checkedLevel);
57+
var isChecked = CheckManager.GetUserCheckLevel(request.AdminPermissionsImpl, siteInfo, channelId, out var checkedLevel);
5858
var checkedLevels = CheckManager.GetCheckedLevels(siteInfo, isChecked, checkedLevel, true);
5959

6060
var allChannels =

0 commit comments

Comments
 (0)