Rev 1312 | Rev 1692 | 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 | });*/ |
||
749 | 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> |
||
112 | <tr> |
||
113 | <th> |
||
1400 | jmachado | 114 | Instituição |
115 | </th> |
||
116 | <td> |
||
117 | <html:select styleClass="form-control" property="courseUnitView.institutionCode"> |
||
118 | <option value="">Nenhum</option> |
||
119 | <html:option value="1">Escola Superior de Tecnologia e Gestão (3122)</html:option> |
||
120 | <html:option value="2">Escola Superior Agrária de Elvas (3123)</html:option> |
||
121 | <html:option value="3">Escola Superior de Educação (3121) </html:option> |
||
122 | <html:option value="4">Escola Superior de Saúde (7055)</html:option> |
||
123 | <html:option value="5">Escola Superior de Educação - Post. Graduação</html:option> |
||
124 | <html:option value="6">Instituto Politécnico de Portalegre (3120)</html:option> |
||
125 | </html:select> |
||
126 | |||
127 | </td> |
||
128 | </tr> |
||
129 | <tr> |
||
130 | <th> |
||
214 | jmachado | 131 | <bean:message key="courseunit.semestre"/> |
132 | </th> |
||
133 | <td> |
||
1133 | jmachado | 134 | <html:select onchange="alertFolders('semestre')" property="courseUnitView.semestre"> |
135 | <html:option value="S1"><bean:message key="courseunit.S1"/></html:option> |
||
136 | <html:option value="S2"><bean:message key="courseunit.S2"/></html:option> |
||
137 | <html:option value="A"><bean:message key="courseunit.A"/></html:option> |
||
138 | <html:option value="T1"><bean:message key="courseunit.T1"/></html:option> |
||
139 | <html:option value="T2"><bean:message key="courseunit.T2"/></html:option> |
||
140 | <html:option value="T3"><bean:message key="courseunit.T3"/></html:option> |
||
141 | <html:option value="T4"><bean:message key="courseunit.T4"/></html:option> |
||
214 | jmachado | 142 | </html:select> |
143 | </td> |
||
144 | </tr> |
||
145 | <tr> |
||
146 | <th> |
||
147 | <bean:message key="courseunit.importYear"/> |
||
148 | </th> |
||
149 | <td> |
||
1133 | jmachado | 150 | <html:select onchange="alertFolders('ano')" property="courseUnitView.importYear"> |
214 | jmachado | 151 | <logic:iterate id="item" name="CourseUnitsForm" property="importYears"> |
152 | <html:option value="${item}">${item}</html:option> |
||
153 | </logic:iterate> |
||
154 | </html:select> |
||
155 | </td> |
||
156 | </tr> |
||
1146 | jmachado | 157 | <tr> |
158 | <th> |
||
159 | <bean:message key="courseunit.turma"/> |
||
160 | </th> |
||
161 | <td> |
||
162 | <html:text styleClass="text" property="courseUnitView.cdTurma"/> (Esta ação vai influênciar as importações SIGES) |
||
163 | </td> |
||
164 | </tr> |
||
833 | jmachado | 165 | <tr> |
166 | <th> |
||
167 | <bean:message key="courseunit.pathIntranet"/> |
||
168 | </th> |
||
169 | <td> |
||
834 | jmachado | 170 | <html:text styleClass="text" readonly="true" property="courseUnitView.pathIntranet"/> (Para preencher gerar pastas nos serviços) |
833 | jmachado | 171 | </td> |
172 | </tr> |
||
749 | jmachado | 173 | |
214 | jmachado | 174 | <tr> |
175 | <th> |
||
749 | jmachado | 176 | <bean:message key="courseunit.responsable"/> |
177 | </th> |
||
178 | <td> |
||
1133 | jmachado | 179 | <html:select onchange="alertPermissions();" property="courseUnitView.responsableId"> |
751 | jmachado | 180 | <html:option value="0"></html:option> |
836 | jmachado | 181 | <logic:iterate id="teacher" name="CourseUnitsForm" property="teachers" type="pt.estgp.estgweb.domain.views.UserView"> |
749 | jmachado | 182 | <html:option value="${teacher.id}">(${teacher.code}) ${teacher.name}</html:option> |
183 | </logic:iterate> |
||
184 | </html:select> |
||
185 | </td> |
||
186 | </tr> |
||
187 | <tr> |
||
188 | <th> |
||
214 | jmachado | 189 | <bean:message key="courseunit.teachers"/> |
190 | </th> |
||
191 | <td> |
||
294 | jmachado | 192 | <logic:lessEqual value="0" name="CourseUnitView" property="id"> |
277 | jmachado | 193 | <i><bean:message key="courseunit.to.add.teachers.save.first"/></i> |
194 | </logic:lessEqual> |
||
195 | |||
294 | jmachado | 196 | <logic:greaterThan value="0" name="CourseUnitView" property="id"> |
277 | jmachado | 197 | <html:select property="teacherId"> |
198 | <logic:present name="CourseUnitsForm" property="teachers"> |
||
199 | <logic:iterate id="teacher" name="CourseUnitsForm" property="teachers" type="pt.estgp.estgweb.domain.views.UserView"> |
||
200 | <jomm:option itemName="teacher" itemProperty="id" comparableObjectName="CourseUnitsForm" |
||
201 | comparableObjectProperty="teacherId"> |
||
202 | (${teacher.code}) ${teacher.name} |
||
203 | </jomm:option> |
||
204 | </logic:iterate> |
||
205 | <input type="button" value="<bean:message key="add"/>" |
||
1133 | jmachado | 206 | onclick="alertPermissions();set(this.form,'addTeacher');this.form.submit();"> |
277 | jmachado | 207 | </logic:present> |
208 | </html:select> |
||
209 | <logic:greaterThan name="CourseUnitView" property="teachersSize" value="0"> |
||
210 | <table class="dataTable removeButton"> |
||
211 | <logic:iterate id="userView" name="CourseUnitView" property="teachers" type="pt.estgp.estgweb.domain.views.UserView"> |
||
212 | <tr> |
||
213 | <th> |
||
214 | ${userView.code} |
||
215 | </th> |
||
216 | <th> |
||
217 | ${userView.name} |
||
218 | </th> |
||
219 | <td><input type="button" class="removeButton" |
||
220 | onclick="CourseUnitsForm.id.value='${userView.id}';set(this.form,'removeTeacher');this.form.submit();"> |
||
221 | </td> |
||
222 | </tr> |
||
223 | </logic:iterate> |
||
224 | </table> |
||
225 | </logic:greaterThan> |
||
214 | jmachado | 226 | </logic:greaterThan> |
227 | </td> |
||
228 | </tr> |
||
276 | jmachado | 229 | |
214 | jmachado | 230 | <tr> |
231 | <th> |
||
232 | <bean:message key="courseunit.students"/> |
||
233 | </th> |
||
234 | <td> |
||
276 | jmachado | 235 | |
294 | jmachado | 236 | <logic:lessEqual value="0" name="CourseUnitView" property="id"> |
1312 | jmachado | 237 | <i><bean:message key="courseunit.to.add.students.save.first"/></i><br/> |
276 | jmachado | 238 | </logic:lessEqual> |
239 | |||
1312 | jmachado | 240 | |
294 | jmachado | 241 | <logic:greaterThan value="0" name="CourseUnitView" property="id"> |
1312 | jmachado | 242 | Código SIGES |
243 | <html:text style="width: 150px" property="studentCode"/> |
||
244 | Turma: |
||
245 | <% |
||
246 | AbstractDao.getCurrentSession().beginTransaction(); |
||
247 | CourseUnit unit = DaoFactory.getCourseUnitDaoImpl().load(CourseUnitView.getId()); |
||
248 | if(unit.getTurmas() != null) |
||
249 | { |
||
250 | %> |
||
251 | <html:select property="choosedTurma"> |
||
252 | <option value="">Escolha Turma ou crie uma nova</option> |
||
253 | <% |
||
254 | for(CourseUnitTurma turma: unit.getTurmas()) |
||
255 | { |
||
256 | request.setAttribute("turma",turma.getTurma()); |
||
257 | %> |
||
258 | <html:option value="${turma}">${turma}</html:option> |
||
259 | <% |
||
260 | } |
||
261 | %> |
||
262 | </html:select> |
||
263 | <% |
||
264 | |||
265 | } |
||
266 | AbstractDao.getCurrentSession().getTransaction().commit(); |
||
267 | %> |
||
268 | <html:text style="width: 150px" property="newChoosedTurma"/> |
||
276 | jmachado | 269 | <input type="button" value="<bean:message key="add"/>" |
1133 | jmachado | 270 | 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 | 271 | |
276 | jmachado | 272 | <logic:greaterThan name="CourseUnitView" property="studentsSize" value="0"> |
837 | jmachado | 273 | |
274 | <table id="myTable" class="tablesorter dataTable removeButton"> |
||
275 | <thead> |
||
276 | <tr> |
||
277 | <th>Código Siges</th> |
||
278 | <th>Username</th> |
||
279 | <th>Nome</th> |
||
280 | <th>Email</th> |
||
1312 | jmachado | 281 | <th>Telefone</th> |
282 | <th class="icons"></th> |
||
837 | jmachado | 283 | </tr> |
284 | </thead> |
||
285 | <tbody> |
||
748 | jmachado | 286 | <logic:iterate id="userView" name="CourseUnitView" property="studentsOrderedByNumber" type="pt.estgp.estgweb.domain.views.UserView"> |
276 | jmachado | 287 | <tr> |
837 | jmachado | 288 | <td> |
276 | jmachado | 289 | ${userView.code} |
837 | jmachado | 290 | </td> |
291 | <td> |
||
276 | jmachado | 292 | ${userView.username} |
837 | jmachado | 293 | </td> |
294 | <td> |
||
276 | jmachado | 295 | ${userView.name} |
837 | jmachado | 296 | </td> |
297 | <td> |
||
276 | jmachado | 298 | ${userView.email} |
837 | jmachado | 299 | </td> |
300 | <td> |
||
301 | ${userView.phonenumber} |
||
302 | </td> |
||
1312 | jmachado | 303 | <td><button type="button" class="btn btn-danger" |
276 | jmachado | 304 | onclick="CourseUnitsForm.id.value='${userView.code}';set(this.form,'removeStudent');this.form.submit();"> |
1312 | jmachado | 305 | <span class="glyphicon glyphicon-remove"/> |
306 | </button> |
||
276 | jmachado | 307 | </td> |
308 | </tr> |
||
309 | </logic:iterate> |
||
837 | jmachado | 310 | </tbody> |
276 | jmachado | 311 | </table> |
312 | </logic:greaterThan> |
||
214 | jmachado | 313 | </logic:greaterThan> |
314 | </td> |
||
315 | </tr> |
||
206 | jmachado | 316 | |
276 | jmachado | 317 | |
214 | jmachado | 318 | </table> |
319 | <input type="button" onclick="set(form,'createOrUpdateAdmin');form.submit()" value="<bean:message key="confirm"/>"> |
||
206 | jmachado | 320 | </html:form> |