| 1 |
<?php |
| 2 |
$plugin_groups = Plugin_Groups_Options::get_single( 'plugin_groups' ); |
| 3 |
$plugins = get_plugins(); |
| 4 |
|
| 5 |
?> |
| 6 |
<div class="wrap plugin-groups-calderamain-canvas" id="plugin-groups-main-canvas"> |
| 7 |
<span class="wp-baldrick spinner" style="float: none; display: block;" data-target="#plugin-groups-main-canvas" data-callback="plorg_canvas_init" data-type="json" data-request="#plugin-groups-live-config" data-event="click" data-template="#main-ui-template" data-autoload="true"></span> |
| 8 |
</div> |
| 9 |
|
| 10 |
<div class="clear"></div> |
| 11 |
|
| 12 |
<input type="hidden" class="clear" autocomplete="off" id="plugin-groups-live-config" style="width:100%;" value="<?php echo esc_attr( json_encode($plugin_groups) ); ?>"> |
| 13 |
|
| 14 |
<script type="text/html" id="main-ui-template"> |
| 15 |
<?php |
| 16 |
// pull in the join table card template |
| 17 |
include PLORG_PATH . 'includes/templates/main-ui.php'; |
| 18 |
?> |
| 19 |
</script> |
| 20 |
<script type="text/javascript"> |
| 21 |
function plorg_start_importer(){ |
| 22 |
return {}; |
| 23 |
} |
| 24 |
function plorg_create_plugin_groups(){ |
| 25 |
jQuery('#plugin-groups-field-sync').trigger('refresh'); |
| 26 |
jQuery('#plorg-save-button').trigger('click'); |
| 27 |
} |
| 28 |
</script> |
| 29 |
<script type="text/html" id="import-plugin_groups-form"> |
| 30 |
<div class="import-tester-config-group"> |
| 31 |
<input id="new-plugin-groups-import-file" type="file" class="regular-text"> |
| 32 |
<input id="new-plugin_groups-import" value="" name="import" type="hidden"> |
| 33 |
</div> |
| 34 |
{{#script}} |
| 35 |
jQuery( function($){ |
| 36 |
|
| 37 |
$('#plorg_import_init').prop('disabled', true).addClass('disabled'); |
| 38 |
|
| 39 |
$('#new-plugin-groups-import-file').on('change', function(){ |
| 40 |
$('#plorg_import_init').prop('disabled', true).addClass('disabled'); |
| 41 |
var input = $(this), |
| 42 |
f = this.files[0], |
| 43 |
contents; |
| 44 |
|
| 45 |
if (f) { |
| 46 |
var r = new FileReader(); |
| 47 |
r.onload = function(e) { |
| 48 |
contents = e.target.result; |
| 49 |
var data; |
| 50 |
try{ |
| 51 |
data = JSON.parse( contents ); |
| 52 |
} catch(e){}; |
| 53 |
|
| 54 |
if( !data || ! data['plugin-groups-setup'] ){ |
| 55 |
alert("<?php echo esc_attr( __('Not a valid Plugin-groups export file.', 'plugin-groups') ); ?>"); |
| 56 |
input[0].value = null; |
| 57 |
return false; |
| 58 |
} |
| 59 |
|
| 60 |
$('#plugin-groups-live-config').val( contents ); |
| 61 |
$('#plorg_import_init').prop('disabled', false).removeClass('disabled'); |
| 62 |
} |
| 63 |
if( f.type !== 'application/json' ){ |
| 64 |
alert("<?php echo esc_attr( __('Not a valid Plugin-groups export file.', 'plugin-groups') ); ?>"); |
| 65 |
this.value = null; |
| 66 |
return false; |
| 67 |
} |
| 68 |
r.readAsText(f); |
| 69 |
} else { |
| 70 |
alert("Failed to load file"); |
| 71 |
return false; |
| 72 |
} |
| 73 |
}); |
| 74 |
|
| 75 |
}); |
| 76 |
{{/script}} |
| 77 |
</script> |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|