From 7fe1dc51e755cbcecb3a47178a5f45d13a1f1ed2 Mon Sep 17 00:00:00 2001 From: Victoria Lewis Date: Thu, 15 Oct 2015 11:59:47 -0700 Subject: [PATCH] KMAIN 1908 LP 1437112 Added a library selector that displays an indented org unit tree instead of a flat list for selecting default search library and preferred library modified Open-ILS/src/templates/staff/admin/workstation/t_search_prefs.tt2 and Open-ILS/web/js/ui/default/staff/admin/workstation/app.js --- .../staff/admin/workstation/t_search_prefs.tt2 | 134 +++++++++++---------- .../js/ui/default/staff/admin/workstation/app.js | 66 +++++----- .../web/js/ui/default/staff/cat/catalog/app.js | 2 +- 3 files changed, 109 insertions(+), 93 deletions(-) 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 5b1c12a433..e6a7a040a4 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,82 +1,88 @@
- + -
-
-

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

+
+
+

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

+
-
-
-
- -
-
+
+
+

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.

+
+ + +
+
+
+ +
+
+

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 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.

-
+
+
+

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.

+
- -
-
+ +
+
+
+ +
+
- -
-
-

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.

-
-
- -
-
-
-
+
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 5b38f1979f..9a2c48d8fd 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 @@ -193,19 +193,15 @@ function($scope , $window , $location, egCore, egOrg, egConfirmDialog, egAuth) { }); egCore.hatch.getItem('eg.pref.lib.default') - .then(function(def) { - if (def == undefined) { + .then(function(prefDef) { + if (prefDef == undefined) { egCore.hatch.setItem( 'eg.pref.lib.default', $scope.orgList[0]); - def = $scope.orgList[0].shortname; + prefDef = $scope.orgList[0].shortname; } //This lets our dropdown auto-select our default preferred lib. - $scope.selectedPrefOrg = def; - angular.forEach($scope.orgList, function(val, key) { - if(JSON.stringify(def.shortname) == JSON.stringify(val.shortname)){ - $scope.selectedPrefOrg = val.shortname; - } - }); + $scope.selectedPrefOrg = prefDef; + $scope.getPrefDefaultSelectedName = getSelectedName($scope.selectedPrefOrg.shortname); }); egCore.hatch.getItem('eg.search.lib.default') @@ -217,38 +213,52 @@ function($scope , $window , $location, egCore, egOrg, egConfirmDialog, egAuth) { } //This lets our dropdown auto-select our default search lib. $scope.selectedOrg = def; - angular.forEach($scope.orgList, function(val, key) { - if(JSON.stringify(def.shortname) == JSON.stringify(val.shortname)){ - $scope.selectedOrg = val.shortname; - } - }); + $scope.getDefaultSelectedName = getSelectedName($scope.selectedOrg.shortname); }); - $scope.getOrgLabel = function(org) { - return org == $scope.defaultSearchLib? - egCore.strings.$replace(egCore.strings.DEFAULT_ORG_LABEL, {org:org}) :org; + $scope.orgDefaultChanged = function(org) { + $scope.selectedOrg = org; + $scope.getDefaultSelectedName = $scope.selectedOrg.shortname; + if ($scope.onchange) $scope.onchange($scope.getDefaultSelectedName); + } + + $scope.prefOrgDefaultChanged = function(org) { + $scope.selectedPrefOrg = org; + $scope.getPrefDefaultSelectedName = getSelectedName($scope.selectedPrefOrg.shortname); + if ($scope.onchange) $scope.onchange($scope.getPrefDefaultSelectedName); } - $scope.getPrefOrgLabel = function(org) { - return org == $scope.defaultPrefLib? - egCore.strings.$replace(egCore.strings.DEFAULT_PREF_ORG_LABEL, {pref:org}) :org; + var getSelectedName = function(prefOrg) { + if (prefOrg) { + return prefOrg + } else { + return $scope.orgList[0].shortname; + } } $scope.setDefaultLibs = function() { - setDefaultSearchLib(); - setDefaultPrefLib(); + if($scope.selectedOrg.shortname){ + setDefaultSearchLib(); + } + if($scope.selectedPrefOrg.shortname ){ + setDefaultPrefLib(); + } } function setDefaultSearchLib() { - egCore.hatch.setItem( - 'eg.search.lib.default', JSON.parse($scope.selectedOrg)) - .then(function() { $scope.defaultSearchLib = $scope.selectedOrg }); + if($scope.selectedOrg){ + egCore.hatch.setItem( + 'eg.search.lib.default', ($scope.selectedOrg)) + //.then(function() { $scope.defaultSearchLib = $scope.selected.Org }); + } } function setDefaultPrefLib() { - egCore.hatch.setItem( - 'eg.pref.lib.default', JSON.parse($scope.selectedPrefOrg)) - .then(function() { $scope.defaultPrefLib = $scope.selectedPrefOrg }); + if($scope.selectedPrefOrg ) { + egCore.hatch.setItem( + 'eg.pref.lib.default', $scope.selectedPrefOrg) + //.then(function() { $scope.defaultPrefLib = $scope.selectedPrefOrg }); + } } // --------------------- diff --git a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js index 0f356b55bf..b327adc7ed 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js @@ -261,8 +261,8 @@ function($scope , $routeParams , $location , $q , egCore , egHolds, // The URL is otherwise generated through user navigation. if ($scope.catalog_url) return; - var default_search_library = egCore.hatch.getLocalItem('eg.search.lib.default'); var url = $location.absUrl().replace(/\/staff.*/, '/opac/advanced'); + var default_search_library = egCore.hatch.getLocalItem('eg.search.lib.default'); var preferred_search_library = egCore.hatch.getLocalItem('eg.pref.lib.default'); if (default_search_library.id) { -- 2.11.0