Webapp refinements

svn: r18588
This commit is contained in:
Doug Blank 2011-12-12 23:21:13 +00:00
parent 42c397f830
commit e705da749c
17 changed files with 85 additions and 18 deletions

View File

@ -0,0 +1,5 @@
{% load my_tags %}
{% filter breadcrumb %}
{% format "/browse|Browse,/%s|%s,/%s/%s|%s [%s]" view tviews view object.handle tview object.gramps_id %}
{% endfilter %}

View File

@ -13,7 +13,7 @@
<div class="content" id="IndividualDetail">
{{ "/browse|Browse,/source|Sources"|breadcrumb}}
{% include "detail_breadcrumb.html" %}
<h3>{{source.title|escape}}</h3>
<div id="summaryarea">

View File

@ -11,7 +11,9 @@
</script>
<div class="content" id="IndividualDetail">
{{ "/browse|Browse,/event|Events"|breadcrumb}}
{% include "detail_breadcrumb.html" %}
<div id="summaryarea">
<table class="infolist">
<trbody>

View File

@ -11,7 +11,8 @@
</script>
<div class="content" id="IndividualDetail">
{{ "/browse|Browse,/family|Families"|breadcrumb}}
{% include "detail_breadcrumb.html" %}
<h3>{{family.father|make_name:user}} and {{family.mother|make_name:user}}</h3>

View File

@ -10,7 +10,7 @@
});
</script>
{{ "/browse|Browse,/media|Media"|breadcrumb}}
{% include "detail_breadcrumb.html" %}
<table>
<tr>

View File

@ -12,7 +12,10 @@
<div class="content" id="IndividualDetail">
{{ "/browse|Browse,/person|People,/person/{0}|Person"|breadcrumb:person.handle}}
{% filter breadcrumb %}
{% format "/browse|Browse,/person|People,/person/%s|Person [%s],/person/%s/name/%s|Name #%s" object.handle object.gramps_id object.handle order order %}
{% endfilter %}
<h3>{{person|make_name:user}} [{{person.gramps_id}}]</h3>
<div id="summaryarea">

View File

@ -12,7 +12,7 @@
<div class="content" id="IndividualDetail">
{{ "/browse|Browse,/note|Notes"|breadcrumb}}
{% include "detail_breadcrumb.html" %}
<div id="summaryarea">
<table class="infolist">

View File

@ -9,7 +9,9 @@
<div id="description" style="padding: 10pt 10pt 10pt 10pt;">
<form name="SearchForm">
{% if tview != "Report" %}
{{ "/browse|Browse"|breadcrumb}}
{% filter breadcrumb %}
{% format "/browse|Browse,/%s|%s" view tviews %}
{% endfilter %}
{% endif %}
<input type="submit" value="Search:"></input>
<input autocomplete="off" name="search" id="get_focus" type="text" size="50" value="{{search}}"></input>

View File

@ -12,7 +12,7 @@
<div class="content" id="IndividualDetail">
{{ "/browse|Browse,/person|People"|breadcrumb}}
{% include "detail_breadcrumb.html" %}
<div id="summaryarea">
<table class="infolist"> {% comment %} 5 cols {% endcomment %}
@ -30,7 +30,7 @@
{% endif %}
<tr>
<td colspan="4">{{nameform|render_name:user}} [{{person.gramps_id}}]</td>
<td colspan="4">{{nameform|render_name:user}}</td>
<td class="ColumnAttribute" align="right">{{nameform.name_type.label}}:</td>
<td class="ColumnValue" id="data">{% render nameform.name_type user action %}</td>
</tr>

View File

@ -12,7 +12,7 @@
<div class="content" id="IndividualDetail">
{{ "/browse|Browse,/place|Places"|breadcrumb}}
{% include "detail_breadcrumb.html" %}
<div id="summaryarea">

View File

@ -5,7 +5,7 @@
<div class="content" id="IndividualDetail">
{{ "/report|Reports"|breadcrumb}}
{% include "detail_breadcrumb.html" %}
<div id="summaryarea">

View File

@ -12,7 +12,7 @@
<div class="content" id="IndividualDetail">
{{ "/browse|Browse,/repository|Repositories"|breadcrumb}}
{% include "detail_breadcrumb.html" %}
<div id="summaryarea">

View File

@ -13,7 +13,7 @@
<div class="content" id="IndividualDetail">
{{ "/browse|Browse,/source|Sources"|breadcrumb}}
{% include "detail_breadcrumb.html" %}
<h3>{{source.title|escape}}</h3>
<div id="summaryarea">

View File

@ -12,7 +12,7 @@
<div class="content" id="IndividualDetail">
{{ "/browse|Browse,/tag|Tags"|breadcrumb}}
{% include "detail_breadcrumb.html" %}
<div id="summaryarea">

