From e72257b3f5a1643388087047fc4d550c8c922f9d Mon Sep 17 00:00:00 2001 From: "Rob G. Healey" Date: Mon, 14 Dec 2009 06:18:33 +0000 Subject: [PATCH] Cleaned up class MediaListPage and added mime type to the MediaListPage. svn: r13793 --- src/data/Web_Visually.css | 19 +++++++--- src/plugins/webreport/NarrativeWeb.py | 52 +++++++++++++++++---------- 2 files changed, 47 insertions(+), 24 deletions(-) diff --git a/src/data/Web_Visually.css b/src/data/Web_Visually.css index 27d525bf8..ff098827e 100644 --- a/src/data/Web_Visually.css +++ b/src/data/Web_Visually.css @@ -708,18 +708,27 @@ div#EventDetail table.eventlist tbody tr td.ColumnDate { margin: 0; padding: 0; } -#Gallery table.infolist tbody tr td.ColumnRowLabel, -#Gallery table.infolist tbody tr td.ColumnDate { - background-color: #D8F3D6; - padding-bottom:0; +#Gallery table.infolist tbody tr td { + background-colo: #D8F3D6; +} +#Gallery table.infolist tbody tr td.ColumnRowLabel { + width: 8%; + padding-bottom: 0; } #Gallery table.infolist tbody tr td.ColumnName { - padding:0; + padding: 0; + width: 50%; background-color: #FFF; } #Gallery table.infolist tbody tr td.ColumnName a { padding:.1em 10px .3em 10px; } +#Gallery table.infolist tbody tr td.ColumnDate { + width: 15%; +} +#Gallery table.infolist tbody tr td.ColumnMime { + width: 20%; +} #Gallery table.gallerylist tbody tr td { border-bottom: dashed 1px #5D835F; } diff --git a/src/plugins/webreport/NarrativeWeb.py b/src/plugins/webreport/NarrativeWeb.py index 51c8c32ee..f481dc075 100644 --- a/src/plugins/webreport/NarrativeWeb.py +++ b/src/plugins/webreport/NarrativeWeb.py @@ -2637,10 +2637,12 @@ class MediaPage(BasePage): with Html("div", id = "summaryarea") as summaryarea: mediadetail += summaryarea if mime_type: + print mime_type if mime_type.startswith("image/"): if not target_exists: - with Html("div", missingimage, id = "MediaDisplay") as mediadisplay: - summaryarea += mediadisplay + with Html("div", id = "MediaDisplay") as mediadisplay: + summaryarea += mediadisplay + mediadisplay += missingimage else: # Check how big the image is relative to the requested 'initial' # image size. If it's significantly bigger, scale it down to @@ -3251,31 +3253,37 @@ class MediaListPage(BasePage): medialistpage, body = self.write_header(_('Media'), _KEYPERSON) # begin gallery division - with Html("div", class_ = "content", id = "Gallery") as section: - body += section + with Html("div", class_ = "content", id = "Gallery") as medialist: + body += medialist msg = _("This page contains an index of all the media objects " "in the database, sorted by their title. Clicking on " "the title will take you to that media object’s page. " "If you see media size densions above an image, click on the " "image to see the full sized version. ") - section += Html("p", msg, id = "description") + medialist += Html("p", msg, id = "description") # begin gallery table and table head with Html("table", class_ = "infolist gallerylist") as table: - section += table + medialist += table # begin table head thead = Html("thead") table += thead - trow = Html("tr") + ( - Html("th", " ", class_ = "ColumnRowLabel", inline = True), - Html("th", _("Media | Name"), class_ = "ColumnName", inline = True), - Html("th", DHEAD, class_ = "ColumnDate", inline = True) - ) + trow = Html("tr") thead += trow - + media_header_row = [ + [" ", "RowLabel"], + [_("Media | Name"), "Name"], + [DHEAD, "Date"], + [_("Mime Type"), "Mime"] + ] + trow.extend( + Html("th", label, class_ = "Column" + colclass, inline = True) + for (label, colclass) in media_header_row + ) + # begin table body tbody = Html("tbody") table += tbody @@ -3286,19 +3294,25 @@ class MediaListPage(BasePage): for handle in mlist: media = db.get_object_from_handle(handle) - date = _dd.display(media.get_date_object() ) title = media.get_description() if not title: title = "[untitled]" - trow = Html("tr") + ( - Html("td", index, class_ = "ColumnRowLabel", inline = True), - Html("td", self.media_ref_link(handle, title), class_ = "ColumnName"), - Html("td", date, class_ = "ColumnDate", inline = True) - ) + trow = Html("tr") tbody += trow - # increment counter + media_data_row = [ + [index, "RowLabel"], + [self.media_ref_link(handle, title), "Name"], + [_dd.display(media.get_date_object() ), "Date"], + [media.get_mime_type(), "Mime"] + ] + + trow.extend( + Html("td", data, class_ = "Column" + colclass) + for (data, colclass) in media_data_row + ) + index += 1 # add footer section