Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add comments in all menus (#127) #177

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading