public override Rss.RssItem[] GetRssFeedItems(CmsPage page, CmsPlaceholderDefinition placeholderDefinition, CmsLanguage langToRenderFor) { base.categoryList = db.fetchCategoryList(langToRenderFor); RenderParameters renderParams = RenderParameters.FromPlaceholderParamList(placeholderDefinition.ParamList); CmsUrlFormat pageLinkFormat = CmsUrlFormat.FullIncludingProtocolAndDomainName; CmsUrlFormat fileLinkFormat = CmsUrlFormat.FullIncludingProtocolAndDomainName; FileAggItem[] filesToShow = FetchAllFilesToShow(page, placeholderDefinition.Identifier, langToRenderFor, renderParams, pageLinkFormat, fileLinkFormat); List <Rss.RssItem> ret = new List <Rss.RssItem>(); foreach (FileAggItem file in filesToShow) { Rss.RssItem rssItem = CreateAndInitRssItem(page, langToRenderFor); // -- link directly to the file url rssItem.Link = new Uri(file.FileDownloadURL, UriKind.RelativeOrAbsolute); rssItem.Guid = new Rss.RssGuid(rssItem.Link); rssItem.Title = file.Title; rssItem.Description = file.Description; rssItem.PubDate_GMT = file.LastModified.ToUniversalTime(); ret.Add(rssItem); } // foreach file return(ret.ToArray()); } // GetRssFeedItems
/// <summary> /// Render the placeholder in ViewMode /// </summary> /// <param name="writer"></param> /// <param name="page"></param> /// <param name="identifier"></param> /// <param name="langToRenderFor"></param> /// <param name="paramList"></param> public override void RenderInViewMode(HtmlTextWriter writer, CmsPage page, int identifier, CmsLanguage langToRenderFor, string[] paramList) { base.categoryList = db.fetchCategoryList(langToRenderFor); string controlId = "simplefileaggregator_" + page.ID.ToString() + "_" + identifier.ToString() + langToRenderFor.shortCode; RenderParameters renderParams = RenderParameters.FromPlaceholderParamList(paramList); CmsUrlFormat pageLinkFormat = CmsUrlFormat.RelativeToRoot; CmsUrlFormat fileLinkFormat = CmsUrlFormat.RelativeToRoot; List <FileAggItem> filesToShow = new List <FileAggItem>(FetchAllFilesToShow(page, identifier, langToRenderFor, renderParams, pageLinkFormat, fileLinkFormat)); StringBuilder html = new StringBuilder(); bool canWrite = page.currentUserCanWrite; if (renderFromEditMode) // don't render forms if we are in Edit Mode. { canWrite = false; } if (canWrite) { html.Append("<p>" + handleAssociateExistingSubmit(page, identifier, langToRenderFor, controlId, filesToShow, pageLinkFormat, fileLinkFormat) + "</p>" + EOL); html.Append("<p>" + base.handleUploadSubmit(page, identifier, langToRenderFor, controlId) + "</p>" + EOL); } FileAggItem[] uniqueFilesToShow = FileAggItem.RemoveDuplicates(filesToShow); html.Append(RenderToHtmlList(uniqueFilesToShow, renderParams, canWrite)); if (canWrite) { html.Append(renderAssociateExistingForm(page, controlId, langToRenderFor, uniqueFilesToShow, pageLinkFormat, fileLinkFormat)); html.Append(base.renderUploadForm(page, langToRenderFor, controlId)); } // List<FileLibraryDetailsData> filesToDisplay = FileLibraryDetailsData.FetchDetailsDataForPages(pagesToGetDetailsFrom); writer.Write(html.ToString()); }