Work on refactoring measurements out of Lesion Tracker package

- Removed AssociatedStudies Collection
- Measurement API is generated from configuration files
- Data exchange methods are defined in configuration
This commit is contained in:
Erik Ziegler committed 2016-11-15 08:21:46 +01:00
1 parent c511edd419
commit ab4d4c9008
537 files changed
+5122 -3545

No files matched your search

@@ -0,0 +1,8 @@
<template name="emailVerification">
<div id="emailVerification">
<div id="emailVerificationContent">
<h3>Verify Your Email Address</h3>
<p>We need to verify your email address. We've sent an email to <b>{{emailAddress}}</b> to verify your address. Please click the link in your email to continue.</p>
</div>
</div>
</template>
@@ -0,0 +1,5 @@
Template.emailVerification.helpers({
emailAddress: function() {
return Meteor.user().emails[0].address;
}
});
@@ -0,0 +1,15 @@
#emailVerification
#emailVerificationContent
position: absolute
top: 0
bottom: 0
left: 0
right: 0
margin: auto
width: 60%
height: 20%
z-index: 100
border-radius: 5px
padding: 10px 20px 10px 20px
background-color: rgba(255,255,255,1)
outline: none
@@ -0,0 +1,11 @@
Meteor.startup(function() {
// TODO: Configure some settings
HipaaAuditLog.configure({
classes: {
input: 'form-control',
select: 'form-control',
ribbon: ''
},
highlightColor: '#006289'
});
});
@@ -0,0 +1,2 @@
#hipaaLogPage
margin-top: 40px
@@ -0,0 +1,16 @@
<template name="lastLoginModal">
<div class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body" style="padding: 0;">
<div class="alert alert-info" style="margin: 0 auto;">
<a href="#" class="close" data-dismiss="modal">&times;</a>
{{#if lastLoginDate}}
<h5>You last logged in on <strong>{{lastLoginDate}}</strong></h5>
{{/if}}
</div>
</div>
</div>
</div>
</div>
</template>
@@ -0,0 +1,10 @@
<template name="timeoutCountdownDialog">
<div id="timeoutCountdownDialog">
<div class="dialogHeader">
<h5>Your session is about to expire.</h5>
</div>
<div class="dialogContent">
<p>You will be logged out in {{timeLeft}}.</p>
</div>
</div>
</template>
@@ -0,0 +1,39 @@
Template.timeoutCountdownDialog.helpers({
timeLeft: function() {
var timeLeft = Session.get('countdownDialogLeftTime');
var suffix = timeLeft > 1 ? 'seconds': 'second';
return timeLeft + suffix;
}
});
Template.timeoutCountdownDialog.onRendered(function() {
// Show countdown dialog
var timeoutCountdownInterval;
$(document).on('TriggerOpenTimeoutCountdownDialog', function(e, leftTime) {
// Show modal dialog
timeoutCountdownInterval = setInterval(function() {
// Set countdownDialogLeftTime session
Session.set('countdownDialogLeftTime', --leftTime);
var dialog = $('#timeoutCountdownDialog');
// Show dialog
dialog.css('display', 'block');
}, 1000);
});
$(document).on('TriggerCloseTimeoutCountdownDialog', function() {
var dialog = $('#timeoutCountdownDialog');
// Close the dialog
dialog.css('display', 'none');
if (timeoutCountdownInterval) {
clearInterval(timeoutCountdownInterval);
// Remove reviewer info for the user
Meteor.call('removeUserFromReviewers', Meteor.userId());
}
});
});
@@ -0,0 +1,15 @@
#timeoutCountdownDialog
display: none
position: absolute
top: 0
bottom: 0
left: 0
right: 0
margin: auto
width: 20%
height: 15%
z-index: 100
border-radius: 5px
padding: 10px 20px 10px 20px
background-color: rgba(255,255,255,1)
outline: none
@@ -0,0 +1,44 @@
<template name="userAccountMenu">
{{#if currentUser}}
<div id="userAccountMenu" class="dropdown">
<div class="dropdown-toggle noselect clearfix" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="userName pull-left m-r-1">{{name}} {{currentPath}}</span>
<div class="menuButton pull-right">
<i class="fa fa-cog"></i> <span class="caret-down"></span>
</div>
</div>
<ul class="dropdown-menu dropdown-menu-right">
{{#if showStudyListMenu}}
<li>
<a href="studylist" id="studylist">
<i class="fa fa-list-ul"></i> Study List
</a>
</li>
{{else}}
<li>
<a href="/audit" id="audit">
<i class="fa fa-list-ul"></i> View Audit Log
</a>
</li>
{{/if}}
<li role="separator" class="divider"></li>
<li>
<a id="serverInformation">
<i class="fa fa-server fa-lg"></i> Server Information
</a>
</li>
<li role="separator" class="divider"></li>
<li>
<a href="changePassword" id="changePassword">
<i class="fa fa-lock"></i> Change Password
</a>
</li>
<li>
<a id="logoutButton">
<i class="fa fa-power-off"></i> Logout
</a>
</li>
</ul>
</div>
{{/if}}
</template>
@@ -0,0 +1,122 @@
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import { Session } from 'meteor/session';
// Display the last login modal as default
Session.setDefault('displayLastLoginModal', true);
Template.userAccountMenu.helpers({
name: function() {
var nameSplit = Meteor.user().profile.fullName.split(' ');
var lastName = nameSplit[nameSplit.length - 1];
nameSplit[nameSplit.length - 1] = lastName.substr(0, 1) + '.';
return nameSplit.join(' ');
},
currentUser: function() {
var verifyEmail = Meteor.settings && Meteor.settings.public && Meteor.settings.public.verifyEmail || false;
if (!Meteor.user() || !Meteor.userId()) {
return;
}
if (!verifyEmail) {
return true;
}
if (!Meteor.user().emails) {
return true;
}
return !!Meteor.user().emails[0].verified;
}
});
Template.userAccountMenu.events({
'click #serverInformation': function() {
$('#serverInformationModal').modal('show');
},
'click #logoutButton': function() {
Meteor.logout(function() {
Router.go('/entrySignIn');
});
}
});
Template.userAccountMenu.onCreated(function userAccountMenuCreated() {
const instance = Template.instance();
// Create reactive last login date
instance.lastLoginDate = new ReactiveVar();
// We need oldUser to remove Reviewers if the user logged out
let oldUser;
// Get last login date
Meteor.call('getPriorLoginDate', function(error, lastLoginDate){
if (error) {
console.log(error);
return;
}
// Format the last login date
const formattedLastLoginDate = moment(lastLoginDate).format("MMMM Do YYYY, HH:mm:ss A");
instance.lastLoginDate.set(formattedLastLoginDate);
});
instance.autorun(function() {
const lastLoginDate = instance.lastLoginDate.get();
if (!lastLoginDate) {
return;
}
// Hook login/logout
var user = Meteor.user();
if (!user) {
// Display last login modal for the next login
Session.setPersistent('displayLastLoginModal', true);
if (oldUser) {
// Log Signout
// TODO: eventType for logout is not defined
// HipaaLogger.logEvent({
// eventType: 'logout',
// userId: oldUser._id,
// userName: oldUser.profile.fullName
// });
// Remove the user by oldUserId from Reviewers
Meteor.call('removeUserFromReviewers', oldUser._id);
}
return;
}
// Set oldUser
oldUser = user;
// Trigger last login date popup
if (!Session.get('displayLastLoginModal')) {
return;
}
// Displaye the modal
Modal.show('lastLoginModal', {
lastLoginDate: lastLoginDate
});
// Hide the modal after 5sec
Meteor.setTimeout(() => {
Modal.hide('lastLoginModal');
Session.setPersistent('displayLastLoginModal', false);
}, 5000);
// Log signin
HipaaLogger.logEvent({
eventType: 'init',
userId: user._id,
userName: user.profile.fullName
});
});
});
@@ -0,0 +1,32 @@
@import "{design}/app"
#userAccountMenu
padding: 4px 0
height: 100%
.dropdown-toggle
theme('color', '$defaultColor')
cursor: pointer
font-size: 13px
font-weight: 400
line-height: 18px
text-decoration: none
.menuButton
theme('border-left', 'solid 1px $defaultColor')
display: inline-block
height: 18px
padding: 0 8px
.fa
theme('color', '$defaultColor')
font-size: 17px
line-height: 18px
.caret-down
theme('color', '$uiLightGray')
margin: 0 4px 4px 2px
ul.dropdown-menu
li
cursor: pointer