</form>
</div>
-<div class="text-right" ng-if="local_overlay_target">
-[% l('Record with TCN [_1] marked for overlay.', '{{local_overlay_target}}') %]"
+<div class="panel panel-default" ng-show="field_strip_groups.length">
+ <div class="panel-heading">[% l('Remove Fields on Import') %]</div>
+ <div class="panel-body">
+ <div class="row">
+ <div class="col-sm-3 checkbox-inline" ng-repeat="grp in field_strip_groups">
+ <label for="strip-grp-{{grp.id()}}">{{grp.label()}}</label>
+ <input id='strip-grp-{{grp.id()}}' ng-model="grp.selected" type="checkbox"/>
+ </div>
+ </div>
+ </div>
+</div>
+
+<div class="row" ng-show="searchInProgress">
+ <div class="col-md-6">
+ <div class="progress progress-striped active">
+ <div class="progress-bar" role="progressbar" aria-valuenow="100"
+ aria-valuemin="0" aria-valuemax="100" style="width: 100%">
+ <span class="sr-only">[% l('Searching...') %]</span>
+ </div>
+ </div>
+ </div>
</div>
-<div class="text-right" ng-if="!local_overlay_target">
-[% l('No record marked for overlay.') %]
+
+<div class="row">
+ <div class="col-md-6">
+ [% l('Total hits: [_1]', '{{total_hits}}') %]
+ </div>
+ <div class="col-md-6 text-right" ng-if="local_overlay_target">
+ [% l('Record with TCN [_1] marked for overlay.', '{{local_overlay_target}}') %]"
+ </div>
+ <div class="col-md-6 text-right" ng-if="!local_overlay_target">
+ [% l('No record marked for overlay.') %]
+ </div>
</div>
-<form class="form-validated" novalidate name="form" ng-submit="ok(args)">
- <div>
- <div class="modal-header">
- <button type="button" class="close"
- ng-click="cancel()" aria-hidden="true">×</button>
- <h4 class="modal-title">[% l('Overlay record?') %]</h4>
- </div>
- <div class="modal-body">
- <div class="row">
- <div class="col-xs-6">
- <div>[% l('Replace TCN [_1] ...', '{{overlay_target}}') %]</div>
- <eg-record-html record-id="overlay_target" />
- </div>
- <div class="col-xs-6">
- <div>[% l('With this?') %]</div>
- <eg-record-html marc-xml="{{marc_xml}}" />
- </div>
- </div>
- </div>
- <div class="modal-footer">
- <input type="submit" ng-disabled="form.$invalid"
- class="btn btn-primary" value="[% l('Overlay') %]"/>
- <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
- </div>
+<div>
+ <div class="modal-header">
+ <button type="button" class="close"
+ ng-click="cancel()" aria-hidden="true">×</button>
+ <h4 class="modal-title">[% l('Overlay record?') %]</h4>
</div>
-</form>
+ <div class="modal-body">
+ <div class="row">
+ <div class="col-xs-6">
+ <div>[% l('Replace TCN [_1] ...', '{{overlay_target}}') %]</div>
+ <eg-record-html record-id="overlay_target" />
+ </div>
+ <div class="col-xs-6">
+ <div>[% l('With this?') %]
+ <button class="btn btn-default" ng-click="editOverlayRecord()">
+ [% l('Edit') %]
+ </button>
+ </div>
+ <eg-record-html marc-xml="{{args.marc_xml}}" />
+ </div>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <input type="submit" ng-click="ok(args)"
+ class="btn btn-primary" value="[% l('Overlay') %]"/>
+ <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
+ </div>
+</div>
egZ3950TargetSvc.loadTargets();
egZ3950TargetSvc.loadActiveSearchFields();
+ $scope.field_strip_groups = [];
+ egCore.startup.go().then(function() {
+ // and list of field strip groups; need to ensure
+ // that enough of the startup has happened so that
+ // we have the user WS
+ egCore.pcrud.search('vibtg',
+ {
+ always_apply : 'f',
+ owner : {
+ 'in' : {
+ select : {
+ aou : [{
+ column : 'id',
+ transform : 'actor.org_unit_ancestors',
+ result_field : 'id'
+ }]
+ },
+ from : 'aou',
+ where : {
+ id : egCore.auth.user().ws_ou()
+ }
+ }
+ }
+ },
+ { order_by : { vibtq : ['label'] } }
+ ).then(null, null, function(strip_group) {
+ strip_group.selected = false;
+ $scope.field_strip_groups.push(strip_group);
+ });
+ });
+
+ $scope.total_hits = 0;
+
var provider = egGridDataProvider.instance({});
provider.get = function(offset, count) {
query['offset'] = offset;
var resultIndex = offset;
+ $scope.total_hits = 0;
+ $scope.searchInProgress = true;
egCore.net.request(
'open-ils.search',
method,
egCore.auth.token(),
query
).then(
- function() { deferred.resolve() },
+ function() { $scope.searchInProgress = false; deferred.resolve() },
null, // onerror
function(result) {
+ // FIXME when the search offset is > 0, the
+ // total hits count can be wrong if one of the
+ // Z39.50 targets has fewer than $offset hits; in that
+ // case, result.count is not supplied.
+ $scope.total_hits += (result.count || 0);
for (var i in result.records) {
result.records[i].mvr['service'] = result.service;
result.records[i].mvr['index'] = resultIndex++;
return false;
}
+ $scope.selectFieldStripGroups = function() {
+ var groups = [];
+ angular.forEach($scope.field_strip_groups, function(grp, idx) {
+ if (grp.selected) {
+ groups.push(grp.id());
+ }
+ });
+ return groups;
+ };
$scope.import = function() {
var deferred = $q.defer();
var items = $scope.gridControls.selectedItems();
'open-ils.cat',
'open-ils.cat.biblio.record.xml.import',
egCore.auth.token(),
- items[0]['marcxml']
- // FIXME and more
+ items[0]['marcxml'],
+ null, // FIXME bib source
+ null,
+ null,
+ $scope.selectFieldStripGroups()
).then(
function() { deferred.resolve() },
null, // onerror
$scope.overlay_record = function() {
var items = $scope.gridControls.selectedItems();
var overlay_target = $scope.local_overlay_target;
+ var args = {
+ 'marc_xml' : items[0]['marcxml']
+ };
$modal.open({
templateUrl: './cat/z3950/t_overlay',
size: 'lg',
['$scope', '$modalInstance', function($scope, $modalInstance) {
$scope.focusMe = true;
$scope.overlay_target = overlay_target;
- $scope.marc_xml = items[0]['marcxml'];
- $scope.ok = function(args) { $modalInstance.close(args) }
- $scope.cancel = function () { $modalInstance.dismiss() }
+ $scope.args = args;
+ $scope.ok = function(args) { $modalInstance.close(args) };
+ $scope.cancel = function () { $modalInstance.dismiss() };
+ $scope.editOverlayRecord = function() {
+ $modal.open({
+ templateUrl: './cat/z3950/t_edit_overlay_record',
+ size: 'lg',
+ controller:
+ ['$scope', '$modalInstance', function($scope, $modalInstance) {
+ $scope.focusMe = true;
+ $scope.record_id = 0;
+ $scope.dirty_flag = false;
+ $scope.args = args;
+ $scope.ok = function(args) { $modalInstance.close(args) }
+ $scope.cancel = function () { $modalInstance.dismiss() }
+ }]
+ }).result.then(function (args) {
+ if (!args || !args.name) return;
+ });
+ };
}]
}).result.then(function (args) {
egCore.net.request(
'open-ils.cat.biblio.record.marc.replace',
egCore.auth.token(),
overlay_target,
- items[0]['marcxml']
- // FIXME and more
+ args.marc_xml,
+ null, // FIXME bib source
+ null,
+ $scope.selectFieldStripGroups()
).then(
function(result) {
console.debug('overlay complete');