user-group-detail.html 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. {% extends '../layout/admin.html' %}
  2. {% block html_title %}{{ customTitle(t('UserGroup management') + '/' + userGroup.name) | preventXss }}{% endblock %}
  3. {% block content_header %}
  4. <div class="header-wrap">
  5. <header id="page-header">
  6. <h1 class="title" id="">{{ t('UserGroup management') + '/' + userGroup.name | preventXss }}</h1>
  7. </header>
  8. </div>
  9. {% endblock %}
  10. {% block content_main %}
  11. <div class="content-main">
  12. {% set smessage = req.flash('successMessage') %}
  13. {% if smessage.length %}
  14. <div class="alert alert-success">
  15. {{ smessage }}
  16. </div>
  17. {% endif %}
  18. {% set emessage = req.flash('errorMessage') %}
  19. {% if emessage.length %}
  20. <div class="alert alert-danger">
  21. {{ emessage }}
  22. </div>
  23. {% endif %}
  24. <div class="row">
  25. <div class="col-md-3">
  26. {% include './widget/menu.html' with {current: 'user-group'} %}
  27. </div>
  28. <div class="col-md-9">
  29. <a href="/admin/user-groups" class="btn btn-default">
  30. <i class="icon-fw ti-arrow-left" aria-hidden="true"></i>
  31. グループ一覧に戻る
  32. </a>
  33. <div class="modal fade" id="admin-add-user-group-relation-modal">
  34. <div class="modal-dialog">
  35. <div class="modal-content">
  36. <div class="modal-header">
  37. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  38. <h4 class="modal-title">
  39. グループへのユーザー追加
  40. </h4>
  41. </div>
  42. <div class="modal-body">
  43. <p>
  44. <strong>方法1.</strong> ユーザ名を入力して追加
  45. </p>
  46. <form class="form-inline" role="form" action="/admin/user-group-relation/create" method="post">
  47. <div class="form-group">
  48. <input type="text" name="user_name" class="form-control input-sm" id="inputRelatedUserName" placeholder="username">
  49. </div>
  50. <input type="hidden" name="user_group_id" value="{{userGroup.id}}">
  51. <input type="hidden" name="_csrf" value="{{ csrf() }}">
  52. <button type="submit" class="btn btn-sm btn-success">追加</button>
  53. </form>
  54. {% if 0 < notRelatedusers.length %}
  55. <hr>
  56. <p>
  57. <strong>方法2.</strong> ユーザーを下のリストから選択
  58. </p>
  59. <ul class="list-inline">
  60. {% for sUser in notRelatedusers %}
  61. <li>
  62. <form role="form" action="/admin/user-group-relation/create" method="post">
  63. <!-- <input type="hidden" name="user_name" value="{{sUser.username}}"> -->
  64. <input type="hidden" name="user_group_id" value="{{userGroup.id}}">
  65. <input type="hidden" name="_csrf" value="{{ csrf() }}">
  66. <button type="submit" name="user_name" value="{{sUser.username}}" class="btn btn-xs btn-primary">{{sUser.username}}</button>
  67. </form>
  68. </li>
  69. {% endfor %}
  70. </ul>
  71. {% endif %}
  72. </div>
  73. </div>
  74. <!-- /.modal-content -->
  75. </div>
  76. <!-- /.modal-dialog -->
  77. </div>
  78. <div class="m-t-20 form-box">
  79. <form action="/admin/user-group/{{userGroup.id}}/update" method="post" class="form-horizontal" role="form">
  80. <fieldset>
  81. <legend>基本情報</legend>
  82. <div class="form-group">
  83. <label for="name" class="col-sm-2 control-label">{{ t('Name') }}</label>
  84. <div class="col-sm-4">
  85. <input class="form-control" type="text" name="name" value="{{ userGroup.name }}" required>
  86. </div>
  87. </div>
  88. <div class="form-group">
  89. <label class="col-sm-2 control-label">{{ t('Created') }}</label>
  90. <div class="col-sm-4">
  91. <input class="form-control" type="text" disabled value="{{userGroup.createdAt|date('Y-m-d', sRelation.relatedUser.createdAt.getTimezoneOffset()) }}">
  92. </div>
  93. </div>
  94. <div class="form-group">
  95. <div class="col-sm-offset-2 col-sm-10">
  96. <input type="hidden" name="_csrf" value="{{ csrf() }}">
  97. <button type="submit" class="btn btn-primary">{{ t('Update') }}</button>
  98. </div>
  99. </div>
  100. </fieldset>
  101. </form>
  102. </div>
  103. <div class="m-t-20 form-box">
  104. <fieldset>
  105. <legend>グループ画像の設定</legend>
  106. <div class="form-group col-sm-8">
  107. <h4>
  108. {{ t('Upload Image') }}
  109. </h4>
  110. <div class="form-group">
  111. <div id="pictureUploadFormMessage"></div>
  112. <label for="" class="col-sm-4 control-label">
  113. {{ t('Current Image') }}
  114. </label>
  115. <div class="col-sm-8">
  116. <p>
  117. <img src="{{ userGroup|uploadedpicture }}" id="settingUserPicture" class="picture picture-lg img-circle">
  118. <br>
  119. </p>
  120. <p>
  121. {% if userGroup.image %}
  122. <form action="/admin/user-group/{{userGroup.id}}/picture/delete" method="post" class="form-horizontal" role="form" onsubmit="return window.confirm('{{ t('Delete this image?') }}');">
  123. <button type="submit" class="btn btn-danger">{{ t('Delete Image') }}</button>
  124. </form>
  125. {% endif %}
  126. </p>
  127. </div>
  128. </div><!-- /.form-group -->
  129. <div class="form-group">
  130. <label for="" class="col-sm-4 control-label">
  131. {{ t('Upload new image') }}
  132. </label>
  133. <div class="col-sm-8">
  134. {% if isUploadable() %}
  135. <form action="/_api/admin/user-group/{{userGroup.id}}/picture/upload" id="pictureUploadForm" method="post" class="form-horizontal" role="form" enctype="multipart/form-data">
  136. <input name="userGroupPicture" type="file" accept="image/*">
  137. <div id="pictureUploadFormProgress">
  138. </div>
  139. </form>
  140. {% else %} * {{ t('page_me.form_help.profile_image1') }}
  141. <br> * {{ t('page_me.form_help.profile_image2') }}
  142. <br> {% endif %}
  143. </div>
  144. </div><!-- /.form-group -->
  145. </div><!-- /.col-sm- -->
  146. </fieldset>
  147. </div><!-- /.form-box -->
  148. <legend class="m-t-20">ユーザー一覧</legend>
  149. <table class="table table-bordered table-user-list">
  150. <thead>
  151. <tr>
  152. <th width="100px">#</th>
  153. <th>
  154. <code>username</code>
  155. </th>
  156. <th>名前</th>
  157. <th width="100px">作成日</th>
  158. <th width="150px">最終ログイン</th>
  159. <th width="70px"></th>
  160. </tr>
  161. </thead>
  162. <tbody>
  163. {% for sRelation in userGroupRelations %}
  164. {% set sUser = sRelation.relatedUser%}
  165. <tr>
  166. <td>
  167. <img src="{{ sRelation.relatedUser|picture }}" class="picture img-circle" />
  168. </td>
  169. <td>
  170. <strong>{{ sRelation.relatedUser.username }}</strong>
  171. </td>
  172. <td>{{ sRelation.relatedUser.name }}</td>
  173. <td>{{ sRelation.relatedUser.createdAt|date('Y-m-d', sRelation.relatedUser.createdAt.getTimezoneOffset()) }}</td>
  174. <td>
  175. {% if sRelation.relatedUser.lastLoginAt %} {{ sRelation.relatedUser.lastLoginAt|date('Y-m-d H:i', sRelation.relatedUser.createdAt.getTimezoneOffset()) }} {% endif %}
  176. </td>
  177. <td>
  178. <div class="btn-group admin-user-menu">
  179. <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
  180. <i class="icon-settings"></i> <span class="caret"></span>
  181. </button>
  182. <ul class="dropdown-menu" role="menu">
  183. <form id="form_removeFromGroup_{{ sUser.id }}" action="/admin/user-group-relation/{{userGroup._id.toString()}}/remove-relation/{{ sRelation._id.toString() }}" method="post">
  184. <input type="hidden" name="_csrf" value="{{ csrf() }}">
  185. </form>
  186. <li>
  187. <a href="javascript:form_removeFromGroup_{{ sUser.id }}.submit()">
  188. <i class="icon-fw icon-user-unfollow"></i> グループから外す
  189. </a>
  190. </li>
  191. </ul>
  192. </div>
  193. </td>
  194. </tr>
  195. {% endfor %}
  196. {% if 0 < notRelatedusers.length %}
  197. <tr>
  198. <td></td>
  199. <td class="text-center">
  200. <button class="btn btn-default" data-target="#admin-add-user-group-relation-modal" data-toggle="modal">
  201. <i class="ti-plus"></i>
  202. </button>
  203. </td>
  204. <td></td>
  205. <td></td>
  206. <td></td>
  207. <td></td>
  208. </tr>
  209. {% endif %}
  210. </tbody>
  211. </table>
  212. <!-- {% include '../widget/pager.html' with {path: "/admin/user-group-detail", pager: pager} %} -->
  213. <legend class="m-t-20">ページ一覧</legend>
  214. {% if pageGroupRelations.length == 0 %}<p>グループが閲覧権限を保有するページはありません</p>{% endif %}
  215. {% include '../widget/page_list.html' with { pages: pageGroupRelations, pagePropertyName: 'targetPage' } %}
  216. </div>
  217. </div>
  218. </div>
  219. {% endblock content_main %}
  220. {% block content_footer %}
  221. {% endblock content_footer %}