Subversion Repositories bacoAlunos

Rev

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

Rev Author Line No. Line
1312 jmachado 1
<%@ page import="jomm.dao.impl.AbstractDao" %>
2
<%@ page import="pt.estgp.estgweb.domain.CourseUnit" %>
3
<%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %>
749 jmachado 4
<%@ page import="pt.estgp.estgweb.domain.views.CourseView" %>
5
<%@ page import="pt.estgp.estgweb.web.utils.RequestUtils" %>
214 jmachado 6
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.IServiceManager" %>
749 jmachado 7
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.ServiceManager" %>
214 jmachado 8
<%@ page import="java.util.List" %>
1312 jmachado 9
<%@ page import="pt.estgp.estgweb.domain.CourseUnitTurma" %>
206 jmachado 10
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
11
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
12
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
13
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
14
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
15
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
16
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
17
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
1133 jmachado 18
<script>
19
    function alertPermissions()
20
    {
21
        alert("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")
22
    }
23
    function alertFolders(place)
24
    {
25
        alert("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.");
26
    }
27
 
28
</script>
214 jmachado 29
<%
30
    IServiceManager sm = ServiceManager.getInstance();
31
    String[] names = new String[]{};
32
    Object[] args = new Object[]{};
33
    List<CourseView> courseViews = (List<CourseView>) sm.execute(RequestUtils.getRequester(request, response), "LoadCourses", args, names);
34
    request.setAttribute("Courses", courseViews);
749 jmachado 35
 
36
    List<pt.estgp.estgweb.domain.views.UserView> teachers =(List<pt.estgp.estgweb.domain.views.UserView>)  sm.execute(RequestUtils.getRequester(request, response), "LoadTeachers", args, names);
833 jmachado 37
    /*Collections.sort(teachers,new Comparator<pt.estgp.estgweb.domain.views.UserView>(){
38
 
39
        @Override
40
        public int compare(pt.estgp.estgweb.domain.views.UserView o1, pt.estgp.estgweb.domain.views.UserView o2) {
41
            if(o1.getName()!=null && o2.getName() != null)
42
                return o1.getName().compareTo(o2.getName());
43
            if(o1.getName()==null)
44
                return 1;
45
            return -1;
46
        }
47
 
48
    });*/
1805 jmachado 49
    request.setAttribute("teachers", teachers);
214 jmachado 50
%>
215 jmachado 51
 
206 jmachado 52
<jsp:useBean id="CourseUnitView" type="pt.estgp.estgweb.domain.views.CourseUnitView" scope="request"/>
53
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/>
214 jmachado 54
<html:errors/>
55
<jomm:messages/>
749 jmachado 56
 
57
<ul>
58
    <li><html:link action="/user/startLoadCourseUnitFromHome.do?id=${CourseUnitView.id}">Página da Unidade</html:link></li>
1312 jmachado 59
    <li><html:link action="/user/startLoadCourseUnitProgram.do?courseUnitId=${CourseUnitView.id}">Ficha Curricular</html:link></li>
749 jmachado 60
</ul>
1171 jmachado 61
<%
62
String fromAction = "";
63
String from = "";
64
String user = "";
65
if (request.getParameter("from") != null)
66
{
67
    user = "/user";
68
    fromAction = "From" + request.getParameter("from");
69
    from = "?from=" + request.getParameter("from");
70
}
71
request.setAttribute("from", from);
72
request.setAttribute("user", user);
73
request.setAttribute("fromAction", fromAction);
74
%>
75
 
76
<html:form styleClass="form" action="${user}/courseUnitControllerAdmin${fromAction}${from}" enctype="multipart/form-data">
1173 jmachado 77
 
1171 jmachado 78
<%--<html:form styleClass="form" action="/user/courseUnitControllerAdminFromServiceZone" enctype="multipart/form-data">--%>
1173 jmachado 79
 
214 jmachado 80
<input type="hidden" name="dispatch" value="createOrUpdateAdmin">
81
<html:hidden property="courseUnitView.id"/>
82
<html:hidden property="id"/>
83
<table>
84
<tr>
85
    <th>
86
        <bean:message key="courseunit.name"/>
87
    </th>
88
    <td>
89
        <html:text styleClass="text" property="courseUnitView.name"/>
90
    </td>
91
</tr>
92
<tr>
93
    <th>
94
        <bean:message key="courseunit.course"/>
95
    </th>
96
    <td>
1133 jmachado 97
        <html:select onchange="alertFolders('curso')" property="courseUnitView.courseId">
214 jmachado 98
            <logic:iterate id="course" name="Courses" type="pt.estgp.estgweb.domain.views.CourseView">
99
                <html:option value="${course.id}">(${course.code}) ${course.name}</html:option>
