protected override void OnInit(EventArgs e) { base.OnInit(e); CurrentUserInfo user = CMSContext.CurrentUser; // Check 'read' permissions if (!user.IsAuthorizedPerResource("CMS.Content", "Read")) { RedirectToAccessDenied("CMS.Content", "Read"); } // Check UIProfile if (!user.IsAuthorizedPerUIElement("CMS.Content", "Properties.General")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "Properties.General"); } if (!user.IsAuthorizedPerUIElement("CMS.Content", "General.Advanced")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "General.Advanced"); } // Init document manager events DocumentManager.OnSaveData += DocumentManager_OnSaveData; DocumentManager.OnAfterAction += DocumentManager_OnAfterAction; DocumentManager.OnValidateData += DocumentManager_OnValidateData; // Initialize node node = DocumentManager.Node; }
protected void Page_Load(object sender, EventArgs e) { CurrentUserInfo cu = CMSContext.CurrentUser; // Check permissions if ((cu == null) || !cu.IsAuthorizedPerResource("CMS.Ecommerce", "EcommerceRead")) { CMSMyDeskPage.RedirectToCMSDeskAccessDenied("CMS.Ecommerce", "EcommerceRead"); } // Check UIProfile if (!cu.IsAuthorizedPerUIElement("CMS.Desk", "Ecommerce")) { CMSMyDeskPage.RedirectToCMSDeskUIElementAccessDenied("CMS.Desk", "Ecommerce"); } if (!cu.IsAuthorizedPerUIElement("CMS.Ecommerce", "DashboardGroup")) { CMSMyDeskPage.RedirectToCMSDeskUIElementAccessDenied("CMS.Ecommerce", "DashboardGroup"); } if (!cu.IsAuthorizedPerUIElement("CMS.Ecommerce", "EcommerceDashboard")) { CMSMyDeskPage.RedirectToCMSDeskUIElementAccessDenied("CMS.Ecommerce", "EcommerceDashboard"); } }
protected override void CreateChildControls() { base.CreateChildControls(); selectContainer.DropDownSingleSelect.CssClass = "SelectorDropDown"; selectContainer.WhereCondition = string.Format("ContainerID IN (SELECT ContainerID FROM CMS_WebPartContainerSite WHERE SiteID = {0})", CMSContext.CurrentSiteID); // Add none value string[,] noneValue = new string[1, 2]; noneValue[0, 0] = GetString("general.empty"); noneValue[0, 1] = string.Empty; selectContainer.SpecialFields = noneValue; CurrentUserInfo currentUser = CMSContext.CurrentUser; string siteName = CMSContext.CurrentSiteName; // Check user permissions bool design = currentUser.IsAuthorizedPerResource("CMS.Design", "Design"); bool deskAuthorized = currentUser.IsAuthorizedPerUIElement("CMS.Desk", "Content"); bool contentAuthorized = currentUser.IsAuthorizedPerUIElement("CMS.Content", new string[] { "Design", "Design.WebPartProperties", "WebPartProperties.General" }, siteName); if (!IsLiveSite && design && deskAuthorized && contentAuthorized) { // Check UI permissions for editing/creating container bool editAuthorized = currentUser.IsAuthorizedPerUIElement("CMS.Content", new string[] { "WebPartProperties.EditContainers" }, siteName); bool createAuthorized = currentUser.IsAuthorizedPerUIElement("CMS.Content", new string[] { "WebPartProperties.NewContainers" }, siteName); // Initialize selector SetDialog(editAuthorized, createAuthorized); } }
protected override void OnInit(EventArgs e) { base.OnInit(e); DocumentManager.LocalMessagesPlaceHolder = plcMess; DocumentManager.OnSaveData += DocumentManager_OnSaveData; CurrentUserInfo user = CMSContext.CurrentUser; // Check 'read' permissions if (!user.IsAuthorizedPerResource("CMS.Content", "Read")) { RedirectToAccessDenied("CMS.Content", "Read"); } // Check UIProfile if (!user.IsAuthorizedPerUIElement("CMS.Content", "Properties.General")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "Properties.General"); } if (!user.IsAuthorizedPerUIElement("CMS.Content", "General.Advanced")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "General.Advanced"); } }
/// <summary> /// Reloads the controls on the page to the appropriate state /// </summary> protected void ReloadControls() { TreeNode node = DocumentManager.Node; if (node.NodeAliasPath == "/") { // For root, inherit option means no page template radInherit.ResourceString = "Template.NoTemplate"; } // Get the template ID int templateId = SelectedTemplateID; string suffix = null; bool inherit = radInherit.Checked; plcUIClone.Visible = false; plcUIEdit.Visible = false; plcUISave.Visible = false; if (inherit) { // Inherited selectorEnabled = false; // Inherit templateId = GetInheritedPageTemplateId(node); if (templateId > 0) { suffix = " " + GetString("Template.Inherited"); } } else { // Standard selection selectorEnabled = true; } // Set modal dialogs btnSave.OnClientClick = "modalDialog('" + ResolveUrl("~/CMSModules/PortalEngine/UI/Layout/SaveNewPageTemplate.aspx") + "?templateId=" + templateId + "&siteid=" + CMSContext.CurrentSiteID + "', 'SaveNewTemplate', 600, 400); return false;"; btnEditTemplateProperties.OnClientClick = "modalDialog('" + ResolveUrl("~/CMSModules/PortalEngine/UI/PageTemplates/PageTemplate_Edit.aspx") + "?templateid=" + templateId + "&aliaspath=" + node.NodeAliasPath + "&dialog=1', 'TemplateSelection', 850, 680); return false;"; // Load the page template name pti = PageTemplateInfoProvider.GetPageTemplateInfo(templateId); if (pti != null) { txtTemplate.Text = pti.DisplayName; plcUISave.Visible = true; plcUIEdit.Visible = (!pti.IsReusable || currentUser.IsAuthorizedPerUIElement("CMS.Content", "Template.ModifySharedTemplates")); plcUIClone.Visible = pti.IsReusable || inherit; } else { txtTemplate.Text = GetString("Template.SelectorNoTemplate"); } txtTemplate.Text += suffix; }
/// <summary> /// Page load event. /// </summary> protected void Page_Load(object sender, EventArgs e) { // Add "none record" if required if (this.AddNoneRecord && (usStyleSheet.SpecialFields == null)) { usStyleSheet.SpecialFields = new string[1, 2] { { GetString("SelectCssStylesheet.NoneRecord"), String.Empty } }; } // If site specified, restrict to stylesheets assigned to the site if (this.SiteId > 0) { usStyleSheet.WhereCondition = SqlHelperClass.AddWhereCondition(usStyleSheet.WhereCondition, "StylesheetID IN (SELECT StylesheetID FROM CMS_CssStylesheetSite WHERE SiteID = " + this.SiteId + ")"); } usStyleSheet.ReturnColumnName = ReturnColumnName; // Check if user can edit the stylesheet CurrentUserInfo currentUser = CMSContext.CurrentUser; bool design = currentUser.IsAuthorizedPerResource("CMS.Design", "Design"); bool uiElement = currentUser.IsAuthorizedPerUIElement("CMS.Content", new string[] { "Properties", "Properties.General", "General.Design" }, CMSContext.CurrentSiteName); if ((AllowEditButtons) && (design) && (uiElement) && (this.usStyleSheet.ReturnColumnName.Equals("StylesheetID", StringComparison.InvariantCultureIgnoreCase))) { bool uiEditStylesheet = currentUser.IsAuthorizedPerUIElement("CMS.Content", new string[] { "Design.EditCSSStylesheets" }, CMSContext.CurrentSiteName); bool uiNewStylesheet = currentUser.IsAuthorizedPerUIElement("CMS.Content", new string[] { "Design.NewCSSStylesheets" }, CMSContext.CurrentSiteName); usStyleSheet.DropDownSingleSelect.CssClass = "SelectorDropDown"; // Check UI permissions for editing stylesheet if (uiEditStylesheet) { string url = "~/CMSModules/CssStylesheets/Pages/CssStylesheet_General.aspx?editonlycode=true"; url = URLHelper.AddParameterToUrl(url, "hash", QueryHelper.GetHash("?editonlycode=true")); url = URLHelper.AddParameterToUrl(url, "cssstylesheetid", "##ITEMID##"); url = URLHelper.AddParameterToUrl(url, "siteid", SiteId.ToString()); usStyleSheet.EditItemPageUrl = url; } // Check UI permissions for creating stylesheet if (uiNewStylesheet) { string url = "~/CMSModules/CssStylesheets/Pages/CssStylesheet_New.aspx?usedialog=1"; if (SiteId > 0) { url = URLHelper.AddParameterToUrl(url, "siteid", SiteId.ToString()); } url = URLHelper.AddParameterToUrl(url, "hash", QueryHelper.GetHash(url)); usStyleSheet.NewItemPageUrl = url; } } }
protected void Page_Init(object sender, EventArgs e) { // Check license if (DataHelper.GetNotEmpty(URLHelper.GetCurrentDomain(), "") != "") { LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetCurrentDomain(), FeatureEnum.Polls); } // Check site availability if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Polls", CMSContext.CurrentSiteName)) { RedirectToResourceNotAvailableOnSite("CMS.Polls"); } // Check site availability if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Form", CMSContext.CurrentSiteName)) { RedirectToResourceNotAvailableOnSite("CMS.Form"); } CurrentUserInfo user = CMSContext.CurrentUser; // Check permissions for CMS Desk -> Tools -> Polls if (!user.IsAuthorizedPerUIElement("CMS.Tools", "Tools.Content") || !user.IsAuthorizedPerUIElement("CMS.Tools", "Polls")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Tools", "Polls"); } // Check permissions for site polls if (!user.IsAuthorizedPerResource("CMS.Polls", CMSAdminControl.PERMISSION_READ)) { RedirectToCMSDeskAccessDenied("CMS.Polls", "Read"); } // Check permissions for forms if (!user.IsAuthorizedPerResource("CMS.Form", "ReadData")) { RedirectToCMSDeskAccessDenied("CMS.Form", "ReadData"); } // Load BizForm selector if BizForms module is available if (ModuleEntry.IsModuleLoaded(ModuleEntry.BIZFORM) && ResourceSiteInfoProvider.IsResourceOnSite(ModuleEntry.BIZFORM, CMSContext.CurrentSiteName)) { bizFormData = this.LoadUserControl("~/CMSModules/BizForms/Controls/BizFormEditData.ascx") as CMSAdminControl; bizFormData.ShortID = "bizFormData"; bizFormData.SetValue("ShowNewRecordButton", false); plcBizForm.Controls.Add(bizFormData); bizFormData.Visible = true; } }
/// <summary> /// Raises the <see cref="E:Init"/> event. /// </summary> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected override void OnInit(EventArgs e) { base.OnInit(e); CurrentUserInfo cui = CMSContext.CurrentUser; // Check UI Permissions if ((cui == null) || !cui.IsAuthorizedPerUIElement("CMS.Content", "Properties.Variants")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "Properties.Variants"); } // Check module availability on site if (!ResourceSiteInfoProvider.IsResourceOnSite("cms.contentpersonalization", CMSContext.CurrentSiteName)) { RedirectToResourceNotAvailableOnSite("CMS.ContentPersonalization"); } // Check license if (DataHelper.GetNotEmpty(URLHelper.GetCurrentDomain(), "") != "") { LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetCurrentDomain(), FeatureEnum.ContentPersonalization); } // Check the Read permissions if (!CMSContext.CurrentUser.IsAuthorizedPerResource("cms.contentpersonalization", "Read")) { RedirectToAccessDenied(String.Format(GetString("general.permissionresource"), "Read", "Content personalization")); } }
protected void Page_Load(object sender, EventArgs e) { if (!QueryHelper.ValidateHash("hash")) { URLHelper.Redirect(ResolveUrl("~/CMSMessages/Error.aspx?title=" + GetString("dialogs.badhashtitle") + "&text=" + GetString("dialogs.badhashtext") + "&cancel=1")); } else { string element = QueryHelper.GetString("taskType", null); // Check permissions for CMS Desk -> Tools -> Staging CurrentUserInfo user = CMSContext.CurrentUser; if (!user.IsAuthorizedPerUIElement("cms.staging", element)) { RedirectToCMSDeskUIElementAccessDenied("cms.staging", element); } // Check 'Manage tasks' permission if (!CMSContext.CurrentUser.IsAuthorizedPerResource("cms.staging", "Manage" + element + "Tasks")) { RedirectToAccessDenied("cms.staging", "Manage" + element + "Tasks"); } CurrentMaster.Title.TitleText = GetString("Task.ViewHeader"); CurrentMaster.Title.TitleImage = GetImageUrl("CMSModules/CMS_Staging/tasks.png"); int taskId = QueryHelper.GetInteger("taskid", 0); ucViewTask.TaskId = taskId; } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> protected void Page_Load(object sender, EventArgs e) { CurrentUserInfo ui = CMSContext.CurrentUser; if (!ui.IsAuthorizedPerUIElement("CMS.Content", "WebPartProperties.Variant")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "WebPartProperties.Variant"); } // Check permissions (based on variant type) if (variantMode == VariantModeEnum.MVT) { if (!ui.IsAuthorizedPerResource("CMS.MVTest", "Read")) { // Not authorized for MV test - Read. RedirectToInformation(String.Format(GetString("general.permissionresource"), "Read", "CMS.MVTest")); } } else if (variantMode == VariantModeEnum.ContentPersonalization) { if (!ui.IsAuthorizedPerResource("CMS.ContentPersonalization", "Read")) { // Not authorized for Content personalization - Read. RedirectToInformation(String.Format(GetString("general.permissionresource"), "Read", "CMS.ContentPersonalization")); } } // Setup the control SetupControl(); }
protected void Page_Load(object sender, EventArgs e) { // Check security CurrentUserInfo currentUser = CMSContext.CurrentUser; if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", new string[] { "Design", "Design.WebPartProperties", "WebPartProperties.General", "WebPartProperties.EditTransformations" }, CMSContext.CurrentSiteName)) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "Design.WebPartProperties;WebPartProperties.General;WebPartProperties.EditTransformations"); } UserInfo ui = CMSContext.CurrentUser; // If site manager set directly (or window not in dialog mode) - set site manager flag to unigrid // In some cases dialog mode may be used in site manager (hier. transformation) bool isSiteManager = QueryHelper.GetBoolean("sitemanager", false); if ((isSiteManager || !mDialogMode) && ui.UserSiteManagerAdmin) { ucTransf.IsSiteManager = true; } CurrentMaster.Title.Visible = true; int transformationID = QueryHelper.GetInteger("transID", 0); string selectedTemplate = QueryHelper.GetString("templatetype", String.Empty); if (!String.IsNullOrEmpty(ucTransf.SelectedItemType)) { selectedTemplate = ucTransf.SelectedItemType; } Guid guid = QueryHelper.GetGuid("guid", Guid.Empty); bool showInfoLabel = QueryHelper.GetBoolean("showinfo", false); TransformationInfo ti = TransformationInfoProvider.GetTransformation(transformationID); ucTransf.ShowInfoLabel = showInfoLabel; ucTransf.TransInfo = ti; ucTransf.HierarchicalID = guid; //Set breadcrumbs string[,] tabs = new string[2, 4]; tabs[0, 0] = GetString("documenttype_edit_transformation_list.titlelist"); tabs[0, 1] = ResolveUrl(String.Format("~/CMSModules/DocumentTypes/Pages/Development/HierarchicalTransformations_Transformations.aspx?transID={0}&templatetype={1}&editonlycode={2}&tabmode={3}&aliaspath={4}&instanceguid={5}", ti.TransformationID, selectedTemplate, mDialogMode, QueryHelper.GetInteger("tabmode", 0), QueryHelper.GetString("aliaspath", String.Empty), QueryHelper.GetGuid("instanceguid", Guid.Empty))); tabs[0, 2] = ""; tabs[1, 0] = GetString("documenttype_edit_transformation_list.edit"); tabs[1, 1] = ""; tabs[1, 2] = ""; CurrentMaster.Title.HelpTopicName = "partialhierarchicalTransformation_tab"; CurrentMaster.Title.HelpName = "helpTopic"; CurrentMaster.Title.Breadcrumbs = tabs; if (mDialogMode) { pnlContainer.CssClass = "PageContent"; } }
protected override void OnInit(EventArgs e) { base.OnInit(e); // Check permissions for web part properties UI CurrentUserInfo currentUser = CMSContext.CurrentUser; if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", "WebPartProperties.Code")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "WebPartProperties.Code"); } if (webpartId != "") { // Get page info pi = GetPageInfo(aliasPath, templateId); if (pi == null) { this.Visible = false; return; } pti = pi.PageTemplateInfo; if ((pti != null) && ((pti.TemplateInstance != null))) { // Get web part instance webPart = pti.TemplateInstance.GetWebPart(instanceGuid, zoneVariantId, variantId) ?? pti.GetWebPart(webpartId); if (webPart != null) { txtCode.Text = ValidationHelper.GetString(webPart.GetValue("WebPartCode"), ""); } } } }
protected void Page_Init(object sender, EventArgs e) { // Check the license if (!string.IsNullOrEmpty(DataHelper.GetNotEmpty(URLHelper.GetCurrentDomain(), string.Empty))) { LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetCurrentDomain(), FeatureEnum.Newsletters); } // Check site availability if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Newsletter", CMSContext.CurrentSiteName)) { RedirectToResourceNotAvailableOnSite("CMS.Newsletter"); } CurrentUserInfo user = CMSContext.CurrentUser; // Check permissions for CMS Desk -> Tools -> Newsletter if (!user.IsAuthorizedPerUIElement("CMS.Tools", "Newsletter")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Tools", "Newsletter"); } // Check 'NewsletterRead' permission if (!user.IsAuthorizedPerResource("CMS.Newsletter", "Read")) { RedirectToCMSDeskAccessDenied("CMS.Newsletter", "Read"); } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> protected void Page_Load(object sender, EventArgs e) { CurrentUserInfo cui = CMSContext.CurrentUser; // Check UI Permissions if (!cui.IsAuthorizedPerUIElement("CMS.Content", "OnlineMarketing.MVTVariants")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "OnlineMarketing.MVTVariants"); } if (!cui.IsAuthorizedPerResource("cms.mvtest", "Read")) { RedirectToAccessDenied(String.Format(GetString("general.permissionresource"), "Read", "MVT testing")); } // Set disabled module info ucDisabledModule.SettingsKeys = "CMSAnalyticsEnabled;CMSMVTEnabled"; ucDisabledModule.InfoTexts.Add(GetString("WebAnalytics.Disabled") + "</br>"); ucDisabledModule.InfoTexts.Add(GetString("mvt.disabled")); ucDisabledModule.ParentPanel = pnlDisabled; // Get the PageTemplateID of the current node if (Node != null) { // Set NodeID in order to check the access to the document listElem.NodeID = Node.NodeID; listElem.PageTemplateID = Node.GetUsedPageTemplateId(); } EditedObject = Node; }
/// <summary> /// Handles the Load event of the Page control. /// </summary> protected void Page_Load(object sender, EventArgs e) { CurrentUserInfo ui = CMSContext.CurrentUser; if (!ui.IsAuthorizedPerUIElement("CMS.Content", "WebPartProperties.Variant")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "WebPartProperties.Variant"); } // Check permissions (based on variant type) if (variantMode == VariantModeEnum.MVT) { if (!ui.IsAuthorizedPerResource("CMS.MVTest", "Read")) { // Not authorised for MV test - Read. RedirectToInformation(String.Format(GetString("general.permissionresource"), "Read", "CMS.MVTest")); } } else if (variantMode == VariantModeEnum.ContentPersonalization) { if (!ui.IsAuthorizedPerResource("CMS.ContentPersonalization", "Read")) { // Not authorised for Content personalization - Read. RedirectToInformation(String.Format(GetString("general.permissionresource"), "Read", "CMS.ContentPersonalization")); } } if (!SettingsKeyProvider.UsingVirtualPathProvider) { this.lblInfo.Text = GetString("WebPartCode.ProviderNotRunning"); this.lblInfo.CssClass = "ErrorLabel"; } else { // Setup the buttons btnOnOK.Click += new EventHandler(btnOnOK_Click); btnOnApply.Click += new EventHandler(btnOnApply_Click); ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ApplyButton", ScriptHelper.GetScript( "function SetRefresh(refreshpage) { document.getElementById('" + this.hidRefresh.ClientID + "').value = refreshpage; } \n" + "function OnApplyButton(refreshpage) { SetRefresh(refreshpage); " + Page.ClientScript.GetPostBackEventReference(btnOnApply, "") + "} \n" + "function OnOKButton(refreshpage) { SetRefresh(refreshpage); " + Page.ClientScript.GetPostBackEventReference(btnOnOK, "") + "} \n" )); } if (variantMode == VariantModeEnum.MVT) { // Display MVT edit dialog mvtEditElem.Visible = true; mvtEditElem.UIFormControl.SubmitButton.Visible = false; } else if (variantMode == VariantModeEnum.ContentPersonalization) { // Display Content personalization edit dialog cpEditElem.Visible = true; cpEditElem.UIFormControl.SubmitButton.Visible = false; } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> protected void Page_Load(object sender, EventArgs e) { // Check UI elements for web part zone CurrentUserInfo currentUser = CMSContext.CurrentUser; if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", new string[] { "Design", "Design.WebPartZoneProperties" }, CMSContext.CurrentSiteName)) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "Design;Design.WebPartZoneProperties"); } // Show the tabs when displaying a zone variant if (variantId > 0) { tabsElem.JavaScriptHandler = "TabSelect"; tabsElem.OnTabCreated += new UITabs.TabCreatedEventHandler(tabElem_OnTabCreated); pnlTabsContainer.Visible = true; } string postBackReference = ControlsHelper.GetPostBackEventReference(pnlUpdate, ""); ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "TabSelect", ScriptHelper.GetScript("function TabSelect(name){currSelElem = document.getElementById('" + hdnSelectedTab.ClientID + "'); if ((currSelElem != null)) { origVal = currSelElem.value; currSelElem.value = name; if (origVal != '') {" + postBackReference + " }}}")); // Title this.CurrentMaster.Title.TitleText = GetString("webpartzone.propertiesheader"); this.CurrentMaster.Title.TitleImage = GetImageUrl("CMSModules/CMS_PortalEngine/WebpartZoneProperties/title.png"); this.CurrentMaster.Title.HelpTopicName = "webpartzoneproperties"; this.CurrentMaster.Title.HelpName = "helpTopic"; // Tabs header css class this.CurrentMaster.PanelHeader.CssClass = "WebpartTabsPageHeader"; // UI Strings this.btnOk.Text = GetString("general.ok"); this.btnApply.Text = GetString("general.apply"); this.btnCancel.Text = GetString("general.cancel"); this.chkRefresh.Text = GetString("webpartzone.refresh"); // Default control path string controlPath = "~/CMSModules/PortalEngine/Controls/WebParts/WebPartZoneProperties.ascx"; string ctrlId = "wpzp"; // Set personalized control path if selected switch (hdnSelectedTab.Value.ToLower()) { case "webpartzoneproperties.variant": controlPath = "~/CMSModules/OnlineMarketing/Controls/WebParts/WebPartZonePersonalized.ascx"; ctrlId = "pers"; isVariantTab = true; break; } // Load selected control currentControl = this.LoadControl(controlPath); currentControl.ID = ctrlId; // Add to control collection plcDynamicContent.Controls.Add(currentControl); }
protected override void OnInit(EventArgs e) { base.OnInit(e); currentUser = MembershipContext.AuthenticatedUser; if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", "Properties.LinkedDocs")) { RedirectToUIElementAccessDenied("CMS.Content", "Properties.LinkedDocs"); } }
protected override void OnInit(EventArgs e) { base.OnInit(e); currentUser = CMSContext.CurrentUser; if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", "Properties.LinkedDocs")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "Properties.LinkedDocs"); } }
protected void Page_Load(object sender, EventArgs e) { // Check permissions for web part properties UI CurrentUserInfo currentUser = CMSContext.CurrentUser; if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", "WebPartProperties.Layout")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "WebPartProperties.Layout"); } }
protected void Page_Load(object sender, EventArgs e) { if (!String.IsNullOrEmpty(this.ModuleName)) { // Reserve UI tabs DataRow sdr = SecurityHelper.ReserveSecurityLogItem("LoadUIGuide"); // Get UI elements which represent the guide items DataSet ds = null; if (String.IsNullOrEmpty(this.ElementName)) { ds = UIElementInfoProvider.GetUIMenuElements(this.ModuleName); } else { ds = UIElementInfoProvider.GetChildUIElements(this.ModuleName, this.ElementName); } // Create guide item collection CurrentUserInfo currentUser = CMSContext.CurrentUser; int i = 0; if (!DataHelper.DataSourceIsEmpty(ds)) { ArrayList guideParams = new ArrayList(4); foreach (DataRow dr in ds.Tables[0].Rows) { string elementName = ValidationHelper.GetString(dr["ElementName"], ""); if (currentUser.IsAuthorizedPerUIElement(this.ModuleName, elementName, this.ModuleAvailabilityForSiteRequired)) { // Get parameters of the guide item object itemParams = GetGuideItemParameters(new UIElementInfo(dr)); // If item initialized, add it to the collection if (itemParams != null) { guideParams.Add(itemParams); i++; } } } // Initialize guide guideElem.Parameters = guideParams; guideElem.Columns = this.Columns; } // Log the security if (sdr != null) { SecurityHelper.SetLogItemData(sdr, currentUser.UserName, this.ModuleName, this.ElementName, i, CMSContext.CurrentSiteName); } } }
protected void Page_Load(object sender, EventArgs e) { // Check permissions for web part properties UI CurrentUserInfo currentUser = CMSContext.CurrentUser; if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", "WebPartProperties.Layout")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "WebPartProperties.Layout"); } WebPartInstance webPart = null; if (webpartId != "") { // Get pageinfo PageInfo pi = GetPageInfo(aliasPath, templateId); if (pi != null) { // Get page template PageTemplateInfo pti = pi.PageTemplateInfo; // Get web part if ((pti != null) && ((pti.TemplateInstance != null))) { webPart = pti.TemplateInstance.GetWebPart(instanceGuid, zoneVariantId, variantId) ?? pti.GetWebPart(webpartId); } } } // If the web part is not found, do not continue if (webPart != null) { WebPartInfo wpi = WebPartInfoProvider.GetWebPartInfo(webPart.WebPartType); if (wpi != null) { // Get the current layout name if (String.IsNullOrEmpty(LayoutCodeName)) { // Get the current layout name LayoutCodeName = ValidationHelper.GetString(webPart.GetValue("WebPartLayout"), ""); } // Load the web part information if (LayoutCodeName != "") { WebPartLayoutInfo wpli = WebPartLayoutInfoProvider.GetWebPartLayoutInfo(wpi.WebPartName, LayoutCodeName); SetEditedObject(wpli, null); } } } // Set page tabs InitTabs(1, "webpartlayoutcontent"); SetTab(0, GetString("general.general"), "webpartproperties_layout.aspx" + URLHelper.RemoveParameterFromUrl(URLHelper.Url.Query, "saved"), null); }
/// <summary> /// Reloads the data in the selector. /// </summary> public void ReloadData() { this.uniSelector.IsLiveSite = this.IsLiveSite; this.uniSelector.ButtonClear.Visible = false; this.uniSelector.AllowEmpty = this.DisplayClearButton; this.uniSelector.SetValue("FilterMode", SettingsObjectType.TRANSFORMATION); // Check if user can edit the transformation CurrentUserInfo currentUser = CMSContext.CurrentUser; bool deskAuthorized = currentUser.IsAuthorizedPerUIElement("CMS.Desk", "Content"); bool contentAuthorized = currentUser.IsAuthorizedPerUIElement("CMS.Content", new string[] { "Design", "Design.WebPartProperties" }, CMSContext.CurrentSiteName); if (deskAuthorized && contentAuthorized) { bool editAuthorized = currentUser.IsAuthorizedPerUIElement("CMS.Content", new string[] { "WebPartProperties.EditTransformations" }, CMSContext.CurrentSiteName); bool createAuthorized = currentUser.IsAuthorizedPerUIElement("CMS.Content", new string[] { "WebPartProperties.NewTransformations" }, CMSContext.CurrentSiteName); // Transformation editing authorized if (editAuthorized) { string isSiteManagerStr = IsSiteManager ? "&siteManager=true" : String.Empty; string url = "~/CMSModules/DocumentTypes/Pages/Development/DocumentType_Edit_Transformation_Frameset.aspx?name=##ITEMID##" + isSiteManagerStr + "&editonlycode=1"; url = URLHelper.AddParameterToUrl(url, "hash", QueryHelper.GetHash("?editonlycode=1")); this.uniSelector.EditItemPageUrl = url; } // Creating of new transformation authorized if (createAuthorized) { string isSiteManagerStr = IsSiteManager ? "&siteManager=true" : String.Empty; string url = NewDialogPath + "?editonlycode=1" + isSiteManagerStr + "&selectedvalue=##ITEMID##"; url = URLHelper.AddParameterToUrl(url, "hash", QueryHelper.GetHash("?editonlycode=1")); this.uniSelector.NewItemPageUrl = url; } } if (!ShowHierarchicalTransformation) { this.uniSelector.WhereCondition = "(TransformationIsHierarchical IS NULL) OR (TransformationIsHierarchical = 0)"; } }
protected override void OnInit(EventArgs e) { base.OnInit(e); // Check UI personalization CurrentUserInfo user = CMSContext.CurrentUser; if (!user.IsAuthorizedPerUIElement("CMS.FileImport", "ImportFromComputer")) { RedirectToCMSDeskUIElementAccessDenied("CMS.FileImport", "ImportFromComputer"); } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> protected void Page_Load(object sender, EventArgs e) { CurrentUserInfo cui = CurrentUser; if (cui != null) { if (cui.IsAuthorizedPerUIElement("CMS.OnSiteEdit", "OnSiteHighlight")) { // Highlight button MenuItem highlightItem = new MenuItem(); highlightItem.CssClass = "BigButton OnSiteHighlightButton"; highlightItem.ImageAlign = ImageAlign.Top; highlightItem.ImagePath = GetImageUrl("CMSModules/CMS_PortalEngine/OnSiteEdit/highlight.png"); highlightItem.OnClientClick = "OEHighlightToggle(event, this);"; highlightItem.Text = GetString("onsiteedit.highlight"); highlightItem.Tooltip = GetString("onsiteedit.highlighttooltip"); highlightItem.ImageAltText = GetString("onsiteedit.highlight"); otherMenu.Buttons.Add(highlightItem); } if (cui.IsAuthorizedPerUIElement("CMS.OnSiteEdit", "OnSiteHidden")) { // Hidden button MenuItem hiddenItem = new MenuItem(); hiddenItem.CssClass = "BigButton OnSiteHiddenButton"; hiddenItem.ImageAlign = ImageAlign.Top; hiddenItem.ImagePath = GetImageUrl("CMSModules/CMS_PortalEngine/OnSiteEdit/hidden.png"); hiddenItem.Text = GetString("general.hidden"); hiddenItem.Tooltip = GetString("onsiteedit.hiddentooltip"); hiddenItem.ImageAltText = GetString("general.hidden"); // Add temporary empty sub menu item to ensure generating of the sub menu functions SubMenuItem epmtyItem = new SubMenuItem(); hiddenItem.SubItems.Add(epmtyItem); otherMenu.Buttons.Add(hiddenItem); } } }
protected void Page_Load(object sender, EventArgs e) { // Check UI Analytics.Settings CurrentUserInfo ui = CMSContext.CurrentUser; if (!ui.IsAuthorizedPerUIElement("CMS.Content", "Analytics.Settings")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "Analytics.Settings"); } // Display disabled information if (!AnalyticsHelper.AnalyticsEnabled(CMSContext.CurrentSiteName)) { this.pnlWarning.Visible = true; this.lblWarning.Text = ResHelper.GetString("WebAnalytics.Disabled"); } ucConversionSelector.SelectionMode = SelectionModeEnum.SingleTextBox; ucConversionSelector.IsLiveSite = false; nodeID = QueryHelper.GetInteger("nodeid", 0); mSave = GetString("general.save"); UIContext.AnalyticsTab = AnalyticsTabEnum.Settings; tree = new TreeProvider(CMSContext.CurrentUser); node = tree.SelectSingleNode(nodeID, CMSContext.PreferredCultureCode, tree.CombineWithDefaultCulture); if (ui.IsAuthorizedPerDocument(node, NodePermissionsEnum.Read) == AuthorizationResultEnum.Denied) { RedirectToAccessDenied(String.Format(GetString("cmsdesk.notauthorizedtoreaddocument"), node.NodeAliasPath)); } // Check modify permissions else if (ui.IsAuthorizedPerDocument(node, NodePermissionsEnum.Modify) == AuthorizationResultEnum.Denied) { lblInfo.Visible = true; lblInfo.Text = String.Format(GetString("cmsdesk.notauthorizedtoeditdocument"), node.NodeAliasPath); // Disable save button btnSave.Enabled = false; usSelectCampaign.Enabled = false; } if (node != null) { if (!URLHelper.IsPostback()) { ReloadData(); } } }
protected void Page_Load(object sender, EventArgs e) { // Check permissions for web part properties UI CurrentUserInfo currentUser = CMSContext.CurrentUser; if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", "WebPartProperties.Variant")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "WebPartProperties.Variant"); } frameContent.Attributes.Add("src", "webpartproperties_personalized.aspx" + URLHelper.Url.Query); frameButtons.Attributes.Add("src", ResolveUrl("~/CMSModules/PortalEngine/UI/WebParts/webpartproperties_buttons.aspx" + URLHelper.Url.Query)); }
protected void Page_Load(object sender, EventArgs e) { // Check permissions for web part properties UI CurrentUserInfo currentUser = CMSContext.CurrentUser; if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", "WebPartProperties.Code")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "WebPartProperties.Code"); } frameContent.Attributes.Add("src", "webpartproperties_code.aspx" + URLHelper.Url.Query); frameButtons.Attributes.Add("src", "webpartproperties_buttons.aspx" + URLHelper.Url.Query); }
private void SetDialogMode() { // Check if user can edit the stylesheet CurrentUserInfo currentUser = CMSContext.CurrentUser; string siteName = (CurrentSite != null) ? CurrentSite.SiteName : string.Empty; if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", new string[] { "Properties", "Properties.General", "General.Design" }, siteName)) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "Properties;Properties.General;General.Design"); } // Hide OK button btnOk.Visible = false; CurrentMaster.PanelContent.CssClass = "PageContent"; CurrentMaster.PanelFooter.CssClass = "FloatRight"; // Add save button LocalizedButton btnSave = new LocalizedButton { ID = "btnSave", ResourceString = "general.save", EnableViewState = false, CssClass = "SubmitButton" }; btnSave.Click += (sender, e) => Save(false); CurrentMaster.PanelFooter.Controls.Add(btnSave); // Add save & close button LocalizedButton btnSaveAndClose = new LocalizedButton { ID = "btnSaveAndClose", ResourceString = "general.saveandclose", CssClass = "LongSubmitButton", EnableViewState = false }; btnSaveAndClose.Click += (sender, e) => Save(true); CurrentMaster.PanelFooter.Controls.Add(btnSaveAndClose); // Add close button CurrentMaster.PanelFooter.Controls.Add(new LocalizedButton { ID = "btnCancel", ResourceString = "general.close", EnableViewState = false, OnClientClick = "window.close(); return false;", CssClass = "SubmitButton" }); }
protected override void OnInit(EventArgs e) { base.OnInit(e); CurrentUserInfo user = CMSContext.CurrentUser; // Check 'read' permissions if (!user.IsAuthorizedPerResource("CMS.Content", "Read")) { RedirectToAccessDenied("CMS.Content", "Read"); } // Check UIProfile if (!user.IsAuthorizedPerUIElement("CMS.Content", "Properties.General")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "Properties.General"); } if (!user.IsAuthorizedPerUIElement("CMS.Content", "General.Advanced")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "General.Advanced"); } }
protected void Page_Load(object sender, EventArgs e) { CurrentUserInfo cu = CMSContext.CurrentUser; // Check permissions if ((cu == null) || !cu.IsAuthorizedPerResource("CMS.OnlineMarketing", "Read")) { CMSMyDeskPage.RedirectToCMSDeskAccessDenied("CMS.OnlineMarketing", "Read"); } // Check UIProfile if (!cu.IsAuthorizedPerUIElement("CMS.OnlineMarketing", "OMDashBoardGroup")) { CMSMyDeskPage.RedirectToCMSDeskUIElementAccessDenied("CMS.OnlineMarketing", "OMDashBoardGroup"); } if (!cu.IsAuthorizedPerUIElement("CMS.OnlineMarketing", "OMDashBoard")) { CMSMyDeskPage.RedirectToCMSDeskUIElementAccessDenied("CMS.OnlineMarketing", "OMDashBoard"); } // Register script for unimenu button selection CMSDeskPage.AddMenuButtonSelectScript(this, "OMDashBoard", null, "menu"); }
protected override void OnInit(EventArgs e) { base.OnInit(e); currentUser = CMSContext.CurrentUser; if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", "Properties.LinkedDocs")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "Properties.LinkedDocs"); } }
protected void Page_Load(object sender, EventArgs e) { CMSContext.ViewMode = ViewModeEnum.MasterPage; // Keep current user user = CMSContext.CurrentUser; // Check UIProfile if (!user.IsAuthorizedPerUIElement("CMS.Content", "MasterPage")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "MasterPage"); } // Check "Design" permission if (!user.IsAuthorizedPerResource("CMS.Design", "Design")) { RedirectToAccessDenied("CMS.Design", "Design"); } // Register the scripts ScriptHelper.RegisterProgress(this); ScriptHelper.RegisterSaveShortcut(btnSave, null, false); // Save changes support bool confirmChanges = SettingsKeyProvider.GetBoolValue(CMSContext.CurrentSiteName + ".CMSConfirmChanges"); string script = string.Empty; if (confirmChanges) { script = "var confirmLeave='" + ResHelper.GetString("Content.ConfirmLeave", user.PreferredUICultureCode) + "'; \n"; } else { script += "confirmChanges = false;"; } ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "saveChangesScript", ScriptHelper.GetScript(script)); nodeId = QueryHelper.GetInteger("NodeId", 0); try { CMSContext.CurrentPageInfo = PageInfoProvider.GetPageInfo(CMSContext.CurrentSiteName, "/", CMSContext.PreferredCultureCode, null, false); // Title string title = CMSContext.CurrentTitle; if (!string.IsNullOrEmpty(title)) { title = "<title>" + title + "</title>"; } // Body class string bodyCss = CMSContext.CurrentBodyClass; if (bodyCss != null && bodyCss.Trim() != "") { bodyCss = "class=\"" + bodyCss + "\""; } else { bodyCss = ""; } // metadata string meta = "<meta http-equiv=\"pragma\" content=\"no-cache\" />"; string description = CMSContext.CurrentDescription; if (description != "") { meta += "<meta name=\"description\" content=\"" + description + "\" />"; } string keywords = CMSContext.CurrentKeyWords; if (keywords != "") { meta += "<meta name=\"keywords\" content=\"" + keywords + "\" />"; } // Site style sheet string cssSiteSheet = ""; CssStylesheetInfo cssInfo = null; int stylesheetId = CMSContext.CurrentPageInfo.DocumentStylesheetID; cssInfo = CssStylesheetInfoProvider.GetCssStylesheetInfo((stylesheetId > 0) ? stylesheetId : CMSContext.CurrentSite.SiteDefaultStylesheetID); if (cssInfo != null) { cssSiteSheet = CSSHelper.GetCSSFileLink(CSSHelper.GetStylesheetUrl(cssInfo.StylesheetName)); } // Theme css files string themeCssFiles = ""; if (cssInfo != null) { try { string directory = URLHelper.GetPhysicalPath(string.Format("~/App_Themes/{0}/", cssInfo.StylesheetName)); if (Directory.Exists(directory)) { foreach (string file in Directory.GetFiles(directory, "*.css")) { themeCssFiles += CSSHelper.GetCSSFileLink(CSSHelper.GetPhysicalCSSUrl(cssInfo.StylesheetName, Path.GetFileName(file))); } } } catch { } } // Add values to page mHead = FormatHTML(HighlightHTML(title + meta + cssSiteSheet + themeCssFiles), 2); mBody = bodyCss; } catch { lblError.Visible = true; lblError.Text = GetString("MasterPage.PageEditErr"); } // Prepare the hints and typw dropdown lblType.Text = ResHelper.GetString("PageLayout.Type"); if (drpType.Items.Count == 0) { drpType.Items.Add(new ListItem(ResHelper.GetString("TransformationType.Ascx"), TransformationTypeEnum.Ascx.ToString())); drpType.Items.Add(new ListItem(ResHelper.GetString("TransformationType.Html"), TransformationTypeEnum.Html.ToString())); } string lang = ValidationHelper.GetString(SettingsHelper.AppSettings["CMSProgrammingLanguage"], "C#"); ltlDirectives.Text = "<%@ Control Language=\"" + lang + "\" ClassName=\"Simple\" Inherits=\"CMS.PortalControls.CMSAbstractLayout\" %><br /><%@ Register Assembly=\"CMS.PortalControls\" Namespace=\"CMS.PortalControls\" TagPrefix=\"cc1\" %>"; if (!SettingsKeyProvider.UsingVirtualPathProvider) { lblChecked.Visible = true; lblChecked.Text = "<br />" + AddSpaces(2) + GetString("MasterPage.VirtualPathProviderNotRunning"); txtLayout.ReadOnly = true; } LoadData(); // Register synchronization script for split mode if (CMSContext.DisplaySplitMode) { RegisterSplitModeSync(true, false); } }
protected void AddResource_Click(object sender, ImageClickEventArgs e) { try { if (Session["KenticoUserInfo"] == null) return; var kenticoUserInfo = (UserInfo)Session["KenticoUserInfo"]; var userInfo = UserInfoProvider.GetUserInfo(kenticoUserInfo.UserName); var currentUser = new CurrentUserInfo(userInfo, true); if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", "EditForm")) { return; } var theImageButton = sender as ImageButton; if (theImageButton == null) { return; } string[] row = null; if (!string.IsNullOrEmpty(theImageButton.CommandArgument)) { row = theImageButton.CommandArgument.Split(new[] { "|@|" }, StringSplitOptions.None); } var theResource = new Resource(); if (row == null || row.Length <= 0) return; theResource.Source = row[0]; theResource.URL = theResource.Source == PBSLearningMedia ? row[5] : row[1]; theResource.ResourceName = row[3]; theResource.Description = row[4]; var clientId = DistrictParms.LoadDistrictParms().ClientID; var userAliasPath = String.Concat(FORWARD_SLASH, KenticoHelper.GetKenticoMainFolderName(clientId), FORWARD_SLASH, "Users"); var provider = new TreeProvider(currentUser); var parent = provider.SelectSingleNode(CMSContext.CurrentSiteName, userAliasPath + FORWARD_SLASH + kenticoUserInfo.UserName, "en-us"); var webLink = theResource.Source == PBSLearningMedia ? Request.Url.GetLeftPart(UriPartial.Authority) + ResolveUrl("~/Services/KenticoServices/KenticoWebServices.aspx?resource=PBSLearningMedia&url=" + theResource.URL) : theResource.URL; if (parent == null) return; var ci = DataClassInfoProvider.GetDataClass(ResourceClassName); var node = CMS.DocumentEngine.TreeNode.New(ResourceClassName, provider); node.SetValue("Type", 84); // static Resource ID node.SetValue("SubType", 97); // static Resource Web-Based ID node.SetValue("Name", theResource.ResourceName); node.SetValue("DocumentName", theResource.ResourceName); node.SetValue("Description", theResource.Description); node.SetValue("DocumentCulture", "en-us"); node.SetValue("CreateDate", DateTime.Now); node.SetValue("CreatedBy", kenticoUserInfo.UserName); node.SetValue("Category", 0); node.SetValue("AttachmentName", null); node.SetValue("Grade", null); node.SetValue("Subject", null); node.SetValue("Courses", null); node.SetValue("DocRecordID", null); node.SetValue("WebLink", webLink); node.SetValue("DocumentPageTemplateID", ci.ClassDefaultPageTemplateID); node.Insert(parent.NodeID); theImageButton.ImageUrl = "~/Images/Check.png"; theImageButton.ToolTip = "Resource Added to My Docs"; theImageButton.Enabled = false; } catch (Exception ex) { throw ex; } }
private void ShowMDSButtons(GridDataItem item, bool showTheButtons) { // ------------------------------------------ // check to make sure the user have permissions to add otherwise do not show button if (Session["KenticoUserInfo"] == null) return; var kenticoUserInfo = (UserInfo)Session["KenticoUserInfo"]; var userInfo = UserInfoProvider.GetUserInfo(kenticoUserInfo.UserName); var currentUser = new CurrentUserInfo(userInfo, true); if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", "EditForm")) { var button = (ImageButton)item.FindControl("AddAsNewMyDocsResource"); if (button != null) { button.Enabled = false; button.CssClass = "disabledButton"; } //item.FindControl("AddAsNewMyDocsResource").Visible = false; return; } // ------------------------------------------ item.FindControl("AddAsNewMyDocsResource").Visible = showTheButtons; //item.FindControl("AddAsNewDistrictResource").Visible = showTheButtons; //item.FindControl("AddAsNewStateResource").Visible = showTheButtons; }
protected void Page_Load(object sender, EventArgs e) { // Check permissions for CMS Desk -> Content -> Design -> Edit layout // It is placed here because this control is loaded dynamically by CMSPlaceHolder user = CMSContext.CurrentUser; if (!user.IsAuthorizedPerUIElement("CMS.Content", "Design.EditLayout")) { CMSPage.RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "Design.EditLayout"); } // Use UI culture for strings culture = user.PreferredUICultureCode; imgSave.ImageUrl = GetImageUrl("CMSModules/CMS_Content/EditMenu/save.png"); imgSave.AlternateText = ResHelper.GetString("general.save", culture); imgCheckOut.ImageUrl = GetImageUrl("CMSModules/CMS_Content/EditMenu/checkout.png"); imgCheckOut.AlternateText = ResHelper.GetString("general.checkout", culture); imgCheckIn.ImageUrl = GetImageUrl("CMSModules/CMS_Content/EditMenu/checkin.png"); imgCheckIn.AlternateText = ResHelper.GetString("general.checkinfromfile", culture); btnUndoCheckOut.OnClientClick = "return confirm(" + ScriptHelper.GetString(ResHelper.GetString("General.ConfirmUndoCheckOut", culture)) + ");"; imgUndoCheckOut.ImageUrl = GetImageUrl("~/App_Themes/Default/Images/CMSModules/CMS_Content/EditMenu/undocheckout.png"); imgUndoCheckOut.AlternateText = ResHelper.GetString("general.undocheckout", culture); lblType.Text = ResHelper.GetString("PageLayout.Type"); if (this.drpType.Items.Count == 0) { drpType.Items.Add(new ListItem(ResHelper.GetString("TransformationType.Ascx"), TransformationTypeEnum.Ascx.ToString())); drpType.Items.Add(new ListItem(ResHelper.GetString("TransformationType.Html"), TransformationTypeEnum.Html.ToString())); } string lang = DataHelper.GetNotEmpty(SettingsHelper.AppSettings["CMSProgrammingLanguage"], "C#"); ltlDirectives.Text = "<%@ Control Language=\"" + lang + "\" ClassName=\"Simple\" Inherits=\"CMS.PortalControls.CMSAbstractLayout\" %><br /><%@ Register Assembly=\"CMS.PortalControls\" Namespace=\"CMS.PortalControls\" TagPrefix=\"cc1\" %>"; // Disable buttons and inform about not usign virtual path provider if (!SettingsKeyProvider.UsingVirtualPathProvider) { this.btnCheckOut.Visible = false; this.btnCheckIn.Visible = false; this.btnUndoCheckOut.Visible = false; txtLayout.ReadOnly = true; } this.txtLayout.Editor.AutoSize = true; }
protected override void OnInit(EventArgs e) { base.OnInit(e); currentUser = MembershipContext.AuthenticatedUser; if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", "Properties.LinkedDocs")) { RedirectToUIElementAccessDenied("CMS.Content", "Properties.LinkedDocs"); } }
protected void Page_Load(object sender, EventArgs e) { // Register the scripts ScriptHelper.RegisterProgress(this); ScriptHelper.RegisterScriptFile(this, "~/CMSModules/Content/CMSDesk/Properties/template.js"); inheritElem.DocumentSettings = true; int documentId = 0; UIContext.PropertyTab = PropertyTabEnum.Template; currentUser = CMSContext.CurrentUser; nodeId = QueryHelper.GetInteger("nodeid", 0); tree = new TreeProvider(currentUser); node = tree.SelectSingleNode(nodeId, CMSContext.PreferredCultureCode, false); // Redirect to page 'New culture version' in split mode. It must be before setting EditedDocument. if ((node == null) && displaySplitMode) { URLHelper.Redirect("~/CMSModules/Content/CMSDesk/New/NewCultureVersion.aspx" + URLHelper.Url.Query); } // Set edited document EditedDocument = node; if (node != null) { siteid = node.NodeSiteID; documentId = node.DocumentID; } imgSaveDoc.ImageUrl = GetImageUrl("CMSModules/CMS_Content/EditMenu/save.png"); imgSaveDoc.DisabledImageUrl = GetImageUrl("CMSModules/CMS_Content/EditMenu/savedisabled.png"); mSaveDoc = GetString("general.save"); pnlInherits.GroupingText = GetString("PageProperties.InheritLevels"); ltlScript.Text = ""; string initScript = null; hasDesign = currentUser.IsAuthorizedPerResource("CMS.Design", "Design"); if (hasDesign) { btnEditTemplateProperties.Attributes.Add("onclick", "modalDialog('" + ResolveUrl("~/CMSModules/PortalEngine/UI/PageTemplates/PageTemplate_Edit.aspx") + "?templateid=' + document.getElementById('SelectedTemplateId').value + '&dialog=1', 'TemplateSelection', 850, 680);return false;"); bool allowEditShared = currentUser.IsAuthorizedPerUIElement("CMS.Content", "Template.ModifySharedTemplates"); // Define GetCurrentTemplateId() used for specifing teplateId in the SaveAsNewTemplate onClick handler initScript = @" var allowEditShared = " + allowEditShared.ToString().ToLower() + @"; function GetCurrentTemplateId() { if (document.getElementById('SelectedTemplateId').value > 0) { return document.getElementById('SelectedTemplateId').value; } else { return document.getElementById('InheritedTemplateId').value; } };" ; ltlPreInitScript.Text = ScriptHelper.GetScript(initScript); btnSelect.Text = GetString("PageProperties.Select"); btnSelect.Attributes.Add("onclick", "modalDialog('" + ResolveUrl(PORTALENGINE_UI_LAYOUTPATH + "PageTemplateSelector.aspx") + "?documentid=" + documentId + "', 'PageTemplateSelection', '90%', '85%'); return false;"); // Register the dialog script ScriptHelper.RegisterDialogScript(this); ltlElemScript.Text += ScriptHelper.GetScript( @" var cloneElem = document.getElementById('" + btnClone.ClientID + @"'); if (cloneElem != null) var cloneElemStyle = (cloneElem.style != null) ? cloneElem.style : cloneElem; var inheritElem = document.getElementById('" + btnInherit.ClientID + @"'); if (inheritElem != null) var inheritElemStyle = (inheritElem.style != null) ? inheritElem.style : inheritElem; var saveElem = document.getElementById('" + btnSave.ClientID + @"'); if (saveElem != null) var saveElemStyle = (saveElem.style != null) ? saveElem.style : saveElem; var editTemplatePropertiesElem = document.getElementById('" + btnEditTemplateProperties.ClientID + @"'); if (editTemplatePropertiesElem != null) var editTemplatePropertiesElemStyle = (editTemplatePropertiesElem.style != null) ? editTemplatePropertiesElem.style : editTemplatePropertiesElem; " ); txtTemplate.Text = ValidationHelper.GetString(Request.Params["txtTemplate"], ""); pnlActions.GroupingText = GetString("PageProperties.Template"); mClone = GetString("PageProperties.Clone"); mSave = GetString("PageProperties.Save"); mInherit = GetString("PageProperties.Inherit"); mEditTemplateProperties = GetString("PageProperties.EditTemplateProperties"); imgClone.ImageUrl = GetImageUrl("CMSModules/CMS_Content/Template/clone.png"); imgInherit.ImageUrl = GetImageUrl("CMSModules/CMS_Content/Template/inherit.png"); imgSave.ImageUrl = GetImageUrl("CMSModules/CMS_Content/Template/save.png"); imgEditTemplateProperties.ImageUrl = GetImageUrl("CMSModules/CMS_Content/Template/edit.png"); imgClone.DisabledImageUrl = GetImageUrl("CMSModules/CMS_Content/Template/clonedisabled.png"); imgInherit.DisabledImageUrl = GetImageUrl("CMSModules/CMS_Content/Template/inheritdisabled.png"); imgSave.DisabledImageUrl = GetImageUrl("CMSModules/CMS_Content/Template/savedisabled.png"); imgEditTemplateProperties.DisabledImageUrl = GetImageUrl("CMSModules/CMS_Content/Template/editdisabled.png"); } else { RedirectToUINotAvailable(); } if (!RequestHelper.IsPostBack()) { ReloadData(); // Modal dialog for save btnSaveOnClickScript = "modalDialog('" + ResolveUrl(PORTALENGINE_UI_LAYOUTPATH + "SaveNewPageTemplate.aspx") + "?templateId=' + GetCurrentTemplateId() + '&siteid=" + siteid + "', 'SaveNewTemplate', 480, 360);return false;"; if (node != null) { if (node.NodeAliasPath != "/") { inheritElem.Value = node.NodeInheritPageLevels; // Try get info whether exist linked document in path DataSet ds = tree.SelectNodes(CMSContext.CurrentSiteName, "/%", node.DocumentCulture, false, null, "NodeLinkedNodeID IS NOT NULL AND (N'" + SqlHelperClass.GetSafeQueryString(node.NodeAliasPath) + "' LIKE NodeAliasPath + '%')", null, -1, false, 1, "Count(*) AS NumOfDocs"); // If node is not link or none of parent documents is not linked document use document name path if (!node.IsLink && ValidationHelper.GetInteger(DataHelper.GetDataRowValue(ds.Tables[0].Rows[0], "NumOfDocs"), 0) == 0) { inheritElem.TreePath = TreePathUtils.GetParentPath("/" + node.DocumentNamePath); } // otherwise use alias path else { inheritElem.TreePath = TreePathUtils.GetParentPath("/" + node.NodeAliasPath); } } else { pnlInherits.Visible = false; } } } else if (hasDesign) { initScript = "document.getElementById('SelectedTemplateId').value = " + ValidationHelper.GetInteger(Request.Params["SelectedTemplateId"], 0) + "; \n " + "document.getElementById('InheritedTemplateId').value = " + ValidationHelper.GetInteger(Request.Params["InheritedTemplateId"], 0) + "; \n " + "document.getElementById('Saved').value = " + ValidationHelper.GetBoolean(Request.Params["Saved"], false).ToString().ToLower() + "; \n" + "document.getElementById('TemplateDisplayName').value = '" + ValidationHelper.GetString(Request.Params["TemplateDisplayName"], "") + "'; \n " + "document.getElementById('TemplateDescription').value = '" + ValidationHelper.GetString(Request.Params["TemplateDescription"], "") + "'; \n " + "document.getElementById('TemplateCategory').value = '" + ValidationHelper.GetString(Request.Params["TemplateCategory"], "") + "'; \n " + "document.getElementById('isPortal').value = " + ValidationHelper.GetBoolean(Request.Params["isPortal"], false).ToString().ToLower() + "; \n " + "document.getElementById('isReusable').value = " + ValidationHelper.GetBoolean(Request.Params["isReusable"], false).ToString().ToLower() + "; \n " + "document.getElementById('isAdHoc').value = " + ValidationHelper.GetBoolean(Request.Params["isAdHoc"], false).ToString().ToLower() + "; \n "; string textTemplate = ValidationHelper.GetString(Request.Params["txtTemplate"], ""); if (textTemplate == "") { textTemplate = ValidationHelper.GetString(Request.Params["TextTemplate"], ""); } initScript += "document.getElementById('TextTemplate').value = " + ScriptHelper.GetString(textTemplate) + "; \n "; ltlInitScript.Text = ScriptHelper.GetScript(initScript); ltlScript.Text += ScriptHelper.GetScript("ShowButtons(document.getElementById('isPortal').value, document.getElementById('isReusable').value, document.getElementById('isAdHoc').value); \n"); ltlScript.Text += ScriptHelper.GetScript("if (document.getElementById('SelectedTemplateId').value == 0) { if (inheritElemStyle != null) inheritElemStyle.display = 'none'; if (editTemplatePropertiesElemStyle != null) editTemplatePropertiesElemStyle.display = 'none'; }"); txtTemplate.Text = textTemplate; btnSaveOnClickScript = "modalDialog('" + ResolveUrl(PORTALENGINE_UI_LAYOUTPATH + "SaveNewPageTemplate.aspx") + "?templateId=' + GetCurrentTemplateId() + '&siteid=" + siteid + "', 'SaveNewTemplate', 480, 360);return false;"; } // Javascript function for updating template name string updateTemplateName = ScriptHelper.GetScript(@"function SetTemplateName(templateName) { var txtTemplate = document.getElementById('" + txtTemplate.ClientID + "'); txtTemplate.value = templateName;}"); ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "SetTemplateName", updateTemplateName); }