private void InjectSiteimproveScriptIntoCmsDeskPages(CMSPage cmsPage) { // Looking for a more elgeant solution. I am not a fan of all of these Contains/StartsWith TypeName string stuff // bail for Delete page, I'd like to do this a better way // This MUST go First, if you attempt to access a property (like DocumentID), it errors hard, even with try catch if (cmsPage.TypeName.Contains("_cmsdesk_delete_")) { return; } // For the "Page" Tab, this is == 0, which is not what we want, but it is helping us ignore a bunch of other situations if (cmsPage.DocumentID == 0) { return; } // if already registered, bail if (SiteimproveUtility.IsJavascriptAlreadyRegistered()) { return; } bool overlayIsEnabled = false; // this Contains() check is NOT ideal... Looking for a more elgeant solution, based on support talks and documentation, nothing seems to exist if (PortalContext.ViewMode == ViewModeEnum.Preview) { overlayIsEnabled = SettingsUtility.GetIsEnabledOnPreview(); } else if (cmsPage.TypeName.Contains("cmsmodules_content_cmsdesk_properties_")) { overlayIsEnabled = SettingsUtility.GetIsEnabledOnPropertyTabs(); } else if (PortalContext.ViewMode == ViewModeEnum.EditForm && cmsPage.TypeName.Contains("_cmsdesk_edit_edit_")) { overlayIsEnabled = SettingsUtility.GetIsEnabledOnForm(); } else { return; } if (!overlayIsEnabled) { return; } SiteimproveUtility.RegisterJavascriptBigBoxSmart(cmsPage, cmsPage.DocumentID, false); }