Subversion Repositories bacoAlunos

Rev

Rev 1505 | Rev 1507 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1506 jmachado 1
<%@ page import="jomm.dao.impl.AbstractDao" %>
2
<%@ page import="pt.estgp.estgweb.domain.CourseDepartment" %>
3
<%@ page import="pt.estgp.estgweb.domain.Teacher" %>
4
<%@ page import="pt.estgp.estgweb.domain.User" %>
5
<%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %>
6
<%@ page import="pt.estgp.estgweb.domain.views.UserView" %>
507 jmachado 7
<%@ page import="pt.estgp.estgweb.utils.ConfigProperties" %>
1506 jmachado 8
<%@ page import="pt.estgp.estgweb.web.filters.UserRoleProxy" %>
507 jmachado 9
<%@ page import="java.util.ArrayList" %>
1506 jmachado 10
<%@ page import="java.util.Collection" %>
11
<%@ page import="java.util.List" %>
214 jmachado 12
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
13
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
14
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
15
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
16
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
17
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
18
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
19
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
20
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
21
<jsp:useBean id="CourseView" type="pt.estgp.estgweb.domain.views.CourseView" scope="request"/>
1133 jmachado 22
<script>
23
    function alertPermissions()
24
    {
1285 jmachado 25
        alert("Aviso a transmitir ao Centro Informático. Este procedimento afecta as permissões atuais no sistema de ficheiros da intranet. Após salvar estas alterações, por favor gere o BAT de geração de pastas e corra-o novamente na raiz do servidor IONLINE")
1133 jmachado 26
    }
27
    function alertFolders(place)
28
    {
1285 jmachado 29
        alert("Aviso a transmitir ao Centro Informático. Caro administrador, lembramos-lhe que alterar o " + place + " de uma unidade curricular implica trocar a pasta de ficheiros da intranet do " + place + " onde esta se encontrava para o " + place + " onde actualmente se encontra. O BACO irá actualizar a nova LOCALIZAÇÃO da pasta de ficheiros na sua base de dados. Mas a pasta terá de ser fisicamente alterada pela administração de sistemas.");
1133 jmachado 30
    }
31
 
32
</script>
444 jmachado 33
<html:errors/>
34
<jomm:messages/>
1506 jmachado 35
<html:form styleClass="form-horizontal" action="/user/courseControllerFromServiceZone" enctype="multipart/form-data">
214 jmachado 36
<input type="hidden" name="dispatch" value="submit"/>
37
<html:hidden property="courseView.id"/>
1506 jmachado 38
<jsp:useBean id="CourseForm" type="pt.estgp.estgweb.web.form.courses.CourseForm" scope="request"/>
248 jmachado 39
<logic:present name="CourseView" property="htmlResult">
40
    <pre class="log">
41
        <bean:write name="CourseView" property="htmlResult"/>
42
    </pre>
43
</logic:present>
1133 jmachado 44
 
1506 jmachado 45
<div class="panel panel-default">
46
<div class="panel-body">
376 jmachado 47
 
1506 jmachado 48
    <div class="form-group">
49
        <label class="control-label col-sm-2"><bean:message key="course.code"/></label>
50
        <div class="col-sm-10">
51
            <html:text styleClass="form-control" property="courseView.code" size="20"/>
52
        </div>
53
    </div>
54
    <div class="form-group">
55
        <label class="control-label col-sm-2"><bean:message key="course.area"/></label>
56
        <div class="col-sm-10">
1505 jmachado 57
            <%
58
                AbstractDao.getCurrentSession().beginTransaction();
59
                List<CourseDepartment> departments = DaoFactory.getCourseDepartmentDaoImpl().findActives();
1506 jmachado 60
                request.setAttribute("departaments",departments);
1505 jmachado 61
            %>
1506 jmachado 62
            <html:select styleClass="form-control" property="courseView.area">
1505 jmachado 63
                <html:option value="">Nenhum</html:option>
64
                <logic:iterate id="area" name="departaments" type="pt.estgp.estgweb.domain.CourseDepartmentImpl">
65
                    <html:option value="${area.sigla}">${area.schoolFromInstitutionalCode} - ${area.name}</html:option>
376 jmachado 66
                </logic:iterate>
67
            </html:select>
1505 jmachado 68
            <%
69
                AbstractDao.getCurrentSession().getTransaction().commit();
70
            %>
1506 jmachado 71
        </div>
72
    </div>
73
    <div class="form-group">
74
        <label class="control-label col-sm-2"><bean:message key="name"/> PT</label>
75
        <div class="col-sm-10">
