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]
# ...
}
}
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 {
myopac_page = "prefs_notify";
prefs_page = 'settings' %]
-USER SETTINGS
+ <form method='GET'>
- <!-- SEARCH PREFS SAVE, MOVE TO SUB-TEMPLATE
<div style="float:right;width:65px;">
<div style="position:absolute">
<div style="position:relative;top:75px;">
- <a id='acct_prefs_save'
- class='hide_me'
- href="#"><img alt="Save"
+ <a id='acct_prefs_save' href="#"><img alt="[% l('Save') %]"
src="[% ctx.media_prefix %]/images/save-btn.png" /></a>
</div>
</div>
</div>
- -->
- <!-- SEARCH PREFERENCES / leaving here for reference
- <table class="hide_me full-width" id="acct_search_main">
- <tbody id='myopac_prefs_tbody'>
- <tr id='myopac_prefs_loading'>
- <td colspan='3'><b>[% l("Loading...") %]</b></td>
- </tr>
-
+ <table class="full-width" id="acct_search_main">
+ <tbody>
<tr id='myopac_prefs_row'>
<td width='20%'>[% l("Search hits per page") %]</td>
<td>
<div style="position:absolute">
<div style="position:relative;top:0px;left:55px;">
- <a href="#">
- <img alt="Search Hits Help"
- src="[% ctx.media_prefix %]/images/question-mark.png" /></a>
+ <a href="#"><img alt="[% l('Search Hits Help') %]"
+ src="[% ctx.media_prefix %]/images/question-mark.png" /></a>
</div>
- </div><select id='prefs_hits_per'
- style="position:relative;z-index:100;">
- <option value='5'>
- 5
- </option>
-
- <option value='8'>
- 8
- </option>
-
- <option value='10'>
- 10
- </option>
-
- <option value='15'>
- 15
- </option>
-
- <option value='20'>
- 20
- </option>
-
- <option value='25'>
- 25
- </option>
-
- <option value='50'>
- 50
- </option>
+ </div>
+ <select name='opac.hits_per_page'>
+ [% key = 'opac.hits_per_page';
+ FOR val IN [5, 8, 10, 15, 20, 25, 50] %]
+ <option value='[% val %]'
+ [% IF ctx.user_setting_map.$key == val %]
+ selected='selected'[% END %]>[% val %]</option>
+ [% END %]
</select>
</td>
</tr>
<tr>
- <td colspan="2"><label for="circHistStart">Keep history of
- checked out items?</label> <input type="checkbox"
- id="circHistStart" /></td>
+ <td>
+ [% l('Keep history of checked out items?') %]
+ </td>
+ <td>
+ <input name='history.circ.retention_start' type="checkbox"
+ [%
+ key = 'history.circ.retention_start';
+ IF ctx.user_setting_map.$key; # any value
+ %] checked='checked' [% END %]
+ />
+ </td>
</tr>
- <tr class="hide_me">
+ <!--
+ <tr>
<td>[% l("Default Font Size") %]</td>
-
- <td><select id='prefs_def_font'>
- <option value='regular'>
- [% l("Regular Font") %]
- </option>
-
- <option value='large'>
- [% l("Large Font") %]
- </option>
- </select></td>
+ <td>
+ <select id='prefs_def_font'>
+ <option value='regular'>[% l("Regular Font") %]</option>
+ <option value='large'>[% l("Large Font") %]</option>
+ </select>
+ </td>
</tr>
- <tr class="hide_me">
+ <tr>
<td>[% l("Default Search Location") %]</td>
<td>
<div style='margin-bottom: 5px;'>
<input type='checkbox' id='myopac_pref_home_lib' />
- [% l("Always search my home library by default.") %]
+ [% l("Search my home library by default.") %]
</div>
<select id='prefs_def_location'></select>
</td>
</tr>
- <tr class="hide_me">
+ <tr>
<td>[% l("Default Search Range") %]</td>
-
- <td><select id='prefs_def_range'>
- </select></td>
+ <td>
+ <select>
+ [%# TODO %]
+ </select>
+ </td>
</tr>
+ -->
+
</tbody>
</table>
- [% INCLUDE "default/opac/parts/myopac/prefs_hints.tt2" %]
- -->
-
+ </form>
+ [% INCLUDE "default/opac/parts/myopac/prefs_hints.tt2" %]
[% END %]