Plugin Directory

Changeset 2261940


Ignore:
Timestamp:
03/16/2020 05:44:57 PM (6 years ago)
Author:
orangetoolz
Message:

Bulk email validation complete, design changed & Reset button issue fixed

Location:
cf7-db-tool/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • cf7-db-tool/trunk/assets/css/cf7-bulk-mail.css

    r2245565 r2261940  
    115115#cf7-db-bulkmail .wp-editor-wrap {
    116116    width: 100%;
    117     padding: 6px 10px
     117    padding: 6px 10px;
     118    border-radius:5px;
    118119}
    119120#cf7-db-bulkmail .dbtool-radio-wrap {
     
    132133}
    133134.cf7-dbt-container.bulkmail .cf7-dbt-sidebar-inner{
    134     margin-top: 40px
    135 }
     135    margin-top: 20px
     136}
     137
     138.select_user_wrapper #select_all, .select_user_wrapper #ResetData{
     139    color: #fff;
     140    text-shadow: none;
     141    cursor: pointer;
     142    display: inline-block;
     143    min-height: 1em;
     144    outline: 0;
     145    border: none;
     146    vertical-align: baseline;
     147    font-family: Lato,'Helvetica Neue',Arial,Helvetica,sans-serif;
     148    margin: 0 .25em 0 0;
     149    padding: .78571429em 1.5em .78571429em;
     150    text-transform: none;
     151    text-shadow: none;
     152    font-weight: 700;
     153    line-height: 1em;
     154    font-style: normal;
     155    text-align: center;
     156    text-decoration: none;
     157    border-radius: .28571429rem;
     158    -webkit-box-shadow: 0 0 0 1px transparent inset, 0 0 0 0 rgba(34,36,38,.15) inset;
     159    box-shadow: 0 0 0 1px transparent inset, 0 0 0 0 rgba(34,36,38,.15) inset;
     160    -webkit-user-select: none;
     161    -moz-user-select: none;
     162    -ms-user-select: none;
     163    user-select: none;
     164    -webkit-transition: opacity .1s ease,background-color .1s ease,color .1s ease,background .1s ease,-webkit-box-shadow .1s ease;
     165    transition: opacity .1s ease,background-color .1s ease,color .1s ease,background .1s ease,-webkit-box-shadow .1s ease;
     166    transition: opacity .1s ease,background-color .1s ease,color .1s ease,box-shadow .1s ease,background .1s ease;
     167    transition: opacity .1s ease,background-color .1s ease,color .1s ease,box-shadow .1s ease,background .1s ease,-webkit-box-shadow .1s ease;
     168    will-change: '';
     169    -webkit-tap-highlight-color: transparent;
     170}
     171.select_user_wrapper #select_all{
     172    background-color: #2185d0;
     173}
     174.select_user_wrapper #select_all:hover{
     175    background-color: #1678c2;
     176}
     177.select_user_wrapper #ResetData{
     178    background-color: #db2828;
     179    color: #fff;
     180}
     181.select_user_wrapper #ResetData:hover{
     182    background-color: #d01919;
     183}
     184
     185.select_user_wrapper #ResetData{
     186    opacity: 0.65;
     187    cursor: not-allowed;
     188}
     189
     190
     191
     192
    136193
    137194@media screen and (max-width: 1300px) {
  • cf7-db-tool/trunk/assets/js/cf7-db-bulkmail.js

    r2245565 r2261940  
    44    $(document).ready(function(){
    55        var OBJ = {
    6             department : 0,
    7             session    : 0
     6            cf7form : 0,
    87        }
    98        // $('#select-department_list').on('change', function() {
     
    1211        // });
    1312
    14         // $('#select-session_list').on('change', function() {
    15         //  OBJ.session = $(this).find(":selected").val() ;
    16         //  callFromDB();
    17         // });
    18         // function callFromDB() {
    19         //  if(OBJ.department != 0 && OBJ.session != 0){
    20         //      $.post(ajax_object.ajax_url,{
    21         //          'action':'bulkMailAjaxDataAction',
    22         //          'department': OBJ.department,
    23         //          'session': OBJ.session,
    24         //      },function(data){
    25         //          if(data == 0){
    26         //              alert('No Data Found');
    27         //          }else{
    28         //              //console.log(data);
    29         //              $('#dbtool-user-list').html(data);
    30         //          }
    31         //      })
    32         //
    33         //  }
    34         // }
     13        $('#select-session_list').on('change', function() {
     14            OBJ.cf7form = $(this).find(":selected").val() ;
     15            callFromDB();
     16        });
     17        function callFromDB() {
     18            if(OBJ.cf7form != 0 ){
     19                $.post(ajax_object.ajax_url,{
     20                    'action':'bulkMailAjaxDataAction',
     21                    'department': OBJ.cf7form,
     22                },function(data){
     23                    if(data == 0){
     24                        alert('No Data Found');
     25                    }else{
     26                        //console.log(data);
     27                        $('#dbtool-user-list').html(data);
     28                    }
     29                })
     30
     31            }
     32        }
    3533    });
    3634})(jQuery);
    3735// arguments: reference to select list, callback function (optional)
     36
     37var Totalusers = document.getElementById("dbtool-user-list");
     38var resetButton = document.getElementById('ResetData')
     39
    3840function getSelectedOptions(sel, fn) {
    3941    var opts = [], opt;
     
    7173// anonymous function onchange for select list with id demoSel
    7274document.getElementById('dbtool-user-list').onchange = function(e) {
    73 
    7475    // get reference to display textarea
    7576    var display = document.getElementById('dbtool-recipient-emails');
    76 
    7777    // callback fn handles selected options
    7878    getSelectedOptions(this, callback);
    7979
     80
     81
     82
     83    if(resetButton.computedStyleMap().get('cursor').value=='not-allowed') {
     84        resetButton.style.cssText = "opacity: 1;cursor: pointer;"
     85    }
    8086};
    8187
     
    8389document.getElementById('select_all').onclick = function(e) {
    8490    var TargetToInputForm = document.getElementById('dbtool-recipient-emails');
    85     var Totalusers = document.getElementById("dbtool-user-list");
     91
    8692    TargetToInputForm.value = '';
    8793    var emailList = "";
     
    9399    emailList = emailList.slice(0, emailList.length-1);
    94100    TargetToInputForm.value = emailList;
     101    resetButton.style.cssText  = "opacity: 1;cursor: pointer;"
    95102    return false; // don't return online form
    96103};
     104
     105// Reset function for disable remove from mail list
     106
     107resetButton.onclick = function(e) {
     108    for (var i = 0; i < Totalusers.length; i++) {
     109        Totalusers.options[i].removeAttribute("disabled");
     110    }
     111    this.style.cssText  = "opacity: 0.65;cursor: not-allowed;"
     112}
  • cf7-db-tool/trunk/cf7-db-tool.php

    r2245565 r2261940  
    88 * Text Domain: cf7-db-tool
    99 * Tags: contact, cf7, contact form 7, db, export, save, wpcf7, contact form 7 db,  contact form 7 database, contact form 7 data export, contact form 7 database addon
    10  * Version: 3.0.0
     10 * Version: 3.0.1
    1111 */
    1212
    13 define('CF7_DBT_VERSION', '3.0.0');
    14 define('CF7_DBT_DB_VERSION', '3.0.0');
     13define('CF7_DBT_VERSION', '3.0.1');
     14define('CF7_DBT_DB_VERSION', '3.0.1');
    1515define('CF7_DBT_PATH', __DIR__);
    1616define('CF7_DBT_URL', plugins_url(basename(CF7_DBT_PATH)));
  • cf7-db-tool/trunk/readme.txt

    r2245575 r2261940  
    44Requires at least: 4.8
    55Tested up to: 5.3
    6 Stable tag: 3.0.0
     6Stable tag: 3.0.1
    77License: GPLv2 or later
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    3131Upcoming features:
    3232
    33 * Email integrationf with bulk mail
     33* Choose bulk mail contacts from cf7 forms
     34* Email integration with bulk mail
    3435
    3536
     
    9596*Bulk email feature added
    9697
     98= 3.0.1 =
     99*Release Date - March 16, 2020*
     100*Bulk email validation complete, design changed & Reset button issue fixed
     101
  • cf7-db-tool/trunk/src/BulkMail.php

    r2245565 r2261940  
    1111
    1212        $this->cf7DBBulkMail();
    13         //add_action('wp_ajax_bulkMailAjaxDataAction',[$this,'bulkMailAjaxDataAction']);
     13        add_action('wp_ajax_bulkMailAjaxDataAction',[$this,'bulkMailAjaxDataAction']);
    1414
    1515    }
     
    173173                                                            <input  type="button" id="select_all" name="select_all" value="Select All user">
    174174                                                        </div>
    175                                                         <button type="reset" id="ResetData">Reset Data</button>
    176                                                         <!--                                            <div class="select-department">-->
    177                                                         <!--                                                <select  id="select-department_list">-->
    178                                                         <!--                                                    <option value="">-- --><?php //_e( 'Select Department', 'dumhall' ); ?><!-- --</option>-->
    179                                                         <!--                                                    --><?php
    180                                                         //
    181                                                         //                                                    $users = get_users( array( 'fields' => array( 'ID' ) ) );
    182                                                         //                                                    foreach($users as $user_id){
    183                                                         //                                                        $data = get_user_meta ( $user_id->ID);
    184                                                         //                                                        if(!empty($data['department'][0])){
    185                                                         //                                                            echo '<option value="' . esc_html( $data['department'][0]) . '">' . esc_html( $data['department'][0] ) . '</option>';
    186                                                         //                                                        }
    187                                                         //                                                    }
    188                                                         //                                                    ?>
    189                                                         <!--                                                </select>-->
    190                                                         <!--                                            </div>-->
    191                                                         <!--                                            <div class="select-session">-->
    192                                                         <!--                                                <select   id="select-session_list">-->
    193                                                         <!--                                                    <option value="">-- --><?php //_e( 'Select Session', 'dumhall' ); ?><!-- --</option>-->
    194                                                         <!--                                                    --><?php
    195                                                         //
    196                                                         //                                                    $users = get_users( array( 'fields' => array( 'ID' ) ) );
    197                                                         //                                                    foreach($users as $user_id){
    198                                                         //                                                        $data = get_user_meta ( $user_id->ID);
    199                                                         //                                                        if(isset($data['session'][0])){
    200                                                         //                                                            echo '<option value="' . esc_html( $data['session'][0]) . '">' . esc_html( $data['session'][0] ) . '</option>';
    201                                                         //                                                        }
    202                                                         //                                                    }
    203                                                         //                                                    ?>
    204                                                         <!--                                                </select>-->
    205                                                         <!--                                            </div>-->
     175
     176<!--                                                        <div class="select-department">-->
     177<!--                                                            <select  id="select-department_list">-->
     178<!--                                                                <option value="">-- --><?php //_e( 'Select Department', 'dumhall' ); ?><!-- --</option>-->
     179<!--                                                                --><?php
     180//
     181//                                                                $users = get_users( array( 'fields' => array( 'ID' ) ) );
     182//                                                                foreach($users as $user_id){
     183//                                                                    $data = get_user_meta ( $user_id->ID);
     184//                                                                    if(!empty($data['department'][0])){
     185//                                                                        echo '<option value="' . esc_html( $data['department'][0]) . '">' . esc_html( $data['department'][0] ) . '</option>';
     186//                                                                    }
     187//                                                                }
     188//                                                                ?>
     189<!--                                                            </select>-->
     190<!--                                                        </div>-->
     191<!--                                                        <div class="select-session">-->
     192<!--                                                            <select   id="select-session_list">-->
     193<!--                                                                <option value="">-- --><?php //_e( 'Select Form', 'dumhall' ); ?><!-- --</option>-->
     194<!--                                                                <option value="1">hell</option>-->
     195<!--                                                                <option value="2">hell2</option>-->
     196<!--                                                                <option value="3">hell3</option>-->
     197<!--                                                                <option value="4">hell4</option>-->
     198<!--                                                                --><?php
     199//
     200//
     201//                                                                ?><!-- $users = get_users( array( 'fields' => array( 'ID' ) ) );-->
     202<!--                                                                foreach($users as $user_id){-->
     203<!--                                                                $data = get_user_meta ( $user_id->ID);-->
     204<!--                                                                if(isset($data['session'][0])){-->
     205<!--                                                                echo '<option value="' . esc_html( $data['session'][0]) . '">' . esc_html( $data['session'][0] ) . '</option>';-->
     206<!--                                                                }-->
     207<!--                                                                }-->
     208<!--                                                            </select>-->
     209<!--                                                        </div>-->
     210
     211                                                        <div class="reset-entery-data">
     212                                                            <button type="reset" id="ResetData">Reset Data</button>
     213                                                        </div>
    206214                                                    </div>
    207215                                                </td>
     
    271279    // Ajax request for load targeted form users
    272280    public function bulkMailAjaxDataAction(){
    273       echo "test";
    274 
    275         // this is required to terminate immediately and return a proper response
    276         $department = '';
    277         $session = '';
    278         if(isset($_POST['department'])){
    279             $department = sanitize_text_field($_POST['department']);
    280         }
    281         if(isset($_POST['session'])){
    282             $session = sanitize_text_field($_POST['session']);
    283         }
    284         $args = array(
    285             'meta_query' => array(
    286                 'relation' => 'AND', // Could be OR, default is AND
    287                 array(
    288                     'key'     => 'department',
    289                     'value'   => $department,
    290                     'compare' => '=='
    291                 ),
    292                 array(
    293                     'key'     => 'session',
    294                     'value'   => $session,
    295                     'compare' => '=='
    296                 )
    297             )
    298         );
    299         $users = get_users( $args );
    300 
    301         foreach ( $users as $user ) {
    302             //var_dump($user->user_email);
    303             // $session = $user->session;
    304             if ( $user->first_name && $user->last_name ) {
    305                 $user_fullname = ' (' . $user->first_name . ' ' . $user->last_name . ')';
    306             } else {
    307                 $user_fullname = '';
    308             }
    309             echo '<option value="' . esc_html( $user->user_email ) . '">' . esc_html( $user->user_email ) . esc_html( $user_fullname) .'</option>';
    310 
    311         };
     281      echo "<script>alert('hello');</script>";
     282
     283//        // this is required to terminate immediately and return a proper response
     284//        $department = '';
     285//        $session = '';
     286//        if(isset($_POST['department'])){
     287//            $department = sanitize_text_field($_POST['department']);
     288//        }
     289//        if(isset($_POST['session'])){
     290//            $session = sanitize_text_field($_POST['session']);
     291//        }
     292//        $args = array(
     293//            'meta_query' => array(
     294//                'relation' => 'AND', // Could be OR, default is AND
     295//                array(
     296//                    'key'     => 'department',
     297//                    'value'   => $department,
     298//                    'compare' => '=='
     299//                ),
     300//                array(
     301//                    'key'     => 'session',
     302//                    'value'   => $session,
     303//                    'compare' => '=='
     304//                )
     305//            )
     306//        );
     307//        $users = get_users( $args );
     308//
     309//        foreach ( $users as $user ) {
     310//            //var_dump($user->user_email);
     311//            // $session = $user->session;
     312//            if ( $user->first_name && $user->last_name ) {
     313//                $user_fullname = ' (' . $user->first_name . ' ' . $user->last_name . ')';
     314//            } else {
     315//                $user_fullname = '';
     316//            }
     317//            echo '<option value="' . esc_html( $user->user_email ) . '">' . esc_html( $user->user_email ) . esc_html( $user_fullname) .'</option>';
     318//
     319//        };
    312320        wp_die();
    313321    }
Note: See TracChangeset for help on using the changeset viewer.