Plugin Directory

Changeset 2128623


Ignore:
Timestamp:
07/25/2019 04:40:58 PM (7 years ago)
Author:
devjoe2016
Message:

Persist input type value after form submission

Location:
database-operations
Files:
55 added
4 edited

Legend:

Unmodified
Added
Removed
  • database-operations/trunk/admin/class-database-operations-admin.php

    r2126576 r2128623  
    167167
    168168        } else {
     169        if($_POST["pwpc_types"] == ""){
     170                $res = '<h4> Select A Chart Type And Legend</h4>';
     171                //return $res;
     172            } else {
    169173     $this->performChartQuery($_POST);
    170174   $res='<div id="tesr'.$post_id.'" style="overflow:auto;"></div>';
     
    201205        </script>';
    202206        }
     207        }
    203208
    204209        $_POST["ct_ms_content"] = $res;
    205210        foreach($_POST as $key => $value)
    206211        {
    207             if (0 === strpos($key, "ct_ms_")) {
     212            //if (0 === strpos($key, "ct_ms_")) {
    208213                update_post_meta( $post_id, $key, $value );
    209214           
    210             }
     215            //}
    211216        }   
    212217     
  • database-operations/trunk/admin/views/database-operations-form-admin-display.php

    r2126576 r2128623  
    2020            <th scope="row"><?php _e( 'Select first database table', 'db_op_plugin' ) ?></th>
    2121            <td>
    22             <select name="tb1" class="tb1" >
    23             <option value="<?php
    24             $post_val = get_post_meta(get_the_ID(), 'tb1');
    25            
    26             foreach($post_val as $k => $v){
    27                
    28                 echo $v;
    29            
    30             }
    31             ?>" > <?php
    32             $post_val = get_post_meta(get_the_ID(), 'tb1');
    33            
    34             foreach($post_val as $k => $v){
    35                
    36                 echo $v;
    37            
    38             }
    39      
    40             ?> </option>
     22            <select name="tb1" class="tb1" id="tb1">
     23        <option value="" > None </option>
    4124            <?php
    4225             foreach ($db_op_first_tb as $mytable)
     
    4831                }
    4932            ?>
    50             <option value="" > None </option>
    51             </select>
    52             </td>
    53             </tr><tr>
    54             <th scope="row"><?php _e( 'Select second database table', 'db_op_plugin' ) ?></th>
    55             <td>
    56             <select name="tb2" class="tb2" >
    57             <option value="<?php
    58             $post_val = get_post_meta(get_the_ID(), 'tb2');
     33   
     34<script type="text/javascript">
     35  document.getElementById('tb1').value = "<?php
     36$post_val = get_post_meta(get_the_ID(), 'tb1');
    5937           
    6038            foreach($post_val as $k => $v){
     
    6341           
    6442            }
    65      
    66            
    67             ?>" ><?php
    68             $post_val = get_post_meta(get_the_ID(), 'tb2');
    69            
    70             foreach($post_val as $k => $v){
    71                
    72                 echo $v;
    73            
    74             }
    75      
    76             ?></option>
     43 
     44  ?>";
     45</script>
     46            </select>
     47            </td>
     48            </tr><tr>
     49            <th scope="row"><?php _e( 'Select second database table', 'db_op_plugin' ) ?></th>
     50            <td>
     51            <select name="tb2" class="tb2" id="tb2" >
     52        <option value="">None</option>
     53
    7754            <?php
    7855             foreach ($db_op_second_tb as $mytable)
     
    8360                }
    8461            ?>
    85             <option value="">None</option>
     62<script type="text/javascript">
     63  document.getElementById('tb2').value = "<?php
     64$post_val = get_post_meta(get_the_ID(), 'tb2');
     65           
     66            foreach($post_val as $k => $v){
     67               
     68                echo $v;
     69           
     70            }
     71 
     72  ?>";
     73</script>
    8674            </select>
     75           
    8776            </td>
    8877            </tr>
     
    9079            <th scope="row"><?php _e( 'Select database query option', 'db_op_plugin' ) ?></th>
    9180            <td>
    92             <select name="qryop" class="qryop"><?php
     81            <select name="qryop" class="qryop" id="qryop">
     82            <?php
    9383             foreach ($db_op_query_op as $mytable)
    9484                {
     
    9888                }
    9989            ?>
     90<script type="text/javascript">
     91  document.getElementById('qryop').value = "<?php
     92$post_val = get_post_meta(get_the_ID(), 'qryop');
     93           
     94            foreach($post_val as $k => $v){
     95               
     96                echo $v;
     97           
     98            }
     99  ?>";
     100</script>
    100101            </select
    101102            </td>
     
    111112</div>
    112113<label class="switch">
    113   <input type="checkbox" name="charts">
     114    <input type="checkbox" name="charts" id="charts">
     115<script type="text/javascript">
     116  document.getElementById('charts').checked = "<?php
     117$post_val = get_post_meta(get_the_ID(), 'charts');
     118           
     119            foreach($post_val as $k => $v){
     120               
     121                echo $v;
     122           
     123            }
     124 
     125  ?>";
     126</script>
    114127  <span class="slider round"></span> Charts
    115128  <br/><br/> <h4>To use this chart, use just one table with two columns representing the vertical and horizontal axis.</h4>
     
    125138                    <option value="radarchart"><?php _e( "Radar Chart", PWPC_CHARTS_TEXT_DOMAIN );?></option>
    126139                </select>
     140<script type="text/javascript">
     141  document.getElementById('pwpc_types').value = "<?php
     142$post_val = get_post_meta(get_the_ID(), 'pwpc_types');
     143           
     144            foreach($post_val as $k => $v){
     145               
     146                echo $v;
     147           
     148            }
     149 
     150  ?>";
     151</script>
    127152            </div>
    128153           
     
    130155                <label class="pwpc-form-label" for="pwpc_legend"><h4><?php _e( "Display Legend?", PWPC_CHARTS_TEXT_DOMAIN );?></h4></label>
    131156                <select class="pwpc-form-control" id="pwpc_legend" name="pwpc_legend">
    132                     <option value="false"><?php _e( "No", PWPC_CHARTS_TEXT_DOMAIN );?></option>
    133                     <option value="true"><?php _e( "Yes", PWPC_CHARTS_TEXT_DOMAIN );?></option>
     157                    <option value="false"><?php _e( "False", PWPC_CHARTS_TEXT_DOMAIN );?></option>
     158                    <option value="true"><?php _e( "True", PWPC_CHARTS_TEXT_DOMAIN );?></option>
    134159                </select>
     160<script type="text/javascript">
     161  document.getElementById('pwpc_legend').value = "<?php
     162$post_val = get_post_meta(get_the_ID(), 'pwpc_legend');
     163           
     164            foreach($post_val as $k => $v){
     165               
     166                echo $v;
     167           
     168            }
     169  ?>";
     170</script>
    135171            </div>
    136            
    137 <div> <h4>Contact us for other chart types such as pie chart</h4></div>
    138         <!--<p class="submit">
    139         <input type="submit" id="db_op_sub" class="button-primary" value="<?php //_e( 'Perform query', 'db_op_plugin' ); ?>" />
    140         </p>-->
    141 
    142172 </form>
    143173     
  • database-operations/trunk/db_op.php

    r2126576 r2128623  
    44Plugin URI: https://antechncom.wordpress.com/
    55Description: This plugin connects Wordpress and the MY_SQL database, thus allowing a user fetch data from the MY_SQL database, a user can display a table or perform a simple 'UNION' on two tables. Copy shortcodes to use on any page.
    6 Version: 2.9.5
     6Version: 2.9.9
    77Author: Antechn
    88Author URI: https://antechncom.wordpress.com/about-us/
  • database-operations/trunk/readme.txt

    r2126576 r2128623  
    55Requires at least: 4.6
    66Tested up to: 5.2
    7 Stable tag: 2.9.5
     7Stable tag: 2.9.9
    88Requires PHP: 5.2.4
    99License: GPLv2 or later
     
    9191* Multiple Charts Types And Legend
    9292
     93= 2.9.9 =
     94* Persist Input Type Of Form After Submission
    9395
    9496
     97
Note: See TracChangeset for help on using the changeset viewer.