Skip to content

Commit

Permalink
Actualización
Browse files Browse the repository at this point in the history
  • Loading branch information
biffly committed Oct 20, 2020
1 parent dc7a6a7 commit 50f05a3
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 14 deletions.
4 changes: 2 additions & 2 deletions MGS-forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: MGS-Forms para Fusion Builder
Plugin URI: http://www.marceloscenna.com.ar
Description: Creacion de formularios y almacenado en BBDD. Permite crar de forma rapida un formulario y agregarlo utilizando Fusion Builder
Version: 2.0
Version: 2.1
Author: Marcelo Scenna
Author URI: http://www.marceloscenna.com.ar
Text Domain: mgs-forms
Expand Down Expand Up @@ -39,7 +39,7 @@
if( !defined('MGS_FORMS_BASENAME') ) define( 'MGS_FORMS_BASENAME', plugin_basename(__FILE__) );
if( !defined('MGS_FORMS_PLUGIN_DIR') ) define( 'MGS_FORMS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
if( !defined('MGS_FORMS_PLUGIN_DIR_URL') ) define( 'MGS_FORMS_PLUGIN_DIR_URL', plugin_dir_url( __FILE__ ) );
if( !defined('MGS_FORMS_VERSION') ) define( 'MGS_FORMS_VERSION', '2.0' );
if( !defined('MGS_FORMS_VERSION') ) define( 'MGS_FORMS_VERSION', '2.1' );
if( !defined('MGS_FORMS_SLUG') ) define( 'MGS_FORMS_SLUG', 'MGS-Forms-FusionBuilder/MGS-forms.php' );
if( !defined('MGS_FORMS_PLUGIN_REMOTE_PATH') ) define( 'MGS_FORMS_PLUGIN_REMOTE_PATH', 'http://marceloscenna.com.ar/update.php' );
if( !defined('MGS_FORMS_SPECIAL_SECRET_KEY') ) define( 'MGS_FORMS_SPECIAL_SECRET_KEY', '589b4113769878.59794845' );
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ https://dillinger.io/]

Creacion de formularios y almacenado en BBDD. Permite crar de forma rapida un formulario y agregarlo utilizando Fusion Builder
## Change Log
- ###### Version 2.1
- Add eliminar varios regitros
- ###### Version 2.0
- Fix MGS NL Actions Plg
- ###### Version 1.9
Expand Down
7 changes: 6 additions & 1 deletion css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@

.mgs-select-field{width:100%;}


#mgs-registros_wrapper table.dataTable tr td input[type="checkbox"]{
height: 1.5rem;
width: 1.5rem;
line-height: 1.5rem;
font-size: 1.5rem;
}


