本文整理汇总了C#中DotNetNuke.Entities.Tabs.TabController.UpdateTab方法的典型用法代码示例。如果您正苦于以下问题:C# TabController.UpdateTab方法的具体用法?C# TabController.UpdateTab怎么用?C# TabController.UpdateTab使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Entities.Tabs.TabController
的用法示例。
在下文中一共展示了TabController.UpdateTab方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
}
示例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: 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);
}
}
示例4: 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);
}
}
示例5: UpdateTabName
private void UpdateTabName(int tabId, string newName)
{
var tc = new TabController();
var tab = tc.GetTab(tabId, PortalId, false);
tab.TabName = newName;
tc.UpdateTab(tab);
}
示例6: OnInit
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
jQuery.RequestDnnPluginsRegistration();
cboCacheProvider.SelectedIndexChanged += cboCacheProvider_Change;
cboCopyPage.SelectedIndexChanged += cboCopyPage_SelectedIndexChanged;
cboFolders.SelectedIndexChanged += cboFolders_SelectedIndexChanged;
cboParentTab.SelectedIndexChanged += cboParentTab_SelectedIndexChanged;
cmdClearAllPageCache.Click += cmdClearAllPageCache_Click;
cmdClearPageCache.Click += cmdClearPageCache_Click;
cmdCopyPerm.Click += cmdCopyPerm_Click;
cmdCopySkin.Click += cmdCopySkin_Click;
cmdDelete.Click += cmdDelete_Click;
cmdUpdate.Click += cmdUpdate_Click;
editDefaultCultureButton.Command += editDefaultCultureButton_Command;
localizePagesButton.Click += localizePagesButton_Click;
moduleLocalization.ModuleLocalizationChanged += moduleLocalization_ModuleLocalizationChanged;
tabLocalization.TabLocalizationChanged += tabLocalization_ModuleLocalizationChanged;
publishPageButton.Click += publishPageButton_Click;
rbInsertPosition.SelectedIndexChanged += rbInsertPosition_SelectedIndexChanged;
rblCacheIncludeExclude.SelectedIndexChanged += rblCacheIncludeExclude_Change;
readyForTranslationButton.Click += readyForTranslationButton_Click;
cmdSubmitTranslation.Click += submitTranslation_Click;
cmdCancelTranslation.Click += cancelTranslation_Click;
translatedCheckbox.CheckedChanged += translatedCheckbox_CheckedChanged;
viewDefaultCultureButton.Command += viewDefaultCultureButton_Command;
// Verify that the current user has access to edit this module
if (!TabPermissionController.HasTabPermission("ADD,EDIT,COPY,DELETE,MANAGE"))
{
Response.Redirect(Globals.AccessDeniedURL(), true);
}
if ((Request.QueryString["action"] != null))
{
_strAction = Request.QueryString["action"].ToLower();
}
if (Tab.ContentItemId == Null.NullInteger && Tab.TabID != Null.NullInteger)
{
var tabCtl = new TabController();
//This tab does not have a valid ContentItem
tabCtl.CreateContentItem(Tab);
tabCtl.UpdateTab(Tab);
}
moduleLocalization.TabId = TabId;
moduleLocalization.ShowEditColumn = false;
DisableHostAdminFunctions();
}
示例7: UpdateTab
private void UpdateTab(TabInfo tab)
{
var tc = new TabController();
if (tab != null)
{
tc.UpdateTab(tab);
}
}
示例8: CmdUpdateClick
protected void CmdUpdateClick(object sender, EventArgs e)
{
//Often times grid stays but node is not selected (e.g. when node is deleted or update page is clicked)
if (ctlPages.SelectedNode == null)
return;
var intTab = Convert.ToInt32(ctlPages.SelectedNode.Value);
var tabcontroller = new TabController();
var tab = tabcontroller.GetTab(intTab, PortalId, true);
this.Page.Validate();
if (!this.Page.IsValid)
return;
if (tab != null && TabPermissionController.CanManagePage(tab))
{
tab.TabName = txtName.Text;
tab.Title = txtTitle.Text;
tab.Description = txtDescription.Text;
tab.KeyWords = txtKeywords.Text;
tab.IsVisible = chkVisible.Checked;
tab.DisableLink = chkDisabled.Checked;
tab.IsDeleted = false;
tab.Url = ctlURL.Url;
tabcontroller.UpdateTabSetting(tab.TabID, "LinkNewWindow", ctlURL.NewWindow.ToString());
tabcontroller.UpdateTabSetting(tab.TabID, "AllowIndex", chkAllowIndex.Checked.ToString());
tab.SkinSrc = drpSkin.SelectedValue;
tab.ContainerSrc = drpContainer.SelectedValue;
tab.TabPath = Globals.GenerateTabPath(tab.ParentId, tab.TabName);
tab.TabPermissions.Clear();
if (tab.PortalID != Null.NullInteger)
{
tab.TabPermissions.AddRange(dgPermissions.Permissions);
}
//All validations have been done in the Page.Validate()
//Check for invalid
if (!IsValidTabName(tab.TabName))
{
return;
}
//Validate Tab Path
if (!IsValidTabPath(tab, tab.TabPath))
{
return;
}
tab.RefreshInterval = txtRefresh.Text == "" ? Null.NullInteger : Convert.ToInt32(txtRefresh.Text);
tab.SiteMapPriority = float.Parse(txtSitemapPriority.Text);
tab.PageHeadText = txtMeta.Text;
tab.IsSecure = chkSecure.Checked;
tab.PermanentRedirect = chkPermanentRedirect.Checked;
var iconFile = ctlIcon.Url;
var iconFileLarge = ctlIconLarge.Url;
tab.IconFile = iconFile;
tab.IconFileLarge = iconFileLarge;
tab.Terms.Clear();
tab.Terms.AddRange(termsSelector.Terms);
tabcontroller.UpdateTab(tab);
ShowSuccessMessage(string.Format(Localization.GetString("TabUpdated", LocalResourceFile), tab.TabName));
BindTree();
//keep the tab selected
SelectedNode = intTab.ToString(CultureInfo.InvariantCulture);
ctlPages.FindNodeByValue(SelectedNode).Selected = true;
ctlPages.FindNodeByValue(SelectedNode).ExpandParentNodes();
}
}
示例9: CtlPagesNodeEdit
protected void CtlPagesNodeEdit(object sender, RadTreeNodeEditEventArgs e)
{
var objTabController = new TabController();
var objTab = objTabController.GetTab(int.Parse(e.Node.Value), PortalId, false);
if (objTab != null && TabPermissionController.CanManagePage(objTab))
{
//Check for invalid
string invalidType;
if (!TabController.IsValidTabName(e.Text, out invalidType))
{
ShowErrorMessage(string.Format(Localization.GetString(invalidType, LocalResourceFile), e.Text));
e.Node.Text = objTab.TabName;
e.Text = objTab.TabName;
}
else if (!IsValidTabPath(objTab, Globals.GenerateTabPath(objTab.ParentId, e.Text)))
{
e.Node.Text = objTab.TabName;
e.Text = objTab.TabName;
}
else
{
objTab.TabName = e.Text;
objTabController.UpdateTab(objTab);
}
BindTreeAndShowTab(objTab.TabID);
}
}
示例10: AdvancedUrlRewriter_ReplaceChars
public void AdvancedUrlRewriter_ReplaceChars(Dictionary<string, string> testFields)
{
var settings = UrlTestFactoryClass.GetSettings("UrlRewrite", testFields["TestName"]);
string testPageName = testFields.GetValue("TestPageName");
TabInfo tab = null;
if (!String.IsNullOrEmpty(testPageName))
{
var tabName = testFields["Page Name"];
var tc = new TabController();
tab = tc.GetTabByName(tabName, PortalId);
tab.TabName = testPageName;
tc.UpdateTab(tab);
//Refetch tab from DB
tab = tc.GetTab(tab.TabID, tab.PortalID, false);
}
settings.PortalId = PortalId;
string autoAscii = testFields.GetValue("AutoAscii");
if (!String.IsNullOrEmpty(autoAscii))
{
settings.AutoAsciiConvert = Convert.ToBoolean(autoAscii);
}
TestUtil.GetReplaceCharDictionary(testFields, settings.ReplaceCharacterDictionary);
SetDefaultAlias(testFields);
ExecuteTestForTab(tab, settings, testFields);
}
示例11: OnInit
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
jQuery.RequestDnnPluginsRegistration();
ClientResourceManager.RegisterScript(Page, "~/Resources/Shared/Scripts/dnn.extensions.js", FileOrder.Js.DefaultPriority);
ClientResourceManager.RegisterScript(Page, "~/Resources/Shared/scripts/dnn.jquery.extensions.js", FileOrder.Js.DefaultPriority + 1);
ClientResourceManager.RegisterScript(Page, "~/DesktopModules/Admin/Tabs/ClientScripts/dnn.PageUrl.js", FileOrder.Js.DefaultPriority + 2);
ServicesFramework.Instance.RequestAjaxAntiForgerySupport();
cboCacheProvider.SelectedIndexChanged += cboCacheProvider_Change;
cboCopyPage.SelectionChanged += cboCopyPage_SelectedIndexChanged;
cboFolders.SelectionChanged += cboFolders_SelectedIndexChanged;
cboParentTab.SelectionChanged += cboParentTab_SelectedIndexChanged;
cmdClearAllPageCache.Click += cmdClearAllPageCache_Click;
cmdClearPageCache.Click += cmdClearPageCache_Click;
cmdCopyPerm.Click += cmdCopyPerm_Click;
cmdCopySkin.Click += cmdCopySkin_Click;
cmdDelete.Click += cmdDelete_Click;
cmdUpdate.Click += cmdUpdate_Click;
rblCacheIncludeExclude.SelectedIndexChanged += rblCacheIncludeExclude_Change;
readyForTranslationButton.Click += readyForTranslationButton_Click;
cmdSubmitTranslation.Click += submitTranslation_Click;
cmdCancelTranslation.Click += cancelTranslation_Click;
// Verify that the current user has access to edit this module
if (!TabPermissionController.HasTabPermission("ADD,EDIT,COPY,DELETE,MANAGE"))
{
Response.Redirect(Globals.AccessDeniedURL(), true);
}
if ((Request.QueryString["action"] != null))
{
_strAction = Request.QueryString["action"].ToLower();
}
if (Tab.ContentItemId == Null.NullInteger && Tab.TabID != Null.NullInteger)
{
var tabCtl = new TabController();
//This tab does not have a valid ContentItem
tabCtl.CreateContentItem(Tab);
tabCtl.UpdateTab(Tab);
}
DisableHostAdminFunctions();
if (PortalSettings.ActiveTab.IsSuperTab || PortalSecurity.IsInRole("Administrators") || PortalSettings.ActiveTab.ParentId == Null.NullInteger)
{
// Add Non Specified if user is Admin or if current tab is already on the top level
cboParentTab.UndefinedItem = new ListItem(SharedConstants.Unspecified, string.Empty);
}
cboCopyPage.UndefinedItem = new ListItem(SharedConstants.Unspecified, string.Empty);
PortalAliasCaption.Text = PortalAlias.HTTPAlias;
PortalAliasCaption.ToolTip = PortalAlias.HTTPAlias;
UrlContainer.Attributes.Add(HtmlTextWriterAttribute.Class.ToString(), "um-page-url-container");
}
示例12: AddProfessionalPreviewPage
private static void AddProfessionalPreviewPage(int parentId, string tabPath, string moduleFriendlyName, string tabName, string tabDescription, string smallIcon, string largeIcon)
{
DnnInstallLogger.InstallLogInfo(Localization.Localization.GetString("LogStart", Localization.Localization.GlobalResourceFile) + "AddProfessionalPreviewPage:" + parentId);
var tabController = new TabController();
TabInfo hostTab;
//Get web servers module
ModuleDefinitionInfo moduleDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName(moduleFriendlyName);
//Add Pages under Professional Features Tab
int tabId = TabController.GetTabByTabPath(Null.NullInteger, tabPath, Null.NullString);
if (tabId == Null.NullInteger)
{
//Add host page
hostTab = AddHostPage(tabName, tabDescription, smallIcon, largeIcon, true);
hostTab.ParentId = parentId;
tabController.UpdateTab(hostTab);
//Add module to page
AddModuleToPage(hostTab, moduleDef.ModuleDefID, tabName, largeIcon, true);
}
}
示例13: AddLinkedProfessionalPreviewPage
private static void AddLinkedProfessionalPreviewPage(int parentId, string tabPath, string url, string tabName, string tabDescription, string smallIcon, string largeIcon)
{
DnnInstallLogger.InstallLogInfo(Localization.Localization.GetString("LogStart", Localization.Localization.GlobalResourceFile) + "AddLinkedProfessionalPreviewPage:" + parentId);
var tabController = new TabController();
TabInfo newTab;
if (TabController.GetTabByTabPath(Null.NullInteger, tabPath, Null.NullString) == Null.NullInteger)
{
newTab = AddHostPage(tabName, tabDescription, smallIcon, largeIcon, true);
newTab.ParentId = parentId;
newTab.Url = url;
tabController.UpdateTab(newTab);
}
}
示例14: UpgradeToVersion610
private static void UpgradeToVersion610()
{
AddModuleCategories();
//update languages module
int moduleDefId = GetModuleDefinition("Languages", "Languages");
AddModuleControl(moduleDefId, "LocalizePages", "Localize Pages", "DesktopModules/Admin/Languages/LocalizePages.ascx", "~/images/icon_language_32px.gif", SecurityAccessLevel.Edit, 0, Null.NullString, true);
//add store control
moduleDefId = AddModuleDefinition("Extensions", "", "Extensions");
AddModuleControl(moduleDefId, "Store", "Store Details", "DesktopModules/Admin/Extensions/Store.ascx", "~/images/icon_extensions_32px.png", SecurityAccessLevel.Host, 0);
EnableModalPopUps();
var tabController = new TabController();
var tab = tabController.GetTabByName("Portals", Null.NullInteger);
tab.TabName = "Site Management";
tabController.UpdateTab(tab);
var moduleController = new ModuleController();
foreach (var module in moduleController.GetTabModules(tab.TabID).Values)
{
if (module.ModuleTitle == "Portals")
{
module.ModuleTitle = "Site Management";
moduleController.UpdateModule(module);
}
}
//Add List module to Admin page of every portal
ModuleDefinitionInfo mDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("Lists");
if (mDef != null)
{
AddAdminPages("Lists",
"Manage common lists",
"~/Icons/Sigma/Lists_16X16_Standard.png",
"~/Icons/Sigma/Lists_32X32_Standard.png",
true,
mDef.ModuleDefID,
"Lists",
"~/Icons/Sigma/Lists_16X16_Standard.png",
true);
}
//update DotNetNuke.Portals' friend name to 'Sites'.
var portalPackage = PackageController.GetPackageByName("DotNetNuke.Portals");
if(portalPackage != null)
{
portalPackage.FriendlyName = "Sites";
PackageController.SavePackage(portalPackage);
}
//add mobile preview control
AddModuleControl(Null.NullInteger, "MobilePreview", "Mobile Preview", "DesktopModules/Admin/MobilePreview/Preview.ascx", string.Empty, SecurityAccessLevel.Admin, Null.NullInteger);
}
示例15: UpgradeToVersion613
private static void UpgradeToVersion613()
{
//Rename admin pages page's title to 'Page Management'.
var portalController = new PortalController();
foreach (PortalInfo portal in portalController.GetPortals())
{
var tabController = new TabController();
var pagesTabId = TabController.GetTabByTabPath(portal.PortalID, "//Admin//Pages", Null.NullString);
if (pagesTabId != Null.NullInteger)
{
var pagesTab = tabController.GetTab(pagesTabId, portal.PortalID, false);
if (pagesTab != null && pagesTab.Title == "Pages")
{
pagesTab.Title = "Page Management";
tabController.UpdateTab(pagesTab);
}
}
}
}