Rev 1857 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1350 | jmachado | 1 | <%@ page import="jomm.dao.impl.AbstractDao" %> |
2 | <%@ page import="pt.estgp.estgweb.domain.Configuration" %> |
||
1353 | jmachado | 3 | <%@ page import="pt.estgp.estgweb.domain.Course" %> |
1350 | jmachado | 4 | <%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %> |
1353 | jmachado | 5 | <%@ page import="pt.estgp.estgweb.utils.DatesUtils" %> |
6 | <%@ page import="java.util.List" %> |
||
1350 | jmachado | 7 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> |
8 | <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %> |
||
9 | <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %> |
||
10 | <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> |
||
11 | <%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %> |
||
12 | <%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
||
13 | <%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %> |
||
1353 | jmachado | 14 | <baco:isAdmin> |
1350 | jmachado | 15 | <jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/> |
16 | <jomm:messages/> |
||
17 | <html:errors/> |
||
18 | |||
19 | <% |
||
20 | |||
21 | AbstractDao.getCurrentSession().beginTransaction(); |
||
22 | |||
23 | Configuration configuration = DaoFactory.getConfigurationDaoImpl().load(); |
||
24 | |||
25 | %> |
||
26 | |||
1353 | jmachado | 27 | <div class="panel panel-default"> |
28 | <div class="panel-heading">Configurações Gerais do Sistema</div> |
||
29 | <div class="panel-body"> |
||
30 | <html:form styleClass="form-horizontal" action="/admin/setConfigurations"> |
||
31 | <input type="hidden" name="dispatch" value="saveConfigsGerais"/> |
||
32 | <jsp:useBean id="ConfigurationsForm" type="pt.estgp.estgweb.web.form.configuration.ConfigurationsForm" scope="request"/> |
||
33 | <% |
||
34 | ConfigurationsForm.setConfiguration(configuration); |
||
35 | %> |
||
1350 | jmachado | 36 | |
1353 | jmachado | 37 | <div class="form-group"> |
38 | <label class="control-label col-sm-2">Ano de Interface</label> |
||
39 | <div class="col-sm-10"> |
||
40 | <% |
||
41 | List<String> years = DatesUtils.getImportYears(10); |
||
42 | %> |
||
43 | <html:select styleClass="form-control" property="configuration.interfaceImportYear"> |
||
44 | <% |
||
45 | for(String year:years) |
||
46 | { |
||
47 | request.setAttribute("year",year); |
||
48 | %> |
||
49 | <html:option value="${year}">${year}</html:option> |
||
50 | <% |
||
51 | } |
||
52 | %> |
||
53 | </html:select> |
||
54 | </div> |
||
55 | </div> |
||
56 | |||
57 | <div class="form-group"> |
||
58 | <label class="control-label col-sm-2">Cursos Ficticios (separados por virgulas)</label> |
||
59 | <div class="col-sm-10"> |
||
60 | <html:text styleClass="form-control" property="configuration.cursosFicticios"/> |
||
61 | </div> |
||
62 | </div> |
||
63 | |||
64 | |||
65 | <div class="form-group"> |
||
66 | <label class="control-label col-sm-2">Informação de Abertura da Intranet</label> |
||
67 | <div class="col-sm-10"> |
||
68 | <html:textarea styleClass="form-control" rows="5" property="configuration.openInfoIntranet"/> |
||
69 | </div> |
||
70 | </div> |
||
71 | |||
1916 | grupo1 | 72 | <div class="form-group"> |
73 | <label class="control-label col-sm-2">Relatórios de Curso em Produção</label> |
||
74 | <div class="col-sm-10"> |
||
1353 | jmachado | 75 | |
1916 | grupo1 | 76 | <html:select styleClass="form-control" property="configuration.courseReportImportYear"> |
77 | <% |
||
78 | for(String year:years) |
||
79 | { |
||
80 | request.setAttribute("year",year); |
||
81 | %> |
||
82 | <html:option value="${year}">${year}</html:option> |
||
83 | <% |
||
84 | } |
||
85 | %> |
||
86 | </html:select> |
||
87 | </div> |
||
88 | </div> |
||
89 | |||
1353 | jmachado | 90 | <div class="panel panel-default"> |
91 | <div class="panel-heading">Relatórios de Avaliação das Unidades Curriculares</div> |
||
92 | <div class="panel-body"> |
||
93 | <div class="form-group"> |
||
94 | <label class="control-label col-sm-2">Ano aberto para relatórios de avaliação</label> |
||
95 | <div class="col-sm-10"> |
||
96 | <html:select styleClass="form-control" property="configuration.courseUnitEvaluationActiveYear"> |
||
97 | <% |
||
98 | for(String year:years) |
||
99 | { |
||
100 | request.setAttribute("year",year); |
||
101 | %> |
||
102 | <html:option value="${year}">${year}</html:option> |
||
103 | <% |
||
104 | } |
||
105 | %> |
||
106 | </html:select> |
||
107 | </div> |
||
108 | </div> |
||
109 | <div class="form-group"> |
||
110 | <label class="control-label col-sm-2">Tipos de Cursos em Avaliação</label> |
||
111 | <div class="col-sm-4"> |
||
112 | <html:hidden styleId="degree" property="configuration.courseUnitEvaluationActiveDegrees" /> |
||
113 | <div class="list-group" id="degreesListGroup"> |
||
114 | |||
115 | </div> |
||
116 | <script> |
||
117 | var degrees = '${ConfigurationsForm.configuration.courseUnitEvaluationActiveDegrees}'; |
||
118 | jsonObjDegrees = []; |
||
119 | if(degrees.length > 0) |
||
120 | { |
||
1427 | jmachado | 121 | var degreesArray = degrees.split(";"); |
1353 | jmachado | 122 | for(i=0;i< degreesArray.length;i++) |
123 | { |
||
124 | item = {} |
||
125 | item ["degree"] = degreesArray[i]; |
||
126 | jsonObjDegrees.push(item); |
||
127 | } |
||
128 | } |
||
129 | function persistDegrees(){ |
||
130 | var finalDegrees = ""; |
||
131 | $("#degreesListGroup").html(""); |
||
132 | jsonObjDegrees.forEach( |
||
133 | function(obj) { |
||
134 | if(finalDegrees == "") |
||
135 | finalDegrees+= obj.degree; |
||
136 | else |
||
1427 | jmachado | 137 | finalDegrees+= ";" + obj.degree; |
1353 | jmachado | 138 | |
139 | |||
140 | var elementNew = $("<div class=\"list-group-item\">" + |
||
141 | $('#degreeCombo option[value="' + obj.degree + '"]').html() + |
||
142 | "</div>"); |
||
143 | $("#degreesListGroup").append(elementNew); |
||
144 | var removeBtn = $('<button class="btn btn-xs btn-danger pull-right" type="button"><span class="glyphicon glyphicon-remove"/></button>'); |
||
145 | elementNew.append(removeBtn); |
||
146 | removeBtn.click( |
||
147 | function(){ |
||
148 | var found = false; |
||
149 | for(var degree in jsonObjDegrees) |
||
150 | { |
||
151 | if(jsonObjDegrees[degree].degree == obj.degree) |
||
152 | { |
||
153 | jsonObjDegrees.splice(degree, 1); |
||
154 | break; |
||
155 | } |
||
156 | } |
||
157 | persistDegrees(); |
||
158 | } |
||
159 | ); |
||
160 | } |
||
161 | ); |
||
162 | $("#degree").val(finalDegrees); |
||
163 | |||
164 | } |
||
165 | $(document).ready( |
||
166 | function(){ |
||
167 | persistDegrees(); |
||
168 | $("#addDegreeBtn").click( |
||
169 | function() |
||
170 | { |
||
171 | var found = false; |
||
172 | for(var degree in jsonObjDegrees) |
||
173 | { |
||
174 | if(jsonObjDegrees[degree].degree == $("#degreeCombo").val()) |
||
175 | { |
||
176 | found = true; |
||
177 | } |
||
178 | } |
||
179 | if(!found) |
||
180 | { |
||
181 | item = {} |
||
182 | item ["degree"] = $("#degreeCombo").val(); |
||
183 | jsonObjDegrees.push(item); |
||
184 | persistDegrees(); |
||
185 | } |
||
186 | } |
||
187 | ); |
||
188 | $("#removeDegreeBtn").click( |
||
189 | function() |
||
190 | { |
||
191 | var found = false; |
||
192 | for(var degree in jsonObjDegrees) |
||
193 | { |
||
194 | if(jsonObjDegrees[degree].degree == $("#degreeCombo").val()) |
||
195 | { |
||
196 | jsonObjDegrees.splice(degree, 1); |
||
197 | break; |
||
198 | } |
||
199 | } |
||
200 | persistDegrees(); |
||
201 | } |
||
202 | ); |
||
203 | |||
204 | } |
||
205 | ); |
||
206 | </script> |
||
207 | </div> |
||
208 | <div class="col-sm-3"> |
||
209 | <select class="form-control" id="degreeCombo"> |
||
210 | <option value="B"><bean:message key="course.B"/> (B)</option> |
||
211 | <option value="L"><bean:message key="course.L"/> (L)</option> |
||
212 | <option value="M"><bean:message key="course.M"/> (M)</option> |
||
213 | <option value="P"><bean:message key="course.P"/> (P)</option> |
||
214 | <option value="E"><bean:message key="course.E"/> (E)</option> |
||
215 | <option value="A"><bean:message key="course.A"/> (A)</option> |
||
216 | <option value="C"><bean:message key="course.C"/> (C)</option> |
||
217 | <option value="O"><bean:message key="course.O"/> (O)</option> |
||
218 | <option value="T"><bean:message key="course.T"/> (T)</option> |
||
219 | </select> |
||
220 | </div> |
||
221 | <div class="col-sm-3"> |
||
222 | <button class="btn btn-small btn-success" type="button" id="addDegreeBtn"><span class="glyphicon glyphicon-plus"/></button> |
||
223 | <button class="btn btn-small btn-danger" type="button" id="removeDegreeBtn"><span class="glyphicon glyphicon-remove"/></button> |
||
224 | </div> |
||
225 | </div> |
||
226 | |||
227 | |||
228 | <div class="form-group"> |
||
229 | <label class="control-label col-sm-2">Cursos Ativos para Avaliação</label> |
||
230 | <div class="col-sm-4"> |
||
231 | <html:hidden styleId="course" property="configuration.courseUnitEvaluationActiveCourseIds" /> |
||
232 | <div class="list-group" id="coursesListGroup"> |
||
233 | |||
234 | </div> |
||
235 | <script> |
||
236 | var courses = '${ConfigurationsForm.configuration.courseUnitEvaluationActiveCourseIds}'; |
||
237 | |||
238 | jsonObjCourses = []; |
||
239 | if(courses.length > 0) |
||
240 | { |
||
241 | var coursesArray = courses.split(";"); |
||
242 | for(i=0;i< coursesArray.length;i++) |
||
243 | { |
||
244 | item = {} |
||
245 | item ["courseId"] = coursesArray[i]; |
||
246 | jsonObjCourses.push(item); |
||
247 | } |
||
248 | } |
||
249 | |||
250 | function persistCourses(){ |
||
251 | var finalCourses = ""; |
||
252 | $("#coursesListGroup").html(""); |
||
253 | jsonObjCourses.forEach( |
||
254 | function(obj) { |
||
255 | if(finalCourses == "") |
||
256 | finalCourses+= obj.courseId; |
||
257 | else |
||
258 | finalCourses+= ";" + obj.courseId; |
||
259 | var elementNew = $( "<div class=\"list-group-item\">" + |
||
260 | $('#coursesCombo option[value="' + obj.courseId + '"]').html() + |
||
261 | "</div>"); |
||
262 | $("#coursesListGroup").append(elementNew); |
||
263 | var removeBtn = $('<button class="btn btn-xs btn-danger pull-right" type="button"><span class="glyphicon glyphicon-remove"/></button>'); |
||
264 | elementNew.append(removeBtn); |
||
265 | removeBtn.click( |
||
266 | function(){ |
||
267 | var found = false; |
||
268 | for(var course in jsonObjCourses) |
||
269 | { |
||
270 | if(jsonObjCourses[course].courseId == obj.courseId) |
||
271 | { |
||
272 | jsonObjCourses.splice(course, 1); |
||
273 | break; |
||
274 | } |
||
275 | } |
||
276 | persistCourses(); |
||
277 | } |
||
278 | ); |
||
279 | |||
280 | } |
||
281 | ); |
||
282 | $("#course").val(finalCourses); |
||
283 | |||
284 | } |
||
285 | $(document).ready( |
||
286 | function(){ |
||
287 | persistCourses(); |
||
288 | $("#addCourseBtn").click( |
||
289 | function() |
||
290 | { |
||
291 | var found = false; |
||
292 | for(var course in jsonObjCourses) |
||
293 | { |
||
294 | if(jsonObjCourses[course].courseId == $("#coursesCombo").val()) |
||
295 | { |
||
296 | found = true; |
||
297 | } |
||
298 | } |
||
299 | if(!found) |
||
300 | { |
||
301 | item = {} |
||
302 | item ["courseId"] = $("#coursesCombo").val(); |
||
303 | jsonObjCourses.push(item); |
||
304 | persistCourses(); |
||
305 | } |
||
306 | } |
||
307 | ); |
||
308 | $("#removeCourseBtn").click( |
||
309 | function() |
||
310 | { |
||
311 | var found = false; |
||
312 | for(var course in jsonObjCourses) |
||
313 | { |
||
314 | if(jsonObjCourses[course].courseId == $("#coursesCombo").val()) |
||
315 | { |
||
316 | jsonObjCourses.splice(course, 1); |
||
317 | break; |
||
318 | } |
||
319 | } |
||
320 | persistCourses(); |
||
321 | } |
||
322 | ); |
||
323 | |||
324 | } |
||
325 | ); |
||
326 | </script> |
||
327 | </div> |
||
328 | <div class="col-sm-3"> |
||
329 | <select class="form-control" id="coursesCombo"> |
||
330 | <% |
||
331 | List<Course> courses = DaoFactory.getCourseDaoImpl().findAllOrderByName(); |
||
332 | request.setAttribute("Courses",courses); |
||
333 | %> |
||
334 | <logic:iterate id="course" name="Courses" type="pt.estgp.estgweb.domain.Course"> |
||
335 | <option value="${course.id}">${course.name} (${course.code})</option> |
||
336 | </logic:iterate> |
||
337 | </select> |
||
338 | </div> |
||
339 | <div class="col-sm-3"> |
||
340 | <button class="btn btn-small btn-success" type="button" id="addCourseBtn"><span class="glyphicon glyphicon-plus"/></button> |
||
341 | <button class="btn btn-small btn-danger" type="button" id="removeCourseBtn"><span class="glyphicon glyphicon-remove"/></button> |
||
342 | </div> |
||
343 | </div> |
||
344 | </div> |
||
345 | </div> |
||
346 | |||
347 | |||
348 | |||
349 | <button type="button" class="btn btn-success" onclick="set(form,'saveConfigsGerais');form.submit()"><bean:message key="confirm"/></button> |
||
350 | </html:form> |
||
351 | </div> |
||
352 | </div> |
||
353 | |||
354 | |||
1350 | jmachado | 355 | <% |
356 | AbstractDao.getCurrentSession().getTransaction().commit(); |
||
1353 | jmachado | 357 | %> |
358 | </baco:isAdmin> |