This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
/
usermanager.xhtml
149 lines (134 loc) · 6.03 KB
/
usermanager.xhtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:zanata="http://java.sun.com/jsf/composite/zanata">
<ui:composition template="../WEB-INF/template/template.xhtml">
<f:metadata>
<f:viewParam name="username" value="#{userAction.username}" />
<f:event type="preRenderView" listener="#{userSearch.loadUsers}"/>
<f:event type="preRenderView" listener="#{identity.checkRole('admin')}"/>
</f:metadata>
<ui:define name="page_title">#{msgs['jsf.ManageUsers']}</ui:define>
<ui:define name="center_content">
<zanata:confirm-modal id="deleteUserModal"
title="#{msgs['jsf.user.delete.title']}"
message="#{msgs['jsf.AreYouSureYouWishToDeleteThisUserThisActionCannotBeUndone']}"
onresponse="onDeleteUserResponse" />
<h:form>
<a4j:jsFunction name="deleteUser"
action="#{userAction.deleteUser(username)}" render="usermanagerForm,
userSearch-pager, userSearch-page-info, userSearchBottom-pager, userSearchBottom-page-info">
<a4j:param name="val1" assignTo="#{username}"/>
</a4j:jsFunction>
</h:form>
<script type="text/javascript">
var selectedUser;
function setSelectedUser(user) {
selectedUser = user;
}
function onDeleteUserResponse(del) {
if (del) {
deleteUser(selectedUser);
} else {
selectedUser = null;
}
zanata.modal.hide('#deleteUserModal');
}
</script>
<div class="g--centered">
<div class="g__item w--2-3 l--push-bottom-half">
<p class="txt--meta l--push-all-0">
<h:link outcome="/admin/home.xhtml"
value="#{msgs['jsf.Administration']}"/>
</p>
<h1 class="l--push-all-0">#{msgs['jsf.ManageUsers']}</h1>
<div class="panel l--push-top-1">
<div class="panel__header">
<h2 class="panel__heading">#{msgs['jsf.admin.manageuser.header']}</h2>
</div>
<div class="panel__sub-header js-reveal">
<zanata:list-filter status="userLoader"
listId="usermanagerForm"
render="usermanagerForm, userSearchBottom-pager, userSearchBottom-page-info"
id="userSearch" iconClass="i--users"
placeholder="#{msgs['jsf.SearchUsers']}"
actionBean="#{userAction.userFilter}"/>
</div>
<a4j:status name="userLoader">
<f:facet name="start">
<zanata:loader/>
</f:facet>
</a4j:status>
<h:form id="usermanagerForm" styleClass="l--push-bottom-0">
<ul class="list--stats">
<ui:repeat value="#{userAction.userFilter.currentPage}"
var="user">
<li class="list__item--actionable">
<div class="list__item__action">
<div
class="dropdown dropdown--small dropdown--inline dropdown--single list__item__dropdown js-dropdown">
<a href="#" title="Options"
class="dropdown__toggle js-dropdown__toggle txt--meta">
<span class="is-invisible">Options</span>
</a>
<ul class="dropdown__content js-dropdown__content">
<ui:fragment
rendered="#{identity.hasPermission('seam.user', 'delete')}">
<li>
<a href="#" class="i__item--right txt--danger" onclick="setSelectedUser('#{user}')"
data-toggle="modal" data-target="#deleteUserModal">
#{msgs['jsf.Delete']}
<i class="i i--remove i__item__icon"></i>
</a>
</li>
</ui:fragment>
</ul>
</div>
</div>
<h:link outcome="/admin/userdetail.xhtml"
disabled="#{not identity.hasPermission('seam.user', 'update')}">
<div class="list__item__content">
<div class="list__item__info">
<h3 class="list__title" title="#{identityManager.isUserEnabled(user) ? '' : msgs['jsf.account.disable.tooltip']}">
<span
class="#{identityManager.isUserEnabled(user) ? '' : 'txt--danger'}">
<ui:fragment
rendered="#{not identityManager.isUserEnabled(user)}">
<i class="i i--lock"></i>
</ui:fragment>
#{user}
</span>
<h:panelGroup layout="span" styleClass="txt--meta l--push-h-quarter"
rendered="#{not userSearch.getUserRoles(user).isEmpty()}">
[#{userSearch.getUserRoles(user)}]
</h:panelGroup>
</h3>
<span class="list__item__meta">
#{userAction.getEmail(user)}
</span>
</div>
</div>
<f:param name="username" value="#{user}"/>
</h:link>
</li>
</ui:repeat>
</ul>
</h:form>
</div>
<div class="panel__sub-header js-reveal">
<zanata:list-filter status="userLoader"
listId="usermanagerForm"
render="usermanagerForm, userSearch-pager, userSearch-page-info"
id="userSearchBottom" iconClass="i--users"
placeholder="#{msgs['jsf.SearchUsers']}"
actionBean="#{userAction.userFilter}"/>
</div>
</div>
</div>
</ui:define>
</ui:composition>
</html>