Subversion Repositories bacoAlunos

Rev

Rev 1752 | 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" %>
1797 jmachado 12
<%@ page import="pt.estgp.estgweb.domain.UserSession" %>
214 jmachado 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" %>
1797 jmachado 21
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSessionImpl" scope="request"/>
214 jmachado 22
<jsp:useBean id="CourseView" type="pt.estgp.estgweb.domain.views.CourseView" scope="request"/>
1133 jmachado 23
<script>
24
    function alertPermissions()
25
    {
1285 jmachado 26
        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 27
    }
28
    function alertFolders(place)
29
    {
1285 jmachado 30
        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 31
    }
32
 
33
</script>
444 jmachado 34
<html:errors/>
35
<jomm:messages/>
1506 jmachado 36
<html:form styleClass="form-horizontal" action="/user/courseControllerFromServiceZone" enctype="multipart/form-data">
214 jmachado 37
<input type="hidden" name="dispatch" value="submit"/>
38
<html:hidden property="courseView.id"/>
1506 jmachado 39
<jsp:useBean id="CourseForm" type="pt.estgp.estgweb.web.form.courses.CourseForm" scope="request"/>
248 jmachado 40
<logic:present name="CourseView" property="htmlResult">
41
    <pre class="log">
42
        <bean:write name="CourseView" property="htmlResult"/>
43
    </pre>
44
</logic:present>
1133 jmachado 45
 
1506 jmachado 46
<div class="panel panel-default">
47
<div class="panel-body">
376 jmachado 48
 
1797 jmachado 49
    <%
50
        if(UserSession.getUser().isSuperuserOrAdmin()
51
                || CourseView.getCode() == null
52
                || CourseView.getCode().trim().length() == 0
53
                || CourseView.getCode().trim().equals("0"))
54
        {
55
            request.setAttribute("codeReadOnly",false);
56
        }
57
        else
58
            request.setAttribute("codeReadOnly",true);
59
    %>
1506 jmachado 60
    <div class="form-group">
61
        <label class="control-label col-sm-2"><bean:message key="course.code"/></label>
62
        <div class="col-sm-10">
1797 jmachado 63
            <html:text styleClass="form-control" readonly="${codeReadOnly}" property="courseView.code" size="20"/>
1506 jmachado 64
        </div>
65
    </div>
66
    <div class="form-group">
67
        <label class="control-label col-sm-2"><bean:message key="course.area"/></label>
68
        <div class="col-sm-10">
1505 jmachado 69
            <%
70
                AbstractDao.getCurrentSession().beginTransaction();
71
                List<CourseDepartment> departments = DaoFactory.getCourseDepartmentDaoImpl().findActives();
1506 jmachado 72
                request.setAttribute("departaments",departments);
1505 jmachado 73
            %>
1697 jmachado 74
            <html:select styleClass="form-control" property="courseView.area" styleId="courseArea">
1505 jmachado 75
                <html:option value="">Nenhum</html:option>
76
                <logic:iterate id="area" name="departaments" type="pt.estgp.estgweb.domain.CourseDepartmentImpl">
77
                    <html:option value="${area.sigla}">${area.schoolFromInstitutionalCode} - ${area.name}</html:option>
376 jmachado 78
                </logic:iterate>
79
            </html:select>
1505 jmachado 80
            <%
81
                AbstractDao.getCurrentSession().getTransaction().commit();
82
            %>
1506 jmachado 83
        </div>
84
    </div>
85
    <div class="form-group">
86
        <label class="control-label col-sm-2"><bean:message key="name"/> PT</label>
87
        <div class="col-sm-10">
88
            <html:text styleClass="form-control" property="courseView.name" size="20"/>
89
        </div>
90
    </div>
91
    <div class="form-group">
92
        <label class="control-label col-sm-2"><bean:message key="name"/> EN</label>
93
        <div class="col-sm-10">
94
            <html:text styleClass="form-control" property="courseView.nameEn" size="20"/>
95
        </div>
96
    </div>
97
    <div class="form-group">
98
        <label class="control-label col-sm-2"><bean:message key="name"/> ES</label>
99
        <div class="col-sm-10">
100
            <html:text styleClass="form-control" property="courseView.nameEs" size="20"/>
101
        </div>
102
    </div>
103
    <div class="form-group">
104
        <label class="control-label col-sm-2"><bean:message key="name"/> FR</label>
105
        <div class="col-sm-10">
106
            <html:text styleClass="form-control" property="courseView.nameFr" size="20"/>
107
        </div>
108
    </div>
109
    <div class="form-group">
110
        <label class="control-label col-sm-2"><bean:message key="course.description"/></label>
