Mercurial > hg > orthanc
comparison OrthancServer/OrthancExplorer/explorer.js @ 4853:b3d0a3a4d890
Added links to download attachments from the Orthanc Explorer
author | Alain Mazy <am@osimis.io> |
---|---|
date | Thu, 16 Dec 2021 14:48:46 +0100 |
parents | 7053502fbf97 |
children | 3e9a76464e8a 43e613a7756b |
comparison
equal
deleted
inserted
replaced
4851:abb0e1c2b88d | 4853:b3d0a3a4d890 |
---|---|
699 { | 699 { |
700 $(buttonSelector).closest('li').hide(); | 700 $(buttonSelector).closest('li').hide(); |
701 } | 701 } |
702 } | 702 } |
703 | 703 |
704 | 704 function SetupAttachments(accessSelector, liClass, resourceId, resourceType) { |
705 GetResource('/' + resourceType + '/' + resourceId + '/attachments?full', function(attachments) { | |
706 target = $(accessSelector); | |
707 $('.' + liClass).remove(); | |
708 for (var key in attachments) { | |
709 if (attachments[key] >= 1024) { | |
710 target.append('<li data-icon="gear" class="' + liClass + '"><a href="#" id="' + attachments[key] + '">Download ' + key + '</a></li>') | |
711 } | |
712 } | |
713 target.listview('refresh'); | |
714 }); | |
715 | |
716 } | |
705 | 717 |
706 function RefreshPatient() | 718 function RefreshPatient() |
707 { | 719 { |
708 var pageData, target, v; | 720 var pageData, target, v; |
709 | 721 |
736 target.append(FormatStudy(studies[i], '#study?uuid=' + studies[i].ID)); | 748 target.append(FormatStudy(studies[i], '#study?uuid=' + studies[i].ID)); |
737 } | 749 } |
738 | 750 |
739 SetupAnonymizedOrModifiedFrom('#patient-anonymized-from', patient, 'patient', ANONYMIZED_FROM); | 751 SetupAnonymizedOrModifiedFrom('#patient-anonymized-from', patient, 'patient', ANONYMIZED_FROM); |
740 SetupAnonymizedOrModifiedFrom('#patient-modified-from', patient, 'patient', MODIFIED_FROM); | 752 SetupAnonymizedOrModifiedFrom('#patient-modified-from', patient, 'patient', MODIFIED_FROM); |
753 SetupAttachments('#patient-access', 'patient-attachment', pageData.uuid, 'patients'); | |
741 | 754 |
742 target.listview('refresh'); | 755 target.listview('refresh'); |
743 | 756 |
744 // Check whether this patient is protected | 757 // Check whether this patient is protected |
745 $.ajax({ | 758 $.ajax({ |
783 .append(FormatStudy(study)) | 796 .append(FormatStudy(study)) |
784 .listview('refresh'); | 797 .listview('refresh'); |
785 | 798 |
786 SetupAnonymizedOrModifiedFrom('#study-anonymized-from', study, 'study', ANONYMIZED_FROM); | 799 SetupAnonymizedOrModifiedFrom('#study-anonymized-from', study, 'study', ANONYMIZED_FROM); |
787 SetupAnonymizedOrModifiedFrom('#study-modified-from', study, 'study', MODIFIED_FROM); | 800 SetupAnonymizedOrModifiedFrom('#study-modified-from', study, 'study', MODIFIED_FROM); |
801 SetupAttachments('#study-access', 'study-attachment', pageData.uuid, 'studies'); | |
788 | 802 |
789 target = $('#list-series'); | 803 target = $('#list-series'); |
790 $('li', target).remove(); | 804 $('li', target).remove(); |
791 for (var i = 0; i < series.length; i++) { | 805 for (var i = 0; i < series.length; i++) { |
792 if (i == 0 || | 806 if (i == 0 || |
800 | 814 |
801 target.append(FormatSeries(series[i], '#series?uuid=' + series[i].ID)); | 815 target.append(FormatSeries(series[i], '#series?uuid=' + series[i].ID)); |
802 } | 816 } |
803 target.listview('refresh'); | 817 target.listview('refresh'); |
804 | 818 |
819 | |
805 currentPage = 'study'; | 820 currentPage = 'study'; |
806 currentUuid = pageData.uuid; | 821 currentUuid = pageData.uuid; |
807 }); | 822 }); |
808 }); | 823 }); |
809 }); | 824 }); |
837 .append(FormatSeries(series)) | 852 .append(FormatSeries(series)) |
838 .listview('refresh'); | 853 .listview('refresh'); |
839 | 854 |
840 SetupAnonymizedOrModifiedFrom('#series-anonymized-from', series, 'series', ANONYMIZED_FROM); | 855 SetupAnonymizedOrModifiedFrom('#series-anonymized-from', series, 'series', ANONYMIZED_FROM); |
841 SetupAnonymizedOrModifiedFrom('#series-modified-from', series, 'series', MODIFIED_FROM); | 856 SetupAnonymizedOrModifiedFrom('#series-modified-from', series, 'series', MODIFIED_FROM); |
857 SetupAttachments('#series-access', 'series-attachment', pageData.uuid, 'series'); | |
842 | 858 |
843 target = $('#list-instances'); | 859 target = $('#list-instances'); |
844 $('li', target).remove(); | 860 $('li', target).remove(); |
845 for (var i = 0; i < instances.length; i++) { | 861 for (var i = 0; i < instances.length; i++) { |
846 target.append(FormatInstance(instances[i], '#instance?uuid=' + instances[i].ID)); | 862 target.append(FormatInstance(instances[i], '#instance?uuid=' + instances[i].ID)); |
975 } | 991 } |
976 }); | 992 }); |
977 | 993 |
978 SetupAnonymizedOrModifiedFrom('#instance-anonymized-from', instance, 'instance', ANONYMIZED_FROM); | 994 SetupAnonymizedOrModifiedFrom('#instance-anonymized-from', instance, 'instance', ANONYMIZED_FROM); |
979 SetupAnonymizedOrModifiedFrom('#instance-modified-from', instance, 'instance', MODIFIED_FROM); | 995 SetupAnonymizedOrModifiedFrom('#instance-modified-from', instance, 'instance', MODIFIED_FROM); |
996 | |
997 SetupAttachments('#instance-access', 'instance-attachment', pageData.uuid, 'instances'); | |
980 | 998 |
981 currentPage = 'instance'; | 999 currentPage = 'instance'; |
982 currentUuid = pageData.uuid; | 1000 currentUuid = pageData.uuid; |
983 }); | 1001 }); |
984 }); | 1002 }); |
1345 $('#series-media').live('click', function(e) { | 1363 $('#series-media').live('click', function(e) { |
1346 e.preventDefault(); //stop the browser from following | 1364 e.preventDefault(); //stop the browser from following |
1347 window.location.href = '../series/' + $.mobile.pageData.uuid + '/media'; | 1365 window.location.href = '../series/' + $.mobile.pageData.uuid + '/media'; |
1348 }); | 1366 }); |
1349 | 1367 |
1350 | 1368 $('.patient-attachment').live('click', function(e) { |
1369 e.preventDefault(); //stop the browser from following | |
1370 window.location.href = '../patients/' + $.mobile.pageData.uuid + '/attachments/' + e.target.id + '/data'; | |
1371 }); | |
1372 | |
1373 $('.study-attachment').live('click', function(e) { | |
1374 e.preventDefault(); //stop the browser from following | |
1375 window.location.href = '../studies/' + $.mobile.pageData.uuid + '/attachments/' + e.target.id + '/data'; | |
1376 }); | |
1377 | |
1378 $('.series-attachment').live('click', function(e) { | |
1379 e.preventDefault(); //stop the browser from following | |
1380 window.location.href = '../series/' + $.mobile.pageData.uuid + '/attachments/' + e.target.id + '/data'; | |
1381 }); | |
1382 | |
1383 $('.instance-attachment').live('click', function(e) { | |
1384 e.preventDefault(); //stop the browser from following | |
1385 window.location.href = '../instances/' + $.mobile.pageData.uuid + '/attachments/' + e.target.id + '/data'; | |
1386 }); | |
1351 | 1387 |
1352 $('#protection').live('change', function(e) { | 1388 $('#protection').live('change', function(e) { |
1353 var isProtected = e.target.value == "on"; | 1389 var isProtected = e.target.value == "on"; |
1354 $.ajax({ | 1390 $.ajax({ |
1355 url: '../patients/' + $.mobile.pageData.uuid + '/protected', | 1391 url: '../patients/' + $.mobile.pageData.uuid + '/protected', |