本文整理汇总了C#中DotNetNuke.Entities.Tabs.TabInfo类的典型用法代码示例。如果您正苦于以下问题:C# TabInfo类的具体用法?C# TabInfo怎么用?C# TabInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TabInfo类属于DotNetNuke.Entities.Tabs命名空间,在下文中一共展示了TabInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddCoursePage
public TabInfo AddCoursePage(string tabName, string tabTitle)
{
PortalSettings portalSettings = new PortalSettings();
int portalId = portalSettings.PortalId;
TabController tabController = new TabController();
TabInfo getTab = tabController.GetTabByName(tabName, portalId);
if (getTab != null)
throw new Exception("Cannot create Page. Page with this PageName already exists");
TabInfo newTab = new TabInfo();
newTab.PortalID = portalId;
newTab.TabName = tabName;
newTab.Title = tabTitle;
newTab.SkinSrc = "[G]Skins/20047-UnlimitedColorPack-033/CoursePage.ascx";
newTab.ContainerSrc = portalSettings.DefaultPortalContainer;
CommonTabSettings(newTab);
AddViewPermissions(newTab);
int tabId = tabController.AddTab(newTab, true);
DotNetNuke.Common.Utilities.DataCache.ClearModuleCache(tabId);
AddTabURL(newTab); //Makes the URL of Page /4 or /C4
// add modules to new page
AddModuleToPage(newTab, ModuleType.DisplayCourse);
AddModuleToPage(newTab, ModuleType.Rating);
AddModuleToPage(newTab, ModuleType.Comments);
return newTab;
}
示例2: UpgradeModule
/// <summary>
/// Upgrades the module.
/// </summary>
/// <param name="Version">The version.</param>
/// <returns>System.String.</returns>
public string UpgradeModule(string Version)
{
TabController tabs = new TabController();
foreach (PortalInfo p in new PortalController().GetPortals())
{
TabInfo tabInfo = tabs.GetTabByName("Vanity Urls", p.PortalID);
if (tabInfo == null)
{
tabInfo = new TabInfo();
tabInfo.TabID = -1;
tabInfo.ParentId = tabs.GetTabByName("Admin", p.PortalID).TabID;
tabInfo.PortalID = p.PortalID;
tabInfo.TabName = "Vanity Urls";
try
{
int tabId = tabs.AddTab(tabInfo);
AddModuleToPage(p.PortalID, tabId);
return "Vanity Urls page added";
}
catch (Exception ex)
{
DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
}
}
}
return "";
}
示例3: FriendlyUrl
internal override string FriendlyUrl(TabInfo tab, string path, string pageName, PortalSettings portalSettings)
{
if (portalSettings == null)
{
throw new ArgumentNullException("portalSettings");
}
return FriendlyUrlInternal(tab, path, pageName, String.Empty, portalSettings);
}
示例4: GivenThereIsAPageCalled
public void GivenThereIsAPageCalled(string pageName, Table permissions)
{
var reset = false;
var tabController = new TabController();
var tab = tabController.GetTabByName(pageName, PortalId);
if (tab == null)
{
tab = new TabInfo
{
TabName = pageName,
PortalID = 0
};
tab.TabID = tabController.AddTab(tab);
foreach (var row in permissions.Rows)
{
var roleId = -1;
var roleController = new RoleController();
if (row[0] == "All Users")
{
roleId = -1;
}
else
{
var role = roleController.GetRoleByName(PortalId, row[0]);
if (role == null)
{
if (roleController.GetRoleByName(Null.NullInteger, row[0]) == null)
{
role = new RoleInfo { RoleName = row[0], RoleGroupID = Null.NullInteger };
roleId = roleController.AddRole(role);
}
}
}
var permissionController = new PermissionController();
var permission = permissionController.GetPermissionByCodeAndKey("SYSTEM_TAB", row[1]);
var tabPermission = new TabPermissionInfo
{
PermissionID = 3,
TabID = tab.TabID,
AllowAccess = true,
RoleID = roleId
};
tab.TabPermissions.Add(tabPermission);
}
tabController.UpdateTab(tab);
reset = true;
}
Page = tab;
if (reset)
{
Config.Touch();
}
}
示例5: MustHaveTestPageAdded
public void MustHaveTestPageAdded()
{
//Create a tabInfo obj, then use TabController AddTab Method?
TabInfo newPage = new TabInfo();
newPage.TabName = "Test Page";
newPage.PortalID = 0;
newPage.SkinSrc = "[G]Skins/Aphelia/twoColumn-rightAside.ascx";
newPage.ContainerSrc = "[G]Containers/Aphelia/Title.ascx";
TabController tabController = new TabController();
var tab = tabController.GetTabByName("Test Page", 0);
if (tab == null)
{
try
{
tabController.AddTab(newPage);
}
catch (Exception exc)
{
Assert.IsTrue(false, "Add Tab result: " + exc.Message);
}
//tabController.AddTab(newPage);
newPage = tabController.GetTabByName("Test Page", 0);
TabPermissionInfo tabPermission = new TabPermissionInfo();
tabPermission.PermissionID = 3;
tabPermission.TabID = newPage.TabID;
tabPermission.AllowAccess = true;
tabPermission.RoleID = 0;
newPage.TabPermissions.Add(tabPermission);
try
{
tabController.UpdateTab(newPage);
}
catch (Exception exc)
{
Assert.IsTrue(false, "Update Tab result: " + exc.Message);
}
newPage = tabController.GetTabByName("Test Page", 0);
tabPermission.RoleID = 0;
tabPermission.PermissionID = 4;
tabPermission.TabID = newPage.TabID;
tabPermission.AllowAccess = true;
newPage.TabPermissions.Add(tabPermission);
try
{
tabController.UpdateTab(newPage);
}
catch (Exception exc)
{
Assert.IsTrue(false, "Update Tab Permissions result: " + exc.Message);
}
Thread.Sleep(1500);
}
}
示例6: IsExcludedFromFriendlyUrls
/// <summary>
/// Determines if the tab is excluded from FriendlyUrl Processing
/// </summary>
/// <param name="tab"></param>
/// <param name="settings"></param>
/// <param name="rewriting">If true, we are checking for rewriting purposes, if false, we are checking for friendly Url Generating.</param>
/// <returns></returns>
private static bool IsExcludedFromFriendlyUrls(TabInfo tab, FriendlyUrlSettings settings, bool rewriting)
{
//note this is a duplicate of another method in RewriteController.cs
bool exclude = false;
string tabPath = (tab.TabPath.Replace("//", "/") + ";").ToLower();
if (settings.UseBaseFriendlyUrls != null)
{
exclude = settings.UseBaseFriendlyUrls.ToLower().Contains(tabPath);
}
return exclude;
}
示例7: AddChildTabsToList
private static void AddChildTabsToList(TabInfo currentTab, ref TabCollection allPortalTabs, ref IDictionary<int, TabInfo> tabsWithModule, ref IDictionary<int, TabInfo> tabsInOrder)
{
if ((tabsWithModule.ContainsKey(currentTab.TabID) && !tabsInOrder.ContainsKey(currentTab.TabID)))
{
//add current tab
tabsInOrder.Add(currentTab.TabID, currentTab);
//add children of current tab
foreach (TabInfo tab in allPortalTabs.WithParentId(currentTab.TabID))
{
AddChildTabsToList(tab, ref allPortalTabs, ref tabsWithModule, ref tabsInOrder);
}
}
}
示例8: AddAllTabsModules
private static void AddAllTabsModules(TabInfo tab)
{
var objmodules = new ModuleController();
var portalSettings = new PortalSettings(tab.TabID, tab.PortalID);
foreach (ModuleInfo allTabsModule in objmodules.GetAllTabsModules(tab.PortalID, true))
{
//[DNN-6276]We need to check that the Module is not implicitly deleted. ie If all instances are on Pages
//that are all "deleted" then even if the Module itself is not deleted, we would not expect the
//Module to be added
var canAdd =
(from ModuleInfo allTabsInstance in objmodules.GetModuleTabs(allTabsModule.ModuleID) select new TabController().GetTab(allTabsInstance.TabID, tab.PortalID, false)).Any(
t => !t.IsDeleted) && (!portalSettings.ContentLocalizationEnabled || allTabsModule.CultureCode == portalSettings.CultureCode);
if (canAdd)
{
objmodules.CopyModule(allTabsModule, tab, Null.NullString, true);
}
}
}
示例9: GetFriendlyUrlTabPath
/// <summary>
/// Get the tab path for the supplied Tab
/// </summary>
/// <param name="tab"></param>
/// <param name="options"></param>
/// <param name="parentTraceId"></param>
/// <returns></returns>
internal static string GetFriendlyUrlTabPath(TabInfo tab, FriendlyUrlOptions options, Guid parentTraceId)
{
string baseTabPath = tab.TabPath.Replace("//", "/").TrimStart('/');
if (options.CanGenerateNonStandardPath)
{
//build up a non-space version of the tab path
baseTabPath = BuildTabPathWithReplacement(tab, options, parentTraceId);
baseTabPath = baseTabPath.Replace("//", "/");
//automatic diacritic conversion
if (options.ConvertDiacriticChars)
{
bool diacriticsChanged;
baseTabPath = ReplaceDiacritics(baseTabPath, out diacriticsChanged);
}
}
return baseTabPath;
}
示例10: AppendToTabPath
private static string AppendToTabPath(string path, TabInfo tab, FriendlyUrlOptions options, out bool modified)
{
string tabName = tab.TabName;
var result = new StringBuilder(tabName.Length);
//922 : change to harmonise cleaning of tab + other url name items
tabName = FriendlyUrlController.CleanNameForUrl(tabName, options, out modified);
if (!modified
&& string.IsNullOrEmpty(options.PunctuationReplacement) == false
&& tab.TabName.Contains(" ")
&& tabName.Contains(" ") == false)
{
modified = true;
//spaces replaced - the modified parameter is for all other replacements but space replacements
}
result.Append(tabName);
result.Insert(0, "//");
result.Insert(0, path); //effectively adds result to the end of the path
return result.ToString();
}
示例11: AddModuleToPage
///-----------------------------------------------------------------------------
///<summary>
/// AddModuleToPage adds a module to a Page
///</summary>
///<remarks>
///</remarks>
///<param name = "page">The Page to add the Module to</param>
///<param name = "moduleDefId">The Module Deinition Id for the module to be aded to this tab</param>
///<param name = "moduleTitle">The Module's title</param>
///<param name = "moduleIconFile">The Module's icon</param>
///<param name = "inheritPermissions">Inherit the Pages View Permisions</param>
///<history>
/// [cnurse] 11/16/2004 created
///</history>
///-----------------------------------------------------------------------------
public static int AddModuleToPage(TabInfo page, int moduleDefId, string moduleTitle, string moduleIconFile, bool inheritPermissions)
{
var moduleController = new ModuleController();
ModuleInfo moduleInfo;
int moduleId = Null.NullInteger;
if ((page != null))
{
bool isDuplicate = false;
foreach (var kvp in moduleController.GetTabModules(page.TabID))
{
moduleInfo = kvp.Value;
if (moduleInfo.ModuleDefID == moduleDefId)
{
isDuplicate = true;
moduleId = moduleInfo.ModuleID;
}
}
if (!isDuplicate)
{
moduleInfo = new ModuleInfo
{
ModuleID = Null.NullInteger,
PortalID = page.PortalID,
TabID = page.TabID,
ModuleOrder = -1,
ModuleTitle = moduleTitle,
PaneName = Globals.glbDefaultPane,
ModuleDefID = moduleDefId,
CacheTime = 0,
IconFile = moduleIconFile,
AllTabs = false,
Visibility = VisibilityState.None,
InheritViewPermissions = inheritPermissions
};
moduleId = moduleController.AddModule(moduleInfo);
}
}
return moduleId;
}
示例12: CreatePage
private TabInfo CreatePage(TabInfo tab, int portalId, int parentTabId, string tabName, bool includeInMenu)
{
int id = -1;
var tc = new TabController();
var tPermissions = new TabPermissionCollection();
var newTab = new TabInfo();
if ((tab != null))
{
foreach (TabPermissionInfo t in tab.TabPermissions)
{
var tNew = new TabPermissionInfo
{
AllowAccess = t.AllowAccess,
DisplayName = t.DisplayName,
ModuleDefID = t.ModuleDefID,
PermissionCode = t.PermissionCode,
PermissionID = t.PermissionID,
PermissionKey = t.PermissionKey,
PermissionName = t.PermissionName,
RoleID = t.RoleID,
RoleName = t.RoleName,
TabID = -1,
TabPermissionID = -1,
UserID = t.UserID,
Username = t.Username
};
newTab.TabPermissions.Add(t);
}
}
newTab.ParentId = parentTabId;
newTab.PortalID = portalId;
newTab.TabName = tabName;
newTab.Title = tabName;
newTab.IsVisible = includeInMenu;
newTab.SkinSrc = "[G]Skins/DarkKnight/2-Column-Right-SocialProfile-Mega-Menu.ascx";
id = tc.AddTab(newTab);
tab = tc.GetTab(id, portalId, true);
return tab;
}
示例13: CreateLocalizedCopy
public void CreateLocalizedCopy(TabInfo originalTab, Locale locale)
{
CreateLocalizedCopy(originalTab, locale, true);
}
示例14: CheckFor301RedirectExclusion
private static bool CheckFor301RedirectExclusion(int tabId, int portalId, bool checkBaseUrls, out TabInfo tab, FriendlyUrlSettings settings)
{
bool doRedirect = false;
tab = TabController.Instance.GetTab(tabId, portalId, false);
//don't redirect unless allowed, the tab is valid, and it's not an admin or super tab
if (tab != null && tab.IsSuperTab == false && !tab.DoNotRedirect)
{
if (checkBaseUrls)
{
//no redirect for friendly url purposes if the tab is in the 'base friendly urls' section
doRedirect = !RewriteController.IsExcludedFromFriendlyUrls(tab, settings, true);
}
else
{
doRedirect = true;
}
}
return doRedirect;
}
示例15: RenderTabNode
/// <summary>
/// Renders the tab node.
/// </summary>
/// <param name="parentNode">The parent node.</param>
/// <param name="tabInfo">The tab info.</param>
/// <param name="moduleController">The module controller.</param>
/// <param name="editorHostSettings">The editor host settings.</param>
private void RenderTabNode(
TreeNode parentNode,
TabInfo tabInfo,
ModuleController moduleController,
List<EditorHostSetting> editorHostSettings)
{
var tabKey = string.Format("DNNCKT#{0}#", tabInfo.TabID);
var tabSettingsExists = SettingsUtil.CheckExistsPortalOrPageSettings(editorHostSettings, tabKey);
// Tabs
var tabNode = new TreeNode
{
Text = tabInfo.TabName,
Value = string.Format("t{0}", tabInfo.TabID),
ImageUrl =
tabSettingsExists
? "../images/PageHasSetting.png"
: "../images/PageNoSetting.png"
};
if (tabInfo.HasChildren)
{
foreach (var childTab in TabController.GetTabsByParent(tabInfo.TabID, tabInfo.PortalID))
{
this.RenderTabNode(tabNode, childTab, moduleController, editorHostSettings);
}
}
var modules = moduleController.GetTabModules(tabInfo.TabID).Values;
foreach (var moduleNode in from moduleInfo in modules
let moduleKey = string.Format("DNNCKMI#{0}#INS#", moduleInfo.ModuleID)
let moduleSettingsExists =
SettingsUtil.CheckExistsModuleSettings(moduleKey, moduleInfo.ModuleID)
select
new TreeNode
{
Text = moduleInfo.ModuleTitle,
ImageUrl =
moduleSettingsExists
? "../images/ModuleHasSetting.png"
: "../images/ModuleNoSetting.png",
Value = string.Format("m{0}", moduleInfo.ModuleID)
})
{
tabNode.ChildNodes.Add(moduleNode);
}
parentNode.ChildNodes.Add(tabNode);
}