111
        <div class="col-sm-10">
112
            <html:textarea styleClass="form-control" property="courseView.description"/>
113
        </div>
114
    </div>
115
    <div class="form-group">
116
        <label class="control-label col-sm-2"><bean:message key="status"/></label>
117
        <div class="col-sm-10">
118
            <html:select styleClass="form-control" property="courseView.status">
797 jmachado 119
                <html:option value="true"><bean:message key="yes"/></html:option>
120
                <html:option value="false"><bean:message key="no"/></html:option>
790 jmachado 121
            </html:select>
1506 jmachado 122
        </div>
123
    </div>
124
    <div class="form-group">
1521 jmachado 125
        <label class="control-label col-sm-2">Mostrar Plano Estudos na API (Sites Externos/ex: Site IPP)</label>
126
        <div class="col-sm-10">
127
            <html:select styleClass="form-control" property="courseView.showStudiesPlan">
128
                <html:option value="true"><bean:message key="yes"/></html:option>
129
                <html:option value="false"><bean:message key="no"/></html:option>
130
            </html:select>
131
        </div>
132
    </div>
133
    <div class="form-group">
1507 jmachado 134
        <label class="control-label col-sm-2"><bean:message key="course.degree"/></label>
1506 jmachado 135
        <div class="col-sm-10">
136
            <html:select styleClass="form-control"  property="courseView.degree">
249 jmachado 137
                <html:option value="B"><bean:message key="course.B"/></html:option>
138
                <html:option value="L"><bean:message key="course.L"/></html:option>
139
                <html:option value="M"><bean:message key="course.M"/></html:option>
140
                <html:option value="P"><bean:message key="course.P"/></html:option>
141
                <html:option value="E"><bean:message key="course.E"/></html:option>
417 jmachado 142
                <html:option value="A"><bean:message key="course.A"/></html:option>
143
                <html:option value="C"><bean:message key="course.C"/></html:option>
144
                <html:option value="O"><bean:message key="course.O"/></html:option>
896 jmachado 145
                <html:option value="T"><bean:message key="course.T"/></html:option>
214 jmachado 146
            </html:select>
1133 jmachado 147
            ** SIGES: <bean:write name="CourseForm" property="courseView.degree"/> - Qualquer erro de atrbuição informar imediatamente a equipa de desenvolvimento
1506 jmachado 148
        </div>
149
    </div>
1312 jmachado 150
    <logic:notEmpty name="CourseForm" property="courseView.courseYearViews">
1506 jmachado 151
        <div class="form-group">
152
            <label class="control-label col-sm-2">Politica de Separação de Turmas</label>
153
            <div class="col-sm-10">
1312 jmachado 154
                <table class="tablesorterfiltered">
155
                    <thead>
156
                        <tr>
157
                            <th>Ano Lectivo</th>
158
                            <th>Usar Turmas Separadas</th>
159
                            <th>Ultima alteração</th>
160
                        </tr>
161
                    </thead>
162
                    <tbody>
1506 jmachado 163
                        <nested:iterate id="cyv" property="courseView.courseYearViews" type="pt.estgp.estgweb.domain.views.CourseView.CourseYearView">
164
                            <tr>
165
                                <td>${cyv.importYear}</td>
166
                                <td><nested:hidden property="id"/>
167
                                    <nested:checkbox property="separatedTurmas"/></td>
168
                                <td>${cyv.updateDate}</td>
169
                            </tr>
170
                        </nested:iterate>
1312 jmachado 171
                    </tbody>
172
                </table>
1506 jmachado 173
            </div>
174
        </div>
1312 jmachado 175
    </logic:notEmpty>
1506 jmachado 176
    <div class="form-group">
177
        <label class="control-label col-sm-2"><bean:message key="course.importYear"/></label>
178
        <div class="col-sm-10">
179
            <html:select styleClass="form-control"  property="courseView.importYear">
214 jmachado 180
                <logic:iterate id="item" name="CourseForm" property="importYears">
181
                    <html:option value="${item}">${item}</html:option>
182
                </logic:iterate>
183
            </html:select>
1506 jmachado 184
        </div>
185
    </div>
186
 
187
    <div class="form-group">
188
        <label class="control-label col-sm-2"><bean:message key="course.institutionalCode"/></label>
189
        <div class="col-sm-10">
1670 jmachado 190
            <logic:notEmpty name="CourseForm" property="courseView.courseDepartment">
191
                <logic:notEmpty name="CourseForm" property="courseView.courseDepartment.courseSchool">
192
                    ${CourseForm.courseView.courseDepartment.courseSchool.name}
193
                </logic:notEmpty>
