本文整理汇总了C#中DotNetNuke.Entities.Portals.PortalController.CopyPageTemplate方法的典型用法代码示例。如果您正苦于以下问题:C# PortalController.CopyPageTemplate方法的具体用法?C# PortalController.CopyPageTemplate怎么用?C# PortalController.CopyPageTemplate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Entities.Portals.PortalController
的用法示例。
在下文中一共展示了PortalController.CopyPageTemplate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpgradeToVersion530
private static void UpgradeToVersion530()
{
//update languages module
int moduleDefId = GetModuleDefinition("Languages", "Languages");
RemoveModuleControl(moduleDefId, "");
AddModuleControl(moduleDefId, "", "", "DesktopModules/Admin/Languages/languageEnabler.ascx", "~/images/icon_language_32px.gif", SecurityAccessLevel.View, 0, "", true);
AddModuleControl(moduleDefId, "Editor", "", "DesktopModules/Admin/Languages/languageeditor.ascx", "~/images/icon_language_32px.gif", SecurityAccessLevel.View, 0);
//Add new View Profile module
moduleDefId = AddModuleDefinition("ViewProfile", "", "ViewProfile", false, false);
AddModuleControl(moduleDefId, "", "", "DesktopModules/Admin/ViewProfile/ViewProfile.ascx", "~/images/icon_profile_32px.gif", SecurityAccessLevel.View, 0);
AddModuleControl(moduleDefId, "Settings", "Settings", "DesktopModules/Admin/ViewProfile/Settings.ascx", "~/images/icon_profile_32px.gif", SecurityAccessLevel.Edit, 0);
//Add new Sitemap settings module
moduleDefId = AddModuleDefinition("Sitemap", "", "Sitemap", false, false);
AddModuleControl(moduleDefId, "", "", "DesktopModules/Admin/Sitemap/SitemapSettings.ascx", "~/images/icon_analytics_32px.gif", SecurityAccessLevel.View, 0);
AddAdminPages("Search Engine Sitemap", "Configure the sitemap for submission to common search engines.", "~/images/icon_analytics_16px.gif", "~/images/icon_analytics_32px.gif", true, moduleDefId, "Search Engine Sitemap", "~/images/icon_analytics_32px.gif");
//Add new Photo Profile field to Host
var listController = new ListController();
Dictionary<string, ListEntryInfo> dataTypes = listController.GetListEntryInfoDictionary("DataType");
var properties = ProfileController.GetPropertyDefinitionsByPortal(Null.NullInteger);
ProfileController.AddDefaultDefinition(Null.NullInteger, "Preferences", "Photo", "Image", 0, properties.Count*2 + 2, UserVisibilityMode.AllUsers, dataTypes);
string installTemplateFile = string.Format("{0}Template\\UserProfile.page.template", Globals.InstallMapPath);
string hostTemplateFile = string.Format("{0}Templates\\UserProfile.page.template", Globals.HostMapPath);
if (File.Exists(installTemplateFile))
{
if (!File.Exists(hostTemplateFile))
{
File.Copy(installTemplateFile, hostTemplateFile);
}
}
if (File.Exists(hostTemplateFile))
{
var tabController = new TabController();
var portalController = new PortalController();
ArrayList portals = portalController.GetPortals();
foreach (PortalInfo portal in portals)
{
properties = ProfileController.GetPropertyDefinitionsByPortal(portal.PortalID);
//Add new Photo Profile field to Portal
ProfileController.AddDefaultDefinition(portal.PortalID, "Preferences", "Photo", "Image", 0, properties.Count*2 + 2, UserVisibilityMode.AllUsers, dataTypes);
//Rename old Default Page template
string defaultPageTemplatePath = string.Format("{0}Templates\\Default.page.template", portal.HomeDirectoryMapPath);
if (File.Exists(defaultPageTemplatePath))
{
File.Move(defaultPageTemplatePath, String.Format("{0}Templates\\Default_old.page.template", portal.HomeDirectoryMapPath));
}
//Update Default profile template in every portal
portalController.CopyPageTemplate("Default.page.template", portal.HomeDirectoryMapPath);
//Add User profile template to every portal
portalController.CopyPageTemplate("UserProfile.page.template", portal.HomeDirectoryMapPath);
//Synchronize the Templates folder to ensure the templates are accessible
FolderManager.Instance.Synchronize(portal.PortalID, "Templates/", false, true);
var xmlDoc = new XmlDocument();
try
{
// open the XML file
xmlDoc.Load(hostTemplateFile);
}
catch (Exception ex)
{
Exceptions.Exceptions.LogException(ex);
}
XmlNode userTabNode = xmlDoc.SelectSingleNode("//portal/tabs/tab");
if (userTabNode != null)
{
string tabName = XmlUtils.GetNodeValue(userTabNode.CreateNavigator(), "name");
var userTab = tabController.GetTabByName(tabName, portal.PortalID) ?? TabController.DeserializeTab(userTabNode, null, portal.PortalID, PortalTemplateModuleAction.Merge);
//Update SiteSettings to point to the new page
if (portal.UserTabId > Null.NullInteger)
{
portal.RegisterTabId = portal.UserTabId;
}
else
{
portal.UserTabId = userTab.TabID;
}
}
portalController.UpdatePortalInfo(portal);
//Add Users folder to every portal
string usersFolder = string.Format("{0}Users\\", portal.HomeDirectoryMapPath);
if (!Directory.Exists(usersFolder))
{
//Create Users folder
Directory.CreateDirectory(usersFolder);
//.........这里部分代码省略.........