76
            <html:text styleClass="form-control" property="courseView.name" size="20"/>
77
        </div>
78
    </div>
79
    <div class="form-group">
80
        <label class="control-label col-sm-2"><bean:message key="name"/> EN</label>
81
        <div class="col-sm-10">
82
            <html:text styleClass="form-control" property="courseView.nameEn" size="20"/>
83
        </div>
84
    </div>
85
    <div class="form-group">
86
        <label class="control-label col-sm-2"><bean:message key="name"/> ES</label>
87
        <div class="col-sm-10">
88
            <html:text styleClass="form-control" property="courseView.nameEs" size="20"/>
89
        </div>
90
    </div>
91
    <div class="form-group">
92
        <label class="control-label col-sm-2"><bean:message key="name"/> FR</label>
93
        <div class="col-sm-10">
94
            <html:text styleClass="form-control" property="courseView.nameFr" size="20"/>
95
        </div>
96
    </div>
97
    <div class="form-group">
98
        <label class="control-label col-sm-2"><bean:message key="course.description"/></label>
99
        <div class="col-sm-10">
100
            <html:textarea styleClass="form-control" property="courseView.description"/>
101
        </div>
102
    </div>
103
    <div class="form-group">
104
        <label class="control-label col-sm-2"><bean:message key="status"/></label>
105
        <div class="col-sm-10">
106
            <html:select styleClass="form-control" property="courseView.status">
797 jmachado 107
                <html:option value="true"><bean:message key="yes"/></html:option>
108
                <html:option value="false"><bean:message key="no"/></html:option>
790 jmachado 109
            </html:select>
1506 jmachado 110
        </div>
111
    </div>
112
    <div class="form-group">
113
        <label class="control-label col-sm-2"><bean:message key="course.degree"/> FR</label>
114
        <div class="col-sm-10">
115
            <html:select styleClass="form-control"  property="courseView.degree">
249 jmachado 116
                <html:option value="B"><bean:message key="course.B"/></html:option>
117
                <html:option value="L"><bean:message key="course.L"/></html:option>
118
                <html:option value="M"><bean:message key="course.M"/></html:option>
119
                <html:option value="P"><bean:message key="course.P"/></html:option>
120
                <html:option value="E"><bean:message key="course.E"/></html:option>
417 jmachado 121
                <html:option value="A"><bean:message key="course.A"/></html:option>
122
                <html:option value="C"><bean:message key="course.C"/></html:option>
123
                <html:option value="O"><bean:message key="course.O"/></html:option>
896 jmachado 124
                <html:option value="T"><bean:message key="course.T"/></html:option>
214 jmachado 125
            </html:select>
1133 jmachado 126
            ** SIGES: <bean:write name="CourseForm" property="courseView.degree"/> - Qualquer erro de atrbuição informar imediatamente a equipa de desenvolvimento
1506 jmachado 127
        </div>
128
    </div>
1312 jmachado 129
    <logic:notEmpty name="CourseForm" property="courseView.courseYearViews">
1506 jmachado 130
        <div class="form-group">
131
            <label class="control-label col-sm-2">Politica de Separação de Turmas</label>
132
            <div class="col-sm-10">
1312 jmachado 133
                <table class="tablesorterfiltered">
134
                    <thead>
135
                        <tr>
136
                            <th>Ano Lectivo</th>
137
                            <th>Usar Turmas Separadas</th>
138
                            <th>Ultima alteração</th>
139
                        </tr>
140
                    </thead>
141
                    <tbody>
1506 jmachado 142
                        <nested:iterate id="cyv" property="courseView.courseYearViews" type="pt.estgp.estgweb.domain.views.CourseView.CourseYearView">
143
                            <tr>
144
                                <td>${cyv.importYear}</td>
145
                                <td><nested:hidden property="id"/>
146
                                    <nested:checkbox property="separatedTurmas"/></td>
147
                                <td>${cyv.updateDate}</td>
148
                            </tr>
149
                        </nested:iterate>
1312 jmachado 150
                    </tbody>
151
                </table>
1506 jmachado 152
            </div>
153
        </div>
1312 jmachado 154
    </logic:notEmpty>
1506 jmachado 155
    <div class="form-group">
156
        <label class="control-label col-sm-2"><bean:message key="course.importYear"/></label>
157
        <div class="col-sm-10">
158
            <html:select styleClass="form-control"  property="courseView.importYear">
214 jmachado 159
                <logic:iterate id="item" name="CourseForm" property="importYears">
160
                    <html:option value="${item}">${item}</html:option>
161
                </logic:iterate>
162
            </html:select>
1506 jmachado 163
        </div>
164
    </div>
