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 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); }