Skip to content

Commit 14c7cd9

Browse files
committed
#779 its now possible to activate the data aggreements by public data
1 parent f45c188 commit 14c7cd9

File tree

4 files changed

+87
-8
lines changed

4 files changed

+87
-8
lines changed

Console/BExIS.Web.Shell/Areas/DDM/BExIS.Modules.Ddm.UI.Svelte/src/routes/search/+page.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616
contentLayoutType={pageContentLayoutType.full}
1717
{links}
1818
>
19+
<h1>eric is cool</h1>
1920
<Search {controller} />
2021
</Page>

Console/BExIS.Web.Shell/Areas/DDM/BExIS.Modules.Ddm.UI/Controllers/DataController.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ public ActionResult ShowData(long id, int version = 0, bool asPartial = false, s
171171
ViewData["use_minor"] = moduleSettings.GetValueByKey("use_minor");
172172
ViewData["check_public_metadata"] = moduleSettings.GetValueByKey("check_public_metadata");
173173
ViewData["has_data"] = false;
174+
ViewData["data_aggreement"] = moduleSettings.GetValueByKey("data_aggreement");
174175
Session["Filter"] = null;
175176

176177
Dataset researcobject = dm.GetDataset(id);

Console/BExIS.Web.Shell/Areas/DDM/BExIS.Modules.Ddm.UI/Ddm.Settings.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,18 @@
4545
"type": "Boolean",
4646
"description": "If set to true, the minor version tag can be assigned to dataset versions to display changes in more detail."
4747
},
48+
{
49+
"key": "data_aggreement",
50+
"title": "Data Aggreement by download",
51+
"value": "none",
52+
"description": "Set up if user need to aggree the data aggreements before download and where the aggreement is writen.",
53+
"type": "String",
54+
"options": [
55+
"none",
56+
"data policy",
57+
"terms and conditions"
58+
]
59+
},
4860
{
4961
"key": "citationSettings",
5062
"title": "settings for citations",
@@ -56,7 +68,7 @@
5668
"numberOfAuthors": 0,
5769
"showCitation": true,
5870
"defaultViewCitationFormat": "Text",
59-
"viewCitationFormats": ["Text", "APA"],
71+
"viewCitationFormats": [ "Text", "APA" ],
6072
"downloadCitationFormats": [ "Text", "APA", "RIS", "BibTex" ]
6173
},
6274
"description": "..."

Console/BExIS.Web.Shell/Areas/DDM/BExIS.Modules.Ddm.UI/Views/Data/ShowData.cshtml

Lines changed: 72 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
string bioSchemaInfos = "";
1111
long total = 0;
1212
bool has_data = false;
13+
string data_aggreement = "none";
14+
bool aggrreement_checked = true;
1315

1416
if (ViewData["TabIndex"] != null)
1517
{
@@ -41,6 +43,14 @@
4143
has_data = (bool)ViewData["has_data"];
4244
}
4345

46+
if (ViewData["data_aggreement"] != null && String.IsNullOrEmpty(User.Identity.Name))
47+
{
48+
data_aggreement = (string)ViewData["data_aggreement"];
49+
if (data_aggreement != "none") {
50+
aggrreement_checked = false;
51+
}
52+
}
53+
4454
var show_tabs = new Dictionary<string, string>();
4555
bool check_public_metadata = false;
4656

@@ -234,10 +244,32 @@
234244
@{Html.RenderAction("GetCitationOrTitle", "Data", new { datasetVersionId = Model.VersionId });}
235245
</div>
236246

237-
<div class="datasetview_header-toggle">
238-
247+
<div class="datasetview_header-toggle flex">
248+
239249
@if (Model.DownloadAccess)
240250
{
251+
/* data aggreement state: none, data policy, terms and conditions**/
252+
253+
if (data_aggreement.Equals("data policy"))
254+
{
255+
<div class="data-aggreement">
256+
@Html.CheckBox("data_policy", false, new { @id = "data-policy" })
257+
<b>I accept the public regulations from the
258+
<a href="/footer/policy" target="_blank">privacy policy</a>.</b>
259+
</div>
260+
}
261+
else if (data_aggreement.Equals("terms and conditions"))
262+
{
263+
<div class="data-aggreement">
264+
@Html.CheckBox("terms_and_conditions", false, new { @id = "terms-and-conditions" })
265+
<b>
266+
I accept the public regulations from the
267+
<a href="/footer/termsandconditions" target="_blank">terms and conditions</a>.
268+
</b>
269+
</div>
270+
}
271+
272+
241273

242274
if (Model.DataStructureType.ToLower().Equals("structured"))
243275
{
@@ -279,9 +311,9 @@
279311
{
280312
<button id="sendRequestBt" class="bx-button small function bx-disabled" title="Send request to the owner of the dataset for the rights to see and download the primary data." disabled="disabled">Request Pending</button>
281313
}
282-
else if(!has_data)
314+
else if (!has_data)
283315
{
284-
<!-- if dataset has no data-->
316+
<!-- if dataset has no data-->
285317

286318
}
287319
else
@@ -445,7 +477,7 @@
445477
</div>
446478
}
447479
</div>
448-
<script type="text/javascript">
480+
<script type="text/javascript">
449481
450482
function grid_subjects_onDataBound() {
451483
addTooltips();
@@ -480,8 +512,34 @@
480512
481513
$("#preloaderContainer").removePreloader();
482514
515+
console.log("aggrreement_checked",'@aggrreement_checked')
516+
setDownloadBt('@aggrreement_checked');
517+
483518
});
484519
520+
function setDownloadBt(aggreed) {
521+
console.log("aggreed",aggreed)
522+
523+
if (aggreed == 'true' || aggreed == 'True' || aggreed == true) {
524+
$("#dropdownMenu1").removeAttr("disabled");
525+
$("#dropdownMenu1").removeClass("bx-disabled")
526+
}
527+
else
528+
{
529+
$("#dropdownMenu1").attr("disabled", "disabled");
530+
$("#dropdownMenu1").addClass("bx-disabled")
531+
}
532+
}
533+
534+
$("#data-policy").change(function () {
535+
var isChecked = $(this).is(":checked");
536+
setDownloadBt(isChecked);
537+
});
538+
539+
$("#terms-and-conditions").change(function () {
540+
var isChecked = $(this).is(":checked");
541+
setDownloadBt(isChecked);
542+
});
485543
486544
function loadTags() {
487545
$.ajax({
@@ -632,7 +690,7 @@
632690
window.location.href = "/dcm/[email protected]";
633691
634692
}
635-
</script>
693+
</script>
636694

637695
}
638696
else if (Model.IsPublic == false)
@@ -673,14 +731,17 @@ else
673731
float: right;
674732
}
675733
734+
676735
.tab-pane {
677736
min-height: 70px;
678737
}
679738
680-
.flex{
739+
.flex {
681740
display: flex;
682741
flex-wrap: wrap;
683742
justify-content: space-between;
743+
gap: 5px;
744+
align-content: center;
684745
}
685746
686747
.grow {
@@ -703,4 +764,8 @@ else
703764
padding-left:2px;
704765
}
705766
767+
.data-aggreement {
768+
width:300px;
769+
}
770+
706771
</style>

0 commit comments

Comments
 (0)