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