mirror of
https://github.com/cytopia/devilbox.git
synced 2024-12-22 14:12:25 +00:00
Merge pull request #787 from merlijnvanlent/master
Ability to view emails within the intranet dashboard.
This commit is contained in:
commit
fa0c8f5632
21
.devilbox/www/htdocs/assets/js/html-email.js
Normal file
21
.devilbox/www/htdocs/assets/js/html-email.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
class HtmlEmail extends HTMLElement {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.attachShadow({ mode: 'open' });
|
||||||
|
|
||||||
|
let emailContent;
|
||||||
|
try {
|
||||||
|
emailContent = window.atob(this.dataset.content);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const container = document.createElement('div');
|
||||||
|
container.innerHTML = emailContent;
|
||||||
|
|
||||||
|
this.shadowRoot.appendChild(container);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
customElements.define('html-email', HtmlEmail);
|
@ -159,6 +159,17 @@ $messages = $MyMbox->get($sortOrderArr);
|
|||||||
<?php
|
<?php
|
||||||
$message = htmlentities($data['raw']);
|
$message = htmlentities($data['raw']);
|
||||||
$structure = $data['decoded'];
|
$structure = $data['decoded'];
|
||||||
|
$body = null;
|
||||||
|
|
||||||
|
if (isset($structure->body)) {
|
||||||
|
$body = $structure->body;
|
||||||
|
}
|
||||||
|
elseif(isset($structure->parts[1]->body)) {
|
||||||
|
$body = $structure->parts[1]->body;
|
||||||
|
}
|
||||||
|
elseif(isset($structure->parts[0]->body)) {
|
||||||
|
$body = $structure->parts[0]->body;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<tr id="<?php echo $data['num'];?>" class="subject">
|
<tr id="<?php echo $data['num'];?>" class="subject">
|
||||||
<td><?php echo $data['num'];?></td>
|
<td><?php echo $data['num'];?></td>
|
||||||
@ -174,16 +185,13 @@ $messages = $MyMbox->get($sortOrderArr);
|
|||||||
<tr id="mail-<?php echo $data['num'];?>" style="display:none">
|
<tr id="mail-<?php echo $data['num'];?>" style="display:none">
|
||||||
<td></td>
|
<td></td>
|
||||||
<td colspan="4">
|
<td colspan="4">
|
||||||
<?php if (isset($structure->body)): ?>
|
<?php if ($body !== null): ?>
|
||||||
<?php echo htmlentities($structure->body) ?>
|
<html-email data-content="<?php echo base64_encode($body) ?>">
|
||||||
<?php elseif(isset($structure->parts[1]->body)): ?>
|
</html-email>
|
||||||
<?php echo htmlentities($structure->parts[1]->body) ?>
|
|
||||||
<?php elseif(isset($structure->parts[0]->body)): ?>
|
|
||||||
<?php echo htmlentities($structure->parts[0]->body) ?>
|
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php echo '<div class="alert alert-warning" role="alert">
|
<div class="alert alert-warning" role="alert">
|
||||||
No valid body found
|
No valid body found
|
||||||
</div>' ?>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<hr>
|
<hr>
|
||||||
<p><a class="btn btn-primary" data-toggle="collapse" href="#email-<?php echo $data['num'];?>" aria-expanded="false" aria-controls="email-<?php echo $data['num'];?>">Raw source</a></p>
|
<p><a class="btn btn-primary" data-toggle="collapse" href="#email-<?php echo $data['num'];?>" aria-expanded="false" aria-controls="email-<?php echo $data['num'];?>">Raw source</a></p>
|
||||||
@ -215,5 +223,6 @@ $messages = $MyMbox->get($sortOrderArr);
|
|||||||
// Handler for .ready() called.
|
// Handler for .ready() called.
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
<script src="/assets/js/html-email.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user