Rev 1538 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1070 | jmachado | 1 | <%@ page import="jomm.dao.impl.AbstractDao" %> |
1085 | jmachado | 2 | <%@ page import="jomm.utils.MessageResources" %> |
3 | <%@ page import="pt.estgp.estgweb.domain.JobServiceTaskImpl" %> |
||
1070 | jmachado | 4 | <%@ page import="pt.estgp.estgweb.domain.JobServiceTaskScheduler" %> |
5 | <%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %> |
||
6 | <%@ page import="java.util.List" %> |
||
1312 | jmachado | 7 | <%@ page import="pt.estgp.estgweb.utils.ConfigProperties" %> |
1538 | jmachado | 8 | <%@ page import="java.util.Collections" %> |
1070 | jmachado | 9 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> |
10 | <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %> |
||
11 | <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> |
||
12 | <%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %> |
||
13 | <%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
||
1300 | jmachado | 14 | <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %> |
1070 | jmachado | 15 | <%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %> |
16 | <jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/> |
||
17 | <jomm:messages/> |
||
18 | <html:errors/> |
||
1791 | jmachado | 19 | <% |
1070 | jmachado | 20 | |
21 | |||
1791 | jmachado | 22 | %> |
23 | |||
1387 | jmachado | 24 | <div class="modal fade" id="modalHelpQuestionario" role="dialog" > |
25 | <div class="modal-dialog" data-width="960" style="display: block; width: 960px; margin-top: 50px;" aria-hidden="false"> |
||
26 | |||
27 | <!-- Modal content--> |
||
28 | <div class="modal-content"> |
||
29 | <div class="modal-header"> |
||
30 | <h1 class="modal-title">Ajuda sobre as Importações</h1> |
||
31 | </div> |
||
32 | <div class="modal-body"> |
||
33 | |||
34 | <div class="panel panel-default"> |
||
1389 | jmachado | 35 | |
1387 | jmachado | 36 | <h3>Questões relativas a importações</h3> |
37 | <ul> |
||
38 | <li>A ordem de importação deve ser: Cursos, Professores, Alunos</li> |
||
39 | <li>De forma a que as tipologias de aulas sejam bem atribuidas é necessária uma segunda importação de Cursos após a importação de Professores, |
||
40 | uma vez que só após termos professores associados é que as tipologias podem ser associadas aos mesmos</li> |
||
41 | </ul> |
||
42 | </div> |
||
43 | |||
44 | <button type="button" class="btn btn-success" data-dismiss="modal">Voltar</button> |
||
45 | </div> |
||
46 | </div> |
||
47 | |||
48 | </div> |
||
49 | </div> |
||
50 | |||
1070 | jmachado | 51 | <% |
1791 | jmachado | 52 | |
1070 | jmachado | 53 | AbstractDao.getCurrentSession().beginTransaction(); |
1791 | jmachado | 54 | |
55 | List<JobServiceTaskScheduler> schedulledTasks; |
||
56 | if(request.getAttribute("classServiceFilter") != null) |
||
57 | { |
||
58 | String classServiceFilter = (String) request.getAttribute("classServiceFilter"); |
||
59 | schedulledTasks = DaoFactory.getJobServiceTaskSchedulerDaoImpl().findFilteredByClassService(classServiceFilter); |
||
60 | } |
||
61 | else |
||
62 | schedulledTasks = DaoFactory.getJobServiceTaskSchedulerDaoImpl().findAllOrderByDescription(); |
||
63 | |||
1070 | jmachado | 64 | request.setAttribute("tasks",schedulledTasks); |
65 | %> |
||
66 | |||
1085 | jmachado | 67 | <script> |
1070 | jmachado | 68 | |
1085 | jmachado | 69 | function updateStatus() |
70 | { |
||
1070 | jmachado | 71 | |
1085 | jmachado | 72 | $.getJSON( "<%=request.getContextPath()%>/admin/schedullerTasksJson?service=loadTasks", function( data ) { |
73 | |||
74 | var task; |
||
75 | for(var i =0;i<data.length;i++) |
||
76 | { |
||
77 | var id = data[i].id; |
||
1312 | jmachado | 78 | if( data[i].lastJobServiceTask == null) |
79 | continue; |
||
1085 | jmachado | 80 | var progress = data[i].lastJobServiceTask.progress + "%"; |
81 | var status = data[i].lastJobServiceTask.status; |
||
82 | |||
83 | |||
84 | if(data[i].now == false && ((progress != null && progress != 0) || status != "PENDING")) |
||
85 | { |
||
86 | $("#log" + id).attr("href","<%=request.getContextPath()%>/user/configurationTasks.do?dispatch=loadLog&id=" + data[i].lastJobServiceTask.id); |
||
87 | $("#log" + id).show(); |
||
88 | $("#progress"+id).html(progress); |
||
89 | <% |
||
90 | for(JobServiceTaskImpl.JobStatus jS : JobServiceTaskImpl.JobStatus.values()) |
||
91 | { |
||
92 | %> |
||
93 | if(status == "<%=jS.name()%>") |
||
94 | { |
||
95 | $("#ultima"+id).html("<%=MessageResources.getInstance(request).getMessage("job.status."+jS.name())%>"); |
||
96 | } |
||
97 | <% |
||
98 | } |
||
99 | %> |
||
100 | } |
||
101 | else if(data[i].now == true) |
||
102 | { |
||
103 | $("#log" + id).hide(); |
||
104 | if($("#ultimaIcon"+id).attr("class").indexOf("glyphicon-warning-sign") > -1) |
||
105 | { |
||
106 | $("#ultimaIcon"+id).removeClass("glyphicon-warning-sign"); |
||
107 | $("#ultimaIcon"+id).addClass("glyphicon-random"); |
||
108 | } |
||
109 | else |
||
110 | { |
||
111 | $("#ultimaIcon"+id).addClass("glyphicon-warning-sign"); |
||
112 | $("#ultimaIcon"+id).removeClass("glyphicon-random"); |
||
113 | } |
||
114 | } |
||
115 | } |
||
116 | setTimeout("updateStatus()",2000); |
||
117 | }); |
||
118 | |||
119 | } |
||
120 | $(document).ready(function(){ |
||
121 | updateStatus(); |
||
122 | |||
123 | }); |
||
124 | </script> |
||
125 | |||
126 | |||
1070 | jmachado | 127 | <div class="container-fluid"> |
128 | <div class="panel panel-default"> |
||
129 | <div class="panel-heading"> |
||
130 | <bean:message key="configuration.tasks"/> |
||
1083 | jmachado | 131 | |
1387 | jmachado | 132 | <a class="btn btn-default" href="#" data-toggle="modal" data-target="#modalHelpImports"> |
133 | <span class="glyphicon glyphicon-question-sign"></span> Ajuda sobre Importações |
||
134 | </a> |
||
1077 | jmachado | 135 | <a href="<%=request.getContextPath()%>/user/configurationJobTasks.do" style="float:right" class="btn btn-default"><span class="glyphicon glyphicon-list-alt">Consultar Todos os Logs</span></a> |
1133 | jmachado | 136 | <a href="<%=request.getContextPath()%>/user/configurationTasks.do?dispatch=newTask" style="float:right" class="btn btn-success" onclick="set(form,'new');form.submit();"><span class="glyphicon glyphicon-plus">Agendar</span></a> |
1085 | jmachado | 137 | <a href="<%=request.getContextPath()%>/user/configurationSchedulleTasks.do" class="btn btn-info"><span class="glyphicon glyphicon-refresh"></span></a> |
1070 | jmachado | 138 | </div> |
139 | <div class="panel-body"> |
||
1133 | jmachado | 140 | <table id="myTable" class="tablesorter tablesorterfiltered"> |
1070 | jmachado | 141 | <thead> |
142 | <tr> |
||
1082 | jmachado | 143 | <th>Agora</th> |
1070 | jmachado | 144 | <th><bean:message key="configuration.task"/></th> |
145 | <th>Tipo</th> |
||
146 | <th>Calendarização</th> |
||
1076 | jmachado | 147 | |
1070 | jmachado | 148 | <th>Criador</th> |
149 | <th>Parametros</th> |
||
1076 | jmachado | 150 | <th>Última</th> |
151 | <th>Progresso</th> |
||
1300 | jmachado | 152 | <th class="filter-false" data-sorter="false"></th> |
1070 | jmachado | 153 | </tr> |
154 | </thead> |
||
155 | <tbody> |
||
156 | <logic:iterate id="task" name="tasks" type="pt.estgp.estgweb.domain.JobServiceTaskSchedulerImpl"> |
||
157 | <tr> |
||
1082 | jmachado | 158 | <td> |
1085 | jmachado | 159 | <logic:equal value="false" name="task" property="now"> |
1082 | jmachado | 160 | <a href="<%=request.getContextPath()%>/user/configurationTasks.do?dispatch=runNow&id=${task.id}" class="btn btn-default"> |
161 | <span class="glyphicon glyphicon-play"></span> |
||
162 | </a> |
||
1085 | jmachado | 163 | </logic:equal> |
1082 | jmachado | 164 | </td> |
1070 | jmachado | 165 | <td><bean:message key="targetService.${task.targetService}"/></td> |
166 | <td><bean:message key="configuration.task.${task.typeMsgKey}"/></td> |
||
167 | <td> |
||
168 | <logic:equal value="true" name="task" property="weekly"> |
||
169 | <bean:message key="weekday.day"/> <bean:message key="weekday.${task.weekDayMsgKey}"/> |
||
170 | </logic:equal> |
||
171 | <logic:equal value="true" name="task" property="monthly"> |
||
172 | <bean:message key="monthday.day"/> ${task.monthday} |
||
173 | </logic:equal> |
||
174 | <bean:message key="day.time"/> |
||
175 | ${task.hour}:${task.minute} |
||
176 | </td> |
||
1076 | jmachado | 177 | |
1070 | jmachado | 178 | <td>${task.createdBy.username}</td> |
179 | <td> |
||
180 | <table cellspacing="0" cellspadding="0"> |
||
181 | <logic:iterate id="taskParam" name="task" property="serviceTaskSchedulerParameters" type="pt.estgp.estgweb.domain.JobServiceTaskSchedulerParameter"> |
||
182 | <tr> |
||
183 | <td> |
||
1312 | jmachado | 184 | <bean:message key="task.param.${taskParam.name}"/> |
1070 | jmachado | 185 | </td> |
186 | <td> |
||
1312 | jmachado | 187 | <logic:equal value="JOB_institution_KEY" name="taskParam" property="name"> |
188 | <%=ConfigProperties.getProperty("institution.code.prefix." + taskParam.getObject())%> |
||
189 | </logic:equal> |
||
190 | <logic:notEqual value="JOB_institution_KEY" name="taskParam" property="name"> |
||
1332 | jmachado | 191 | <logic:equal value="JOB_questionario_courseList_KEY" name="taskParam" property="name"> |
192 | <a href="#" data-href="<%=request.getContextPath()%>/admin/questionarios/pedagogicoEstudante/cursosJobInfo.jsp?jobId=${task.id}" data-title="Listagem de Cursos da Tarefa de Atribuição" data-toggle="modal" data-target="#modalAjaxRequest"> |
||
193 | Lista Cursos |
||
194 | </a> |
||
195 | </logic:equal> |
||
196 | <logic:notEqual value="JOB_questionario_courseList_KEY" name="taskParam" property="name"> |
||
197 | ${taskParam.object} |
||
198 | </logic:notEqual> |
||
199 | |||
1312 | jmachado | 200 | </logic:notEqual> |
1070 | jmachado | 201 | </td> |
202 | </tr> |
||
203 | </logic:iterate> |
||
204 | </table> |
||
205 | </td> |
||
1085 | jmachado | 206 | <td id="ultima${task.id}" <logic:equal value="false" name="task" property="now">class="jobStatus${task.lastJobServiceTask.status}"</logic:equal>> |
207 | <logic:equal value="true" name="task" property="now"> |
||
208 | <span id="ultimaIcon${task.id}" class="glyphicon glyphicon glyphicon-random"></span> |
||
209 | </logic:equal> |
||
210 | <logic:equal value="false" name="task" property="now"> |
||
211 | <logic:notEmpty name="task" property="lastJobServiceTask"> |
||
212 | <bean:message key="job.status.${task.lastJobServiceTask.status}"/> |
||
213 | </logic:notEmpty> |
||
214 | </logic:equal> |
||
1076 | jmachado | 215 | </td> |
1085 | jmachado | 216 | <td id="progress${task.id}" style="text-align: right"> |
217 | <logic:equal value="true" name="task" property="now"> |
||
218 | <span class="glyphicon glyphicon glyphicon-random"></span> |
||
219 | </logic:equal> |
||
220 | <logic:equal value="false" name="task" property="now"> |
||
221 | <logic:notEmpty name="task" property="lastJobServiceTask"> |
||
222 | ${task.lastJobServiceTask.progress} % |
||
223 | </logic:notEmpty> |
||
224 | </logic:equal> |
||
1076 | jmachado | 225 | </td> |
1070 | jmachado | 226 | |
1300 | jmachado | 227 | <td class="icons" align="right"> |
1076 | jmachado | 228 | <logic:notEmpty name="task" property="lastJobServiceTask"> |
1085 | jmachado | 229 | <a id="log${task.id}" href="<%=request.getContextPath()%>/user/configurationTasks.do?dispatch=loadLog&id=${task.lastJobServiceTask.id}" class="btn btn-default"> |
1076 | jmachado | 230 | <span class="glyphicon glyphicon-list-alt"></span> |
231 | </a> |
||
232 | </logic:notEmpty> |
||
1070 | jmachado | 233 | |
1082 | jmachado | 234 | <logic:equal value="true" name="task" property="active"> |
235 | <a alt="Desactivar" class="btn btn-success" href="<%=request.getContextPath()%>/user/configurationTasks.do?dispatch=toggleActive&id=${task.id}" > |
||
236 | <span class="glyphicon glyphicon-ok"></span> |
||
237 | </a> |
||
238 | </logic:equal> |
||
239 | <logic:equal value="false" name="task" property="active"> |
||
240 | <a alt="Activar" class="btn btn-warning" href="<%=request.getContextPath()%>/user/configurationTasks.do?dispatch=toggleActive&id=${task.id}" > |
||
241 | <span class="glyphicon glyphicon-ban-circle"></span> |
||
242 | </a> |
||
243 | </logic:equal> |
||
1070 | jmachado | 244 | |
1082 | jmachado | 245 | <a alt="Apagar" class="btn btn-danger" onclick="return confirm('Tem a certeza que deseja apagar esta tarefa? <bean:message key="targetService.${task.targetService}"/>')" href="<%=request.getContextPath()%>/user/configurationTasks.do?dispatch=delete&id=${task.id}"> |
246 | <span class="glyphicon glyphicon-remove"></span> |
||
247 | </a> |
||
1085 | jmachado | 248 | |
249 | <a alt="Editar" class="btn btn-warning" href="<%=request.getContextPath()%>/user/configurationTasks.do?dispatch=load&id=${task.id}"> |
||
250 | <span class="glyphicon glyphicon-pencil"></span> |
||
251 | </a> |
||
1070 | jmachado | 252 | </td> |
253 | |||
254 | </tr> |
||
255 | </logic:iterate> |
||
256 | </tbody> |
||
257 | |||
258 | </table> |
||
259 | </div> |
||
260 | </div> |
||
261 | </div> |
||
262 | |||
263 | |||
264 | <% |
||
265 | AbstractDao.getCurrentSession().getTransaction().commit(); |
||
266 | %> |