Rev 1814 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
208 | jmachado | 1 | <%@ page import="pt.estgp.estgweb.domain.views.BlogView" %> |
457 | jmachado | 2 | <%@ page import="pt.utl.ist.berserk.logic.serviceManager.IServiceManager" %> |
3 | <%@ page import="pt.utl.ist.berserk.logic.serviceManager.ServiceManager" %> |
||
4 | <%@ page import="pt.estgp.estgweb.web.utils.RequestUtils" %> |
||
5 | <%@ page import="java.util.List" %> |
||
6 | <%@ page import="pt.estgp.estgweb.utils.DatesUtils" %> |
||
489 | jmachado | 7 | <%@ page import="pt.estgp.estgweb.domain.enums.CourseUnitContentsGrants" %> |
8 | <%@ page import="pt.estgp.estgweb.web.UserSessionProxy" %> |
||
1814 | jmachado | 9 | <%@ page import="pt.estgp.estgweb.utils.Globals" %> |
926 | jmachado | 10 | <%@ page import="pt.estgp.estgweb.utils.ConfigManager" %> |
995 | jmachado | 11 | <%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %> |
1077 | jmachado | 12 | <%@ page import="pt.estgp.estgweb.domain.views.CourseUnitView" %> |
1814 | jmachado | 13 | <%@ page import="pt.estgp.estgweb.domain.*" %> |
14 | <%@ page import="jomm.dao.impl.AbstractDao" %> |
||
203 | jmachado | 15 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> |
208 | jmachado | 16 | <%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %> |
17 | <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %> |
||
18 | <%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %> |
||
19 | <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %> |
||
20 | <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> |
||
21 | <%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %> |
||
1077 | jmachado | 22 | <jsp:useBean id="CourseUnitView" type="pt.estgp.estgweb.domain.views.CourseUnitView" scope="request"/> |
1312 | jmachado | 23 | <baco:initCourseUnitEvaluationClearances name="CourseUnitView"/> |
1101 | jmachado | 24 | <% |
25 | UserSession userSession = UserSessionProxy.loadUserSessionFromRequest(request); |
||
26 | if(userSession == null) |
||
27 | request.setAttribute("UserSession",new UserSessionImpl()); |
||
28 | %> |
||
1077 | jmachado | 29 | <jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/> |
30 | <% |
||
901 | jmachado | 31 | |
32 | try{ |
||
1312 | jmachado | 33 | if (request.getAttribute("BlogView") != null) |
34 | { |
||
35 | BlogView bV = (BlogView) request.getAttribute("BlogView"); |
||
36 | request.setAttribute("CourseUnitView",bV.getCourseUnitView()); |
||
37 | } |
||
1077 | jmachado | 38 | |
1312 | jmachado | 39 | boolean activePeriod = |
40 | DaoFactory.getConfigurationDaoImpl().isCourseUniEvaluationActivePeriodInTransaction(CourseUnitView.getId()); |
||
214 | jmachado | 41 | |
1312 | jmachado | 42 | CourseUnitView.getId(); |
214 | jmachado | 43 | |
1312 | jmachado | 44 | %> |
214 | jmachado | 45 | |
46 | |||
47 | |||
1312 | jmachado | 48 | <% |
49 | String fromAction = ""; |
||
50 | String user = ""; |
||
51 | if (request.getParameter("from") != null) |
||
52 | { |
||
53 | user = "/user"; |
||
54 | fromAction = "From" + request.getParameter("from"); |
||
55 | if(request.getParameter("from").equals("CourseUnit")) |
||
56 | { |
||
57 | fromAction = "FromHome"; |
||
58 | } |
||
59 | } |
||
60 | request.setAttribute("user", user); |
||
61 | request.setAttribute("fromAction", fromAction); |
||
62 | %> |
||
1077 | jmachado | 63 | |
1312 | jmachado | 64 | <style> |
65 | .nav-menu li |
||
66 | { |
||
67 | padding-left: 0; |
||
68 | margin-left: 0; |
||
69 | padding-bottom: 0; |
||
214 | jmachado | 70 | |
1312 | jmachado | 71 | } |
72 | </style> |
||
214 | jmachado | 73 | |
1312 | jmachado | 74 | <nav class="navbar navbar-default" role="navigation"> |
881 | jmachado | 75 | |
1312 | jmachado | 76 | <div class="navbar-header" style="padding-right: 15px;"> |
77 | <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#menuUnit"> |
||
78 | <span class="icon-bar"></span> |
||
79 | <span class="icon-bar"></span> |
||
80 | <span class="icon-bar"></span> |
||
81 | </button> |
||
82 | </div> |
||
898 | jmachado | 83 | |
1312 | jmachado | 84 | <div class="collapse navbar-collapse" id="menuUnit"> |
1022 | jmachado | 85 | |
1312 | jmachado | 86 | |
87 | <ul class="nav nav-stacked"> |
||
88 | <li><html:link action="${user}/startLoadCourseUnit${fromAction}?courseUnitView.id=${CourseUnitView.id}"><span class="glyphicon glyphicon-home"></span> <bean:message key="courseunit.menu.home"/></html:link></li> |
||
1479 | jmachado | 89 | |
90 | |||
91 | <baco:isTeacherOfCourseUnit courseUnitId="${CourseUnitView.id}"> |
||
92 | <baco:hasNotRole role="services"> |
||
93 | <li> |
||
94 | <li> |
||
95 | <html:link action="/user/startSubmitAnnouncementFromCourseUnit?announcementView.courseUnitView.id=${CourseUnitView.id}"><span class="icon icon-bubble2"></span> <bean:message key="courseunit.menu.put.announcement"/></html:link> |
||
96 | </li> |
||
97 | </baco:hasNotRole> |
||
98 | </baco:isTeacherOfCourseUnit> |
||
99 | |||
100 | <baco:hasRole role="services"> |
||
101 | <li> |
||
102 | <html:link action="/user/startSubmitAnnouncementFromCourseUnit?announcementView.courseUnitView.id=${CourseUnitView.id}"><span class="icon icon-bubble2"></span> <bean:message key="courseunit.menu.put.announcement"/></html:link> |
||
103 | </li> |
||
104 | </baco:hasRole> |
||
105 | |||
106 | |||
107 | |||
108 | |||
109 | <baco:clearOperation name="CourseUnitView" property="courseUnit" op="PROGRAM_EDIT_PROGRAM"> |
||
110 | <li> |
||
111 | <html:link action="/user/startLoadCourseUnitProgram?courseUnitId=${CourseUnitView.id}"><span class="icon icon-library"></span> <bean:message key="edit"/> <bean:message key="courseunit.programfilepath"/></html:link> |
||
112 | </li> |
||
113 | </baco:clearOperation> |
||
114 | |||
1312 | jmachado | 115 | <baco:clearOperation name="CourseUnitView" property="courseUnit" op="EVALUATION_EDITION"> |
116 | <li> |
||
117 | <html:link action="/user/startLoadCourseUnitEvaluation.do?courseUnitId=${CourseUnitView.id}"> |
||
1479 | jmachado | 118 | <span class="glyphicon glyphicon-flag"></span> |
1312 | jmachado | 119 | <bean:message key="edit"/> <bean:message key="courseunit.menu.evaluation"/> |
120 | |||
121 | <% |
||
122 | if(activePeriod && !CourseUnitView.isValidEvaluation()) |
||
123 | { |
||
1529 | jmachado | 124 | if(CourseUnitView.isValidationEvaluation()) |
125 | { |
||
1312 | jmachado | 126 | %> |
1529 | jmachado | 127 | <img src="<%=request.getContextPath()%>/imgs/check.gif" width="35px"/> |
128 | <% |
||
129 | } |
||
130 | else |
||
131 | { |
||
132 | %> |
||
1531 | jmachado | 133 | <img src="<%=request.getContextPath()%>/imgs/preencher2.gif" width="35px"/> |
1312 | jmachado | 134 | <% |
1529 | jmachado | 135 | } |
1312 | jmachado | 136 | } |
1531 | jmachado | 137 | else if(CourseUnitView.isValidEvaluation()) |
1529 | jmachado | 138 | { |
1312 | jmachado | 139 | %> |
1529 | jmachado | 140 | <span class="glyphicon glyphicon-ok"></span> |
141 | <% |
||
142 | } |
||
143 | %> |
||
1312 | jmachado | 144 | </html:link> |
145 | </li> |
||
146 | </baco:clearOperation> |
||
147 | |||
148 | |||
149 | <baco:isAuthenticated> |
||
1830 | jmachado | 150 | <%-- |
1312 | jmachado | 151 | <baco:isInCourseUnit courseUnitId="${CourseUnitView.id}"> |
152 | <li> |
||
1479 | jmachado | 153 | <a href="<%=request.getContextPath()%>/user/startLoadCourseUnitWorksFromHome.do?courseUnitView.id=${CourseUnitView.id}"><span class="icon icon-clipboard"></span> <bean:message key="courseunit.menu.assignements"/></a> |
1312 | jmachado | 154 | </li> |
1830 | jmachado | 155 | </baco:isInCourseUnit>--%> |
1814 | jmachado | 156 | <% |
157 | AbstractDao.getCurrentSession().beginTransaction(); |
||
158 | CourseUnitImpl cuImplPersistent = (CourseUnitImpl) DaoFactory.getCourseUnitDaoImpl().get(CourseUnitView.getId()); |
||
159 | |||
160 | pt.estgp.estgweb.domain.UserSession uS = DaoFactory.getUserSessionDaoImpl().load(UserSession.getCookie()); |
||
161 | boolean isFromCourseUnitCommission = cuImplPersistent.isFromCourseUnitCommission(uS); |
||
162 | if(isFromCourseUnitCommission) |
||
163 | { |
||
164 | %> |
||
165 | <li> |
||
166 | <a href="<%=request.getContextPath()%>/user/startLoadCourseUnitWorksFromHome.do?courseUnitView.id=${CourseUnitView.id}"><span class="icon icon-clipboard"></span> <bean:message key="courseunit.menu.assignements"/></a> |
||
167 | </li> |
||
168 | <% |
||
169 | } |
||
170 | AbstractDao.getCurrentSession().getTransaction().commit(); |
||
171 | %> |
||
1312 | jmachado | 172 | </baco:isAuthenticated> |
173 | |||
1479 | jmachado | 174 | <baco:clearOperation name="CourseUnitView" property="courseUnit" op="STATISTICS_CAN_VIEW"> |
175 | <li> |
||
176 | <html:link action="/user/startLoadCourseUnitStatsFromHome?courseUnitView.id=${CourseUnitView.id}"><span class="glyphicon glyphicon-stats"></span> <bean:message key="course.unit.stats"/></html:link> |
||
177 | </li> |
||
178 | </baco:clearOperation> |
||
179 | |||
180 | |||
181 | |||
182 | |||
1312 | jmachado | 183 | <baco:isAuthenticated> |
184 | <li> |
||
1479 | jmachado | 185 | <html:link action="/user/startCourseUnitBlogFromHome?courseUnitView.id=${CourseUnitView.id}"><span class="icon icon-bubbles"></span> <bean:message key="courseunit.menu.blog"/></html:link> |
1312 | jmachado | 186 | </li> |
187 | <li> |
||
1479 | jmachado | 188 | <html:link action="/user/startLoadCourseUnitStudentsFromHome?courseUnitView.id=${CourseUnitView.id}"><span class="icon icon-users"></span> <bean:message key="courseunit.students"/></html:link> |
1312 | jmachado | 189 | </li> |
190 | |||
191 | </baco:isAuthenticated> |
||
192 | |||
193 | |||
194 | <baco:isAuthenticated> |
||
195 | |||
196 | <li> |
||
197 | <a class="dropdown-toggle" data-toggle="dropdown" href="#"><span class="glyphicon glyphicon-folder-open"></span> <bean:message key="courseunit.menu.files"/><span class="caret"></span></a> |
||
198 | |||
199 | |||
200 | <ul class="dropdown-menu"> |
||
201 | |||
1022 | jmachado | 202 | <% |
1312 | jmachado | 203 | |
204 | CourseUnitContentsGrants contentsGrants = CourseUnitContentsGrants.parse(CourseUnitView.getContentsGrants()); |
||
205 | |||
206 | if ( userSession.getUser().isSuperuserOrAdmin() || |
||
207 | userSession.getUser().hasRole("services") || |
||
208 | contentsGrants == CourseUnitContentsGrants.PUBLIC || |
||
209 | (contentsGrants == CourseUnitContentsGrants.INTERNAL && UserSessionProxy.isAuthenticated(request)) || |
||
210 | (contentsGrants == CourseUnitContentsGrants.PRIVATE && UserSessionProxy.isAuthenticated(request) && |
||
1782 | jmachado | 211 | (((UserImpl) ((userSession.getUser()))).checkIsTeacherOfCourseUnit(CourseUnitView.getId()) || |
212 | ((UserImpl) ((userSession.getUser()))).checkIsStudentfCourseUnit(CourseUnitView.getId())))) |
||
1022 | jmachado | 213 | { |
214 | %> |
||
1312 | jmachado | 215 | <li> |
216 | <html:link action="/user/startLoadCourseUnitRootFromHome?courseUnitView.id=${CourseUnitView.id}"><span class="glyphicon glyphicon-folder-open"></span> Pasta Cadeira</html:link> |
||
217 | </li> |
||
218 | <li> |
||
219 | <html:link action="/user/startLoadCourseUnitContentsFromHome?courseUnitView.id=${CourseUnitView.id}"> <span class="glyphicon glyphicon-folder-open"></span> <bean:message key="courseunit.menu.contents"/></html:link> |
||
220 | </li> |
||
1022 | jmachado | 221 | <% |
1312 | jmachado | 222 | if(Integer.parseInt(CourseUnitView.getImportYear()) < Integer.parseInt("201516")) |
223 | { |
||
224 | %> |
||
225 | <li> |
||
226 | <html:link action="/user/startLoadCourseUnitPresencesFromHome?courseUnitView.id=${CourseUnitView.id}"> <span class="glyphicon glyphicon-folder-open"></span> <bean:message key="courseunit.menu.presences"/></html:link> |
||
227 | </li> |
||
228 | <li> |
||
229 | <html:link action="/user/startLoadCourseUnitGradesFromHome?courseUnitView.id=${CourseUnitView.id}"> <span class="glyphicon glyphicon-folder-open"></span> <bean:message key="courseunit.menu.grades"/></html:link> |
||
230 | </li> |
||
231 | <% |
||
1022 | jmachado | 232 | } |
233 | %> |
||
1312 | jmachado | 234 | <li> |
235 | <html:link action="/user/startLoadCourseUnitDtpFromHome?courseUnitView.id=${CourseUnitView.id}"> <span class="glyphicon glyphicon-folder-open"></span> <bean:message key="courseunit.menu.dtp"/></html:link> |
||
236 | </li> |
||
237 | <% |
||
238 | } |
||
239 | %> |
||
240 | </ul> |
||
241 | </li> |
||
242 | </baco:isAuthenticated> |
||
898 | jmachado | 243 | |
214 | jmachado | 244 | |
245 | |||
1312 | jmachado | 246 | <% |
214 | jmachado | 247 | |
208 | jmachado | 248 | |
1312 | jmachado | 249 | IServiceManager sm = ServiceManager.getInstance(); |
1102 | jmachado | 250 | |
1312 | jmachado | 251 | String[] names = new String[]{}; |
252 | Object[] args = new Object[]{CourseUnitView.getCode(), CourseUnitView.getCourseCode()}; |
||
253 | |||
254 | pt.estgp.estgweb.domain.views.CourseUnitView courseUnitViewInEvaluation = (pt.estgp.estgweb.domain.views.CourseUnitView) sm.execute(RequestUtils.getRequester(request, response), "LoadCourseUnitInEvaluationBySigesCodes", args, names); |
||
255 | |||
256 | |||
257 | names = new String[]{}; |
||
258 | args = new Object[]{CourseUnitView.getCode(), CourseUnitView.getCourseCode()}; |
||
259 | |||
260 | List<pt.estgp.estgweb.domain.views.CourseUnitView> courseUnitViews = (List<pt.estgp.estgweb.domain.views.CourseUnitView>) sm.execute(RequestUtils.getRequester(request, response), "LoadCourseUnitsBySigesCodes", args, names); |
||
261 | if(courseUnitViews.size() > 1) |
||
262 | { |
||
263 | request.setAttribute("OldUnits",courseUnitViews); |
||
264 | } |
||
265 | %> |
||
266 | <logic:present name="OldUnits"> |
||
267 | <%-- <div class="linkMenuBlock"> |
||
268 | <div class="linkMenuBlockTitle"> |
||
926 | jmachado | 269 | <% |
1312 | jmachado | 270 | if (CourseUnitView.getImportYear().equals(DaoFactory.getConfigurationDaoImpl().getInterfaceImportYearCreateTransaction())) |
926 | jmachado | 271 | { |
272 | %> |
||
1312 | jmachado | 273 | <bean:message key="courseunit.menu.unit.old.units"/> |
926 | jmachado | 274 | <% |
1312 | jmachado | 275 | }else{ |
276 | %> |
||
277 | <bean:message key="courseunit.menu.unit.other.units"/> |
||
278 | <% |
||
926 | jmachado | 279 | } |
280 | %> |
||
1312 | jmachado | 281 | </div> |
489 | jmachado | 282 | <% |
1312 | jmachado | 283 | |
489 | jmachado | 284 | %> |
1312 | jmachado | 285 | <div class="linkLeftMenu"> |
286 | <div class="listClean"> |
||
287 | <ul>--%> |
||
288 | <li> |
||
289 | <a class="dropdown-toggle" data-toggle="dropdown" href="#"><span class="glyphicon glyphicon-folder-open"></span> <bean:message key="courseunit.menu.unit.old.units"/><span class="caret"></span> |
||
290 | <% |
||
291 | if(courseUnitViewInEvaluation !=null && courseUnitViewInEvaluation.getId()!=CourseUnitView.getId()) |
||
292 | { |
||
293 | %> |
||
1533 | jmachado | 294 | <img src="<%=request.getContextPath()%>/imgs/preencher2.gif" width="35px"/> |
1312 | jmachado | 295 | <% |
296 | } |
||
297 | %> |
||
298 | </a> |
||
457 | jmachado | 299 | |
300 | |||
1312 | jmachado | 301 | <ul class="dropdown-menu"> |
302 | <logic:iterate id="item" name="OldUnits" type="pt.estgp.estgweb.domain.views.CourseUnitView"> |
||
303 | <li> |
||
304 | <logic:equal value="${CourseUnitView.id}" name="item" property="id"> |
||
305 | <a href="#">${item.importYear}</a> |
||
306 | </logic:equal> |
||
307 | <logic:notEqual value="${CourseUnitView.id}" name="item" property="id"> |
||
1074 | jmachado | 308 | |
1312 | jmachado | 309 | <html:link action="${user}/startLoadCourseUnit${fromAction}?courseUnitView.id=${item.id}"> |
1074 | jmachado | 310 | |
1312 | jmachado | 311 | ${item.importYear} |
312 | <% |
||
1531 | jmachado | 313 | if(courseUnitViewInEvaluation != null && courseUnitViewInEvaluation.getId()==item.getId()) |
1312 | jmachado | 314 | { |
1529 | jmachado | 315 | if(item.isValidationEvaluation()) |
316 | { |
||
1312 | jmachado | 317 | %> |
1529 | jmachado | 318 | <img src="<%=request.getContextPath()%>/imgs/check.gif" width="35px"/> |
319 | <% |
||
320 | } |
||
321 | else |
||
322 | { |
||
323 | %> |
||
324 | |||
1531 | jmachado | 325 | <img src="<%=request.getContextPath()%>/imgs/preencher2.gif" width="35px"/> |
1312 | jmachado | 326 | <% |
1529 | jmachado | 327 | } |
1312 | jmachado | 328 | } |
1531 | jmachado | 329 | else if(item.isValidEvaluation()) |
1529 | jmachado | 330 | { |
1312 | jmachado | 331 | %> |
1529 | jmachado | 332 | <span class="glyphicon glyphicon-ok"></span> |
333 | <% |
||
334 | } |
||
335 | %> |
||
1312 | jmachado | 336 | </html:link> |
337 | </logic:notEqual> |
||
457 | jmachado | 338 | |
1312 | jmachado | 339 | </li> |
340 | </logic:iterate> |
||
341 | </ul> |
||
342 | </li> |
||
457 | jmachado | 343 | |
1312 | jmachado | 344 | </logic:present> |
1074 | jmachado | 345 | |
1312 | jmachado | 346 | </ul> |
1074 | jmachado | 347 | |
348 | |||
1312 | jmachado | 349 | </div><!-- /.navbar-collapse --> |
1074 | jmachado | 350 | |
1312 | jmachado | 351 | </nav> |
901 | jmachado | 352 | <% |
353 | }catch(Throwable e) |
||
354 | { |
||
355 | System.out.println(e.toString()); |
||
356 | e.printStackTrace(); |
||
357 | } |
||
1312 | jmachado | 358 | %> |
359 |