comparison Applications/StoneWebViewer/WebApplication/app.js @ 1698:8805a6a01655

"DateFormat" configuration option
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 27 Nov 2020 10:13:15 +0100
parents c2802561d7f9
children 0598c87e1e88
comparison
equal deleted inserted replaced
1697:c2802561d7f9 1698:8805a6a01655
319 var s = ''; 319 var s = '';
320 for (var i = 0; i < this.studies.length; i++) { 320 for (var i = 0; i < this.studies.length; i++) {
321 if (this.studies[i].selected) { 321 if (this.studies[i].selected) {
322 if (s.length > 0) 322 if (s.length > 0)
323 s += ', '; 323 s += ', ';
324 s += (this.studies[i].tags[STUDY_DESCRIPTION] + ' [' + 324 s += this.studies[i].tags[STUDY_DESCRIPTION];
325 this.studies[i].tags[STUDY_DATE] + ']'); 325
326 var date = this.studies[i].tags[STUDY_DATE];
327 if (date.length > 0) {
328 s += ' [' + this.FormatDate(date) + ']';
329 }
326 } 330 }
327 } 331 }
328 if (s.length == 0) 332 if (s.length == 0)
329 return '...'; 333 return '...';
330 else 334 else
707 //$('#windowing-content').css('right', '10'); 711 //$('#windowing-content').css('right', '10');
708 //$('#windowing-content').css('left', 'auto'); 712 //$('#windowing-content').css('left', 'auto');
709 713
710 this.showWindowing = true; 714 this.showWindowing = true;
711 } 715 }
716 },
717
718 FormatDate(date) {
719 if (date === undefined ||
720 date.length == 0) {
721 return '';
722 }
723 else {
724 var format = this.globalConfiguration['DateFormat'];
725 if (format === undefined) {
726 // No configuration for the date format, use the DICOM tag as such
727 return date;
728 }
729 else {
730 var year = date.replace(/^([0-9]{4})([0-9]{2})([0-9]{2})$/, '$1');
731 var month = date.replace(/^([0-9]{4})([0-9]{2})([0-9]{2})$/, '$2');
732 var day = date.replace(/^([0-9]{4})([0-9]{2})([0-9]{2})$/, '$3');
733 return format.replace(/YYYY/g, year).replace(/MM/g, month).replace(/DD/g, day);
734 }
735 }
712 } 736 }
713 }, 737 },
714 738
715 mounted: function() { 739 mounted: function() {
716 this.SetViewportLayout('1x1'); 740 this.SetViewportLayout('1x1');