From 471e5be5386c5a548a01bb21da7a4e2b4311d890 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 8 Jun 2011 17:25:31 -0400 Subject: [PATCH] Read support for some user settings in setting page Search hits per page and circ history opt-in displaying TODO: add more settings TODO: implement POST/write for updating values Signed-off-by: Bill Erickson --- .../lib/OpenILS/WWW/EGCatLoader/Account.pm | 18 +++- .../default/opac/myopac/prefs_settings.tt2 | 113 ++++++++------------- 2 files changed, 61 insertions(+), 70 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index 0e96bb2446..f9c7bf41e3 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -11,13 +11,14 @@ my $U = 'OpenILS::Application::AppUtils'; sub prepare_extended_user_info { my $self = shift; + my @extra_flesh = @_; $self->ctx->{user} = $self->editor->retrieve_actor_user([ $self->ctx->{user}->id, { flesh => 1, flesh_fields => { - au => [qw/card home_ou addresses ident_type billing_address/] + au => [qw/card home_ou addresses ident_type billing_address/, @extra_flesh] # ... } } @@ -107,7 +108,20 @@ sub update_optin_prefs { sub load_myopac_prefs_settings { my $self = shift; - return $self->prepare_extended_user_info || Apache2::Const::OK; + my $stat = $self->prepare_extended_user_info('settings'); + return $stat if $stat; # not-OK + + $self->ctx->{user_setting_map} = { + map { $_->name => OpenSRF::Utils::JSON->JSON2perl($_->value) } + @{$self->ctx->{user}->settings} + }; + + return Apache2::Const::OK + unless $self->cgi->request_method eq 'POST'; + + # process POST request... + + return Apache2::Const::OK; } sub fetch_user_holds { diff --git a/Open-ILS/web/templates/default/opac/myopac/prefs_settings.tt2 b/Open-ILS/web/templates/default/opac/myopac/prefs_settings.tt2 index daf65be285..85594f7551 100644 --- a/Open-ILS/web/templates/default/opac/myopac/prefs_settings.tt2 +++ b/Open-ILS/web/templates/default/opac/myopac/prefs_settings.tt2 @@ -3,112 +3,89 @@ myopac_page = "prefs_notify"; prefs_page = 'settings' %] -USER SETTINGS +
- - + - [% INCLUDE "default/opac/parts/myopac/prefs_hints.tt2" %] - --> - +
+ [% INCLUDE "default/opac/parts/myopac/prefs_hints.tt2" %] [% END %] -- 2.11.0