| 1 | {{{#!html |
| 2 | <form id="wp_action"> |
| 3 | <table style="margin: 0px auto;"> |
| 4 | <tbody> |
| 5 | <tr> |
| 6 | <td> |
| 7 | <fieldset style="height: 15em;"> |
| 8 | <legend> |
| 9 | Action name |
| 10 | </legend> |
| 11 | <table> |
| 12 | <tbody style="vertical-align: inherit;"> |
| 13 | <tr> |
| 14 | <td> |
| 15 | Scope |
| 16 | </td> |
| 17 | <td> |
| 18 | <select id="realm" onchange="val()" required> |
| 19 | <option value=""></option> |
| 20 | <optgroup label="Institute"> |
| 21 | <option value="CMCC" >CMCC</option > |
| 22 | <option value="CNRS" >CNRS-INSU</option > |
| 23 | <option value="Mercator_Ocean">Mercator Océan</option> |
| 24 | <option value="Met_Office" >Met Office</option > |
| 25 | <option value="NOC" >NERC-NOC</option > |
| 26 | </optgroup> |
| 27 | <optgroup label="Streams" > |
| 28 | <option value="AGRIF" >AGRIF</option > |
| 29 | <option value="ASINTER">Air-Sea Interactions</option> |
| 30 | <option value="HPC" >HPC</option > |
| 31 | <option value="KERNEL" >Kernel</option > |
| 32 | <option value="PUBLI" >Publication</option > |
| 33 | <option value="SEAICE" >Sea-Ice</option > |
| 34 | <option value="TOPBGC" >TOP & BGC</option > |
| 35 | <option value="ENHANCE">Enhancement</option > |
| 36 | </optgroup> |
| 37 | </select> |
| 38 | <br> |
| 39 | <span class="hint">Institute for specific actions, Stream for shared actions</span> |
| 40 | </td> |
| 41 | </tr> |
| 42 | <tr> |
| 43 | <td> |
| 44 | Number |
| 45 | </td> |
| 46 | <td> |
| 47 | <select id="increment" onchange="val()"></select> |
| 48 | <br> |
| 49 | <span class="hint">Check the tables above to define free number</span> |
| 50 | </td> |
| 51 | </tr> |
| 52 | <tr> |
| 53 | <td> |
| 54 | Suffix |
| 55 | </td> |
| 56 | <td> |
| 57 | <input type="text" id="suffix" placeholder="Name(s)-Keyword(s)" required> |
| 58 | <br> |
| 59 | <span class="hint">Identify PI(s) and field(s), <u>no space recommended</u></span> |
| 60 | </td> |
| 61 | </tr> |
| 62 | <tr> |
| 63 | <td> |
| 64 | <em>Preview</em> |
| 65 | </td> |
| 66 | <td> |
| 67 | <em id="name_preview"></em> |
| 68 | </td> |
| 69 | </tr> |
| 70 | </tbody> |
| 71 | </table> |
| 72 | </fieldset> |
| 73 | <td> |
| 74 | <fieldset style="height: 15em; display: grid;"> |
| 75 | <legend> |
| 76 | Submit / Reset |
| 77 | </legend> |
| 78 | <input type="hidden" name="summary" value="" id="summary"> |
| 79 | <input type="hidden" name="type" value="Task" > |
| 80 | <input type="hidden" name="milestone" value="`$YEAR` WP" > |
| 81 | <input type="hidden" name="version" value="trunk" > |
| 82 | <input type="hidden" name="action" value="edit" > |
| 83 | <input type="hidden" name="template" value="WorkPlanAction" > |
| 84 | <table> |
| 85 | <tbody> |
| 86 | <tr> |
| 87 | <td style="text-align: center;"> |
| 88 | <input type="submit" id="form_wiki" value="Create action page" formtarget="_blank" formaction="/nemo/wiki/`$YEAR` WP/__REPLACE_DYNAMICALLY__"> |
| 89 | </td> |
| 90 | </tr> |
| 91 | <tr> |
| 92 | <td style="text-align: center;"> |
| 93 | <input type="submit" id="form_ticket" value="Open action ticket" formtarget="_blank" formaction="/nemo/newticket" > |
| 94 | </td> |
| 95 | </tr> |
| 96 | <tr> |
| 97 | <td style="text-align: center;"> |
| 98 | <button type="reset" onclick="resetForm();">Clear form</button> |
| 99 | </td> |
| 100 | </tr> |
| 101 | </tbody> |
| 102 | </table> |
| 103 | </fieldset> |
| 104 | </td> |
| 105 | </tr> |
| 106 | </tbody> |
| 107 | </table> |
| 108 | </form> |
| 109 | |
| 110 | <script type="text/javascript"> |
| 111 | |
| 112 | // Global variable for action name |
| 113 | var action_name; |
| 114 | |
| 115 | // Leading zeros for number |
| 116 | function padWithZeroes(n, width) { while ( n.length < width ) n = '0' + n; return n; } |
| 117 | |
| 118 | // Auto-generated numbers sequence for select input |
| 119 | for(var i=1; i<=20; i++){ |
| 120 | var select = document.getElementById("increment"); var option = document.createElement("option"); |
| 121 | select.options.add(option); |
| 122 | option.text = i; option.value = padWithZeroes(i.toString(), 2); |
| 123 | } |
| 124 | |
| 125 | // Build the real action name by concatenating the form inputs |
| 126 | function val() { |
| 127 | var realm = $("#realm").val(); var inc = $("#increment").val(); var suffix = $("#suffix").val(); |
| 128 | action_name = realm + '-' + inc + '_' + suffix; |
| 129 | $("#name_preview").text(action_name); $("#summary").val(action_name); |
| 130 | } |
| 131 | |
| 132 | // Update name preview as typing |
| 133 | $("#suffix").keyup (function() { val(); }); |
| 134 | |
| 135 | function resetForm(){ setTimeout(function(){ val(); }, 50); } |
| 136 | |
| 137 | // Set wiki page name on the fly |
| 138 | $("#wp_action").submit(function() { |
| 139 | var form_action = $("#form_wiki").attr("formaction"); |
| 140 | form_action = form_action.replace("__REPLACE_DYNAMICALLY__", action_name); |
| 141 | $("#form_wiki").attr("formaction", form_action); |
| 142 | }); |
| 143 | |
| 144 | </script> |
| 145 | }}} |