Rev 1350 | Rev 1427 | 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 | |||
72 | |||
73 | <div class="panel panel-default"> |
||
74 | <div class="panel-heading">Relatórios de Avaliação das Unidades Curriculares</div> |
||
75 | <div class="panel-body"> |
||
76 | <div class="form-group"> |
||
77 | <label class="control-label col-sm-2">Ano aberto para relatórios de avaliação</label> |
||
78 | <div class="col-sm-10"> |
||
79 | <html:select styleClass="form-control" property="configuration.courseUnitEvaluationActiveYear"> |
||
80 | <% |
||
81 | for(String year:years) |
||
82 | { |
||
83 | request.setAttribute("year",year); |
||
84 | %> |
||
85 | <html:option value="${year}">${year}</html:option> |
||
86 | <% |
||
87 | } |
||
88 | %> |
||
89 | </html:select> |
||
90 | </div> |
||
91 | </div> |
||
92 | <div class="form-group"> |
||
93 | <label class="control-label col-sm-2">Tipos de Cursos em Avaliação</label> |
||
94 | <div class="col-sm-4"> |
||
95 | <html:hidden styleId="degree" property="configuration.courseUnitEvaluationActiveDegrees" /> |
||
96 | <div class="list-group" id="degreesListGroup"> |
||
97 | |||
98 | </div> |
||
99 | <script> |
||
100 | var degrees = '${ConfigurationsForm.configuration.courseUnitEvaluationActiveDegrees}'; |
||
101 | jsonObjDegrees = []; |
||
102 | if(degrees.length > 0) |
||
103 | { |
||
104 | var degreesArray = degrees.split(","); |
||
105 | for(i=0;i< degreesArray.length;i++) |
||
106 | { |
||
107 | item = {} |
||
108 | item ["degree"] = degreesArray[i]; |
||
109 | jsonObjDegrees.push(item); |
||
110 | } |
||
111 | } |
||
112 | function persistDegrees(){ |
||
113 | var finalDegrees = ""; |
||
114 | $("#degreesListGroup").html(""); |
||
115 | jsonObjDegrees.forEach( |
||
116 | function(obj) { |
||
117 | if(finalDegrees == "") |
||
118 | finalDegrees+= obj.degree; |
||
119 | else |
||
120 | finalDegrees+= "," + obj.degree; |
||
121 | |||
122 | |||
123 | var elementNew = $("<div class=\"list-group-item\">" + |
||
124 | $('#degreeCombo option[value="' + obj.degree + '"]').html() + |
||
125 | "</div>"); |
||
126 | $("#degreesListGroup").append(elementNew); |
||
127 | var removeBtn = $('<button class="btn btn-xs btn-danger pull-right" type="button"><span class="glyphicon glyphicon-remove"/></button>'); |
||
128 | elementNew.append(removeBtn); |
||
129 | removeBtn.click( |
||
130 | function(){ |
||
131 | var found = false; |
||
132 | for(var degree in jsonObjDegrees) |
||
133 | { |
||
134 | if(jsonObjDegrees[degree].degree == obj.degree) |
||
135 | { |
||
136 | jsonObjDegrees.splice(degree, 1); |
||
137 | break; |
||
138 | } |
||
139 | } |
||
140 | persistDegrees(); |
||
141 | } |
||
142 | ); |
||
143 | } |
||
144 | ); |
||
145 | $("#degree").val(finalDegrees); |
||
146 | |||
147 | } |
||
148 | $(document).ready( |
||
149 | function(){ |
||
150 | persistDegrees(); |
||
151 | $("#addDegreeBtn").click( |
||
152 | function() |
||
153 | { |
||
154 | var found = false; |
||
155 | for(var degree in jsonObjDegrees) |
||
156 | { |
||
157 | if(jsonObjDegrees[degree].degree == $("#degreeCombo").val()) |
||
158 | { |
||
159 | found = true; |
||
160 | } |
||
161 | } |
||
162 | if(!found) |
||
163 | { |
||
164 | item = {} |
||
165 | item ["degree"] = $("#degreeCombo").val(); |
||
166 | jsonObjDegrees.push(item); |
||
167 | persistDegrees(); |
||
168 | } |
||
169 | } |
||
170 | ); |
||
171 | $("#removeDegreeBtn").click( |
||
172 | function() |
||
173 | { |
||
174 | var found = false; |
||
175 | for(var degree in jsonObjDegrees) |
||
176 | { |
||
177 | if(jsonObjDegrees[degree].degree == $("#degreeCombo").val()) |
||
178 | { |
||
179 | jsonObjDegrees.splice(degree, 1); |
||
180 | break; |
||
181 | } |
||
182 | } |
||
183 | persistDegrees(); |
||
184 | } |
||
185 | ); |
||
186 | |||
187 | } |
||
188 | ); |
||
189 | </script> |
||
190 | </div> |
||
191 | <div class="col-sm-3"> |
||
192 | <select class="form-control" id="degreeCombo"> |
||
193 | <option value="B"><bean:message key="course.B"/> (B)</option> |
||
194 | <option value="L"><bean:message key="course.L"/> (L)</option> |
||
195 | <option value="M"><bean:message key="course.M"/> (M)</option> |
||
196 | <option value="P"><bean:message key="course.P"/> (P)</option> |
||
197 | <option value="E"><bean:message key="course.E"/> (E)</option> |
||
198 | <option value="A"><bean:message key="course.A"/> (A)</option> |
||
199 | <option value="C"><bean:message key="course.C"/> (C)</option> |
||
200 | <option value="O"><bean:message key="course.O"/> (O)</option> |
||
201 | <option value="T"><bean:message key="course.T"/> (T)</option> |
||
202 | </select> |
||
203 | </div> |
||
204 | <div class="col-sm-3"> |
||
205 | <button class="btn btn-small btn-success" type="button" id="addDegreeBtn"><span class="glyphicon glyphicon-plus"/></button> |
||
206 | <button class="btn btn-small btn-danger" type="button" id="removeDegreeBtn"><span class="glyphicon glyphicon-remove"/></button> |
||
207 | </div> |
||
208 | </div> |
||
209 | |||
210 | |||
211 | <div class="form-group"> |
||
212 | <label class="control-label col-sm-2">Cursos Ativos para Avaliação</label> |
||
213 | <div class="col-sm-4"> |
||
214 | <html:hidden styleId="course" property="configuration.courseUnitEvaluationActiveCourseIds" /> |
||
215 | <div class="list-group" id="coursesListGroup"> |
||
216 | |||
217 | </div> |
||
218 | <script> |
||
219 | var courses = '${ConfigurationsForm.configuration.courseUnitEvaluationActiveCourseIds}'; |
||
220 | |||
221 | jsonObjCourses = []; |
||
222 | if(courses.length > 0) |
||
223 | { |
||
224 | var coursesArray = courses.split(";"); |
||
225 | for(i=0;i< coursesArray.length;i++) |
||
226 | { |
||
227 | item = {} |
||
228 | item ["courseId"] = coursesArray[i]; |
||
229 | jsonObjCourses.push(item); |
||
230 | } |
||
231 | } |
||
232 | |||
233 | function persistCourses(){ |
||
234 | var finalCourses = ""; |
||
235 | $("#coursesListGroup").html(""); |
||
236 | jsonObjCourses.forEach( |
||
237 | function(obj) { |
||
238 | if(finalCourses == "") |
||
239 | finalCourses+= obj.courseId; |
||
240 | else |
||
241 | finalCourses+= ";" + obj.courseId; |
||
242 | var elementNew = $( "<div class=\"list-group-item\">" + |
||
243 | $('#coursesCombo option[value="' + obj.courseId + '"]').html() + |
||
244 | "</div>"); |
||
245 | $("#coursesListGroup").append(elementNew); |
||
246 | var removeBtn = $('<button class="btn btn-xs btn-danger pull-right" type="button"><span class="glyphicon glyphicon-remove"/></button>'); |
||
247 | elementNew.append(removeBtn); |
||
248 | removeBtn.click( |
||
249 | function(){ |
||
250 | var found = false; |
||
251 | for(var course in jsonObjCourses) |
||
252 | { |
||
253 | if(jsonObjCourses[course].courseId == obj.courseId) |
||
254 | { |
||
255 | jsonObjCourses.splice(course, 1); |
||
256 | break; |
||
257 | } |
||
258 | } |
||
259 | persistCourses(); |
||
260 | } |
||
261 | ); |
||
262 | |||
263 | } |
||
264 | ); |
||
265 | $("#course").val(finalCourses); |
||
266 | |||
267 | } |
||
268 | $(document).ready( |
||
269 | function(){ |
||
270 | persistCourses(); |
||
271 | $("#addCourseBtn").click( |
||
272 | function() |
||
273 | { |
||
274 | var found = false; |
||
275 | for(var course in jsonObjCourses) |
||
276 | { |
||
277 | if(jsonObjCourses[course].courseId == $("#coursesCombo").val()) |
||
278 | { |
||
279 | found = true; |
||
280 | } |
||
281 | } |
||
282 | if(!found) |
||
283 | { |
||
284 | item = {} |
||
285 | item ["courseId"] = $("#coursesCombo").val(); |
||
286 | jsonObjCourses.push(item); |
||
287 | persistCourses(); |
||
288 | } |
||
289 | } |
||
290 | ); |
||
291 | $("#removeCourseBtn").click( |
||
292 | function() |
||
293 | { |
||
294 | var found = false; |
||
295 | for(var course in jsonObjCourses) |
||
296 | { |
||
297 | if(jsonObjCourses[course].courseId == $("#coursesCombo").val()) |
||
298 | { |
||
299 | jsonObjCourses.splice(course, 1); |
||
300 | break; |
||
301 | } |
||
302 | } |
||
303 | persistCourses(); |
||
304 | } |
||
305 | ); |
||
306 | |||
307 | } |
||
308 | ); |
||
309 | </script> |
||
310 | </div> |
||
311 | <div class="col-sm-3"> |
||
312 | <select class="form-control" id="coursesCombo"> |
||
313 | <% |
||
314 | List<Course> courses = DaoFactory.getCourseDaoImpl().findAllOrderByName(); |
||
315 | request.setAttribute("Courses",courses); |
||
316 | %> |
||
317 | <logic:iterate id="course" name="Courses" type="pt.estgp.estgweb.domain.Course"> |
||
318 | <option value="${course.id}">${course.name} (${course.code})</option> |
||
319 | </logic:iterate> |
||
320 | </select> |
||
321 | </div> |
||
322 | <div class="col-sm-3"> |
||
323 | <button class="btn btn-small btn-success" type="button" id="addCourseBtn"><span class="glyphicon glyphicon-plus"/></button> |
||
324 | <button class="btn btn-small btn-danger" type="button" id="removeCourseBtn"><span class="glyphicon glyphicon-remove"/></button> |
||
325 | </div> |
||
326 | </div> |
||
327 | </div> |
||
328 | </div> |
||
329 | |||
330 | |||
331 | |||
332 | <button type="button" class="btn btn-success" onclick="set(form,'saveConfigsGerais');form.submit()"><bean:message key="confirm"/></button> |
||
333 | </html:form> |
||
334 | </div> |
||
335 | </div> |
||
336 | |||
337 | |||
1350 | jmachado | 338 | <% |
339 | AbstractDao.getCurrentSession().getTransaction().commit(); |
||
1353 | jmachado | 340 | %> |
341 | </baco:isAdmin> |