From e35544a0df7aaaf9f7e9378367f67635befd2759 Mon Sep 17 00:00:00 2001 From: "Rob G. Healey" Date: Mon, 28 Sep 2009 23:52:05 +0000 Subject: [PATCH] Fixed Events in display_event_header(), display_event_row(), write_event_row(), class EventListPage and EventOage. Cleanup little with alphabet_navigation(), corrections and modifications to stylesheet to match. svn: r13271 --- src/data/Web_Visually.css | 17 +++-- src/plugins/webreport/NarrativeWeb.py | 89 +++++++++++++-------------- 2 files changed, 56 insertions(+), 50 deletions(-) diff --git a/src/data/Web_Visually.css b/src/data/Web_Visually.css index 73eb43c19..5e48df4c8 100644 --- a/src/data/Web_Visually.css +++ b/src/data/Web_Visually.css @@ -304,7 +304,7 @@ body#WebCal div#navigation ul li a { } #navigation ul li a:hover, #subnavigation ul li a:hover { margin-top: -6px; - padding: 11px 11px 12px 10px; + padding: 11px 11px 12px 1px; background-color: #C1B398; color: #000; } @@ -581,16 +581,16 @@ div#EventList, div#EventDetail { } div#events table.eventlist { margin-top: .3cm; } -table.eventlist tbody tr { +table.eventlist tbody tr.BeginName { border-bottom: solid 1px #5D835F; } table.eventlist tbody tr td { background-color: #D8F3D6; padding: 4px 0px 4px 0px; + border-bottom: dashed 1px #000; } -table.eventlist tbody tr td.ColumnType { +table.eventlist tbody tr td.ColumnEvent { background-color: #FFF; - border-top: solid 1px #5D835F; width: 20%; } table.eventlist tbody tr td.ColumnDate { @@ -615,6 +615,12 @@ table.eventlist tbody tr td.ColumnPartner { background-color: #FFF; width: 35%; } +div#EventList table.eventlist tbody tr td.ColumnEvent a, +div#EventList table.eventlist tbody tr td.ColumnPerson a, +div#EventList table.eventlist tbody tr td.ColumnPartner a { + display: block; + padding: .9em 10px; +} div#EventDetail h3 { font-size: xxx-large; } @@ -631,8 +637,9 @@ div#EventDetail table.eventlist tbody tr td.ColumnAttribute { text-transform: uppercase; width: 20%; } -div#EventDetail table.eventlist tbody tr td.ColumnType { +div#EventDetail table.eventlist tbody tr td.ColumnEvent { background-color: #D8F3D6; + border-top: solid 1px #5D835F; } /* Gallery diff --git a/src/plugins/webreport/NarrativeWeb.py b/src/plugins/webreport/NarrativeWeb.py index fbdb9c20c..bbab5d7fe 100644 --- a/src/plugins/webreport/NarrativeWeb.py +++ b/src/plugins/webreport/NarrativeWeb.py @@ -487,7 +487,8 @@ class BasePage(object): """ for more information: see get_event_data() """ - event_data = self.get_event_data(evt, evt_ref, showplc, showdescr, showsrc, shownote, subdirs, hyp) + event_data = self.get_event_data(evt, evt_ref, showplc, showdescr, showsrc, + shownote, subdirs, hyp) for (label, colclass, data) in event_data: data = data or " " @@ -558,29 +559,25 @@ class BasePage(object): # position 0 = translatable label, position 1 = column class # position 2 = data info = [ - [THEAD, 'Type', evt_hyper], - [DHEAD, 'Date', _dd.display(evt.get_date_object() )] ] + [_("Event"), "Event", evt_hyper], + [DHEAD, "Date", _dd.display(evt.get_date_object() )] ] if showplc: - place_row = [PHEAD, 'Place', place_hyper] - info.append(place_row) + info.append([PHEAD, "Place", place_hyper]) if showdescr: descr = evt.get_description() - descr_row = [DESCRHEAD, 'Description', descr] - info.append(descr_row) + info.append([DESCRHEAD, "Description", descr]) if showsrc: - srcrefs = self.get_citation_links( evt.get_source_references() ) or " " - source_row = [SHEAD, 'Sources', srcrefs] - info.append(source_row) + srcrefs = self.get_citation_links(evt.get_source_references() ) + info.append([SHEAD, "Sources", srcrefs]) if shownote: notelist = evt.get_note_list() notelist.extend(evt_ref.get_note_list() ) notelist = self.dump_notes(notelist) - note_row = [NHEAD, 'Notes', notelist] - info.append(note_row) + info.append([NHEAD, "Notes", notelist]) # return event data information to its callers return info @@ -1376,7 +1373,7 @@ class BasePage(object): """ # the only place that this will ever equal False - # is first there is more than one event for a person for class EventListPage + # is first there is more than one event for a person if first: # see above for explanation @@ -2039,11 +2036,9 @@ class EventListPage(BasePage): "The person’s name will only be shown once for their events.") eventlist += Html("p", msg, id="description") - # begin event list table + # begin event list table and table head with Html("table", class_ = "infolist eventlist") as table: eventlist += table - - # begin table head thead = Html("thead") table += thead @@ -2052,10 +2047,11 @@ class EventListPage(BasePage): thead += trow for (label, colclass) in [ - [THEAD, 'Type'], - [DHEAD, 'Date'], - [_('Person'), 'Person'], - [_('Partner'), 'Partner'] ]: + [_("Event"), "Event"], + [DHEAD, "Date"], + [_("Person"), "Person"], + [_("Partner"), "Partner"] ]: + trow += Html("th", label, class_ = "Column%s" % colclass, inline = True) # begin table body @@ -2069,9 +2065,9 @@ class EventListPage(BasePage): partner) in event_list: # write eent row data - trow = self.write_event_row(person, partner, evt_type, evt, - evt_ref, first) - tbody += trow + tbody += self.write_event_row(person, partner, evt_type, evt, + evt_ref, first) + first = False # and clearline for proper styling @@ -2103,6 +2099,9 @@ class EventListPage(BasePage): # begin table row trow = Html("tr") + if first: + trow.attr = ' class = "BeginName" ' + # get event data """ for more information: see get_event_data() @@ -2181,7 +2180,8 @@ class EventPage(BasePage): data = event_data[index][2] or " " # determine if we are using the same row or not? - samerow = True if (data == " " or colclass == "Date") else False + samerow = True if (data == " " or (colclass == "Date" or "Event")) \ + else False trow = Html("tr") + ( Html("td", label, class_ = "ColumnAttribute", inline = True), @@ -4334,24 +4334,20 @@ class IndividualPage(BasePage): # position 0 = translatable label, position 1 = column class, and # position 2 = data event_header_row = [ - (THEAD, 'Type'), - (DHEAD, 'Date') ] + (_("Event"), "Event"), + (DHEAD, "Date") ] if showplc: - place_row = (PHEAD, 'Place') - event_header_row.append(place_row) + event_header_row.append((PHEAD, "Place")) if showdescr: - descr_row = (DESCRHEAD, 'Description') - event_header_row.append(descr_row) + event_header_row.append((DESCRHEAD, "Description")) if showsrc: - source_row = (SHEAD, 'Sources') - event_header_row.append(source_row) + event_header_row.append((SHEAD, "Sources")) if shownote: - note_row = (NHEAD, 'Notes') - event_header_row.append(note_row) + event_header_row.append((NHEAD, "Notes")) trow = Html("tr") for (label, colclass) in event_header_row: @@ -5721,12 +5717,12 @@ def _get_short_name(gender, name): short_name = short_name + ", " + suffix return short_name -def get_person_keyname(db, handle): +def __get_person_keyname(db, handle): """ .... """ person = db.get_person_from_handle(handle) - return person.get_primary_name().surname + return person.get_primary_name().get_surname() -def get_place_keyname(db, handle): +def __get_place_keyname(db, handle): """ ... """ return ReportUtils.place_name(db, handle) @@ -5749,10 +5745,13 @@ def get_first_letters(db, handle_list, key): for handle in handle_list: if key == _PERSON: - keyname = get_person_keyname(db, handle) + keyname = __get_person_keyname(db, handle) else: - keyname = get_place_keyname(db, handle) - first_letters.append(first_letter(keyname)) + keyname = __get_place_keyname(db, handle) + ltr = first_letter(keyname) + + if ltr is not ",": + first_letters.append(ltr) return first_letters @@ -5780,6 +5779,7 @@ def alphabet_navigation(db, handle_list, key): # See : http://www.gramps-project.org/bugs/view.php?id=2933 # (lang_country, modifier ) = locale.getlocale() + for ltr in get_first_letters(db, handle_list, key): if ltr in sorted_set: sorted_set[ltr] += 1 @@ -5787,8 +5787,7 @@ def alphabet_navigation(db, handle_list, key): sorted_set[ltr] = 1 # remove the number of each occurance of each letter - sorted_alpha_index = sorted((l for l in sorted_set if l != ','), - key=locale.strxfrm) + sorted_alpha_index = sorted(sorted_set, key=locale.strxfrm) # if no letters, return None back to its callers if not sorted_alpha_index: @@ -5798,10 +5797,10 @@ def alphabet_navigation(db, handle_list, key): with Html("div", id="alphabet") as alphabet_nav: num_ltrs = len(sorted_alpha_index) - nrows = ((num_ltrs / 34) + 1) - index = 0 + nrows = ((num_ltrs // 34) + 1) - for rows in xrange(nrows): + index = 0 + for row in xrange(nrows): unordered = Html("ul") alphabet_nav += unordered