194
            </logic:notEmpty>
195
            * (vem do departamento)
1506 jmachado 196
        </div>
197
    </div>
1505 jmachado 198
 
1506 jmachado 199
    <div class="form-group">
200
        <label class="control-label col-sm-2"><bean:message key="course.userGroupStudents"/></label>
201
        <div class="col-sm-10">
202
            <html:text styleClass="form-control" onchange="alertPermissions()" property="courseView.userGroupStudents"/>
203
        </div>
204
    </div>
901 jmachado 205
 
206
 
1506 jmachado 207
    <div class="form-group">
208
        <label class="control-label col-sm-2"><bean:message key="course.coordinator"/></label>
209
        <div class="col-sm-10">
210
            <html:select styleClass="form-control" onchange="alertPermissions()"  property="courseView.coordinator.id">
214 jmachado 211
                <html:option value="0">
212
                    <bean:message key="none"/>
213
                </html:option>
1741 jmachado 214
                <%
215
                    List<UserView> teachers = CourseForm.getTeachersService(request,response);
216
                    request.setAttribute("teachers",teachers);
217
                %>
218
                <logic:present name="teachers" >
219
                    <logic:iterate id="teacher" name="teachers" type="pt.estgp.estgweb.domain.views.UserView">
214 jmachado 220
                        <html:option value="${teacher.id}">
221
                            (${teacher.code}) ${teacher.name}
222
                        </html:option>
223
                    </logic:iterate>
224
                </logic:present>
225
            </html:select>
1506 jmachado 226
        </div>
227
    </div>
507 jmachado 228
 
1506 jmachado 229
    <div class="form-group">
230
        <label class="control-label col-sm-2"><bean:message key="course.validation.role"/></label>
231
        <div class="col-sm-10">
232
            <%
507 jmachado 233
            List<String> targetRoles = new ArrayList<String>();
1283 jmachado 234
            for(String role: UserRoleProxy.getUserRoles())
507 jmachado 235
            {
1506 jmachado 236
            if(role.startsWith("courseValidateProgram"))
237
            targetRoles.add(role);
507 jmachado 238
            }
239
            request.setAttribute("targetRoles",targetRoles);
1506 jmachado 240
            %>
241
            <html:select styleClass="form-control" onchange="alertPermissions()" property="courseView.validationRole">
1539 jmachado 242
                <html:option value=""></html:option>
1506 jmachado 243
                <logic:iterate id="role" name="targetRoles">
244
                    <html:option value="${role}" key="user.role.${role}"/>
507 jmachado 245
                </logic:iterate>
246
            </html:select>
1506 jmachado 247
        </div>
248
    </div>
249 jmachado 249
 
1506 jmachado 250
    <div class="form-group">
251
        <label class="control-label col-sm-2">Membros da Comissão</label>
252
        <div class="col-sm-10">
507 jmachado 253
 
254
 
255
 
1506 jmachado 256
                <%
1741 jmachado 257
                    request.setAttribute("teachersForComissions", CourseForm.getTeachersService(request,response));
1506 jmachado 258
                    request.setAttribute("courseIdForComissions", CourseView.getId());
1507 jmachado 259
                    //CourseView needed ja la esta neste caso
1506 jmachado 260
                %>
507 jmachado 261
 
1507 jmachado 262
                <jsp:include page="courseComissionEditPanel.jsp"/>
1506 jmachado 263
                <%-- // PAINEL INDEPENDENTE PARA GERIR COMISSAO DE CURSO --%>
264
        </div>
265
    </div>
266
 
267
 
268
    <div class="form-group">
269
        <label class="control-label col-sm-2"><bean:message key="course.externalSite"/></label>
270
        <div class="col-sm-10">
271
            <html:select styleClass="form-control" property="courseView.externalSiteServer">
249 jmachado 272
                <html:option value="estgp">ESTG</html:option>
273
            </html:select>
1506 jmachado 274
            <html:text styleClass="form-control" property="courseView.externalSitePath"/>
275
        </div>
276
    </div>
277
 
1797 jmachado 278
    <%--
1506 jmachado 279
    <div class="form-group">
280
        <label class="control-label col-sm-2"><bean:message key="course.studies.plan"/>(VERSAO ANTIGA)</label>
281
        <div class="col-sm-10">
282
            <baco:isAdmin>
283
                <html:file styleClass="form-control" property="studiesPlan"/>
284
            </baco:isAdmin>
285
            <baco:isNotAdmin>
286
                <html:file disabled="true" styleClass="form-control" property="studiesPlan"/>
287
            </baco:isNotAdmin>
288
 
214 jmachado 289
            <logic:present name="CourseView" property="studiesPlan">
