From b4b199b4f95abbcc55e825a1f734f0657d1f5dd1 Mon Sep 17 00:00:00 2001 From: berick Date: Wed, 6 Apr 2011 12:17:01 -0400 Subject: [PATCH] created inital notifications preference page; infrastructure for notify and search/settings preferences pages; prefs pages icons --- .../src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm | 4 +- .../lib/OpenILS/WWW/EGCatLoader/Account.pm | 46 +- .../web/templates/default/opac/myopac/prefs.tt2 | 726 ++------------------- .../templates/default/opac/myopac/prefs/notify.tt2 | 120 ++++ .../default/opac/myopac/prefs/settings.tt2 | 115 ++++ .../default/opac/parts/myopac/personal.tt2 | 395 +++++++++++ 6 files changed, 732 insertions(+), 674 deletions(-) create mode 100644 Open-ILS/web/templates/default/opac/myopac/prefs/notify.tt2 create mode 100644 Open-ILS/web/templates/default/opac/myopac/prefs/settings.tt2 create mode 100644 Open-ILS/web/templates/default/opac/parts/myopac/personal.tt2 diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index 0b60828e7f..c889704800 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -127,7 +127,9 @@ sub load { return $self->load_myopac_bookbag_update if $path =~ m|opac/myopac/list/update|; return $self->load_myopac_circ_history if $path =~ m|opac/myopac/circ_history|; return $self->load_myopac_hold_history if $path =~ m|opac/myopac/hold_history|; - return $self->load_myopac if $path =~ m|opac/myopac|; + return $self->load_myopac_prefs_notify if $path =~ m|opac/myopac/prefs/notify|; + return $self->load_myopac_prefs_settings if $path =~ m|opac/myopac/prefs/settings|; + return $self->load_myopac_prefs if $path =~ m|opac/myopac/prefs|; return Apache2::Const::OK; } 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 3c1d6a650f..5ba9c9e2c6 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -10,9 +10,51 @@ my $U = 'OpenILS::Application::AppUtils'; # context additions: # user : au object, fleshed -sub load_myopac { +sub load_myopac_prefs { + my $self = shift; + + $self->ctx->{user} = $self->editor->retrieve_actor_user([ + $self->ctx->{user}->id, + { + flesh => 1, + flesh_fields => { + au => [qw/card home_ou addresses ident_type/] + # ... + } + } + ]); + + return Apache2::Const::OK; +} + +sub load_myopac_prefs_notify { + my $self = shift; + my $e = $self->editor; + + # fetch all of the opt-in settings the user has access to + # XXX: user's should in theory have options to opt-in to notices + # for remote locations, but that opens the door for a large + # set of generally un-used opt-ins.. needs discussion + my $opt_ins = $U->simplereq( + 'open-ils.actor', + 'open-ils.actor.event_def.opt_in.settings.atomic', + $e->authtoken, $e->requestor->home_ou); + + # fetch user setting values for each of the opt-in settings + my $user_set = $U->simplereq( + 'open-ils.actor', + 'open-ils.actor.patron.settings.retrieve', + $e->authtoken, + $e->requestor->id, + [map {$_->name} @$opt_ins] + ); + + $self->ctx->{opt_in_settings} = [map { {cust => $_, value => $user_set->{$_->name} } } @$opt_ins]; + return Apache2::Const::OK; +} + +sub load_myopac_prefs_settings { my $self = shift; - $self->ctx->{page} = 'myopac'; $self->ctx->{user} = $self->editor->retrieve_actor_user([ $self->ctx->{user}->id, diff --git a/Open-ILS/web/templates/default/opac/myopac/prefs.tt2 b/Open-ILS/web/templates/default/opac/myopac/prefs.tt2 index bb62854b45..1f40c0b100 100644 --- a/Open-ILS/web/templates/default/opac/myopac/prefs.tt2 +++ b/Open-ILS/web/templates/default/opac/myopac/prefs.tt2 @@ -1,683 +1,67 @@ [% PROCESS "default/opac/parts/header.tt2"; WRAPPER "default/opac/parts/base.tt2" + "default/opac/parts/myopac/base.tt2"; - myopac_page = "prefs" %] -
- - -
- - Account Information and Preferences - - - Export List - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[% l("Loading...") %]
[% l("Search hits per page") %] -
-
- - Search Hits Help -
-
-
[% l("Default Font Size") %]
[% l("Default Search Location") %] -
- - [% l("Always search my home library by default.") %] -
- -
[% l("Default Search Range") %]
Try - Library Elf-to manage library materials! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[% l("Default Hold Notification Method") %] [% l("(Help)") %]
Pick Up Notice for - Holds
-
- - (Temporarily phone notification will generate a - mailed paper notice.)
Expire Notice for - Holds
-
Cancel Notice for - Holds
-
Overdue First - Notice
- -
- - - (Temporarily phone notification will generate a - mailed paper notice.)
Courtesy - Notice
-
- -
-
- - - - - - -
- [% l("Your account expired on") %] - ! - [% l("Please see a librarian to renew your account.") %]
+
+
- -
- - - - - - - - - - - - -
- [% l("* Staff Notes *") %]
:

