diff options
Diffstat (limited to 'modules-available/permissionmanager/templates')
4 files changed, 259 insertions, 4 deletions
diff --git a/modules-available/permissionmanager/templates/_page.html b/modules-available/permissionmanager/templates/_page.html index dfc941ae..3b436eda 100644 --- a/modules-available/permissionmanager/templates/_page.html +++ b/modules-available/permissionmanager/templates/_page.html @@ -1,4 +1,20 @@ -<div style="border:5px solid red"> - <h1>{{lang_hello}}, {{foo}}</h1> - ** {{now}} ** -</div>
\ No newline at end of file +<form id="switchForm" method="GET" action="?do=permissionmanager"> + <input type="hidden" name="do" value="permissionmanager"> + + <div class="btn-group"> + <button class="btn {{rolesButtonClass}}" type="submit" name="show" value="roles"> + <span class="glyphicon glyphicon-education"></span> + {{lang_Roles}} + </button> + + <button class="btn {{usersButtonClass}}" type="submit" name="show" value="users"> + <span class="glyphicon glyphicon-user"></span> + {{lang_Users}} + </button> + + <button class="btn {{locationsButtonClass}}" type="submit" name="show" value="locations"> + <span class="glyphicon glyphicon-home"></span> + {{lang_Locations}} + </button> + </div> +</form>
\ No newline at end of file diff --git a/modules-available/permissionmanager/templates/locationsTable.html b/modules-available/permissionmanager/templates/locationsTable.html new file mode 100644 index 00000000..bd3b7f88 --- /dev/null +++ b/modules-available/permissionmanager/templates/locationsTable.html @@ -0,0 +1,14 @@ +<div class="row"> + <div class="col-md-12"> + <table id="locationsTable" class="table table-condensed table-hover"> + <thead> + + </thead> + + <tbody> + + + </tbody> + </table> + </div> +</div>
\ No newline at end of file diff --git a/modules-available/permissionmanager/templates/rolesTable.html b/modules-available/permissionmanager/templates/rolesTable.html new file mode 100644 index 00000000..40cdda96 --- /dev/null +++ b/modules-available/permissionmanager/templates/rolesTable.html @@ -0,0 +1,65 @@ +<form method="post" action="?do=permissionmanager"> + <input type="hidden" name="token" value="{{token}}"> + + <button class="btn btn-success" type="button" onclick="openRoleEditor()"><span class="glyphicon glyphicon-plus"></span> {{lang_newRole}}</button> + + <div class="row"> + <div class="col-md-12"> + <table id="rolesTable" class="table table-condensed table-hover"> + <thead> + <tr> + <th data-sort="string">{{lang_Roles}}</th> + <th>{{lang_Edit}}</th> + <th>{{lang_Delete}}</th> + </tr> + </thead> + + <tbody> + {{#roles}} + <tr> + <td>{{roleName}}</td> + <td> + <a href="?do=permissionmanager&show=roleEditor&roleid={{roleId}}">{{lang_Edit}}</a> + </td> + <td> + <a href="#deleteModal" data-toggle="modal" data-target="#deleteModal" onclick="deleteRole('{{roleId}}')">{{lang_Delete}}</a> + </td> + </tr> + {{/roles}} + </tbody> + </table> + </div> + </div> + + + <!-- Modals --> + <div class ="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> + <div class="modal-dialog" role="document"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + <h4 class="modal-title" id="myModalLabel">{{lang_Delete}}</h4> + </div> + <div class="modal-body"> + {{lang_deleteCheck}} + </div> + <div class="modal-footer"> + <input type="hidden" id="deleteId" name="deleteId" value=""/> + <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button> + <button type="submit" name="action" value="deleteRole" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> {{lang_Delete}}</button> + </div> + </div> + </div> + </div> + +</form> + +<script> + function openRoleEditor() { + window.location.href = "?do=permissionmanager&show=roleEditor" + } + + function deleteRole($roleId) { + $(".modal-footer #deleteId").val($roleId); + } +</script>
\ No newline at end of file diff --git a/modules-available/permissionmanager/templates/usersTable.html b/modules-available/permissionmanager/templates/usersTable.html new file mode 100644 index 00000000..3db1ebdb --- /dev/null +++ b/modules-available/permissionmanager/templates/usersTable.html @@ -0,0 +1,160 @@ +<form method="post" action="?do=permissionmanager"> + <input type="hidden" name="token" value="{{token}}"> + <button class="btn btn-success" type="button" data-toggle="modal" data-target="#addRoleToUserModal"><span class="glyphicon glyphicon-share-alt"></span> {{lang_addRole}}</button> + <button class="btn btn-danger" type="button" data-toggle="modal" data-target="#removeRoleFromUserModal"><span class="glyphicon glyphicon-trash"></span> {{lang_removeRole}}</button> + + <div class="row"> + <div class="col-md-12"> + <table id="usersTable" class="table table-condensed table-hover"> + <thead> + <tr> + <th data-sort="string">{{lang_Users}}</th> + <th>{{lang_Roles}}</th> + <th data-sort="int" data-sort-default="desc">{{lang_Selected}}</th> + </tr> + </thead> + + <tbody> + {{#user}} + <tr> + <td>{{name}}</td> + <td> + {{#role}} + <span class="label label-default customSpanMargin">{{.}}</span> + {{/role}} + </td> + <td data-sort-value="0"> + <div class="checkbox"> + <input id="{{userid}}" type="checkbox" name="users[]" value='{{userid}}'> + <label for="{{userid}}"></label> + </div> + </td> + </tr> + {{/user}} + </tbody> + </table> + </div> + </div> + + <!-- Modals --> + <div class ="modal fade" id="addRoleToUserModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> + <div class="modal-dialog" role="document"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + <h4 class="modal-title" id="myModalLabel">{{lang_addRole}}</h4> + </div> + <div class="modal-body"> + <div class="row"> + <div class="col-md-12 scrollingTable"> + <table id="addRoleToUserTable" class="table table-condensed table-hover"> + <thead> + <tr> + <th data-sort="string">{{lang_Roles}}</th> + <th data-sort="int" data-sort-default="desc">{{lang_Selected}}</th> + </tr> + </thead> + + <tbody> + {{#roles}} + <tr> + <td>{{roleName}}</td> + <td data-sort-value="0"> + <div class="checkbox"> + <input id="add{{roleId}}" type="checkbox" name="roles[]" value='{{roleId}}'> + <label for="add{{roleId}}"></label> + </div> + </td> + </tr> + {{/roles}} + </tbody> + </table> + </div> + </div> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button> + <button type="submit" name="action" value="addRoleToUser" class="btn btn-success" onclick="clearRemoveRoleModal()"><span class="glyphicon glyphicon-share-alt"></span> {{lang_addRole}}</button> + </div> + </div> + </div> + </div> + + <div class ="modal fade" id="removeRoleFromUserModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> + <div class="modal-dialog" role="document"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + <h4 class="modal-title" id="myModalLabel2">{{lang_Remove}}</h4> + </div> + <div class="modal-body"> + <div class="row"> + <div class="col-md-12 scrollingTable"> + <table id="removeRoleFromUserTable" class="table table-condensed table-hover"> + <thead> + <tr> + <th data-sort="string">{{lang_Roles}}</th> + <th data-sort="int" data-sort-default="desc">{{lang_Selected}}</th> + </tr> + </thead> + + <tbody> + {{#roles}} + <tr> + <td>{{roleName}}</td> + <td data-sort-value="0"> + <div class="checkbox"> + <input id="remove{{roleId}}" type="checkbox" name="roles[]" value='{{roleId}}'> + <label for="remove{{roleId}}"></label> + </div> + </td> + </tr> + {{/roles}} + </tbody> + </table> + </div> + </div> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button> + <button type="submit" name="action" value="removeRoleFromUser" class="btn btn-danger" onclick="clearAddRoleModal()"><span class="glyphicon glyphicon-trash"></span> {{lang_Remove}}</button> + </div> + </div> + </div> + </div> +</form> + +<script> + document.addEventListener("DOMContentLoaded", function() { + // if checked,: mark green, else: unmark + $('input:checkbox').change(function() { + if ($(this).is(':checked')) { + $(this).closest("td").data("sort-value", 1); + $(this).closest("tr").css("background-color", "#f2ffe6"); + } else { + $(this).closest("td").data("sort-value", 0); + $(this).closest("tr").css("background-color", ""); + } + + }); + + }); + + + // if remove-Role button is clicked, uncheck all checkboxes in add-role modal so they aren't submitted too + function clearAddRoleModal () { + $('#addRoleToUserModal') + .find("input[type=checkbox]") + .prop("checked", "") + .end(); + } + + // if add-Role button is clicked, uncheck all checkboxes in remove-role modal so they aren't submitted too + function clearRemoveRoleModal() { + $('#removeRoleFromUserModal') + .find("input[type=checkbox]") + .prop("checked", "") + .end(); + } + +</script>
\ No newline at end of file |