1506 jmachado 290
                <a href="<%=request.getContextPath()%>/repositoryStream/${CourseView.studiesPlanStreamId}"><bean:message key="course.studies.plan"/> XML antigo</a> (${CourseView.studiesPlanSizeKb} Kb - ${CourseView.studiesPlanDate})
214 jmachado 291
            </logic:present>
292
            <logic:notPresent name="CourseView" property="studiesPlan">
293
                <bean:message key="course.studies.plan.not.available"/>
294
            </logic:notPresent>
1505 jmachado 295
 
1506 jmachado 296
        </div>
1797 jmachado 297
    </div>--%>
1506 jmachado 298
 
299
 
1507 jmachado 300
 
1506 jmachado 301
    <div class="form-group">
302
        <label class="control-label col-sm-2">
303
            <bean:message key="course.studies.plan"/>(Versão nova PAE)
1513 jmachado 304
 
1507 jmachado 305
            <baco:hasRole role="admin,all,servicesStudiesPlans">
1752 jmachado 306
                <logic:equal value="0" name="CourseView" property="id">
307
                    Para Gerir Planos de Estudos tem de salvar o Curso
308
                </logic:equal>
309
                <logic:greaterThan value="0" name="CourseView" property="id">
310
                    <button class="btn btn-warning" type="button" onclick="set(this.form,'submitAndAdminStudyPlan');this.form.submit()">
311
                        <span class="glyphicon glyphicon-pencil"></span> Gerir Planos
312
                    </button>
313
                </logic:greaterThan>
314
 
1507 jmachado 315
            </baco:hasRole>
316
            <baco:hasNotRole role="admin,all,servicesStudiesPlans">
317
                <label class="text-info"> Necessita do papel de Gestão de Planos de Estudos para editar os planos</label>
1513 jmachado 318
            </baco:hasNotRole>
1506 jmachado 319
        </label>
320
        <div class="col-sm-10">
1505 jmachado 321
            <logic:present name="CourseView" property="courseStudiesPlans">
322
                <table class="tablesorterfiltered">
323
                    <thead>
324
                    <tr>
325
                        <th>Versão</th>
326
                        <th>Data Produção</th>
327
                        <th>Ultima alteração</th>
328
                        <th>Descrição</th>
329
                    </tr>
330
                    </thead>
331
                    <tbody>
332
                    <logic:iterate id="studyPlan" name="CourseView" property="courseStudiesPlans" type="pt.estgp.estgweb.domain.CourseStudiesPlan">
333
                        <tr>
334
                            <td>${studyPlan.version}</td>
335
                            <td>${studyPlan.saveDate}</td>
336
                            <td>${studyPlan.updateDate}</td>
337
                            <td>${studyPlan.versionDescription}</td>
338
                        </tr>
339
                    </logic:iterate>
340
                    </tbody>
341
                </table>
342
            </logic:present>
1506 jmachado 343
        </div>
344
    </div>
1505 jmachado 345
 
1506 jmachado 346
 
347
 
1507 jmachado 348
 
1506 jmachado 349
<%--
350
 
351
    <tr>
352
        <th>
353
            <bean:message key="course.director"/>
354
        </th>
355
        <td>
356
            <html:select onchange="alertPermissions()"  property="courseView.director.id">
357
                <html:option value="0">
358
                    <bean:message key="none"/>
359
                </html:option>
360
                <logic:present name="CourseForm" property="teachers">
361
                    <logic:iterate id="teacher" name="CourseForm" property="teachers" type="pt.estgp.estgweb.domain.views.UserView">
362
                        <html:option value="${teacher.id}">
363
                            (${teacher.code}) ${teacher.name}
364
                        </html:option>
365
                    </logic:iterate>
366
                </logic:present>
367
            </html:select>
1505 jmachado 368
        </td>
369
    </tr>
1506 jmachado 370
--%>
214 jmachado 371
 
1506 jmachado 372
 
373
 
374
 
375
 
376
 
1697 jmachado 377
    <script>
378
        function validate(form)
379
        {
380
            if(!$("#courseArea option:selected").length || $("#courseArea option:selected").val() == "")
381
            {
382
                alert("Tem de escolher um departamento para o Curso");
383
            }
384
            else
385
            {
386
                form.submit();
387
            }
388
        }
389
    </script>
390
    <button class="btn btn-success" type="button" onclick="set(this.form,'submit');validate(this.form)">
1506 jmachado 391
            <bean:message key="confirm"/>
392
    </button>
393
 
394
 
395
</div><!-- //panel-body-->
396
</div><!-- //panel panel-default-->
397
 
214 jmachado 398
</html:form>