/// <summary> /// Under edit mode, render the right hand side of the file details page as form (HTML INPUT or TEXTAREA, etc...) /// </summary> /// <param name="detailsPage"></param> /// <param name="identifier"></param> /// <param name="lang"></param> /// <param name="fileData"></param> /// <param name="controlId"></param> /// <returns></returns> protected string renderRightPaneForm(CmsPage detailsPage, int identifier, CmsLanguage lang, FileLibraryDetailsData fileData, string controlId, CmsUrlFormat fileUrlFormat) { string fName = fileData.FileName; StringBuilder html = new StringBuilder(); html.Append("<div style=\"float: left;\" class=\"listing\">" + EOL); html.Append(renderDiv(getFileText(lang), FileLibraryDetailsData.getDownloadAnchorHtml(detailsPage, identifier, lang, fName, fileUrlFormat))); string cssClass = "fileLibrary_categoryId"; string popupCategory = FileLibraryCategoryData.getEditPopupAnchor(lang, cssClass, getEditText(lang)); string htmlId = controlId + "categoryId"; NameValueCollection categoryColl = new NameValueCollection(); foreach (FileLibraryCategoryData c in categoryList) { categoryColl.Add(c.CategoryId.ToString(), c.CategoryName); } string selectCategory = getCategoryOption(lang, controlId, fileData.CategoryId); html.Append(renderDiv(getCategoryText(lang) + " " + popupCategory, selectCategory)); htmlId = controlId + "author"; html.Append(renderDiv(getAuthorText(lang), PageUtils.getInputTextHtml(htmlId, htmlId, fileData.Author, 30, 50))); htmlId = controlId + "description"; html.Append(renderDiv(getDocumentAbstractText(lang), PageUtils.getTextAreaHtml(htmlId, htmlId, fileData.Description, 25, 5))); if (getFileTypeName(fileData).EndsWith("graphic", StringComparison.CurrentCultureIgnoreCase)) { string imgPreviewUrl = showThumbPage.getThumbDisplayUrl(FileLibraryDetailsData.getDownloadUrl(detailsPage, identifier, lang, fName, fileUrlFormat), 200, -1); string imgTag = "<img border=\"0\" src=\"" + imgPreviewUrl + "\"></a>"; html.Append(renderDiv(getImagePreviewText(lang), FileLibraryDetailsData.getDownloadAnchorHtml(detailsPage, identifier, lang, fName, imgTag, "_blank", "", fileUrlFormat))); } bool eventRequired = FileLibraryCategoryData.isEventRequired(categoryList, fileData.CategoryId); if (eventRequired || fileData.EventPageId >= 0) { htmlId = controlId + "eventPageId"; html.Append(renderDiv(getAttachedEventText(lang), getEventOption(lang, controlId, fileData.EventPageId, eventRequired))); } WebPortalUser u = WebPortalUser.FetchUser(fileData.CreatedBy, CmsPortalApplication.GetInstance()); string uploadPersonName = (u == null) ? fileData.CreatedBy : u.FullName; html.Append(renderDiv(getUploadedByText(lang), uploadPersonName)); html.Append(renderDiv(getLastUpdatedText(lang), detailsPage.LastUpdatedDateTime.ToString("MMMM d yyyy h:mm tt"))); html.Append("</div>" + EOL); return(html.ToString()); }
public static FileAggItem FromFileLibraryDetailsData(FileLibraryDetailsData sourceDetails, List <FileLibraryCategoryData> categoryList, CmsUrlFormat pageLinkUrlFormat, CmsUrlFormat fileLinkUrlFormat) { CmsPage detailsPage = CmsContext.getPageById(sourceDetails.DetailsPageId); string PageDisplayURL = detailsPage.getUrl(sourceDetails.Lang, pageLinkUrlFormat); string FileDownloadURL = FileLibraryDetailsData.getDownloadUrl(detailsPage, sourceDetails.Identifier, sourceDetails.Lang, sourceDetails.FileName, fileLinkUrlFormat); string Title = detailsPage.getTitle(sourceDetails.Lang); string Description = sourceDetails.Description; string CategoryName = FileLibraryCategoryData.getCategoryFromList(categoryList, sourceDetails.CategoryId).CategoryName; DateTime lastModified = detailsPage.LastUpdatedDateTime; return(new FileAggItem(PageDisplayURL, FileDownloadURL, Title, Description, CategoryName, lastModified)); }
/// <summary> /// Render right hand side of the file details page (all details) /// </summary> /// <param name="detailsPage"></param> /// <param name="identifier"></param> /// <param name="lang"></param> /// <param name="fileData"></param> /// <returns></returns> protected string renderRightPane(CmsPage detailsPage, int identifier, CmsLanguage lang, FileLibraryDetailsData fileData, CmsUrlFormat fileUrlFormat) { string fName = fileData.FileName; StringBuilder html = new StringBuilder(); html.Append("<div style=\"float: left;\" class=\"listing\">" + EOL); html.Append(renderDiv(getFileText(lang), FileLibraryDetailsData.getDownloadAnchorHtml(detailsPage, identifier, lang, fName, fileUrlFormat))); html.Append(renderDiv(getCategoryText(lang), fileData.getCategoryName(categoryList))); html.Append(renderDiv(getAuthorText(lang), fileData.Author)); html.Append(renderDiv(getDocumentAbstractText(lang), StringUtils.nl2br(fileData.Description))); if (getFileTypeName(fileData).EndsWith("graphic", StringComparison.CurrentCultureIgnoreCase)) { string imgPreviewUrl = showThumbPage.getThumbDisplayUrl(FileLibraryDetailsData.getDownloadUrl(detailsPage, identifier, lang, fName, fileUrlFormat), 200, -1); string imgTag = "<img border=\"0\" src=\"" + imgPreviewUrl + "\"></a>"; html.Append(renderDiv(getImagePreviewText(lang), FileLibraryDetailsData.getDownloadAnchorHtml(detailsPage, identifier, lang, fName, imgTag, "_blank", "", fileUrlFormat))); } bool eventRequired = FileLibraryCategoryData.isEventRequired(categoryList, fileData.CategoryId); if (eventRequired) { string eventHtml = "(n/a)"; if (fileData.EventPageId > -1) { CmsPage eventPage = CmsContext.getPageById(fileData.EventPageId); eventHtml = "<a href=\"" + eventPage.getUrl(lang) + "\">" + eventPage.getTitle(lang) + "</a>" + EOL; } html.Append(renderDiv(getAttachedEventText(lang), eventHtml)); } WebPortalUser u = WebPortalUser.FetchUser(fileData.CreatedBy, CmsPortalApplication.GetInstance()); string uploadPersonName = (u == null) ? fileData.CreatedBy : u.FullName; html.Append(renderDiv(getUploadedByText(lang), uploadPersonName)); html.Append(renderDiv(getLastUpdatedText(lang), detailsPage.LastUpdatedDateTime.ToString("MMMM d yyyy h:mm tt"))); html.Append("</div>" + EOL); return(html.ToString()); }