custom-tags.php
2 weeks ago
email-template-editor.php
2 years ago
email-template-settings.php
5 months ago
emails-template.php
4 years ago
header.php
3 years ago
import-template.php
5 years ago
list-templates.php
2 weeks ago
templates.php
2 weeks ago
templates.php
253 lines
| 1 | <?php |
| 2 | |
| 3 | if(!defined("ABSPATH")) die(); |
| 4 | ?> |
| 5 | |
| 6 | <div class="wrap w3eden"> |
| 7 | |
| 8 | |
| 9 | <?php |
| 10 | |
| 11 | require_once __DIR__.'/header.php'; |
| 12 | |
| 13 | |
| 14 | |
| 15 | //List link, page and emaol templates |
| 16 | require_once __DIR__.'/list-templates.php'; |
| 17 | |
| 18 | require_once __DIR__.'/email-template-settings.php'; |
| 19 | |
| 20 | ?> |
| 21 | |
| 22 | |
| 23 | </div> |
| 24 | |
| 25 | |
| 26 | |
| 27 | <style> |
| 28 | #tagstable td{ vertical-align: top; } |
| 29 | div.notice, .updated{ display: none; } |
| 30 | .xbubble |
| 31 | { |
| 32 | position: relative; |
| 33 | padding: 10px; |
| 34 | background: #eeeeee; |
| 35 | -webkit-border-radius: 3px; |
| 36 | -moz-border-radius: 3px; |
| 37 | border-radius: 3px; |
| 38 | } |
| 39 | |
| 40 | .xbubble:after |
| 41 | { |
| 42 | content: ''; |
| 43 | position: absolute; |
| 44 | border-style: solid; |
| 45 | border-width: 0 10px 10px; |
| 46 | border-color: #eeeeee transparent; |
| 47 | display: block; |
| 48 | width: 0; |
| 49 | z-index: 1; |
| 50 | top: -10px; |
| 51 | left: 17px; |
| 52 | } |
| 53 | .w3ebselect{ |
| 54 | padding: 2px; |
| 55 | border-radius: 2px; |
| 56 | background: #ffffff; |
| 57 | cursor: pointer; |
| 58 | } |
| 59 | |
| 60 | .w3econtainer { |
| 61 | border: 3px solid #333; |
| 62 | border-radius: 4px; |
| 63 | background: #333; |
| 64 | } |
| 65 | |
| 66 | /* Container for columns and the top "toolbar" */ |
| 67 | .w3erow { |
| 68 | padding: 7px 10px 10px; |
| 69 | background: #333; |
| 70 | color: #8db4b6; |
| 71 | letter-spacing: 0.5px; |
| 72 | font-size: 10px; |
| 73 | font-weight: 400; |
| 74 | } |
| 75 | |
| 76 | /* Create three unequal columns that floats next to each other */ |
| 77 | .w3ecolumn { |
| 78 | float: left; |
| 79 | } |
| 80 | |
| 81 | .w3eleft { |
| 82 | width: 60px; |
| 83 | } |
| 84 | |
| 85 | .w3eright { |
| 86 | width: 10%; |
| 87 | } |
| 88 | |
| 89 | .w3emiddle { |
| 90 | width: calc(90% - 60px); |
| 91 | } |
| 92 | |
| 93 | /* Clear floats after the columns */ |
| 94 | .w3erow:after { |
| 95 | content: ""; |
| 96 | display: table; |
| 97 | clear: both; |
| 98 | } |
| 99 | |
| 100 | /* Three dots */ |
| 101 | .w3edot { |
| 102 | margin-top: 4px; |
| 103 | height: 12px; |
| 104 | width: 12px; |
| 105 | background-color: #bbb; |
| 106 | border-radius: 50%; |
| 107 | display: inline-block; |
| 108 | } |
| 109 | |
| 110 | /* Style the input field */ |
| 111 | input[type=text].w3e { |
| 112 | width: 100%; |
| 113 | border-radius: 3px; |
| 114 | border: none; |
| 115 | background-color: white; |
| 116 | margin-top: -8px; |
| 117 | height: 25px; |
| 118 | color: #666; |
| 119 | padding: 5px; |
| 120 | } |
| 121 | |
| 122 | /* Three bars (hamburger menu) */ |
| 123 | .w3ebar { |
| 124 | width: 17px; |
| 125 | height: 3px; |
| 126 | background-color: #aaa; |
| 127 | margin: 3px 0; |
| 128 | display: block; |
| 129 | } |
| 130 | |
| 131 | /* Page content */ |
| 132 | .w3econtent { |
| 133 | padding: 0; |
| 134 | margin-bottom: -4px; |
| 135 | } |
| 136 | .btn-group .btn-status input{ |
| 137 | display: none; |
| 138 | } |
| 139 | |
| 140 | </style> |
| 141 | <script> |
| 142 | |
| 143 | jQuery(function($){ |
| 144 | $('.bselect').click(function(){ |
| 145 | $('#banner-url').val(this.src); |
| 146 | }); |
| 147 | <?php if(isset($ttype)) { ?> |
| 148 | $('body').on('click', '.template_preview', function(e){ |
| 149 | e.preventDefault(); |
| 150 | WPDM.dialog.ajax('<?php echo esc_js(__( "Template Preview" , "download-manager" )); ?>', $(this).attr('data-href'), { size: 'lg', icon: false }); |
| 151 | }); |
| 152 | $('#etmpl').on('change', function () { |
| 153 | $('#preview').attr('src', 'edit.php?action=email_template_preview&id=user-signup&etmpl='+$(this).val()+"&__empnonce=<?php echo wp_create_nonce(WPDM_PRI_NONCE); ?>"); |
| 154 | $('#etplname').html($(this).val()); |
| 155 | }); |
| 156 | $('#etplname').html($('#etmpl').val()); |
| 157 | $('#emlstform').submit(function (e) { |
| 158 | e.preventDefault(); |
| 159 | $('#emsbtn').html('<i class="fa fa-sync fa-spin"></i> <?php _e( "Saving..." , "download-manager" ); ?>'); |
| 160 | $(this).ajaxSubmit({ |
| 161 | url: ajaxurl+"?action=wpdm_save_email_setting", |
| 162 | success: function (res) { |
| 163 | $('#emsbtn').html('<i class="fas fa-hdd"></i> <?php _e( "Save Changes" , "download-manager" ); ?>'); |
| 164 | document.getElementById('preview').contentDocument.location.reload(true); |
| 165 | } |
| 166 | }); |
| 167 | }); |
| 168 | |
| 169 | $('.btn-status').on('click', function () { |
| 170 | var v = $(this).data('value'); |
| 171 | var c = '.'+$(this).data('id'); |
| 172 | var $this = this; |
| 173 | $.post(ajaxurl, {action: 'update_template_status', template: $(this).data('id'), type: '<?php echo $ttype; ?>', status: v, tsnonce: '<?php echo wp_create_nonce(WPDM_PRI_NONCE) ?>'}, function (res) { |
| 174 | $(c).removeClass('btn-danger').removeClass('btn-success').addClass('btn-secondary'); |
| 175 | if(v==1) |
| 176 | $($this).addClass('btn-success').removeClass('btn-secondary'); |
| 177 | else |
| 178 | $($this).addClass('btn-danger').removeClass('btn-secondary'); |
| 179 | }); |
| 180 | |
| 181 | |
| 182 | }); |
| 183 | |
| 184 | |
| 185 | <?php } ?> |
| 186 | // Open the New/Edit Tag form inside a WPDM dialog |
| 187 | function wpdmOpenTagDialog(){ |
| 188 | var tpl = document.getElementById('newtagmodal-tpl'); |
| 189 | WPDM.dialog.show({ |
| 190 | title: '<?php echo esc_js(__( "New Tag" , "download-manager" )); ?>', |
| 191 | content: tpl.innerHTML, |
| 192 | size: 'md', |
| 193 | icon: false, |
| 194 | backdrop: 'static' |
| 195 | }); |
| 196 | } |
| 197 | |
| 198 | $('body').on('click', '.add-new-tag', function (e) { |
| 199 | e.preventDefault(); |
| 200 | wpdmOpenTagDialog(); |
| 201 | }); |
| 202 | |
| 203 | $('body').on('submit', '#newtagform', function (e) { |
| 204 | e.preventDefault(); |
| 205 | var $form = $(this); |
| 206 | var obtnlbl = $('#newtagformsubmit').html(); |
| 207 | $('#newtagformsubmit').html("<i class='fa fa-sun fa-spin'></i>").attr('disabled', 'disabled'); |
| 208 | $form.ajaxSubmit({ |
| 209 | url: ajaxurl, |
| 210 | resetForm: true, |
| 211 | success: function (response) { |
| 212 | $('#newtagformsubmit').html(obtnlbl).removeAttr('disabled'); |
| 213 | $('#row_'+response.name).hide(); |
| 214 | $('#tagstable tbody').append( |
| 215 | ' <tr id="row_'+response.name+'">\n' + |
| 216 | ' <td>['+response.name+']</td>\n' + |
| 217 | ' <td><pre style="background: #ffffff;border-radius: 3px;font-size: 10px">'+response.value+'</pre></td>\n' + |
| 218 | ' <td style="width: 220px">\n' + |
| 219 | ' <a href="#" class="btn btn-info tag-edit" data-tag="'+response.name+'"><?php _e("Edit", "download-manager"); ?></a>\n' + |
| 220 | ' <a href="#" class="btn btn-danger tag-delete" data-tag="'+response.name+'"><?php _e("Delete", "download-manager"); ?></a>\n' + |
| 221 | ' </td>\n' + |
| 222 | ' </tr>' |
| 223 | ); |
| 224 | $form.closest('.wpdm-dialog-wrapper').find('.wpdm-dialog__close').trigger('click'); |
| 225 | } |
| 226 | }); |
| 227 | }); |
| 228 | $('body').on('click', '.tag-edit', function () { |
| 229 | var tag = $(this).data('tag'); |
| 230 | wpdmOpenTagDialog(); |
| 231 | WPDM.blockUI('#newtagform'); |
| 232 | $.get(ajaxurl, {tag: tag, action: 'wpdm_edit_custom_tag'}, function (response) { |
| 233 | $('#tag_name').val(response.name); |
| 234 | $('#tag_value').val(response.value); |
| 235 | WPDM.unblockUI('#newtagform'); |
| 236 | }) |
| 237 | }); |
| 238 | $('body').on('click', '.tag-delete', function (e) { |
| 239 | e.preventDefault(); |
| 240 | if(!confirm('<?php echo __( "Are you sure?", "download-manager" ); ?>')) return false; |
| 241 | var tag = $(this).data('tag'); |
| 242 | $.get(ajaxurl, {tag: $(this).data('tag'), action: 'wpdm_delete_custom_tag'}, function (response) { |
| 243 | $('#row_'+tag).hide(); |
| 244 | }) |
| 245 | }); |
| 246 | }); |
| 247 | |
| 248 | </script> |
| 249 | </div> |
| 250 | |
| 251 | |
| 252 | |
| 253 |