本文整理汇总了C#中DotNetNuke.Entities.Tabs.TabController.CreateLocalizedCopies方法的典型用法代码示例。如果您正苦于以下问题:C# TabController.CreateLocalizedCopies方法的具体用法?C# TabController.CreateLocalizedCopies怎么用?C# TabController.CreateLocalizedCopies使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Entities.Tabs.TabController
的用法示例。
在下文中一共展示了TabController.CreateLocalizedCopies方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateTabFromParent
//.........这里部分代码省略.........
ContainerSrc = "",
CultureCode = Null.NullString
};
if (objRoot != null)
{
tab.IsVisible = objRoot.IsVisible;
tab.DisableLink = objRoot.DisableLink;
tab.SkinSrc = objRoot.SkinSrc;
tab.ContainerSrc = objRoot.ContainerSrc;
}
var portalSettings = PortalController.GetCurrentPortalSettings();
if (portalSettings.ContentLocalizationEnabled)
{
tab.CultureCode = LocaleController.Instance.GetDefaultLocale(tab.PortalID).Code;
}
var controller = new TabController();
var parentTab = controller.GetTab(parentId, -1, false);
if (parentTab != null)
{
tab.PortalID = parentTab.PortalID;
tab.ParentId = parentTab.TabID;
if (parentTab.IsSuperTab)
ShowPermissions(false);
}
else
{
//return Null.NullInteger;
tab.PortalID = PortalId;
tab.ParentId = Null.NullInteger;
}
tab.TabPath = Globals.GenerateTabPath(tab.ParentId, tab.TabName);
//Check for invalid
if (!IsValidTabName(tab.TabName))
{
return Null.NullInteger;
}
//Validate Tab Path
if (!IsValidTabPath(tab, tab.TabPath))
{
return Null.NullInteger;
}
//Inherit permissions from parent
tab.TabPermissions.Clear();
if (tab.PortalID != Null.NullInteger && objRoot != null)
{
tab.TabPermissions.AddRange(objRoot.TabPermissions);
}
else if (tab.PortalID != Null.NullInteger)
{
//Give admin full permission
ArrayList permissions = PermissionController.GetPermissionsByTab();
foreach (PermissionInfo permission in permissions)
{
var newTabPermission = new TabPermissionInfo
{
PermissionID = permission.PermissionID,
PermissionKey = permission.PermissionKey,
PermissionName = permission.PermissionName,
AllowAccess = true,
RoleID = PortalSettings.Current.AdministratorRoleId
};
tab.TabPermissions.Add(newTabPermission);
}
}
//Inherit other information from Parent
if (objRoot != null)
{
tab.Terms.Clear();
tab.StartDate = objRoot.StartDate;
tab.EndDate = objRoot.EndDate;
tab.RefreshInterval = objRoot.RefreshInterval;
tab.SiteMapPriority = objRoot.SiteMapPriority;
tab.PageHeadText = objRoot.PageHeadText;
tab.IsSecure = objRoot.IsSecure;
tab.PermanentRedirect = objRoot.PermanentRedirect;
}
var ctrl = new TabController();
tab.TabID = ctrl.AddTab(tab);
ApplyDefaultTabTemplate(tab);
//create localized tabs if content localization is enabled
if (portalSettings.ContentLocalizationEnabled)
{
ctrl.CreateLocalizedCopies(tab);
}
ShowSuccessMessage(string.Format(Localization.GetString("TabCreated", LocalResourceFile), tab.TabName));
return tab.TabID;
}
示例2: SaveTabData
//.........这里部分代码省略.........
}
if (!IsHostMenu && Tab.PortalID == Null.NullInteger)
{
//Portal Tab moved to Host so clear portal cache
objTabs.ClearCache(PortalId);
}
}
}
else
{
if (positionTabId == Null.NullInteger)
{
Tab.TabID = objTabs.AddTab(Tab);
}
else
{
if (rbInsertPosition.SelectedValue == "After" && positionTabId > Null.NullInteger)
{
Tab.TabID = objTabs.AddTabAfter(Tab, positionTabId);
}
else if (rbInsertPosition.SelectedValue == "Before" && positionTabId > Null.NullInteger)
{
Tab.TabID = objTabs.AddTabBefore(Tab, positionTabId);
}
else
{
Tab.TabID = objTabs.AddTab(Tab);
}
}
//Create Localized versions
if (PortalSettings.ContentLocalizationEnabled && cultureTypeList.SelectedValue == "Localized")
{
objTabs.CreateLocalizedCopies(Tab);
//Refresh tab
_tab = objTabs.GetTab(Tab.TabID, Tab.PortalID, true);
}
var copyTabId = cboCopyPage.Visible && cboCopyPage.SelectedItem != null ? cboCopyPage.SelectedItemValueAsInt : Null.NullInteger;
if (copyTabId != Null.NullInteger)
{
var objModules = new ModuleController();
ModuleInfo objModule;
CheckBox chkModule;
RadioButton optCopy;
RadioButton optReference;
TextBox txtCopyTitle;
foreach (DataGridItem objDataGridItem in grdModules.Items)
{
chkModule = (CheckBox)objDataGridItem.FindControl("chkModule");
if (chkModule.Checked)
{
var intModuleID = Convert.ToInt32(grdModules.DataKeys[objDataGridItem.ItemIndex]);
optCopy = (RadioButton)objDataGridItem.FindControl("optCopy");
optReference = (RadioButton)objDataGridItem.FindControl("optReference");
txtCopyTitle = (TextBox)objDataGridItem.FindControl("txtCopyTitle");
objModule = objModules.GetModule(intModuleID, copyTabId, false);
ModuleInfo newModule = null;
if ((objModule != null))
{
//Clone module as it exists in the cache and changes we make will update the cached object
newModule = objModule.Clone();
示例3: SaveTabData
//.........这里部分代码省略.........
objTabs.ClearCache(PortalId);
}
UpdateTabSettings(Tab.TabID);
}
// add or copy
}
else
{
if (positionTabID == Null.NullInteger)
{
Tab.TabID = objTabs.AddTab(Tab);
}
else
{
if (rbInsertPosition.SelectedValue == "After" && positionTabID > Null.NullInteger)
{
Tab.TabID = objTabs.AddTabAfter(Tab, positionTabID);
}
else if (rbInsertPosition.SelectedValue == "Before" && positionTabID > Null.NullInteger)
{
Tab.TabID = objTabs.AddTabBefore(Tab, positionTabID);
}
else
{
Tab.TabID = objTabs.AddTab(Tab);
}
}
UpdateTabSettings(Tab.TabID);
//Create Localized versions
if (PortalSettings.ContentLocalizationEnabled && cultureTypeList.SelectedValue == "Localized")
{
objTabs.CreateLocalizedCopies(Tab);
//Refresh tab
_tab = objTabs.GetTab(Tab.TabID, Tab.PortalID, true);
}
var copyTabId = Int32.Parse(cboCopyPage.SelectedItem.Value);
if (copyTabId != -1)
{
var objModules = new ModuleController();
ModuleInfo objModule;
CheckBox chkModule;
RadioButton optCopy;
RadioButton optReference;
TextBox txtCopyTitle;
foreach (DataGridItem objDataGridItem in grdModules.Items)
{
chkModule = (CheckBox)objDataGridItem.FindControl("chkModule");
if (chkModule.Checked)
{
var intModuleID = Convert.ToInt32(grdModules.DataKeys[objDataGridItem.ItemIndex]);
optCopy = (RadioButton)objDataGridItem.FindControl("optCopy");
optReference = (RadioButton)objDataGridItem.FindControl("optReference");
txtCopyTitle = (TextBox)objDataGridItem.FindControl("txtCopyTitle");
objModule = objModules.GetModule(intModuleID, copyTabId, false);
ModuleInfo newModule = null;
if ((objModule != null))
{
//Clone module as it exists in the cache and changes we make will update the cached object
newModule = objModule.Clone();
if (!optReference.Checked)
示例4: localizePagesButton_Click
protected void localizePagesButton_Click(object sender, EventArgs e)
{
var tabCtrl = new TabController();
tabCtrl.CreateLocalizedCopies(Tab);
//Redirect to refresh page (and skinobjects)
Response.Redirect(Request.RawUrl, true);
}
示例5: SaveTabInfoObject
//.........这里部分代码省略.........
if ((tab.TabPermissions.Count == 0 && tab.PortalID != Null.NullInteger))
{
//Give admin full permission
ArrayList permissions = PermissionController.GetPermissionsByTab();
foreach (PermissionInfo permission in permissions)
{
TabPermissionInfo newTabPermission = new TabPermissionInfo();
newTabPermission.PermissionID = permission.PermissionID;
newTabPermission.PermissionKey = permission.PermissionKey;
newTabPermission.PermissionName = permission.PermissionName;
newTabPermission.AllowAccess = true;
newTabPermission.RoleID = PortalSettings.Current.AdministratorRoleId;
tab.TabPermissions.Add(newTabPermission);
}
}
PortalSettings _PortalSettings = PortalController.GetCurrentPortalSettings();
if (_PortalSettings.ContentLocalizationEnabled)
{
Locale defaultLocale = LocaleController.Instance.GetDefaultLocale(tab.PortalID);
tab.CultureCode = defaultLocale.Code;
}
else
{
tab.CultureCode = Null.NullString;
}
if ((location == TabRelativeLocation.AFTER && (relativeToTab != null)))
{
tab.TabID = tabCtrl.AddTabAfter(tab, relativeToTab.TabID);
}
else if ((location == TabRelativeLocation.BEFORE && (relativeToTab != null)))
{
tab.TabID = tabCtrl.AddTabBefore(tab, relativeToTab.TabID);
}
else
{
tab.TabID = tabCtrl.AddTab(tab);
}
if (_PortalSettings.ContentLocalizationEnabled)
{
tabCtrl.CreateLocalizedCopies(tab);
}
tabCtrl.UpdateTabSetting(tab.TabID, "CacheProvider", "");
tabCtrl.UpdateTabSetting(tab.TabID, "CacheDuration", "");
tabCtrl.UpdateTabSetting(tab.TabID, "CacheIncludeExclude", "0");
tabCtrl.UpdateTabSetting(tab.TabID, "IncludeVaryBy", "");
tabCtrl.UpdateTabSetting(tab.TabID, "ExcludeVaryBy", "");
tabCtrl.UpdateTabSetting(tab.TabID, "MaxVaryByCount", "");
}
else
{
tabCtrl.UpdateTab(tab);
if ((location == TabRelativeLocation.AFTER && (relativeToTab != null)))
{
tabCtrl.MoveTabAfter(tab, relativeToTab.TabID);
}
else if ((location == TabRelativeLocation.BEFORE && (relativeToTab != null)))
{
tabCtrl.MoveTabBefore(tab, relativeToTab.TabID);
}
}
}
catch (Exception ex)
{
DnnLog.Error(ex);
if (ex.Message.StartsWith("Page Exists"))
{
throw new DotNetNukeException(ex.Message, DotNetNukeErrorCode.PageExists);
}
}
// create the page from a template
if ((!string.IsNullOrEmpty(templateMapPath)))
{
XmlDocument xmlDoc = new XmlDocument();
try
{
xmlDoc.Load(templateMapPath);
TabController.DeserializePanes(xmlDoc.SelectSingleNode("//portal/tabs/tab/panes"), tab.PortalID, tab.TabID, PortalTemplateModuleAction.Ignore, new Hashtable());
//save tab permissions
DeserializeTabPermissions(xmlDoc.SelectNodes("//portal/tabs/tab/tabpermissions/permission"), tab);
}
catch (Exception ex)
{
Exceptions.LogException(ex);
throw new DotNetNukeException("Unable to process page template.", ex, DotNetNukeErrorCode.DeserializePanesFailed);
}
}
//todo: reload tab from db or send back tabid instead?
return tab.TabID;
}