From 95eff27824227203376bff1d98a6f2b9c06d47da Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 9 Jun 2015 22:10:18 +0000 Subject: [PATCH] WIP: start work on Z39.50 interface So far, fetch targets. Next steps: - add directive for the search input boxes; will need to watch the target list - add search service Signed-off-by: Galen Charlton --- Open-ILS/src/templates/staff/cat/z3950/index.tt2 | 17 +++++++++ Open-ILS/src/templates/staff/cat/z3950/t_list.tt2 | 18 +++++++++ .../src/templates/staff/cat/z3950/t_target.tt2 | 4 ++ Open-ILS/src/templates/staff/navbar.tt2 | 6 +++ .../web/js/ui/default/staff/cat/services/z3950.js | 44 ++++++++++++++++++++++ 5 files changed, 89 insertions(+) create mode 100644 Open-ILS/src/templates/staff/cat/z3950/index.tt2 create mode 100644 Open-ILS/src/templates/staff/cat/z3950/t_list.tt2 create mode 100644 Open-ILS/src/templates/staff/cat/z3950/t_target.tt2 create mode 100644 Open-ILS/web/js/ui/default/staff/cat/services/z3950.js diff --git a/Open-ILS/src/templates/staff/cat/z3950/index.tt2 b/Open-ILS/src/templates/staff/cat/z3950/index.tt2 new file mode 100644 index 0000000000..02f8d08f46 --- /dev/null +++ b/Open-ILS/src/templates/staff/cat/z3950/index.tt2 @@ -0,0 +1,17 @@ +[% + WRAPPER "staff/base.tt2"; + ctx.page_title = l("Z39.50"); + ctx.page_app = "egCatZ3950Search"; + ctx.page_ctrl = "Z3950SearchCtrl"; +%] + +[% BLOCK APP_JS %] + + + + +[% END %] + +
+ +[% END %] diff --git a/Open-ILS/src/templates/staff/cat/z3950/t_list.tt2 b/Open-ILS/src/templates/staff/cat/z3950/t_list.tt2 new file mode 100644 index 0000000000..5f12a1fd7c --- /dev/null +++ b/Open-ILS/src/templates/staff/cat/z3950/t_list.tt2 @@ -0,0 +1,18 @@ +
+[% l('Search') %] +
+ +
+[% l('Targets') %] + +
+ + + + diff --git a/Open-ILS/src/templates/staff/cat/z3950/t_target.tt2 b/Open-ILS/src/templates/staff/cat/z3950/t_target.tt2 new file mode 100644 index 0000000000..52903002b4 --- /dev/null +++ b/Open-ILS/src/templates/staff/cat/z3950/t_target.tt2 @@ -0,0 +1,4 @@ +
+ {{target.code}} / {{target.settings.label}}} + requires auth +
diff --git a/Open-ILS/src/templates/staff/navbar.tt2 b/Open-ILS/src/templates/staff/navbar.tt2 index dd9cb38177..6e2e8f73d4 100644 --- a/Open-ILS/src/templates/staff/navbar.tt2 +++ b/Open-ILS/src/templates/staff/navbar.tt2 @@ -222,6 +222,12 @@
  • + + + [% l('Import Record from Z39.50') %] + +
  • +
  • [% l('MARC Batch Import/Export') %] diff --git a/Open-ILS/web/js/ui/default/staff/cat/services/z3950.js b/Open-ILS/web/js/ui/default/staff/cat/services/z3950.js new file mode 100644 index 0000000000..1d6d9182ec --- /dev/null +++ b/Open-ILS/web/js/ui/default/staff/cat/services/z3950.js @@ -0,0 +1,44 @@ +angular.module('egZ3950Mod', ['egCoreMod', 'ui.bootstrap']) + +.directive("egZ3950TargetList", function () { + return { + transclude: true, + restrict: 'AE', + scope: { + + }, + templateUrl: './cat/z3950/t_target', + controller: + ['$scope','egCore','egAuth', + function($scope , egCore, egAuth) { + function loadTargets() { + egCore.net.request( + 'open-ils.search', + 'open-ils.search.z3950.retrieve_services', + egAuth.token() + ).then(function(res) { + $scope.targets = []; + // native Evergreen search goes first + var localTarget = res['native-evergreen-catalog']; + delete res['native-evergreen-catalog']; + angular.forEach(res, function(value, key) { + this.push({ + code: key, + settings: value + }); + }, $scope.targets); + $scope.targets.sort(function (a, b) { + a = a.settings.label; + b = b.settings.label; + return a < b ? -1 : (a > b ? 1 : 0); + }); + $scope.targets.unshift({ + code: 'native-evergreen-catalog', + settings: localTarget + }); + }); + } + loadTargets(); + }] + } +}) -- 2.11.0