View File

@ -149,11 +149,33 @@ def breadcrumb(path, arg=None):
retval = ""
for item in path.split(","):
p, name = item.split("|")
retval += '<a href="%s">%s</a> > ' % (p, name)
if retval != "":
retval += " > "
retval += '<a href="%s"><b>%s</b></a>' % (p, name)
return "<p>%s</p>" % retval
breadcrumb.is_safe = True
register.filter('breadcrumb', breadcrumb)
def format(string, arg0=None, arg1=None, arg2=None, arg3=None, arg4=None, arg5=None, arg6=None):
if arg0 is None:
return string
elif arg1 is None:
return string % arg0
elif arg2 is None:
return string % (arg0, arg1)
elif arg3 is None:
return string % (arg0, arg1, arg2)
elif arg4 is None:
return string % (arg0, arg1, arg2, arg3)
elif arg5 is None:
return string % (arg0, arg1, arg2, arg3, arg4)
elif arg6 is None:
return string % (arg0, arg1, arg2, arg3, arg4, arg5)
else:
return string % (arg0, arg1, arg2, arg3, arg4, arg5, arg6)
format.is_safe = True
register.simple_tag(format)
def currentSection(view1, view2): # tview, menu
if view1.strip().lower() in [view[1] for view in VIEWS] and view2 == "browse":
return "class=CurrentSection"

View File

