Skip to content

Commit

Permalink
add comments in all menus (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
David Coutadeur authored and davidcoutadeur committed Oct 31, 2024
1 parent 8d136e6 commit c1ffc73
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 15 deletions.
7 changes: 6 additions & 1 deletion htdocs/disableaccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
$dn = "";
$password = "";
$comment = "";
$returnto = "display";

if (isset($_POST["returnto"]) and $_POST["returnto"]) {
$returnto = $_POST["returnto"];
}

if (isset($_POST["dn"]) and $_POST["dn"]) {
$dn = $_POST["dn"];
Expand Down Expand Up @@ -47,4 +52,4 @@
auditlog($audit_log_file, $dn, $audit_admin, "disableaccount", $result, $comment);
}

header('Location: index.php?page=display&dn='.$dn.'&disableaccountresult='.$result);
header('Location: index.php?page='.$returnto.'&dn='.$dn.'&disableaccountresult='.$result);
4 changes: 4 additions & 0 deletions htdocs/enableaccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
$comment = "";
$returnto = "display";

if (isset($_POST["returnto"]) and $_POST["returnto"]) {
$returnto = $_POST["returnto"];
}

if (isset($_POST["dn"]) and $_POST["dn"]) {
$dn = $_POST["dn"];
} else if (isset($_GET["dn"]) and $_GET["dn"]) {
Expand Down
7 changes: 6 additions & 1 deletion htdocs/lockaccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
$result = "";
$dn = "";
$comment = "";
$returnto = "display";

if (isset($_POST["returnto"]) and $_POST["returnto"]) {
$returnto = $_POST["returnto"];
}

if (isset($_POST["dn"]) and $_POST["dn"]) {
$dn = $_POST["dn"];
Expand Down Expand Up @@ -50,4 +55,4 @@
auditlog($audit_log_file, $dn, $audit_admin, "lockaccount", $result, $comment);
}

header('Location: index.php?page=display&dn='.$dn.'&lockaccountresult='.$result);
header('Location: index.php?page='.$returnto.'&dn='.$dn.'&lockaccountresult='.$result);
4 changes: 4 additions & 0 deletions htdocs/unlockaccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
$comment = "";
$returnto = "display";

if (isset($_POST["returnto"]) and $_POST["returnto"]) {
$returnto = $_POST["returnto"];
}

if (isset($_POST["dn"]) and $_POST["dn"]) {
$dn = $_POST["dn"];
} else if (isset($_GET["dn"]) and $_GET["dn"]) {
Expand Down
3 changes: 2 additions & 1 deletion templates/comment.tpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<form id={$method} method="post" action="index.php?page={$page}">
<input type="hidden" name="dn" value="{$dn}" />
<div class="modal fade" id="commentModal" tabindex="-1" aria-labelledby="CommentModal" aria-hidden="true">
<input type="hidden" name="returnto" value="{$returnto}" />
<div class="modal fade" id="commentModal{$method}{$dn|sha1}" tabindex="-1" aria-labelledby="CommentModal{$method}{$dn|sha1}" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
Expand Down
8 changes: 4 additions & 4 deletions templates/display.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
<div class="alert alert-danger"><i class="fa fa-fw fa-exclamation-triangle"></i> {$msg_accountnotunlocked}</div>
{/if}
{if $use_unlockcomment}
<button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#commentModal">
<button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#commentModalunlock{$dn|sha1}">
<i class="fa fa-fw fa-unlock me-2"></i>{$msg_unlockaccount}
<i class="fa fa-fw fa-info-circle text-body-tertiary ms-2" title="{$msg_comment_needed}"></i>
</button>
Expand Down Expand Up @@ -277,7 +277,7 @@
<div class="alert alert-danger"><i class="fa fa-fw fa-exclamation-triangle"></i> {$msg_accountnotlocked}</div>
{/if}
{if $use_lockcomment}
<button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#commentModal">
<button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#commentModallock{$dn|sha1}">
<i class="fa fa-fw fa-lock me-2"></i>{$msg_lockaccount}
<i class="fa fa-fw fa-info-circle text-body-tertiary ms-2" title="{$msg_comment_needed}"></i>
</button>
Expand Down Expand Up @@ -326,7 +326,7 @@
<div class="alert alert-danger"><i class="fa fa-fw fa-exclamation-triangle"></i> {$msg_accountnotdisabled}</div>
{/if}
{if $use_disablecomment}
<button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#commentModal">
<button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#commentModaldisable{$dn|sha1}">
<i class="fa fa-fw fa-user-slash me-2"></i>{$msg_disableaccount}
<i class="fa fa-fw fa-info-circle text-body-tertiary ms-2" title="{$msg_comment_needed}"></i>
</button>
Expand Down Expand Up @@ -358,7 +358,7 @@
<div class="alert alert-danger"><i class="fa fa-fw fa-exclamation-triangle"></i> {$msg_accountnotenabled}</div>
{/if}
{if $use_enablecomment}
<button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#commentModal">
<button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#commentModalenable{$dn|sha1}">
<i class="fa fa-fw fa-user-check me-2"></i>{$msg_enableaccount}
<i class="fa fa-fw fa-info-circle text-body-tertiary ms-2" title="{$msg_comment_needed}"></i>
</button>
Expand Down
38 changes: 30 additions & 8 deletions templates/listing_table.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,38 @@
<i class="fa fa-fw fa-id-card"></i>
</a>
{if $display_unlock_button}
<a href="index.php?page=unlockaccount&dn={$entry.dn|escape:'url'}&returnto=searchlocked"
class="btn btn-success btn-sm" role="button" title="{$msg_unlockaccount}">
<i class="fa fa-fw fa-unlock"></i>
</a>
{if $use_unlockcomment}
<button type="button" class="btn btn-success btn-sm" data-bs-toggle="modal" data-bs-target="#commentModalunlock{$entry.dn|sha1}">
<i class="fa fa-fw fa-unlock"></i>{$msg_unlockaccount}
<i class="fa fa-fw fa-info-circle text-body-tertiary" title="{$msg_comment_needed}"></i>
</button>
<div>
{include 'comment.tpl' method=unlock page=unlockaccount title=$msg_unlockaccount dn=$entry.dn returnto=$page}
</div>
{else}
<a href="index.php?page=unlockaccount&dn={$entry.dn|escape:'url'}&returnto=searchlocked"
class="btn btn-success btn-sm" role="button" title="{$msg_unlockaccount}">
<i class="fa fa-fw fa-unlock"></i>
</a>
{/if}
{/if}
{if $display_enable_button}
<a href="index.php?page=enableaccount&dn={$entry.dn|escape:'url'}&returnto=searchdisabled"
class="btn btn-success btn-sm" role="button" title="{$msg_enableaccount}">
<i class="fa fa-fw fa-user-check"></i>
</a>
{if $use_enablecomment}
<button type="button" class="btn btn-success btn-sm" data-bs-toggle="modal" data-bs-target="#commentModalenable{$entry.dn|sha1}">
<i class="fa fa-fw fa-user-check"></i>{$msg_enableaccount}
<i class="fa fa-fw fa-info-circle text-body-tertiary" title="{$msg_comment_needed}"></i>
</button>
<div>
{include 'comment.tpl' method=enable page=enableaccount title=$msg_enableaccount dn=$entry.dn returnto=$page}
</div>
{else}
<a href="index.php?page=enableaccount&dn={$entry.dn|escape:'url'}&returnto=searchdisabled"
class="btn btn-success btn-sm" role="button" title="{$msg_enableaccount}">
<i class="fa fa-fw fa-user-check"></i>
</a>
{/if}


{/if}
</th>
{foreach $listing_columns as $column}
Expand Down

0 comments on commit c1ffc73

Please sign in to comment.