Skip to content

Commit 32a4793

Browse files
committed
bugfix:2092,1992,2035,2095
1 parent 9ff8126 commit 32a4793

File tree

12 files changed

+75
-40
lines changed

12 files changed

+75
-40
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ SiteServer CMS 基于.NET 平台,能够以最低的成本、最少的人力投
1515

1616
## 迭代计划
1717

18+
[2019 年 7 月/8 月迭代计划](https://mp.weixin.qq.com/s/c-khP44sahCG1phjl8ZHeg)
19+
1820
[2019 年 5 月/6 月迭代计划](https://github.com/siteserver/cms/issues/1879)
1921

2022
[2019 年 3 月/4 月迭代计划](https://github.com/siteserver/cms/issues/1790)

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.10正式版
15+
SiteServer CMS V6.12正式版
1616
</releaseNotes>
1717
</metadata>
1818
</package>

SiteServer.BackgroundPages/Cms/PageContentSearch.cs

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
using SiteServer.CMS.Model.Enumerations;
1515
using SiteServer.CMS.Plugin;
1616
using SiteServer.Plugin;
17-
using SiteServer.Utils.Enumerations;
1817

1918
namespace SiteServer.BackgroundPages.Cms
2019
{

SiteServer.CMS/Core/ContentUtility.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ public static string TextEditorContentDecode(SiteInfo siteInfo, string content,
6868
assetsUrl = siteInfo.Additional.AssetsUrl;
6969
}
7070
StringUtils.ReplaceHrefOrSrc(builder, virtualAssetsUrl, assetsUrl);
71-
StringUtils.ReplaceHrefOrSrc(builder, "@/", siteInfo.Additional.WebUrl);
72-
StringUtils.ReplaceHrefOrSrc(builder, "@", siteInfo.Additional.WebUrl);
71+
StringUtils.ReplaceHrefOrSrc(builder, "@/", siteInfo.Additional.WebUrl + "/");
72+
StringUtils.ReplaceHrefOrSrc(builder, "@", siteInfo.Additional.WebUrl + "/");
7373

7474
builder.Replace("&#xa0;", "&nbsp;");
7575

SiteServer.CMS/ImportExport/Components/ContentIe.cs

+18-9
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,29 @@ public ContentIe(SiteInfo siteInfo, string siteContentDirectoryPath)
2424
_siteInfo = siteInfo;
2525
}
2626

27-
public void ImportContents(string filePath, bool isOverride, ChannelInfo nodeInfo, int taxis, int importStart, int importCount, bool isChecked, int checkedLevel, string adminName)
27+
public void ImportContents(string filePath, bool isOverride, ChannelInfo channelInfo, int taxis, int importStart, int importCount, bool isChecked, int checkedLevel, string adminName)
2828
{
2929
if (!FileUtils.IsFileExists(filePath)) return;
3030
var feed = AtomFeed.Load(FileUtils.GetFileStreamReadOnly(filePath));
3131

32-
ImportContents(feed.Entries, nodeInfo, taxis, importStart, importCount, false, isChecked, checkedLevel, isOverride, adminName);
32+
ImportContents(feed.Entries, channelInfo, taxis, importStart, importCount, false, isChecked, checkedLevel, isOverride, adminName);
3333
}
3434

35-
public void ImportContents(string filePath, bool isOverride, ChannelInfo nodeInfo, int taxis, bool isChecked, int checkedLevel, int adminId, int userId, int sourceId)
35+
public List<int> ImportContents(string filePath, bool isOverride, ChannelInfo channelInfo, int taxis, bool isChecked, int checkedLevel, int adminId, int userId, int sourceId)
3636
{
37-
if (!FileUtils.IsFileExists(filePath)) return;
37+
if (!FileUtils.IsFileExists(filePath)) return null;
3838
var feed = AtomFeed.Load(FileUtils.GetFileStreamReadOnly(filePath));
3939

40-
ImportContents(feed.Entries, nodeInfo, taxis, false, isChecked, checkedLevel, isOverride, adminId, userId, sourceId);
40+
return ImportContents(feed.Entries, channelInfo, taxis, false, isChecked, checkedLevel, isOverride, adminId, userId, sourceId);
4141
}
4242

43-
public void ImportContents(AtomEntryCollection entries, ChannelInfo channelInfo, int taxis, bool isOverride, string adminName)
43+
public List<int> ImportContents(AtomEntryCollection entries, ChannelInfo channelInfo, int taxis, bool isOverride, string adminName)
4444
{
45-
ImportContents(entries, channelInfo, taxis, 0, 0, true, true, 0, isOverride, adminName);
45+
return ImportContents(entries, channelInfo, taxis, 0, 0, true, true, 0, isOverride, adminName);
4646
}
4747

4848
// 内部消化掉错误
49-
private void ImportContents(AtomEntryCollection entries, ChannelInfo channelInfo, int taxis, int importStart, int importCount, bool isCheckedBySettings, bool isChecked, int checkedLevel, bool isOverride, string adminName)
49+
private List<int> ImportContents(AtomEntryCollection entries, ChannelInfo channelInfo, int taxis, int importStart, int importCount, bool isCheckedBySettings, bool isChecked, int checkedLevel, bool isOverride, string adminName)
5050
{
5151
if (importStart > 1 || importCount > 0)
5252
{
@@ -82,6 +82,7 @@ private void ImportContents(AtomEntryCollection entries, ChannelInfo channelInfo
8282
}
8383

8484
var tableName = ChannelManager.GetTableName(_siteInfo, channelInfo);
85+
var contentIdList = new List<int>();
8586

8687
foreach (AtomEntry entry in entries)
8788
{
@@ -179,6 +180,7 @@ private void ImportContents(AtomEntryCollection entries, ChannelInfo channelInfo
179180
if (isInsert)
180181
{
181182
var contentId = DataProvider.ContentDao.InsertWithTaxis(tableName, _siteInfo, channelInfo, contentInfo, taxis);
183+
contentIdList.Add(contentId);
182184

183185
TagUtils.UpdateTags(string.Empty, tags, _siteInfo.Id, contentId);
184186
}
@@ -193,11 +195,14 @@ private void ImportContents(AtomEntryCollection entries, ChannelInfo channelInfo
193195
// ignored
194196
}
195197
}
198+
199+
return contentIdList;
196200
}
197201

198-
private void ImportContents(AtomEntryCollection entries, ChannelInfo channelInfo, int taxis, bool isCheckedBySettings, bool isChecked, int checkedLevel, bool isOverride, int adminId, int userId, int sourceId)
202+
private List<int> ImportContents(AtomEntryCollection entries, ChannelInfo channelInfo, int taxis, bool isCheckedBySettings, bool isChecked, int checkedLevel, bool isOverride, int adminId, int userId, int sourceId)
199203
{
200204
var tableName = ChannelManager.GetTableName(_siteInfo, channelInfo);
205+
var contentIdList = new List<int>();
201206

202207
foreach (AtomEntry entry in entries)
203208
{
@@ -298,6 +303,8 @@ private void ImportContents(AtomEntryCollection entries, ChannelInfo channelInfo
298303
{
299304
var contentId = DataProvider.ContentDao.InsertWithTaxis(tableName, _siteInfo, channelInfo, contentInfo, taxis);
300305

306+
contentIdList.Add(contentId);
307+
301308
TagUtils.UpdateTags(string.Empty, tags, _siteInfo.Id, contentId);
302309
}
303310

@@ -311,6 +318,8 @@ private void ImportContents(AtomEntryCollection entries, ChannelInfo channelInfo
311318
// ignored
312319
}
313320
}
321+
322+
return contentIdList;
314323
}
315324

316325
public bool ExportContents(SiteInfo siteInfo, int channelId, List<int> contentIdList, bool isPeriods, string dateFrom, string dateTo, ETriState checkedState)

SiteServer.CMS/ImportExport/ImportObject.cs

+25-15
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22
using System.Collections;
33
using System.Collections.Generic;
44
using System.Collections.Specialized;
5+
using System.Linq;
56
using System.Text;
67
using Atom.Core;
78
using SiteServer.Utils;
89
using SiteServer.CMS.Core;
10+
using SiteServer.CMS.Core.Create;
911
using SiteServer.CMS.Core.Office;
1012
using SiteServer.CMS.DataCache;
1113
using SiteServer.CMS.ImportExport.Components;
1214
using SiteServer.CMS.Model;
1315
using SiteServer.CMS.Model.Enumerations;
14-
using SiteServer.CMS.Model.Attributes;
1516

1617
namespace SiteServer.CMS.ImportExport
1718
{
@@ -245,34 +246,34 @@ public void ImportChannelsAndContents(int parentId, string siteContentDirectoryP
245246
}
246247
}
247248

248-
public void ImportContentsByZipFile(ChannelInfo nodeInfo, string zipFilePath, bool isOverride, int importStart, int importCount, bool isChecked, int checkedLevel)
249+
public void ImportContentsByZipFile(ChannelInfo channelInfo, string zipFilePath, bool isOverride, int importStart, int importCount, bool isChecked, int checkedLevel)
249250
{
250251
var siteContentDirectoryPath = PathUtils.GetTemporaryFilesPath("contents");
251252
DirectoryUtils.DeleteDirectoryIfExists(siteContentDirectoryPath);
252253
DirectoryUtils.CreateDirectoryIfNotExists(siteContentDirectoryPath);
253254

254255
ZipUtils.ExtractZip(zipFilePath, siteContentDirectoryPath);
255256

256-
var tableName = ChannelManager.GetTableName(_siteInfo, nodeInfo);
257+
var tableName = ChannelManager.GetTableName(_siteInfo, channelInfo);
257258

258-
var taxis = DataProvider.ContentDao.GetMaxTaxis(tableName, nodeInfo.Id, false);
259+
var taxis = DataProvider.ContentDao.GetMaxTaxis(tableName, channelInfo.Id, false);
259260

260-
ImportContents(nodeInfo, siteContentDirectoryPath, isOverride, taxis, importStart, importCount, isChecked, checkedLevel);
261+
ImportContents(channelInfo, siteContentDirectoryPath, isOverride, taxis, importStart, importCount, isChecked, checkedLevel);
261262
}
262263

263-
public void ImportContentsByZipFile(ChannelInfo nodeInfo, string zipFilePath, bool isOverride, bool isChecked, int checkedLevel, int adminId, int userId, int sourceId)
264+
public List<int> ImportContentsByZipFile(ChannelInfo channelInfo, string zipFilePath, bool isOverride, bool isChecked, int checkedLevel, int adminId, int userId, int sourceId)
264265
{
265266
var siteContentDirectoryPath = PathUtils.GetTemporaryFilesPath("contents");
266267
DirectoryUtils.DeleteDirectoryIfExists(siteContentDirectoryPath);
267268
DirectoryUtils.CreateDirectoryIfNotExists(siteContentDirectoryPath);
268269

269270
ZipUtils.ExtractZip(zipFilePath, siteContentDirectoryPath);
270271

271-
var tableName = ChannelManager.GetTableName(_siteInfo, nodeInfo);
272+
var tableName = ChannelManager.GetTableName(_siteInfo, channelInfo);
272273

273-
var taxis = DataProvider.ContentDao.GetMaxTaxis(tableName, nodeInfo.Id, false);
274+
var taxis = DataProvider.ContentDao.GetMaxTaxis(tableName, channelInfo.Id, false);
274275

275-
ImportContents(nodeInfo, siteContentDirectoryPath, isOverride, taxis, isChecked, checkedLevel, adminId, userId, sourceId);
276+
return ImportContents(channelInfo, siteContentDirectoryPath, isOverride, taxis, isChecked, checkedLevel, adminId, userId, sourceId);
276277
}
277278

278279
public void ImportContentsByAccessFile(int channelId, string excelFilePath, bool isOverride, int importStart, int importCount, bool isChecked, int checkedLevel)
@@ -413,7 +414,7 @@ public void ImportContentsByCsvFile(int channelId, string csvFilePath, bool isOv
413414
}
414415
}
415416

416-
public void ImportContentsByCsvFile(ChannelInfo channelInfo, string csvFilePath, bool isOverride, bool isChecked, int checkedLevel, int adminId, int userId, int sourceId)
417+
public List<int> ImportContentsByCsvFile(ChannelInfo channelInfo, string csvFilePath, bool isOverride, bool isChecked, int checkedLevel, int adminId, int userId, int sourceId)
417418
{
418419
var contentInfoList = ExcelObject.GetContentsByCsvFile(csvFilePath, _siteInfo, channelInfo);
419420
contentInfoList.Reverse();
@@ -454,6 +455,8 @@ public void ImportContentsByCsvFile(ChannelInfo channelInfo, string csvFilePath,
454455
contentInfo.Id = DataProvider.ContentDao.Insert(tableName, _siteInfo, channelInfo, contentInfo);
455456
}
456457
}
458+
459+
return contentInfoList.Select(x => x.Id).ToList();
457460
}
458461

459462
public void ImportContentsByTxtZipFile(int channelId, string zipFilePath, bool isOverride, int importStart, int importCount, bool isChecked, int checkedLevel)
@@ -535,7 +538,7 @@ public void ImportContentsByTxtZipFile(int channelId, string zipFilePath, bool i
535538
}
536539
}
537540

538-
public void ImportContentsByTxtFile(ChannelInfo channelInfo, string txtFilePath, bool isOverride, bool isChecked, int checkedLevel, int adminId, int userId, int sourceId)
541+
public List<int> ImportContentsByTxtFile(ChannelInfo channelInfo, string txtFilePath, bool isOverride, bool isChecked, int checkedLevel, int adminId, int userId, int sourceId)
539542
{
540543
var tableName = ChannelManager.GetTableName(_siteInfo, channelInfo);
541544

@@ -574,32 +577,39 @@ public void ImportContentsByTxtFile(ChannelInfo channelInfo, string txtFilePath,
574577
{
575578
contentInfo.Id = DataProvider.ContentDao.Insert(tableName, _siteInfo, channelInfo, contentInfo);
576579
}
580+
581+
return new List<int>
582+
{
583+
contentInfo.Id
584+
};
577585
}
578586

579-
public void ImportContents(ChannelInfo nodeInfo, string siteContentDirectoryPath, bool isOverride, int taxis, int importStart, int importCount, bool isChecked, int checkedLevel)
587+
public void ImportContents(ChannelInfo channelInfo, string siteContentDirectoryPath, bool isOverride, int taxis, int importStart, int importCount, bool isChecked, int checkedLevel)
580588
{
581589
var filePath = PathUtils.Combine(siteContentDirectoryPath, "contents.xml");
582590

583591
var contentIe = new ContentIe(_siteInfo, siteContentDirectoryPath);
584592

585-
contentIe.ImportContents(filePath, isOverride, nodeInfo, taxis, importStart, importCount, isChecked, checkedLevel, _adminName);
593+
contentIe.ImportContents(filePath, isOverride, channelInfo, taxis, importStart, importCount, isChecked, checkedLevel, _adminName);
586594

587595
FileUtils.DeleteFileIfExists(filePath);
588596

589597
DirectoryUtils.MoveDirectory(siteContentDirectoryPath, _sitePath, isOverride);
590598
}
591599

592-
public void ImportContents(ChannelInfo nodeInfo, string siteContentDirectoryPath, bool isOverride, int taxis, bool isChecked, int checkedLevel, int adminId, int userId, int sourceId)
600+
public List<int> ImportContents(ChannelInfo channelInfo, string siteContentDirectoryPath, bool isOverride, int taxis, bool isChecked, int checkedLevel, int adminId, int userId, int sourceId)
593601
{
594602
var filePath = PathUtils.Combine(siteContentDirectoryPath, "contents.xml");
595603

596604
var contentIe = new ContentIe(_siteInfo, siteContentDirectoryPath);
597605

598-
contentIe.ImportContents(filePath, isOverride, nodeInfo, taxis, isChecked, checkedLevel, adminId, userId, sourceId);
606+
var contentIdList = contentIe.ImportContents(filePath, isOverride, channelInfo, taxis, isChecked, checkedLevel, adminId, userId, sourceId);
599607

600608
FileUtils.DeleteFileIfExists(filePath);
601609

602610
DirectoryUtils.MoveDirectory(siteContentDirectoryPath, _sitePath, isOverride);
611+
612+
return contentIdList;
603613
}
604614

605615
//public void ImportInputContentsByCsvFile(InputInfo inputInfo, string excelFilePath, int importStart, int importCount, bool isChecked)

SiteServer.CMS/Provider/ContentDao.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2501,7 +2501,9 @@ public string GetPagerWhereSqlString(SiteInfo siteInfo, ChannelInfo channelInfo,
25012501
}
25022502
else if (searchChannelIdList.Count == 1)
25032503
{
2504-
whereList.Add($"{nameof(ContentAttribute.ChannelId)} = {channelInfo.Id}");
2504+
whereList.Add(isTrashOnly
2505+
? $"{nameof(ContentAttribute.ChannelId)} = -{channelInfo.Id}"
2506+
: $"{nameof(ContentAttribute.ChannelId)} = {channelInfo.Id}");
25052507
}
25062508
else
25072509
{

SiteServer.CMS/Provider/DatabaseDao.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ public bool DropTable(string tableName)
929929
TableColumnManager.ClearCache();
930930
return true;
931931
}
932-
catch (Exception e)
932+
catch
933933
{
934934
return false;
935935
}

SiteServer.Web/.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,5 @@ test39/
6767
upload
6868
T_*.html
6969
index.html
70-
index.shtml
70+
index.shtml
71+
version.txt

SiteServer.Web/Controllers/Pages/Cms/PagesContentsLayerExportController.cs

+7-3
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ public IHttpActionResult Submit()
9999
var pluginColumns = PluginContentManager.GetContentColumns(pluginIds);
100100

101101
var contentInfoList = new List<ContentInfo>();
102+
var calculatedContentInfoList = new List<ContentInfo>();
103+
102104
if (contentIds.Count == 0)
103105
{
104106
var count = ContentManager.GetCount(siteInfo, channelInfo, onlyAdminId);
@@ -142,7 +144,8 @@ public IHttpActionResult Submit()
142144
}
143145
}
144146

145-
contentInfoList.Add(ContentManager.Calculate(sequence++, contentInfo, columns, pluginColumns));
147+
contentInfoList.Add(contentInfo);
148+
calculatedContentInfoList.Add(ContentManager.Calculate(sequence++, contentInfo, columns, pluginColumns));
146149
}
147150
}
148151
}
@@ -176,7 +179,8 @@ public IHttpActionResult Submit()
176179
}
177180
}
178181

179-
contentInfoList.Add(ContentManager.Calculate(sequence++, contentInfo, columns, pluginColumns));
182+
contentInfoList.Add(contentInfo);
183+
calculatedContentInfoList.Add(ContentManager.Calculate(sequence++, contentInfo, columns, pluginColumns));
180184
}
181185
}
182186

@@ -197,7 +201,7 @@ public IHttpActionResult Submit()
197201
{
198202
var fileName = $"{channelInfo.ChannelName}.csv";
199203
var filePath = PathUtils.GetTemporaryFilesPath(fileName);
200-
ExcelObject.CreateExcelFileForContents(filePath, siteInfo, channelInfo, contentInfoList, columnNames);
204+
ExcelObject.CreateExcelFileForContents(filePath, siteInfo, channelInfo, calculatedContentInfoList, columnNames);
201205
downloadUrl = PageUtils.GetTemporaryFilesUrl(fileName);
202206
}
203207
}

0 commit comments

Comments
 (0)