Skip to content

Commit

Permalink
Fixes issue: Clear Logs saved #51
Browse files Browse the repository at this point in the history
  • Loading branch information
michelve committed Oct 27, 2020
1 parent 6bd0485 commit 89afc37
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 7 deletions.
2 changes: 2 additions & 0 deletions admin/slm-add-licenses.php
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,9 @@ function slm_add_licenses_menu()
</div>
<h3 class="slm-tab-title"><?php _e('Activity Log'); ?></h3>
<div class="clear clear-fix"></div>

<div class="sml-sep"></div>

<div class="lic-activity-log" style="min-height: 325px; min-width: 100%; max-width: 900px">
<?php SLM_Utility::get_lic_activity($license_key); ?>
</div>
Expand Down
24 changes: 22 additions & 2 deletions admin/slm-admin-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,15 @@ function slm_admin_tools_menu()
echo '<br />' . $msg;
echo '</p></div>';
}
?>
if (isset($_POST['slm_clear_log'])) {
global $wpdb;
$table = SLM_TBL_LIC_LOG;
$slm_log_clean = $wpdb->query("TRUNCATE TABLE $table");

echo '<div id="message" class="updated fade"><p> Log was cleared succesfully!</p></div>';

}
?>
<br />
<div class="postbox">
<h3 class="hndle"><label for="title"><?php _e('Send Deactivation Message for a License', 'softwarelicensemanager'); ?></label></h3>
Expand All @@ -51,7 +59,19 @@ function slm_admin_tools_menu()
</form>
</div>
</div>
<?php

<div class="postbox">
<h3 class="hndle"><label for="title"><?php _e('Clean activity log', 'softwarelicensemanager'); ?></label></h3>
<div class="inside">
<p><?php _e('This will clear/reset license keys activities', 'softwarelicensemanager'); ?></p>
<form method="post" action="">
<div class="submit">
<input type="submit" name="slm_clear_log" value="Clear Log" class="button" />
</div>
</form>
</div>
</div>
<?php
echo '</div></div>';
echo '</div>';
}
2 changes: 1 addition & 1 deletion public/assets/css/slm-front-end.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ background: #f0283e;
}

#slm_licenses_table tbody tr:nth-child(even) {background: #fbfbfb}
#slm_licenses_table tbody tr:nth-child(odd) {background: #FFF}
#slm_licenses_table tbody tr:nth-child(odd) {background: #FFF}
3 changes: 2 additions & 1 deletion public/assets/js/slm.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ function slm_exportlicense(){
var text = license_data;
var filename = "license-" + filelicname + ".json";
download(filename, text);
}
}

48 changes: 45 additions & 3 deletions woocommerce/includes/wc_licenses_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,42 @@ public function endpoint_content()
?>
<?php endif; ?>




<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>








<div class="woocommerce-slm-content" <?php echo esc_html__($slm_hide); ?>>
<table id="slm_licenses_table" class="woocommerce-orders-table woocommerce-MyAccount-orders shop_table shop_table_responsive my_account_orders account-orders-table" style="border-collapse:collapse;">
<thead>
Expand Down Expand Up @@ -161,9 +197,14 @@ public function endpoint_content()
}
?>
</td>
<td class="slm-view" data-title="<?php echo esc_html__('view', 'softwarelicensemanager'); ?>"><a href="" class=" woocommerce-button button view"><?php echo esc_html__('view', 'softwarelicensemanager'); ?></a></td>
<td class="slm-view" data-title="<?php echo esc_html__('view', 'softwarelicensemanager'); ?>">
<a href="" class="woocommerce-button button view">
<?php echo esc_html__('view', 'softwarelicensemanager'); ?>
</a>
</td>
</tr>
<tr class="parent">

<td colspan="5" class="hiddenRow">
<div class="collapse demo<?php echo $class_id_++; ?> slm-shadow">
<div class="slm_ajax_msg"></div>
Expand Down Expand Up @@ -229,15 +270,16 @@ public function endpoint_content()
<?php
if ($allow_domain_removal == true) :
?>

<script>
jQuery(document).ready(function() {
jQuery('.deactivate_lic_key').click(function(event) {
var id = jQuery(this).attr("id");
var lic_type = jQuery(this).attr('lic_type');
var activation_type = jQuery(this).attr('data-activation_type');
var class_name = '.lic-entry-' + id;

jQuery(this).text('Removing');
jQuery.get('<?php echo esc_url(home_url('/')); ?>' + 'wp-admin/admin-ajax.php?action=del_activation&id=' + id + '&lic_type=' + lic_type, function(data) {
jQuery.get('<?php echo esc_url(home_url('/')); ?>' + 'wp-admin/admin-ajax.php?action=del_activation&id=' + id + '&activation_type=' + activation_type, function(data) {
if (data == 'success') {
jQuery(class_name).remove();
jQuery('.slm_ajax_msg').html('<div class="alert alert-primary" role="alert"><?php echo esc_html__('License key was deactivated!', 'softwarelicensemanager'); ?></div>');
Expand Down

0 comments on commit 89afc37

Please sign in to comment.