Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F103590762
almaviewit.component.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Mar 3, 05:19
Size
5 KB
Mime Type
text/plain
Expires
Wed, Mar 5, 05:19 (1 d, 14 h)
Engine
blob
Format
Raw Data
Handle
24620331
Attached To
rPRIMOIII Primo_3_package
almaviewit.component.js
View Options
"use strict";
/*
OBJECTIF: Ajouter un lien pour rapporter les problèmes d'accès aux
ressources électroniques. Un message d'avertissement s'affiche quand la
la personne n'est pas sur le réseau EPFL
*/
module.exports = {
bindings: {parentCtrl: '<'},
controllerAs: 'ctrl',
controller: ['$filter', 'userService', function($filter, userService) {
var vm = this;
vm.get_txt = function() {
return $filter('customTranslate')('vpnMSG');
}
vm.feedbackLink = '';
vm.is_epfl_IP = false;
vm.no_report_link = false;
// not for open access
if (vm.parentCtrl.item.pnx.addata.openaccess && vm.parentCtrl.item.pnx.addata.openaccess[0] === 'true') {
vm.no_report_link = true;
}
// not for cdi open access
if (vm.parentCtrl.item.pnx.addata.oa && vm.parentCtrl.item.pnx.addata.oa[0] === 'free_for_read') {
vm.no_report_link = true;
}
if (!vm.no_report_link){
/* Obtient l'adresse ip depuis un service se trouvant dans le
module \js\slsp\epfl_custom_slsp.js */
var userIP = userService.getIP();
// console.log(userIP);
// Vérification du range EPFL
if (userIP) {
const regex = /128\.17([89])\.(\d{1,3})\./;
const found = userIP.match(regex);
if (found && (found[1] == '8' || parseInt(found[2])>=128)) {
vm.is_epfl_IP = true;
}
}
// Récupération des métadonnées de la ressource
var mmsId = vm.parentCtrl.item.pnx.control.recordid[0];
var title = '';
if (vm.parentCtrl.item.pnx.display.title && vm.parentCtrl.item.pnx.display.title.length > 0) {
title = vm.parentCtrl.item.pnx.display.title[0];
}
var creationdate = '';
if (vm.parentCtrl.item.pnx.display.creationdate && vm.parentCtrl.item.pnx.display.creationdate.length > 0) {
creationdate = vm.parentCtrl.item.pnx.display.creationdate[0];
}
var creator = '';
if (vm.parentCtrl.item.pnx.display.creator && vm.parentCtrl.item.pnx.display.creator.length > 0) {
creator = vm.parentCtrl.item.pnx.display.creator.join(', ');
}
var type = '';
if (vm.parentCtrl.item.pnx.display.type && vm.parentCtrl.item.pnx.display.type.length > 0) {
type = vm.parentCtrl.item.pnx.display.type[0];
}
var identifier = '';
if (vm.parentCtrl.item.pnx.display.identifier && vm.parentCtrl.item.pnx.display.identifier.length > 0) {
var ident = vm.parentCtrl.item.pnx.display.identifier[0];
if (ident.indexOf('<b>ISBN') > -1) {
identifier = vm.parentCtrl.item.pnx.display.identifier.join(', ').replace(/<\/b>/g, '').replace(/<b>/g, '');
} else if (ident.indexOf('<b>ISSN') > -1) {
identifier = vm.parentCtrl.item.pnx.display.identifier.join(', ').replace(/<\/b>/g, '').replace(/<b>/g, '');
} else if (ident.indexOf('ISBN') > -1) {
identifier = 'ISBN: ' + ident.substring(ident.indexOf('$$V') + 3);
} else if (ident.indexOf('ISSN') > -1) {
identifier = 'ISSN: ' + ident.substring(ident.indexOf('$$V') + 3);
}
}
var userAgent = navigator.userAgent;
// Création de l'objet du message
var subject = 'Access problem ' + mmsId + ' - "' + title + '"';
// Création du corps du message
var body = $filter('customTranslate')('feedbackLinkMSG') + '\n\n' + '****\nTitle: ' + title + '\nAuthor: ' + creator + '\nYear: ' + creationdate + '\nType: ' + type + '\nDocId: ' + mmsId + '\nIdentifier: ' + identifier + '\nUser_agent: ' + userAgent + '\nUserIP: ' + userIP + '\nRange EPFL: ' + vm.is_epfl_IP + '\n****';
vm.feedbackLink = 'mailto:edoc@epfl.ch' + '?subject=' + encodeURIComponent(subject) + '&body=' + encodeURIComponent(body) + '&Content-Type=text/html';
}
}],
template: `<div class="bar alert-bar" ng-if="ctrl.no_report_link==false && ctrl.is_epfl_IP==false">
<div ng-bind-html="ctrl.get_txt()"></div><md-icon ng-if="::($ctrl.iconDefinition && !$ctrl.isCustom && !$ctrl.isEmailMode())" md-svg-icon="primo-ui:open-in-new" role="presentation" class="md-primoExplore-theme"></md-icon
<div class="feedbacklink"> <a href="{{ ::ctrl.feedbackLink }}"><md-icon md-svg-icon="primo-ui:envelope-outline" role="presentation" class="md-primoExplore-theme"></md-icon> {{ 'feedbackLink' | customTranslate }}</a></div>
</div>
<div class="feedbacklink" ng-if="ctrl.no_report_link==false && ctrl.is_epfl_IP==true"> <a href="{{ ::ctrl.feedbackLink }}"><md-icon md-svg-icon="primo-ui:envelope-outline" role="presentation" class="md-primoExplore-theme"></md-icon> {{ 'feedbackLink' | customTranslate }}</a></div>`}
Event Timeline
Log In to Comment