mirror of https://github.com/itflow-org/itflow
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:
parent
36e1df93bb
commit
ed0b192f5b
|
|
@ -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_attempts; ?></td>
|
||||
<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>
|
||||
</a>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,24 +1,18 @@
|
|||
<?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
|
||||
require "plugins/htmlpurifier/HTMLPurifier.standalone.php";
|
||||
require "../plugins/htmlpurifier/HTMLPurifier.standalone.php";
|
||||
|
||||
$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('URI.AllowedSchemes', ['data' => true, 'src' => true, 'http' => true, 'https' => true]);
|
||||
$purifier = new HTMLPurifier($purifier_config);
|
||||
|
||||
if (isset($_GET['email_id'])) {
|
||||
$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");
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM email_queue WHERE email_id = $email_id LIMIT 1");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
|
||||
$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>";
|
||||
}
|
||||
|
||||
// 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();
|
||||
?>
|
||||
|
||||
<ol class="breadcrumb d-print-none">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="admin_user.php"><i class="fas fa-fw fa-user-shield mr-2"></i>Admin</a>
|
||||
</li>
|
||||
<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">
|
||||
<div class="modal-body bg-white">
|
||||
<div>From: <?php echo "$email_from_name <small>($email_from)</small>"; ?></div>
|
||||
<div>To: <?php echo "$email_recipient_name <small>($email_recipient)</small>"; ?></div>
|
||||
<hr>
|
||||
<div class="prettyContent">
|
||||
<?php echo $email_content; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="js/pretty_content.js"></script>
|
||||
<script src="../js/pretty_content.js"></script>
|
||||
|
||||
<?php
|
||||
|
||||
require_once "includes/footer.php";
|
||||
require_once "../includes/ajax_footer.php";
|
||||
|
|
@ -115,7 +115,7 @@
|
|||
<li class="nav-header">MAINTENANCE</li>
|
||||
|
||||
<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>
|
||||
<p>Mail Queue</p>
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -1,12 +1,16 @@
|
|||
// Generic Ajax Modal Load Script
|
||||
//
|
||||
/*Trigger Button using data-ajax attributes -->
|
||||
<button type="button"
|
||||
class="btn btn-primary ajax-trigger"
|
||||
data-ajax-url="ajax_contact_edit.php"
|
||||
data-ajax-id="123">
|
||||
Edit Contact
|
||||
</button>
|
||||
/* Example Triggering -->
|
||||
|
||||
<button type="button"
|
||||
class="btn btn-primary"
|
||||
data-toggle = "ajax-modal" // Triggers the AJAX Modal
|
||||
data-modal-size = "lg" // Optional: Defaults to md
|
||||
data-ajax-url="ajax/ajax_contact_edit.php"
|
||||
data-ajax-id="123">
|
||||
Edit Contact
|
||||
</button>
|
||||
|
||||
*/
|
||||
$(document).on('click', '[data-toggle="ajax-modal"]', function (e) {
|
||||
e.preventDefault();
|
||||
|
|
@ -15,6 +19,7 @@ $(document).on('click', '[data-toggle="ajax-modal"]', function (e) {
|
|||
var $trigger = $(this);
|
||||
var ajaxUrl = $trigger.data('ajax-url');
|
||||
var ajaxId = $trigger.data('ajax-id');
|
||||
var modalSize = $trigger.data('modal-size') || 'md';
|
||||
|
||||
// Make the AJAX call to fetch modal content.
|
||||
$.ajax({
|
||||
|
|
@ -38,7 +43,7 @@ $(document).on('click', '[data-toggle="ajax-modal"]', function (e) {
|
|||
// Build the modal HTML using the returned title and content.
|
||||
var modalHtml =
|
||||
'<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-header">' +
|
||||
' <h5 class="modal-title" id="' + modalId + 'Label">' + response.title + '</h5>' +
|
||||
|
|
|
|||
Loading…
Reference in New Issue