165
 
166
    <div class="form-group">
167
        <label class="control-label col-sm-2"><bean:message key="course.institutionalCode"/></label>
168
        <div class="col-sm-10">
1505 jmachado 169
            <!--Dependente do app.properties-->
1506 jmachado 170
            <html:select styleClass="form-control"  property="courseView.institutionalCode">
1505 jmachado 171
                <html:option value="1"><%=ConfigProperties.getProperty("institution.code.prefix.1")%></html:option>
172
                <html:option value="2"><%=ConfigProperties.getProperty("institution.code.prefix.2")%></html:option>
173
                <html:option value="3"><%=ConfigProperties.getProperty("institution.code.prefix.3")%></html:option>
174
                <html:option value="4"><%=ConfigProperties.getProperty("institution.code.prefix.4")%></html:option>
175
            </html:select>
1506 jmachado 176
        </div>
177
    </div>
1505 jmachado 178
 
1506 jmachado 179
    <div class="form-group">
180
        <label class="control-label col-sm-2"><bean:message key="course.userGroupStudents"/></label>
181
        <div class="col-sm-10">
182
            <html:text styleClass="form-control" onchange="alertPermissions()" property="courseView.userGroupStudents"/>
183
        </div>
184
    </div>
901 jmachado 185
 
186
 
1506 jmachado 187
    <div class="form-group">
188
        <label class="control-label col-sm-2"><bean:message key="course.coordinator"/></label>
189
        <div class="col-sm-10">
190
            <html:select styleClass="form-control" onchange="alertPermissions()"  property="courseView.coordinator.id">
214 jmachado 191
                <html:option value="0">
192
                    <bean:message key="none"/>
193
                </html:option>
194
                <logic:present name="CourseForm" property="teachers">
195
                    <logic:iterate id="teacher" name="CourseForm" property="teachers" type="pt.estgp.estgweb.domain.views.UserView">
196
                        <html:option value="${teacher.id}">
197
                            (${teacher.code}) ${teacher.name}
198
                        </html:option>
199
                    </logic:iterate>
200
                </logic:present>
201
            </html:select>
1506 jmachado 202
        </div>
203
    </div>
507 jmachado 204
 
1506 jmachado 205
    <div class="form-group">
206
        <label class="control-label col-sm-2"><bean:message key="course.validation.role"/></label>
207
        <div class="col-sm-10">
208
            <%
507 jmachado 209
            List<String> targetRoles = new ArrayList<String>();
1283 jmachado 210
            for(String role: UserRoleProxy.getUserRoles())
507 jmachado 211
            {
1506 jmachado 212
            if(role.startsWith("courseValidateProgram"))
213
            targetRoles.add(role);
507 jmachado 214
            }
215
            request.setAttribute("targetRoles",targetRoles);
1506 jmachado 216
            %>
217
            <html:select styleClass="form-control" onchange="alertPermissions()" property="courseView.validationRole">
218
                <logic:iterate id="role" name="targetRoles">
219
                    <html:option value="${role}" key="user.role.${role}"/>
507 jmachado 220
                </logic:iterate>
221
            </html:select>
1506 jmachado 222
        </div>
223
    </div>
249 jmachado 224
 
1506 jmachado 225
    <div class="form-group">
226
        <label class="control-label col-sm-2">Membros da Comissão</label>
227
        <div class="col-sm-10">
507 jmachado 228
 
229
 
230
 
1506 jmachado 231
                <%
232
                    request.setAttribute("teachersForComissions", CourseForm.getTeachers());
233
                    request.setAttribute("courseIdForComissions", CourseView.getId());
234
                %>
507 jmachado 235
 
1506 jmachado 236
                <%-- PAINEL INDEPENDENTE PARA GERIR COMISSAO DE CURSO --%>
237
                <%
238
                        Long courseIdForComissions = (Long) request.getAttribute("courseIdForComissions");
239
                        Collection<UserView> teachersForComissions = (Collection<UserView>) request.getAttribute("teachersForComissions");
240
 
241
                %>
242
                <script>
243
                    function removeCourseComissionTeacher(teacherId)
244
                    {
245
                        $.getJSON('<%=request.getContextPath()%>/user/courses/courseApiJson.jsp',
246
                                {
247
                                    service:"removeCourseComissionTeacher",
248
                                    teacherId:teacherId,
249
                                    courseId: <%=courseIdForComissions%>
250
                                },
251
                                function(data)
252
                                {
253
                                    if(data.response == "done")
254
                                    {
255
                                        $("#courseComissionTeacher" + teacherId).remove();
256
                                    }
257
                                    else
258
                                    {
259
                                        $("#courseComissionTeacher" + teacherId).css(
260
                                                {
261
                                                    "background-color":"red"
262
                                                }
263
                                        );
264
                                        alert("ERRO NO SERVIÇO: " + data.msg);
265
                                    }
266
                                });
267
                    }
