| 1 |
<?php |
| 2 |
/** |
| 3 |
* Stateless Sync Interface |
| 4 |
*/ |
| 5 |
global $wpdb; |
| 6 |
|
| 7 |
?> |
| 8 |
|
| 9 |
|
| 10 |
<div class="wrap" ng-controller="wpStatelessTools" ng-init="init()"> |
| 11 |
|
| 12 |
<noscript><p><em><?php _e( 'You must enable Javascript in order to proceed!', ud_get_stateless_media()->domain ); ?></em></p></noscript> |
| 13 |
|
| 14 |
<form id="go" ng-submit="processStart($event)"> |
| 15 |
|
| 16 |
<div> |
| 17 |
|
| 18 |
<div class="option"> |
| 19 |
<label> |
| 20 |
<input ng-disabled="isRunning || isLoading" type="radio" name="action" value="regenerate_images" ng-model="action" /> |
| 21 |
<?php _e( 'Regenerate all stateless images and synchronize Google Storage with local server', ud_get_stateless_media()->domain ); ?> |
| 22 |
</label> |
| 23 |
</div> |
| 24 |
|
| 25 |
<div class="option"> |
| 26 |
<label> |
| 27 |
<input ng-disabled="isRunning || isLoading" type="radio" name="action" value="sync_non_images" ng-model="action" /> |
| 28 |
<?php _e( 'Synchronize non-images files between Google Storage and local server', ud_get_stateless_media()->domain ); ?> |
| 29 |
</label> |
| 30 |
</div> |
| 31 |
|
| 32 |
<?php if(!empty($GLOBALS['show_non_library_sync'])):?> |
| 33 |
<div class="option"> |
| 34 |
<label> |
| 35 |
<input ng-disabled="isRunning || isLoading" type="radio" name="action" value="sync_non_library_files" ng-model="action" /> |
| 36 |
<?php _e( 'Synchronize non media library files between Google Storage and local server', ud_get_stateless_media()->domain ); ?> |
| 37 |
</label> |
| 38 |
</div> |
| 39 |
<?php endif;?> |
| 40 |
|
| 41 |
</div> |
| 42 |
|
| 43 |
<div ng-if="action == 'regenerate_images' && progresses.images || action == 'sync_non_images' && progresses.other"> |
| 44 |
|
| 45 |
<h2><?php _e( 'Method', ud_get_stateless_media()->domain ); ?></h2> |
| 46 |
|
| 47 |
<div class="option"> |
| 48 |
<label> |
| 49 |
<input ng-disabled="isRunning || isLoading" type="radio" name="method" value="start" ng-model="$parent.method" /> |
| 50 |
<?php _e( 'Start a new process', ud_get_stateless_media()->domain ); ?> |
| 51 |
<span class="notice notice-warning" style="margin-left:20px;"> |
| 52 |
<?php _e( '<strong>Warning:</strong> This will make it impossible to continue the last process.', ud_get_stateless_media()->domain ); ?> |
| 53 |
</span> |
| 54 |
</label> |
| 55 |
</div> |
| 56 |
|
| 57 |
<div class="option"> |
| 58 |
<label> |
| 59 |
<input ng-disabled="isRunning || isLoading" type="radio" name="method" value="continue" ng-model="$parent.method" /> |
| 60 |
<?php _e( 'Continue the last process', ud_get_stateless_media()->domain ); ?> |
| 61 |
</label> |
| 62 |
</div> |
| 63 |
|
| 64 |
</div> |
| 65 |
|
| 66 |
<div ng-if="(action == 'regenerate_images' && fails.images) || (action == 'sync_non_images' && fails.other)"> |
| 67 |
|
| 68 |
<h2><?php _e( 'Fix errors', ud_get_stateless_media()->domain ); ?></h2> |
| 69 |
|
| 70 |
<div class="option"> |
| 71 |
<label> |
| 72 |
<input ng-disabled="isRunning || isLoading" type="checkbox" name="method" ng-true-value="'fix'" ng-model="$parent.method" /> |
| 73 |
<?php _e( 'Try to fix previously failed items', ud_get_stateless_media()->domain ); ?> |
| 74 |
<span class="notice notice-warning" style="margin-left:20px;"> |
| 75 |
<?php _e( '<strong>Warning:</strong> This will make it impossible to continue the last process.', ud_get_stateless_media()->domain ); ?> |
| 76 |
</span> |
| 77 |
</label> |
| 78 |
</div> |
| 79 |
|
| 80 |
</div> |
| 81 |
|
| 82 |
<div> |
| 83 |
|
| 84 |
<h2><?php _e( 'Bulk Size', ud_get_stateless_media()->domain ); ?></h2> |
| 85 |
|
| 86 |
<div class="option"> |
| 87 |
<label> |
| 88 |
<input ng-disabled="isRunning || isLoading" type="number" name="bulk_size" ng-model="bulk_size" /> |
| 89 |
<?php _e( 'How many items to process at once', ud_get_stateless_media()->domain ); ?> |
| 90 |
</label> |
| 91 |
</div> |
| 92 |
|
| 93 |
</div> |
| 94 |
|
| 95 |
<div class="status ud-admin-notice {{error?'error':'notice'}}" ng-show="status"> |
| 96 |
<p> |
| 97 |
<?php _e( 'Status:', ud_get_stateless_media()->domain ); ?> {{status}} |
| 98 |
<span class="button button-secondary" ng-show="extraStatus" ng-click="showErrorDetails = !showErrorDetails"><?php _e( 'Details', ud_get_stateless_media()->domain ); ?></span> |
| 99 |
</p> |
| 100 |
<div id="sm-error-details" class="extra-info" ng-show="extraStatus && showErrorDetails" ng-bind-html="extraStatus | trust"></div> |
| 101 |
</div> |
| 102 |
|
| 103 |
<div ng-show="isRunning" id="regenthumbs-bar" style="position:relative;height:25px;"> |
| 104 |
<div id="regenthumbs-bar-percent" style="position:absolute;left:50%;top:50%;width:300px;margin-left:-150px;height:25px;margin-top:-9px;font-weight:bold;text-align:center;"></div> |
| 105 |
</div> |
| 106 |
|
| 107 |
<ol ng-show="log.length" id="regenthumbs-debuglist"> |
| 108 |
<li ng-repeat="l in log">{{l.message}}</li> |
| 109 |
</ol> |
| 110 |
|
| 111 |
<div class="buttons"> |
| 112 |
<button ng-disabled="isRunning || isLoading" type="submit" class="button-primary"><?php _e( 'Run (may take a while)' ); ?></button> |
| 113 |
<div ng-disabled="!isRunning" ng-click="processStop($event)" class="button-secondary"><?php _e( 'Stop' ); ?></div> |
| 114 |
<div ng-disabled="!log.length" ng-click="log=[]" class="button-secondary"><?php _e( 'Clear Log' ); ?></div> |
| 115 |
</div> |
| 116 |
|
| 117 |
</form> |
| 118 |
|
| 119 |
</div> |