mirror of
https://github.com/itflow-org/itflow
synced 2026-03-15 18:24:50 +00:00
Added data-modal-size to the new ajax generic modal functin to define modal size if left blank it will use standard md, also moved Email Message View to use the new ajax modal
This commit is contained in:
@@ -177,7 +177,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<td><?php echo $email_status_display; ?></td>
|
<td><?php echo $email_status_display; ?></td>
|
||||||
<td><?php echo $email_attempts; ?></td>
|
<td><?php echo $email_attempts; ?></td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<a class="btn btn-sm btn-secondary" href="admin_mail_queue_message_view.php?email_id=<?php echo $email_id; ?>">
|
<a class="btn btn-sm btn-secondary" href="#"
|
||||||
|
data-toggle = "ajax-modal"
|
||||||
|
data-modal-size = "lg"
|
||||||
|
data-ajax-url = "ajax/ajax_admin_mail_queue_message_view.php"
|
||||||
|
data-ajax-id = "<?php echo $email_id; ?>"
|
||||||
|
>
|
||||||
<i class="fas fa-fw fa-eye"></i>
|
<i class="fas fa-fw fa-eye"></i>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "includes/inc_all_admin.php";
|
require_once '../includes/ajax_header.php';
|
||||||
|
|
||||||
|
$email_id = intval($_GET['id']);
|
||||||
|
|
||||||
//Initialize the HTML Purifier to prevent XSS
|
//Initialize the HTML Purifier to prevent XSS
|
||||||
require "plugins/htmlpurifier/HTMLPurifier.standalone.php";
|
require "../plugins/htmlpurifier/HTMLPurifier.standalone.php";
|
||||||
|
|
||||||
$purifier_config = HTMLPurifier_Config::createDefault();
|
$purifier_config = HTMLPurifier_Config::createDefault();
|
||||||
$purifier_config->set('Cache.DefinitionImpl', null); // Disable cache by setting a non-existent directory or an invalid one
|
$purifier_config->set('Cache.DefinitionImpl', null); // Disable cache by setting a non-existent directory or an invalid one
|
||||||
$purifier_config->set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'http' => true, 'https' => true]);
|
$purifier_config->set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'http' => true, 'https' => true]);
|
||||||
$purifier = new HTMLPurifier($purifier_config);
|
$purifier = new HTMLPurifier($purifier_config);
|
||||||
|
|
||||||
if (isset($_GET['email_id'])) {
|
$sql = mysqli_query($mysqli, "SELECT * FROM email_queue WHERE email_id = $email_id LIMIT 1");
|
||||||
$email_id = intval($_GET['email_id']);
|
|
||||||
} else {
|
|
||||||
echo "You dont belong here";
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM email_queue WHERE email_id = $email_id");
|
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_array($sql);
|
||||||
|
|
||||||
$email_from = nullable_htmlentities($row['email_from']);
|
$email_from = nullable_htmlentities($row['email_from']);
|
||||||
@@ -42,37 +36,22 @@ if ($email_status == 0) {
|
|||||||
$email_status_display = "<div class='text-success'>Sent</div><small class='text-secondary'>$email_sent_at</small>";
|
$email_status_display = "<div class='text-success'>Sent</div><small class='text-secondary'>$email_sent_at</small>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Build the dynamic modal title
|
||||||
|
$title = "<i class='fas fa-envelope-open mr-2'></i><strong>$email_subject</strong>";
|
||||||
|
|
||||||
|
// Generate the HTML form content using output buffering.
|
||||||
|
ob_start();
|
||||||
?>
|
?>
|
||||||
|
<div class="modal-body bg-white">
|
||||||
<ol class="breadcrumb d-print-none">
|
<div>From: <?php echo "$email_from_name <small>($email_from)</small>"; ?></div>
|
||||||
<li class="breadcrumb-item">
|
<div>To: <?php echo "$email_recipient_name <small>($email_recipient)</small>"; ?></div>
|
||||||
<a href="admin_user.php"><i class="fas fa-fw fa-user-shield mr-2"></i>Admin</a>
|
<hr>
|
||||||
</li>
|
<div class="prettyContent">
|
||||||
<li class="breadcrumb-item">
|
|
||||||
<a href="admin_mail_queue.php"><i class="fas fa-fw fa-mail-bulk mr-2"></i>Mail Queue</a>
|
|
||||||
</li>
|
|
||||||
<li class="breadcrumb-item active"><i class="fas fa-fw fa-envelope-open mr-2"></i><?php echo $email_subject; ?></li>
|
|
||||||
</ol>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
|
|
||||||
<div class="col-md-12">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header bg-dark">
|
|
||||||
<div>From: <?php echo "$email_from_name <small>($email_from)</small>"; ?></div>
|
|
||||||
<div>To: <?php echo "$email_recipient_name <small>($email_recipient)</small>"; ?></div>
|
|
||||||
<div>Subject: <?php echo $email_subject; ?></div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body prettyContent">
|
|
||||||
<?php echo $email_content; ?>
|
<?php echo $email_content; ?>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="js/pretty_content.js"></script>
|
<script src="../js/pretty_content.js"></script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
require_once "../includes/ajax_footer.php";
|
||||||
require_once "includes/footer.php";
|
|
||||||
@@ -115,7 +115,7 @@
|
|||||||
<li class="nav-header">MAINTENANCE</li>
|
<li class="nav-header">MAINTENANCE</li>
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="admin_mail_queue.php" class="nav-link <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['admin_mail_queue.php', 'admin_mail_queue_message_view.php']) ? 'active' : ''); ?>">
|
<a href="admin_mail_queue.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_mail_queue.php' ? 'active' : ''); ?>">
|
||||||
<i class="nav-icon fas fa-mail-bulk"></i>
|
<i class="nav-icon fas fa-mail-bulk"></i>
|
||||||
<p>Mail Queue</p>
|
<p>Mail Queue</p>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
// Generic Ajax Modal Load Script
|
// Generic Ajax Modal Load Script
|
||||||
//
|
//
|
||||||
/*Trigger Button using data-ajax attributes -->
|
/* Example Triggering -->
|
||||||
<button type="button"
|
|
||||||
class="btn btn-primary ajax-trigger"
|
<button type="button"
|
||||||
data-ajax-url="ajax_contact_edit.php"
|
class="btn btn-primary"
|
||||||
data-ajax-id="123">
|
data-toggle = "ajax-modal" // Triggers the AJAX Modal
|
||||||
Edit Contact
|
data-modal-size = "lg" // Optional: Defaults to md
|
||||||
</button>
|
data-ajax-url="ajax/ajax_contact_edit.php"
|
||||||
|
data-ajax-id="123">
|
||||||
|
Edit Contact
|
||||||
|
</button>
|
||||||
|
|
||||||
*/
|
*/
|
||||||
$(document).on('click', '[data-toggle="ajax-modal"]', function (e) {
|
$(document).on('click', '[data-toggle="ajax-modal"]', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -15,6 +19,7 @@ $(document).on('click', '[data-toggle="ajax-modal"]', function (e) {
|
|||||||
var $trigger = $(this);
|
var $trigger = $(this);
|
||||||
var ajaxUrl = $trigger.data('ajax-url');
|
var ajaxUrl = $trigger.data('ajax-url');
|
||||||
var ajaxId = $trigger.data('ajax-id');
|
var ajaxId = $trigger.data('ajax-id');
|
||||||
|
var modalSize = $trigger.data('modal-size') || 'md';
|
||||||
|
|
||||||
// Make the AJAX call to fetch modal content.
|
// Make the AJAX call to fetch modal content.
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -38,7 +43,7 @@ $(document).on('click', '[data-toggle="ajax-modal"]', function (e) {
|
|||||||
// Build the modal HTML using the returned title and content.
|
// Build the modal HTML using the returned title and content.
|
||||||
var modalHtml =
|
var modalHtml =
|
||||||
'<div class="modal text-sm" id="' + modalId + '" tabindex="-1">' +
|
'<div class="modal text-sm" id="' + modalId + '" tabindex="-1">' +
|
||||||
' <div class="modal-dialog">' +
|
' <div class="modal-dialog modal-'+ modalSize +'">' +
|
||||||
' <div class="modal-content bg-dark">' +
|
' <div class="modal-content bg-dark">' +
|
||||||
' <div class="modal-header">' +
|
' <div class="modal-header">' +
|
||||||
' <h5 class="modal-title" id="' + modalId + 'Label">' + response.title + '</h5>' +
|
' <h5 class="modal-title" id="' + modalId + 'Label">' + response.title + '</h5>' +
|
||||||
|
|||||||
Reference in New Issue
Block a user