本文整理汇总了C#中DotNetNuke.Entities.Tabs.TabController.GetTabByCulture方法的典型用法代码示例。如果您正苦于以下问题:C# TabController.GetTabByCulture方法的具体用法?C# TabController.GetTabByCulture怎么用?C# TabController.GetTabByCulture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Entities.Tabs.TabController
的用法示例。
在下文中一共展示了TabController.GetTabByCulture方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetHomePageTabIdForCulture
/// <summary>
/// Finds a culture-specific homepage tabid for a non-default language
/// </summary>
/// <param name="defaultCulture">The default culture of the portal</param>
/// <param name="cultureCode"></param>
/// <param name="defaultHomeTabId">The default home page tab id</param>
/// <param name="portalId"></param>
/// <returns>THe valid home page tabid for the portalid and culture</returns>
/// <remarks>Note if no specific home page found for the culture, will return defaultHomeTabId back</remarks>
internal static int GetHomePageTabIdForCulture(string defaultCulture, int portalId, string cultureCode,
int defaultHomeTabId)
{
int homeTabId = defaultHomeTabId;
if (String.Compare(defaultCulture, cultureCode, StringComparison.OrdinalIgnoreCase) != 0)
{
//not the default culture, so there could be a different home page for the different cultulre in 5.5+ builds
var tc = new TabController();
var cultureLocale = new Locale { Code = cultureCode, Fallback = cultureCode, Text = cultureCode };
TabInfo tab = tc.GetTabByCulture(defaultHomeTabId, portalId, cultureLocale);
if (tab != null)
{
//this is the culture specific tab of the home page
homeTabId = tab.TabID;
}
}
return homeTabId;
}
示例2: SaveTabData
//.........这里部分代码省略.........
//Set Culture Code
var positionTabID = Null.NullInteger;
if (cboPositionTab.SelectedItem != null)
{
positionTabID = Int32.Parse(cboPositionTab.SelectedItem.Value);
}
if (strAction != "edit")
{
if (PortalSettings.ContentLocalizationEnabled)
{
switch (cultureTypeList.SelectedValue)
{
case "Localized":
var defaultLocale = LocaleController.Instance.GetDefaultLocale(PortalId);
Tab.CultureCode = defaultLocale.Code;
break;
case "Culture":
Tab.CultureCode = PortalSettings.CultureCode;
break;
default:
Tab.CultureCode = Null.NullString;
break;
}
var tabLocale = LocaleController.Instance.GetLocale(Tab.CultureCode) ?? LocaleController.Instance.GetDefaultLocale(PortalId);
//Fix parent
if (Tab.ParentId > Null.NullInteger)
{
parentTab = objTabs.GetTab(Tab.ParentId, PortalId, false);
if (parentTab.CultureCode != Tab.CultureCode)
{
parentTab = objTabs.GetTabByCulture(Tab.ParentId, PortalId, tabLocale);
}
Tab.ParentId = parentTab.TabID;
}
//Fix position TabId
if (positionTabID > Null.NullInteger)
{
var positionTab = objTabs.GetTab(positionTabID, PortalId, false);
if (positionTab.CultureCode != Tab.CultureCode)
{
positionTab = objTabs.GetTabByCulture(positionTabID, PortalId, tabLocale);
}
positionTabID = positionTab.TabID;
}
}
else
{
Tab.CultureCode = Null.NullString;
}
}
//Validate Tab Path
if (string.IsNullOrEmpty(strAction))
{
var tabID = TabController.GetTabByTabPath(Tab.PortalID, Tab.TabPath, Tab.CultureCode);
if (tabID != Null.NullInteger)
{
var existingTab = objTabs.GetTab(tabID, PortalId, false);
if (existingTab != null && existingTab.IsDeleted)
{
UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("TabRecycled", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning);
示例3: SaveTabData
//.........这里部分代码省略.........
//Set Culture Code
var positionTabId = Null.NullInteger;
if (cboPositionTab.SelectedItem != null)
{
positionTabId = Int32.Parse(cboPositionTab.SelectedItem.Value);
}
if (strAction != "edit")
{
if (PortalSettings.ContentLocalizationEnabled)
{
switch (cultureTypeList.SelectedValue)
{
case "Localized":
var defaultLocale = LocaleController.Instance.GetDefaultLocale(PortalId);
Tab.CultureCode = defaultLocale.Code;
break;
case "Culture":
Tab.CultureCode = PortalSettings.CultureCode;
break;
default:
Tab.CultureCode = Null.NullString;
break;
}
var tabLocale = LocaleController.Instance.GetLocale(Tab.CultureCode) ?? LocaleController.Instance.GetDefaultLocale(PortalId);
//Fix parent
if (Tab.ParentId > Null.NullInteger)
{
parentTab = objTabs.GetTab(Tab.ParentId, PortalId, false);
if (parentTab.CultureCode != Tab.CultureCode)
{
parentTab = objTabs.GetTabByCulture(Tab.ParentId, PortalId, tabLocale);
}
if (parentTab != null)
{
Tab.ParentId = parentTab.TabID;
}
}
//Fix position TabId
if (positionTabId > Null.NullInteger)
{
var positionTab = objTabs.GetTab(positionTabId, PortalId, false);
if (positionTab.CultureCode != Tab.CultureCode)
{
positionTab = objTabs.GetTabByCulture(positionTabId, PortalId, tabLocale);
}
if (positionTab != null)
{
positionTabId = positionTab.TabID;
}
}
}
else
{
Tab.CultureCode = Null.NullString;
}
}
//Validate Tab Path
if (string.IsNullOrEmpty(strAction))
{
var tabID = TabController.GetTabByTabPath(Tab.PortalID, Tab.TabPath, Tab.CultureCode);
示例4: BindData
private void BindData(bool refresh)
{
if (refresh)
{
LoadData();
}
var tabController = new TabController();
modulesListBox.Items.Clear();
tabsListBox.Items.Clear();
foreach (ModuleInfo module in DeletedModules)
{
if (String.IsNullOrEmpty(module.ModuleTitle))
{
module.ModuleTitle = module.DesktopModule.FriendlyName;
}
var locale = LocaleController.Instance.GetLocale(module.CultureCode);
TabInfo tab = locale != null
? tabController.GetTabByCulture(module.TabID, PortalId, locale)
: tabController.GetTab(module.TabID, PortalId, false);
if (tab == null)
{
modulesListBox.Items.Add(new ListItem(module.ModuleTitle + " - " + module.LastModifiedOnDate, module.TabID + "-" + module.ModuleID));
}
else if (tab.TabID == module.TabID)
{
modulesListBox.Items.Add(new ListItem(tab.TabName + " - " + module.ModuleTitle + " - " + module.LastModifiedOnDate, module.TabID + "-" + module.ModuleID));
}
}
foreach (var tab in DeletedTabs)
{
var item = new ListItem(tab.IndentedTabName + " - " + tab.LastModifiedOnDate, tab.TabID.ToString());
item.Attributes.Add("ParentId", tab.ParentId.ToString());
tabsListBox.Items.Add(item);
}
cmdRestoreTab.Enabled = (DeletedTabs.Count > 0);
cmdDeleteTab.Enabled = (DeletedTabs.Count > 0);
cmdRestoreModule.Enabled = (modulesListBox.Items.Count > 0);
cmdDeleteModule.Enabled = (modulesListBox.Items.Count > 0);
cmdEmpty.Enabled = DeletedTabs.Count > 0 || modulesListBox.Items.Count > 0;
}
示例5: GetChildModules
private List<ModuleInfo> GetChildModules(int tabId, string cultureCode)
{
var modules = new List<ModuleInfo>();
var tabCtrl = new TabController();
Locale locale = LocaleController.Instance.GetLocale(cultureCode);
if (locale != null)
{
modules = (from kvp in tabCtrl.GetTabByCulture(tabId, PortalSettings.PortalId, locale).ChildModules where !kvp.Value.IsDeleted select kvp.Value).ToList();
}
return modules;
}
示例6: BindData
private void BindData(bool refresh)
{
if (refresh)
{
LoadData();
}
var tabController = new TabController();
modulesListBox.Items.Clear();
tabsListBox.Items.Clear();
foreach (ModuleInfo module in DeletedModules)
{
if (String.IsNullOrEmpty(module.ModuleTitle))
{
module.ModuleTitle = module.DesktopModule.FriendlyName;
}
var locale = LocaleController.Instance.GetLocale(module.CultureCode);
TabInfo tab = locale != null
? tabController.GetTabByCulture(module.TabID, PortalId, locale)
: tabController.GetTab(module.TabID, PortalId, false);
if (tab == null)
{
modulesListBox.Items.Add(new ListItem(module.ModuleTitle, module.TabID + "-" + module.ModuleID));
}
else if (tab.TabID == module.TabID)
{
modulesListBox.Items.Add(new ListItem(tab.TabName + " - " + module.ModuleTitle, module.TabID + "-" + module.ModuleID));
}
}
tabsListBox.DataSource = DeletedTabs;
tabsListBox.DataBind();
cmdRestoreTab.Enabled = (DeletedTabs.Count > 0);
cmdDeleteTab.Enabled = (DeletedTabs.Count > 0);
cmdRestoreModule.Enabled = (modulesListBox.Items.Count > 0);
cmdDeleteModule.Enabled = (modulesListBox.Items.Count > 0);
cmdEmpty.Enabled = DeletedTabs.Count > 0 || modulesListBox.Items.Count > 0;
}
示例7: MapLocalizedSpecialPages
/// <summary>
/// Remaps the Special Pages such as Home, Profile, Search
/// to their localized versions
/// </summary>
/// <remarks>
/// </remarks>
public void MapLocalizedSpecialPages(int portalId, string cultureCode)
{
TabController tabCont = new TabController();
DataCache.ClearHostCache(true);
DataProvider.Instance().EnsureLocalizationExists(portalId, cultureCode);
PortalInfo defaultPortal = GetPortal(portalId, GetPortalDefaultLanguage(portalId));
PortalInfo targetPortal = GetPortal(portalId, cultureCode);
Locale targetLocale = LocaleController.Instance.GetLocale(cultureCode);
TabInfo tempTab;
if ((defaultPortal.HomeTabId != Null.NullInteger))
{
tempTab = tabCont.GetTabByCulture(defaultPortal.HomeTabId, portalId, targetLocale);
if (tempTab != null)
{
targetPortal.HomeTabId = tempTab.TabID;
}
}
if ((defaultPortal.LoginTabId != Null.NullInteger))
{
tempTab = tabCont.GetTabByCulture(defaultPortal.LoginTabId, portalId, targetLocale);
if (tempTab != null)
{
targetPortal.LoginTabId = tempTab.TabID;
}
}
if ((defaultPortal.RegisterTabId != Null.NullInteger))
{
tempTab = tabCont.GetTabByCulture(defaultPortal.RegisterTabId, portalId, targetLocale);
if (tempTab != null)
{
targetPortal.RegisterTabId = tempTab.TabID;
}
}
if ((defaultPortal.SplashTabId != Null.NullInteger))
{
tempTab = tabCont.GetTabByCulture(defaultPortal.SplashTabId, portalId, targetLocale);
if (tempTab != null)
{
targetPortal.SplashTabId = tempTab.TabID;
}
}
if ((defaultPortal.UserTabId != Null.NullInteger))
{
tempTab = tabCont.GetTabByCulture(defaultPortal.UserTabId, portalId, targetLocale);
if (tempTab != null)
{
targetPortal.UserTabId = tempTab.TabID;
}
}
if ((defaultPortal.SearchTabId != Null.NullInteger))
{
tempTab = tabCont.GetTabByCulture(defaultPortal.SearchTabId, portalId, targetLocale);
if (tempTab != null)
{
targetPortal.SearchTabId = tempTab.TabID;
}
}
UpdatePortalInfo(targetPortal, false);
}
示例8: ResolvePageLink
private string ResolvePageLink(int id, string defaultValue)
{
var tabController = new TabController();
// 2016-03-03 before issue #710
//var tabInfo = tabController.GetTab(linkId);
//if (tabInfo == null)
// return defaultValue;
//return tabInfo.TabPath;
//ownerPortalSettings = SxcInstance.
var tabInfo = tabController.GetTab(id);
if (tabInfo == null) return defaultValue;
var portalSettings = PortalSettings.Current;
// Get full PortalSettings (with portal alias) if module sharing is active
if (PortalSettings.Current != null && PortalSettings.Current.PortalId != tabInfo.PortalID)
//{
portalSettings = new PortalSettings(tabInfo.PortalID);
//var portalAlias = ownerPortalSettings.PrimaryAlias ?? TestablePortalAliasController.Instance.GetPortalAliasesByPortalId(tabInfo.PortalID).First();
//portalSettings = new PortalSettings(id, portalAlias);
//}
if(portalSettings == null) return defaultValue;
// var tabInfo = tabController.GetTab(id, portalSettings.PortalId, false);
// if (tabInfo == null) return defaultValue;
if (tabInfo.CultureCode != "" && tabInfo.CultureCode != PortalSettings.Current.CultureCode)
{
var cultureTabInfo = tabController.GetTabByCulture(tabInfo.TabID, tabInfo.PortalID, LocaleController.Instance.GetLocale(PortalSettings.Current.CultureCode));
if (cultureTabInfo != null)
tabInfo = cultureTabInfo;
}
// Exception in AdvancedURLProvider because ownerPortalSettings.PortalAlias is null
return Globals.NavigateURL(tabInfo.TabID, portalSettings, "", new string[] {});// + urlParams;
}
示例9: BindData
/// <summary>
/// Loads deleted tabs and modules into the lists
/// </summary>
/// <remarks>
/// </remarks>
/// <history>
/// [VMasanas] 18/08/2004
/// [VMasanas] 20/08/2004 Update display information for deleted modules to:
/// ModuleFriendlyName: ModuleTitle - Tab: TabName
/// </history>
private void BindData()
{
var objModules = new ModuleController();
var objTabs = new TabController();
TabInfo objTab;
ModuleInfo objModule;
int intModule;
lstModules.Items.Clear();
lstTabs.Items.Clear();
var currentLocale = LocaleController.Instance.GetCurrentLocale(PortalId);
var arrDeletedTabs = new ArrayList();
TabCollection tabsList;
if (modeButtonList.SelectedValue == "ALL")
{
tabsList = objTabs.GetTabsByPortal(PortalId);
}
else
{
tabsList = objTabs.GetTabsByPortal(PortalId).WithCulture(currentLocale.Code, true);
}
foreach (var tab in tabsList.Values)
{
if (tab.IsDeleted)
{
arrDeletedTabs.Add(tab);
}
}
var arrModules = objModules.GetModules(PortalId);
for (intModule = 0; intModule <= arrModules.Count - 1; intModule++)
{
objModule = (ModuleInfo) arrModules[intModule];
if (objModule.IsDeleted && (modeButtonList.SelectedValue == "ALL" || objModule.CultureCode == currentLocale.Code))
{
if (String.IsNullOrEmpty(objModule.ModuleTitle))
{
objModule.ModuleTitle = objModule.DesktopModule.FriendlyName;
}
var locale = LocaleController.Instance.GetLocale(objModule.CultureCode);
if (locale != null)
{
objTab = objTabs.GetTabByCulture(objModule.TabID, PortalId, locale);
}
else
{
objTab = objTabs.GetTab(objModule.TabID, PortalId, false);
}
if (objTab == null)
{
lstModules.Items.Add(new ListItem(objModule.ModuleTitle, objModule.TabID + "-" + objModule.ModuleID));
}
else if (objTab.TabID == objModule.TabID)
{
lstModules.Items.Add(new ListItem(objTab.TabName + " - " + objModule.ModuleTitle, objModule.TabID + "-" + objModule.ModuleID));
}
}
}
lstTabs.DataSource = arrDeletedTabs;
lstTabs.DataBind();
cmdRestoreTab.Enabled = (arrDeletedTabs.Count > 0);
cmdDeleteTab.Enabled = (arrDeletedTabs.Count > 0);
cmdRestoreModule.Enabled = (lstModules.Items.Count > 0);
cmdDeleteModule.Enabled = (lstModules.Items.Count > 0);
cmdEmpty.Enabled = arrDeletedTabs.Count > 0 || lstModules.Items.Count > 0;
}
示例10: ResolveHyperlinkValues
/// <summary>
/// Resolves File and Page values
/// For example, File:123 or Page:123
/// </summary>
public static string ResolveHyperlinkValues(string value, PortalSettings ownerPortalSettings)
{
var resultString = value;
var regularExpression = Regex.Match(resultString, @"^(?<type>(file|page)):(?<id>[0-9]+)(?<params>(\?|\#).*)?$", RegexOptions.IgnoreCase);
if (!regularExpression.Success)
return value;
var fileManager = FileManager.Instance;
var tabController = new TabController();
var type = regularExpression.Groups["type"].Value.ToLower();
var id = int.Parse(regularExpression.Groups["id"].Value);
var urlParams = regularExpression.Groups["params"].Value ?? "";
switch (type)
{
case "file":
var fileInfo = fileManager.GetFile(id);
if (fileInfo != null)
resultString = (fileInfo.StorageLocation == (int)FolderController.StorageLocationTypes.InsecureFileSystem
? Path.Combine(ownerPortalSettings.HomeDirectory, fileInfo.RelativePath) + urlParams
: fileManager.GetUrl(fileInfo));
break;
case "page":
var portalSettings = PortalSettings.Current;
// Get full PortalSettings (with portal alias) if module sharing is active
if (PortalSettings.Current != null && PortalSettings.Current.PortalId != ownerPortalSettings.PortalId)
{
var portalAlias = ownerPortalSettings.PrimaryAlias ?? TestablePortalAliasController.Instance.GetPortalAliasesByPortalId(ownerPortalSettings.PortalId).First();
portalSettings = new PortalSettings(id, portalAlias);
}
var tabInfo = tabController.GetTab(id, ownerPortalSettings.PortalId, false);
if (tabInfo != null)
{
if (tabInfo.CultureCode != "" && tabInfo.CultureCode != PortalSettings.Current.CultureCode)
{
var cultureTabInfo = tabController.GetTabByCulture(tabInfo.TabID, tabInfo.PortalID, LocaleController.Instance.GetLocale(PortalSettings.Current.CultureCode));
if (cultureTabInfo != null)
tabInfo = cultureTabInfo;
}
// Exception in AdvancedURLProvider because ownerPortalSettings.PortalAlias is null
resultString = Globals.NavigateURL(tabInfo.TabID, portalSettings, "", new string[] { }) + urlParams;
}
break;
}
return resultString;
}