Show Log history for every object

svn: r19886
This commit is contained in:
Doug Blank 2012-06-20 02:34:15 +00:00
parent 32fbd754fb
commit 4b0962fcc9
10 changed files with 72 additions and 1 deletions

View File

@ -10,6 +10,11 @@
document.location.hash = ui.panel.id;
}
});
$('#shared-tabs').tabs({
'select': function(event, ui){
document.location.hash = ui.panel.id;
}
});
});
</script>
@ -36,6 +41,7 @@
<li class="ui-corner-top ui-state-default"><a href="#tab-media">Media</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-data">Data</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-references">References</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-history">History</a></li>
</ul>
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom" id="tab-general">
@ -73,6 +79,9 @@
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-references">
{% citation_reference_table citation user action %}
</div>
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-history">
{% history_table citation user action %}
</div>
</div>
<p>Note: Any changes in the shared citation information will be reflected
@ -82,13 +91,14 @@
<hr>
<h2>Shared source information</h2>
<div class="ui-tabs ui-widget ui-widget-content ui-corner-all" id="general-tabs">
<div class="ui-tabs ui-widget ui-widget-content ui-corner-all" id="shared-tabs">
<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-shared-general">General</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-shared-notes">Notes</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-shared-media">Media</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-shared-repositories">Repositories</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-shared-references">References</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-shared-history">History</a></li>
</ul>
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom" id="tab-shared-general">
@ -130,6 +140,9 @@
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-shared-references">
{% citation_reference_table source user action %}
</div>
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-shared-history">
{% history_table source user action %}
</div>
</div>
<p>Note: Any changes in the shared source information will be reflected

View File

@ -57,6 +57,7 @@
<li class="ui-corner-top ui-state-default"><a href="#tab-media">Media</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-attributes">Attributes</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-references">References</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-history">History</a></li>
</ul>
<div class="ui-tab-panel ui-widget-content ui-corner-bottom" id="tab-sources">
{% citation_table event user action "/citation/$act/event/%s" event.handle %}
@ -73,6 +74,9 @@
<div class="ui-tab-panel ui-widget-content ui-corner-bottom ui-tab-hide" id="tab-references">
{% event_reference_table event user action %}
</div>
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-history">
{% history_table event user action %}
</div>
</div>
{% if user.is_superuser %}

View File

@ -103,6 +103,7 @@
<li class="ui-corner-top ui-state-default"><a href="#tab-notes">Notes</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 href="#tab-lds">LDS</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-history">History</a></li>
</ul>
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom" id="tab-children">
<!-- Events -->
@ -126,6 +127,9 @@
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-lds">
{% lds_table family user action "/lds/add/family/%s" family.handle %}
</div>
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-history">
{% history_table family user action %}
</div>
</div>
{% if user.is_superuser %}

View File

@ -61,6 +61,7 @@
<li class="ui-corner-top ui-state-default"><a href="#tab-attributes">Attributes</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-notes">Notes</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-references">References</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-history">History</a></li>
</ul>
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-sources">
{% citation_table media user action "/citation/$act/media/%s" media.handle %}
@ -74,6 +75,9 @@
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom" id="tab-references">
{% media_reference_table media user action %}
</div>
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-history">
{% history_table media user action %}
</div>
</div>
{% if user.is_superuser %}

View File

@ -75,10 +75,14 @@
<div class="ui-tabs ui-widget ui-widget-content ui-corner-all" id="tabs">
<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
<li class="ui-corner-top ui-state-default"><a href="#tab-references">References</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-history">History</a></li>
</ul>
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-references">
{% note_reference_table note user action %}
</div>
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-history">
{% history_table note user action %}
</div>
</div>
</div>
</div>

View File

@ -94,6 +94,7 @@
<li class="ui-corner-top ui-state-default"><a href="#tab-association">Associations</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 href="#tab-references">References</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-history">History</a></li>
</ul>
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom" id="tab-events">
<!-- Events -->
@ -130,6 +131,9 @@
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-references">
{% person_reference_table person user action %}
</div>
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-history">
{% history_table person user action %}
</div>
</div>
{% if logform %}

View File

@ -57,6 +57,7 @@
<li class="ui-corner-top ui-state-default"><a 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 href="#tab-references">References</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-history">History</a></li>
</ul>
<div class="ui-tab-panel ui-widget-content ui-corner-bottom" id="tab-locations">
<!-- place.location_set -->
@ -79,6 +80,9 @@
<div class="ui-tab-panel ui-widget-content ui-corner-bottom ui-tab-hide" id="tab-references">
{% place_reference_table place user action %}
</div>
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-history">
{% history_table place user action %}
</div>
</div>
</div>
</div>

View File

@ -52,6 +52,7 @@
<li class="ui-corner-top ui-state-default"><a href="#tab-internet">Internet</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-notes">Notes</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-references">References</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-history">History</a></li>
</ul>
<div class="ui-tab-panel ui-widget-content ui-corner-bottom" id="tab-addresses">
{% address_table repository user action "/address/add/repository/%s" repository.handle %}
@ -65,6 +66,9 @@
<div class="ui-tab-panel ui-widget-content ui-corner-bottom ui-tab-hide" id="tab-references">
{% repository_reference_table repository user action %}
</div>
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-history">
{% history_table repository user action %}
</div>
</div>
{% if user.is_superuser %}

View File

@ -58,6 +58,7 @@
<li class="ui-corner-top ui-state-default"><a href="#tab-data">Data</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-repositories">Repositories</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-references">References</a></li>
<li class="ui-corner-top ui-state-default"><a href="#tab-history">History</a></li>
</ul>
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom" id="tab-notes">
{% note_table source user action "/note/$act/source/%s" source.handle %}
@ -74,6 +75,9 @@
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-references">
{% source_reference_table source user action %}
</div>
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-history">
{% history_table source user action %}
</div>
</div>
{% if user.is_superuser %}

View File

@ -80,6 +80,7 @@ util_tags = [
'render_name',
"get_person_from_handle",
"event_table",
"history_table",
"name_table",
"surname_table",
"citation_table",
@ -325,6 +326,31 @@ def event_table(obj, user, action, url, args):
retval += nbsp("") # to keep tabs same height
return retval
def history_table(obj, user, action):
retval = ""
table = Table("history_table")
table.columns(
_("Action"),
_("Comment"),
)
if user.is_authenticated():
obj_type = ContentType.objects.get_for_model(obj)
for entry in models.Log.objects.filter(
object_id=obj.id,
object_type=obj_type):
table.row(
"%s on %s by %s" % (entry.log_type,
entry.last_changed,
entry.last_changed_by),
entry.reason)
table.row(
"Latest on %s by %s" % (obj.last_changed,
obj.last_changed_by),
"Current status")
retval += table.get_html()
retval += nbsp("") # to keep tabs same height
return retval
def name_table(obj, user, action, url=None, *args):
retval = ""
table = Table("name_table")