Mercurial > hg > orthanc
comparison OrthancExplorer/explorer.js @ 1556:b8dc2f855a83
Preview of PDF files encapsulated in DICOM from Orthanc Explorer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 20 Aug 2015 17:05:05 +0200 |
parents | c90a4a42a3f2 |
children | cd9d99fe32e9 |
comparison
equal
deleted
inserted
replaced
1555:d6a93e12b1c1 | 1556:b8dc2f855a83 |
---|---|
28 return args[number]; | 28 return args[number]; |
29 }); | 29 }); |
30 }; | 30 }; |
31 | 31 |
32 | 32 |
33 function Refresh() | |
34 { | |
35 if (currentPage == 'patient') | |
36 RefreshPatient(); | |
37 else if (currentPage == 'study') | |
38 RefreshStudy(); | |
39 else if (currentPage == 'series') | |
40 RefreshSeries(); | |
41 else if (currentPage == 'instance') | |
42 RefreshInstance(); | |
43 } | |
44 | |
45 | |
33 $(document).ready(function() { | 46 $(document).ready(function() { |
34 var $tree = $('#dicom-tree'); | 47 var $tree = $('#dicom-tree'); |
35 $tree.tree({ | 48 $tree.tree({ |
36 autoEscape: false | 49 autoEscape: false |
37 }); | 50 }); |
43 $tree.tree('closeNode', event.node, true); | 56 $tree.tree('closeNode', event.node, true); |
44 else | 57 else |
45 $tree.tree('openNode', event.node, true); | 58 $tree.tree('openNode', event.node, true); |
46 } | 59 } |
47 ); | 60 ); |
61 | |
62 currentPage = $.mobile.pageData.active; | |
63 currentUuid = $.mobile.pageData.uuid; | |
64 if (currentPage.length > 0 && | |
65 currentUuid.length > 0) | |
66 { | |
67 Refresh(); | |
68 } | |
48 }); | 69 }); |
49 | 70 |
50 | 71 |
51 function SplitLongUid(s) | 72 function SplitLongUid(s) |
52 { | 73 { |
584 $(window).hashchange(function(e, data) { | 605 $(window).hashchange(function(e, data) { |
585 // This fixes the navigation with the back button and with the anonymization | 606 // This fixes the navigation with the back button and with the anonymization |
586 if ('uuid' in $.mobile.pageData && | 607 if ('uuid' in $.mobile.pageData && |
587 currentPage == $.mobile.pageData.active && | 608 currentPage == $.mobile.pageData.active && |
588 currentUuid != $.mobile.pageData.uuid) { | 609 currentUuid != $.mobile.pageData.uuid) { |
589 if (currentPage == 'patient') | 610 Refresh(); |
590 RefreshPatient(); | |
591 else if (currentPage == 'study') | |
592 RefreshStudy(); | |
593 else if (currentPage == 'series') | |
594 RefreshSeries(); | |
595 else if (currentPage == 'instance') | |
596 RefreshInstance(); | |
597 } | 611 } |
598 }); | 612 }); |
599 }); | 613 }); |
600 | 614 |
601 | 615 |
684 | 698 |
685 | 699 |
686 | 700 |
687 $('#instance-preview').live('click', function(e) { | 701 $('#instance-preview').live('click', function(e) { |
688 if ($.mobile.pageData) { | 702 if ($.mobile.pageData) { |
689 GetResource('/instances/' + $.mobile.pageData.uuid + '/frames', function(frames) { | 703 var pdf = '../instances/' + $.mobile.pageData.uuid + '/pdf'; |
690 if (frames.length == 1) | 704 $.ajax({ |
691 { | 705 url: pdf, |
692 // Viewing a single-frame image | 706 cache: false, |
693 jQuery.slimbox('../instances/' + $.mobile.pageData.uuid + '/preview', '', { | 707 success: function(s) { |
694 overlayFadeDuration : 1, | 708 window.location.assign(pdf); |
695 resizeDuration : 1, | 709 }, |
696 imageFadeDuration : 1 | 710 error: function() { |
711 GetResource('/instances/' + $.mobile.pageData.uuid + '/frames', function(frames) { | |
712 if (frames.length == 1) | |
713 { | |
714 // Viewing a single-frame image | |
715 jQuery.slimbox('../instances/' + $.mobile.pageData.uuid + '/preview', '', { | |
716 overlayFadeDuration : 1, | |
717 resizeDuration : 1, | |
718 imageFadeDuration : 1 | |
719 }); | |
720 } | |
721 else | |
722 { | |
723 // Viewing a multi-frame image | |
724 | |
725 var images = []; | |
726 for (var i = 0; i < frames.length; i++) { | |
727 images.push([ '../instances/' + $.mobile.pageData.uuid + '/frames/' + i + '/preview' ]); | |
728 } | |
729 | |
730 jQuery.slimbox(images, 0, { | |
731 overlayFadeDuration : 1, | |
732 resizeDuration : 1, | |
733 imageFadeDuration : 1, | |
734 loop : true | |
735 }); | |
736 } | |
697 }); | 737 }); |
698 } | 738 } |
699 else | |
700 { | |
701 // Viewing a multi-frame image | |
702 | |
703 var images = []; | |
704 for (var i = 0; i < frames.length; i++) { | |
705 images.push([ '../instances/' + $.mobile.pageData.uuid + '/frames/' + i + '/preview' ]); | |
706 } | |
707 | |
708 jQuery.slimbox(images, 0, { | |
709 overlayFadeDuration : 1, | |
710 resizeDuration : 1, | |
711 imageFadeDuration : 1, | |
712 loop : true | |
713 }); | |
714 } | |
715 }); | 739 }); |
716 | |
717 } | 740 } |
718 }); | 741 }); |
719 | 742 |
720 | 743 |
721 | 744 |