private void OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } switch (e.Tab.TabName.ToLowerCSafe()) { case "account.customfields": // Check if contact has any custom fields var formInfo = FormHelper.GetFormInfo("OM.Account", false); if (!formInfo.GetFields(true, false, false).Any()) { e.Tab = null; } break; case "account.contacts": // Display contacts tab only if user is authorized to read contacts if (!ContactHelper.AuthorizedReadContact(Account.AccountSiteID, false) && !AccountHelper.AuthorizedReadAccount(Account.AccountSiteID, false)) { e.Tab = null; } break; case "account.merge": case "account.subsidiaries": if (Account.AccountMergedWithAccountID != 0) { e.Tab = null; } break; } }
void OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } var tab = e.Tab; switch (tab.TabName.ToLowerCSafe()) { case "webpart.code": if (!ValidationHelper.GetBoolean(SettingsHelper.AppSettings["CMSDevelopmentMode"], false)) { e.Tab = null; } break; case "webpart.theme": var wpi = Control.UIContext.EditedObject as WebPartInfo; if ((wpi != null) && StorageHelper.IsExternalStorage(wpi.GetThemePath())) { e.Tab = null; } break; } }
/// <summary> /// Tabs the elem_ on tab created. /// </summary> protected void tabElem_OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } var tab = e.Tab; var element = e.UIElement; switch (element.ElementName.ToLowerCSafe()) { case "widgetproperties.variant": { bool isNewVariant = QueryHelper.GetBoolean("isnewvariant", false); int variantId = QueryHelper.GetInteger("variantid", 0); // Set the variant mode into the tab url if ((variantMode != VariantModeEnum.None) && !string.IsNullOrEmpty(tab.RedirectUrl)) { tab.RedirectUrl = URLHelper.AddParameterToUrl(tab.RedirectUrl, "variantmode", VariantModeFunctions.GetVariantModeString(variantMode)); } if ((variantId <= 0) || isNewVariant) { e.Tab = null; return; } } break; } }
/// <summary> /// Tabs the elem_ on tab created. /// </summary> protected void tabElem_OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } var tab = e.Tab; var element = e.UIElement; if (!String.IsNullOrEmpty(tabsElem.JavaScriptHandler)) { tab.OnClientClick = "if (" + tabsElem.JavaScriptHandler + ") { " + tabsElem.JavaScriptHandler + "(" + ScriptHelper.GetString(element.ElementName) + "); } "; } switch (element.ElementName.ToLowerCSafe()) { case "webpartzoneproperties.variant": { bool isNewVariant = QueryHelper.GetBoolean("isnewvariant", false); int variantId = QueryHelper.GetInteger("variantid", 0); if ((variantId <= 0) || isNewVariant) { e.Tab = null; } } break; } }
/// <summary> /// Appends additional query parameters. /// </summary> protected void Control_OnTabCreated(object sender, TabCreatedEventArgs e) { if ((e.Tab != null) && !String.IsNullOrEmpty(deviceName)) { e.Tab.RedirectUrl = URLHelper.AddParameterToUrl(e.Tab.RedirectUrl, "devicename", deviceName); e.Tab.RedirectUrl = ApplicationUrlHelper.AppendDialogHash(e.Tab.RedirectUrl); } }
protected void tabElem_OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } var tab = e.Tab; var element = e.UIElement; switch (element.ElementName.ToLowerCSafe()) { case "webpartproperties.datasource": if ((type != WebPartTypeEnum.BasicViewer) || isNew) { e.Tab = null; return; } break; case "webpartproperties.viewer": if ((type != WebPartTypeEnum.DataSource) || isNew) { e.Tab = null; return; } break; case "webpartproperties.variant": { if ((variantId <= 0) || isNew || isNewVariant) { e.Tab = null; return; } } break; case "webpartzoneproperties.variant": if ((zoneVariantId <= 0) || isNew) { e.Tab = null; return; } break; case "webpartproperties.layout": if (isNew || isNewVariant) { e.Tab = null; return; } // Hide loader, it appears on wrong position because of small frame e.Tab.OnClientClick = "if (window.Loader) { window.Loader.hide(); }"; break; } }
/// <summary> /// Fires when a tab is created and hides ui elements which should not be visible for content only classes. /// </summary> private void OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } if (DocumentUIHelper.IsElementHiddenForNode(e.UIElement, node)) { e.Tab = null; } }
protected void OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } var tab = e.Tab; var element = e.UIElement; var elementName = element.ElementName.ToLower(); var ti = TransInfo; var hier = (ti != null) && ti.TransformationIsHierarchical; switch (elementName) { case "transformation.transformations": if (!hier) { e.Tab = null; } break; case "transformation.general": if (hier) { // Hide general tab when only code editing enabled var editOnlyCode = QueryHelper.GetBoolean("editonlycode", false); if (editOnlyCode) { e.Tab = null; return; } // Get original query string var query = URLHelper.GetQuery(tab.RedirectUrl); var url = URLHelper.AppendQuery("~/CMSModules/DocumentTypes/Pages/Development/HierarchicalTransformations_General.aspx", query); url = Control.HandleTabQueryString(url, element); tab.RedirectUrl = URLHelper.ResolveUrl(url); } break; case "transformation.theme": if (hier) { e.Tab = null; } break; } }
/// <summary> /// Appends additional query parameters. /// </summary> protected void tabControl_OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } var tab = e.Tab; if (!String.IsNullOrEmpty(AdditionalTabQuery)) { tab.RedirectUrl = URLHelper.AppendQuery(tab.RedirectUrl, AdditionalTabQuery); } }
protected void Header_OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } switch (e.TabIndex) { case 1: if ((!ModuleEntryManager.IsModuleLoaded(ModuleName.ONLINEMARKETING) && ResourceSiteInfoProvider.IsResourceOnSite(ModuleName.ONLINEMARKETING, SiteContext.CurrentSiteName))) { // Hide tab if module is not loaded e.Tab = null; } break; } }
/// <summary> /// Event handling creation of tabs. /// </summary> private void OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } var tab = e.Tab; if (tab.TabName.ToLowerCSafe().EqualsCSafe("editgroupcustomfields")) { // Check custom fields of group FormInfo formInfo = FormHelper.GetFormInfo(PredefinedObjectType.GROUP, false); if (!formInfo.GetFormElements(true, false, true).Any()) { e.Tab = null; } } }
protected void OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } var tab = e.Tab; var element = e.UIElement; var manager = DocumentManager; var node = manager.Node; bool splitViewSupported = PortalContext.ViewMode != ViewModeEnum.EditLive; string elementName = element.ElementName.ToLowerCSafe(); if (DocumentUIHelper.IsElementHiddenForNode(element, node)) { e.Tab = null; return; } switch (elementName) { case "properties.languages": splitViewSupported = false; break; case "properties.security": case "properties.relateddocs": case "properties.linkeddocs": splitViewSupported = false; break; } // Ensure split view mode if (splitViewSupported && PortalUIHelper.DisplaySplitMode) { tab.RedirectUrl = DocumentUIHelper.GetSplitViewUrl(tab.RedirectUrl); } }
private void OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } switch (e.Tab.TabName.ToLowerCSafe()) { case "contactcustomfields": // Check if contact has any custom fields var formInfo = FormHelper.GetFormInfo("OM.Contact", false); if (!formInfo.GetFields(true, false, false).Any()) { e.Tab = null; } break; case "contactaccounts": if (!AccountHelper.AuthorizedReadAccount(Contact.ContactSiteID, false) && !ContactHelper.AuthorizedReadContact(Contact.ContactSiteID, false)) { e.Tab = null; } break; case "ips": if (!ActivitySettingsHelper.IPLoggingEnabled(SiteContext.CurrentSiteName)) { e.Tab = null; } break; case "contactprocesses": // Marketing automation if (!WorkflowInfoProvider.IsMarketingAutomationAllowed()) { e.Tab = null; } break; } }
void OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } var tab = e.Tab; switch (tab.TabName.ToLowerCSafe()) { case "webpart.theme": var wpi = Control.UIContext.EditedObject as WebPartInfo; if ((wpi != null) && StorageHelper.IsExternalStorage(wpi.GetThemePath())) { e.Tab = null; } break; } }
protected void tabElem_OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } var tab = e.Tab; var element = e.UIElement; string elementName = element.ElementName.ToLowerCSafe(); if (elementName.StartsWithCSafe("validation.") && (elementName.Substring("validation.".Length) == selected)) { selectedTabIndex = e.TabIndex; } if (tab.RedirectUrl != null) { tab.RedirectUrl = URLHelper.AppendQuery(URLHelper.RemoveQuery(tab.RedirectUrl), RequestContext.CurrentQueryString); } }
private void OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } var element = e.UIElement; string elem = element.ElementName.ToLowerCSafe(); switch (elem) { case "validation": // Show validate only when not disabled if (QueryHelper.GetBoolean("hidevalidate", false)) { e.Tab = null; } break; } }
/// <summary> /// Fires when a tab is created /// </summary> private void OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } string mode = null; var element = e.UIElement; // Hides UI element if it is not relevant for edited node if (DocumentUIHelper.IsElementHiddenForNode(element, Node)) { e.Tab = null; return; } switch (element.ElementName.ToLowerInvariant()) { case "page": case "pagemvc": { mode = "edit"; } break; case "design": { if (!showDesign) { e.Tab = null; return; } mode = "design"; } break; case "editform": // Keep edit form { mode = "editform"; } break; case "product": { if (!showProductTab) { e.Tab = null; return; } mode = "product"; } break; case "masterpage": { if (!showMasterPage) { e.Tab = null; return; } mode = "masterpage"; } break; case "properties": { // Document properties mode = "properties"; } break; case "analytics": { mode = "analytics"; } break; } if (Node != null) { var tab = e.Tab; var settings = new UIPageURLSettings { Mode = mode, Node = Node, NodeID = Node.NodeID, Culture = Node.DocumentCulture, PreferredURL = tab.RedirectUrl }; tab.RedirectUrl = DocumentUIHelper.GetDocumentPageUrl(settings); tab.Text = DocumentUIHelper.GetUIElementDisplayName(element, Node); } }
protected void OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } var tab = e.Tab; var element = e.UIElement; PageTemplateInfo UITemplate = PageTemplateInfoProvider.GetPageTemplateInfo(e.UIElement.ElementPageTemplateID); var manager = DocumentManager; var node = manager.Node; bool splitViewSupported = PortalContext.ViewMode != ViewModeEnum.EditLive; string elementName = element.ElementName.ToLowerCSafe(); if (UITemplate.CodeName.ToLower().Contains("editrelationship")) { XmlDocument properties = new XmlDocument(); properties.LoadXml(e.UIElement.ElementProperties); XmlNode LeftSideMacro = properties.SelectSingleNode("/Data[1]/IsLeftSideMacro[1]"); XmlNode RightSideMacro = properties.SelectSingleNode("/Data[1]/IsRightSideMacro[1]"); XmlNode AutoHide = properties.SelectSingleNode("/Data[1]/AutoHide[1]"); if (AutoHide != null && ValidationHelper.GetBoolean(AutoHide.InnerText, false) && LeftSideMacro != null && RightSideMacro != null) { MacroResolver pageResolver = MacroResolver.GetInstance(); // Get current node's class, then full document so it has related data. int NodeID = ValidationHelper.GetInteger(URLHelper.GetQueryValue(RequestContext.RawURL, "nodeid"), 1); string Culture = DataHelper.GetNotEmpty(URLHelper.GetQueryValue(RequestContext.RawURL, "culture"), "en-US"); TreeNode CurrentDocument = CacheHelper.Cache <TreeNode>(cs => { TreeNode Document = new DocumentQuery().WhereEquals("NodeID", NodeID).Columns("ClassName").FirstOrDefault(); Document = new DocumentQuery(Document.ClassName).WhereEquals("NodeID", NodeID).Culture(Culture).FirstOrDefault(); if (cs.Cached) { cs.CacheDependency = CacheHelper.GetCacheDependency(new string[] { string.Format("node|{0}|{1}|{2}", Document.NodeSiteName, Document.NodeAliasPath, Culture, PageTemplateInfo.OBJECT_TYPE + "|byid|" + e.UIElement.ElementPageTemplateID) }); } return(Document); }, new CacheSettings(CacheHelper.CacheMinutes(SiteContext.CurrentSiteName), NodeID, Culture, e.UIElement.ElementPageTemplateID)); pageResolver.SetNamedSourceData("CurrentDocument", CurrentDocument); if (!(ValidationHelper.GetBoolean(pageResolver.ResolveMacros(LeftSideMacro.InnerText), true) || ValidationHelper.GetBoolean(pageResolver.ResolveMacros(RightSideMacro.InnerText), true))) { e.Tab = null; } } } if (DocumentUIHelper.IsElementHiddenForNode(element, node)) { e.Tab = null; return; } // Ensure split view mode if (splitViewSupported && PortalUIHelper.DisplaySplitMode) { tab.RedirectUrl = DocumentUIHelper.GetSplitViewUrl(tab.RedirectUrl); } }
protected void OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } var tab = e.Tab; var element = e.UIElement; bool splitViewSupported = false; string lowerElementName = element.ElementName.ToLowerCSafe(); switch (lowerElementName) { case "products.attachments": case "products.metadata": case "products.categories": case "products.workflow": case "products.versions": splitViewSupported = true; break; case "products.general": splitViewSupported = true; break; } switch (lowerElementName) { case "products.attachments": case "products.metadata": case "products.categories": case "products.workflow": case "products.versions": case "products.relatedproducts": // Check if editing product with its document if (NodeID <= 0) { e.Tab = null; return; } break; case "products.documents": if ((NodeID <= 0) && (ECommerceSettings.ProductsTree(SiteContext.CurrentSiteName) == ProductsTreeModeEnum.Sections)) { if (!MembershipContext.AuthenticatedUser.IsGlobalAdministrator || (sku == null) || !sku.IsGlobal) { e.Tab = null; return; } } break; case "products.preview": { // Check if editing product with its document if (NodeID <= 0) { e.Tab = null; return; } var settings = new UIPageURLSettings { Mode = "preview", NodeID = Node.NodeID, Culture = Node.DocumentCulture, Node = Node, AllowViewValidate = false }; tab.RedirectUrl = ProductUIHelper.GetProductPageUrl(settings); tab.RedirectUrl = URLHelper.AddParameterToUrl(tab.RedirectUrl, "nodeid", NodeID.ToString()); tab.RedirectUrl = URLHelper.AddParameterToUrl(tab.RedirectUrl, "showdevicesselection", "0"); } break; case "products.advanced": { tab.Expand = (NodeID <= 0); // Append product/node params to url var url = tab.RedirectUrl; url = URLHelper.AddParameterToUrl(url, "productid", ProductID.ToString()); if (Node != null) { url = URLHelper.AddParameterToUrl(url, "nodeid", Node.NodeID.ToString()); url = URLHelper.AddParameterToUrl(url, "culture", Node.DocumentCulture); } tab.RedirectUrl = url; } break; case "products.options": tab.RedirectUrl = URLHelper.AddParameterToUrl(tab.RedirectUrl, "productId", ProductID.ToString()); break; } // Add SiteId parameter to each tab if (!string.IsNullOrEmpty(tab.RedirectUrl)) { tab.RedirectUrl = URLHelper.AddParameterToUrl(tab.RedirectUrl, "siteId", siteId.ToString()); } // Ensure split view mode if ((NodeID > 0) && splitViewSupported && UIContext.DisplaySplitMode) { tab.RedirectUrl = DocumentUIHelper.GetSplitViewUrl(tab.RedirectUrl); } // Make URL absolute tab.RedirectUrl = URLHelper.GetAbsoluteUrl(tab.RedirectUrl); }
protected void OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } var tab = e.Tab; var element = e.UIElement; var node = documentManager.Node; bool splitViewSupported = false; string lowerElementName = element.ElementName.ToLowerCSafe(); // Skip some elements if editing just SKU without document binding switch (lowerElementName) { case "products.relatedproducts": if (node == null) { e.Tab = null; return; } break; case "products.documents": var displayTree = ECommerceSettings.ProductsTree(siteId) == ProductsTreeModeEnum.Sections; if ((node == null) && displayTree) { if (!MembershipContext.AuthenticatedUser.IsGlobalAdministrator || (sku == null) || !sku.IsGlobal) { e.Tab = null; return; } } break; case "products.workflow": case "products.versions": splitViewSupported = true; if ((node == null) || (documentManager.Workflow == null)) { e.Tab = null; return; } break; } // Add SiteId parameter to each tab if (!string.IsNullOrEmpty(tab.RedirectUrl) && (siteId != SiteContext.CurrentSiteID)) { tab.RedirectUrl = URLHelper.AddParameterToUrl(tab.RedirectUrl, "siteId", siteId.ToString()); } // Ensure split view mode if (splitViewSupported && UIContext.DisplaySplitMode) { tab.RedirectUrl = DocumentUIHelper.GetSplitViewUrl(tab.RedirectUrl); } }
/// <summary> /// Fires when a tab is created /// </summary> private void OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } string mode = null; var element = e.UIElement; string elem = element.ElementName.ToLowerCSafe(); // Hide other tabs for wireframe if (isWireframe && ((elem != "wireframe") && (elem != "editform"))) { e.Tab = null; return; } switch (elem) { case "page": { mode = "edit"; } break; case "design": { // Check if the design mode is enabled if (!designEnabled) { e.Tab = null; return; } mode = "design"; } break; case "wireframe": { // Check if the wireframe mode is enabled if (!hasWireframe) { e.Tab = null; return; } mode = "wireframe"; } break; case "editform": // Keep edit form { mode = "editform"; } break; case "product": { // Check if the product tab is enabled if (!showProductTab) { e.Tab = null; return; } mode = "product"; } break; case "masterpage": { // Check if master page tab is enabled if (!isMasterPage) { e.Tab = null; return; } mode = "masterpage"; } break; case "properties": { // Document properties mode = "properties"; } break; case "analytics": { // Analytics if (isWireframe) { e.Tab = null; return; } mode = "analytics"; } break; } if (Node != null) { var tab = e.Tab; var settings = new UIPageURLSettings { Mode = mode, Node = Node, NodeID = Node.NodeID, Culture = Node.DocumentCulture, PreferredURL = tab.RedirectUrl }; // Ensure correct URL tab.RedirectUrl = DocumentUIHelper.GetDocumentPageUrl(settings); } }
/// <summary> /// Event handling creation of tabs. /// </summary> private void OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } var tab = e.Tab; switch (tab.TabName.ToLowerCSafe()) { case "customfields": // Check custom fields of user { int customFields = 0; var userId = QueryHelper.GetInteger("objectid", 0); UserInfo ui = UserInfoProvider.GetUserInfo(userId); if (ui != null) { if (!MembershipContext.AuthenticatedUser.IsGlobalAdministrator && !ui.IsInSite(SiteContext.CurrentSiteName)) { URLHelper.SeeOther(UIHelper.GetInformationUrl(ResHelper.GetString("user.notinsite"))); } // Get user form information and check for visible non-system fields FormInfo formInfo = FormHelper.GetFormInfo(ui.ClassName, false); customFields = (formInfo.GetFormElements(true, false, true).Any() ? 1 : 0); // Check custom fields of user settings if needed if ((customFields == 0) && (ui.UserSettings != null)) { // Get user settings form information and check for visible non-system fields formInfo = FormHelper.GetFormInfo(ui.UserSettings.ClassName, false); customFields = (formInfo.GetFormElements(true, false, true).Any() ? 1 : 0); } } if (customFields == 0) { e.Tab = null; } } break; case "notifications": // Display notifications tab ? if (!LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.Notifications, ModuleName.NOTIFICATIONS)) { e.Tab = null; } break; case "languages": // Display languages tab ? if (!LicenseKeyInfoProvider.IsFeatureAvailable(FeatureEnum.Multilingual)) { e.Tab = null; } break; case "membership": // Display membership tab ? if (!LicenseKeyInfoProvider.IsFeatureAvailable(FeatureEnum.Membership)) { e.Tab = null; } break; case "departments": { // Is E-commerce on site ? bool ecommerceOnSite = false; if (SiteContext.CurrentSiteName != null) { // Check if E-commerce module is installed ecommerceOnSite = ModuleEntryManager.IsModuleLoaded(ModuleName.ECOMMERCE) && ResourceSiteInfoProvider.IsResourceOnSite("CMS.Ecommerce", SiteContext.CurrentSiteName); } if (!ecommerceOnSite) { e.Tab = null; } } break; case "sites": { bool showSites = false; if (MembershipContext.AuthenticatedUser.IsGlobalAdministrator) { int sitesCount = SiteInfoProvider.GetSitesCount(); if (sitesCount > 0) { showSites = true; } } if (!showSites) { e.Tab = null; } } break; case "friends": if (!LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.Friends, ModuleName.COMMUNITY)) { e.Tab = null; } break; } }
/// <summary> /// Event handling creation of tabs. /// </summary> private void OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } var tab = e.Tab; switch (tab.TabName.ToLowerCSafe()) { case "customfields": // Check custom fields of user { int customFields = 0; var userId = QueryHelper.GetInteger("objectid", 0); UserInfo ui = UserInfoProvider.GetUserInfo(userId); if (ui != null) { if (!MembershipContext.AuthenticatedUser.IsGlobalAdministrator && !ui.IsInSite(SiteContext.CurrentSiteName)) { URLHelper.SeeOther(UIHelper.GetInformationUrl(ResHelper.GetString("user.notinsite"))); } // Get user form information and check for visible non-system fields FormInfo formInfo = FormHelper.GetFormInfo(ui.ClassName, false); customFields = (formInfo.GetFormElements(true, false, true).Any() ? 1 : 0); // Check custom fields of user settings if needed if ((customFields == 0) && (ui.UserSettings != null)) { // Get user settings form information and check for visible non-system fields formInfo = FormHelper.GetFormInfo(ui.UserSettings.ClassName, false); customFields = (formInfo.GetFormElements(true, false, true).Any() ? 1 : 0); } } if (customFields == 0) { e.Tab = null; } } break; case "notifications": // Display notifications tab ? if (!LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.Notifications, ModuleName.NOTIFICATIONS)) { e.Tab = null; } break; case "languages": // Display languages tab ? if (!LicenseKeyInfoProvider.IsFeatureAvailable(FeatureEnum.Multilingual)) { e.Tab = null; } break; case "membership": // Display membership tab ? if (!LicenseKeyInfoProvider.IsFeatureAvailable(FeatureEnum.Membership)) { e.Tab = null; } break; case "departments": { // Is E-commerce on site ? bool ecommerceOnSite = false; if (SiteContext.CurrentSiteName != null) { // Check if E-commerce module is installed ecommerceOnSite = ModuleEntryManager.IsModuleLoaded(ModuleName.ECOMMERCE) && ResourceSiteInfoProvider.IsResourceOnSite(ModuleName.ECOMMERCE, SiteContext.CurrentSiteName); } if (!ecommerceOnSite) { e.Tab = null; } } break; case "sites": { bool showSites = false; if (MembershipContext.AuthenticatedUser.IsGlobalAdministrator) { int sitesCount = SiteInfoProvider.GetSitesCount(); if (sitesCount > 0) { showSites = true; } } if (!showSites) { e.Tab = null; } } break; case "friends": if (!LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.Friends, ModuleName.COMMUNITY)) { e.Tab = null; } break; } }
protected void OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } var tab = e.Tab; var element = e.UIElement; var manager = DocumentManager; var node = manager.Node; bool splitViewSupported = PortalContext.ViewMode != ViewModeEnum.EditLive; string elementName = element.ElementName.ToLowerCSafe(); if (DocumentUIHelper.IsElementHiddenForNode(element, node)) { e.Tab = null; return; } switch (elementName) { case "properties.languages": splitViewSupported = false; if (!CultureSiteInfoProvider.IsSiteMultilingual(SiteContext.CurrentSiteName) || !CultureSiteInfoProvider.LicenseVersionCheck()) { e.Tab = null; return; } break; case "properties.security": case "properties.relateddocs": case "properties.linkeddocs": splitViewSupported = false; break; case "properties.variants": if (DataHelper.GetNotEmpty(RequestContext.CurrentDomain, "") != "") { // Check license and whether content personalization is enabled and whether exists at least one variant for current template if ((node == null) || !LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.ContentPersonalization, ModuleName.ONLINEMARKETING) || !ResourceSiteInfoProvider.IsResourceOnSite("CMS.ContentPersonalization", SiteContext.CurrentSiteName) || !PortalContext.ContentPersonalizationEnabled || (VariantHelper.GetVariantID(VariantModeEnum.ContentPersonalization, node.GetUsedPageTemplateId(), String.Empty) <= 0)) { e.Tab = null; return; } } break; case "properties.workflow": case "properties.versions": if (manager.Workflow == null) { e.Tab = null; return; } break; case "properties.personas": tab.RedirectUrl = URLHelper.AddParameterToUrl(tab.RedirectUrl, "objectid", manager.NodeID.ToString(CultureInfo.InvariantCulture)); break; } // UI elements could have a different display name if content only document is selected tab.Text = DocumentUIHelper.GetUIElementDisplayName(element, node); // Ensure split view mode if (splitViewSupported && UIContext.DisplaySplitMode) { tab.RedirectUrl = DocumentUIHelper.GetSplitViewUrl(tab.RedirectUrl); } }
/// <summary> /// Fires when a tab is created /// </summary> private void OnTabCreated(object sender, TabCreatedEventArgs e) { if (e.Tab == null) { return; } string mode = null; var element = e.UIElement; string elem = element.ElementName.ToLowerCSafe(); // Hide other tabs for wireframe if (isWireframe && ((elem != "wireframe") && (elem != "editform"))) { e.Tab = null; return; } switch (elem) { case "page": { mode = "edit"; } break; case "design": { if (!showDesign) { e.Tab = null; return; } mode = "design"; } break; case "wireframe": { if (!hasWireframe) { e.Tab = null; return; } mode = "wireframe"; } break; case "editform": // Keep edit form { mode = "editform"; } break; case "product": { if (!showProductTab) { e.Tab = null; return; } mode = "product"; } break; case "masterpage": { if (!showMasterPage) { e.Tab = null; return; } mode = "masterpage"; } break; case "properties": { // Document properties mode = "properties"; } break; case "analytics": { if (isWireframe) { e.Tab = null; return; } mode = "analytics"; } break; } if (Node != null) { var tab = e.Tab; var settings = new UIPageURLSettings { Mode = mode, Node = Node, NodeID = Node.NodeID, Culture = Node.DocumentCulture, PreferredURL = tab.RedirectUrl }; // Ensure correct URL tab.RedirectUrl = DocumentUIHelper.GetDocumentPageUrl(settings); } }