本文整理汇总了C#中DotNetNuke.Entities.Modules.ModuleController.GetTabModules方法的典型用法代码示例。如果您正苦于以下问题:C# ModuleController.GetTabModules方法的具体用法?C# ModuleController.GetTabModules怎么用?C# ModuleController.GetTabModules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Entities.Modules.ModuleController
的用法示例。
在下文中一共展示了ModuleController.GetTabModules方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddAdminPages
public static void AddAdminPages(string tabName, string description, string tabIconFile, string tabIconFileLarge, bool isVisible, int moduleDefId, string moduleTitle, string moduleIconFile, bool inheritPermissions)
{
var portalController = new PortalController();
ArrayList portals = portalController.GetPortals();
//Add Page to Admin Menu of all configured Portals
for (int intPortal = 0; intPortal <= portals.Count - 1; intPortal++)
{
var portal = (PortalInfo)portals[intPortal];
//Create New Admin Page (or get existing one)
TabInfo newPage = Upgrade.AddAdminPage(portal, tabName, description, tabIconFile, tabIconFileLarge, isVisible);
//Add Module To Page
Upgrade.AddModuleToPage(newPage, moduleDefId, moduleTitle, moduleIconFile, inheritPermissions);
var moduleController = new ModuleController();
if (newPage != null) {
foreach (var module in moduleController.GetTabModules(newPage.TabID).Values)
{
moduleController.UpdateTabModuleSetting(module.TabModuleID, "hideadminborder", "true");
}
}
}
}
示例2: GivenAModuleOnThePage
public void GivenAModuleOnThePage(string moduleName, Table permissions)
{
var controller = new ModuleController();
var modules = controller.GetTabModules(Page.TabID);
var module = modules.Where(m => m.Value.ModuleDefinition.FriendlyName == moduleName);
if (!module.Any())
{
AddModuleToPage(Page, GetModuleDefinition(moduleName, moduleName), moduleName, "", true);
}
}
示例3: GetAdmin
public GetAdminPayload GetAdmin(int tabId, int moduleId)
{
if (ValidateAuthentication() && HasPermission(moduleId))
{
ModuleController mc = new ModuleController();
List<Modules> modules = mc.GetTabModules(tabId).Where(x => x.Value.IsDeleted == false && x.Value.ModuleID != moduleId)
.Select(x => new Modules() {ModuleId = x.Key, Name = x.Value.ModuleTitle}).ToList();
return new GetAdminPayload {CheckValues = DataController.GetChecks(moduleId),Modules = modules};
}
return null;
}
示例4: 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;
}
示例5: 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";
}
}
示例6: 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;
}
示例7: AddHostPage
private static void AddHostPage(int parentId, string tabPath, string moduleFriendlyName, string tabName, string tabDescription, string smallIcon, string largeIcon, bool isVisible = true)
{
var tabController = new TabController();
var moduleController = new ModuleController();
TabInfo hostTab;
// Get the module definition
var moduleDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName(moduleFriendlyName);
// Add pages
var tabId = TabController.GetTabByTabPath(Null.NullInteger, tabPath, Null.NullString);
if (tabId == Null.NullInteger)
{
//Add host page
hostTab = Upgrade.AddHostPage(tabName, tabDescription, smallIcon, largeIcon, isVisible);
hostTab.ParentId = parentId;
tabController.UpdateTab(hostTab);
//Add module to page
Upgrade.AddModuleToPage(hostTab, moduleDef.ModuleDefID, tabName, largeIcon, true);
}
else
{
hostTab = tabController.GetTab(tabId, Null.NullInteger, false);
foreach (
var kvp in
moduleController.GetTabModules(tabId)
.Where(kvp => kvp.Value.DesktopModule.ModuleName == moduleFriendlyName))
{
// Remove previous module instance
moduleController.DeleteTabModule(tabId, kvp.Value.ModuleID, false);
break;
}
//Add module to page
Upgrade.AddModuleToPage(hostTab, moduleDef.ModuleDefID, tabName, largeIcon, true);
}
}
示例8: AddHostPage
public void AddHostPage(int parentId, string tabPath, string moduleFriendlyName, string tabName, string tabDescription, string smallIcon, string largeIcon)
{
var tabController = new TabController();
var moduleController = new ModuleController();
TabInfo hostTab;
//Get web servers module
ModuleDefinitionInfo moduleDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName(moduleFriendlyName);
//Add Pages under Advanced Features Tab
int tabId = TabController.GetTabByTabPath(Null.NullInteger, tabPath, Null.NullString);
if (tabId == Null.NullInteger)
{
//Add host page
hostTab = Upgrade.AddHostPage(tabName, tabDescription, smallIcon, largeIcon, true);
hostTab.ParentId = parentId;
tabController.UpdateTab(hostTab);
//Add module to page
Upgrade.AddModuleToPage(hostTab, moduleDef.ModuleDefID, tabName, largeIcon, true);
}
else
{
hostTab = tabController.GetTab(tabId, Null.NullInteger, false);
foreach (var kvp in moduleController.GetTabModules(tabId))
{
if (kvp.Value.DesktopModule.ModuleName == "ProfessionalPreview")
{
//Preview module so hard delete
moduleController.DeleteTabModule(tabId, kvp.Value.ModuleID, false);
break;
}
}
//Add module to page
Upgrade.AddModuleToPage(hostTab, moduleDef.ModuleDefID, tabName, largeIcon, true);
}
}
示例9: OnInit
protected override void OnInit (EventArgs e)
{
base.OnInit (e);
var mctrl = new ModuleController ();
var docModules = new List<ModuleInfo>();
// get all document modules (R7.Documents and DNN Documents)
foreach (var module in mctrl.GetTabModules (TabId).Values)
{
var mdef = module.ModuleDefinition.DefinitionName.ToLowerInvariant();
if (module.ModuleID != ModuleId && !module.IsDeleted && (mdef == "r7.documents" || mdef == "documents"))
docModules.Add (module);
}
// fill modules combo
comboModule.AddItem (LocalizeString ("NotSelected.Text"), Null.NullInteger.ToString ());
foreach (var docModule in docModules)
comboModule.AddItem (docModule.ModuleTitle, docModule.ModuleID.ToString());
// set Cancel button link
linkCancel.NavigateUrl = Globals.NavigateURL ();
}
示例10: UpgradeToVersion500
private static void UpgradeToVersion500()
{
var portalController = new PortalController();
ArrayList portals = portalController.GetPortals();
var tabController = new TabController();
//Add Edit Permissions for Admin Tabs to legacy portals
var permissionController = new PermissionController();
ArrayList permissions = permissionController.GetPermissionByCodeAndKey("SYSTEM_TAB", "EDIT");
int permissionId = -1;
if (permissions.Count == 1)
{
var permission = permissions[0] as PermissionInfo;
if (permission != null)
{
permissionId = permission.PermissionID;
}
foreach (PortalInfo portal in portals)
{
var adminTab = tabController.GetTab(portal.AdminTabId, portal.PortalID, true);
if (adminTab != null)
{
var tabPermission = new TabPermissionInfo {TabID = adminTab.TabID, PermissionID = permissionId, AllowAccess = true, RoleID = portal.AdministratorRoleId};
if (!TabPermissionExists(tabPermission, portal.PortalID))
{
adminTab.TabPermissions.Add(tabPermission);
}
//Save Tab Permissions to Data Base
TabPermissionController.SaveTabPermissions(adminTab);
foreach (var childTab in TabController.GetTabsByParent(portal.AdminTabId, portal.PortalID))
{
tabPermission = new TabPermissionInfo {TabID = childTab.TabID, PermissionID = permissionId, AllowAccess = true, RoleID = portal.AdministratorRoleId};
if (!TabPermissionExists(tabPermission, portal.PortalID))
{
childTab.TabPermissions.Add(tabPermission);
}
//Save Tab Permissions to Data Base
TabPermissionController.SaveTabPermissions(childTab);
}
}
}
}
//Update Host/Admin modules Visibility setting
bool superTabProcessed = Null.NullBoolean;
var moduleController = new ModuleController();
foreach (PortalInfo portal in portals)
{
if (!superTabProcessed)
{
//Process Host Tabs
foreach (TabInfo childTab in TabController.GetTabsByParent(portal.SuperTabId, Null.NullInteger))
{
foreach (ModuleInfo tabModule in moduleController.GetTabModules(childTab.TabID).Values)
{
tabModule.Visibility = VisibilityState.None;
moduleController.UpdateModule(tabModule);
}
}
}
//Process Portal Tabs
foreach (TabInfo childTab in TabController.GetTabsByParent(portal.AdminTabId, portal.PortalID))
{
foreach (ModuleInfo tabModule in moduleController.GetTabModules(childTab.TabID).Values)
{
tabModule.Visibility = VisibilityState.None;
moduleController.UpdateModule(tabModule);
}
}
}
//Upgrade PortalDesktopModules to support new "model"
permissions = permissionController.GetPermissionByCodeAndKey("SYSTEM_DESKTOPMODULE", "DEPLOY");
if (permissions.Count == 1)
{
var permission = permissions[0] as PermissionInfo;
if (permission != null)
{
permissionId = permission.PermissionID;
}
foreach (PortalInfo portal in portals)
{
foreach (DesktopModuleInfo desktopModule in DesktopModuleController.GetDesktopModules(Null.NullInteger).Values)
{
if (!desktopModule.IsPremium)
{
//Parse the permissions
var deployPermissions = new DesktopModulePermissionCollection();
DesktopModulePermissionInfo deployPermission;
// if Not IsAdmin add Registered Users
if (!desktopModule.IsAdmin)
{
deployPermission = new DesktopModulePermissionInfo {PermissionID = permissionId, AllowAccess = true, RoleID = portal.RegisteredRoleId};
deployPermissions.Add(deployPermission);
}
//.........这里部分代码省略.........
示例11: LoadTabModules
private List<ModuleInfo> LoadTabModules()
{
var moduleCtl = new ModuleController();
var moduleList = new List<ModuleInfo>();
//Check if we have module scope
if (ModuleId > Null.NullInteger)
{
ModuleInfo sourceModule = moduleCtl.GetModule(ModuleId, TabId);
if (sourceModule.LocalizedModules != null)
{
foreach (ModuleInfo localizedModule in sourceModule.LocalizedModules.Values)
{
moduleList.Add(localizedModule);
}
}
}
else
{
foreach (ModuleInfo m in moduleCtl.GetTabModules(TabId).Values)
{
if (!m.IsDeleted)
{
moduleList.Add(m);
if (m.LocalizedModules != null)
{
foreach (ModuleInfo localizedModule in m.LocalizedModules.Values)
{
moduleList.Add(localizedModule);
}
}
}
}
}
return moduleList;
}
示例12: GrdModulesNeedDataSource
protected void GrdModulesNeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
var lst = new List<ModuleInfo>();
if (ctlPages.SelectedNode != null)
{
var tabid = Convert.ToInt32(ctlPages.SelectedNode.Value);
var moduleController = new ModuleController();
var dic = moduleController.GetTabModules(tabid);
lst.AddRange(dic.Values.Where(objModule => objModule.IsDeleted == false));
}
grdModules.DataSource = lst;
}
示例13: LoadTabModules
private List<ModuleInfo> LoadTabModules(int TabID)
{
var moduleCtl = new ModuleController();
var moduleList = new List<ModuleInfo>();
foreach (var m in moduleCtl.GetTabModules(TabID).Values)
{
if (TabPermissionController.CanAddContentToPage() && !m.IsDeleted && !m.AllTabs)
{
moduleList.Add(m);
}
}
return moduleList;
}
示例14: SerializeTabs
/// <summary>
/// Serializes all portal Tabs
/// </summary>
/// <param name="xmlTemplate">Reference to XmlDocument context</param>
/// <param name="nodeTabs">Node to add the serialized objects</param>
/// <param name="objportal">Portal to serialize</param>
/// <param name="hRoles">A hastable with all serialized roles</param>
/// <remarks>
/// Only portal tabs will be exported to the template, Admin tabs are not exported.
/// On each tab, all modules will also be exported.
/// </remarks>
/// <history>
/// [VMasanas] 23/09/2004 Created
/// </history>
public void SerializeTabs( XmlDocument xmlTemplate, XmlNode nodeTabs, PortalInfo objportal, Hashtable hRoles )
{
TabController objtabs = new TabController();
//supporting object to build the tab hierarchy
Hashtable hTabs = new Hashtable();
XmlSerializer xserTabs = new XmlSerializer( typeof( TabInfo ) );
foreach( TabInfo objtab in objtabs.GetTabs( objportal.PortalID ) )
{
//if not an admin tab & not deleted
if( objtab.TabOrder < 10000 && ! objtab.IsDeleted )
{
StringWriter sw = new StringWriter();
xserTabs.Serialize( sw, objtab );
XmlDocument xmlTab = new XmlDocument();
xmlTab.LoadXml( sw.GetStringBuilder().ToString() );
XmlNode nodeTab = xmlTab.SelectSingleNode( "tab" );
nodeTab.Attributes.Remove( nodeTab.Attributes["xmlns:xsd"] );
nodeTab.Attributes.Remove( nodeTab.Attributes["xmlns:xsi"] );
XmlNode newnode;
if( objtab.TabID == objportal.SplashTabId )
{
newnode = xmlTab.CreateElement( "tabtype" );
newnode.InnerXml = "splashtab";
nodeTab.AppendChild( newnode );
}
else if( objtab.TabID == objportal.HomeTabId )
{
newnode = xmlTab.CreateElement( "tabtype" );
newnode.InnerXml = "hometab";
nodeTab.AppendChild( newnode );
}
else if( objtab.TabID == objportal.UserTabId )
{
newnode = xmlTab.CreateElement( "tabtype" );
newnode.InnerXml = "usertab";
nodeTab.AppendChild( newnode );
}
else if( objtab.TabID == objportal.LoginTabId )
{
newnode = xmlTab.CreateElement( "tabtype" );
newnode.InnerXml = "logintab";
nodeTab.AppendChild( newnode );
}
if( ! Null.IsNull( objtab.ParentId ) )
{
newnode = xmlTab.CreateElement( "parent" );
newnode.InnerXml = Server.HtmlEncode( hTabs[objtab.ParentId].ToString() );
nodeTab.AppendChild( newnode );
// save tab as: ParentTabName/CurrentTabName
hTabs.Add( objtab.TabID, hTabs[objtab.ParentId] + "/" + objtab.TabName );
}
else
{
// save tab as: CurrentTabName
hTabs.Add( objtab.TabID, objtab.TabName );
}
// Serialize modules
XmlNode nodePanes;
nodePanes = nodeTab.AppendChild( xmlTab.CreateElement( "panes" ) );
ModuleController objmodules = new ModuleController();
DesktopModuleController objDesktopModules = new DesktopModuleController();
ModuleDefinitionController objModuleDefController = new ModuleDefinitionController();
XmlSerializer xserModules = new XmlSerializer( typeof( ModuleInfo ) );
Dictionary<int, ModuleInfo> dict = objmodules.GetTabModules(objtab.TabID);
foreach( KeyValuePair<int, ModuleInfo> pair in dict )
{
ModuleInfo objmodule = pair.Value;
if (!objmodule.IsDeleted)
{
sw = new StringWriter();
xserModules.Serialize(sw, objmodule);
XmlDocument xmlModule = new XmlDocument();
xmlModule.LoadXml(sw.GetStringBuilder().ToString());
XmlNode nodeModule = xmlModule.SelectSingleNode("module");
nodeModule.Attributes.Remove(nodeModule.Attributes["xmlns:xsd"]);
nodeModule.Attributes.Remove(nodeModule.Attributes["xmlns:xsi"]);
//.........这里部分代码省略.........
示例15: publishPageButton_Click
protected void publishPageButton_Click(object sender, EventArgs e)
{
var tabCtrl = new TabController();
var modCtrl = new ModuleController();
//First mark all modules as translated
foreach (ModuleInfo m in modCtrl.GetTabModules(Tab.TabID).Values)
{
modCtrl.UpdateTranslationStatus(m, true);
}
//First mark tab as translated
tabCtrl.UpdateTranslationStatus(Tab, true);
//Next publish Tab (update Permissions)
tabCtrl.PublishTab(Tab);
//Redirect to refresh page (and skinobjects)
Response.Redirect(Request.RawUrl, true);
}