|
| 1 | +<div class="card mb-4"> |
| 2 | + <div class="card-body"> |
| 3 | + <div class="form-group mb-3"> |
| 4 | + <label for="aaf-project-{{ .Ordinal }}"><strong>XNAT Project Name</strong></label> |
| 5 | + <input type="text" class="form-control mt-1" id="aaf-project-{{ .Ordinal }}" placeholder="e.g. MyProject"> |
| 6 | + </div> |
| 7 | + <div class="form-group mb-3"> |
| 8 | + <label for="aaf-org-{{ .Ordinal }}"><strong>Organisation</strong></label> |
| 9 | + <input type="text" class="form-control mt-1" id="aaf-org-{{ .Ordinal }}" placeholder="e.g. QLD Health"> |
| 10 | + </div> |
| 11 | + <div class="form-group mb-3"> |
| 12 | + <label for="aaf-site-{{ .Ordinal }}"><strong>Data Acquisition Site</strong></label> |
| 13 | + <input type="text" class="form-control mt-1" id="aaf-site-{{ .Ordinal }}" placeholder="e.g. HIRF, CAI, TRI"> |
| 14 | + </div> |
| 15 | + |
| 16 | + <div id="aaf-output-{{ .Ordinal }}" style="display:none;"> |
| 17 | + <table class="table table-bordered mb-3"> |
| 18 | + <tr> |
| 19 | + <th style="width:80px;">To</th> |
| 20 | + <td>rcc-support@uq.edu.au</td> |
| 21 | + <td style="width:70px; text-align:center; vertical-align:middle;"> |
| 22 | + <button class="btn btn-sm btn-outline-secondary" id="aaf-copy-to-{{ .Ordinal }}">Copy</button> |
| 23 | + </td> |
| 24 | + </tr> |
| 25 | + <tr> |
| 26 | + <th>Subject</th> |
| 27 | + <td><span id="aaf-subject-{{ .Ordinal }}"></span></td> |
| 28 | + <td style="width:70px; text-align:center; vertical-align:middle;"> |
| 29 | + <button class="btn btn-sm btn-outline-secondary" id="aaf-copy-subject-{{ .Ordinal }}">Copy</button> |
| 30 | + </td> |
| 31 | + </tr> |
| 32 | + <tr> |
| 33 | + <th>Body</th> |
| 34 | + <td><span id="aaf-body-{{ .Ordinal }}" style="white-space:pre-line;"></span></td> |
| 35 | + <td style="width:70px; text-align:center; vertical-align:middle;"> |
| 36 | + <button class="btn btn-sm btn-outline-secondary" id="aaf-copy-body-{{ .Ordinal }}">Copy</button> |
| 37 | + </td> |
| 38 | + </tr> |
| 39 | + </table> |
| 40 | + <a id="aaf-mailto-{{ .Ordinal }}" class="btn btn-primary" href="#" role="button"> |
| 41 | + Open in Email Client |
| 42 | + </a> |
| 43 | + </div> |
| 44 | + </div> |
| 45 | +</div> |
| 46 | + |
| 47 | +<script> |
| 48 | +(function() { |
| 49 | + var ord = '{{ .Ordinal }}'; |
| 50 | + var projectInput = document.getElementById('aaf-project-' + ord); |
| 51 | + var orgInput = document.getElementById('aaf-org-' + ord); |
| 52 | + var siteInput = document.getElementById('aaf-site-' + ord); |
| 53 | + var output = document.getElementById('aaf-output-' + ord); |
| 54 | + var subjectEl = document.getElementById('aaf-subject-' + ord); |
| 55 | + var bodyEl = document.getElementById('aaf-body-' + ord); |
| 56 | + var mailto = document.getElementById('aaf-mailto-' + ord); |
| 57 | + |
| 58 | + function getSubject() { |
| 59 | + return 'XNAT AAF account for project ' + projectInput.value.trim(); |
| 60 | + } |
| 61 | + function getBody() { |
| 62 | + return 'Hello RCC support,\n\nI require an AAF account to access the UQ AIS XNAT service.\n\nMy details are below:\nOrganisation: ' + orgInput.value.trim() + '\nData Acquisition Site: ' + siteInput.value.trim() + '\n\nThank you'; |
| 63 | + } |
| 64 | + |
| 65 | + function update() { |
| 66 | + var project = projectInput.value.trim(); |
| 67 | + var org = orgInput.value.trim(); |
| 68 | + var site = siteInput.value.trim(); |
| 69 | + if (project && org && site) { |
| 70 | + subjectEl.textContent = getSubject(); |
| 71 | + bodyEl.textContent = getBody(); |
| 72 | + mailto.href = 'mailto:rcc-support@uq.edu.au?subject=' + encodeURIComponent(getSubject()) + '&body=' + encodeURIComponent(getBody() + '\n'); |
| 73 | + output.style.display = 'block'; |
| 74 | + } else { |
| 75 | + output.style.display = 'none'; |
| 76 | + } |
| 77 | + } |
| 78 | + |
| 79 | + projectInput.addEventListener('input', update); |
| 80 | + orgInput.addEventListener('input', update); |
| 81 | + siteInput.addEventListener('input', update); |
| 82 | + |
| 83 | + document.getElementById('aaf-copy-to-' + ord).addEventListener('click', function() { |
| 84 | + navigator.clipboard.writeText('rcc-support@uq.edu.au'); |
| 85 | + }); |
| 86 | + document.getElementById('aaf-copy-subject-' + ord).addEventListener('click', function() { |
| 87 | + navigator.clipboard.writeText(getSubject()); |
| 88 | + }); |
| 89 | + document.getElementById('aaf-copy-body-' + ord).addEventListener('click', function() { |
| 90 | + navigator.clipboard.writeText(getBody()); |
| 91 | + }); |
| 92 | +})(); |
| 93 | +</script> |
0 commit comments