comparison OrthancExplorer/explorer.js @ 443:be93b666ed79

link anonymized to original resource in OrthancExplorer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 17 May 2013 16:55:30 +0200
parents 97a00b30abcc
children b05eb8708aee
comparison
equal deleted inserted replaced
442:40deb6525337 443:be93b666ed79
354 }); 354 });
355 }); 355 });
356 356
357 357
358 358
359 function SetupAnonymizedFrom(buttonSelector, resource, resourceType)
360 {
361 if ('AnonymizedFrom' in resource)
362 {
363 $(buttonSelector).closest('li').show();
364 $(buttonSelector).click(function(e) {
365 window.location.assign('explorer.html#' + resourceType + '?uuid=' + resource.AnonymizedFrom);
366 window.location.reload();
367 });
368 }
369 else
370 {
371 $(buttonSelector).closest('li').hide();
372 }
373 }
374
375
359 $('#patient').live('pagebeforeshow', function() { 376 $('#patient').live('pagebeforeshow', function() {
360 if ($.mobile.pageData) { 377 if ($.mobile.pageData) {
361 GetSingleResource('patients', $.mobile.pageData.uuid, function(patient) { 378 GetSingleResource('patients', $.mobile.pageData.uuid, function(patient) {
362 GetMultipleResources('studies', patient.Studies, function(studies) { 379 GetMultipleResources('studies', patient.Studies, function(studies) {
363 SortOnDicomTag(studies, 'StudyDate', false, true); 380 SortOnDicomTag(studies, 'StudyDate', false, true);
378 (FormatDicomDate(studies[i].MainDicomTags.StudyDate))); 395 (FormatDicomDate(studies[i].MainDicomTags.StudyDate)));
379 } 396 }
380 397
381 target.append(FormatStudy(studies[i], '#study?uuid=' + studies[i].ID)); 398 target.append(FormatStudy(studies[i], '#study?uuid=' + studies[i].ID));
382 } 399 }
400
401 SetupAnonymizedFrom('#patient-anonymized-from', patient, 'patient');
383 402
384 target.listview('refresh'); 403 target.listview('refresh');
385 404
386 // Check whether this patient is protected 405 // Check whether this patient is protected
387 $.ajax({ 406 $.ajax({
415 .append(FormatPatient(patient, '#patient?uuid=' + patient.ID, true)) 434 .append(FormatPatient(patient, '#patient?uuid=' + patient.ID, true))
416 .append('<li data-role="list-divider">Study</li>') 435 .append('<li data-role="list-divider">Study</li>')
417 .append(FormatStudy(study)) 436 .append(FormatStudy(study))
418 .listview('refresh'); 437 .listview('refresh');
419 438
439 SetupAnonymizedFrom('#study-anonymized-from', study, 'study');
440
420 var target = $('#list-series'); 441 var target = $('#list-series');
421 $('li', target).remove(); 442 $('li', target).remove();
422 for (var i = 0; i < series.length; i++) { 443 for (var i = 0; i < series.length; i++) {
423 if (i == 0 || series[i].MainDicomTags.SeriesDate != series[i - 1].MainDicomTags.SeriesDate) 444 if (i == 0 || series[i].MainDicomTags.SeriesDate != series[i - 1].MainDicomTags.SeriesDate)
424 { 445 {
453 .append('<li data-role="list-divider">Study</li>') 474 .append('<li data-role="list-divider">Study</li>')
454 .append(FormatStudy(study, '#study?uuid=' + study.ID, true)) 475 .append(FormatStudy(study, '#study?uuid=' + study.ID, true))
455 .append('<li data-role="list-divider">Series</li>') 476 .append('<li data-role="list-divider">Series</li>')
456 .append(FormatSeries(series)) 477 .append(FormatSeries(series))
457 .listview('refresh'); 478 .listview('refresh');
479
480 SetupAnonymizedFrom('#series-anonymized-from', series, 'series');
458 481
459 var target = $('#list-instances'); 482 var target = $('#list-instances');
460 $('li', target).remove(); 483 $('li', target).remove();
461 for (var i = 0; i < instances.length; i++) { 484 for (var i = 0; i < instances.length; i++) {
462 target.append(FormatInstance(instances[i], '#instance?uuid=' + instances[i].ID)); 485 target.append(FormatInstance(instances[i], '#instance?uuid=' + instances[i].ID));