/*
Expand Down
18 changes: 14 additions & 4 deletions inc/admin/class-main.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,22 @@ public function delete_registros_callback(){
if( isset($_POST['id']) && $_POST['id']!='' ){
global $wpdb;
global $table_name_mgs_forms;
$id = $_POST['id'];
if( $wpdb->delete($table_name_mgs_forms, array('id'=>$id)) ){
$resp = array('est' => 'OK');
if( is_array($_POST['id']) ){
foreach($_POST['id'] as $id ){
$wpdb->delete($table_name_mgs_forms, ['id'=>$id]);
}
$resp = array('est' => 'OKs');
}else{
$resp = array('est' => 'ERR');
$id = $_POST['id'];
if( $wpdb->delete($table_name_mgs_forms, array('id'=>$id)) ){
$resp = array('est' => 'OK');
}else{
$resp = array('est' => 'ERR');
}
$resp = array('est' => 'OK');
}


}else{
$resp = array('est' => 'ERR');
}
Expand Down
53 changes: 47 additions & 6 deletions inc/admin/screen-forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<select id="formulario" name="formulario" class="mgs-forms-control mgs-select-field" <?php echo $state?> placeholder="<?php echo $placeholder?>">
<option value=""><?php echo $placeholder?></option>
<?php foreach($forms_ids as $f){?>
<option value="<?php echo $f->post_id?>"><?php echo get_the_title($f->post_id)?></option>
<option value="<?php echo $f->post_id?>" <?php selected($f->post_id, $_GET['_form'])?>><?php echo get_the_title($f->post_id)?></option>
<?php }?>
</select>
<?php
Expand Down Expand Up @@ -59,11 +59,18 @@
<input type="submit" class="button button-primary mgs-forms-save-settings mgs-forms-export-csv" value="<?php echo __('Descargar CSV')?>" disabled>
</div>
</div>

<div class="mgs-forms-settings list-regs"></div>
<div class="clear"></div>
</div>
</form>
<form method="get">
<div class="mgs-registros_wrapper">
<div class="mgs-forms-settings list-regs"></div>
<div class="clear"></div>
</div>
<input type="hidden" name="page" id="page" value="mgs-forms-formularios">
<input type="hidden" name="_form" id="_form" value="">
<input type="hidden" name="acc" id="acc" value="delete">

</form>

<script>

Expand All @@ -72,10 +79,12 @@
};

var espera = '<div class="mgs-mgs-espera"><i class="fa fa-exclamation-circle" aria-hidden="true"></i> Seleccione unu formulario para ver los resultados</div>';
var cargando = '<div class="mgs-mgs-espera"><i class="fa fa-spinner fa-spin fa-2x fa-fw"></i> Cargando resultados</div><table id="mgs-registros" class="table table-striped table-bordered dataTable" width="100%"></table>';
var cargando = '<div class="mgs-mgs-espera"><i class="fa fa-spinner fa-spin fa-2x fa-fw"></i> Cargando resultados</div><table id="mgs-registros" class="table table-striped table-bordered dataTable" width="100%"></table><button type="button" class="button button-primary mgs-forms-deletess"><?php echo __('Eliminar seleccionados')?></button>';
var tabla ='';

jQuery('.list-regs').html(espera);
LoadRegistros();

//jQuery('.list-regs').html(espera);

jQuery('#formulario').on('change', function(){
LoadRegistros();
Expand All @@ -102,6 +111,34 @@
});
});

jQuery('body').on('click', 'button.mgs-forms-deletess', function(e){
e.preventDefault();
var to_delete = [];
jQuery('.mgs-forms-ids-to-delete').each(function(){
if( jQuery(this).is(':checked') ){
var row = jQuery(this).parent().parent();
row.addClass('selected');
to_delete.push(jQuery(this).val())
}
});
if( to_delete.length>0 ){
//console.log('deleting....', to_delete);
//DeleteRegistro(to_delete);
bootbox.confirm({
title : 'Eliminar?',
message : 'Realmente desea eliminar los registros seleccionados? La operación no se puede deshacer.',
callback : function(result){
if( result ){
DeleteRegistro(to_delete);
}else{
jQuery('tr').removeClass('selected');
}
}
});
}
});


function DeleteRegistro(id){
jQuery.ajax({
data : {
Expand All @@ -115,6 +152,9 @@ function DeleteRegistro(id){
if( resp.est=='OK' ){
tabla.row('.selected').remove().draw(false);
bootbox.alert("Registro eliminado con éxito.");
}else if( resp.est=='OKs' ){
tabla.rows('.selected').remove().draw(false);
bootbox.alert("Registros eliminados con éxito.");
}else{
bootbox.alert("No se pudo eliminar el registro.");
jQuery('tr').removeClass('selected');
Expand All @@ -136,6 +176,7 @@ function LoadRegistros(){
});

if( form!='' ){
jQuery('#_form').val(form);
jQuery('.mgs-forms-export-csv').prop('disabled', false);
jQuery('.list-regs').html(cargando);
jQuery.ajax({
Expand Down
4 changes: 3 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Tags: forms, db
Requires at least: 4.9
Tested up to: 5.1.1
Stable tag: 2.0
Stable tag: 2.1
License: BSD 2-Clause "Simplified"
License URI: https://github.com/biffly/MGS-Forms-Fusion-Builder/blob/master/LICENSE

Expand All @@ -16,6 +16,8 @@ Creacion de formularios y almacenado en BBDD. Permite crar de forma rapida un fo

== Changelog ==
= Version 2.0 =
* Add eliminar varios registros
= Version 2.0 =
* Fix conflicto MGS NL Plg
= Version 1.9 =
* Fix admin issue
Expand Down

0 comments on commit 50f05a3

Please sign in to comment.