comparison OrthancExplorer/explorer.js @ 83:a7bffca29031

relative paths
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 Sep 2012 12:06:30 +0200
parents 9eb40cad7935
children 11e48e70c039
comparison
equal deleted inserted replaced
82:9eb40cad7935 83:a7bffca29031
139 139
140 function GetSingleResource(type, uuid, callback) 140 function GetSingleResource(type, uuid, callback)
141 { 141 {
142 var resource = null; 142 var resource = null;
143 $.ajax({ 143 $.ajax({
144 url: '/' + type + '/' + uuid, 144 url: '../' + type + '/' + uuid,
145 dataType: 'json', 145 dataType: 'json',
146 async: false, 146 async: false,
147 success: function(s) { 147 success: function(s) {
148 callback(s); 148 callback(s);
149 } 149 }
154 function GetMultipleResources(type, uuids, callback) 154 function GetMultipleResources(type, uuids, callback)
155 { 155 {
156 if (uuids == null) 156 if (uuids == null)
157 { 157 {
158 $.ajax({ 158 $.ajax({
159 url: '/' + type, 159 url: '../' + type,
160 dataType: 'json', 160 dataType: 'json',
161 async: false, 161 async: false,
162 success: function(s) { 162 success: function(s) {
163 uuids = s; 163 uuids = s;
164 } 164 }
166 } 166 }
167 167
168 var resources = []; 168 var resources = [];
169 var ajaxRequests = uuids.map(function(uuid) { 169 var ajaxRequests = uuids.map(function(uuid) {
170 return $.ajax({ 170 return $.ajax({
171 url: '/' + type + '/' + uuid, 171 url: '../' + type + '/' + uuid,
172 dataType: 'json', 172 dataType: 'json',
173 async: true, 173 async: true,
174 success: function(s) { 174 success: function(s) {
175 resources.push(s); 175 resources.push(s);
176 } 176 }
506 .append('<li data-role="list-divider">Instance</li>') 506 .append('<li data-role="list-divider">Instance</li>')
507 .append(FormatInstance(instance)) 507 .append(FormatInstance(instance))
508 .listview('refresh'); 508 .listview('refresh');
509 509
510 $.ajax({ 510 $.ajax({
511 url: '/instances/' + instance.ID + '/tags', 511 url: '../instances/' + instance.ID + '/tags',
512 dataType: 'json', 512 dataType: 'json',
513 success: function(s) { 513 success: function(s) {
514 $('#dicom-tree').tree('loadData', ConvertForTree(s)); 514 $('#dicom-tree').tree('loadData', ConvertForTree(s));
515 } 515 }
516 }); 516 });
570 } 570 }
571 571
572 572
573 573
574 $('#instance-delete').live('click', function() { 574 $('#instance-delete').live('click', function() {
575 OpenDeleteResourceDialog('/instances/' + $.mobile.pageData.uuid, 575 OpenDeleteResourceDialog('../instances/' + $.mobile.pageData.uuid,
576 'Delete this instance?'); 576 'Delete this instance?');
577 }); 577 });
578 578
579 $('#study-delete').live('click', function() { 579 $('#study-delete').live('click', function() {
580 OpenDeleteResourceDialog('/studies/' + $.mobile.pageData.uuid, 580 OpenDeleteResourceDialog('../studies/' + $.mobile.pageData.uuid,
581 'Delete this study?'); 581 'Delete this study?');
582 }); 582 });
583 583
584 $('#series-delete').live('click', function() { 584 $('#series-delete').live('click', function() {
585 OpenDeleteResourceDialog('/series/' + $.mobile.pageData.uuid, 585 OpenDeleteResourceDialog('../series/' + $.mobile.pageData.uuid,
586 'Delete this series?'); 586 'Delete this series?');
587 }); 587 });
588 588
589 $('#patient-delete').live('click', function() { 589 $('#patient-delete').live('click', function() {
590 OpenDeleteResourceDialog('/patients/' + $.mobile.pageData.uuid, 590 OpenDeleteResourceDialog('../patients/' + $.mobile.pageData.uuid,
591 'Delete this patient?'); 591 'Delete this patient?');
592 }); 592 });
593 593
594 594
595 $('#instance-download-dicom').live('click', function(e) { 595 $('#instance-download-dicom').live('click', function(e) {
596 // http://stackoverflow.com/a/1296101 596 // http://stackoverflow.com/a/1296101
597 e.preventDefault(); //stop the browser from following 597 e.preventDefault(); //stop the browser from following
598 window.location.href = '/instances/' + $.mobile.pageData.uuid + '/file'; 598 window.location.href = '../instances/' + $.mobile.pageData.uuid + '/file';
599 }); 599 });
600 600
601 $('#instance-download-json').live('click', function(e) { 601 $('#instance-download-json').live('click', function(e) {
602 // http://stackoverflow.com/a/1296101 602 // http://stackoverflow.com/a/1296101
603 e.preventDefault(); //stop the browser from following 603 e.preventDefault(); //stop the browser from following
604 window.location.href = '/instances/' + $.mobile.pageData.uuid + '/tags'; 604 window.location.href = '../instances/' + $.mobile.pageData.uuid + '/tags';
605 }); 605 });
606 606
607 607
608 $('#instance-preview').live('click', function(e) { 608 $('#instance-preview').live('click', function(e) {
609 if ($.mobile.pageData) { 609 if ($.mobile.pageData) {
610 GetSingleResource('instances', $.mobile.pageData.uuid + '/frames', function(frames) { 610 GetSingleResource('instances', $.mobile.pageData.uuid + '/frames', function(frames) {
611 if (frames.length == 1) 611 if (frames.length == 1)
612 { 612 {
613 // Viewing a single-frame image 613 // Viewing a single-frame image
614 jQuery.slimbox('/instances/' + $.mobile.pageData.uuid + '/preview', '', { 614 jQuery.slimbox('../instances/' + $.mobile.pageData.uuid + '/preview', '', {
615 overlayFadeDuration : 1, 615 overlayFadeDuration : 1,
616 resizeDuration : 1, 616 resizeDuration : 1,
617 imageFadeDuration : 1 617 imageFadeDuration : 1
618 }); 618 });
619 } 619 }
621 { 621 {
622 // Viewing a multi-frame image 622 // Viewing a multi-frame image
623 623
624 var images = []; 624 var images = [];
625 for (var i = 0; i < frames.length; i++) { 625 for (var i = 0; i < frames.length; i++) {
626 images.push([ '/instances/' + $.mobile.pageData.uuid + '/frames/' + i + '/preview' ]); 626 images.push([ '../instances/' + $.mobile.pageData.uuid + '/frames/' + i + '/preview' ]);
627 } 627 }
628 628
629 jQuery.slimbox(images, 0, { 629 jQuery.slimbox(images, 0, {
630 overlayFadeDuration : 1, 630 overlayFadeDuration : 1,
631 resizeDuration : 1, 631 resizeDuration : 1,
644 GetMultipleResources('instances', series.Instances, function(instances) { 644 GetMultipleResources('instances', series.Instances, function(instances) {
645 Sort(instances, function(x) { return x.IndexInSeries; }, true, false); 645 Sort(instances, function(x) { return x.IndexInSeries; }, true, false);
646 646
647 var images = []; 647 var images = [];
648 for (var i = 0; i < instances.length; i++) { 648 for (var i = 0; i < instances.length; i++) {
649 images.push([ '/instances/' + instances[i].ID + '/preview', 649 images.push([ '../instances/' + instances[i].ID + '/preview',
650 '{0}/{1}'.format(i + 1, instances.length) ]) 650 '{0}/{1}'.format(i + 1, instances.length) ])
651 } 651 }
652 652
653 jQuery.slimbox(images, 0, { 653 jQuery.slimbox(images, 0, {
654 overlayFadeDuration : 1, 654 overlayFadeDuration : 1,
667 667
668 668
669 function ChooseDicomModality(callback) 669 function ChooseDicomModality(callback)
670 { 670 {
671 $.ajax({ 671 $.ajax({
672 url: '/modalities', 672 url: '../modalities',
673 type: 'GET', 673 type: 'GET',
674 dataType: 'json', 674 dataType: 'json',
675 async: false, 675 async: false,
676 success: function(modalities) { 676 success: function(modalities) {
677 var clickedModality = ''; 677 var clickedModality = '';
714 714
715 $('#instance-store,#series-store').live('click', function(e) { 715 $('#instance-store,#series-store').live('click', function(e) {
716 ChooseDicomModality(function(modality) { 716 ChooseDicomModality(function(modality) {
717 if (modality != '') { 717 if (modality != '') {
718 $.ajax({ 718 $.ajax({
719 url: '/modalities/' + modality + '/store', 719 url: '../modalities/' + modality + '/store',
720 type: 'POST', 720 type: 'POST',
721 dataType: 'text', 721 dataType: 'text',
722 data: $.mobile.pageData.uuid, 722 data: $.mobile.pageData.uuid,
723 async: true, // Necessary to block UI 723 async: true, // Necessary to block UI
724 beforeSend: function() { 724 beforeSend: function() {