Skip to content

Commit

Permalink
Ref github issue #33
Browse files Browse the repository at this point in the history
  • Loading branch information
mdehsjmt committed Dec 17, 2018
1 parent 43e92c9 commit 6c76421
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
// Copyright (c) North West e-Health 2011. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Web;
using System.Web.Mvc;
using Extant.Data;
using Extant.Data.Entities;

namespace Extant.Web.Infrastructure
Expand All @@ -21,6 +22,7 @@ public object BindModel(ControllerContext controllerContext, ModelBindingContext
theFile.InputStream.Read(fileUpload.FileData, 0, theFile.ContentLength);
fileUpload.FileName = theFile.FileName;
fileUpload.MimeType = theFile.ContentType;
fileUpload.IsApproved = HttpContext.Current.User.IsInRole(Constants.AdministratorRole);
return fileUpload;
}
return null;
Expand Down
2 changes: 2 additions & 0 deletions source/Extant/Extant.Web/Models/FileUploadModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ public class FileUploadModel
public string FileSize { get; set; }

public string MimeType { get; set; }

public bool IsApproved { get; set; }
}
}
12 changes: 7 additions & 5 deletions source/Extant/Extant.Web/Views/Study/Index.aspx
Original file line number Diff line number Diff line change
Expand Up @@ -129,22 +129,22 @@
<div class="fieldset">
<span class="legend">Files</span>
<p><strong>Patient Information Leaflet: </strong>
<% if (null != Model.PatientInformationLeaflet){ %>
<% if (null != Model.PatientInformationLeaflet && Model.PatientInformationLeaflet.IsApproved){ %>
<a href="/Study/File/<%:Model.PatientInformationLeaflet.Id %>">Download</a> (<%:Model.PatientInformationLeaflet.FileSize %>)
<% } else { %>
N/A
<% } %>
</p>
<p><strong>Consent Form: </strong>
<% if (null != Model.ConsentForm){ %>
<% if (null != Model.ConsentForm && Model.ConsentForm.IsApproved){ %>
<a href="/Study/File/<%:Model.ConsentForm.Id %>">Download</a> (<%:Model.ConsentForm.FileSize %>)
<% } else {%>
N/A
<% } %>
</p>
<p><strong>Has Data Access Policy: </strong><%:Model.HasDataAccessPolicy %></p>
<p><strong>Data Access Policy: </strong>
<% if (null != Model.DataAccessPolicy){ %>
<% if (null != Model.DataAccessPolicy && Model.DataAccessPolicy.IsApproved){ %>
<a href="/Study/File/<%:Model.DataAccessPolicy.Id %>">Download</a> (<%:Model.DataAccessPolicy.FileSize%>)
<% } else {%>
N/A
Expand All @@ -156,11 +156,13 @@
%>
<p><strong>Additional Files</strong></p>
<%
foreach (var file in Model.AdditionalDocuments)
{
foreach (var file in Model.AdditionalDocuments)
{
if (file.File.IsApproved) {
%>
<p><%:file.Description %> (<%:file.DocumentType %>) - <a href="/Study/File/<%:file.File.Id %>">Download</a> (<%:file.File.FileSize%>)</p>
<%
}
}
}
%>
Expand Down

0 comments on commit 6c76421

Please sign in to comment.