Rev 1617 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1617 | Rev 1618 | ||
---|---|---|---|
Line 17... | Line 17... | ||
17 | <%@attribute name="title" type="java.lang.String" required="false" %> |
17 | <%@attribute name="title" type="java.lang.String" required="false" %> |
18 | <%@attribute name="transactional" type="java.lang.Boolean" required="true" %> |
18 | <%@attribute name="transactional" type="java.lang.Boolean" required="true" %> |
19 | <%@attribute name="printOnlyList" type="java.lang.Boolean" required="false" %> |
19 | <%@attribute name="printOnlyList" type="java.lang.Boolean" required="false" %> |
20 | <%@attribute name="ignoreUserId" type="java.lang.Long" required="false" %> |
20 | <%@attribute name="ignoreUserId" type="java.lang.Long" required="false" %> |
21 | <%@attribute name="useWellTitle" type="java.lang.Boolean" required="false" %> |
21 | <%@attribute name="useWellTitle" type="java.lang.Boolean" required="false" %> |
- | 22 | <%@attribute name="useModals" type="java.lang.Boolean" required="false" %> |
|
22 | 23 | ||
23 | <% |
24 | <% |
24 | String idTemp = BytesUtils.generateHexKey() + role.replaceAll(" ", "_").replaceAll("\\.","_"); |
25 | String idTemp = BytesUtils.generateHexKey() + role.replaceAll(" ", "_").replaceAll("\\.","_"); |
25 | %> |
26 | %> |
26 | 27 | ||
27 | <!-- Usar o Angular para Printar os Roles --> |
28 | <!-- Usar o Angular para Printar os Roles --> |
28 | <div class="clearfix"> |
29 | <div class="clearfix"> |
29 | 30 | ||
30 | <div class="col-md-12" id="printRoleModule<%=idTemp%>" ng-app="printRoleModule<%=idTemp%>" ng-controller="printRoleModuleController<%=idTemp%>"> |
31 | <div class="col-md-12" style="padding: 0; margin: 0" id="printRoleModule<%=idTemp%>" ng-app="printRoleModule<%=idTemp%>" ng-controller="printRoleModuleController<%=idTemp%>"> |
31 | 32 | ||
32 | <% |
33 | <% |
33 | if(printOnlyList == null || printOnlyList == false) |
34 | if(printOnlyList == null || printOnlyList == false) |
34 | { |
35 | { |
35 | %> |
36 | %> |
Line 40... | Line 41... | ||
40 | <h3 <%if(useWellTitle != null && useWellTitle){%>class="well well-sm"<%}%>><bean:message key="user.role.${role}"/></h3> |
41 | <h3 <%if(useWellTitle != null && useWellTitle){%>class="well well-sm"<%}%>><bean:message key="user.role.${role}"/></h3> |
41 | </logic:empty> |
42 | </logic:empty> |
42 | <% |
43 | <% |
43 | } |
44 | } |
44 | %> |
45 | %> |
45 | <div class="col-md-6"> |
46 | <div class="col-md-6" style="padding: 2px; margin: 0"> |
46 | <ul> |
47 | <ul> |
47 | <li ng-repeat="u in roleUsers" class="roleUser{{u.id}}"> |
48 | <li ng-repeat="u in roleUsers" class="roleUser{{u.id}}"> |
- | 49 | <baco:hasRole role="admin,all,servicesRolesManagement,servicesCoursesManagement,services"> |
|
- | 50 | <% |
|
- | 51 | if(useModals != null && !useModals) |
|
- | 52 | { |
|
- | 53 | %> |
|
- | 54 | <button type="button" class="btn btn-danger btn-xs" ng-click="removeUser( u.id )"><span class="glyphicon glyphicon-remove"/></button> |
|
- | 55 | <% |
|
- | 56 | } |
|
48 | <baco:isAdmin> |
57 | else |
- | 58 | { |
|
- | 59 | %> |
|
49 | <bacoTags:confirm icon="glyphicon glyphicon-remove" btnClass="btn btn-danger btn-xs"> |
60 | <bacoTags:confirm icon="glyphicon glyphicon-remove" btnClass="btn btn-danger btn-xs"> |
50 | <jsp:attribute name="targetFunction">removeUser<%=idTemp%>({{u.id}})</jsp:attribute> |
61 | <jsp:attribute name="targetFunction">removeUser<%=idTemp%>({{u.id}})</jsp:attribute> |
51 | <jsp:attribute name="msg">Tem a certeza que deseja remover o utilizador {{u.name}} do grupo <bean:message key="user.role.${role}"/></jsp:attribute> |
62 | <jsp:attribute name="msg">Tem a certeza que deseja remover o utilizador {{u.name}} do grupo <bean:message key="user.role.${role}"/></jsp:attribute> |
52 | </bacoTags:confirm> |
63 | </bacoTags:confirm> |
- | 64 | <% |
|
- | 65 | } |
|
- | 66 | %> |
|
53 | </baco:isAdmin> |
67 | </baco:hasRole> |
54 | 68 | ||
55 | {{u.username}} |
69 | {{u.username}} |
56 | <label ng-if="u.name"> |
70 | <label ng-if="u.name"> |
57 | - {{u.name}} |
71 | - {{u.name}} |
58 | </label> |
72 | </label> |
Line 62... | Line 76... | ||
62 | <%--</label>--%> |
76 | <%--</label>--%> |
63 | 77 | ||
64 | </li> |
78 | </li> |
65 | </ul> |
79 | </ul> |
66 | </div> |
80 | </div> |
67 | <baco:isAdmin> |
81 | <baco:hasRole role="admin,all,servicesRolesManagement,servicesCoursesManagement,services"> |
68 | <div class="col-md-6"> |
82 | <div class="col-md-6" style="padding: 2px; margin: 0"> |
69 | 83 | ||
70 | <div class="panel panel-default"> |
84 | <div class="panel panel-default"> |
71 | <div class="panel-heading"> |
85 | <div class="panel-heading"> |
72 | Adicionar elemento ao grupo <bean:message key="user.role.${role}"/> |
86 | Adicionar elemento ao grupo <bean:message key="user.role.${role}"/> |
73 | </div> |
87 | </div> |
74 | <div class="panel-body"> |
88 | <div class="panel-body"> |
75 | <div class="web-messages"> </div> |
89 | <div class="web-messages"> </div> |
76 | 90 | ||
77 | <div class="input-group"> |
91 | <div class="input-group"> |
78 | <input type="text" id="queryPersons<%=idTemp%>" class="form-control" placeholder="Pesquisar..."> |
92 | <input type="text" id="queryPersons<%=idTemp%>" onkeyup="if(event.keyCode == 13){searchPersons<%=idTemp%>();}" class="form-control" placeholder="Pesquisar..."> |
79 | <span class="input-group-btn"> |
93 | <span class="input-group-btn"> |
80 | <button class="btn btn-secondary" type="button" onclick="searchPersons<%=idTemp%>();return false;"><span class="glyphicon glyphicon-search"/></button> |
94 | <button class="btn btn-secondary" type="button" onclick="searchPersons<%=idTemp%>();return false;"><span class="glyphicon glyphicon-search"/></button> |
81 | </span> |
95 | </span> |
82 | </div> |
96 | </div> |
83 | <div ng-show="findUser.length > 0" class="clearfix" id="personsResults<%=idTemp%>" style="position: absolute; background-color: gray;border: 1px solid gray;z-index: 1000; right: 30px;left:30px;"> |
97 | <div ng-show="findUser.length > 0" class="clearfix" id="personsResults<%=idTemp%>" style="position: absolute; background-color: gray;border: 1px solid gray;z-index: 1000; right: 30px;left:30px;"> |
Line 102... | Line 116... | ||
102 | </td> |
116 | </td> |
103 | <td ng-if="f.type != 'teacher' && f.type != 'student'"> |
117 | <td ng-if="f.type != 'teacher' && f.type != 'student'"> |
104 | User |
118 | User |
105 | </td> |
119 | </td> |
106 | <td>{{f.sigesCode}}</td> |
120 | <td>{{f.sigesCode}}</td> |
- | 121 | <td> |
|
- | 122 | <% |
|
- | 123 | if(useModals != null && !useModals) |
|
- | 124 | { |
|
- | 125 | %> |
|
- | 126 | <button type="button" class="btn btn-success btn-xs" ng-click="addUser( f.id )"><span class="glyphicon glyphicon-plus"/></button> |
|
- | 127 | <% |
|
- | 128 | } |
|
- | 129 | else |
|
- | 130 | { |
|
- | 131 | %> |
|
- | 132 | <bacoTags:confirm icon="glyphicon glyphicon-plus" btnClass="btn btn-success btn-xs"> |
|
- | 133 | <jsp:attribute name="targetFunction">addUser<%=idTemp%>({{f.id}});angular.element($('#printRoleModule<%=idTemp%>')).scope().removeAllUsers();angular.element($('#printRoleModule<%=idTemp%>')).scope().$apply();</jsp:attribute> |
|
- | 134 | <jsp:attribute name="msg">Tem a certeza que deseja adicionar o utilizador {{f.name}} ao grupo <bean:message key="user.role.${role}"/></jsp:attribute> |
|
- | 135 | </bacoTags:confirm> |
|
- | 136 | <% |
|
- | 137 | } |
|
- | 138 | %> |
|
- | 139 | </td> |
|
107 | </tr> |
140 | </tr> |
108 | </tbody> |
141 | </tbody> |
109 | </table> |
142 | </table> |
110 | </div> |
143 | </div> |
111 | </div> |
144 | </div> |
112 | 145 | ||
113 | </div> |
146 | </div> |
114 | </div> |
147 | </div> |
115 | 148 | ||
116 | <script> |
149 | <script> |
- | 150 | ||
- | 151 | ||
117 | //DECLARACAO DA APLICACAO LOCAL EM ANGULAR |
152 | //DECLARACAO DA APLICACAO LOCAL EM ANGULAR |
118 | var printRoleModule<%=idTemp%> = angular.module('printRoleModule<%=idTemp%>', []); |
153 | var printRoleModule<%=idTemp%> = angular.module('printRoleModule<%=idTemp%>', []); |
119 | GLOBAL_BacoAngularAppDependencies.push('printRoleModule<%=idTemp%>'); |
154 | GLOBAL_BacoAngularAppDependencies.push('printRoleModule<%=idTemp%>'); |
120 | printRoleModule<%=idTemp%>.controller('printRoleModuleController<%=idTemp%>', function($scope) { |
155 | printRoleModule<%=idTemp%>.controller('printRoleModuleController<%=idTemp%>', function($scope) { |
121 | //variavel para a pesquisa de users |
156 | //variavel para a pesquisa de users |
Line 123... | Line 158... | ||
123 | $scope.roleUsers = []; |
158 | $scope.roleUsers = []; |
124 | $scope.removeAllUsers = function() |
159 | $scope.removeAllUsers = function() |
125 | { |
160 | { |
126 | $scope.findUser = []; |
161 | $scope.findUser = []; |
127 | } |
162 | } |
- | 163 | $scope.removeUser = function(id) |
|
- | 164 | { |
|
- | 165 | if(confirm("Tem a certeza que deseja remover o utilizador?")) |
|
- | 166 | removeUser<%=idTemp%>(id); |
|
- | 167 | } |
|
- | 168 | $scope.addUser = function(id) |
|
- | 169 | { |
|
- | 170 | if(confirm("Tem a certeza que deseja adicionar o utilizador?")) |
|
- | 171 | { |
|
- | 172 | addUser<%=idTemp%>(id); |
|
- | 173 | $scope.removeAllUsers(); |
|
- | 174 | } |
|
- | 175 | ||
- | 176 | } |
|
128 | }); |
177 | }); |
- | 178 | ||
129 | </script> |
179 | </script> |
130 | <script language="javascript"> |
180 | <script language="javascript"> |
131 | 181 | ||
132 | $(document).ready(function() |
182 | $(document).ready(function() |
133 | { |
183 | { |
Line 154... | Line 204... | ||
154 | { |
204 | { |
155 | alert("Accao Falhou mas as resposta foi esta: " + JSON.stringify(response)); |
205 | alert("Accao Falhou mas as resposta foi esta: " + JSON.stringify(response)); |
156 | }); |
206 | }); |
157 | 207 | ||
158 | } |
208 | } |
- | 209 | ||
- | 210 | function addUser<%=idTemp%>(id) |
|
- | 211 | { |
|
- | 212 | widgetCallWithActionParameters( |
|
- | 213 | '<%=request.getContextPath()%>/user/json/model.do', |
|
- | 214 | 'addRole2User', |
|
- | 215 | { |
|
- | 216 | q : |
|
- | 217 | "{ userId : " + id + ", role : '${role}' }" |
|
- | 218 | } |
|
- | 219 | , |
|
- | 220 | $("#printRoleModule<%=idTemp%>"), |
|
- | 221 | function(response) |
|
- | 222 | { |
|
- | 223 | angular.element($("#printRoleModule<%=idTemp%>")).scope().roleUsers = response.results; |
|
- | 224 | angular.element($("#printRoleModule<%=idTemp%>")).scope().$apply(); |
|
- | 225 | }, |
|
- | 226 | function(response) |
|
- | 227 | { |
|
- | 228 | alert("Accao Falhou mas as resposta foi esta: " + JSON.stringify(response)); |
|
- | 229 | }); |
|
- | 230 | ||
- | 231 | } |
|
159 | function loadUserRoles<%=idTemp%>() |
232 | function loadUserRoles<%=idTemp%>() |
160 | { |
233 | { |
161 | widgetCallWithActionParameters( |
234 | widgetCallWithActionParameters( |
162 | '<%=request.getContextPath()%>/user/json/model.do', |
235 | '<%=request.getContextPath()%>/user/json/model.do', |
163 | 'findUserRoles', |
236 | 'findUserRoles', |
Line 203... | Line 276... | ||
203 | 276 | ||
204 | } |
277 | } |
205 | 278 | ||
206 | </script> |
279 | </script> |
207 | </div> |
280 | </div> |
208 | </baco:isAdmin> |
281 | </baco:hasRole> |
209 | </div> |
282 | </div> |
210 | </div> |
283 | </div> |
211 | 284 |