/// <summary> /// OkClick Handler. /// </summary> protected void btnOk_Click(object sender, EventArgs e) { string culture = ValidationHelper.GetString(cultureSelector.Value, ""); if ((culture != "") && ((currentCulture.ToLowerCSafe() != culture.ToLowerCSafe()) || chkDocuments.Checked)) { // Set new culture SiteInfo si = SiteInfo.Provider.Get(siteId); if (si != null) { try { // Set default culture and change current culture label SettingsKeyInfoProvider.SetValue("CMSDefaultCultureCode", si.SiteName, culture.Trim()); if (PageRoutingHelper.HideLanguagePrefixForDefaultCultureUrl(si.SiteName)) { new PageUrlPathCultureFormatChanger(siteId).ChangeForCulture(currentCulture, PageRoutingUrlCultureFormatEnum.LanguagePrefix); new PageUrlPathCultureFormatChanger(siteId).ChangeForCulture(culture, PageRoutingUrlCultureFormatEnum.DomainDriven); } // Change culture of documents if (chkDocuments.Checked) { // Change culture of the documents TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser); tree.ChangeCulture(si.SiteName, currentCulture, culture); } if (!LicenseHelper.CheckFeature(RequestContext.CurrentDomain, FeatureEnum.Multilingual)) { // If not multilingual, remove all cultures from the site and assign new culture CultureSiteInfoProvider.RemoveSiteCultures(si.SiteName); CultureSiteInfoProvider.AddCultureToSite(culture, si.SiteName); } ltlScript.Text = ScriptHelper.GetScript("wopener.ChangeCulture('" + chkDocuments.Checked + "'); CloseDialog();"); } catch (Exception ex) { LogAndShowError("Sites", "ChangeDefaultCulture", ex); } } } else { ltlScript.Text = ScriptHelper.GetScript("CloseDialog();"); } }
private void SetUrlTextbox(bool refreshSlug = true) { var urlPath = Node.GetPageUrlPath(); var formattedPath = string.Empty; if (!string.IsNullOrEmpty(urlPath.ParentPath)) { PageRoutingHelper.EnsurePathFormat(urlPath.ParentPath, Node.NodeSiteID, out formattedPath); } txtSlug.MaxLength = PageUrlPath.SLUG_LENGTH; txtSlug.PlaceholderText = TextHelper.LimitLength(SitePresentationUrl + formattedPath, 45, CutTextEnum.Start); if (refreshSlug) { txtSlug.Value = urlPath.Slug; } }
protected override void OnInit(EventArgs e) { var showSlugsList = string.Equals(QueryHelper.GetString("subtab", null), PageRoutingUIHelper.SLUGS_LIST_SUBTAB_NAME, StringComparison.InvariantCultureIgnoreCase); if (showSlugsList) { URLHelper.Redirect(URLHelper.ResolveUrl(PageRoutingUIHelper.GetSlugsListingPath(Node.NodeID, Node.DocumentCulture))); } DocumentManager.RegisterEvents = false; DocumentManager.UseDocumentHelper = false; DocumentManager.CheckPermissions = false; base.OnInit(e); // Enable split mode EnableSplitMode = true; // Register the scripts ScriptHelper.RegisterLoader(Page); if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.Content", "Properties.URLs")) { RedirectToUIElementAccessDenied("CMS.Content", "Properties.URLs"); } pnlAlternativeUrls.Visible = AlternativeUrlHelper.IsAlternativeUrlUIEnabled(Node.NodeSiteID); pnlPageUrlPath.Visible = pnlContainer.Visible = PageRoutingHelper.GetRoutingMode(Node.NodeSiteID) == PageRoutingModeEnum.BasedOnContentTree; // Hide option to view all slugs when only one culture is assigned to the site btnDisplaySlugs.Visible = Node.Site.HasMultipleCultures; ScriptHelper.RegisterModule(this, "CMS/Clamp", new { elementWithTextSelector = ".static-textpanel" }); }
private void SetPreviewLinks() { string liveUrl = DocumentURLProvider.GetAbsoluteUrl(Node); if (string.IsNullOrEmpty(liveUrl) && PageRoutingHelper.GetRoutingMode(Node.NodeSiteID) == PageRoutingModeEnum.Custom) { litMissingPattern.Visible = true; } if (!string.IsNullOrEmpty(liveUrl)) { plcLive.Visible = true; lnkLiveURL.HRef = liveUrl; lnkLiveURL.InnerText = liveUrl; } var previewUrl = Node.GetPreviewLink(CurrentUser.UserGUID); if (!string.IsNullOrEmpty(previewUrl)) { plcPreview.Visible = true; btnResetPreviewGuid.ToolTip = GetString("content.ui.properties.invalidatepreviewurl"); btnResetPreviewGuid.Click += btnResetPreviewGuid_Click; btnResetPreviewGuid.OnClientClick = "if(!confirm(" + ScriptHelper.GetLocalizedString("content.ui.properties.generatepreviewurlconf") + ")){return false;}"; SetPreviewUrl(previewUrl); } if (MembershipContext.AuthenticatedUser.IsAuthorizedPerDocument(Node, NodePermissionsEnum.Modify) != AuthorizationResultEnum.Allowed) { btnResetPreviewGuid.Enabled = false; btnResetPreviewGuid.CssClass = "Disabled"; } UpdateLiveSiteButtonUrl(liveUrl); }
protected object gridUrlPaths_OnExternalDataBound(object sender, string sourceName, object parameter) { switch (sourceName.ToLowerInvariant()) { case "openlivesite": { if (pageCultures == null) { break; } var row = (DataRowView)((GridViewRow)parameter).DataItem; var urlPath = DataHelper.GetStringValue(row.Row, "PageUrlPathUrlPath"); var urlPathCulture = DataHelper.GetStringValue(row.Row, "PageUrlPathCulture"); PageRoutingHelper.EnsurePathFormat(urlPath, Node.NodeSiteID, out var formattedPath); var completeUrl = $"{GetSitePresentationUrl(urlPathCulture)}{formattedPath}"; var escapedUrl = Uri.EscapeUriString(completeUrl); var eyeButton = (CMSGridActionButton)sender; eyeButton.OnClientClick = $"window.open(\"{escapedUrl}\"); return false;"; var existsCultureVersion = pageCultures.Contains(urlPathCulture); eyeButton.Enabled = existsCultureVersion; eyeButton.ToolTip = existsCultureVersion ? ResHelper.GetString("content.ui.properties.pageurlpaths.openlivesite") : ResHelper.GetString("content.ui.properties.pageurlpaths.nonexistentcultureversion"); } break; case "edit": if (!CanEditPageUrlPath()) { var editButton = (CMSGridActionButton)sender; editButton.Enabled = false; } break; case "urlpath": { var row = (DataRowView)parameter; var urlPath = DataHelper.GetStringValue(row.Row, "PageUrlPathUrlPath"); var urlPathCulture = DataHelper.GetStringValue(row.Row, "PageUrlPathCulture"); PageRoutingHelper.EnsurePathFormat(urlPath, Node.NodeSiteID, out var formattedPath); var completeUrl = HTMLHelper.HTMLEncode($"{GetSitePresentationUrl(urlPathCulture)}{formattedPath}"); // Ensure correct values for unigrid export if (sender == null) { return(completeUrl); } if (!CanEditPageUrlPath()) { return(GetLabelControl(completeUrl)); } return(GetInlineEditingControl(row, urlPath, completeUrl)); } } return(parameter); }