@ -236,10 +236,12 @@ def view_name_detail(request, handle, order, action="view"):
context = RequestContext(request)
context["action"] = action
context["tview"] = _('Name')
context["tviews"] = _('Names')
context["view"] = 'name'
context["handle"] = handle
context["id"] = id
context["person"] = person
context["object"] = person
context["form"] = form
context["order"] = name.order
context["next"] = "/person/%s/name/%d" % (person.handle, name.order)
@ -358,6 +360,7 @@ def view_detail(request, view, handle, action="view"):
raise Http404(_("Requested %s does not exist.") % view)
view_template = 'view_event_detail.html'
context["tview"] = _("Event")
context["tviews"] = _("Events")
elif view == "family":
try:
obj = Family.objects.get(handle=handle)
@ -365,6 +368,7 @@ def view_detail(request, view, handle, action="view"):
raise Http404(_("Requested %s does not exist.") % view)
view_template = 'view_family_detail.html'
context["tview"] = _("Family")
context["tviews"] = _("Families")
elif view == "media":
try:
obj = Media.objects.get(handle=handle)
@ -372,6 +376,7 @@ def view_detail(request, view, handle, action="view"):
raise Http404(_("Requested %s does not exist.") % view)
view_template = 'view_media_detail.html'
context["tview"] = _("Media")
context["tviews"] = _("Media")
elif view == "note":
try:
obj = Note.objects.get(handle=handle)
@ -379,7 +384,12 @@ def view_detail(request, view, handle, action="view"):
raise Http404(_("Requested %s does not exist.") % view)
view_template = 'view_note_detail.html'
context["tview"] = _("Note")
context["tviews"] = _("Notes")
elif view == "person":
try:
obj = Person.objects.get(handle=handle)
except:
raise Http404(_("Requested %s does not exist.") % view)
return view_person_detail(request, view, handle, action)
elif view == "place":
try:
@ -388,6 +398,7 @@ def view_detail(request, view, handle, action="view"):
raise Http404(_("Requested %s does not exist.") % view)
view_template = 'view_place_detail.html'
context["tview"] = _("Place")
context["tviews"] = _("Places")
elif view == "repository":
try:
obj = Repository.objects.get(handle=handle)
@ -395,6 +406,7 @@ def view_detail(request, view, handle, action="view"):
raise Http404(_("Requested %s does not exist.") % view)
view_template = 'view_repository_detail.html'
context["tview"] = _("Repository")
context["tviews"] = _("Repositories")
elif view == "citation":
try:
obj = Citation.objects.get(handle=handle)
@ -402,6 +414,7 @@ def view_detail(request, view, handle, action="view"):
raise Http404(_("Requested %s does not exist.") % view)
view_template = 'view_citation_detail.html'
context["tview"] = _("Citation")
context["tviews"] = _("Citations")
elif view == "source":
try:
obj = Source.objects.get(handle=handle)
@ -409,6 +422,7 @@ def view_detail(request, view, handle, action="view"):
raise Http404(_("Requested %s does not exist.") % view)
view_template = 'view_source_detail.html'
context["tview"] = _("Source")
context["tviews"] = _("Sources")
elif view == "tag":
try:
obj = Tag.objects.get(handle=handle)
@ -416,6 +430,7 @@ def view_detail(request, view, handle, action="view"):
raise Http404(_("Requested %s does not exist.") % view)
view_template = 'view_tag_detail.html'
context["tview"] = _("Tag")
context["tviews"] = _("Tags")
elif view == "report":
try:
obj = Report.objects.get(handle=handle)
@ -423,14 +438,18 @@ def view_detail(request, view, handle, action="view"):
raise Http404(_("Requested %s does not exist.") % view)
view_template = 'view_report_detail.html'
context["tview"] = _("Report")
context["tviews"] = _("Reports")
else:
raise Http404(_("Requested page type not known"))
context[view] = obj
context["object"] = obj
context["next"] = "/%s/%s" % (view, obj.handle)
return render_to_response(view_template, context)
def view_person_detail(request, view, handle, action="view"):
context = RequestContext(request)
context["tview"] = _("Person")
context["tviews"] = _("People")
if handle == "add":
if request.POST.has_key("action"):
action = request.POST.get("action")
@ -526,13 +545,16 @@ def view_person_detail(request, view, handle, action="view"):
context["personform"] = pf
context["nameform"] = nf
context["person"] = person
context["object"] = person
context["next"] = "/person/%s" % person.handle
view_template = 'view_person_detail.html'
return render_to_response(view_template, context)
def view(request, view):
context = RequestContext(request)
search = ""
if view == "event":
context["tviews"] = _("Events")
if request.user.is_authenticated():
private = Q()
else:
@ -552,6 +574,7 @@ def view(request, view):
view_template = 'view_events.html'
total = Event.objects.all().count()
elif view == "family":
context["tviews"] = _("Families")
if request.user.is_authenticated():
if request.GET.has_key("search"):
search = request.GET.get("search")
@ -605,6 +628,7 @@ def view(request, view):
view_template = 'view_families.html'
total = Family.objects.all().count()
elif view == "media":
context["tviews"] = _("Media")
if request.user.is_authenticated():
private = Q()
else:
@ -622,6 +646,7 @@ def view(request, view):
view_template = 'view_media.html'
total = Media.objects.all().count()
elif view == "note":
context["tviews"] = _("Notes")
if request.user.is_authenticated():
private = Q()
else:
@ -641,6 +666,7 @@ def view(request, view):
view_template = 'view_notes.html'
total = Note.objects.all().count()
elif view == "person":
context["tviews"] = _("People")
if request.user.is_authenticated():
if request.GET.has_key("search"):
search = request.GET.get("search")
@ -688,6 +714,7 @@ def view(request, view):
view_template = 'view_people.html'
total = Name.objects.all().count()
elif view == "place":
context["tviews"] = _("Places")
if request.user.is_authenticated():
private = Q()
else:
@ -707,6 +734,7 @@ def view(request, view):
view_template = 'view_places.html'
total = Place.objects.all().count()
elif view == "repository":
context["tviews"] = _("Repositories")
if request.user.is_authenticated():
private = Q()
else:
@ -727,6 +755,7 @@ def view(request, view):
view_template = 'view_repositories.html'
total = Repository.objects.all().count()
elif view == "citation":
context["tviews"] = _("Citations")
if request.user.is_authenticated():
private = Q()
else:
@ -744,6 +773,7 @@ def view(request, view):
view_template = 'view_citations.html'
total = Citation.objects.all().count()
elif view == "source":
context["tviews"] = _("Sources")
if request.user.is_authenticated():
private = Q()
else:
@ -761,6 +791,7 @@ def view(request, view):
view_template = 'view_sources.html'
total = Source.objects.all().count()
elif view == "tag":
context["tviews"] = _("Tags")
if request.GET.has_key("search"):
search = request.GET.get("search")
object_list = Tag.objects \
@ -771,6 +802,7 @@ def view(request, view):
view_template = 'view_tags.html'
total = Tag.objects.all().count()
elif view == "report":
context["tviews"] = _("Reports")
if request.GET.has_key("search"):
search = request.GET.get("search")
object_list = Report.objects \
@ -798,7 +830,6 @@ def view(request, view):
except (EmptyPage, InvalidPage):
page = paginator.page(paginator.num_pages)
context = RequestContext(request)
context["page"] = page
context["view"] = view
context["tview"] = _(view.title())

View File

@ -232,7 +232,7 @@ def event_table(obj, user, action, url=None, *args):
event_list = [(obj.ref_object, obj) for obj in event_ref_list]
for (djevent, event_ref) in event_list:
table.row(
djevent.description,
djevent.description or str(djevent),
table.db.get_event_from_handle(djevent.handle),
djevent.gramps_id,
display_date(djevent),
@ -322,7 +322,8 @@ def citation_table(obj, user, action, url=None, *args):
object_id=obj.id)
for citation_ref in citation_refs:
if citation_ref.citation:
citation = citation_ref.citation
citation = table.db.get_citation_from_handle(
citation_ref.citation.handle)
table.row(citation,
str(citation.confidence),
str(citation.page),