private string getHtmlForJobsInLocation(Dictionary <CmsPage, List <JobPostingDetailsData> > haystack, JobPostingLocation location, CmsLanguage langToDisplay) { int numJobsToDisplay = 0; StringBuilder html = new StringBuilder(); html.Append("<h2 class=\"JobLocation\">" + location.getLocationText(langToDisplay) + "</h2>" + Environment.NewLine); html.Append("<ul>" + Environment.NewLine); foreach (CmsPage jobPage in haystack.Keys) { foreach (JobPostingDetailsData job in haystack[jobPage]) { if (job.LocationId == location.JobLocationId) { if (job.IsExpired) { html.Append("<span class=\"jobExpiredNotice\" style=\"background-color: yellow; font-weight: bold\">EXPIRED:</span> "); } html.Append("<strong>"); html.Append(jobPage.Title); html.Append("</strong>"); html.Append(" <a class=\"rightArrowLink\" href=\"" + jobPage.Url + "\">" + getFullJobDescriptionText(langToDisplay) + "</a>" + Environment.NewLine); html.Append("<br><br>"); numJobsToDisplay++; } } // foreach job } // foreach page html.Append("</ul>" + Environment.NewLine); if (numJobsToDisplay == 0) { return(""); } return(html.ToString()); }
} // RenderEdit public override void RenderInViewMode(HtmlTextWriter writer, CmsPage page, int identifier, CmsLanguage langToRenderFor, string[] paramList) { // -- revise the Edit Menu CmsPage aggregatorPage = page.ParentPage; JobPostingAggregator.AddJobPostingCommandToEditMenu(page, aggregatorPage); JobPostingDb db = new JobPostingDb(); JobPostingDetailsData postingDetails = db.getJobPostingDetailsData(page, identifier, langToRenderFor, true); JobPostingLocation location = JobPostingLocation.Fetch(postingDetails.LocationId); StringBuilder html = new StringBuilder(); html.Append("<div class=\"JobPostingDetails View\">"); if (IncludeBackLinkInDisplay) { string aggregatorUrl = aggregatorPage.Url; html.Append("<p class=\"jobBackToAggregator\"><strong><a class=\"backToPrev\" href=\"" + aggregatorUrl + "\">" + getBackToJobListingText(langToRenderFor) + "</a></strong><p>"); } // -- if the posting is expired, don't let non-authors view it. if (postingDetails.IsExpired && !page.currentUserCanWrite) { throw new CmsPageNotFoundException(); } if (page.currentUserCanWrite && postingDetails.IsExpired) { html.Append("<div class=\"jobExpiredNotice\" style=\"background-color: yellow; font-weight: bold\">This job posting expired on " + postingDetails.RemoveAnonAccessAt.ToString("d MMM yyyy") + "</div> "); } else if (page.currentUserCanWrite && postingDetails.RemoveAnonAccessAt.Date != JobPostingDetailsData.NoExpiryDateTime.Date) { html.Append("<p class=\"jobExpiredNotice\" style=\"background-color: yellow; font-weight: bold\">This job will be removed from public access on " + postingDetails.RemoveAnonAccessAt.ToString("d MMM yyyy") + "</p>"); } if (IncludeLocationInDisplay) { html.Append("<p class=\"jobLocation\">" + getLocationText(langToRenderFor) + ": " + location.getLocationText(langToRenderFor) + "</p>"); } html.Append("</div>" + Environment.NewLine); writer.Write(html.ToString()); } // RenderView