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 {
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
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 {
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
445477 </div >
446478 }
447479</div >
448- <script type =" text/javascript" >
480+ <script type =" text/javascript" >
449481
450482 function grid_subjects_onDataBound () {
451483 addTooltips ();
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 ({
632690 window .location .href = " /dcm/[email protected] " ; 633691
634692 }
635- </script >
693+ </script >
636694
637695}
638696else 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 {
703764 padding-left :2px ;
704765 }
705766
767+ .data-aggreement {
768+ width :300px ;
769+ }
770+
706771 </style >
0 commit comments