100
            </logic:iterate>
101
        </html:select>
102
    </td>
103
</tr>
104
<tr>
105
    <th>
106
        <bean:message key="courseunit.code"/>
107
    </th>
108
    <td>
109
        <html:text styleClass="text" property="courseUnitView.code"/>
110
    </td>
111
</tr>
1400 jmachado 112
 
113
<tr>
114
    <th>
214 jmachado 115
        <bean:message key="courseunit.semestre"/>
116
    </th>
117
    <td>
1133 jmachado 118
        <html:select onchange="alertFolders('semestre')" property="courseUnitView.semestre">
119
            <html:option value="S1"><bean:message key="courseunit.S1"/></html:option>
120
            <html:option value="S2"><bean:message key="courseunit.S2"/></html:option>
121
            <html:option value="A"><bean:message key="courseunit.A"/></html:option>
122
            <html:option value="T1"><bean:message key="courseunit.T1"/></html:option>
123
            <html:option value="T2"><bean:message key="courseunit.T2"/></html:option>
124
            <html:option value="T3"><bean:message key="courseunit.T3"/></html:option>
125
            <html:option value="T4"><bean:message key="courseunit.T4"/></html:option>
214 jmachado 126
        </html:select>
127
    </td>
128
</tr>
129
<tr>
130
    <th>
131
        <bean:message key="courseunit.importYear"/>
132
    </th>
133
    <td>
1133 jmachado 134
        <html:select onchange="alertFolders('ano')" property="courseUnitView.importYear">
214 jmachado 135
            <logic:iterate id="item" name="CourseUnitsForm" property="importYears">
136
                <html:option value="${item}">${item}</html:option>
137
            </logic:iterate>
138
        </html:select>
139
    </td>
140
</tr>
1146 jmachado 141
    <tr>
142
        <th>
143
            <bean:message key="courseunit.turma"/>
144
        </th>
145
        <td>
146
            <html:text styleClass="text" property="courseUnitView.cdTurma"/> (Esta ação vai influênciar as importações SIGES)
147
        </td>
148
    </tr>
833 jmachado 149
<tr>
150
    <th>
151
        <bean:message key="courseunit.pathIntranet"/>
152
    </th>
153
    <td>
834 jmachado 154
        <html:text styleClass="text" readonly="true" property="courseUnitView.pathIntranet"/> (Para preencher gerar pastas nos serviços)
833 jmachado 155
    </td>
156
</tr>
749 jmachado 157
 
214 jmachado 158
<tr>
159
    <th>
749 jmachado 160
        <bean:message key="courseunit.responsable"/>
161
    </th>
162
    <td>
1133 jmachado 163
        <html:select onchange="alertPermissions();" property="courseUnitView.responsableId">
751 jmachado 164
            <html:option value="0"></html:option>
1805 jmachado 165
            <logic:iterate id="teacher" name="teachers" type="pt.estgp.estgweb.domain.views.UserView" scope="request">
749 jmachado 166
                <html:option value="${teacher.id}">(${teacher.code}) ${teacher.name}</html:option>
167
            </logic:iterate>
168
        </html:select>
169
    </td>
170
</tr>
171
<tr>
172
    <th>
214 jmachado 173
        <bean:message key="courseunit.teachers"/>
174
    </th>
175
    <td>
294 jmachado 176
        <logic:lessEqual value="0" name="CourseUnitView" property="id">
277 jmachado 177
            <i><bean:message key="courseunit.to.add.teachers.save.first"/></i>
178
        </logic:lessEqual>
179
 
294 jmachado 180
        <logic:greaterThan value="0" name="CourseUnitView" property="id">
277 jmachado 181
            <html:select property="teacherId">
1805 jmachado 182
                <logic:present name="teachers" scope="request">
183
                    <logic:iterate id="teacher" name="teachers" type="pt.estgp.estgweb.domain.views.UserView" scope="request">
277 jmachado 184
                        <jomm:option itemName="teacher" itemProperty="id" comparableObjectName="CourseUnitsForm"
185
                                     comparableObjectProperty="teacherId">
186
                            (${teacher.code}) ${teacher.name}
187
                        </jomm:option>
188
                    </logic:iterate>
189
                    <input type="button" value="<bean:message key="add"/>"
1133 jmachado 190
                           onclick="alertPermissions();set(this.form,'addTeacher');this.form.submit();">
277 jmachado 191
                </logic:present>
192
            </html:select>
193
            <logic:greaterThan name="CourseUnitView" property="teachersSize" value="0">
194
                <table class="dataTable removeButton">
1805 jmachado 195
                    <logic:iterate id="userView" name="teachers" type="pt.estgp.estgweb.domain.views.UserView" scope="request">
277 jmachado 196
                        <tr>