+ [% ELSIF prefs_page == 'notify' %] +
+
+
+ +
+
+ +
+ [% ELSE %] +
+ +
+
+ +
+
+ +
+ [% END %] +
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [% IF ctx.user.ident_value %] - - - - - [% END %] - - - - - - - - - - - - - - - - - - - - - - - -
[% l("Name") %][% l( - HUMAN_NAME_FORMAT, - ctx.user.prefix, ctx.user.first_given_name, - ctx.user.second_given_name, ctx.user.family_name, - ctx.user.suffix - ) | html %]
- [% l("Day Phone") %][% ctx.user.day_phone | html %][% l("Change") %]
- - Enter New [% l("Day Phone") %]: - - - - - - - - - -
- [% l("Evening Phone") %][% ctx.user.evening_phone | html %][% l("Change") %]
New - [% l("Evening Phone") %]: - - - -
- [% l("Other Phone") %][% ctx.user.other_phone | html %][% l("Change") %]
Enter - New [% l("Other Phone") %]: - - - -
-
-
- - Username Help -
-
[% l("Username") %] -
[% ctx.user.usrname | html %][% l("Change") %]
[% l("Enter new username:") %] - - - -
- [% l("Password") %] - [% l("(not shown)") %][% l("Change") %]
- - - - - - - - - - - - - - - - - - - -
- - [% l("Enter current password:") %] - - - -
[% l("Enter new password:") %] -
[% l("Re-enter new password:") %] - -
- -
[% l("Email Address") %][% ctx.user.email | html %][% l('Change') %]
- - [% l("Enter new email address:") %] - - - - - - - - -
- [% l("Primary Identification") %] - [% - # l('[_1] ([_2])', ctx.user.ident_value, ctx.user.ident_type.name) | html - # XXX uncomment the above line to show primary - # identification. With a minor tweak it could - # alternatively be shown but partially obscured. %] -
- [% l("Active Barcode") %][% ctx.user.card.barcode %]
- [% l("Home Library") %][% ctx.user.home_ou.name %][% l("Change") %]
- - New home library: - - - - - - - -
- [% l("Account Creation Date") %] -

-
-
- - - - - - - - - - [% FOR addr IN ctx.user.addresses %] - - - - [% END %] - -
[% l("Addresses") %]
- - - - - - - - - - [% IF addr.street2 %] - - - [% END %] - - - - - - - - - - - - - - - - - - - - +

- - - - - - - -
[% l("Address Type") %][% - IF addr.pending == "t"; - "" _ l("*** PENDING ***") _ " "; - END; - addr.address_type | lower | ucfirst; - %]
[% l("Street") %][% addr.street1 | html %]
[% l("Street") %][% addr.street2 | html %]
[% l("City") %][% addr.city | html %]
[% l("County") %][% addr.county| html %]
[% l("State") %][% addr.state | html %]
[% l("Country") %][% addr.country | html %]
[% l("Zip") %][% addr.post_code | html %]
- Edit Address -
-
-
-
- [% l("Please enter a username") %] -
-
- [% l("The requested username is not available. Please choose a different username.") %] -
-
- [% l("Username successfully updated") %] -
-
- [% l("Username update failed") %] -
-
- [% l("Please enter a valid email address") %] -
-
- [% l("Email address successfully updated") %] -
-
- [% l("Email address update failed") %] -
-
- [% l("Passwords are empty or do not match") %] -
-
- [% l("Password successfully updated") %] -
-
- [% l("Password update failed") %] -
- - [% l("Username cannot contain spaces or have the same format as a barcode") %] - - - Address Saved - -
- [% l("Preferences successfully updated") %] -
-
- [% l("Preferences update failed!") %] -
- - [% l("This setting defines how you will be notified of holds that are ready to be picked up from the library. By default, holds will use the notification style you choose here. However, you will still have the option to change individual holds regardless of this setting.") %] +
+ [% l('Account Information and Preferences') %] + + [% l('Export List') %]
+ +
+ +[% + IF prefs_page == 'personal'; + # By default, load the personal info page + INCLUDE 'default/opac/parts/myopac/personal.tt2'; + ELSE; + content; + END; +%] +
[% END %] diff --git a/Open-ILS/web/templates/default/opac/myopac/prefs/notify.tt2 b/Open-ILS/web/templates/default/opac/myopac/prefs/notify.tt2 new file mode 100644 index 0000000000..5d1077a849 --- /dev/null +++ b/Open-ILS/web/templates/default/opac/myopac/prefs/notify.tt2 @@ -0,0 +1,120 @@ +[% PROCESS "default/opac/parts/header.tt2"; + WRAPPER "default/opac/myopac/prefs.tt2"; + myopac_page = "prefs/notify" %] + + + + + + + + [% IF optin.size == 0 %] + [% l('No notification preferences are configured') %] + [% END %] + [% FOR optin IN ctx.opt_in_settings %] + + + + + [% END %] + +
[% l('Notifation Type') %][% l('Enabled') %]
[% optin.cust.label %] + +
+ + + + + +[% END %] + + diff --git a/Open-ILS/web/templates/default/opac/myopac/prefs/settings.tt2 b/Open-ILS/web/templates/default/opac/myopac/prefs/settings.tt2 new file mode 100644 index 0000000000..3e111ffefc --- /dev/null +++ b/Open-ILS/web/templates/default/opac/myopac/prefs/settings.tt2 @@ -0,0 +1,115 @@ +[% PROCESS "default/opac/parts/header.tt2"; + WRAPPER "default/opac/myopac/prefs.tt2"; + myopac_page = "prefs/notify" %] + +USER SETTINGS + + + + + + +[% END %] diff --git a/Open-ILS/web/templates/default/opac/parts/myopac/personal.tt2 b/Open-ILS/web/templates/default/opac/parts/myopac/personal.tt2 new file mode 100644 index 0000000000..fe1be5cd1d --- /dev/null +++ b/Open-ILS/web/templates/default/opac/parts/myopac/personal.tt2 @@ -0,0 +1,395 @@ +
+
+ + + + + + +
+ [% l("Your account expired on") %] + ! + [% l("Please see a librarian to renew your account.") %]
+
+ +
+ + + + + + + + + + + + +
+ [% l("* Staff Notes *") %]
:

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [% IF ctx.user.ident_value %] + + + + + [% END %] + + + + + + + + + + + + + + + + + + + + + + + +
[% l("Name") %][% l( + HUMAN_NAME_FORMAT, + ctx.user.prefix, ctx.user.first_given_name, + ctx.user.second_given_name, ctx.user.family_name, + ctx.user.suffix + ) | html %]
+ [% l("Day Phone") %][% ctx.user.day_phone | html %][% l("Change") %]
+ + Enter New [% l("Day Phone") %]: + + + + + + + + + +
+ [% l("Evening Phone") %][% ctx.user.evening_phone | html %][% l("Change") %]
New + [% l("Evening Phone") %]: + + + +
+ [% l("Other Phone") %][% ctx.user.other_phone | html %][% l("Change") %]
Enter + New [% l("Other Phone") %]: + + + +
+
+
+ + Username Help +
+
[% l("Username") %] +
[% ctx.user.usrname | html %][% l("Change") %]
[% l("Enter new username:") %] + + + +
+ [% l("Password") %] + [% l("(not shown)") %][% l("Change") %]
+ + + + + + + + + + + + + + + + + + + +
+ + [% l("Enter current password:") %] + + + +
[% l("Enter new password:") %] +
[% l("Re-enter new password:") %] + +
+ +
[% l("Email Address") %][% ctx.user.email | html %][% l('Change') %]
+ + [% l("Enter new email address:") %] + + + + + + + + +
+ [% l("Primary Identification") %] + [% + # l('[_1] ([_2])', ctx.user.ident_value, ctx.user.ident_type.name) | html + # XXX uncomment the above line to show primary + # identification. With a minor tweak it could + # alternatively be shown but partially obscured. + %] +
+ [% l("Active Barcode") %][% ctx.user.card.barcode %]
+ [% l("Home Library") %][% ctx.user.home_ou.name %][% l("Change") %]
+ + New home library: + + + + + + + +
+ [% l("Account Creation Date") %] +

+
+
+ + + + + + + + + + [% FOR addr IN ctx.user.addresses %] + + + + [% END %] + +
[% l("Addresses") %]
+ + + + + + + + + + [% IF addr.street2 %] + + + [% END %] + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
[% l("Address Type") %][% + IF addr.pending == "t"; + "" _ l("*** PENDING ***") _ " "; + END; + addr.address_type | lower | ucfirst; + %]
[% l("Street") %][% addr.street1 | html %]
[% l("Street") %][% addr.street2 | html %]
[% l("City") %][% addr.city | html %]
[% l("County") %][% addr.county| html %]
[% l("State") %][% addr.state | html %]
[% l("Country") %][% addr.country | html %]
[% l("Zip") %][% addr.post_code | html %]
+ Edit Address +
+
+
+ -- 2.11.0