|
2 | 2 | using System.Collections;
|
3 | 3 | using System.Collections.Generic;
|
4 | 4 | using System.Collections.Specialized;
|
| 5 | +using System.Linq; |
5 | 6 | using System.Text;
|
6 | 7 | using Atom.Core;
|
7 | 8 | using SiteServer.Utils;
|
8 | 9 | using SiteServer.CMS.Core;
|
| 10 | +using SiteServer.CMS.Core.Create; |
9 | 11 | using SiteServer.CMS.Core.Office;
|
10 | 12 | using SiteServer.CMS.DataCache;
|
11 | 13 | using SiteServer.CMS.ImportExport.Components;
|
12 | 14 | using SiteServer.CMS.Model;
|
13 | 15 | using SiteServer.CMS.Model.Enumerations;
|
14 |
| -using SiteServer.CMS.Model.Attributes; |
15 | 16 |
|
16 | 17 | namespace SiteServer.CMS.ImportExport
|
17 | 18 | {
|
@@ -245,34 +246,34 @@ public void ImportChannelsAndContents(int parentId, string siteContentDirectoryP
|
245 | 246 | }
|
246 | 247 | }
|
247 | 248 |
|
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) |
249 | 250 | {
|
250 | 251 | var siteContentDirectoryPath = PathUtils.GetTemporaryFilesPath("contents");
|
251 | 252 | DirectoryUtils.DeleteDirectoryIfExists(siteContentDirectoryPath);
|
252 | 253 | DirectoryUtils.CreateDirectoryIfNotExists(siteContentDirectoryPath);
|
253 | 254 |
|
254 | 255 | ZipUtils.ExtractZip(zipFilePath, siteContentDirectoryPath);
|
255 | 256 |
|
256 |
| - var tableName = ChannelManager.GetTableName(_siteInfo, nodeInfo); |
| 257 | + var tableName = ChannelManager.GetTableName(_siteInfo, channelInfo); |
257 | 258 |
|
258 |
| - var taxis = DataProvider.ContentDao.GetMaxTaxis(tableName, nodeInfo.Id, false); |
| 259 | + var taxis = DataProvider.ContentDao.GetMaxTaxis(tableName, channelInfo.Id, false); |
259 | 260 |
|
260 |
| - ImportContents(nodeInfo, siteContentDirectoryPath, isOverride, taxis, importStart, importCount, isChecked, checkedLevel); |
| 261 | + ImportContents(channelInfo, siteContentDirectoryPath, isOverride, taxis, importStart, importCount, isChecked, checkedLevel); |
261 | 262 | }
|
262 | 263 |
|
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) |
264 | 265 | {
|
265 | 266 | var siteContentDirectoryPath = PathUtils.GetTemporaryFilesPath("contents");
|
266 | 267 | DirectoryUtils.DeleteDirectoryIfExists(siteContentDirectoryPath);
|
267 | 268 | DirectoryUtils.CreateDirectoryIfNotExists(siteContentDirectoryPath);
|
268 | 269 |
|
269 | 270 | ZipUtils.ExtractZip(zipFilePath, siteContentDirectoryPath);
|
270 | 271 |
|
271 |
| - var tableName = ChannelManager.GetTableName(_siteInfo, nodeInfo); |
| 272 | + var tableName = ChannelManager.GetTableName(_siteInfo, channelInfo); |
272 | 273 |
|
273 |
| - var taxis = DataProvider.ContentDao.GetMaxTaxis(tableName, nodeInfo.Id, false); |
| 274 | + var taxis = DataProvider.ContentDao.GetMaxTaxis(tableName, channelInfo.Id, false); |
274 | 275 |
|
275 |
| - ImportContents(nodeInfo, siteContentDirectoryPath, isOverride, taxis, isChecked, checkedLevel, adminId, userId, sourceId); |
| 276 | + return ImportContents(channelInfo, siteContentDirectoryPath, isOverride, taxis, isChecked, checkedLevel, adminId, userId, sourceId); |
276 | 277 | }
|
277 | 278 |
|
278 | 279 | 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
|
413 | 414 | }
|
414 | 415 | }
|
415 | 416 |
|
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) |
417 | 418 | {
|
418 | 419 | var contentInfoList = ExcelObject.GetContentsByCsvFile(csvFilePath, _siteInfo, channelInfo);
|
419 | 420 | contentInfoList.Reverse();
|
@@ -454,6 +455,8 @@ public void ImportContentsByCsvFile(ChannelInfo channelInfo, string csvFilePath,
|
454 | 455 | contentInfo.Id = DataProvider.ContentDao.Insert(tableName, _siteInfo, channelInfo, contentInfo);
|
455 | 456 | }
|
456 | 457 | }
|
| 458 | + |
| 459 | + return contentInfoList.Select(x => x.Id).ToList(); |
457 | 460 | }
|
458 | 461 |
|
459 | 462 | 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
|
535 | 538 | }
|
536 | 539 | }
|
537 | 540 |
|
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) |
539 | 542 | {
|
540 | 543 | var tableName = ChannelManager.GetTableName(_siteInfo, channelInfo);
|
541 | 544 |
|
@@ -574,32 +577,39 @@ public void ImportContentsByTxtFile(ChannelInfo channelInfo, string txtFilePath,
|
574 | 577 | {
|
575 | 578 | contentInfo.Id = DataProvider.ContentDao.Insert(tableName, _siteInfo, channelInfo, contentInfo);
|
576 | 579 | }
|
| 580 | + |
| 581 | + return new List<int> |
| 582 | + { |
| 583 | + contentInfo.Id |
| 584 | + }; |
577 | 585 | }
|
578 | 586 |
|
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) |
580 | 588 | {
|
581 | 589 | var filePath = PathUtils.Combine(siteContentDirectoryPath, "contents.xml");
|
582 | 590 |
|
583 | 591 | var contentIe = new ContentIe(_siteInfo, siteContentDirectoryPath);
|
584 | 592 |
|
585 |
| - contentIe.ImportContents(filePath, isOverride, nodeInfo, taxis, importStart, importCount, isChecked, checkedLevel, _adminName); |
| 593 | + contentIe.ImportContents(filePath, isOverride, channelInfo, taxis, importStart, importCount, isChecked, checkedLevel, _adminName); |
586 | 594 |
|
587 | 595 | FileUtils.DeleteFileIfExists(filePath);
|
588 | 596 |
|
589 | 597 | DirectoryUtils.MoveDirectory(siteContentDirectoryPath, _sitePath, isOverride);
|
590 | 598 | }
|
591 | 599 |
|
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) |
593 | 601 | {
|
594 | 602 | var filePath = PathUtils.Combine(siteContentDirectoryPath, "contents.xml");
|
595 | 603 |
|
596 | 604 | var contentIe = new ContentIe(_siteInfo, siteContentDirectoryPath);
|
597 | 605 |
|
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); |
599 | 607 |
|
600 | 608 | FileUtils.DeleteFileIfExists(filePath);
|
601 | 609 |
|
602 | 610 | DirectoryUtils.MoveDirectory(siteContentDirectoryPath, _sitePath, isOverride);
|
| 611 | + |
| 612 | + return contentIdList; |
603 | 613 | }
|
604 | 614 |
|
605 | 615 | //public void ImportInputContentsByCsvFile(InputInfo inputInfo, string excelFilePath, int importStart, int importCount, bool isChecked)
|
|
0 commit comments