本文整理汇总了C#中DotNetNuke.Entities.Tabs.TabController.GetTabByName方法的典型用法代码示例。如果您正苦于以下问题:C# TabController.GetTabByName方法的具体用法?C# TabController.GetTabByName怎么用?C# TabController.GetTabByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Entities.Tabs.TabController
的用法示例。
在下文中一共展示了TabController.GetTabByName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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 "";
}
示例2: 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/DarkKnight/Home-Mega-Menu.ascx";
newPage.ContainerSrc = "[G]Containers/DarkKnight/SubTitle_Grey.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);
}
}
示例3: 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;
}
示例4: TestFixtureSetUp
public override void TestFixtureSetUp()
{
base.TestFixtureSetUp();
var tc = new TabController();
var tab = tc.GetTabByName(_aboutUsPageName, PortalId);
_tabId = tab.TabID;
//Add Portal Aliases
var aliasController = new PortalAliasController();
TestUtil.ReadStream(String.Format("{0}", "Aliases"), (line, header) =>
{
string[] fields = line.Split(',');
var alias = aliasController.GetPortalAlias(fields[0], PortalId);
if (alias == null)
{
alias = new PortalAliasInfo
{
HTTPAlias = fields[0],
PortalID = PortalId
};
TestablePortalAliasController.Instance.AddPortalAlias(alias);
}
});
TestUtil.ReadStream(String.Format("{0}", "Users"), (line, header) =>
{
string[] fields = line.Split(',');
TestUtil.AddUser(PortalId, fields[0].Trim(), fields[1].Trim(), fields[2].Trim());
});
}
示例5: MustNotHavePage
private void MustNotHavePage(string pageName)
{
var controller = new TabController();
TabInfo page = controller.GetTabByName(pageName, 0);
if (page != null)
{
controller.DeleteTab(page.TabID, page.PortalID);
}
}
示例6: PageDesignersMustNotExist
public void PageDesignersMustNotExist()
{
var tabController = new TabController();
var tab = tabController.GetTabByName("Designers", 0);
if (tab != null)
{
tabController.DeleteTab(tab.TabID, 0);
Config.Touch();
}
}
示例7: getUrlPreview
public string getUrlPreview(string id)
{
TabController tCtlr = new TabController();
TabInfo tInfoP = tCtlr.GetTabByName("Contingent Entry", PortalId);
int tID = 392;
if (tInfoP != null)
{
int tpID = tInfoP.TabID;
TabInfo tInfo = tCtlr.GetTabByName("Input", PortalId, tpID);
if (tInfo != null)
{
tID = tInfo.TabID;
}
}
//return "Default.aspx?tabid=383" + "&ID=" + id;
//return "Default.aspx?tabid=392" + "&ID=" + id;
return "Default.aspx?tabid=" + tID + "&ID=" + id;
}
示例8: 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();
}
}
示例9: AdvancedUrlRewriter_ForwardExternalUrls
public void AdvancedUrlRewriter_ForwardExternalUrls(Dictionary<string, string> testFields)
{
var settings = UrlTestFactoryClass.GetSettings("UrlRewrite", testFields["TestName"]);
settings.PortalId = PortalId;
var tc = new TabController();
var tab = tc.GetTabByName(_testPage, PortalId);
tab.Url = testFields["ExternalUrl"];
tc.UpdateTab(tab);
ExecuteTest(settings, testFields, true);
}
示例10: AdvancedUrlRewriter_DeletedTabHandling
public void AdvancedUrlRewriter_DeletedTabHandling(Dictionary<string, string> testFields)
{
var settings = UrlTestFactoryClass.GetSettings("UrlRewrite", testFields["TestName"]);
settings.PortalId = PortalId;
var tc = new TabController();
var tab = tc.GetTabByName(_testPage, PortalId);
if (Convert.ToBoolean(testFields["HardDeleted"]))
{
DeleteTab(_testPage);
CacheController.FlushPageIndexFromCache();
}
else
{
tab.IsDeleted = Convert.ToBoolean(testFields["SoftDeleted"]);
tab.DisableLink = Convert.ToBoolean(testFields["Disabled"]);
if (Convert.ToBoolean(testFields["Expired"]))
{
tab.EndDate = DateTime.Now - TimeSpan.FromDays(1);
}
UpdateTab(tab);
}
string deletedTabHandling = testFields.GetValue("DeletedTabHandling");
if (!String.IsNullOrEmpty(deletedTabHandling))
{
switch (deletedTabHandling)
{
case "Do404Error":
settings.DeletedTabHandlingType = DeletedTabHandlingType.Do404Error;
break;
default:
settings.DeletedTabHandlingType = DeletedTabHandlingType.Do301RedirectToPortalHome;
break;
}
}
SetDefaultAlias(testFields);
ExecuteTest(settings, testFields, true);
}
示例11: ExecuteTest
private void ExecuteTest(FriendlyUrlSettings settings, Dictionary<string, string> testFields, bool setDefaultAlias)
{
var tabName = testFields["Page Name"];
var tc = new TabController();
var tab = tc.GetTabByName(tabName, PortalId);
if (setDefaultAlias)
{
SetDefaultAlias(testFields);
}
ExecuteTestForTab(tab, settings, testFields);
}
示例12: DeleteTab
private void DeleteTab(string tabName)
{
var tc = new TabController();
var tab = tc.GetTabByName(tabName, PortalId);
if (tab != null)
{
tc.DeleteTab(tab.TabID, PortalId);
}
}
示例13: RemoveModule
private static int RemoveModule(string desktopModuleName, string tabName, int parentId, bool removeTab)
{
DnnInstallLogger.InstallLogInfo(Localization.Localization.GetString("LogStart", Localization.Localization.GlobalResourceFile) + "RemoveModule:" + desktopModuleName);
var tabController = new TabController();
var moduleController = new ModuleController();
TabInfo tab = tabController.GetTabByName(tabName, Null.NullInteger, parentId);
int moduleDefId = 0;
int count = 0;
//Get the Modules on the Tab
if (tab != null)
{
foreach (KeyValuePair<int, ModuleInfo> kvp in moduleController.GetTabModules(tab.TabID))
{
var module = kvp.Value;
if (module.DesktopModule.FriendlyName == desktopModuleName)
{
//Delete the Module from the Modules list
moduleController.DeleteTabModule(module.TabID, module.ModuleID, false);
moduleDefId = module.ModuleDefID;
}
else
{
count += 1;
}
}
//If Tab has no modules optionally remove tab
if (count == 0 && removeTab)
{
tabController.DeleteTab(tab.TabID, tab.PortalID);
}
}
return moduleDefId;
}
示例14: GetShowOnlyCurrent
private void GetShowOnlyCurrent(TabController objTabController, ref int StartingItemId, ref int iRootGroupId)
{
StartingItemId = 0;
iRootGroupId = 0;
//check if we have a value to work with
if (string.IsNullOrEmpty(ShowOnlyCurrent))
{
return;
}
//check if user specified an ID
if ((char.IsDigit(ShowOnlyCurrent.ToCharArray()[0])))
{
int output;
if(int.TryParse(ShowOnlyCurrent, out output))
{
StartingItemId = output;
}
}
//check if user specified a page name
if ((ShowOnlyCurrent.StartsWith("PageItem:")))
{
TabInfo temptab = objTabController.GetTabByName(ShowOnlyCurrent.Substring(("PageItem:").Length), PortalSettings.PortalId);
if ((temptab != null))
{
StartingItemId = temptab.TabID;
}
}
//RootItem
if (("RootItem" == ShowOnlyCurrent))
{
iRootGroupId = PortalSettings.ActiveTab.TabID;
while (((objTabController.GetTab(iRootGroupId, PortalSettings.PortalId, true)).ParentId != -1))
{
iRootGroupId = (objTabController.GetTab(iRootGroupId, PortalSettings.PortalId, true)).ParentId;
}
}
}
示例15: UpdateTabSetting
private void UpdateTabSetting(string tabName, string settingName, string settingValue)
{
var tc = new TabController();
var tab = tc.GetTabByName(tabName, PortalId);
tab.TabSettings[settingName] = settingValue;
tc.UpdateTab(tab);
}