| 1 |
<div class="export-import-wrap"> |
| 2 |
|
| 3 |
<h2 class="nav-tab-wrapper"> |
| 4 |
<a :class="['nav-tab', isActiveTab( 'export' ) ? 'nav-tab-active' : '']" href="#" v-on:click.prevent="makeActive('export')"><?php _e( 'Export', 'wpuf' ); ?></a> |
| 5 |
<a :class="['nav-tab', isActiveTab( 'import' ) ? 'nav-tab-active' : '']" href="#" v-on:click.prevent="makeActive('import')"><?php _e( 'Import', 'wpuf' ); ?></a> |
| 6 |
<a :class="['nav-tab', isActiveTab( 'logs' ) ? 'nav-tab-active' : '']" href="#" v-on:click.prevent="makeActive('logs')"><?php _e( 'Logs', 'wpuf' ); ?></a> |
| 7 |
</h2> |
| 8 |
|
| 9 |
<div class="nav-tab-content"> |
| 10 |
<div class="nav-tab-inside" v-show="isActiveTab('export')"> |
| 11 |
<h3><?php _e( 'Export Utility', 'weforms' ); ?></h3> |
| 12 |
|
| 13 |
<p><?php _e( 'You can export your form, as well as exporting the submitted entries by the users', 'weforms' ); ?></p> |
| 14 |
|
| 15 |
<div class="postboxes metabox-holder two-col"> |
| 16 |
<div class="postbox"> |
| 17 |
<h3 class="hndle"><?php _e( 'Export Forms', 'weforms' ); ?></h3> |
| 18 |
|
| 19 |
<div class="inside"> |
| 20 |
<p class="help"> |
| 21 |
<?php _e( 'You can export your existing contact forms and import the same forms into a different site.', 'weforms' ); ?> |
| 22 |
</p> |
| 23 |
|
| 24 |
<template v-if="!loading"> |
| 25 |
<form action="admin-post.php?action=weforms_export_forms" method="post"> |
| 26 |
<p><label><input v-model="exportType" type="radio" name="export_type" value="all" checked> <?php _e( 'All Forms', 'weforms' ); ?></label></p> |
| 27 |
<p><label><input v-model="exportType" type="radio" name="export_type" value="selected"> <?php _e( 'Selected Forms', 'weforms' ); ?></label></p> |
| 28 |
<p v-show="exportType == 'selected'"> |
| 29 |
<select name="selected_forms[]" class="forms-list" multiple="multiple"> |
| 30 |
<option v-for="entry in forms" :value="entry.id">{{ entry.title }}</option> |
| 31 |
</select> |
| 32 |
</p> |
| 33 |
|
| 34 |
<?php wp_nonce_field( 'weforms-export-forms' ); ?> |
| 35 |
<input type="submit" class="button button-primary" name="weforms_export_forms" value="<?php _e( 'Export Forms', 'weforms' ); ?>"> |
| 36 |
</form> |
| 37 |
</template> |
| 38 |
<template v-else> |
| 39 |
<div class="spinner loading-spinner is-active"></div> |
| 40 |
</template> |
| 41 |
</div> |
| 42 |
</div><!-- .postbox --> |
| 43 |
|
| 44 |
<div class="postbox"> |
| 45 |
<h3 class="hndle"><?php _e( 'Export Form Entries', 'weforms' ); ?></h3> |
| 46 |
|
| 47 |
<div class="inside"> |
| 48 |
<p class="help"> |
| 49 |
<?php _e( 'Export your form entries/submissions as a <strong>CSV</strong> file.', 'weforms' ); ?> |
| 50 |
</p> |
| 51 |
|
| 52 |
<template v-if="!loading"> |
| 53 |
<form action="admin-post.php?action=weforms_export_form_entries" method="post"> |
| 54 |
<p> |
| 55 |
<select name="selected_forms" class="forms-list"> |
| 56 |
<option value=""><?php _e( '— Select Form —', 'weforms' ); ?></option> |
| 57 |
<option v-for="entry in forms" :value="entry.id">{{ entry.title }}</option> |
| 58 |
</select> |
| 59 |
</p> |
| 60 |
|
| 61 |
<?php wp_nonce_field( 'weforms-export-entries' ); ?> |
| 62 |
<input type="submit" class="button button-primary" name="weforms_export_entries" value="<?php _e( 'Export Entries', 'weforms' ); ?>"> |
| 63 |
</form> |
| 64 |
</template> |
| 65 |
<template v-else> |
| 66 |
<div class="spinner loading-spinner is-active"></div> |
| 67 |
</template> |
| 68 |
</div> |
| 69 |
</div><!-- .postbox --> |
| 70 |
</div> |
| 71 |
</div> |
| 72 |
|
| 73 |
<div class="nav-tab-inside" v-show="isActiveTab('import')"> |
| 74 |
<h3><?php _e( 'Import Contact Form', 'weforms' ); ?></h3> |
| 75 |
|
| 76 |
<p><?php _e( 'Browse and locate a json file you backed up before.', 'weforms' ); ?></p> |
| 77 |
<p><?php _e( 'Press <strong>Import</strong> button, we will do the rest for you.', 'weforms' ); ?></p> |
| 78 |
|
| 79 |
<div class="updated-message notice notice-success is-dismissible" v-if="isSuccess"> |
| 80 |
<p>{{ responseMessage }}</p> |
| 81 |
|
| 82 |
<button type="button" class="notice-dismiss" v-on:click="currentStatus = 0"> |
| 83 |
<span class="screen-reader-text"><?php _e( 'Dismiss this notice.', 'weforms' ); ?></span> |
| 84 |
</button> |
| 85 |
</div> |
| 86 |
|
| 87 |
<div class="update-message notice notice-error is-dismissible" v-if="isFailed"> |
| 88 |
<p>{{ responseMessage }}</p> |
| 89 |
|
| 90 |
<button type="button" class="notice-dismiss" v-on:click="currentStatus = 0"> |
| 91 |
<span class="screen-reader-text"><?php _e( 'Dismiss this notice.', 'weforms' ); ?></span> |
| 92 |
</button> |
| 93 |
</div> |
| 94 |
|
| 95 |
<form action="" method="post" enctype="multipart/form-data" style="margin-top: 20px;"> |
| 96 |
<input type="file" name="importFile" v-on:change="importForm( $event.target.name, $event.target.files, $event )" accept="application/json" /> |
| 97 |
<button type="submit" :class="['button', isSaving ? 'updating-message' : '']" disabled="disabled">{{ importButton }}</button> |
| 98 |
</form> |
| 99 |
|
| 100 |
<hr> |
| 101 |
<h3><?php _e( 'Import Other Forms', 'weforms' ); ?></h3> |
| 102 |
<p><?php _e( 'You can import other WordPress form plugins into weForms.', 'weforms' ); ?></p> |
| 103 |
|
| 104 |
<div class="updated" v-if="ximport.title"> |
| 105 |
<p><strong>{{ ximport.title }}</strong></p> |
| 106 |
|
| 107 |
<p>{{ ximport.message }}</p> |
| 108 |
<p>{{ ximport.action }}</p> |
| 109 |
|
| 110 |
<ul v-if="hasRefs"> |
| 111 |
<li v-for="ref in ximport.refs"> |
| 112 |
<a target="_blank" :href="'admin.php?page=weforms#/form/' + ref.weforms_id + '/edit'">{{ ref.title }}</a> - <a :href="'admin.php?page=weforms#/form/' + ref.weforms_id + '/edit'" target="_blank" class="button button-small"><span class="dashicons dashicons-external"></span> <?php _e( 'Edit', 'weforms' ); ?></a> |
| 113 |
</li> |
| 114 |
</ul> |
| 115 |
|
| 116 |
<p> |
| 117 |
<a href="#" class="button button-primary" @click.prevent="replaceX($event.target, 'replace')"><?php _e( 'Replace Shortcodes', 'weforms' ); ?></a> |
| 118 |
<a href="#" class="button" @click.prevent="replaceX($event.target, 'skip')"><?php _e( 'No Thanks', 'weforms' ); ?></a> |
| 119 |
</p> |
| 120 |
</div> |
| 121 |
|
| 122 |
|
| 123 |
<table style="min-width: 500px;"> |
| 124 |
<tbody> |
| 125 |
<tr> |
| 126 |
<td><?php _e( 'Contact Form 7', 'weforms' ); ?></td> |
| 127 |
<th><button class="button" @click.prevent="importx($event.target, 'cf7')" data-importing="<?php esc_attr_e( 'Importing...', 'weforms' ); ?>" data-original="<?php esc_attr_e( 'Import', 'weforms' ); ?>"><?php _e( 'Import', 'weforms' ); ?></button></th> |
| 128 |
</tr> |
| 129 |
<tr> |
| 130 |
<td><?php _e( 'Ninja Forms', 'weforms' ); ?></td> |
| 131 |
<th><button class="button" @click.prevent="importx($event.target, 'nf')" data-importing="<?php esc_attr_e( 'Importing...', 'weforms' ); ?>" data-original="<?php esc_attr_e( 'Import', 'weforms' ); ?>"><?php _e( 'Import', 'weforms' ); ?></button></th> |
| 132 |
</tr> |
| 133 |
<tr> |
| 134 |
<td><?php _e( 'Caldera Forms', 'weforms' ); ?></td> |
| 135 |
<th><button class="button" @click.prevent="importx($event.target, 'caldera-forms')" data-importing="<?php esc_attr_e( 'Importing...', 'weforms' ); ?>" data-original="<?php esc_attr_e( 'Import', 'weforms' ); ?>"><?php _e( 'Import', 'weforms' ); ?></button></th> |
| 136 |
</tr> |
| 137 |
<tr> |
| 138 |
<td><?php _e( 'Gravity Forms', 'weforms' ); ?></td> |
| 139 |
<th><button class="button" @click.prevent="importx($event.target, 'gf')" data-importing="<?php esc_attr_e( 'Importing...', 'weforms' ); ?>" data-original="<?php esc_attr_e( 'Import', 'weforms' ); ?>"><?php _e( 'Import', 'weforms' ); ?></button></th> |
| 140 |
</tr> |
| 141 |
<tr> |
| 142 |
<td><?php _e( 'WP Forms', 'weforms' ); ?></td> |
| 143 |
<th><button class="button" @click.prevent="importx($event.target, 'wpforms')" data-importing="<?php esc_attr_e( 'Importing...', 'weforms' ); ?>" data-original="<?php esc_attr_e( 'Import', 'weforms' ); ?>"><?php _e( 'Import', 'weforms' ); ?></button></th> |
| 144 |
</tr> |
| 145 |
</tbody> |
| 146 |
</table> |
| 147 |
</div> |
| 148 |
|
| 149 |
<div class="nav-tab-inside" v-show="isActiveTab('logs')"> |
| 150 |
<h3> |
| 151 |
<?php _e( 'Logs', 'weforms' ); ?> |
| 152 |
|
| 153 |
<span class="pull-right"> |
| 154 |
|
| 155 |
<button class="button button-large button-secondary" @click.prevent="fetchLogs($event.target)"> |
| 156 |
<span style="margin-top: 4px" class="dashicons dashicons-image-rotate"></span> Reload |
| 157 |
</button> |
| 158 |
|
| 159 |
<button class="button button-large button-secondary" @click.prevent="deleteLogs($event.target)" v-if="hasLogs"> |
| 160 |
<span style="margin-top: 4px" class="dashicons dashicons-trash"></span> Delete |
| 161 |
</button> |
| 162 |
</span> |
| 163 |
</h3> |
| 164 |
|
| 165 |
<table class="wp-list-table widefat fixed striped wpuf-contact-form" v-if="hasLogs"> |
| 166 |
<thead> |
| 167 |
<tr> |
| 168 |
<th style="width: 10%"> Type </th> |
| 169 |
<th style="width: 15%"> Time </th> |
| 170 |
<th style="width: 75%"> Details </th> </tr> |
| 171 |
</thead> |
| 172 |
<tbody> |
| 173 |
<tr v-for="log in logs"> |
| 174 |
<td> <span> {{ log.type }} </span> </td> |
| 175 |
<td> <span> {{ log.time }} </span> </td> |
| 176 |
<td> {{ log.message }} </td> |
| 177 |
</tr> |
| 178 |
</tbody> |
| 179 |
</table> |
| 180 |
<div v-else> |
| 181 |
<p><?php _e( 'No logs found. If any error occurs during an action. Those will be displayed here.', 'weforms' ); ?></p> |
| 182 |
</div> |
| 183 |
</div> |
| 184 |
</div> |
| 185 |
</div> |
| 186 |
|