Wiki source code of Migration for Recurrent Events
Last modified by pinkpunk on 2025/04/15 23:50
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | {{velocity}} | ||
| 2 | #if("$!{request.outputSyntax}" != 'plain') ## | ||
| 3 | #set($count = $services.moccacalendarmigration.countUnmigratedEventsForRecurrency()) ## | ||
| 4 | == Events to migrate == | ||
| 5 | |||
| 6 | {{html wiki="false" clean="false"}} | ||
| 7 | #if($count < 0) | ||
| 8 | An error occured while determining if events are to be migrated. Please check the server logs. | ||
| 9 | #else | ||
| 10 | |||
| 11 | There are <span id="eventCounter">${count}</span> events to migrate. | ||
| 12 | |||
| 13 | <div id="errorMessage" class="box errormessage" style="display:none"></div> | ||
| 14 | |||
| 15 | #if($count >= 0) | ||
| 16 | <form id="migrationform" class="xFormInline"> | ||
| 17 | <fieldset> | ||
| 18 | <label for="stepSize">Number of events to check at once</label> | ||
| 19 | <select id="stepSize" name="stepSize"> | ||
| 20 | <option>10</option> | ||
| 21 | <option>100</option> | ||
| 22 | <option value="1000" selected="selected">1,000</option> | ||
| 23 | <option value="10000">10,000</option> | ||
| 24 | </select> | ||
| 25 | </fieldset> | ||
| 26 | <fieldset> | ||
| 27 | <span class="buttonwrapper"><input type="submit" id="startMigration" class="button primary" name="start" value="Start Migration" /> | ||
| 28 | <span id="loadSpinner" class="fa" style="width: 1em"> </span> | ||
| 29 | </fieldset> | ||
| 30 | </form> | ||
| 31 | {{/html}} | ||
| 32 | #end | ||
| 33 | #end | ||
| 34 | #end | ||
| 35 | {{/velocity}} | ||
| 36 | {{velocity wiki="false"}} | ||
| 37 | #if("$!{request.outputSyntax}" == 'plain') | ||
| 38 | $response.setContentType('application/json') | ||
| 39 | #set($offset = $numbertool.toNumber($request.getParameter('offset'))) | ||
| 40 | #set($limit = $numbertool.toNumber($request.getParameter('stepSize'))) | ||
| 41 | #if($limit > 0 && $offset >=0) | ||
| 42 | #set($result = $services.moccacalendarmigration.migrateEventsForRecurrenty($offset, $limit)) | ||
| 43 | #if(!$result['errorMessage']) | ||
| 44 | #set($discard = $result.put('remainingCount', $services.moccacalendarmigration.countUnmigratedEventsForRecurrency())) | ||
| 45 | #end | ||
| 46 | #else | ||
| 47 | #set($result = { 'errorMessage' : 'parameter "offset" or "stepSize" is missing'}) | ||
| 48 | #end | ||
| 49 | $jsontool.serialize($result) | ||
| 50 | #end | ||
| 51 | {{/velocity}} |