/// <summary> /// Returns URL of the media item according site settings. /// </summary> /// <param name="nodeGuid">Node GUID of the current attachment node</param> /// <param name="documentUrlPath">URL path of the current attachment document</param> /// <param name="nodeAlias">Node alias of the current attachment node</param> /// <param name="nodeAliasPath">Node alias path of the current attachment node</param> /// <param name="nodeIsLink">Indicates if node is linked node.</param> /// <param name="height">Height of the attachment</param> /// <param name="width">Width of the attachment</param> /// <param name="maxSideSize">Maximum dimension for images displayed for thumbnails view</param> /// <param name="notAttachment">Indicates if item is not attachment</param> /// <param name="documentExtension">Document extension</param> public string GetContentItemUrl(Guid nodeGuid, string documentUrlPath, string nodeAlias, string nodeAliasPath, bool nodeIsLink, int height, int width, int maxSideSize, bool notAttachment, string documentExtension) { string result; if (documentExtension.Contains(";")) { documentExtension = documentExtension.Split(';')[0]; } // Generate URL if (UsePermanentUrls) { bool isLink = ((OutputFormat == OutputFormatEnum.BBLink) || (OutputFormat == OutputFormatEnum.HTMLLink)) || ((OutputFormat == OutputFormatEnum.URL) && (SelectableContent == SelectableContentEnum.AllContent)); if (String.IsNullOrEmpty(nodeAlias)) { nodeAlias = "default"; } if (notAttachment || isLink) { result = DocumentURLProvider.GetPermanentDocUrl(nodeGuid, nodeAlias, SiteObj.SiteName, null, documentExtension); } else { result = AttachmentInfoProvider.GetPermanentAttachmentUrl(nodeGuid, nodeAlias, documentExtension); } } else { string docUrlPath = nodeIsLink ? null : documentUrlPath; // Ensure live site view mode for URLs edited in on-site edit mode if (PortalContext.ViewMode.IsEditLive()) { PortalContext.SetRequestViewMode(ViewModeEnum.LiveSite); } result = DocumentURLProvider.GetUrl(nodeAliasPath, docUrlPath, SiteObj.SiteName, null, documentExtension); } // Make URL absolute if required int currentSiteId = SiteContext.CurrentSiteID; if (Config.UseFullURL || (currentSiteId != SiteObj.SiteID) || (currentSiteId != GetCurrentSiteId())) { result = URLHelper.GetAbsoluteUrl(result, SiteObj.DomainName, URLHelper.GetApplicationUrl(SiteObj.DomainName), null); } return(AddURLDimensionsAndResolve(result, height, width, maxSideSize)); }
private void ReloadData() { if (Node != null) { // Hide parts which are not relevant to content only nodes if (ShowContentOnlyProperties) { pnlUIAdvanced.Visible = false; pnlUICache.Visible = false; pnlUIDesign.Visible = false; plcPermanent.Visible = false; pnlUIOnlineMarketing.Visible = false; } // Log activities checkboxes if (!RequestHelper.IsPostBack()) { bool?logVisit = Node.DocumentLogVisitActivity; chkLogPageVisit.Checked = (logVisit == true); if (Node.NodeParentID > 0) // Init "inherit" option for child nodes (and hide option for root) { chkPageVisitInherit.Checked = (logVisit == null); if (logVisit == null) { chkPageVisitInherit_CheckedChanged(null, EventArgs.Empty); } } chkLogPageVisit.Enabled = !chkPageVisitInherit.Checked; } // Check modify permission canEdit = (MembershipContext.AuthenticatedUser.IsAuthorizedPerDocument(Node, NodePermissionsEnum.Modify) != AuthorizationResultEnum.Denied); // Show document group owner selector if (ModuleEntryManager.IsModuleLoaded(ModuleName.COMMUNITY) && canEditOwner && LicenseHelper.CheckFeature(RequestContext.CurrentDomain, FeatureEnum.Groups)) { plcOwnerGroup.Controls.Clear(); // Initialize panel content Panel rowWrapperPanel = new Panel(); rowWrapperPanel.CssClass = "form-group"; Panel lblPanel = new Panel(); lblPanel.CssClass = "editing-form-label-cell"; Panel ctrlPanel = new Panel(); ctrlPanel.CssClass = "editing-form-value-cell"; // Initialize caption LocalizedLabel lblOwnerGroup = new LocalizedLabel(); lblOwnerGroup.EnableViewState = false; lblOwnerGroup.ResourceString = "community.group.documentowner"; lblOwnerGroup.ID = "lblOwnerGroup"; lblOwnerGroup.CssClass = "control-label"; lblPanel.Controls.Add(lblOwnerGroup); // Initialize selector fcDocumentGroupSelector = (FormEngineUserControl)Page.LoadUserControl("~/CMSAdminControls/UI/Selectors/DocumentGroupSelector.ascx"); fcDocumentGroupSelector.ID = "fcDocumentGroupSelector"; fcDocumentGroupSelector.StopProcessing = pnlUIOwner.IsHidden; ctrlPanel.Controls.Add(fcDocumentGroupSelector); fcDocumentGroupSelector.Value = ValidationHelper.GetInteger(Node.GetValue("NodeGroupID"), 0); fcDocumentGroupSelector.SetValue("siteid", SiteContext.CurrentSiteID); fcDocumentGroupSelector.SetValue("nodeid", Node.NodeID); // Add controls to containers rowWrapperPanel.Controls.Add(lblPanel); rowWrapperPanel.Controls.Add(ctrlPanel); plcOwnerGroup.Controls.Add(rowWrapperPanel); plcOwnerGroup.Visible = true; } // Show owner editing only when authorized to change the permissions if (canEditOwner) { lblOwner.Visible = false; usrOwner.Visible = true; usrOwner.SetValue("AdditionalUsers", new[] { Node.NodeOwner }); } else { usrOwner.Visible = false; } if (!RequestHelper.IsPostBack()) { if (canEditOwner) { usrOwner.Value = Node.GetValue("NodeOwner"); } } // Load the data lblName.Text = HttpUtility.HtmlEncode(Node.GetDocumentName()); lblNamePath.Text = HttpUtility.HtmlEncode(Convert.ToString(Node.GetValue("DocumentNamePath"))); lblAliasPath.Text = Convert.ToString(Node.NodeAliasPath); string typeName = DataClassInfoProvider.GetDataClassInfo(Node.NodeClassName).ClassDisplayName; lblType.Text = HttpUtility.HtmlEncode(ResHelper.LocalizeString(typeName)); lblNodeID.Text = Convert.ToString(Node.NodeID); // Modifier SetUserLabel(lblLastModifiedBy, "DocumentModifiedByUserId"); // Get modified time TimeZoneInfo usedTimeZone; DateTime lastModified = ValidationHelper.GetDateTime(Node.GetValue("DocumentModifiedWhen"), DateTimeHelper.ZERO_TIME); lblLastModified.Text = TimeZoneHelper.GetCurrentTimeZoneDateTimeString(lastModified, MembershipContext.AuthenticatedUser, SiteContext.CurrentSite, out usedTimeZone); ScriptHelper.AppendTooltip(lblLastModified, TimeZoneHelper.GetUTCLongStringOffset(usedTimeZone), "help"); if (!canEditOwner) { // Owner SetUserLabel(lblOwner, "NodeOwner"); } // Creator SetUserLabel(lblCreatedBy, "DocumentCreatedByUserId"); DateTime createdWhen = ValidationHelper.GetDateTime(Node.GetValue("DocumentCreatedWhen"), DateTimeHelper.ZERO_TIME); lblCreated.Text = TimeZoneHelper.GetCurrentTimeZoneDateTimeString(createdWhen, MembershipContext.AuthenticatedUser, SiteContext.CurrentSite, out usedTimeZone); ScriptHelper.AppendTooltip(lblCreated, TimeZoneHelper.GetUTCLongStringOffset(usedTimeZone), "help"); // URL if (plcPermanent.Visible) { string permanentUrl = DocumentURLProvider.GetPermanentDocUrl(Node.NodeGUID, Node.NodeAlias, Node.NodeSiteName, extension: ".aspx"); permanentUrl = URLHelper.ResolveUrl(permanentUrl); lnkPermanentURL.HRef = permanentUrl; lnkPermanentURL.InnerText = permanentUrl; } string liveUrl = DocumentURLProvider.GetAbsoluteLiveSiteURL(Node); lnkLiveURL.HRef = liveUrl; lnkLiveURL.InnerText = liveUrl; bool isRoot = Node.IsRoot(); // Hide preview URL for root node if (!isRoot) { plcPreview.Visible = true; btnResetPreviewGuid.ToolTip = GetString("GeneralProperties.InvalidatePreviewURL"); btnResetPreviewGuid.Click += btnResetPreviewGuid_Click; btnResetPreviewGuid.OnClientClick = "if(!confirm(" + ScriptHelper.GetLocalizedString("GeneralProperties.GeneratePreviewURLConf") + ")){return false;}"; InitPreviewUrl(); } lblGUID.Text = Convert.ToString(Node.NodeGUID); lblDocGUID.Text = (Node.DocumentGUID == Guid.Empty) ? ResHelper.Dash : Node.DocumentGUID.ToString(); lblDocID.Text = Convert.ToString(Node.DocumentID); // Culture CultureInfo ci = CultureInfoProvider.GetCultureInfo(Node.DocumentCulture); lblCulture.Text = ((ci != null) ? ResHelper.LocalizeString(ci.CultureName) : Node.DocumentCulture); if (Node.IsPublished) { lblPublished.Text = GetString("General.Yes"); lblPublished.CssClass += " DocumentPublishedYes"; } else { lblPublished.CssClass += " DocumentPublishedNo"; lblPublished.Text = GetString("General.No"); } // Load page info for inherited cache settings currentPage = PageInfoProvider.GetPageInfo(Node.NodeSiteName, Node.NodeAliasPath, Node.DocumentCulture, null, Node.NodeID, false); if (!RequestHelper.IsPostBack()) { // Init radio buttons for cache settings if (isRoot) { radInherit.Visible = false; radFSInherit.Visible = false; chkCssStyle.Visible = false; } else { // Show what is inherited value radInherit.Text = GetString("GeneralProperties.radInherit") + " (" + GetInheritedCacheCaption("NodeCacheMinutes") + ")"; radFSInherit.Text = GetString("GeneralProperties.radInherit") + " (" + GetInheritedCacheCaption("NodeAllowCacheInFileSystem") + ")"; } string cacheMinutes = ""; switch (Node.NodeCacheMinutes) { case null: // Cache setting is inherited { radNo.Checked = true; radYes.Checked = false; radInherit.Checked = false; if (!isRoot) { radInherit.Checked = true; radNo.Checked = false; if ((currentPage != null) && (currentPage.NodeCacheMinutes > 0)) { cacheMinutes = currentPage.NodeCacheMinutes.ToString(); } } } break; case 0: // Cache is off radNo.Checked = true; radYes.Checked = false; radInherit.Checked = false; break; default: // Cache is enabled radNo.Checked = false; radYes.Checked = true; radInherit.Checked = false; cacheMinutes = Node.NodeCacheMinutes.ToString(); break; } // Set secured radio buttons switch (Node.NodeAllowCacheInFileSystem) { case false: radFSNo.Checked = true; break; case true: radFSYes.Checked = true; break; default: if (!isRoot) { radFSInherit.Checked = true; } else { radFSYes.Checked = true; } break; } txtCacheMinutes.Text = cacheMinutes; if (!radYes.Checked) { txtCacheMinutes.Enabled = false; } var defaultStylesheet = GetDefaultStylesheet(); if (Node.DocumentInheritsStylesheet && !isRoot) { chkCssStyle.Checked = true; // Get stylesheet from the parent node string value = GetStylesheetParentValue(); ctrlSiteSelectStyleSheet.Value = String.IsNullOrEmpty(value) ? defaultStylesheet : value; } else { // Get stylesheet from the current node var stylesheetId = Node.DocumentStylesheetID; ctrlSiteSelectStyleSheet.Value = (stylesheetId == 0) ? defaultStylesheet : stylesheetId.ToString(); } } // Disable new button if document inherit stylesheet bool disableCssSelector = (!isRoot && chkCssStyle.Checked); ctrlSiteSelectStyleSheet.Enabled = !disableCssSelector; ctrlSiteSelectStyleSheet.ButtonNewEnabled = !disableCssSelector; // Initialize Rating control RefreshCntRatingResult(); double rating = 0.0f; if (Node.DocumentRatings > 0) { rating = Node.DocumentRatingValue / Node.DocumentRatings; } ratingControl.MaxRating = 10; ratingControl.CurrentRating = rating; ratingControl.Visible = true; ratingControl.Enabled = false; // Initialize Reset button for rating btnResetRating.OnClientClick = "if (!confirm(" + ScriptHelper.GetString(GetString("GeneralProperties.ResetRatingConfirmation")) + ")) return false;"; object[] param = new object[1]; param[0] = Node.DocumentID; plcAdHocForums.Visible = hasAdHocForum; plcAdHocBoards.Visible = hasAdHocBoard; if (!canEdit) { // Disable form editing DisableFormEditing(); } } else { btnResetRating.Visible = false; } }