本文整理汇总了C#中DotNetNuke.Entities.Tabs.TabController类的典型用法代码示例。如果您正苦于以下问题:C# TabController类的具体用法?C# TabController怎么用?C# TabController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TabController类属于DotNetNuke.Entities.Tabs命名空间,在下文中一共展示了TabController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadSettings
public override void LoadSettings()
{
try
{
if (!Page.IsPostBack)
{
TabController tabCtrl = new TabController();
var currentTab = tabCtrl.GetTab(TabId, PortalId, true);
foreach (var module in currentTab.ChildModules)
{
var modInfo = module.Value as ModuleInfo;
if (modInfo.ModuleDefinition.DefinitionName == "QuickDocsPro")
{
ddlQDPModule.Items.Add(new ListItem(modInfo.ModuleControl.ControlTitle, modInfo.ModuleID.ToString()));
}
}
if ((string)TabModuleSettings["QDPModule"] != null)
{
ddlQDPModule.Items.FindByValue((string)TabModuleSettings["QDPModule"].ToString()).Selected = true;
}
}
}
catch (Exception exc)
{
//Module failed to load
Exceptions.ProcessModuleLoadException(this, exc);
}
}
示例2: GetUrls
/// <summary>
/// Includes page urls on the sitemap
/// </summary>
/// <remarks>
/// Pages that are included:
/// - are not deleted
/// - are not disabled
/// - are normal pages (not links,...)
/// - are visible (based on date and permissions)
/// </remarks>
public override List<SitemapUrl> GetUrls(int portalId, PortalSettings ps, string version)
{
var objTabs = new TabController();
SitemapUrl pageUrl = null;
var urls = new List<SitemapUrl>();
useLevelBasedPagePriority = bool.Parse(PortalController.GetPortalSetting("SitemapLevelMode", portalId, "False"));
minPagePriority = float.Parse(PortalController.GetPortalSetting("SitemapMinPriority", portalId, "0.1"), CultureInfo.InvariantCulture);
includeHiddenPages = bool.Parse(PortalController.GetPortalSetting("SitemapIncludeHidden", portalId, "True"));
this.ps = ps;
foreach (TabInfo objTab in objTabs.GetTabsByPortal(portalId).Values)
{
if (!objTab.IsDeleted && !objTab.DisableLink && objTab.TabType == TabType.Normal && (Null.IsNull(objTab.StartDate) || objTab.StartDate < DateTime.Now) &&
(Null.IsNull(objTab.EndDate) || objTab.EndDate > DateTime.Now) && IsTabPublic(objTab.TabPermissions))
{
if (includeHiddenPages || objTab.IsVisible)
{
pageUrl = GetPageUrl(objTab, (ps.ContentLocalizationEnabled) ? objTab.CultureCode : null);
urls.Add(pageUrl);
}
}
}
return urls;
}
示例3: FormatCrossPortalTabUrl
public static string FormatCrossPortalTabUrl (IModuleControl module, int tabId, bool trackClicks)
{
try {
// get tab info by tabId
var tab = new TabController ().GetTab (tabId, Null.NullInteger, false);
// check if this tab belongs to another portal
if (tab.PortalID != module.ModuleContext.PortalId) {
// get portal alias, primary first (we don't know exactly,
// which portal aliases are globally-available, and which are not)
var portalAlias = PortalAliasController.Instance.GetPortalAliasesByPortalId (tab.PortalID)
.OrderBy (pa => !pa.IsPrimary).First ();
// target portal URL (let target portal use right protocol and do URL rewriting)
return "http://" + portalAlias.HTTPAlias + (trackClicks ?
string.Format ("/LinkClick.aspx?link={0}&tabid={1}", tabId, module.ModuleContext.TabId) :
string.Format ("/Default.aspx?tabid={0}", tabId));
}
// tab is on same portal
return FormatURL (module, tabId.ToString (), trackClicks);
}
catch {
return string.Empty;
}
}
示例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: 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 "";
}
示例6: GetDnnHttpHandler
public IHttpHandler GetDnnHttpHandler(RequestContext requestContext, int portal, int tab, string[] passThrough)
{
PortalController pcontroller = new PortalController();
PortalInfo pinfo = pcontroller.GetPortal(portal);
PortalAliasController pacontroller = new PortalAliasController();
PortalAliasCollection pacollection = pacontroller.GetPortalAliasByPortalID(portal);
//pacollection.
//PortalSettings psettings = new PortalSettings(pinfo);
PortalSettings psettings = new PortalSettings(tab, portal); // 64 is the stats tab. TODO: get by page name and not hardcoded id
foreach (string key in pacollection.Keys)
{
psettings.PortalAlias = pacollection[key];
}
TabController tcontroller = new TabController();
// psettings.ActiveTab = tcontroller.GetTab(57, 0, true); // 57 is the profile tab.
requestContext.HttpContext.Items["PortalSettings"] = psettings;
requestContext.HttpContext.Items["UrlRewrite:OriginalUrl"] = requestContext.HttpContext.Request.RawUrl;
//UserInfo uinfo = requestContext.HttpContext.User == null ? new UserInfo() : UserController.GetUserByName(psettings.PortalId, requestContext.HttpContext.User.Identity.Name);
UserInfo uinfo = requestContext.HttpContext.User == null ? new UserInfo() : UserController.GetCachedUser(psettings.PortalId, requestContext.HttpContext.User.Identity.Name);
requestContext.HttpContext.Items["UserInfo"] = uinfo;
foreach (string s in passThrough)
{
requestContext.HttpContext.Items[s] = requestContext.RouteData.Values[s];
}
IHttpHandler page = BuildManager.CreateInstanceFromVirtualPath(VirtualPath, typeof(DotNetNuke.Framework.PageBase)) as IHttpHandler;
return page;
}
示例7: UrlForTabFriendly
public static string UrlForTabFriendly(int tabId, string csvParams, string friendlyPagePath)
{
string tabUrl = Globals.ApplicationURL(tabId);
TabInfo tabInfo = new TabController().GetTab(tabId, PortalSettings.PortalId, false);
string tabUrlWithParams = tabUrl + ConvertCsvParamsToAmpersandParams(csvParams);
try
{
if (!string.IsNullOrEmpty(friendlyPagePath))
{
string pageName = friendlyPagePath.Trim();
// trim leading and trailing "/"
pageName = pageName.TrimStart('/').TrimEnd('/');
pageName = StringHelper.FormatForUrl(pageName, true);
if(!pageName.EndsWith(".aspx"))
{
pageName += ".aspx";
}
//string pageName = FormatForUrl(cityStateZip) + "/" + FormatForUrl(member.BusinessName) + ".aspx";
return Globals.FriendlyUrl(tabInfo, tabUrlWithParams, pageName, PortalSettings);
}
}
catch (Exception ex)
{
Exceptions.LogException(ex);
return Globals.FriendlyUrl(tabInfo, tabUrlWithParams, PortalSettings);
}
return Globals.FriendlyUrl(tabInfo, tabUrlWithParams, PortalSettings);
}
示例8: FindMessageTab
//This method is copied from user skin object
private int FindMessageTab()
{
var tabController = new TabController();
var moduleController = new ModuleController();
//On brand new install the new Message Center Module is on the child page of User Profile Page
//On Upgrade to 6.2.0, the Message Center module is on the User Profile Page
var profileTab = tabController.GetTab(PortalSettings.UserTabId, PortalSettings.PortalId, false);
if (profileTab != null)
{
var childTabs = tabController.GetTabsByPortal(profileTab.PortalID).DescendentsOf(profileTab.TabID);
foreach (TabInfo tab in childTabs)
{
foreach (KeyValuePair<int, ModuleInfo> kvp in moduleController.GetTabModules(tab.TabID))
{
var module = kvp.Value;
if (module.DesktopModule.FriendlyName == "Message Center")
{
return tab.TabID;
}
}
}
}
//default to User Profile Page
return PortalSettings.UserTabId;
}
示例9: BindData
private void BindData()
{
using (var dt = new DataTable())
{
dt.Columns.Add(new DataColumn("TabId", typeof (Int32)));
dt.Columns.Add(new DataColumn("ContentKey", typeof (String)));
dt.Columns.Add(new DataColumn("Title", typeof (String)));
dt.Columns.Add(new DataColumn("Description", typeof (String)));
dt.Columns.Add(new DataColumn("PubDate", typeof (DateTime)));
var results = new ContentController().GetContentItemsByTerm(_tagQuery).ToList();
var tabController = new TabController();
if (_tagQuery.Length > 0)
{
foreach (var item in results)
{
var dr = dt.NewRow();
dr["TabId"] = item.TabID;
dr["ContentKey"] = item.ContentKey;
dr["Title"] = item.Content;
//get tab info and use the tab description, if tab is deleted then ignore the item.
var tab = tabController.GetTab(item.TabID, PortalId, false);
if(tab != null)
{
if (tab.IsDeleted)
{
continue;
}
dr["Title"] = string.IsNullOrEmpty(tab.Title) ? tab.TabName : tab.Title;
dr["Description"] = tab.Description;
}
else
{
dr["Description"] = item.Content.Length > 1000 ? item.Content.Substring(0, 1000) : item.Content;
}
dr["PubDate"] = item.CreatedOnDate;
dt.Rows.Add(dr);
}
}
//Bind Search Results Grid
var dv = new DataView(dt);
dgResults.DataSource = dv;
dgResults.DataBind();
if (results.Count == 0)
{
dgResults.Visible = false;
lblMessage.Text = string.Format(Localization.GetString("NoResults", LocalResourceFile), _tagQuery);
}
else
{
lblMessage.Text = string.Format(Localization.GetString("Results", LocalResourceFile), _tagQuery);
}
}
}
示例10: 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;
}
示例11: OnLoad
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
var controller = new TabController();
lblHomePage.Text = controller.GetTab(ModuleContext.PortalSettings.HomeTabId, ModuleContext.PortalId,false).TabName;
if (!IsPostBack) BindSettingControls();
}
示例12: ResolvePageLink
private string ResolvePageLink(int linkId, string defaultValue)
{
var tabController = new TabController();
var tabInfo = tabController.GetTab(linkId);
if (tabInfo == null)
return defaultValue;
return tabInfo.TabPath;
}
示例13: LoadSettings
public override void LoadSettings()
{
try
{
if (Page.IsPostBack == false)
{
var portalTabs = TabController.GetPortalTabs(PortalId, Null.NullInteger, false, true);
//Add host tabs
if (UserInfo != null && UserInfo.IsSuperUser)
{
var hostTabs = new TabController().GetTabsByPortal(Null.NullInteger);
portalTabs.AddRange(hostTabs.Values);
}
ParentTab.Items.Clear();
foreach (var t in portalTabs)
{
if ((TabPermissionController.CanViewPage(t)))
{
ParentTab.Items.Add(new ListItem(t.IndentedTabName, t.TabID.ToString()));
}
}
ParentTab.Items.Insert(0, "");
SelectDropDownListItem(ref ParentTab, "ParentTabID");
foreach (string val in ConsoleController.GetSizeValues())
{
DefaultSize.Items.Add(new ListItem(Localization.GetString(val, LocalResourceFile), val));
}
SelectDropDownListItem(ref DefaultSize, "DefaultSize");
if (Settings.ContainsKey("AllowSizeChange"))
{
AllowResize.Checked = Convert.ToBoolean(Settings["AllowSizeChange"]);
}
foreach (var val in ConsoleController.GetViewValues())
{
DefaultView.Items.Add(new ListItem(Localization.GetString(val, LocalResourceFile), val));
}
SelectDropDownListItem(ref DefaultView, "DefaultView");
if (Settings.ContainsKey("AllowViewChange"))
{
AllowViewChange.Checked = Convert.ToBoolean(Settings["AllowViewChange"]);
}
if (Settings.ContainsKey("ShowTooltip"))
{
ShowTooltip.Checked = Convert.ToBoolean(Settings["ShowTooltip"]);
}
if (Settings.ContainsKey("ConsoleWidth"))
{
ConsoleWidth.Text = Convert.ToString(Settings["ConsoleWidth"]);
}
}
}
catch (Exception exc) //Module failed to load
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}
示例14: 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);
}
}
示例15: PageDesignersMustNotExist
public void PageDesignersMustNotExist()
{
var tabController = new TabController();
var tab = tabController.GetTabByName("Designers", 0);
if (tab != null)
{
tabController.DeleteTab(tab.TabID, 0);
Config.Touch();
}
}