Added has_data interface to all quickviews
svn: r17126
This commit is contained in:
parent
25830e2325
commit
51e4f545ed
@ -64,6 +64,7 @@ def run(database, document, date):
|
||||
stab.row_sort_val(1, int(diff_span))
|
||||
matches += 1
|
||||
|
||||
document.has_data = matches > 0
|
||||
sdoc.paragraph(_("\n%d matches.\n") % matches)
|
||||
stab.write(sdoc)
|
||||
sdoc.paragraph("")
|
||||
|
@ -42,5 +42,6 @@ def run(database, document, attribute, value=None):
|
||||
matched = True
|
||||
if matched:
|
||||
matches += 1
|
||||
document.has_data = matches > 0
|
||||
sdoc.paragraph(_("There are %d people with a matching attribute name.\n") % matches)
|
||||
stab.write(sdoc)
|
||||
|
@ -384,5 +384,6 @@ def run(database, document, filter_name, *args, **kwargs):
|
||||
,
|
||||
"Filter matched %d records.", matches) % matches)
|
||||
sdoc.paragraph("")
|
||||
document.has_data = matches > 0
|
||||
if matches > 0:
|
||||
stab.write(sdoc)
|
||||
|
@ -109,7 +109,9 @@ def run(database, document, main_event):
|
||||
sdb.event_type(event),
|
||||
sdb.event_place(event), ref)
|
||||
|
||||
document.has_data = False
|
||||
if stab.get_row_count() > 0:
|
||||
document.has_data = True
|
||||
sdoc.paragraph(_("Events on this exact date"))
|
||||
stab.write(sdoc)
|
||||
else:
|
||||
@ -118,6 +120,7 @@ def run(database, document, main_event):
|
||||
sdoc.paragraph("")
|
||||
|
||||
if histab.get_row_count() > 0:
|
||||
document.has_data = True
|
||||
sdoc.paragraph(_("Other events on this month/day in history"))
|
||||
histab.write(sdoc)
|
||||
else:
|
||||
@ -126,6 +129,7 @@ def run(database, document, main_event):
|
||||
sdoc.paragraph("")
|
||||
|
||||
if yeartab.get_row_count() > 0:
|
||||
document.has_data = True
|
||||
sdoc.paragraph(_("Other events in %(year)d") %
|
||||
{"year":main_date.get_year()})
|
||||
yeartab.write(sdoc)
|
||||
|
@ -70,8 +70,10 @@ def run(database, document, object, item, trans):
|
||||
stab.row(_(objclass), ref) # translation are explicit (above)
|
||||
|
||||
if stab.get_row_count() > 0:
|
||||
document.has_data = True
|
||||
stab.write(sdoc)
|
||||
else:
|
||||
document.has_data = False
|
||||
sdoc.paragraph(_("No references for this %s") % trans)
|
||||
sdoc.paragraph("")
|
||||
sdoc.paragraph("")
|
||||
|
@ -56,6 +56,8 @@ def run(database, document, repo):
|
||||
database.find_backlink_handles(repo_handle, ['Source'
|
||||
])]
|
||||
|
||||
stab.columns(_("Source"), _("Type of media"), _("Call number"))
|
||||
document.has_data = False
|
||||
for source_handle in source_list:
|
||||
src = database.get_source_from_handle(source_handle)
|
||||
|
||||
@ -70,6 +72,6 @@ def run(database, document, repo):
|
||||
media = str(reporef.get_media_type())
|
||||
call = reporef.get_call_number()
|
||||
|
||||
stab.columns(_("Source"), _("Type of media"), _("Call number"))
|
||||
stab.row(src.get_title(), media, call)
|
||||
document.has_data = True
|
||||
stab.write(sdoc)
|
||||
|
@ -122,6 +122,7 @@ def run(database, document, person):
|
||||
str(person.get_primary_name().get_type()))
|
||||
matches += 1
|
||||
|
||||
document.has_data = matches > 0
|
||||
sdoc.paragraph(ngettext("There is %d person with a matching name, or alternate name.\n"
|
||||
,
|
||||
"There are %d people with a matching name, or alternate name.\n"
|
||||
@ -163,6 +164,7 @@ def run_given(database, document, person):
|
||||
str(person.get_primary_name().get_type()))
|
||||
matches += 1
|
||||
|
||||
document.has_data = matches > 0
|
||||
sdoc.paragraph(ngettext("There is %d person with a matching name, or alternate name.\n"
|
||||
,
|
||||
"There are %d people with a matching name, or alternate name.\n"
|
||||
|
@ -57,11 +57,12 @@ def run(database, document, person):
|
||||
sdoc.paragraph("")
|
||||
|
||||
stab.columns(_("Event Type"), _("Event Date"), _("Event Place"))
|
||||
|
||||
document.has_data = False
|
||||
for event in event_list:
|
||||
stab.row(event,
|
||||
sdb.event_date_obj(event),
|
||||
sdb.event_place(event))
|
||||
document.has_data = True
|
||||
stab.write(sdoc)
|
||||
|
||||
def run_fam(database, document, family):
|
||||
@ -99,6 +100,7 @@ def run_fam(database, document, family):
|
||||
'father' : sdb.name(sdb.father(family)), 'mother' : sdb.name(sdb.mother(family)) })
|
||||
sdoc.paragraph("")
|
||||
|
||||
document.has_data = False
|
||||
stab.columns(_("Family Member"), _("Event Type"),
|
||||
_("Event Date"), _("Event Place"))
|
||||
|
||||
@ -106,6 +108,7 @@ def run_fam(database, document, family):
|
||||
stab.row(person, sdb.event_type(event),
|
||||
sdb.event_date_obj(event),
|
||||
sdb.event_place(event))
|
||||
document.has_data = True
|
||||
stab.write(sdoc)
|
||||
|
||||
stab = SimpleTable(sdb)
|
||||
@ -116,6 +119,7 @@ def run_fam(database, document, family):
|
||||
stab.row(person, sdb.event_type(event),
|
||||
sdb.event_date_obj(event),
|
||||
sdb.event_place(event))
|
||||
document.has_data = True
|
||||
stab.write(sdoc)
|
||||
|
||||
def fam_sort(event1, event2):
|
||||
|
@ -48,6 +48,7 @@ def run(database, document, person):
|
||||
# grab our current id (self):
|
||||
gid = sdb.gid(person)
|
||||
# loop through each family in which the person is a child
|
||||
document.has_data = False
|
||||
for family in sdb.child_in(person):
|
||||
# loop through each child in the family
|
||||
for child in sdb.children(family):
|
||||
@ -63,4 +64,5 @@ def run(database, document, person):
|
||||
sdb.gender(child),
|
||||
sdb.birth_or_fallback(child),
|
||||
rel_str)
|
||||
document.has_data = True
|
||||
stab.write(sdoc)
|
||||
|
Loading…
Reference in New Issue
Block a user