1 | @using HeuristicLab.Clients.Hive.WebJobManager.ViewModels.User;
|
---|
2 | @using HeuristicLab.Clients.Access;
|
---|
3 | @model UserViewModel
|
---|
4 |
|
---|
5 | <div>
|
---|
6 |
|
---|
7 | @Html.Partial("Navbar", new HeuristicLab.Clients.Hive.WebJobManager.ViewModels.NavbarViewModel("User"))
|
---|
8 |
|
---|
9 | <ul class="nav nav-pills nav-justified">
|
---|
10 | <li role="presentation"
|
---|
11 | class="">
|
---|
12 | <a asp-controller="User"
|
---|
13 | asp-action="Index">
|
---|
14 | <i class="fa fa-user"></i> Users
|
---|
15 | </a>
|
---|
16 | </li>
|
---|
17 | <li role="presentation"
|
---|
18 | class="active">
|
---|
19 | <a asp-controller="User"
|
---|
20 | asp-action="Groups">
|
---|
21 | <i class="fa fa-group"></i> Groups
|
---|
22 | </a>
|
---|
23 | </li>
|
---|
24 | <li role="presentation"
|
---|
25 | class="">
|
---|
26 | <a asp-controller="User"
|
---|
27 | asp-action="Roles">
|
---|
28 | <i class="fa fa-gavel"></i> Roles
|
---|
29 | </a>
|
---|
30 | </li>
|
---|
31 | </ul>
|
---|
32 | <div class="row"
|
---|
33 | style="text-align:center">
|
---|
34 | @Model.message
|
---|
35 | </div>
|
---|
36 | <div class="row"
|
---|
37 | style="padding:10px; margin-right:0px!important">
|
---|
38 | <div class="col-sm-4">
|
---|
39 | <div class="btn-group btn-group-justified btn-block"
|
---|
40 | role="group" style="margin-bottom:-4px">
|
---|
41 |
|
---|
42 | <a class="btn btn-info btn-lg btn-block disabled"
|
---|
43 | style="width:6%;box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
---|
44 | text-shadow:2px 2px black;">
|
---|
45 | <i class="fa fa-group"></i> @Model.ugroups.Count Group@(Model.ugroups.Count != 1 ? "s" : "")
|
---|
46 | </a>
|
---|
47 | <a class="btn btn-success btn-block
|
---|
48 | @(Model.SelectedGroup.Id == Guid.Empty ? "active" : "")
|
---|
49 | "
|
---|
50 | asp-controller="User"
|
---|
51 | asp-action="SelectGroup"
|
---|
52 | asp-route-id="@Guid.Empty"
|
---|
53 | onclick="showGroup()"
|
---|
54 | style="box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
---|
55 | text-shadow:2px 2px black;">
|
---|
56 | <i class="fa fa-plus-circle"></i>
|
---|
57 | </a>
|
---|
58 | </div>
|
---|
59 | <div class="btn-group-vertical btn-block">
|
---|
60 |
|
---|
61 | @foreach (var group in Model.ugroups)
|
---|
62 | {
|
---|
63 | <a class="btn btn-default @( group.Id == Model.SelectedGroup.Id ? "active" : "" )"
|
---|
64 | style="box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);"
|
---|
65 | asp-controller="User"
|
---|
66 | asp-action="SelectGroup"
|
---|
67 | asp-route-id="@group.Id"
|
---|
68 | onclick="showGroup()">
|
---|
69 | @group.Name
|
---|
70 | </a>
|
---|
71 | }
|
---|
72 | </div>
|
---|
73 | </div>
|
---|
74 | <p style="display:none"
|
---|
75 | id="saver"
|
---|
76 | class="text-center">
|
---|
77 | <br /><br /><br /><br /><br /><br /><br />
|
---|
78 | <i class="fa fa-save fa-spin fa-5x" id="spinner">
|
---|
79 | </i>
|
---|
80 | </p>
|
---|
81 | <p style="display:none"
|
---|
82 | id="group"
|
---|
83 | class="text-center">
|
---|
84 | <br /><br /><br /><br /><br /><br /><br />
|
---|
85 | <i class="fa fa-group fa-spin fa-5x" id="spinner">
|
---|
86 | </i>
|
---|
87 | </p>
|
---|
88 | <p style="display:none"
|
---|
89 | id="deleter"
|
---|
90 | class="text-center">
|
---|
91 | <br /><br /><br /><br /><br /><br /><br />
|
---|
92 | <i class="fa fa-trash-o fa-spin fa-5x" id="spinner">
|
---|
93 | </i>
|
---|
94 | </p>
|
---|
95 |
|
---|
96 | <div class="col-sm-8"
|
---|
97 | id="content"
|
---|
98 | style="padding:5px; padding-left:10px;">
|
---|
99 | @if (Model.SelectedGroup != null)
|
---|
100 | {
|
---|
101 | <div class="panel panel-default"
|
---|
102 | style="border-width:2px!important;padding:17px;
|
---|
103 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);">
|
---|
104 | <div class="row">
|
---|
105 | <h2 style="padding-left:20px">
|
---|
106 | @if (Model.SelectedGroup.Id != Guid.Empty)
|
---|
107 | {
|
---|
108 | <i class="fa fa-group"></i> @Model.SelectedGroup.Name
|
---|
109 | }
|
---|
110 | else
|
---|
111 | {
|
---|
112 | <i class='fa fa-plus-circle'></i> @("Add new group")
|
---|
113 |
|
---|
114 | }
|
---|
115 | </h2>
|
---|
116 | <form class="form-horizontal"
|
---|
117 | method="post"
|
---|
118 | asp-action="saveGroup"
|
---|
119 | asp-controller="User" enctype="multipart/form-data">
|
---|
120 | <div class="form-group">
|
---|
121 | <label for="inpgroupname"
|
---|
122 | class="col-sm-3 control-label">
|
---|
123 | Group name
|
---|
124 | </label>
|
---|
125 | <div class="col-sm-8">
|
---|
126 | <input type="text"
|
---|
127 | class="form-control"
|
---|
128 | id="inpgroupname"
|
---|
129 | name="inpgroupname"
|
---|
130 | placeholder="Group name"
|
---|
131 | onkeydown="triggerSave()"
|
---|
132 | value="@Model.SelectedGroup.Name">
|
---|
133 | </div>
|
---|
134 | </div>
|
---|
135 | <input type="text"
|
---|
136 | style="display:none"
|
---|
137 | id="u"
|
---|
138 | name="u"
|
---|
139 | value="@Model.SelectedGroup.Id" />
|
---|
140 |
|
---|
141 | @if (Model.SelectedGroup.Id != Guid.Empty)
|
---|
142 | {
|
---|
143 | <div class="form-group">
|
---|
144 | <label class="col-sm-3 control-label">
|
---|
145 | Group id
|
---|
146 | </label>
|
---|
147 | <label class="col-sm-8 control-label" style="text-align:left">
|
---|
148 | @Model.SelectedGroup.Id
|
---|
149 | </label>
|
---|
150 | <input type="text"
|
---|
151 | style="display:none"
|
---|
152 | id="u"
|
---|
153 | name="u"
|
---|
154 | value="@Model.SelectedGroup.Id" />
|
---|
155 | </div>
|
---|
156 | <div class="form-group">
|
---|
157 | <label class="col-sm-3 control-label">
|
---|
158 | Members
|
---|
159 | </label>
|
---|
160 | <div class="col-sm-8 control-label" >
|
---|
161 |
|
---|
162 | @foreach (var member in Model.SelectedGroupMembers)
|
---|
163 | {
|
---|
164 | <div class="row">
|
---|
165 | <p class="col-sm-10" style="text-align:left">
|
---|
166 |
|
---|
167 | @if (member is User)
|
---|
168 | {
|
---|
169 | var umember = (User)member;
|
---|
170 | <i class="fa fa-user"></i> @(umember.UserName + "(" + umember.FullName + ")")
|
---|
171 |
|
---|
172 |
|
---|
173 | }
|
---|
174 | else if (member is UserGroup)
|
---|
175 | {
|
---|
176 | var gmember = (UserGroup)member;
|
---|
177 | <i class="fa fa-group"></i> @(gmember.Name)
|
---|
178 |
|
---|
179 | }
|
---|
180 |
|
---|
181 | </p>
|
---|
182 | <p class="col-sm-2">
|
---|
183 | <a class="btn btn-danger"
|
---|
184 | asp-controller="User"
|
---|
185 | asp-action="deleteMember"
|
---|
186 | asp-route-g="@Model.SelectedGroup.Id"
|
---|
187 | asp-route-m="@member.Id"
|
---|
188 | onclick="showDeleter()">
|
---|
189 | <i class="fa fa-trash-o"></i>
|
---|
190 | </a>
|
---|
191 | </p>
|
---|
192 | </div>
|
---|
193 | }
|
---|
194 | @if (Model.SelectedGroupMembers.Count == 0)
|
---|
195 | {
|
---|
196 | <p style="text-align:left">This group currently has no members</p>
|
---|
197 |
|
---|
198 | }
|
---|
199 | </div>
|
---|
200 | </div>
|
---|
201 | }
|
---|
202 | <div class="row" style="margin-left:10px;margin-right:10px;margin-top:-10px">
|
---|
203 | <a class="btn btn-primary"
|
---|
204 | data-toggle="collapse"
|
---|
205 | href="#addmembers"
|
---|
206 | aria-expanded="false"
|
---|
207 | aria-controls="addmembers"
|
---|
208 | style="margin:10px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
---|
209 | text-shadow:2px 2px black;">
|
---|
210 | Add members
|
---|
211 | </a>
|
---|
212 | <div class="collapse"
|
---|
213 | id="addmembers">
|
---|
214 | <div class="panel panel-primary col-sm-6" style="padding:0px">
|
---|
215 | <div class="panel-heading">
|
---|
216 | <p>
|
---|
217 | <i class="fa fa-user"></i> Users
|
---|
218 | <button class="btn btn-sm btn-default"
|
---|
219 | type="button"
|
---|
220 | onclick="selectAll('userstoadd'); triggerSave()">
|
---|
221 | Select all
|
---|
222 | </button>
|
---|
223 | <button class="btn btn-sm btn-default"
|
---|
224 | type="button"
|
---|
225 | onclick="deselectAll('userstoadd'); triggerSave()">
|
---|
226 | Deselect all
|
---|
227 | </button>
|
---|
228 | </p>
|
---|
229 | </div>
|
---|
230 | <div class="panel-body">
|
---|
231 | @foreach (var user in Model.users)
|
---|
232 | {
|
---|
233 | <div class="checkbox">
|
---|
234 | <label>
|
---|
235 | <input type="checkbox"
|
---|
236 | name="userstoadd"
|
---|
237 | @(Model.SelectedGroupMembers.Contains(user) ? "checked disabled" : "")
|
---|
238 | value="@user.Id"
|
---|
239 | onclick="triggerSave()">
|
---|
240 | @user.UserName (@user.FullName)
|
---|
241 | </label>
|
---|
242 | </div>
|
---|
243 |
|
---|
244 | }
|
---|
245 | </div>
|
---|
246 | </div>
|
---|
247 | <div class="panel panel-primary col-sm-6" style="padding:0px">
|
---|
248 | <div class="panel-heading">
|
---|
249 | <p>
|
---|
250 | <i class="fa fa-group"></i> Groups
|
---|
251 |
|
---|
252 | <button class="btn btn-sm btn-default"
|
---|
253 | type="button"
|
---|
254 | onclick="selectAll('groupstoadd'); triggerSave()">
|
---|
255 | Select all
|
---|
256 | </button>
|
---|
257 | <button class="btn btn-sm btn-default"
|
---|
258 | type="button"
|
---|
259 | onclick="deselectAll('groupstoadd'); triggerSave()">
|
---|
260 | Deselect all
|
---|
261 | </button>
|
---|
262 | </p>
|
---|
263 | </div>
|
---|
264 | <div class="panel-body">
|
---|
265 | @foreach (var group in Model.ugroups)
|
---|
266 | {
|
---|
267 | <div class="checkbox">
|
---|
268 | <label>
|
---|
269 | <input type="checkbox"
|
---|
270 | name="groupstoadd"
|
---|
271 | @(Model.SelectedGroupMembers.Contains(group) ||
|
---|
272 | Model.SelectedGroup.Id == group.Id ? "checked disabled" : "")
|
---|
273 | value="@group.Id"
|
---|
274 | onclick="triggerSave()">
|
---|
275 | @group.Name @( Model.SelectedGroup.Id == group.Id ? "(selected group)" : "")
|
---|
276 | </label>
|
---|
277 | </div>
|
---|
278 |
|
---|
279 | }
|
---|
280 | </div>
|
---|
281 | </div>
|
---|
282 | </div>
|
---|
283 | </div>
|
---|
284 | @if (Model.SelectedGroup.Id == Guid.Empty)
|
---|
285 | {//New goup
|
---|
286 | <div class="form-group">
|
---|
287 | <div class="col-sm-offset-3 col-sm-9">
|
---|
288 | <button type="submit"
|
---|
289 | id="inpsaver"
|
---|
290 | disabled
|
---|
291 | class="btn btn-default"
|
---|
292 | onclick="showSaver()">
|
---|
293 | <i class="fa fa-plus-circle"></i> Add group
|
---|
294 | </button>
|
---|
295 | </div>
|
---|
296 | </div>
|
---|
297 |
|
---|
298 |
|
---|
299 | }
|
---|
300 | else
|
---|
301 | {//Changing an existing group
|
---|
302 |
|
---|
303 | <div class="form-group">
|
---|
304 | <div class="col-sm-offset-3 col-sm-3">
|
---|
305 | <button type="submit"
|
---|
306 | id="inpsaver"
|
---|
307 | disabled
|
---|
308 | class="btn btn-default"
|
---|
309 | onclick="showSaver()">
|
---|
310 | <i class="fa fa-save"></i> Save changes
|
---|
311 | </button>
|
---|
312 | </div>
|
---|
313 | <div class="col-sm-5">
|
---|
314 | <a class="btn btn-danger pull-right"
|
---|
315 | asp-controller="User"
|
---|
316 | asp-action="deleteGroup"
|
---|
317 | asp-route-id="@Model.SelectedGroup.Id"
|
---|
318 | onclick="showDeleter()">
|
---|
319 | <i class="fa fa-trash-o"></i> Delete group
|
---|
320 | </a>
|
---|
321 | </div>
|
---|
322 | </div>
|
---|
323 |
|
---|
324 |
|
---|
325 |
|
---|
326 | }
|
---|
327 | <script type="text/javascript">
|
---|
328 | function triggerSave() {
|
---|
329 | if ($("#inpgroupname").val() != "") {
|
---|
330 | document.getElementById("inpsaver").className = "btn btn-lg btn-success";
|
---|
331 | document.getElementById("inpsaver").disabled = false;
|
---|
332 | }
|
---|
333 | else {
|
---|
334 | document.getElementById("inpsaver").className = "btn btn-default";
|
---|
335 | document.getElementById("inpsaver").disabled = true;
|
---|
336 |
|
---|
337 | }
|
---|
338 |
|
---|
339 | }
|
---|
340 | </script>
|
---|
341 | </form>
|
---|
342 |
|
---|
343 | </div>
|
---|
344 | </div>
|
---|
345 |
|
---|
346 | }
|
---|
347 | </div>
|
---|
348 | </div>
|
---|
349 | <script type="text/javascript">
|
---|
350 | function showSaver() {
|
---|
351 | document.getElementById("content").style.display = "none";
|
---|
352 | document.getElementById("saver").style.display = "";
|
---|
353 |
|
---|
354 | }
|
---|
355 | function showGroup() {
|
---|
356 | document.getElementById("content").style.display = "none";
|
---|
357 | document.getElementById("group").style.display = "";
|
---|
358 |
|
---|
359 | }
|
---|
360 | function showDeleter() {
|
---|
361 | document.getElementById("content").style.display = "none";
|
---|
362 | document.getElementById("deleter").style.display = "";
|
---|
363 | }
|
---|
364 | function selectAll(name) {
|
---|
365 | checkboxes = document.getElementsByName(name);
|
---|
366 | for (var i = 0, n = checkboxes.length; i < n; i++) {
|
---|
367 | checkboxes[i].checked = true;
|
---|
368 | }
|
---|
369 | }
|
---|
370 | function deselectAll(name) {
|
---|
371 | checkboxes = document.getElementsByName(name);
|
---|
372 | for (var i = 0, n = checkboxes.length; i < n; i++) {
|
---|
373 | if (checkboxes[i].disabled == false)
|
---|
374 | checkboxes[i].checked = false;
|
---|
375 | }
|
---|
376 | }
|
---|
377 | </script>
|
---|
378 | </div>
|
---|