Plugin Directory

Changeset 3148231


Ignore:
Timestamp:
09/08/2024 04:13:21 PM (19 months ago)
Author:
loncar
Message:

New version 3.12.1

Location:
easy-appointments/trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • easy-appointments/trunk/js/admin.prod.js

    r3029121 r3148231  
    9999            "click .select-label-option": "changeSelectLabelStyle",
    100100            "click .btn-gdpr-delete-data": "gdprDeleteData",
     101            "click #load-default-admin-template": "loadDefaultTemplate"
    101102        },
    102103
     
    209210            // process new content
    210211            var $newTemplate = jQuery(event.target);
    211             var newContent = this.$el.find($newTemplate.data('textarea')).val();
     212            var elemId = $newTemplate.data('textarea');
     213
     214            var newContent = this.$el.find(elemId).val();
    212215
    213216            if (this.tinymceOn) {
     
    220223            }
    221224
     225            if (elemId === '#mail-admin') {
     226                // show load admin template button
     227                this.$el.find('#load-default-admin-template').show();
     228            } else {
     229                // hide admin template button
     230                this.$el.find('#load-default-admin-template').hide();
     231            }
     232
    222233            this.$el.find('.mail-tab').filter('.selected').removeClass('selected');
    223234            $newTemplate.addClass('selected');
     235        },
     236
     237        loadDefaultTemplate: function () {
     238            // wp_ajax_ea_default_template
     239            var endpoint = ajaxurl + '?action=ea_default_template&_wpnonce=' + wpApiSettings.nonce;
     240            var tiny = this.tinymceOn;
     241            var $el = this.$el;
     242
     243            jQuery.ajax({
     244                url: endpoint,
     245                type: 'GET',
     246                success: function(content) {
     247                    if (tiny) {
     248                        tinymce.get('mail-template').setContent(content);
     249                        // clear the stack of undo
     250                        tinymce.activeEditor.undoManager.clear();
     251                        return;
     252                    }
     253
     254                    $el.find('#mail-template').val(newContent);
     255                }
     256            });
    224257        },
    225258
     
    227260            var prevContent = '';
    228261            var $prevTemplate = this.$el.find('.mail-tab').filter('.selected');
     262
    229263            if (this.tinymceOn) {
    230264                prevContent = tinymce.get('mail-template').getContent();
     
    232266                prevContent = this.$el.find('#mail-template').val();
    233267            }
     268
    234269            this.$el.find($prevTemplate.data('textarea')).val(prevContent);
    235270        },
  • easy-appointments/trunk/main.php

    r3147273 r3148231  
    55 * Plugin URI: https://easy-appointments.com/
    66 * Description: Simple and easy to use management system for Appointments and Bookings
    7  * Version: 3.12.0
     7 * Version: 3.12.1
    88 * Requires PHP: 5.3
    99 * Author: Nikola Loncar
     
    2222 * Currently plugin version.
    2323 */
    24 define( 'EASY_APPOINTMENTS_VERSION', '3.12.0' );
     24define( 'EASY_APPOINTMENTS_VERSION', '3.12.1' );
    2525
    2626// path for source files
  • easy-appointments/trunk/readme.txt

    r3147273 r3148231  
    66Tested up to: 6.6
    77Requires PHP: 5.3
    8 Stable tag: 3.12.0
     8Stable tag: 3.12.1
    99License: GPLv2
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    214214== Changelog ==
    215215
     216= 3.12.1 (2024-09-08) =
     217* Added new option to load default Admin email template to mail editor
     218
    216219= 3.12.0 (2024-09-06) =
    217220* Fixed issue with DI52 dependency conflict between versions with other plugins
  • easy-appointments/trunk/src/ajax.php

    r3059359 r3148231  
    161161            add_action('wp_ajax_ea_field', array($this, 'ajax_field'));
    162162            add_action('wp_ajax_ea_export', array($this, 'ajax_export'));
     163            add_action('wp_ajax_ea_default_template', array($this, 'ajax_default_template'));
    163164        }
    164165    }
     
    771772    }
    772773
     774    public function ajax_default_template()
     775    {
     776        $this->validate_admin_nonce();
     777        $this->validate_access_rights('settings');
     778
     779        $content = $this->mail->get_default_admin_template();
     780
     781        wp_die($content);
     782    }
     783
    773784    /**
    774785     * Errors for tools page
  • easy-appointments/trunk/src/mail.php

    r2577616 r3148231  
    308308
    309309        wp_die($content, $title);
     310    }
     311
     312    public function get_default_admin_template()
     313    {
     314        $template_path = $this->utils->get_template_path('mail.notification.tpl.convert.php');
     315        $meta_fields = $this->models->get_all_rows('ea_meta_fields');
     316
     317        // render template
     318        ob_start();
     319        require $template_path;
     320        return ob_get_clean();
    310321    }
    311322
  • easy-appointments/trunk/src/templates/admin.tpl.php

    r3131833 r3148231  
    285285                            </tbody>
    286286                        </table>
     287                        <a id="load-default-admin-template" href="#" style="padding-top: 5px; padding-bottom: 5px; display: none;"><?php _e('Load default admin template', 'easy-appointments'); ?></a>
    287288                        <div><small><?php _e('Available tags', 'easy-appointments'); ?>: #id#, #date#, #start#, #end#, #status#, #created#, #price#, #ip#, #link_confirm#, #link_cancel#, #url_confirm#, #url_cancel#, #service_name#, #service_duration#, #service_price#, #worker_name#, #worker_email#, #worker_phone#, #location_name#, #location_address#, #location_location#, <?php echo implode(', ', EADBModels::get_custom_fields_tags()); ?></small></div>
    288289                    </div>
Note: See TracChangeset for help on using the changeset viewer.