268
                    function addCourseComissionTeacher(teacherId)
269
                    {
270
 
271
                        $.getJSON('<%=request.getContextPath()%>/user/courses/courseApiJson.jsp',
272
                                {
273
                                    service:"addCourseComissionTeacher",
274
                                    teacherId:teacherId,
275
                                    courseId: <%=CourseView.getId()%>
276
                                },
277
                                function(data)
278
                                {
279
                                    if(data.response == "done")
280
                                    {
281
 
282
                                        newLine = $(
283
                                          "<tr id=\"courseComissionTeacher" + teacherId + "\" >" +
284
                                                "<td>" + data.teacherCode + "</td>" +
285
                                                "<td>" + data.teacherName + "</td>" +
286
                                                "<td>" + data.teacherEmail + "</td>" +
287
                                                "<td>" +
288
                                                    "<a class=\"btn btn-warning\" target=\"_blank\" href=\"<%=request.getContextPath()%>/user/startProfileFromSearchUsers.do?id=" + teacherId + "\"><span class=\"glyphicon glyphicon-pencil\"></span></a>" +
289
                                                    "<button type=\"button\" class=\"btn btn-danger\" onclick=\"removeCourseComissionTeacher(" + teacherId + ")\"><span class=\"glyphicon glyphicon-remove\"></span></button>"+
290
                                                  "</td>" +
291
                                          "</tr>");
292
                                        $("#teacherContainer").append(newLine);
293
                                        evaluateTableSortersInside("#teachersTable");
294
 
295
                                    }
296
                                    else
297
                                    {
298
                                        $("#courseComissionTeacher" + teacherId).css(
299
                                                {
300
                                                    "background-color":"red"
301
                                                }
302
                                        );
303
                                        alert("ERRO NO SERVIÇO: " + data.msg);
304
                                    }
305
                                });
306
                    }
307
                </script>
308
                <div class="form-group">
309
                    <label class="control-label col-sm-2">Escolher um Membro para a Comissão</label>
310
                    <div class="col-sm-10">
311
                        <select id="teacherSelectedForComission" class="form-control">
312
                            <option>
313
                                <bean:message key="none"/>
314
                            </option>
315
                            <logic:present name="teachersForComissions">
316
                                <logic:iterate id="teacher" name="teachersForComissions" type="pt.estgp.estgweb.domain.views.UserView">
317
                                    <option value="${teacher.id}">
318
                                        (${teacher.code}) ${teacher.name}
319
                                    </option>
320
                                </logic:iterate>
321
                            </logic:present>
322
                        </select>
323
                        <button type="button" class="btn btn-success" onclick="addCourseComissionTeacher($('#teacherSelectedForComission').val())"><span class="glyphicon glyphicon-plus"></span></button>
324
                    </div>
325
                </div>
326
 
327
 
328
                <table id="teachersTable" class="tablesorterfiltered">
329
                    <thead>
330
                        <tr>
331
                            <th>Código</th>
332
                            <th>Nome</th>
333
                            <th>Contacto</th>
334
                            <th>Editar</th>
335
                        </tr>
336
                    </thead>
337
                    <tbody id="teacherContainer">
338
                    <%
339
                        AbstractDao.getCurrentSession().beginTransaction();
340
                        for(User u:DaoFactory.getUserDaoImpl().loadRoleUsers(CourseView.getValidationRole()))
341
                        {
342
                    %>
343
                        <tr id="courseComissionTeacher<%=u.getId()%>">
344
                            <td><%=((Teacher)u).getSigesCode()%></td>
345
                            <td><%=u.getName()%></td>
346
                            <td><%=u.getEmail()%></td>
347
                            <td>
348
                                <a class="btn btn-warning" target="_blank" href="<%=request.getContextPath()%>/user/startProfileFromSearchUsers.do?id=<%=u.getId()%>"><span class="glyphicon glyphicon-pencil"></span></a>
349
                                <button type="button" class="btn btn-danger" onclick="removeCourseComissionTeacher(<%=u.getId()%>)"><span class="glyphicon glyphicon-remove"></span></button>
350
                            </td>
351
                        </tr>
352
                    <%
353
                        }
354
                        AbstractDao.getCurrentSession().getTransaction().commit();
355
                    %>
356
                    </tbody>
357
                </table>
