Cleaned up class MediaListPage and added mime type to the MediaListPage.

svn: r13793
This commit is contained in:
Rob G. Healey 2009-12-14 06:18:33 +00:00
parent 97f8091467
commit e72257b3f5
2 changed files with 47 additions and 24 deletions

View File

@ -708,18 +708,27 @@ div#EventDetail table.eventlist tbody tr td.ColumnDate {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
#Gallery table.infolist tbody tr td.ColumnRowLabel, #Gallery table.infolist tbody tr td {
#Gallery table.infolist tbody tr td.ColumnDate { background-colo: #D8F3D6;
background-color: #D8F3D6; }
padding-bottom:0; #Gallery table.infolist tbody tr td.ColumnRowLabel {
width: 8%;
padding-bottom: 0;
} }
#Gallery table.infolist tbody tr td.ColumnName { #Gallery table.infolist tbody tr td.ColumnName {
padding:0; padding: 0;
width: 50%;
background-color: #FFF; background-color: #FFF;
} }
#Gallery table.infolist tbody tr td.ColumnName a { #Gallery table.infolist tbody tr td.ColumnName a {
padding:.1em 10px .3em 10px; 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 { #Gallery table.gallerylist tbody tr td {
border-bottom: dashed 1px #5D835F; border-bottom: dashed 1px #5D835F;
} }

View File

@ -2637,10 +2637,12 @@ class MediaPage(BasePage):
with Html("div", id = "summaryarea") as summaryarea: with Html("div", id = "summaryarea") as summaryarea:
mediadetail += summaryarea mediadetail += summaryarea
if mime_type: if mime_type:
print mime_type
if mime_type.startswith("image/"): if mime_type.startswith("image/"):
if not target_exists: if not target_exists:
with Html("div", missingimage, id = "MediaDisplay") as mediadisplay: with Html("div", id = "MediaDisplay") as mediadisplay:
summaryarea += mediadisplay summaryarea += mediadisplay
mediadisplay += missingimage
else: else:
# Check how big the image is relative to the requested 'initial' # Check how big the image is relative to the requested 'initial'
# image size. If it's significantly bigger, scale it down to # 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) medialistpage, body = self.write_header(_('Media'), _KEYPERSON)
# begin gallery division # begin gallery division
with Html("div", class_ = "content", id = "Gallery") as section: with Html("div", class_ = "content", id = "Gallery") as medialist:
body += section body += medialist
msg = _("This page contains an index of all the media objects " msg = _("This page contains an index of all the media objects "
"in the database, sorted by their title. Clicking on " "in the database, sorted by their title. Clicking on "
"the title will take you to that media object’s page. " "the title will take you to that media object’s page. "
"If you see media size densions above an image, click on the " "If you see media size densions above an image, click on the "
"image to see the full sized version. ") "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 # begin gallery table and table head
with Html("table", class_ = "infolist gallerylist") as table: with Html("table", class_ = "infolist gallerylist") as table:
section += table medialist += table
# begin table head # begin table head
thead = Html("thead") thead = Html("thead")
table += thead table += thead
trow = Html("tr") + ( trow = Html("tr")
Html("th", " ", class_ = "ColumnRowLabel", inline = True),
Html("th", _("Media | Name"), class_ = "ColumnName", inline = True),
Html("th", DHEAD, class_ = "ColumnDate", inline = True)
)
thead += trow 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 # begin table body
tbody = Html("tbody") tbody = Html("tbody")
table += tbody table += tbody
@ -3286,19 +3294,25 @@ class MediaListPage(BasePage):
for handle in mlist: for handle in mlist:
media = db.get_object_from_handle(handle) media = db.get_object_from_handle(handle)
date = _dd.display(media.get_date_object() )
title = media.get_description() title = media.get_description()
if not title: if not title:
title = "[untitled]" title = "[untitled]"
trow = Html("tr") + ( 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)
)
tbody += trow 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 index += 1
# add footer section # add footer section