197
                            <th>
198
                                    ${userView.code}
199
                            </th>
200
                            <th>
201
                                    ${userView.name}
202
                            </th>
203
                            <td><input type="button" class="removeButton"
204
                                       onclick="CourseUnitsForm.id.value='${userView.id}';set(this.form,'removeTeacher');this.form.submit();">
205
                            </td>
206
                        </tr>
207
                    </logic:iterate>
208
                </table>
209
            </logic:greaterThan>
214 jmachado 210
        </logic:greaterThan>
211
    </td>
212
</tr>
276 jmachado 213
 
214 jmachado 214
<tr>
215
    <th>
216
        <bean:message key="courseunit.students"/>
217
    </th>
218
    <td>
276 jmachado 219
 
294 jmachado 220
        <logic:lessEqual value="0" name="CourseUnitView" property="id">
1312 jmachado 221
            <i><bean:message key="courseunit.to.add.students.save.first"/></i><br/>
276 jmachado 222
        </logic:lessEqual>
223
 
1312 jmachado 224
 
294 jmachado 225
        <logic:greaterThan value="0" name="CourseUnitView" property="id">
1312 jmachado 226
            Código SIGES
227
            <html:text style="width: 150px" property="studentCode"/>
228
            Turma:
229
            <%
230
                AbstractDao.getCurrentSession().beginTransaction();
231
                CourseUnit unit = DaoFactory.getCourseUnitDaoImpl().load(CourseUnitView.getId());
232
                if(unit.getTurmas() != null)
233
                {
234
            %>
235
                <html:select property="choosedTurma">
236
                    <option value="">Escolha Turma ou crie uma nova</option>
237
            <%
238
                    for(CourseUnitTurma turma: unit.getTurmas())
239
                    {
240
                        request.setAttribute("turma",turma.getTurma());
241
            %>
242
                    <html:option value="${turma}">${turma}</html:option>
243
            <%
244
                    }
245
            %>
246
                </html:select>
247
            <%
248
 
249
                }
250
                AbstractDao.getCurrentSession().getTransaction().commit();
251
            %>
252
            <html:text style="width: 150px" property="newChoosedTurma"/>
276 jmachado 253
            <input type="button" value="<bean:message key="add"/>"
1133 jmachado 254
                   onclick="if(this.form.studentCode.value=='0' || this.form.studentCode.value==''){alert('Por favor coloque o numero de aluno antes de adicionar');}else{alertPermissions();set(this.form,'addStudent');this.form.submit();}">
1312 jmachado 255
 
276 jmachado 256
            <logic:greaterThan name="CourseUnitView" property="studentsSize" value="0">
837 jmachado 257
 
258
                <table id="myTable" class="tablesorter dataTable removeButton">
259
                    <thead>
260
                        <tr>
261
                            <th>Código Siges</th>
262
                            <th>Username</th>
263
                            <th>Nome</th>
264
                            <th>Email</th>
1312 jmachado 265
                            <th>Telefone</th>
266
                            <th class="icons"></th>
837 jmachado 267
                        </tr>
268
                     </thead>
269
                    <tbody>
748 jmachado 270
                    <logic:iterate id="userView" name="CourseUnitView" property="studentsOrderedByNumber" type="pt.estgp.estgweb.domain.views.UserView">
276 jmachado 271
                        <tr>
837 jmachado 272
                            <td>
276 jmachado 273
                                    ${userView.code}
837 jmachado 274
                            </td>
275
                            <td>
276 jmachado 276
                                    ${userView.username}
837 jmachado 277
                            </td>
278
                            <td>
276 jmachado 279
                                    ${userView.name}
837 jmachado 280
                            </td>
281
                            <td>
276 jmachado 282
                                    ${userView.email}
837 jmachado 283
                            </td>
284
                            <td>
285
                                    ${userView.phonenumber}
286
                            </td>
1312 jmachado 287
                            <td><button type="button" class="btn btn-danger"
276 jmachado 288
                                       onclick="CourseUnitsForm.id.value='${userView.code}';set(this.form,'removeStudent');this.form.submit();">
1312 jmachado 289
                                <span class="glyphicon glyphicon-remove"/>
290
                                </button>
276 jmachado 291
                            </td>
292
                        </tr>
293
                    </logic:iterate>
837 jmachado 294
                    </tbody>
276 jmachado 295
                </table>
296
            </logic:greaterThan>
214 jmachado 297
        </logic:greaterThan>
298
    </td>
299
</tr>
206 jmachado 300
 
276 jmachado 301
 
214 jmachado 302
</table>
303
<input type="button" onclick="set(form,'createOrUpdateAdmin');form.submit()" value="<bean:message key="confirm"/>">
206 jmachado 304
</html:form>