Rev 1778 | Rev 1782 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1778 | Rev 1779 | ||
---|---|---|---|
1 | <%@ page import="jomm.dao.impl.AbstractDao" %> |
1 | <%@ page import="jomm.dao.impl.AbstractDao" %> |
2 | <%@ page import="pt.estgp.estgweb.Globals" %> |
2 | <%@ page import="pt.estgp.estgweb.Globals" %> |
3 | <%@ page import="pt.estgp.estgweb.domain.CourseDepartment" %> |
3 | <%@ page import="pt.estgp.estgweb.domain.CourseDepartment" %> |
4 | <%@ page import="pt.estgp.estgweb.domain.CourseDepartmentImpl" %> |
4 | <%@ page import="pt.estgp.estgweb.domain.CourseDepartmentImpl" %> |
5 | <%@ page import="pt.estgp.estgweb.domain.CourseSchool" %> |
5 | <%@ page import="pt.estgp.estgweb.domain.CourseSchool" %> |
6 | <%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %> |
6 | <%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %> |
7 | <%@ page import="pt.estgp.estgweb.web.filters.UserRoleProxy" %> |
7 | <%@ page import="pt.estgp.estgweb.web.filters.UserRoleProxy" %> |
8 | <%@ page import="java.util.ArrayList" %> |
8 | <%@ page import="java.util.ArrayList" %> |
9 | <%@ page import="java.util.List" %> |
9 | <%@ page import="java.util.List" %> |
10 | <%@ page import="pt.estgp.estgweb.domain.CourseSchoolImpl" %> |
10 | <%@ page import="pt.estgp.estgweb.domain.CourseSchoolImpl" %> |
11 | <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %> |
11 | <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %> |
12 | <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %> |
12 | <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %> |
13 | <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> |
13 | <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> |
14 | <%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %> |
14 | <%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %> |
15 | <%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
15 | <%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
16 | <%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %> |
16 | <%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %> |
17 | <%@ taglib tagdir="/WEB-INF/tags" prefix="bacoTags" %> |
17 | <%@ taglib tagdir="/WEB-INF/tags" prefix="bacoTags" %> |
18 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> |
18 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> |
19 | <% |
19 | <% |
20 | AbstractDao.getCurrentSession().beginTransaction(); |
20 | AbstractDao.getCurrentSession().beginTransaction(); |
21 | 21 | ||
22 | ArrayList<CourseDepartment> departments = (ArrayList<CourseDepartment>) DaoFactory.getCourseDepartmentDaoImpl().findAll(); |
22 | ArrayList<CourseDepartment> departments = (ArrayList<CourseDepartment>) DaoFactory.getCourseDepartmentDaoImpl().findAll(); |
23 | String jsonArrayDepartments = CourseDepartmentImpl.getJson(departments); |
23 | String jsonArrayDepartments = CourseDepartmentImpl.toJson(departments); |
24 | 24 | ||
25 | ArrayList<CourseSchool> schools = (ArrayList<CourseSchool>) DaoFactory.getCourseSchoolDaoImpl().findAll(); |
25 | ArrayList<CourseSchool> schools = (ArrayList<CourseSchool>) DaoFactory.getCourseSchoolDaoImpl().findAll(); |
26 | String jsonArraySchools = CourseSchoolImpl.getJson(schools); |
26 | String jsonArraySchools = CourseSchoolImpl.toJson(schools); |
27 | 27 | ||
28 | 28 | ||
29 | request.setAttribute("jsonArrayDepartments",jsonArrayDepartments); |
29 | request.setAttribute("jsonArrayDepartments",jsonArrayDepartments); |
30 | request.setAttribute("departments",departments); |
30 | request.setAttribute("departments",departments); |
31 | 31 | ||
32 | request.setAttribute("jsonArraySchools",jsonArraySchools); |
32 | request.setAttribute("jsonArraySchools",jsonArraySchools); |
33 | request.setAttribute("schools",schools); |
33 | request.setAttribute("schools",schools); |
34 | 34 | ||
35 | List<String> rolesBoardDepartamento = UserRoleProxy.getUserRolesByPrefix("department.board"); |
35 | List<String> rolesBoardDepartamento = UserRoleProxy.getUserRolesByPrefix("department.board"); |
36 | List<String> rolesDiretorDepartamento = UserRoleProxy.getUserRolesByPrefix("department.diretor"); |
36 | List<String> rolesDiretorDepartamento = UserRoleProxy.getUserRolesByPrefix("department.diretor"); |
37 | 37 | ||
38 | request.setAttribute("rolesBoardDepartamento",rolesBoardDepartamento); |
38 | request.setAttribute("rolesBoardDepartamento",rolesBoardDepartamento); |
39 | request.setAttribute("rolesDiretorDepartamento",rolesDiretorDepartamento); |
39 | request.setAttribute("rolesDiretorDepartamento",rolesDiretorDepartamento); |
40 | 40 | ||
41 | %> |
41 | %> |
42 | 42 | ||
43 | <div class="container-fluid"> |
43 | <div class="container-fluid"> |
44 | 44 | ||
45 | <div id="departmentsModule" |
45 | <div id="departmentsModule" |
46 | ng-app="departmentsModule" |
46 | ng-app="departmentsModule" |
47 | ng-controller="departmentsModuleController"> |
47 | ng-controller="departmentsModuleController"> |
48 | 48 | ||
49 | <script> |
49 | <script> |
50 | //DECLARACAO DA APLICACAO LOCAL EM ANGULAR |
50 | //DECLARACAO DA APLICACAO LOCAL EM ANGULAR |
51 | var departmentsModule = angular.module('departmentsModule', []); |
51 | var departmentsModule = angular.module('departmentsModule', []); |
52 | GLOBAL_BacoAngularAppDependencies.push('departmentsModule'); |
52 | GLOBAL_BacoAngularAppDependencies.push('departmentsModule'); |
53 | 53 | ||
54 | departmentsModule.controller('departmentsModuleController', function($scope) { |
54 | departmentsModule.controller('departmentsModuleController', function($scope) { |
55 | $scope.departments = ${jsonArrayDepartments}; |
55 | $scope.departments = ${jsonArrayDepartments}; |
56 | $scope.schools = ${jsonArraySchools}; |
56 | $scope.schools = ${jsonArraySchools}; |
57 | $scope.setDirty = function(department) |
57 | $scope.setDirty = function(department) |
58 | { |
58 | { |
59 | department.dirty = "true"; |
59 | department.dirty = "true"; |
60 | } |
60 | } |
61 | $scope.save = function(department) |
61 | $scope.save = function(department) |
62 | { |
62 | { |
63 | var d = JSON.stringify(department); |
63 | var d = JSON.stringify(department); |
64 | 64 | ||
65 | widgetCallWithActionParameters( |
65 | widgetCallWithActionParameters( |
66 | "<%=request.getContextPath()%>/admin/adminDepartment.do", |
66 | "<%=request.getContextPath()%>/admin/adminDepartment.do", |
67 | "updateCourseDepartment", |
67 | "updateCourseDepartment", |
68 | { |
68 | { |
69 | "courseDepartmentJson" : d |
69 | "courseDepartmentJson" : d |
70 | }, |
70 | }, |
71 | ".form-horizontal", |
71 | ".form-horizontal", |
72 | function(departmentJson) |
72 | function(departmentJson) |
73 | { |
73 | { |
74 | department.dirty = "false"; |
74 | department.dirty = "false"; |
75 | $scope.$apply(); |
75 | $scope.$apply(); |
76 | } |
76 | } |
77 | 77 | ||
78 | ); |
78 | ); |
79 | } |
79 | } |
80 | $scope.removeDepartment = function(department,$index) |
80 | $scope.removeDepartment = function(department,$index) |
81 | { |
81 | { |
82 | 82 | ||
83 | var d = JSON.stringify(department); |
83 | var d = JSON.stringify(department); |
84 | widgetCallWithActionParameters( |
84 | widgetCallWithActionParameters( |
85 | "<%=request.getContextPath()%>/admin/adminDepartment.do", |
85 | "<%=request.getContextPath()%>/admin/adminDepartment.do", |
86 | "removeCourseDepartment", |
86 | "removeCourseDepartment", |
87 | { |
87 | { |
88 | "courseDepartmentJson" : d |
88 | "courseDepartmentJson" : d |
89 | }, |
89 | }, |
90 | ".form-horizontal", |
90 | ".form-horizontal", |
91 | function(departmentJson) |
91 | function(departmentJson) |
92 | { |
92 | { |
93 | $scope.departments.splice($index,1); |
93 | $scope.departments.splice($index,1); |
94 | $scope.$apply(); |
94 | $scope.$apply(); |
95 | } |
95 | } |
96 | 96 | ||
97 | ); |
97 | ); |
98 | } |
98 | } |
99 | $scope.newDepartment = function() |
99 | $scope.newDepartment = function() |
100 | { |
100 | { |
101 | 101 | ||
102 | widgetCallWithActionParameters( |
102 | widgetCallWithActionParameters( |
103 | "<%=request.getContextPath()%>/admin/adminDepartment.do", |
103 | "<%=request.getContextPath()%>/admin/adminDepartment.do", |
104 | "newCourseDepartment",{}, |
104 | "newCourseDepartment",{}, |
105 | ".form-horizontal", |
105 | ".form-horizontal", |
106 | function(departmentJson) |
106 | function(departmentJson) |
107 | { |
107 | { |
108 | departmentJson.dirty = "true"; |
108 | departmentJson.dirty = "true"; |
109 | $scope.departments.push(departmentJson); |
109 | $scope.departments.push(departmentJson); |
110 | $scope.$apply(); |
110 | $scope.$apply(); |
111 | } |
111 | } |
112 | 112 | ||
113 | ); |
113 | ); |
114 | } |
114 | } |
115 | 115 | ||
116 | }); |
116 | }); |
117 | </script> |
117 | </script> |
118 | 118 | ||
119 | 119 | ||
120 | 120 | ||
121 | <p><label class="label-info">Papeis dos Departamentos:</label> Os papeis de departamento são escolhidos da lista de papeis do sistema considerando-se todos os papeis com os prefixos:</p> |
121 | <p><label class="label-info">Papeis dos Departamentos:</label> Os papeis de departamento são escolhidos da lista de papeis do sistema considerando-se todos os papeis com os prefixos:</p> |
122 | <ul> |
122 | <ul> |
123 | <li>department.board: para membros da direcção</li> |
123 | <li>department.board: para membros da direcção</li> |
124 | <li>department.diretor: para diretores direcção</li> |
124 | <li>department.diretor: para diretores direcção</li> |
125 | </ul> |
125 | </ul> |
126 | <p>Caso seja necessário um novo papel deverá administrar os papeis institucionais dirija-se <html:link action="/user/configurationUserRoles">Aqui</html:link></p> |
126 | <p>Caso seja necessário um novo papel deverá administrar os papeis institucionais dirija-se <html:link action="/user/configurationUserRoles">Aqui</html:link></p> |
127 | <button class="btn btn-default" data-toggle="collapse" data-target=".languageNames">Mostrar Campos Multinliguisticos</button> |
127 | <button class="btn btn-default" data-toggle="collapse" data-target=".languageNames">Mostrar Campos Multinliguisticos</button> |
128 | 128 | ||
129 | <button class="btn btn-success pull-right" ng-click="newDepartment()"><span class="glyphicon glyphicon-plus"/></button> |
129 | <button class="btn btn-success pull-right" ng-click="newDepartment()"><span class="glyphicon glyphicon-plus"/></button> |
130 | <div class="form-horizontal"> |
130 | <div class="form-horizontal"> |
131 | <div class="web-messages"></div> |
131 | <div class="web-messages"></div> |
132 | <table class="tablesorter-blue"> |
132 | <table class="tablesorter-blue"> |
133 | <thead> |
133 | <thead> |
134 | <tr> |
134 | <tr> |
135 | <th>Identificador</th> |
135 | <th>Identificador</th> |
136 | <th>Ativo</th> |
136 | <th>Ativo</th> |
137 | <th>Instituição</th> |
137 | <th>Instituição</th> |
138 | <th style="width: 30%">Nome</th> |
138 | <th style="width: 30%">Nome</th> |
139 | <th>Papel para Membro da Direcao</th> |
139 | <th>Papel para Membro da Direcao</th> |
140 | <th>Papel para Director</th> |
140 | <th>Papel para Director</th> |
141 | <th></th> |
141 | <th></th> |
142 | <th></th> |
142 | <th></th> |
143 | </tr> |
143 | </tr> |
144 | </thead> |
144 | </thead> |
145 | <tbody> |
145 | <tbody> |
146 | <tr ng-class="{dirty: d.dirty=='true'}" ng-repeat="d in departments | orderBy:name:false"> |
146 | <tr ng-class="{dirty: d.dirty=='true'}" ng-repeat="d in departments | orderBy:name:false"> |
147 | <td> |
147 | <td> |
148 | <div class="row"> |
148 | <div class="row"> |
149 | <div class="col-md-8"> |
149 | <div class="col-md-8"> |
150 | <input class="form-control" type="text" ng-model="d.sigla" ng-keyup="setDirty(d)"> |
150 | <input class="form-control" type="text" ng-model="d.sigla" ng-keyup="setDirty(d)"> |
151 | </div> |
151 | </div> |
152 | <div class="col-md-2">*</div> |
152 | <div class="col-md-2">*</div> |
153 | </div> |
153 | </div> |
154 | </td> |
154 | </td> |
155 | <td> |
155 | <td> |
156 | <select class="chosenOff form-control" ng-model="d.active" ng-change="setDirty(d)"> |
156 | <select class="chosenOff form-control" ng-model="d.active" ng-change="setDirty(d)"> |
157 | <option ng-value="true" ng-selected="d.active == true">Ativo</option> |
157 | <option ng-value="true" ng-selected="d.active == true">Ativo</option> |
158 | <option ng-value="false" ng-selected="d.active == false">Inativo</option> |
158 | <option ng-value="false" ng-selected="d.active == false">Inativo</option> |
159 | </select> |
159 | </select> |
160 | </td> |
160 | </td> |
161 | <td> |
161 | <td> |
162 | <select class="chosenOff form-control" ng-model="d.courseSchool.id" ng-change="setDirty(d)" ng-options="s.id as s.name for s in schools"> |
162 | <select class="chosenOff form-control" ng-model="d.courseSchool.id" ng-change="setDirty(d)" ng-options="s.id as s.name for s in schools"> |
163 | </select> |
163 | </select> |
164 | </td> |
164 | </td> |
165 | <td> |
165 | <td> |
166 | <input class="form-control" type="text" ng-model="d.name" ng-keyup="setDirty(d)"> |
166 | <input class="form-control" type="text" ng-model="d.name" ng-keyup="setDirty(d)"> |
167 | <div class="languageNames collapse"> |
167 | <div class="languageNames collapse"> |
168 | EN:<input class="form-control" type="text" ng-model="d.nameEn" ng-keyup="setDirty(d)"> |
168 | EN:<input class="form-control" type="text" ng-model="d.nameEn" ng-keyup="setDirty(d)"> |
169 | ES:<input class="form-control" type="text" ng-model="d.nameEs" ng-keyup="setDirty(d)"> |
169 | ES:<input class="form-control" type="text" ng-model="d.nameEs" ng-keyup="setDirty(d)"> |
170 | FR:<input class="form-control" type="text" ng-model="d.nameFr" ng-keyup="setDirty(d)"> |
170 | FR:<input class="form-control" type="text" ng-model="d.nameFr" ng-keyup="setDirty(d)"> |
171 | </div> |
171 | </div> |
172 | </td> |
172 | </td> |
173 | 173 | ||
174 | <td style="font-size: 0.7em !important"> |
174 | <td style="font-size: 0.7em !important"> |
175 | <select class="chosenOff form-control" ng-model="d.boardRole" ng-change="setDirty(d)"> |
175 | <select class="chosenOff form-control" ng-model="d.boardRole" ng-change="setDirty(d)"> |
176 | <option value="">Escolha</option> |
176 | <option value="">Escolha</option> |
177 | <logic:iterate id="role" name="rolesBoardDepartamento"> |
177 | <logic:iterate id="role" name="rolesBoardDepartamento"> |
178 | <option value="${role}"><bean:message key="user.role.${role}"/></option> |
178 | <option value="${role}"><bean:message key="user.role.${role}"/></option> |
179 | </logic:iterate> |
179 | </logic:iterate> |
180 | </select> |
180 | </select> |
181 | </td> |
181 | </td> |
182 | <td style="font-size: 0.7em !important"> |
182 | <td style="font-size: 0.7em !important"> |
183 | <select class="chosenOff form-control" ng-model="d.directorRole" ng-change="setDirty(d)"> |
183 | <select class="chosenOff form-control" ng-model="d.directorRole" ng-change="setDirty(d)"> |
184 | <option value="">Escolha</option> |
184 | <option value="">Escolha</option> |
185 | <logic:iterate id="role" name="rolesDiretorDepartamento"> |
185 | <logic:iterate id="role" name="rolesDiretorDepartamento"> |
186 | <option value="${role}"><bean:message key="user.role.${role}"/></option> |
186 | <option value="${role}"><bean:message key="user.role.${role}"/></option> |
187 | </logic:iterate> |
187 | </logic:iterate> |
188 | </select> |
188 | </select> |
189 | </td> |
189 | </td> |
190 | <td> |
190 | <td> |
191 | <button type="button" class="btn btn-success btn-xs" ng-click="save(d)"> |
191 | <button type="button" class="btn btn-success btn-xs" ng-click="save(d)"> |
192 | <span class="glyphicon glyphicon-ok"/> |
192 | <span class="glyphicon glyphicon-ok"/> |
193 | </button> |
193 | </button> |
194 | </td> |
194 | </td> |
195 | <td> |
195 | <td> |
196 | <bacoTags:confirm msg="Tem a certeza que deseja remover o departamento {{d.name}}" targetFunction="angular.element($('#departmentsModule')).scope().removeDepartment({{d}},{{$index}});angular.element($('#departmentsModule')).scope().$apply();" btnClass="btn btn-danger btn-xs" icon="glyphicon glyphicon-remove"/> |
196 | <bacoTags:confirm msg="Tem a certeza que deseja remover o departamento {{d.name}}" targetFunction="angular.element($('#departmentsModule')).scope().removeDepartment({{d}},{{$index}});angular.element($('#departmentsModule')).scope().$apply();" btnClass="btn btn-danger btn-xs" icon="glyphicon glyphicon-remove"/> |
197 | </td> |
197 | </td> |
198 | 198 | ||
199 | 199 | ||
200 | 200 | ||
201 | </tr> |
201 | </tr> |
202 | </tbody> |
202 | </tbody> |
203 | </table> |
203 | </table> |
204 | <p class="label label-warning">* - A sigla é o identificador do departamento, altere a sigla apenas se perceber as suas implicações. Existem Classes no sistema que dependem da sigla do departamento, a sigla tem de ser unica</p> |
204 | <p class="label label-warning">* - A sigla é o identificador do departamento, altere a sigla apenas se perceber as suas implicações. Existem Classes no sistema que dependem da sigla do departamento, a sigla tem de ser unica</p> |
205 | <%-- |
205 | <%-- |
206 | <model:id name="department" property="id"/> |
206 | <model:id name="department" property="id"/> |
207 | <model:field name="department" property="name"/> |
207 | <model:field name="department" property="name"/> |
208 | <model:field name="department" property="nameEn"/> |
208 | <model:field name="department" property="nameEn"/> |
209 | <model:field name="department" property="nameEs"/> |
209 | <model:field name="department" property="nameEs"/> |
210 | <model:field name="department" property="nameFr"/> |
210 | <model:field name="department" property="nameFr"/> |
211 | <model:remove name="department"/> |
211 | <model:remove name="department"/> |
212 | --%> |
212 | --%> |
213 | </div> |
213 | </div> |
214 | 214 | ||
215 | <pre> |
215 | <pre> |
216 | {{departments | json}} |
216 | {{departments | json}} |
217 | </pre> |
217 | </pre> |
218 | <%-- DEBUG |
218 | <%-- DEBUG |
219 | <pre> |
219 | <pre> |
220 | {{departments | json}} |
220 | {{departments | json}} |
221 | </pre> |
221 | </pre> |
222 | <pre> |
222 | <pre> |
223 | {{schools | json}} |
223 | {{schools | json}} |
224 | </pre> |
224 | </pre> |
225 | --%> |
225 | --%> |
226 | </div> |
226 | </div> |
227 | 227 | ||
228 | 228 | ||
229 | </div> |
229 | </div> |
230 | 230 | ||
231 | 231 | ||
232 | <% |
232 | <% |
233 | AbstractDao.getCurrentSession().getTransaction().commit(); |
233 | AbstractDao.getCurrentSession().getTransaction().commit(); |
234 | %> |
234 | %> |
235 | 235 | ||
236 | Generated by GNU Enscript 1.6.5.2. |
236 | Generated by GNU Enscript 1.6.5.2. |
237 | 237 | ||
238 | 238 |