-[% PROCESS "opac/parts/header.tt2";
- PROCESS "opac/parts/org_selector.tt2";
- WRAPPER "opac/parts/myopac/prefs_base.tt2";
- myopac_page = "prefs";
- prefs_page = 'prefs_settings' %]
+<div class="container" id="admin-workstation-printing">
- <h3 class="sr-only">[% l('Search and History Preferences') %]</h3>
+ <style>
+ /* TODO: more context and move me */
+ textarea {
+ height: 400px;
+ width: 100%;
+ }
+ h2 { margin-bottom: 15px }
+
+ </style>
- <form method='post'>
+ <div class="row">
+ <div class="col-md-12">
+ <h2>[% l('Library & Search Preferences') %]</h2>
+ </div>
+ </div>
- <table class="full-width data_grid" id="acct_search_main"
- title="[% l('Search and History Preferences') %]">
- <tbody>
+ <div class="row">
+ <div class="col-md-12">
+
+ <div class="tab-content">
+ <div class="tab-pane active">
- [% IF ctx.updated_user_settings %]
- <tr><td colspan='2'>
- <div class='renew-summary'>
- [% l('Account Successfully Updated') %]
- </div>
- </td></tr>
- [% END %]
+ <!-- printer config UI -->
+ <div class="row" ng-hide="isTestView">
+ <div class="col-md-6">
+ <h3>Default Search Library</h3>
+ <p>The default search library setting determines what library is searched from the advanced
+ search screen and portal page by default. Manual selection of a search library will override
+ it. One recommendation is to set the search library to the highest point you would normally
+ want to search.</p>
+ <div class="input-group">
+ <div class="input-group-btn" dropdown>
+ <select class="btn btn-default dropdown-toggle" ng-model="selectedOrg">
+ <option ng-repeat="org in orgList" value="{{org}}"
+ ng-selected="org.shortname == selectedOrg">
+ <!--{{org.shortname}} -->
+ {{getOrgLabel(org.shortname)}}
+ </option>
+ </select>
+ </div><!-- /btn-group -->
+ </div><!-- /input-group -->
+ </div><!-- col -->
+
+ <button class="btn btn-default" ng-click="setDefaultSearchLib()">
+ [% l('Save') %]
+ </button>
- [%- setting = 'opac.hits_per_page' -%]
- <tr >
- <td width='20%'><label for='[% setting %]'>[% l("Search hits per page") %]</label></td>
- <td>
- <select id='[% setting %]' name='[% setting %]'>
- [% UNLESS ctx.user_setting_map.$setting;
- ctx.user_setting_map.$setting = 10;
- END;
- FOR val IN [5, 8, 10, 15, 20, 25, 50] %]
- <option value='[% val | uri %]'
- [% IF ctx.user_setting_map.$setting == val %]
- selected='selected'[% END %]>[% val | html %]</option>
- [% END %]
- </select>
- <a href="#"><img alt="[% l('Search Hits Help') %]"
- src="[% ctx.media_prefix %]/images/question-mark.png"
- /></a>
- </td>
- </tr>
- [%- setting = 'opac.default_search_location'; -%]
- <tr >
- <td width='20%'><label for='[% setting %]'>[% l("Preferred search location") %]</label></td>
- <td>
- [%- thang = ctx.user.home_ou.id;
- IF ctx.user_setting_map.$setting;
- thang = ctx.user_setting_map.$setting;
- END;
- id = setting;
- INCLUDE build_org_selector name=setting value=thang;
- %]
- </td>
- </tr>
- [%- setting = 'opac.default_pickup_location'; -%]
- <tr>
- <td width='20%'><label for='[% setting %]'>[% l("Preferred pickup location") %]</label></td>
- <td>
- [%- thang = ctx.user.home_ou.id;
- IF ctx.user_setting_map.$setting;
- thang = ctx.user_setting_map.$setting;
- END;
- id = setting;
- INCLUDE build_org_selector name=setting value=thang can_have_vols_only=1;
- %]
- </td>
- </tr>
- [%- setting = 'history.circ.retention_start' -%]
- <tr>
- [% circ_name = l('Keep history of checked out items?') %]
- <td><label for='[% setting %]'>[% circ_name%]</label></td>
- <td>
- <input id='[% setting %]' name='[% setting %]'
- type="checkbox" title="[% circ_name %]"
- [% IF ctx.user_setting_map.$setting; %] checked='checked' [% END %]/>
- </td>
- </tr>
- [%- setting = 'history.hold.retention_start' -%]
- <tr>
- [% hold_name = l('Keep history of holds?') %]
- <td><label for='[% setting %]'>[% hold_name %]</label></td>
- <td>
- <input id='[% setting %]' name='[% setting %]'
- type="checkbox" title="[% hold_name %]"
- [% IF ctx.user_setting_map.$setting; %] checked='checked' [% END %]/>
- </td>
- </tr>
- [%- setting = 'opac.temporary_list_no_warn' -%]
- <tr>
- [% skip_warn = l('Skip warning when adding to temporary book list?') %]
- <td><label for='[% setting %]'>[% skip_warn %]</label></td>
- <td>
- <input id='[% setting %]' name='[% setting %]'
- type="checkbox" title="[% skip_warn %]"
- [% IF ctx.user_setting_map.$setting %] checked='checked' [% END %]/>
- </td>
- </tr>
- [%- setting = 'circ.holds_behind_desk'; IF ctx.behind_desk_supported -%]
- <tr>
- [% behind_desk = l('Pickup holds from behind the desk when possible?') %]
- <td><label for='[% setting %]'>[% behind_desk %]</label></td>
- <td>
- <input id='[% setting %]' name='[% setting %]'
- type="checkbox" title="[% behind_desk %]"
- [% IF ctx.user_setting_map.$setting %] checked='checked' [% END %]/>
- </td>
- </tr>
- [% END %]
+ </div><!-- row --><div class="row" ng-hide="isTestView">
+ <div class="col-md-6">
+ <h3>Preferred Library</h3>
+ <p>The preferred library is used to show copies and URIs regardless of the library
+ searched. One recommendation is to set this to your workstation library so that local
+ copies show up first in search results.</p>
+ <div class="input-group">
+ <div class="input-group-btn" dropdown>
+ <select class="btn btn-default dropdown-toggle">
+ <option>[% l('Select Library') %]</option>
+ <option ng-repeat="org in orgList">
+ {{org.shortname}}
+ </option>
+ </select>
+ </div><!-- /btn-group -->
+ </div><!-- /input-group -->
+ </div><!-- col -->
- <!--
- <tr>
- <td><label for='prefs_def_font'>[% l("Default Font Size") %]</label></td>
- <td>
- <select id='prefs_def_font'>
- <option value='regular'>[% l("Regular Font") %]</option>
- <option value='large'>[% l("Large Font") %]</option>
- </select>
- </td>
- </tr>
- -->
+ </div><!-- row -->
+ <div class="row" ng-hide="isTestView">
+ <div class="col-md-6">
+ <h3>Default Advanced Search Pane</h3>
+ <p>Advanced search has secondary panes for Numeric and MARC Expert searching. You
+ can change which one is loaded by default when opening a new catalog window here.</p>
+ <div class="input-group">
+ <div class="input-group-btn" dropdown>
+ <select class="btn btn-default dropdown-toggle">
+ <option>[% l('Select Pane') %]</option>
+ </select>
+ </div><!-- /btn-group -->
+ </div><!-- /input-group -->
+ </div><!-- col -->
+
+ </div><!-- row -->
+</div><!-- container -->
- </tbody>
- </table>
- <input type="submit" value="[% l('Save') %]" class="opac-button"/>
- </form>
- [% INCLUDE "opac/parts/myopac/prefs_hints.tt2" %]
-[% END %]
['$scope','$window','$location', 'egCore', 'egOrg','egConfirmDialog', 'egAuth',
function($scope , $window , $location, egCore, egOrg, egConfirmDialog, egAuth) {
console.log('SearchPrefsCtrl');
- $scope.setContext = function(ctx) {
- $scope.context = ctx;
- $scope.isTestView = false;
- $scope.actionPending = false;
- }
- //-----UI.js import
- // avoid linking the full fleshed tree to the scope by
- // tossing in a flattened list. -- Does this work as intended?
- $scope.orgList = egOrg.list().map(function(org) {
- return {
- id : org.id(),
- shortname : org.shortname(), //ex. CONS for example consortium
- depth : org.ou_type().depth() //depth of the org unit
- }
- });
- $scope.getSelectedName = function() {
- if ($scope.selected)
- return $scope.selected.shortname();
- return $scope.label;
- }
-
- $scope.orgChanged = function(org) {
- $scope.selected = egOrg.get(org.id);
- if ($scope.onchange) $scope.onchange($scope.selected);
- }
-
- if (!$scope.selected)
- $scope.selected = egOrg.get(egAuth.user().ws_ou());
- //-----End of UI.js import
+var allOrgs = [];
+ var permMap = {};
+ $scope.contextOrg = egCore.org.get(egCore.auth.user().ws_ou());
+
+ // fetch the stored search lib info
+ egCore.hatch.getItem($scope.orgList)
+ .then(function(all) {
+ allOrgs = all || [];
+ $scope.org =
+ allOrgs.map(function(w) { return w.shortname });
+ return egCore.hatch.getItem('eg.search.lib.default');
+ })
+ .then(function(def) {
+ if (def == undefined) {
+ // def = $scope.orgList[0].shortname;
+ egCore.hatch.setItem(
+ 'eg.search.lib.default', $scope.orgList[0]);
+ $scope.defaultSearchLib = $scope.orgList[0];
+ def = $scope.orgList[0].shortname;
+
+ //alert(" def " + def);
+ // $scope.defaultSearchLib = $scope.orgList[0].shortname;
+ } else {
+ $scope.defaultSearchLib = def;
+ //The option initially loaded will be the default Search Library
+ }
+ alert(def + "def 214 ");
+ $scope.activeSearchLib = def; //Should we make this also show default workstation's library if no default search library exists?
+ $scope.selectedOrg = def;
+ });
+
+ $scope.orgList = egOrg.list().map(function(org) {
+ return {
+ id : org.id(),
+ shortname : org.shortname(),
+ depth : org.ou_type().depth()
+ }
+ });
+
+ $scope.getOrgLabel = function(org) {
+ return org == $scope.defaultSearchLib ?
+ egCore.strings.$replace(egCore.strings.DEFAULT_ORG_LABEL, {org:org}) : org;
+ }
+
+ $scope.setDefaultSearchLib = function() {
+ egCore.hatch.setItem(
+ 'eg.search.lib.default', $scope.selectedOrg)
+ .then(function() { $scope.defaultSearchLib = $scope.selectedOrg });
+ }
+
// ---------------------
// Hatch Configs
$scope.hatchURL = egCore.hatch.hatchURL();