Skip to content

Commit

Permalink
implemented admin overview correctly. fixes #58
Browse files Browse the repository at this point in the history
  • Loading branch information
geek-at committed Nov 12, 2023
1 parent 2559d0c commit fac68fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions web/inc/OpenTrashmailBackend.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ public function listAccount($email)
$emails = getEmailsOfEmail($email);
//var_dump($emails);
return $this->renderTemplate('email-table.html',[
'isadmin'=>($this->settings['ADMIN']==$email),
'email'=>$email,
'emails'=>$emails,
'dateformat'=>$this->settings['DATEFORMAT']
Expand Down
7 changes: 7 additions & 0 deletions web/templates/email-table.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<th scope="col">#</th>
<th scope="col">Date</th>
<th scope="col">From</th>
<?php if($isadmin==true): ?><th scope="col">To</th><?php endif; ?>
<th scope="col">Subject</th>
<th scope="col">Action</th>
</tr>
Expand All @@ -35,10 +36,16 @@
<th scope="row"><?= ++$i; ?></th>
<td id="date-td-<?= $i ?>"><script>document.getElementById('date-td-<?= $i ?>').innerHTML = moment.unix(parseInt(<?=$unixtime?>/1000)).format('<?= $dateformat; ?>');</script></td>
<td><?= escape($ed['from']) ?></td>
<?php if($isadmin==true): ?><td><?= $ed['email'] ?></td><?php endif; ?>
<td><?= escape($ed['subject']) ?></td>
<td>
<?php if($isadmin==true): ?>
<a href="/read/<?= $ed['email'] ?>/<?= $ed['id'] ?>" hx-get="/api/read/<?= $ed['email'] ?>/<?= $ed['id'] ?>" hx-push-url="/read/<?= $ed['email'] ?>/<?= $ed['id'] ?>" hx-target="#main" role="button">Open</a>
<a href="#" hx-get="/api/delete/<?= $ed['email'] ?>/<?= $ed['id'] ?>" hx-confirm="Are you sure?" hx-target="closest tr" hx-swap="outerHTML swap:1s" role="button">Delete</a>
<?php else: ?>
<a href="/read/<?= $email ?>/<?= $ed['id'] ?>" hx-get="/api/read/<?= $email ?>/<?= $ed['id'] ?>" hx-push-url="/read/<?= $email ?>/<?= $ed['id'] ?>" hx-target="#main" role="button">Open</a>
<a href="#" hx-get="/api/delete/<?= $email ?>/<?= $ed['id'] ?>" hx-confirm="Are you sure?" hx-target="closest tr" hx-swap="outerHTML swap:1s" role="button">Delete</a>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
Expand Down

0 comments on commit fac68fe

Please sign in to comment.