Merge pull request #6099 from sbwalker/dev
copy page should copy page settings
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Security;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Oqtane.Enums;
|
using Oqtane.Enums;
|
||||||
@@ -509,6 +508,20 @@ namespace Oqtane.Controllers
|
|||||||
var toPage = _pages.GetPage(toPageId);
|
var toPage = _pages.GetPage(toPageId);
|
||||||
if (toPage != null && toPage.SiteId == _alias.SiteId && _userPermissions.IsAuthorized(User, PermissionNames.View, toPage.PermissionList))
|
if (toPage != null && toPage.SiteId == _alias.SiteId && _userPermissions.IsAuthorized(User, PermissionNames.View, toPage.PermissionList))
|
||||||
{
|
{
|
||||||
|
// copy page settings
|
||||||
|
var settings = _settings.GetSettings(EntityNames.Page, fromPage.PageId).ToList();
|
||||||
|
foreach (var setting in settings)
|
||||||
|
{
|
||||||
|
_settings.AddSetting(new Setting
|
||||||
|
{
|
||||||
|
EntityName = setting.EntityName,
|
||||||
|
EntityId = toPage.PageId,
|
||||||
|
SettingName = setting.SettingName,
|
||||||
|
SettingValue = setting.SettingValue,
|
||||||
|
IsPrivate = setting.IsPrivate
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// copy modules
|
// copy modules
|
||||||
List<PageModule> pageModules = _pageModules.GetPageModules(fromPage.SiteId).ToList();
|
List<PageModule> pageModules = _pageModules.GetPageModules(fromPage.SiteId).ToList();
|
||||||
foreach (PageModule pm in pageModules.Where(item => item.PageId == fromPage.PageId && !item.Module.AllPages && !item.IsDeleted))
|
foreach (PageModule pm in pageModules.Where(item => item.PageId == fromPage.PageId && !item.Module.AllPages && !item.IsDeleted))
|
||||||
@@ -544,6 +557,8 @@ namespace Oqtane.Controllers
|
|||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
module = _modules.AddModule(module);
|
module = _modules.AddModule(module);
|
||||||
|
|
||||||
|
// copy module content (includes settings)
|
||||||
string content = _modules.ExportModule(pm.ModuleId);
|
string content = _modules.ExportModule(pm.ModuleId);
|
||||||
if (content != "")
|
if (content != "")
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user