本文整理汇总了C#中DotNetNuke.Entities.Tabs.TabController.GetTab方法的典型用法代码示例。如果您正苦于以下问题:C# TabController.GetTab方法的具体用法?C# TabController.GetTab怎么用?C# TabController.GetTab使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Entities.Tabs.TabController
的用法示例。
在下文中一共展示了TabController.GetTab方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: 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);
}
}
示例3: 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);
}
}
}
示例4: 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();
}
示例5: 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;
}
示例6: CmdAddPageClick
protected void CmdAddPageClick(object sender, EventArgs e)
{
var tabCtrl = new TabController();
int selectedTabID = Int32.Parse(PageLst.SelectedValue);
TabInfo selectedTab = tabCtrl.GetTab(selectedTabID, PortalSettings.ActiveTab.PortalID, false);
var tabLocation = (TabRelativeLocation) Enum.Parse(typeof (TabRelativeLocation), LocationLst.SelectedValue);
TabInfo newTab = RibbonBarManager.InitTabInfoObject(selectedTab, tabLocation);
string templateFile = string.Empty;
if ((!string.IsNullOrEmpty(TemplateLst.SelectedValue)))
{
templateFile = Path.Combine(PortalSettings.HomeDirectoryMapPath, "Templates\\" + TemplateLst.SelectedValue);
}
newTab.TabName = Name.Text;
newTab.IsVisible = IncludeInMenu.Checked;
string errMsg = string.Empty;
try
{
RibbonBarManager.SaveTabInfoObject(newTab, selectedTab, tabLocation, templateFile);
}
catch (DotNetNukeException ex)
{
Exceptions.LogException(ex);
errMsg = (ex.ErrorCode != DotNetNukeErrorCode.NotSet) ? GetString("Err." + ex.ErrorCode) : ex.Message;
}
catch (Exception ex)
{
Exceptions.LogException(ex);
errMsg = ex.Message;
}
//Clear the Tab's Cached modules
DataCache.ClearModuleCache(PortalSettings.ActiveTab.TabID);
//Update Cached Tabs as TabPath may be needed before cache is cleared
TabInfo tempTab;
if (new TabController().GetTabsByPortal(PortalSettings.ActiveTab.PortalID).TryGetValue(newTab.TabID, out tempTab))
{
tempTab.TabPath = newTab.TabPath;
}
if ((string.IsNullOrEmpty(errMsg)))
{
Response.Redirect(Globals.NavigateURL(newTab.TabID));
}
else
{
errMsg = string.Format("<p>{0}</p><p>{1}</p>", GetString("Err.Header"), errMsg);
Web.UI.Utilities.RegisterAlertOnPageLoad(this, new MessageWindowParameters(errMsg) { Title = GetString("Err.Title")});
}
}
示例7: AddAdminPage
/// <summary>
/// AddAdminPage adds an Admin Tab Page
/// </summary>
/// <param name="Portal">The Portal</param>
/// <param name="TabName">The Name to give this new Tab</param>
/// <param name="TabIconFile">The Icon for this new Tab</param>
/// <param name="IsVisible">A flag indicating whether the tab is visible</param>
private static TabInfo AddAdminPage(PortalInfo Portal, string TabName, string TabIconFile, bool IsVisible)
{
TabController objTabController = new TabController();
TabInfo AdminPage = objTabController.GetTab(Portal.AdminTabId, Portal.PortalID, false);
TabPermissionCollection objTabPermissions = new TabPermissionCollection();
AddPagePermission(ref objTabPermissions, "View", Convert.ToInt32(Portal.AdministratorRoleId));
//Call AddPage with parentTab = AdminPage & RoleId = AdministratorRoleId
return AddPage(AdminPage, TabName, TabIconFile, IsVisible, objTabPermissions, true);
}
示例8: GetDocUrl
public override string GetDocUrl(SearchResult searchResult)
{
var url = Localization.Localization.GetString("SEARCH_NoLink");
var tabController = new TabController();
var tab = tabController.GetTab(searchResult.TabId, searchResult.PortalId, false);
if (TabPermissionController.CanViewPage(tab))
{
url = TestableGlobals.Instance.NavigateURL(searchResult.TabId, string.Empty, searchResult.QueryString);
}
return url;
}
示例9: HasViewPermission
public override bool HasViewPermission(SearchResult searchResult)
{
var viewable = true;
if (searchResult.TabId > 0)
{
var tabController = new TabController();
var tab = tabController.GetTab(searchResult.TabId, searchResult.PortalId, false);
viewable = tab != null && !tab.IsDeleted && TabPermissionController.CanViewPage(tab);
}
return viewable;
}
示例10: GetModuleList
public static List<ListItem> GetModuleList(string ModuleName)
{
List<ListItem> lst = new List<ListItem>();
PortalSettings portalSettings = PortalController.GetCurrentPortalSettings();
List<TabInfo> objTabs = TabController.GetPortalTabs(portalSettings.PortalId, -1, true, true);
var objTabController = new TabController();
var objDesktopModuleController = new DesktopModuleController();
var objDesktopModuleInfo = objDesktopModuleController.GetDesktopModuleByModuleName(ModuleName);
if (objDesktopModuleInfo == null)
{
objDesktopModuleInfo = objDesktopModuleController.GetDesktopModuleByName(ModuleName);
if (objDesktopModuleInfo == null)
{
return lst;
}
}
foreach (TabInfo objTab in objTabs.Where(tab => !tab.IsDeleted))
{
ModuleController objModules = new ModuleController();
foreach (KeyValuePair<int, ModuleInfo> pair in objModules.GetTabModules(objTab.TabID))
{
ModuleInfo objModule = pair.Value;
if (objModule.IsDeleted)
{
continue;
}
if (objModule.DesktopModuleID != objDesktopModuleInfo.DesktopModuleID)
{
continue;
}
string strPath = objTab.TabName;
TabInfo objTabSelected = objTab;
while (objTabSelected.ParentId != Null.NullInteger)
{
objTabSelected = objTabController.GetTab(objTabSelected.ParentId, objTab.PortalID, false);
if (objTabSelected == null)
{
break;
}
strPath = string.Format("{0} -> {1}", objTabSelected.TabName, strPath);
}
var objListItem = new ListItem
{
Value = objModule.ModuleID.ToString(),
Text = string.Format("{0} -> {1}", strPath, objModule.ModuleTitle)
};
lst.Add(objListItem);
}
}
return lst;
}
示例11: BindData
/// <summary>
/// BindData loads the Controls with Tab Data from the Database
/// </summary>
/// <history>
/// [cnurse] 9/10/2004 Updated to reflect design changes for Help, 508 support
/// and localisation
/// </history>
public void BindData()
{
TabController objTabs = new TabController();
TabInfo objTab = objTabs.GetTab( TabId, PortalId, false );
//Load TabControls
LoadTabControls( objTab );
if( objTab != null )
{
if( strAction != "copy" )
{
txtTabName.Text = objTab.TabName;
txtTitle.Text = objTab.Title;
txtDescription.Text = objTab.Description;
txtKeyWords.Text = objTab.KeyWords;
ctlURL.Url = objTab.Url;
}
ctlIcon.Url = objTab.IconFile;
if( cboTab.Items.FindByValue( objTab.ParentId.ToString() ) != null )
{
cboTab.Items.FindByValue( objTab.ParentId.ToString() ).Selected = true;
}
chkHidden.Checked = ! objTab.IsVisible;
chkDisableLink.Checked = objTab.DisableLink;
ctlSkin.SkinSrc = objTab.SkinSrc;
ctlContainer.SkinSrc = objTab.ContainerSrc;
if( ! Null.IsNull( objTab.StartDate ) )
{
txtStartDate.Text = objTab.StartDate.ToShortDateString();
}
if( ! Null.IsNull( objTab.EndDate ) )
{
txtEndDate.Text = objTab.EndDate.ToShortDateString();
}
if( objTab.RefreshInterval != Null.NullInteger )
{
txtRefreshInterval.Text = objTab.RefreshInterval.ToString();
}
txtPageHeadText.Text = objTab.PageHeadText;
}
// copy page options
cboCopyPage.DataSource = LoadPortalTabs();
cboCopyPage.DataBind();
cboCopyPage.Items.Insert( 0, new ListItem( "<" + Localization.GetString( "None_Specified" ) + ">", "-1" ) );
rowModules.Visible = false;
}
示例12: UpgradeModule
public string UpgradeModule(string Version)
{
try
{
switch (Version)
{
case "06.02.00":
var portalController = new PortalController();
var moduleController = new ModuleController();
var tabController = new TabController();
var moduleDefinition = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("Message Center");
if (moduleDefinition != null)
{
var portals = portalController.GetPortals();
foreach (PortalInfo portal in portals)
{
if (portal.UserTabId > Null.NullInteger)
{
//Find TabInfo
var tab = tabController.GetTab(portal.UserTabId, portal.PortalID, true);
if (tab != null)
{
foreach (var module in moduleController.GetTabModules(portal.UserTabId).Values)
{
if (module.DesktopModule.FriendlyName == "Messaging")
{
//Delete the Module from the Modules list
moduleController.DeleteTabModule(module.TabID, module.ModuleID, false);
//Add new module to the page
Upgrade.AddModuleToPage(tab, moduleDefinition.ModuleDefID, "Message Center", "", true);
break;
}
}
}
}
}
}
break;
}
return "Success";
}
catch (Exception exc)
{
Logger.Error(exc);
return "Failed";
}
}
示例13: ViewTab
/// <summary>
/// ViewTab redirects to the Tab/Page for the currently selected tab/page
/// </summary>
/// <remarks>
/// </remarks>
/// <history>
/// [cnurse] 9/9/2004 Created
/// </history>
private void ViewTab()
{
if( lstTabs.SelectedIndex != - 1 )
{
TabController objTabs = new TabController();
TabInfo objTab = objTabs.GetTab( ( (TabInfo)arrPortalTabs[lstTabs.SelectedIndex] ).TabID );
if( objTab != null )
{
if( objTab.DisableLink )
{
UI.Skins.Skin.AddModuleMessage( this, Localization.GetString( "ViewTabMessage", this.LocalResourceFile ), ModuleMessageType.YellowWarning );
}
else
{
Response.Redirect( Globals.NavigateURL( objTab.TabID ), true );
}
}
}
}
示例14: BindBeforeAfterTabControls
private void BindBeforeAfterTabControls()
{
TabInfo parentTab = null;
var noneSpecified = "<" + Localization.GetString("None_Specified") + ">";
if (cboParentTab.SelectedItem != null)
{
var parentTabID = Int32.Parse(cboParentTab.SelectedItem.Value);
var controller = new TabController();
parentTab = controller.GetTab(parentTabID, PortalId, false);
}
List<TabInfo> listTabs = parentTab != null ? new TabController().GetTabsByPortal(parentTab.PortalID).WithParentId(parentTab.TabID) : new TabController().GetTabsByPortal(PortalId).WithParentId(Null.NullInteger);
listTabs = TabController.GetPortalTabs(listTabs, Null.NullInteger, true, noneSpecified, false, false, false, false, true);
cboPositionTab.DataSource = listTabs;
cboPositionTab.DataBind();
rbInsertPosition.Items.Clear();
rbInsertPosition.Items.Add(new ListItem(Localization.GetString("InsertBefore", LocalResourceFile), "Before"));
rbInsertPosition.Items.Add(new ListItem(Localization.GetString("InsertAfter", LocalResourceFile), "After"));
rbInsertPosition.Items.Add(new ListItem(Localization.GetString("InsertAtEnd", LocalResourceFile), "AtEnd"));
rbInsertPosition.SelectedValue = "After";
}
示例15: HasViewPermission
public override bool HasViewPermission(SearchResult searchResult)
{
var viewable = false;
if (searchResult.ModuleId > 0)
{
//Get All related tabIds from moduleId (while minimizing DB access; using caching)
var tabController = new TabController();
var moduleId = searchResult.ModuleId;
// The next call has over 30% performance enhancement over the above one
var tabModules = tabController.GetTabsByPortal(searchResult.PortalId).Values
.SelectMany(tabinfo => tabinfo.ChildModules.Where(kv => kv.Key == moduleId)).Select(m => m.Value);
foreach (ModuleInfo module in tabModules)
{
var tab = tabController.GetTab(module.TabID, searchResult.PortalId, false);
if (!module.IsDeleted && !tab.IsDeleted && TabPermissionController.CanViewPage(tab))
{
//Check If authorised to View Module
if (ModulePermissionController.CanViewModule(module))
{
//Verify against search document permissions
if (string.IsNullOrEmpty(searchResult.Permissions) || PortalSecurity.IsInRoles(searchResult.Permissions))
{
viewable = true;
if (string.IsNullOrEmpty(searchResult.Url))
{
searchResult.Url = TestableGlobals.Instance.NavigateURL(module.TabID, string.Empty, searchResult.QueryString);
}
break;
}
}
}
}
}
else
{
viewable = true;
}
return viewable;
}