From fffeec3d17be21ddc529c0c48d6044ef58e27bb7 Mon Sep 17 00:00:00 2001 From: Victoria Lewis Date: Tue, 25 Aug 2015 12:43:57 -0700 Subject: [PATCH] LP1437112 set default pref library Switch branches to prepare for demo --- .../templates/staff/admin/workstation/index.tt2 | 1 + .../staff/admin/workstation/t_search_prefs.tt2 | 198 ++++++++------------- .../js/ui/default/staff/admin/workstation/app.js | 79 +++++--- 3 files changed, 129 insertions(+), 149 deletions(-) diff --git a/Open-ILS/src/templates/staff/admin/workstation/index.tt2 b/Open-ILS/src/templates/staff/admin/workstation/index.tt2 index 6ed2561078..0512483109 100644 --- a/Open-ILS/src/templates/staff/admin/workstation/index.tt2 +++ b/Open-ILS/src/templates/staff/admin/workstation/index.tt2 @@ -14,6 +14,7 @@ angular.module('egCoreMod').run(['egStrings', function(s) { s.PREFS_REMOVE_KEY_CONFIRM = '[% l('Delete content for key "[_1]"?', '{{deleteKey}}') %]'; s.DEFAULT_WS_LABEL = '[% l('[_1] (Default)', '{{ws}}') %]'; + s.DEFAULT_ORG_LABEL = '[% l( '[_1] {{org}}') %]'; s.WS_EXISTS = '[% l("Workstation name already exists. Use it anyway?") %]'; }]); diff --git a/Open-ILS/src/templates/staff/admin/workstation/t_search_prefs.tt2 b/Open-ILS/src/templates/staff/admin/workstation/t_search_prefs.tt2 index 9f1288c8b5..fc6e8f119c 100644 --- a/Open-ILS/src/templates/staff/admin/workstation/t_search_prefs.tt2 +++ b/Open-ILS/src/templates/staff/admin/workstation/t_search_prefs.tt2 @@ -1,127 +1,85 @@ -[% 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' %] +
-

[% l('Search and History Preferences') %]

+ -
+
+
+

[% l('Library & Search Preferences') %]

+
+
- - +
+
+ +
+
- [% IF ctx.updated_user_settings %] -
- [% END %] + +
+
+

Default Search Library

+

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.

+
+
+ +
+
+
+ + - [%- setting = 'opac.hits_per_page' -%] -
- - - - [%- setting = 'opac.default_search_location'; -%] - - - - - [%- setting = 'opac.default_pickup_location'; -%] - - - - - [%- setting = 'history.circ.retention_start' -%] - - [% circ_name = l('Keep history of checked out items?') %] - - - - [%- setting = 'history.hold.retention_start' -%] - - [% hold_name = l('Keep history of holds?') %] - - - - [%- setting = 'opac.temporary_list_no_warn' -%] - - [% skip_warn = l('Skip warning when adding to temporary book list?') %] - - - - [%- setting = 'circ.holds_behind_desk'; IF ctx.behind_desk_supported -%] - - [% behind_desk = l('Pickup holds from behind the desk when possible?') %] - - - - [% END %] +
+
+

Preferred Library

+

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.

+
+
+ +
+
+
- +
+
+
+

Default Advanced Search Pane

+

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.

+
+
+ +
+
+
+ +
+ - -
-
- [% l('Account Successfully Updated') %] -
-
- - [% l('Search Hits Help') %] -
- [%- 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; - %] -
- [%- 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; - %] -
- -
- -
- -
- -
- -
- [% INCLUDE "opac/parts/myopac/prefs_hints.tt2" %] -[% END %] diff --git a/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js b/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js index b30f9c6ac7..ec23e433b6 100644 --- a/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js +++ b/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js @@ -184,36 +184,57 @@ function($scope , $window , $location , egCore , egConfirmDialog) { ['$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(); -- 2.11.0