358
                <%-- // PAINEL INDEPENDENTE PARA GERIR COMISSAO DE CURSO --%>
359
        </div>
360
    </div>
361
 
362
 
363
    <div class="form-group">
364
        <label class="control-label col-sm-2"><bean:message key="course.externalSite"/></label>
365
        <div class="col-sm-10">
366
            <html:select styleClass="form-control" property="courseView.externalSiteServer">
249 jmachado 367
                <html:option value="estgp">ESTG</html:option>
368
            </html:select>
1506 jmachado 369
            <html:text styleClass="form-control" property="courseView.externalSitePath"/>
370
        </div>
371
    </div>
372
 
373
    <div class="form-group">
374
        <label class="control-label col-sm-2"><bean:message key="course.studies.plan"/>(VERSAO ANTIGA)</label>
375
        <div class="col-sm-10">
376
            <baco:isAdmin>
377
                <html:file styleClass="form-control" property="studiesPlan"/>
378
            </baco:isAdmin>
379
            <baco:isNotAdmin>
380
                <html:file disabled="true" styleClass="form-control" property="studiesPlan"/>
381
            </baco:isNotAdmin>
382
 
214 jmachado 383
            <logic:present name="CourseView" property="studiesPlan">
1506 jmachado 384
                <a href="<%=request.getContextPath()%>/repositoryStream/${CourseView.studiesPlanStreamId}"><bean:message key="course.studies.plan"/> XML antigo</a> (${CourseView.studiesPlanSizeKb} Kb - ${CourseView.studiesPlanDate})
214 jmachado 385
            </logic:present>
386
            <logic:notPresent name="CourseView" property="studiesPlan">
387
                <bean:message key="course.studies.plan.not.available"/>
388
            </logic:notPresent>
1505 jmachado 389
 
1506 jmachado 390
        </div>
391
    </div>
392
 
393
    <%--
394
 
395
    <div class="form-group">
396
        <label class="control-label col-sm-2">
397
            <bean:message key="course.studies.plan"/>(Versão nova PAE)
1505 jmachado 398
            <a class="btn btn-default" href="<%=request.getContextPath()%>/user/adminStudyPlans.do?courseId=<%=CourseView.getId()%>">Gerir Planos</a>
1506 jmachado 399
        </label>
400
        <div class="col-sm-10">
1505 jmachado 401
            <logic:present name="CourseView" property="courseStudiesPlans">
402
                <table class="tablesorterfiltered">
403
                    <thead>
404
                    <tr>
405
                        <th>Versão</th>
406
                        <th>Data Produção</th>
407
                        <th>Ultima alteração</th>
408
                        <th>Descrição</th>
409
                    </tr>
410
                    </thead>
411
                    <tbody>
412
                    <logic:iterate id="studyPlan" name="CourseView" property="courseStudiesPlans" type="pt.estgp.estgweb.domain.CourseStudiesPlan">
413
                        <tr>
414
                            <td>${studyPlan.version}</td>
415
                            <td>${studyPlan.saveDate}</td>
416
                            <td>${studyPlan.updateDate}</td>
417
                            <td>${studyPlan.versionDescription}</td>
418
                        </tr>
419
                    </logic:iterate>
420
                    </tbody>
421
                </table>
422
            </logic:present>
1506 jmachado 423
        </div>
424
    </div>
425
     --%>
1505 jmachado 426
 
1506 jmachado 427
 
428
 
429
<%--
430
 
431
    <tr>
432
        <th>
433
            <bean:message key="course.director"/>
434
        </th>
435
        <td>
436
            <html:select onchange="alertPermissions()"  property="courseView.director.id">
437
                <html:option value="0">
438
                    <bean:message key="none"/>
439
                </html:option>
440
                <logic:present name="CourseForm" property="teachers">
441
                    <logic:iterate id="teacher" name="CourseForm" property="teachers" type="pt.estgp.estgweb.domain.views.UserView">
442
                        <html:option value="${teacher.id}">
443
                            (${teacher.code}) ${teacher.name}
444
                        </html:option>
445
                    </logic:iterate>
446
                </logic:present>
447
            </html:select>
1505 jmachado 448
        </td>
449
    </tr>
1506 jmachado 450
--%>
214 jmachado 451
 
1506 jmachado 452
 
453
 
454
 
455
 
456
 
457
    <button class="btn btn-success" type="button" onclick="set(this.form,'submit');this.form.submit()">
458
            <bean:message key="confirm"/>
459
    </button>
460
 
461
 
462
</div><!-- //panel-body-->
463
</div><!-- //panel panel-default-->
464
 
214 jmachado 465
</html:form>