From b509271850e5c36e785a7c028955a38e6b88134f Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 14 May 2012 15:22:08 -0400 Subject: [PATCH] tpac ac part 1 Signed-off-by: Bill Erickson --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm | 24 +++++++++++ Open-ILS/src/templates/opac/parts/js.tt2 | 38 +++++++++++++++++ .../templates/opac/parts/record/addedcontent.tt2 | 49 ++++++++++++++++++++++ Open-ILS/src/templates/opac/parts/record/body.tt2 | 1 + .../src/templates/opac/parts/record/extras.tt2 | 3 +- Open-ILS/web/css/skin/default/opac/style.css | 4 ++ 6 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 Open-ILS/src/templates/opac/parts/record/addedcontent.tt2 diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm index af1c3fc3d4..bf3857532d 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm @@ -7,6 +7,8 @@ use OpenILS::Utils::Fieldmapper; use OpenILS::Application::AppUtils; my $U = 'OpenILS::Application::AppUtils'; +our $ac_types = ['toc', 'anotes', 'excerpt', 'summary', 'reviews']; + # context additions: # record : bre object sub load_record { @@ -398,4 +400,26 @@ sub load_email_record { return Apache2::Const::OK; } +sub added_content_avail1 { + my $self = shift; + my $ctx = $self->ctx; + $ctx->{added_content} = { + map {$_ => {status => 3, content => ''}} @$ac_types; + }; + + # fire requests +} + +sub added_content_avail2 { + my $self = shift; + my $ctx = $self->ctx; + + # collect requests +} + +sub added_content_get_type { + my $self = shift; + my $ctx = $self->ctx; +} + 1; diff --git a/Open-ILS/src/templates/opac/parts/js.tt2 b/Open-ILS/src/templates/opac/parts/js.tt2 index df50a03559..1b1fb8ab45 100644 --- a/Open-ILS/src/templates/opac/parts/js.tt2 +++ b/Open-ILS/src/templates/opac/parts/js.tt2 @@ -77,4 +77,42 @@ [% END; # use_autosuggest %] + + [%- END; # want_dojo -%] diff --git a/Open-ILS/src/templates/opac/parts/record/addedcontent.tt2 b/Open-ILS/src/templates/opac/parts/record/addedcontent.tt2 new file mode 100644 index 0000000000..f5ba965e4d --- /dev/null +++ b/Open-ILS/src/templates/opac/parts/record/addedcontent.tt2 @@ -0,0 +1,49 @@ +
+ +[% + ac_types = { + reviews => l('Reviews'), + anotes => l('Author Notes'), + toc => l('Table of Contents'), + excerpt => l('Excerpt'), + summary => l('Summary') + }; + + tab_class = 'ac_tab'; + + # For each type of added content, render the link if it's known to have + # content, do not render the link if it's known to not have content. If + # the content status is unknown, render the link, but hide the link via CSS + # if dojo is enabled. If dojo is not enabled, render and display the link. + + %] + +
+ [% FOR type IN ac_types.keys + IF ctx.added_content.$type.status != '2'; # no content + IF ctx.added_content.$type.status == '3' AND want_dojo; # status unknown + tab_class = tab_class _ 'hidden'; + END %] + + [% END %] +
+ +
+
+ [% + ac_type = CGI.param('ac'); + IF ac_type; + content = ctx.added_content.$ac_type.content; + IF content; + content; + ELSE; + l('No Content Available'); + END; + END; + %] +
+
+ + diff --git a/Open-ILS/src/templates/opac/parts/record/body.tt2 b/Open-ILS/src/templates/opac/parts/record/body.tt2 index b7efd51790..664abc9dbf 100644 --- a/Open-ILS/src/templates/opac/parts/record/body.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/body.tt2 @@ -2,6 +2,7 @@ PROCESS "opac/parts/misc_util.tt2"; PROCESS get_marc_attrs args=attrs; stop_parms = ['expand','cnoffset']; + ctx.record_attrs = attrs; # capture for JS %]
diff --git a/Open-ILS/src/templates/opac/parts/record/extras.tt2 b/Open-ILS/src/templates/opac/parts/record/extras.tt2 index 4a473c3660..63f82eeb6a 100644 --- a/Open-ILS/src/templates/opac/parts/record/extras.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/extras.tt2 @@ -22,6 +22,7 @@ {name => 'excerpt', label => l('Excerpt'), hide => 1}, {name => 'issues', label => l('Issues Held'), hide => !(ctx.have_holdings_to_show || ctx.have_mfhd_to_show)}, {name => 'preview', label => l('Preview'), hide => 1}, + {name => 'addedcontent', label => l('Additional Content')}, # hide if all content is known to not exist {name => 'cnbrowse', label => l('Shelf Browser')}, {name => 'marchtml', label => l('MARC Record')} ]; @@ -40,7 +41,7 @@