Files
zoneminder/web/skins/classic/views/_options_roles.php
T
IgorA100 8009884171 - Moved the getDelConfirmModal() function from options.js to skin.js
- Removed the getDelConfirmModal() function (and its call) from report.js, options.js, reports.js, devices.js, +++controlcaps.js(?view=options&tab=control), and snapshots.js. This is because it's now a single function in skin.js, which is called when the "Delete" button is pressed, rather than during page initialization.
- Slightly modified the local functions of manageDelConfirmModalBtns(). Removed the listener, so the code is executed immediately.
- You can now call local functions from the global getDelConfirmModal() function (instead of just executing submitThisForm() ). Applies to report.js, reports.js, devices.js, controlcaps.js, snapshots.js
- Changed the style of the "Delete" button on the Groups page
- Added deletion confirmation to the Storage, Roles, and Groups pages
- On the Event page, deletion permissions were broken. Deletes were allowed for those who did NOT have edit permissions, but deletions were blocked for those who did. !
- On the Report page, deletion didn't work and still doesn't work. This needs to be addressed, or maybe it's possible to delete reports only on the Reports page. (FIXED...)
- On the Devices page, the "canEdit.Device" permissions check was being performed, but it should be performed like this: "canEdit.Devices"
- The $action variable was not defined in \ajax\devices.php
- Added translations.
- Added a style for the disabled "Delete" button
- Minor fixes
2026-05-04 19:09:10 +03:00

77 lines
4.0 KiB
PHP

<?php
require_once('includes/User_Role.php');
?>
<form name="roleForm" method="post" action="?">
<input type="hidden" name="view" value="<?php echo $view ?>"/>
<input type="hidden" name="tab" value="<?php echo $tab ?>"/>
<input type="hidden" name="action" value="delete"/>
<input type="hidden" name="object" value="role"/>
<div id="options">
<div class="col button-block">
<div id="contentButtons">
<?php echo makeButton('?view=role&rid=0', 'AddNewRole', $canEdit); ?>
<button type="button" class="btn-danger" name="deleteBtn" value="Delete" data-on-click-this="DeleteRole" disabled="disabled"><?php echo translate('Delete') ?></button>
</div>
</div>
<div class="wrapper-scroll-table">
<div class="col">
<table id="contentTable"
class="table-sm table-striped"
style="display:none;"
data-click-to-select="true"
data-check-on-init="true"
data-mobile-responsive="true"
data-min-width="562"
data-show-export="true"
>
<thead class="thead-highlight">
<tr>
<th class="colMark"><?php echo translate('Mark') ?></th>
<th data-sortable="true" class="colName"><?php echo translate('Name') ?></th>
<th data-sortable="true" class="colDescription"><?php echo translate('Description') ?></th>
<th data-sortable="true" class="colStream"><?php echo translate('Stream') ?></th>
<th data-sortable="true" class="colEvents"><?php echo translate('Events') ?></th>
<th data-sortable="true" class="colControl"><?php echo translate('Control') ?></th>
<th data-sortable="true" class="colMonitors"><?php echo translate('Monitors') ?></th>
<th data-sortable="true" class="colGroups"><?php echo translate('Groups') ?></th>
<th data-sortable="true" class="colSnapshots"><?php echo translate('Snapshots') ?></th>
<th data-sortable="true" class="colSystem"><?php echo translate('System') ?></th>
<th data-sortable="true" class="colDevices"><?php echo translate('Devices') ?></th>
<th data-sortable="true" class="colUsers"><?php echo translate('Users') ?></th>
</tr>
</thead>
<tbody>
<?php
foreach (ZM\User_Role::find([], ['order'=>'Name']) as $role) {
$users = $role->Users();
$user_count = count($users);
?>
<tr>
<td class="colMark"><input type="checkbox" name="markRids[]" value="<?php echo $role->Id() ?>" data-on-click-this="configureDeleteButton"<?php echo (!$canEdit) ? ' disabled="disabled"' : '' ?>/></td>
<td class="colName"><?php echo makeLink('?view=role&amp;rid='.$role->Id(), validHtmlStr($role->Name()), $canEdit) ?></td>
<td class="colDescription"><?php echo validHtmlStr($role->Description()) ?></td>
<td class="colStream"><?php echo validHtmlStr($role->Stream()) ?></td>
<td class="colEvents"><?php echo validHtmlStr($role->Events()) ?></td>
<td class="colControl"><?php echo validHtmlStr($role->Control()) ?></td>
<td class="colMonitors"><?php echo validHtmlStr($role->Monitors()) ?></td>
<td class="colGroups"><?php echo validHtmlStr($role->Groups()) ?></td>
<td class="colSnapshots"><?php echo validHtmlStr($role->Snapshots()) ?></td>
<td class="colSystem"><?php echo validHtmlStr($role->System()) ?></td>
<td class="colDevices"><?php echo validHtmlStr($role->Devices()) ?></td>
<td class="colUsers"><?php echo $user_count ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div><!-- .col -->
</div><!-- .wrapper-scroll-table -->
</div> <!-- #options -->
<script nonce="<?php echo $cspNonce ?>">
window.addEventListener("DOMContentLoaded",
function() {
$j('#contentTable').bootstrapTable({icons: icons}).show();
});
</script></form>