Added has_data interface for setting tabs to bold/italic if there is data in the tab

svn: r20108
This commit is contained in:
Doug Blank 2012-07-27 14:57:49 +00:00
parent 1d21989810
commit ee0e6681ac
3 changed files with 163 additions and 13 deletions

View File

@ -238,6 +238,22 @@ function unLite(theOption) {
function optClick(theOption) { function optClick(theOption) {
document.location.href=theOption; document.location.href=theOption;
} }
function setHasData(classname, value)
{
var elems = document.getElementsByTagName('*'), i;
for (i in elems) {
if((" " + elems[i].className + " ").indexOf(" " + classname + " ") > -1) {
if (value) {
elems[i].style.fontWeight = "bold";
elems[i].style.fontStyle = "italic";
} else {
elems[i].style.fontWeight = "";
elems[i].style.fontStyle = "";
}
}
}
}
//--> //-->
</SCRIPT> </SCRIPT>

View File

@ -85,18 +85,18 @@
<div class="ui-tabs ui-widget ui-widget-content ui-corner-all" id="tabs" style="border: none;"> <div class="ui-tabs ui-widget ui-widget-content ui-corner-all" id="tabs" style="border: none;">
<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"> <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
<li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#tab-events">Event</a></li> <li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a class="tab-events" href="#tab-events">Event</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-references">Family</a></li> <li class="ui-corner-top ui-state-default"><a class="tab-references" href="#tab-references">Family</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-names">Name</a></li> <li class="ui-corner-top ui-state-default"><a class="tab-names" href="#tab-names">Name</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-citations">Citation</a></li> <li class="ui-corner-top ui-state-default"><a class="tab-citations" href="#tab-citations">Citation</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-attributes">Attribute</a></li> <li class="ui-corner-top ui-state-default"><a class="tab-attributes" href="#tab-attributes">Attribute</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-addresses">Address</a></li> <li class="ui-corner-top ui-state-default"><a class="tab-addresses" href="#tab-addresses">Address</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-notes">Note</a></li> <li class="ui-corner-top ui-state-default"><a class="tab-notes" href="#tab-notes">Note</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-media">Media</a></li> <li class="ui-corner-top ui-state-default"><a class="tab-media" href="#tab-media">Media</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-internet">Internet</a></li> <li class="ui-corner-top ui-state-default"><a class="tab-internet" href="#tab-internet">Internet</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-association">Association</a></li> <li class="ui-corner-top ui-state-default"><a class="tab-association" href="#tab-association">Association</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-lds">LDS</a></li> <li class="ui-corner-top ui-state-default"><a class="tab-lds" href="#tab-lds">LDS</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-history">History</a></li> <li class="ui-corner-top ui-state-default"><a class="tab-history" href="#tab-history">History</a></li>
</ul> </ul>
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom" id="tab-events" style="background-color: #f4f0ec;"> <div class="ui-tabs-panel ui-widget-content ui-corner-bottom" id="tab-events" style="background-color: #f4f0ec;">
<!-- Events --> <!-- Events -->

View File

@ -299,6 +299,8 @@ def make_button(text, url, *args):
def event_table(obj, user, act, url, args): def event_table(obj, user, act, url, args):
retval = "" retval = ""
has_data = False
cssid = "tab-events"
table = Table("event_table") table = Table("event_table")
table.columns( table.columns(
"", "",
@ -326,6 +328,7 @@ def event_table(obj, user, act, url, args):
get_title(djevent.place), get_title(djevent.place),
str(event_ref.role_type)) str(event_ref.role_type))
links.append(('URL', event_ref.get_url())) links.append(('URL', event_ref.get_url()))
has_data = True
count += 1 count += 1
table.links(links) table.links(links)
retval += table.get_html() retval += table.get_html()
@ -341,10 +344,14 @@ def event_table(obj, user, act, url, args):
retval += make_button(_("Add Existing Event"), (url % args).replace("$act", "share")) retval += make_button(_("Add Existing Event"), (url % args).replace("$act", "share"))
else: else:
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def history_table(obj, user, act): def history_table(obj, user, act):
retval = "" retval = ""
has_data = False
cssid = "tab-history"
table = Table("history_table") table = Table("history_table")
table.columns( table.columns(
_("Action"), _("Action"),
@ -360,16 +367,21 @@ def history_table(obj, user, act):
entry.last_changed, entry.last_changed,
entry.last_changed_by), entry.last_changed_by),
entry.reason) entry.reason)
has_data = True
table.row( table.row(
"Latest on %s by %s" % (obj.last_changed, "Latest on %s by %s" % (obj.last_changed,
obj.last_changed_by), obj.last_changed_by),
"Current status") "Current status")
retval += table.get_html() retval += table.get_html()
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def name_table(obj, user, act, url=None, *args): def name_table(obj, user, act, url=None, *args):
retval = "" retval = ""
has_data = False
cssid = "tab-names"
table = Table("name_table") table = Table("name_table")
table.columns(_("Name"), table.columns(_("Name"),
_("Type"), _("Type"),
@ -398,18 +410,23 @@ def name_table(obj, user, act, url=None, *args):
links.append(('URL', links.append(('URL',
# url is "/person/%s/name" # url is "/person/%s/name"
(url % name.person.handle) + ("/%s" % name.order))) (url % name.person.handle) + ("/%s" % name.order)))
has_data = True
table.links(links) table.links(links)
retval += table.get_html() retval += table.get_html()
if user.is_superuser and url and act == "view": if user.is_superuser and url and act == "view":
retval += make_button(_("Add Name"), (url % args)) retval += make_button(_("Add Name"), (url % args))
else: else:
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def surname_table(obj, user, act, url=None, *args): def surname_table(obj, user, act, url=None, *args):
person_handle = args[0] person_handle = args[0]
order = args[1] order = args[1]
retval = "" retval = ""
has_data = False
cssid = "tab-surnames"
table = Table("surname_table") table = Table("surname_table")
table.columns(_("Order"), _("Surname"),) table.columns(_("Order"), _("Surname"),)
if user.is_authenticated(): if user.is_authenticated():
@ -420,6 +437,7 @@ def surname_table(obj, user, act, url=None, *args):
if name: if name:
for surname in name.surname_set.all().order_by("order"): for surname in name.surname_set.all().order_by("order"):
table.row(str(surname.order), surname) table.row(str(surname.order), surname)
has_data = True
retval += table.get_html() retval += table.get_html()
else: else:
retval += "<p id='error'>No such name order = %s</p>" % order retval += "<p id='error'>No such name order = %s</p>" % order
@ -427,10 +445,14 @@ def surname_table(obj, user, act, url=None, *args):
retval += make_button(_("Add Surname"), (url % args)) retval += make_button(_("Add Surname"), (url % args))
else: else:
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def citation_table(obj, user, act, url=None, *args): def citation_table(obj, user, act, url=None, *args):
retval = "" retval = ""
has_data = False
cssid = "tab-citations"
table = Table("citation_table") table = Table("citation_table")
table.columns("", table.columns("",
_("ID"), _("ID"),
@ -453,6 +475,7 @@ def citation_table(obj, user, act, url=None, *args):
str(citation.page), str(citation.page),
) )
links.append(('URL', citation_ref.get_url())) links.append(('URL', citation_ref.get_url()))
has_data = True
count += 1 count += 1
table.links(links) table.links(links)
retval += table.get_html() retval += table.get_html()
@ -468,10 +491,14 @@ def citation_table(obj, user, act, url=None, *args):
retval += make_button(_("Add Existing Citation"), (url % args).replace("$act", "share")) retval += make_button(_("Add Existing Citation"), (url % args).replace("$act", "share"))
else: else:
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def repository_table(obj, user, act, url=None, *args): def repository_table(obj, user, act, url=None, *args):
retval = "" retval = ""
has_data = False
cssid = "tab-repositories"
table = Table("repository_table") table = Table("repository_table")
table.columns( table.columns(
_("ID"), _("ID"),
@ -480,15 +507,21 @@ def repository_table(obj, user, act, url=None, *args):
if user.is_authenticated(): if user.is_authenticated():
pass pass
retval += table.get_html() retval += table.get_html()
## FIXME: missing table
## has_data = True
if user.is_superuser and url and act == "view": if user.is_superuser and url and act == "view":
retval += make_button(_("Add New Repository"), (url % args).replace("$act", "add")) retval += make_button(_("Add New Repository"), (url % args).replace("$act", "add"))
retval += make_button(_("Add Existing Repository"), (url % args).replace("$act", "share")) retval += make_button(_("Add Existing Repository"), (url % args).replace("$act", "share"))
else: else:
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def note_table(obj, user, act, url=None, *args): def note_table(obj, user, act, url=None, *args):
retval = "" retval = ""
has_data = False
cssid = "tab-notes"
table = Table("note_table") table = Table("note_table")
table.columns( table.columns(
_("ID"), _("ID"),
@ -504,31 +537,42 @@ def note_table(obj, user, act, url=None, *args):
table.row(table.db.get_note_from_handle(note.handle), table.row(table.db.get_note_from_handle(note.handle),
str(note_ref.ref_object.note_type), str(note_ref.ref_object.note_type),
note_ref.ref_object.text[:50]) note_ref.ref_object.text[:50])
has_data = True
retval += table.get_html() retval += table.get_html()
if user.is_superuser and url and act == "view": if user.is_superuser and url and act == "view":
retval += make_button(_("Add New Note"), (url % args).replace("$act", "add")) retval += make_button(_("Add New Note"), (url % args).replace("$act", "add"))
retval += make_button(_("Add Existing Note"), (url % args).replace("$act", "share")) retval += make_button(_("Add Existing Note"), (url % args).replace("$act", "share"))
else: else:
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def data_table(obj, user, act, url=None, *args): def data_table(obj, user, act, url=None, *args):
retval = "" retval = ""
has_data = False
cssid = "has_data"
table = Table("data_table") table = Table("data_table")
table.columns(_("Type"), table.columns(_("Type"),
_("Value"), _("Value"),
) )
if user.is_authenticated(): if user.is_authenticated():
pass pass
## FIXME: missing table
## has_data = True
retval += table.get_html() retval += table.get_html()
if user.is_superuser and url and act == "view": if user.is_superuser and url and act == "view":
retval += make_button(_("Add Data"), (url % args)) retval += make_button(_("Add Data"), (url % args))
else: else:
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def attribute_table(obj, user, act, url=None, *args): def attribute_table(obj, user, act, url=None, *args):
retval = "" retval = ""
has_data = False
cssid = "tab-attributes"
table = Table("attribute_table") table = Table("attribute_table")
table.columns(_("Type"), table.columns(_("Type"),
_("Value"), _("Value"),
@ -540,15 +584,20 @@ def attribute_table(obj, user, act, url=None, *args):
for attribute in attributes: for attribute in attributes:
table.row(attribute.attribute_type.name, table.row(attribute.attribute_type.name,
attribute.value) attribute.value)
has_data = True
retval += table.get_html() retval += table.get_html()
if user.is_superuser and url and act == "view": if user.is_superuser and url and act == "view":
retval += make_button(_("Add Attribute"), (url % args)) retval += make_button(_("Add Attribute"), (url % args))
else: else:
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def address_table(obj, user, act, url=None, *args): def address_table(obj, user, act, url=None, *args):
retval = "" retval = ""
has_data = False
cssid = "tab-addresses"
table = Table("address_table") table = Table("address_table")
table.columns(_("Date"), table.columns(_("Date"),
_("Address"), _("Address"),
@ -564,15 +613,20 @@ def address_table(obj, user, act, url=None, *args):
location.city, location.city,
location.state, location.state,
location.country) location.country)
has_data = True
retval += table.get_html() retval += table.get_html()
if user.is_superuser and url and act == "view": if user.is_superuser and url and act == "view":
retval += make_button(_("Add Address"), (url % args)) retval += make_button(_("Add Address"), (url % args))
else: else:
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def location_table(obj, user, act, url=None, *args): def location_table(obj, user, act, url=None, *args):
retval = "" retval = ""
has_data = False
cssid = "tab-locations"
table = Table("location_table") table = Table("location_table")
table.columns(_("Date"), table.columns(_("Date"),
_("Address"), _("Address"),
@ -581,15 +635,21 @@ def location_table(obj, user, act, url=None, *args):
_("Country")) _("Country"))
if user.is_authenticated(): if user.is_authenticated():
pass # FIXME pass # FIXME
## FIXME: missing table
## has_data = True
retval += table.get_html() retval += table.get_html()
if user.is_superuser and url and act == "view": if user.is_superuser and url and act == "view":
retval += make_button(_("Add Address"), (url % args)) retval += make_button(_("Add Address"), (url % args))
else: else:
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def media_table(obj, user, act, url=None, *args): def media_table(obj, user, act, url=None, *args):
retval = "" retval = ""
has_data = False
cssid = "tab-media"
table = Table("media_table") table = Table("media_table")
table.columns(_("Description"), table.columns(_("Description"),
_("Type"), _("Type"),
@ -605,16 +665,21 @@ def media_table(obj, user, act, url=None, *args):
table.row(table.db.get_object_from_handle(media.handle), table.row(table.db.get_object_from_handle(media.handle),
str(media_ref.ref_object.desc), str(media_ref.ref_object.desc),
media_ref.ref_object.path) media_ref.ref_object.path)
has_data = True
retval += table.get_html() retval += table.get_html()
if user.is_superuser and url and act == "view": if user.is_superuser and url and act == "view":
retval += make_button(_("Add New Media"), (url % args).replace("$act", "add")) retval += make_button(_("Add New Media"), (url % args).replace("$act", "add"))
retval += make_button(_("Add Existing Media"), (url % args).replace("$act", "share")) retval += make_button(_("Add Existing Media"), (url % args).replace("$act", "share"))
else: else:
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def internet_table(obj, user, act, url=None, *args): def internet_table(obj, user, act, url=None, *args):
retval = "" retval = ""
has_data = False
cssid = "tab-internet"
table = Table("internet_table") table = Table("internet_table")
table.columns(_("Type"), table.columns(_("Type"),
_("Path"), _("Path"),
@ -625,15 +690,20 @@ def internet_table(obj, user, act, url=None, *args):
table.row(str(url_obj.url_type), table.row(str(url_obj.url_type),
url_obj.path, url_obj.path,
url_obj.desc) url_obj.desc)
has_data = True
retval += table.get_html() retval += table.get_html()
if user.is_superuser and url and act == "view": if user.is_superuser and url and act == "view":
retval += make_button(_("Add Internet"), (str(url) % args)) retval += make_button(_("Add Internet"), (str(url) % args))
else: else:
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def association_table(obj, user, act, url=None, *args): def association_table(obj, user, act, url=None, *args):
retval = "" retval = ""
has_data = False
cssid = "tab-associations"
table = Table("association_table") table = Table("association_table")
table.columns(_("Name"), table.columns(_("Name"),
_("ID"), _("ID"),
@ -643,16 +713,21 @@ def association_table(obj, user, act, url=None, *args):
if gperson: if gperson:
associations = gperson.get_person_ref_list() associations = gperson.get_person_ref_list()
for association in associations: for association in associations:
table.row() table.row() # FIXME: missing table
has_data = True
retval += table.get_html() retval += table.get_html()
if user.is_superuser and url and act == "view": if user.is_superuser and url and act == "view":
retval += make_button(_("Add Association"), (url % args)) retval += make_button(_("Add Association"), (url % args))
else: else:
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def lds_table(obj, user, act, url=None, *args): def lds_table(obj, user, act, url=None, *args):
retval = "" retval = ""
has_data = False
cssid = "tab-lds"
table = Table("lds_table") table = Table("lds_table")
table.columns(_("Type"), table.columns(_("Type"),
_("Date"), _("Date"),
@ -668,15 +743,20 @@ def lds_table(obj, user, act, url=None, *args):
str(lds.status), str(lds.status),
lds.temple, lds.temple,
get_title(lds.place)) get_title(lds.place))
has_data = True
retval += table.get_html() retval += table.get_html()
if user.is_superuser and url and act == "view": if user.is_superuser and url and act == "view":
retval += make_button(_("Add LDS"), (url % args)) retval += make_button(_("Add LDS"), (url % args))
else: else:
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def reference_table(obj, user, act, url=None, *args): def reference_table(obj, user, act, url=None, *args):
retval = "" retval = ""
has_data = False
cssid = "tab-references"
table = Table("reference_table") table = Table("reference_table")
table.columns( table.columns(
_("Type"), _("Type"),
@ -686,12 +766,17 @@ def reference_table(obj, user, act, url=None, *args):
pass pass
retval += table.get_html() retval += table.get_html()
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def person_reference_table(obj, user, act): def person_reference_table(obj, user, act):
retval = """<div style="overflow: auto; height:%spx;">""" % TAB_HEIGHT retval = """<div style="overflow: auto; height:%spx;">""" % TAB_HEIGHT
has_data = False
cssid = "tab-references"
text1 = "" text1 = ""
text2 = "" text2 = ""
has_data = False
table1 = Table("person_reference_table", style="background-color: #f4f0ec;") table1 = Table("person_reference_table", style="background-color: #f4f0ec;")
table1.columns( table1.columns(
"As Spouse", "As Spouse",
@ -715,6 +800,7 @@ def person_reference_table(obj, user, act):
reference.gramps_id, reference.gramps_id,
reference, reference,
) )
has_data = True
count += 1 count += 1
text1 += table1.get_html() text1 += table1.get_html()
count = 1 count = 1
@ -733,6 +819,8 @@ def person_reference_table(obj, user, act):
reference.gramps_id, reference.gramps_id,
reference, reference,
) )
has_data = True
count += 1
text2 += table2.get_html() text2 += table2.get_html()
count = 1 count = 1
for through in models.PersonParentFamilyOrder.objects.filter(person=obj).order_by("order"): for through in models.PersonParentFamilyOrder.objects.filter(person=obj).order_by("order"):
@ -751,10 +839,14 @@ def person_reference_table(obj, user, act):
"/family/add/child/%s" % obj.handle) "/family/add/child/%s" % obj.handle)
retval += make_button(_("Add as Child to Existing Family"), retval += make_button(_("Add as Child to Existing Family"),
"/family/share/child/%s" % obj.handle) "/family/share/child/%s" % obj.handle)
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def note_reference_table(obj, user, act): def note_reference_table(obj, user, act):
retval = "" retval = ""
has_data = False
cssid = "tab-references"
table = Table("note_reference_table") table = Table("note_reference_table")
table.columns( table.columns(
_("Type"), _("Type"),
@ -768,12 +860,17 @@ def note_reference_table(obj, user, act):
item.__class__.__name__, item.__class__.__name__,
item, item,
item.gramps_id) item.gramps_id)
has_data = True
retval += table.get_html() retval += table.get_html()
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def event_reference_table(obj, user, act): def event_reference_table(obj, user, act):
retval = "" retval = ""
has_data = False
cssid = "tab-references"
table = Table("event_reference_table") table = Table("event_reference_table")
table.columns( table.columns(
_("Type"), _("Type"),
@ -791,12 +888,17 @@ def event_reference_table(obj, user, act):
item.__class__.__name__, item.__class__.__name__,
item, item,
item.gramps_id) item.gramps_id)
has_data = True
retval += table.get_html() retval += table.get_html()
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def repository_reference_table(obj, user, act): def repository_reference_table(obj, user, act):
retval = "" retval = ""
has_data = False
cssid = "tab-references"
table = Table("repository_reference_table") table = Table("repository_reference_table")
table.columns( table.columns(
_("Type"), _("Type"),
@ -810,12 +912,17 @@ def repository_reference_table(obj, user, act):
item.__class__.__name__, item.__class__.__name__,
item, item,
item.gramps_id) item.gramps_id)
has_data = True
retval += table.get_html() retval += table.get_html()
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def citation_reference_table(obj, user, act): def citation_reference_table(obj, user, act):
retval = "" retval = ""
has_data = False
cssid = "tab-references"
table = Table("citation_reference_table") table = Table("citation_reference_table")
table.columns( table.columns(
_("Type"), _("Type"),
@ -829,12 +936,17 @@ def citation_reference_table(obj, user, act):
table.row( table.row(
item.__class__.__name__, item.__class__.__name__,
item) item)
has_data = True
retval += table.get_html() retval += table.get_html()
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def source_reference_table(obj, user, act): def source_reference_table(obj, user, act):
retval = "" retval = ""
has_data = False
cssid = "tab-references"
table = Table("source_reference_table") table = Table("source_reference_table")
table.columns( table.columns(
_("Type"), _("Type"),
@ -845,10 +957,14 @@ def source_reference_table(obj, user, act):
# FIXME: where is source ref? # FIXME: where is source ref?
retval += table.get_html() retval += table.get_html()
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def media_reference_table(obj, user, act): def media_reference_table(obj, user, act):
retval = "" retval = ""
has_data = False
cssid = "tab-references"
table = Table("media_reference_table") table = Table("media_reference_table")
table.columns( table.columns(
_("Type"), _("Type"),
@ -862,12 +978,17 @@ def media_reference_table(obj, user, act):
item.__class__.__name__, item.__class__.__name__,
item, item,
item.gramps_id) item.gramps_id)
has_data = True
retval += table.get_html() retval += table.get_html()
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def place_reference_table(obj, user, act): def place_reference_table(obj, user, act):
retval = "" retval = ""
has_data = False
cssid = "tab-references"
table = Table("place_reference_table") table = Table("place_reference_table")
table.columns( table.columns(
_("Type"), _("Type"),
@ -875,12 +996,17 @@ def place_reference_table(obj, user, act):
_("ID")) _("ID"))
if user.is_authenticated() and act != "add": if user.is_authenticated() and act != "add":
pass # FIXME pass # FIXME
## FIXME: missing table
retval += table.get_html() retval += table.get_html()
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
def tag_reference_table(obj, user, act): def tag_reference_table(obj, user, act):
retval = "" retval = ""
has_data = False
cssid = "tab-references"
table = Table("tag_reference_table") table = Table("tag_reference_table")
table.columns( table.columns(
_("Type"), _("Type"),
@ -894,8 +1020,11 @@ def tag_reference_table(obj, user, act):
item.__class__.__name__, item.__class__.__name__,
item, item,
item.gramps_id) item.gramps_id)
has_data = True
retval += table.get_html() retval += table.get_html()
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
class Link(object): class Link(object):
@ -909,6 +1038,8 @@ class Link(object):
def children_table(obj, user, act, url=None, *args): def children_table(obj, user, act, url=None, *args):
retval = "" retval = ""
has_data = False
cssid = "tab-children"
table = Table("children_table") table = Table("children_table")
table.columns( table.columns(
"", "",
@ -956,6 +1087,7 @@ def children_table(obj, user, act, url=None, *args):
links.append(('URL', childref.get_url())) links.append(('URL', childref.get_url()))
else: else:
links.append((None, None)) links.append((None, None))
has_data = True
count += 1 count += 1
table.links(links) table.links(links)
retval += table.get_html() retval += table.get_html()
@ -970,6 +1102,8 @@ def children_table(obj, user, act, url=None, *args):
retval += make_button(_("Add Existing Person as Child"), (url.replace("$act", "share") % args)) retval += make_button(_("Add Existing Person as Child"), (url.replace("$act", "share") % args))
else: else:
retval += nbsp("") # to keep tabs same height retval += nbsp("") # to keep tabs same height
if has_data:
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
return retval return retval
## FIXME: these dji function wrappers just use the functions ## FIXME: these dji function wrappers just use the functions