<script>
angular.module('egCoreMod').run(['egStrings', function(s) {
+ s.TCN_EXISTS = "[% l('A record already exists with the requested TCN value') %]";
+ s.TCN_EXISTS_ERR = "[% l('An unexpected error occurred') %]";
s.IMPORTED_RECORD_FROM_Z3950 = "[% l('Imported record') %]";
s.IMPORTED_RECORD_FROM_Z3950_AS_ID = "[% l('Record imported as ID [_1]', '{{id}}') %]";
s.GO_TO_RECORD = "[% l('Go to record') %]";
*/
.controller('Z3950SearchCtrl',
['$scope','$q','$location','$timeout','$window','egCore','egGridDataProvider','egZ3950TargetSvc','$uibModal',
- 'egConfirmDialog',
+ 'egConfirmDialog','egAlertDialog',
function($scope , $q , $location , $timeout , $window, egCore , egGridDataProvider, egZ3950TargetSvc, $uibModal,
- egConfirmDialog) {
+ egConfirmDialog, egAlertDialog) {
// get list of targets
egZ3950TargetSvc.loadTargets();
function() { deferred.resolve() },
null, // onerror
function(result) {
+ var evt = egCore.evt.parse(result);
+ if (evt) {
+ if (evt.textcode == 'TCN_EXISTS') {
+ egAlertDialog.open(
+ egCore.strings.TCN_EXISTS
+ );
+ } else {
+ // we shouldn't get here
+ egAlertDialog.open(egCore.strings.TCN_EXISTS_ERR);
+ }
+ } else {
egConfirmDialog.open(
egCore.strings.IMPORTED_RECORD_FROM_Z3950,
egCore.strings.IMPORTED_RECORD_FROM_Z3950_AS_ID,
// for some reason
$window.location.href = egCore.env.basePath + 'cat/catalog/record/' + result.id();
});
+ }
}
);