wizard.php
507 lines
| 1 | <div class="wrap pods-admin"> |
| 2 | <div id="icon-pods" class="icon32"><br /></div> |
| 3 | |
| 4 | <form action="" method="post" class="pods-submittable"> |
| 5 | <div class="pods-submittable-fields"> |
| 6 | <?php echo PodsForm::field( 'action', 'pods_admin_components', 'hidden' ); ?> |
| 7 | <?php echo PodsForm::field( 'component', $component, 'hidden' ); ?> |
| 8 | <?php echo PodsForm::field( 'method', $method, 'hidden' ); ?> |
| 9 | <?php echo PodsForm::field( '_wpnonce', wp_create_nonce( 'pods-component-' . $component . '-' . $method ), 'hidden' ); ?> |
| 10 | <?php echo PodsForm::field( 'import_export', 'export', 'hidden' ); ?> |
| 11 | |
| 12 | <h2 class="italicized"><?php esc_html_e( 'Migrate: Packages', 'pods' ); ?></h2> |
| 13 | |
| 14 | <img src="<?php echo esc_url( PODS_URL ); ?>ui/images/pods-logo-notext-rgb-transparent.png" class="pods-leaf-watermark-right" /> |
| 15 | |
| 16 | <div id="pods-wizard-box" class="pods-wizard-steps-2 pods-wizard-hide-first" data-step-process="1"> |
| 17 | <div id="pods-wizard-heading"> |
| 18 | <ul> |
| 19 | <li class="pods-wizard-menu-current" data-step="1"> |
| 20 | <i></i> <span>1</span> <?php esc_html_e( 'Step 1: Choose', 'pods' ); ?> <em></em> |
| 21 | </li> |
| 22 | <li data-step="2"> |
| 23 | <i></i> <span>2</span> <?php esc_html_e( 'Step 2: Import / Export Package', 'pods' ); ?> <em></em> |
| 24 | </li> |
| 25 | </ul> |
| 26 | </div> |
| 27 | |
| 28 | <div id="pods-wizard-main"> |
| 29 | <?php |
| 30 | $api = pods_api(); |
| 31 | |
| 32 | $pods = $api->load_pods( array( 'fields' => false ) ); |
| 33 | $pod_templates = $api->load_templates(); |
| 34 | $pod_pages = $api->load_pages(); |
| 35 | |
| 36 | $export = true; |
| 37 | |
| 38 | if ( empty( $pods ) && empty( $pod_templates ) && empty( $pod_pages ) ) { |
| 39 | $export = false; |
| 40 | } |
| 41 | ?> |
| 42 | |
| 43 | <div id="pods-wizard-panel-1" class="pods-wizard-panel"> |
| 44 | <div class="pods-wizard-content"> |
| 45 | <p><?php esc_html_e( 'Packages allow you to import/export your Pods, Groups, Fields, and other settings between any Pods sites.', 'pods' ); ?></p> |
| 46 | <p><?php esc_html_e( 'A Pods package is stored in JSON format and can be copied or downloaded for import on another site with Pods installed.', 'pods' ); ?></p> |
| 47 | </div> |
| 48 | |
| 49 | <div id="pods-wizard-options"> |
| 50 | <div class="pods-wizard-options-list"> |
| 51 | <div class="pods-wizard-option"> |
| 52 | <a href="#pods-wizard-import" data-opt="import"> |
| 53 | <div> |
| 54 | <h2><?php esc_html_e( 'Import Package', 'pods' ); ?></h2> |
| 55 | |
| 56 | <p><?php esc_html_e( 'Import a package of Pods, Groups, Fields, and other settings from another site.', 'pods' ); ?></p> |
| 57 | </div> |
| 58 | <span>❯</span> |
| 59 | </a> |
| 60 | </div> |
| 61 | |
| 62 | <?php |
| 63 | if ( $export ) { |
| 64 | ?> |
| 65 | <div class="pods-wizard-option"> |
| 66 | <a href="#pods-wizard-export" data-opt="export"> |
| 67 | <div> |
| 68 | <h2><?php esc_html_e( 'Export Package', 'pods' ); ?></h2> |
| 69 | |
| 70 | <p><?php esc_html_e( 'Choose which Pods, Groups, Fields, and other settings to export into a package.', 'pods' ); ?></p> |
| 71 | </div> |
| 72 | <span>❯</span> |
| 73 | </a> |
| 74 | </div> |
| 75 | <?php |
| 76 | } |
| 77 | ?> |
| 78 | </div> |
| 79 | </div> |
| 80 | </div> |
| 81 | |
| 82 | <div id="pods-wizard-panel-2" class="pods-wizard-panel"> |
| 83 | <div class="pods-wizard-option-content" id="pods-wizard-import"> |
| 84 | <div class="pods-wizard-content"> |
| 85 | <p><?php esc_html_e( 'Packages allow you to import/export your Pods, Groups, Fields, and other settings between any Pods sites.', 'pods' ); ?></p> |
| 86 | </div> |
| 87 | |
| 88 | <div class="stuffbox"> |
| 89 | <h3><?php esc_html_e( 'Import your Package', 'pods' ); ?></h3> |
| 90 | |
| 91 | <div class="inside pods-manage-field pods-dependency"> |
| 92 | <div class="pods-field__container pods-field-option"> |
| 93 | <?php |
| 94 | echo PodsForm::label( 'import_package_file', __( 'Upload your pods-package.json', 'pods' ) ); |
| 95 | ?> |
| 96 | <input type="file" name="import_package_file" id="pods-form-ui-import-package-file" accept=".json" /> |
| 97 | <button type="button" |
| 98 | id="pods-form-ui-import-package-file-reset" |
| 99 | class="button button-secondary button-small hidden" |
| 100 | aria-hidden="true"> |
| 101 | <?php esc_html_e( 'Clear file', 'pods' ); ?> |
| 102 | </button> |
| 103 | </div> |
| 104 | <div class="pods-field__container pods-field-option"> |
| 105 | <?php |
| 106 | echo PodsForm::label( 'import_package', __( 'Or paste the Package code', 'pods' ), __( 'If you paste the code, you may encounter issues on certain hosts where mod_security will block the submission. If you encounter an error message on submit, contact your host and let them know that you believe you are seeing a mod_security issue with /wp-admin/admin-ajax.php and they can look through your error logs to help solve it.', 'pods' ) ); |
| 107 | echo PodsForm::field( 'import_package', pods_v( 'import_package', 'post' ), 'paragraph', [ |
| 108 | 'attributes' => [ |
| 109 | 'style' => 'width: 100%; max-width: 100%; height: 250px;', |
| 110 | ], |
| 111 | 'disable_dfv' => true, |
| 112 | ] ); |
| 113 | ?> |
| 114 | </div> |
| 115 | </div> |
| 116 | </div> |
| 117 | </div> |
| 118 | |
| 119 | <div class="pods-wizard-option-content" id="pods-wizard-export"> |
| 120 | <div class="pods-wizard-content"> |
| 121 | <p><?php esc_html_e( 'Packages allow you to import/export your Pods, Groups, Fields, and other settings between any Pods sites.', 'pods' ); ?></p> |
| 122 | |
| 123 | <p> |
| 124 | <a href="#toggle" class="button pods-wizard-toggle-all" data-toggle="all"><?php esc_html_e( 'Toggle everything on / off', 'pods' ); ?></a> |
| 125 | </p> |
| 126 | </div> |
| 127 | |
| 128 | <div class="stuffbox pods-package-import-group"> |
| 129 | <h3> |
| 130 | <label for="link_name"><?php esc_html_e( 'Choose whether to export Settings', 'pods' ); ?></label> |
| 131 | </h3> |
| 132 | |
| 133 | <div class="inside pods-manage-field pods-dependency"> |
| 134 | <div class="pods-field-option-group"> |
| 135 | <div class="pods-pick-values pods-pick-checkbox pods-zebra"> |
| 136 | <ul> |
| 137 | <?php |
| 138 | $data_name = 'settings'; |
| 139 | $data = [ |
| 140 | 'all' => __( 'All Settings', 'pods' ), |
| 141 | ]; |
| 142 | |
| 143 | $zebra = false; |
| 144 | |
| 145 | foreach ( $data as $key => $label ) { |
| 146 | $checked = true; |
| 147 | |
| 148 | $class = ( $zebra ? 'even' : 'odd' ); |
| 149 | |
| 150 | $zebra = ( ! $zebra ); |
| 151 | ?> |
| 152 | <li class="pods-zebra-<?php echo esc_attr( $class ); ?>"> |
| 153 | <?php |
| 154 | echo PodsForm::field( $data_name . '[' . $key . ']', true, 'boolean', [ |
| 155 | 'boolean_yes_label' => $label, |
| 156 | 'disable_dfv' => true, |
| 157 | ] ); |
| 158 | ?> |
| 159 | </li> |
| 160 | <?php |
| 161 | } |
| 162 | ?> |
| 163 | </ul> |
| 164 | </div> |
| 165 | </div> |
| 166 | </div> |
| 167 | </div> |
| 168 | |
| 169 | <?php |
| 170 | if ( ! empty( $pods ) ) { |
| 171 | $data = $pods; |
| 172 | $data_name = 'pods'; |
| 173 | ?> |
| 174 | <div class="stuffbox pods-package-import-group"> |
| 175 | <h3> |
| 176 | <label for="link_name"><?php esc_html_e( 'Choose which Pods to export', 'pods' ); ?></label> |
| 177 | </h3> |
| 178 | |
| 179 | <div class="inside pods-manage-field pods-dependency"> |
| 180 | <div class="pods-field-option-group"> |
| 181 | <div class="pods-pick-values pods-pick-checkbox pods-zebra"> |
| 182 | <p> |
| 183 | <a href="#toggle" class="button pods-wizard-toggle-all" data-toggle="<?php echo esc_attr( $data_name ); ?>"><?php esc_html_e( 'Toggle all on / off', 'pods' ); ?></a> |
| 184 | </p> |
| 185 | |
| 186 | <ul> |
| 187 | <?php |
| 188 | $zebra = false; |
| 189 | |
| 190 | foreach ( $data as $item ) { |
| 191 | $checked = true; |
| 192 | |
| 193 | $class = ( $zebra ? 'even' : 'odd' ); |
| 194 | |
| 195 | $zebra = ( ! $zebra ); |
| 196 | ?> |
| 197 | <li class="pods-zebra-<?php echo esc_attr( $class ); ?>"> |
| 198 | <?php |
| 199 | echo PodsForm::field( $data_name . '[' . $item['id'] . ']', $checked, 'boolean', [ |
| 200 | 'boolean_yes_label' => $item['name'] . ( ! empty( $item['label'] ) ? ' (' . $item['label'] . ')' : '' ), |
| 201 | 'disable_dfv' => true, |
| 202 | ] ); |
| 203 | ?> |
| 204 | </li> |
| 205 | <?php |
| 206 | } |
| 207 | ?> |
| 208 | </ul> |
| 209 | </div> |
| 210 | </div> |
| 211 | </div> |
| 212 | </div> |
| 213 | <?php |
| 214 | }//end if |
| 215 | |
| 216 | if ( ! empty( $pod_templates ) ) { |
| 217 | $data = $pod_templates; |
| 218 | $data_name = 'templates'; |
| 219 | ?> |
| 220 | <div class="stuffbox pods-package-import-group"> |
| 221 | <h3> |
| 222 | <label for="link_name"><?php esc_html_e( 'Choose which Pod Templates to export', 'pods' ); ?></label> |
| 223 | </h3> |
| 224 | |
| 225 | <div class="inside pods-manage-field pods-dependency"> |
| 226 | <div class="pods-field-option-group"> |
| 227 | <div class="pods-pick-values pods-pick-checkbox pods-zebra"> |
| 228 | <p> |
| 229 | <a href="#toggle" class="button pods-wizard-toggle-all" data-toggle="<?php echo esc_attr( $data_name ); ?>"><?php esc_html_e( 'Toggle all on / off', 'pods' ); ?></a> |
| 230 | </p> |
| 231 | |
| 232 | <ul> |
| 233 | <?php |
| 234 | $zebra = false; |
| 235 | |
| 236 | foreach ( $data as $item ) { |
| 237 | $checked = true; |
| 238 | |
| 239 | $class = ( $zebra ? 'even' : 'odd' ); |
| 240 | |
| 241 | $zebra = ( ! $zebra ); |
| 242 | ?> |
| 243 | <li class="pods-zebra-<?php echo esc_attr( $class ); ?>"> |
| 244 | <?php |
| 245 | echo PodsForm::field( $data_name . '[' . $item['id'] . ']', $checked, 'boolean', [ |
| 246 | 'boolean_yes_label' => $item['name'] . ( ! empty( $item['label'] ) ? ' (' . $item['label'] . ')' : '' ), |
| 247 | 'disable_dfv' => true, |
| 248 | ] ); |
| 249 | ?> |
| 250 | </li> |
| 251 | <?php |
| 252 | } |
| 253 | ?> |
| 254 | </ul> |
| 255 | </div> |
| 256 | </div> |
| 257 | </div> |
| 258 | </div> |
| 259 | <?php |
| 260 | }//end if |
| 261 | |
| 262 | if ( ! empty( $pod_pages ) ) { |
| 263 | $data = $pod_pages; |
| 264 | $data_name = 'pages'; |
| 265 | ?> |
| 266 | <div class="stuffbox pods-package-import-group"> |
| 267 | <h3> |
| 268 | <label for="link_name"><?php esc_html_e( 'Choose which Pod Pages to export', 'pods' ); ?></label> |
| 269 | </h3> |
| 270 | |
| 271 | <div class="inside pods-manage-field pods-dependency"> |
| 272 | <div class="pods-field-option-group"> |
| 273 | <div class="pods-pick-values pods-pick-checkbox pods-zebra"> |
| 274 | <p> |
| 275 | <a href="#toggle" class="button pods-wizard-toggle-all" data-toggle="<?php echo esc_attr( $data_name ); ?>"><?php esc_html_e( 'Toggle all on / off', 'pods' ); ?></a> |
| 276 | </p> |
| 277 | |
| 278 | <ul> |
| 279 | <?php |
| 280 | $zebra = false; |
| 281 | |
| 282 | foreach ( $data as $item ) { |
| 283 | $checked = true; |
| 284 | |
| 285 | $class = ( $zebra ? 'even' : 'odd' ); |
| 286 | |
| 287 | $zebra = ( ! $zebra ); |
| 288 | ?> |
| 289 | <li class="pods-zebra-<?php echo esc_attr( $class ); ?>"> |
| 290 | <?php |
| 291 | echo PodsForm::field( $data_name . '[' . $item['id'] . ']', $checked, 'boolean', [ |
| 292 | 'boolean_yes_label' => $item['name'] . ( ! empty( $item['label'] ) ? ' (' . $item['label'] . ')' : '' ), |
| 293 | 'disable_dfv' => true, |
| 294 | ] ); |
| 295 | ?> |
| 296 | </li> |
| 297 | <?php |
| 298 | } |
| 299 | ?> |
| 300 | </ul> |
| 301 | </div> |
| 302 | </div> |
| 303 | </div> |
| 304 | </div> |
| 305 | <?php |
| 306 | }//end if |
| 307 | |
| 308 | do_action( 'pods_packages_export_options', $pods, $pod_templates, $pod_pages, [] ); |
| 309 | ?> |
| 310 | </div> |
| 311 | |
| 312 | <span id="import-export"></span> |
| 313 | |
| 314 | <div class="stuffbox hidden" id="pods-import-results"> |
| 315 | <h3><?php esc_html_e( 'Imported Package', 'pods' ); ?></h3> |
| 316 | |
| 317 | <div class="inside pods-manage-field pods-dependency"> |
| 318 | <div class="pods-wizard-results"></div> |
| 319 | </div> |
| 320 | </div> |
| 321 | |
| 322 | <div class="stuffbox hidden" id="pods-export-results"> |
| 323 | <h3><?php esc_html_e( 'Exported Package', 'pods' ); ?></h3> |
| 324 | |
| 325 | <div class="inside pods-manage-field pods-dependency"> |
| 326 | <p> |
| 327 | <button id="pods-wizard-export-download" class="button button-secondary"><?php esc_html_e( 'Download pods-package.json', 'pods' ); ?></button> |
| 328 | <button id="pods-wizard-export-copy" class="button button-secondary"><?php esc_html_e( 'Copy the Package JSON', 'pods' ); ?></button> |
| 329 | </p> |
| 330 | |
| 331 | <div class="pods-wizard-results"></div> |
| 332 | </div> |
| 333 | </div> |
| 334 | </div> |
| 335 | |
| 336 | <div id="pods-wizard-actions" class="pods-wizard-button-interface"> |
| 337 | <div id="pods-wizard-toolbar"> |
| 338 | <button id="pods-wizard-start" class="button button-secondary hidden"><?php esc_html_e( 'Start Over', 'pods' ); ?></button> |
| 339 | <button id="pods-wizard-next" class="button button-primary hidden" data-again="<?php esc_attr_e( 'Process Again', 'pods' ); ?>" data-next="<?php esc_attr_e( 'Continue', 'pods' ); ?>" data-finished="<?php esc_attr_e( 'Finished', 'pods' ); ?>" data-processing="<?php esc_attr_e( 'Processing', 'pods' ); ?>.."><?php esc_html_e( 'Continue', 'pods' ); ?></button> |
| 340 | </div> |
| 341 | <div id="pods-wizard-finished"> |
| 342 | |
| 343 | </div> |
| 344 | </div> |
| 345 | </div> |
| 346 | </div> |
| 347 | </div> |
| 348 | </form> |
| 349 | </div> |
| 350 | |
| 351 | <script type="text/javascript"> |
| 352 | const $pods_admin_package_import_export = jQuery( '#pods-form-ui-import-export' ); |
| 353 | const $pods_admin_package_import_results = jQuery( '#pods-import-results' ); |
| 354 | const $pods_admin_package_export_results = jQuery( '#pods-export-results' ); |
| 355 | |
| 356 | var pods_admin_wizard_callback = function ( step, completed ) { |
| 357 | if ( 2 == step || !step ) { |
| 358 | $pods_admin_package_import_results.slideUp( 'fast', function () { |
| 359 | jQuery( 'div.pods-wizard-results', $pods_admin_package_import_results ).html( '' ); |
| 360 | } ); |
| 361 | |
| 362 | $pods_admin_package_export_results.slideUp( 'fast', function () { |
| 363 | jQuery( 'div.pods-wizard-results', $pods_admin_package_export_results ).html( '' ); |
| 364 | } ); |
| 365 | } |
| 366 | |
| 367 | return true; |
| 368 | }; |
| 369 | |
| 370 | var pods_admin_submit_callback = function ( id ) { |
| 371 | jQuery( '#pods-wizard-next' ).css( 'cursor', 'pointer' ); |
| 372 | jQuery( '#pods-wizard-next' ).prop( 'disabled', false ); |
| 373 | jQuery( '#pods-wizard-next' ).text( jQuery( '#pods-wizard-next' ).data( 'again' ) ); |
| 374 | |
| 375 | window.location.hash = 'import-export'; |
| 376 | |
| 377 | if ( 'export' === $pods_admin_package_import_export.val() ) { |
| 378 | jQuery( 'div.pods-wizard-results', $pods_admin_package_export_results ).html( id ); |
| 379 | $pods_admin_package_export_results.slideDown( 'fast' ); |
| 380 | } else { |
| 381 | jQuery( 'div.pods-wizard-results', $pods_admin_package_import_results ).html( id ); |
| 382 | $pods_admin_package_import_results.slideDown( 'fast' ); |
| 383 | } |
| 384 | |
| 385 | return false; |
| 386 | }; |
| 387 | |
| 388 | var pods_admin_option_select_callback = function ( $opt ) { |
| 389 | $pods_admin_package_import_export.val( $opt.data( 'opt' ) ); |
| 390 | jQuery( '#pods-wizard-next' ).show().removeClass( 'hidden' ); |
| 391 | }; |
| 392 | |
| 393 | var pods_admin_wizard_startover_callback = function () { |
| 394 | $pods_admin_package_import_results.hide(); |
| 395 | jQuery( 'div.pods-wizard-results', $pods_admin_package_import_results ).html( '' ); |
| 396 | |
| 397 | $pods_admin_package_export_results.hide(); |
| 398 | jQuery( 'div.pods-wizard-results', $pods_admin_package_export_results ).html( '' ); |
| 399 | }; |
| 400 | |
| 401 | const $pods_admin_package_import_package_code = jQuery( '#pods-form-ui-import-package' ); |
| 402 | const $pods_admin_package_import_package_file = jQuery( '#pods-form-ui-import-package-file' ); |
| 403 | |
| 404 | let pods_admin_submit_validation = function ( valid_form ) { |
| 405 | if ( ! valid_form || 'import' !== $pods_admin_package_import_export.val() ) { |
| 406 | return valid_form; |
| 407 | } |
| 408 | |
| 409 | // Check for at least one of these. |
| 410 | return ( |
| 411 | '' !== $pods_admin_package_import_package_code.val() |
| 412 | || '' !== $pods_admin_package_import_package_file.val() |
| 413 | ); |
| 414 | }; |
| 415 | |
| 416 | jQuery( function ( $ ) { |
| 417 | $( document ).Pods( 'validate' ); |
| 418 | $( document ).Pods( 'submit' ); |
| 419 | $( document ).Pods( 'wizard' ); |
| 420 | $( document ).Pods( 'dependency' ); |
| 421 | $( document ).Pods( 'advanced' ); |
| 422 | $( document ).Pods( 'confirm' ); |
| 423 | $( document ).Pods( 'sluggable' ); |
| 424 | |
| 425 | const toggle_all = { |
| 426 | all: true |
| 427 | }; |
| 428 | |
| 429 | $( '.pods-wizard-toggle-all' ).on( 'click', function ( e ) { |
| 430 | e.preventDefault(); |
| 431 | |
| 432 | const toggleData = $( this ).data( 'toggle' ); |
| 433 | |
| 434 | if ( 'undefined' == typeof toggle_all[toggleData] ) { |
| 435 | toggle_all[toggleData] = true; |
| 436 | } |
| 437 | |
| 438 | let $parent; |
| 439 | |
| 440 | if ( 'all' !== toggleData ) { |
| 441 | $parent = $( this ).closest( '.pods-field-option-group' ); |
| 442 | } else { |
| 443 | $parent = $( this ).closest( '.pods-wizard-option-content' ); |
| 444 | } |
| 445 | |
| 446 | $parent.find( '.pods-field.pods-boolean input[type="checkbox"]' ).prop( 'checked', (!toggle_all[toggleData]) ); |
| 447 | |
| 448 | toggle_all[toggleData] = (!toggle_all[toggleData]); |
| 449 | } ); |
| 450 | |
| 451 | const $import_package_reset = $( '#pods-form-ui-import-package-file-reset' ); |
| 452 | const $import_package_code_parent = $pods_admin_package_import_package_code.parent(); |
| 453 | |
| 454 | $pods_admin_package_import_package_file.on( 'change', function( e ) { |
| 455 | if ( ! e.target.files[0] ) { |
| 456 | $pods_admin_package_import_package_code.prop( 'readonly', false ); |
| 457 | $pods_admin_package_import_package_code.prop( 'disabled', false ); |
| 458 | $import_package_reset.prop( 'aria-hidden', true ); |
| 459 | $import_package_reset.addClass( 'hidden' ); |
| 460 | $import_package_code_parent.show(); |
| 461 | |
| 462 | return; |
| 463 | } |
| 464 | |
| 465 | $pods_admin_package_import_package_code.val( '' ); |
| 466 | $pods_admin_package_import_package_code.prop( 'readonly', true ); |
| 467 | $pods_admin_package_import_package_code.prop( 'disabled', true ); |
| 468 | $import_package_reset.prop( 'aria-hidden', false ); |
| 469 | $import_package_reset.removeClass( 'hidden' ); |
| 470 | $import_package_code_parent.hide(); |
| 471 | } ); |
| 472 | |
| 473 | $import_package_reset.on( 'click', function() { |
| 474 | $pods_admin_package_import_package_file.val( '' ); |
| 475 | $pods_admin_package_import_package_file.change(); |
| 476 | } ); |
| 477 | |
| 478 | const $export_results = $( 'div.pods-wizard-results', $pods_admin_package_export_results ); |
| 479 | |
| 480 | $( '#pods-wizard-export-copy' ).on( 'click', function( e ) { |
| 481 | e.preventDefault(); |
| 482 | |
| 483 | const $export_textarea = $( 'textarea', $export_results ); |
| 484 | const packageData = $export_textarea; |
| 485 | |
| 486 | $export_textarea.select(); |
| 487 | |
| 488 | document.execCommand( 'copy' ); |
| 489 | } ); |
| 490 | |
| 491 | $( '#pods-wizard-export-download' ).on( 'click', function( e ) { |
| 492 | e.preventDefault(); |
| 493 | |
| 494 | const packageData = $( 'textarea', $export_results ).val(); |
| 495 | const fileName = 'pods-package-' + new Date().toISOString().split( 'T' )[0] + '.json'; |
| 496 | const fileType = 'application/json;charset=utf-8'; |
| 497 | const fileContent = new Blob( [ packageData ], { type: fileType } ); |
| 498 | |
| 499 | try { |
| 500 | saveAs( fileContent, fileName ); |
| 501 | } catch( e ) { |
| 502 | window.open( 'data:' + fileType + ',' + encodeURIComponent( fileContent ), '_blank', '' ); |
| 503 | } |
| 504 | } ); |
| 505 | } ); |
| 506 | </script> |
| 507 |