user_getall.mak 8.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <%inherit file="local:templates.master_authenticated_left_treeview"/>
  2. <%namespace name="LEFT_MENU" file="tracim.templates.widgets.left_menu"/>
  3. <%namespace name="TIM" file="tracim.templates.pod"/>
  4. <%namespace name="TOOLBAR" file="tracim.templates.user_toolbars"/>
  5. <%namespace name="ROW" file="tracim.templates.widgets.row"/>
  6. <%namespace name="ICON" file="tracim.templates.widgets.icon"/>
  7. <%namespace name="BUTTON" file="tracim.templates.widgets.button"/>
  8. <%def name="title()">${_('Users')}</%def>
  9. <%def name="SIDEBAR_LEFT_CONTENT()">
  10. ${LEFT_MENU.TREEVIEW('sidebar-left-menu', '__')}
  11. </%def>
  12. <%def name="TITLE_ROW()">
  13. <div class="row-fluid">
  14. <div>
  15. ${ROW.TITLE_ROW(_('Users'), 'fa-user', '', 't-user-color', _('manage users and associated workspaces'))}
  16. </div>
  17. </div>
  18. </%def>
  19. <div class="adminuser__wrapper">
  20. ## ADD A USER
  21. % if fake_api.current_user.profile.id>=2:
  22. ## FIXME: check if the current_user is a workspace manager (so he is also allowed to create user)
  23. ## In this case the user is a pod manager, so he is allowed to create users (and to delete them)
  24. <!-- #### CREATE A USER #### -->
  25. <p class="t-spacer-above">
  26. <a class="btn btn-success" data-toggle="collapse" data-target="#create-user-form"><b>${_('Create a user account...')}</b></a>
  27. </p>
  28. <div id="create-user-form" class="collapse">
  29. <div class="pod-inline-form" >
  30. <form role="form" method="POST" action="${tg.url('/admin/users')}">
  31. <div class="form-group">
  32. <label for="user-name">${_('Name')}</label>
  33. <input name="name" type="text" class="form-control" id="user-name" placeholder="${_('Name')}">
  34. </div>
  35. <div class="form-group">
  36. <label for="user-email">${_('Email')}</label>
  37. <input name="email" type="text" class="form-control" id="user-email" placeholder="${_('Email address')}">
  38. </div>
  39. <div class="form-group">
  40. <label for="user-password">${_('Password')}</label>
  41. <input name="password" type="password" class="form-control" id="user-password" placeholder="${_('Optionnaly choose a password')}">
  42. </div>
  43. <div class="checkbox">
  44. <label>
  45. <input type="checkbox" class="checkbox" name="is_tracim_manager" id="is-tracim-manager"> ${_('This user can create workspaces')}
  46. </label>
  47. </div>
  48. <div class="checkbox disabled">
  49. <label>
  50. <input type="checkbox" class="checkbox" disabled name="is_tracim_admin" id="is-tracim-admin"> ${_('This user is an administrator')}
  51. </label>
  52. </div>
  53. <div class="checkbox">
  54. <label>
  55. <input type="checkbox" class="checkbox" checked name="send_email" id="send-email"> ${_('Send email to user')}
  56. </label>
  57. </div>
  58. <span class="pull-right" style="margin-top: 0.5em;">
  59. <button type="submit" class="btn btn-small btn-success" title="Add first comment"><i class=" fa fa-check"></i> ${_('Validate')}</button>
  60. </span>
  61. <script>
  62. $(document).ready(function() {
  63. $('#is-tracim-manager').change(function() {
  64. if($('#is-tracim-manager').prop('checked')==true) {
  65. console.log('now manager is checked');
  66. $('#is-tracim-admin').removeAttr('disabled');
  67. $('#is-tracim-admin').parent().parent().removeClass('disabled');
  68. } else {
  69. console.log('now manager is unchecked');
  70. $('#is-tracim-admin').prop('checked', false);
  71. $('#is-tracim-admin').attr('disabled', 'disabled');
  72. $('#is-tracim-admin').parent().parent().addClass('disabled');
  73. }
  74. });
  75. });
  76. </script>
  77. </form>
  78. <div style="clear: both;"></div>
  79. </div>
  80. </div>
  81. <!-- #### CREATE A USER [END] #### -->
  82. % endif
  83. ## ADD A USER [END]
  84. ## LIST OF USERS
  85. <div class="t-spacer-above">
  86. % if result.user_nb<=0:
  87. ${TIM.NO_CONTENT_INFO(_('There are no workspace yet. Start by <a class="alert-link" data-toggle="collapse" data-target="#create-workspace-form">creating a workspace</a>.'))}
  88. % else:
  89. <table class="table table-striped table-hover">
  90. <thead>
  91. <tr>
  92. <th></th>
  93. <th>${_('User')}</th>
  94. <th>${_('Email')}</th>
  95. <th>${_('Can create workspaces')}</th>
  96. <th>${_('Administrator')}</th>
  97. <th>${_('Notes')}</th>
  98. </tr>
  99. </thead>
  100. % for user in result.users:
  101. <tr class="${('t-less-visible', '')[user.enabled]}">
  102. % if user.enabled:
  103. <td>
  104. ${BUTTON.FA('fa-lightbulb-o fa-lg t-enabled-color', _('User enabled. Click to disable this user'), tg.url('/admin/users/{}/disable'.format(user.id)), fake_api.current_user, 3)}
  105. </td>
  106. <td><a href="${tg.url('/admin/users/{}'.format(user.id))}"><b>${user.name}</b></a></td>
  107. <td><a href="mailto:${user.email}">${user.email}</a></td>
  108. <td>
  109. <% icon = ('fa-square-o fa-lg t-disabled-color', 'fa-check-square-o fa-lg t-enabled-color')[user.profile.id>=2] %>
  110. <% linked_profile = ('tracim-profile-manager', 'tracim-profile-user')[user.profile.id>=2] %>
  111. <% linked_text = (_('Click to allow workspace creation'), _('Click to disallow workspace creation'))[user.profile.id>=2] %>
  112. ${BUTTON.FA(icon, linked_text, tg.url('/admin/users/{}/profile/switch?new_role={}'.format(user.id, linked_profile)), fake_api.current_user, 3)}
  113. </td>
  114. <td>
  115. <% icon = ('fa-square-o fa-lg t-disabled-color', 'fa-check-square-o fa-lg t-enabled-color')[user.profile.id>=3] %>
  116. <% linked_profile = ('tracim-profile-admin', 'tracim-profile-manager')[user.profile.id>=3] %>
  117. <% linked_text = (_('Click to give super user privileges'), _('Click to remove super user privileges'))[user.profile.id>=3] %>
  118. ${BUTTON.FA(icon, linked_text, tg.url('/admin/users/{}/profile/switch?new_role={}'.format(user.id, linked_profile)), fake_api.current_user, 3)}
  119. </td>
  120. % else:
  121. <td>
  122. ${BUTTON.FA('fa-lightbulb-o fa-lg t-disabled-color', _('User disabled. Click to enable this user'), tg.url('/admin/users/{}/enable'.format(user.id)), fake_api.current_user, 3)}
  123. </td>
  124. <td><a class="t-less-visible" href="${tg.url('/admin/users/{}'.format(user.id))}">${user.name}</a></td>
  125. <td>${user.email}</td>
  126. <td>
  127. <% icon = ('fa-square-o fa-lg t-disabled-color', 'fa-check-square-o fa-lg t-disabled-color')[user.profile.id>=2] %>
  128. ${ICON.FA(icon, _('User is disabled. No action allowed'))}
  129. </td>
  130. <td>
  131. <% icon = ('fa-square-o fa-lg t-disabled-color', 'fa-check-square-o fa-lg t-disabled-color')[user.profile.id>=3] %>
  132. <% linked_profile = ('tracim-profile-admin', 'tracim-profile-manager')[user.profile.id>=3] %>
  133. ${ICON.FA(icon, _('User is disabled. No action allowed'))}
  134. </td>
  135. % endif
  136. <td>
  137. % if False==user.has_password:
  138. ${ICON.FA_TOOLTIP('fa-key t-less-visible', _('This user has no password.'))}
  139. <span class="t-less-visible">${_('No password defined.')}</span>
  140. % endif
  141. </td>
  142. </tr>
  143. % endfor
  144. </table>
  145. % endif
  146. </div>
  147. ## LIST OF USERS [END]
  148. </div>