Rev 1671 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1579 | jmachado | 1 | <%@ page import="jomm.dao.impl.AbstractDao" %> |
2 | <%@ page import="pt.estgp.estgweb.domain.QuestionarioReportFileGroupImpl" %> |
||
3 | <%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %> |
||
1629 | jmachado | 4 | <%@ page import="java.util.Date" %> |
1579 | jmachado | 5 | <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %> |
6 | <%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %> |
||
7 | <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %> |
||
8 | <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> |
||
9 | <%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %> |
||
10 | <%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %> |
||
11 | <%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
||
1583 | jmachado | 12 | |
13 | <%@taglib prefix="bacoTemplates" tagdir="/WEB-INF/tags" %> |
||
1579 | jmachado | 14 | <%-- |
15 | Created by IntelliJ IDEA. |
||
16 | User: jorgemachado |
||
17 | Date: 29/12/16 |
||
18 | Time: 11:47 |
||
19 | To change this template use File | Settings | File Templates. |
||
20 | --%> |
||
21 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> |
||
22 | <% |
||
23 | String id = request.getParameter("questionarioReportFileGroup.id"); |
||
24 | AbstractDao.getCurrentSession().beginTransaction(); |
||
25 | QuestionarioReportFileGroupImpl group = (QuestionarioReportFileGroupImpl) DaoFactory.getQuestionarioReportFileGroupDaoImpl().load(Long.parseLong(id)); |
||
26 | request.setAttribute("group",group); |
||
27 | |||
28 | |||
1583 | jmachado | 29 | /* |
1579 | jmachado | 30 | JobServiceTaskImpl job = group.getReportGenerationTaskId() > 0 ? |
31 | (JobServiceTaskImpl) DaoFactory.getJobServiceTaskDaoImpl().load(group.getReportGenerationTaskId()) : |
||
32 | null; |
||
33 | request.setAttribute("Job", job); |
||
1583 | jmachado | 34 | */ |
1579 | jmachado | 35 | |
36 | %> |
||
37 | |||
38 | |||
39 | <div class="panel panel-default" id="reportParameterInputsApp" ng-app="reportParameterInputsApp" ng-controller="reportParameterInputsAppController"> |
||
40 | <div class="panel-heading"> |
||
41 | Administração do Report ${group.id} |
||
42 | </div> |
||
43 | <div class="panel-body"> |
||
44 | <html:form styleClass="form-horizontal" action="/user/questionariosReportsPae"> |
||
45 | <div class="web-messages"></div><!--For Widgets Use--> |
||
46 | <html:errors/> |
||
47 | <jomm:messages/> |
||
48 | <jsp:useBean id="QuestionarioReportGroupForm" type="pt.estgp.estgweb.web.form.questionarios.QuestionarioReportGroupForm" scope="request"/> |
||
49 | |||
50 | <% |
||
51 | QuestionarioReportGroupForm.setQuestionarioReportFileGroup(group); |
||
52 | %> |
||
53 | <html:hidden property="questionarioReportFileGroup.id"/> |
||
54 | <html:hidden property="parametersArrayObtainedFromWidget" value="{{ inputsJson }}"/> |
||
55 | <html:hidden property="questionarioReportFileGroup.reportProcessorClass"/> |
||
56 | <input type="hidden" name="dispatch" value="save"/> |
||
57 | <div class="form-group"> |
||
58 | <label class="col-md-2 control-label">Titulo do Grupo de Relatórios</label> |
||
59 | <div class="col-md-10"> |
||
60 | <html:text styleClass="form-control" property="questionarioReportFileGroup.title"/> |
||
61 | </div> |
||
62 | </div> |
||
1586 | jmachado | 63 | <script> |
64 | $(document).ready(function(){ |
||
65 | $(".checkQuestionarioActivo").attr("data-toogle","toggle"); |
||
66 | $('.checkQuestionarioActivo').bootstrapToggle({ |
||
67 | on: 'Visivel', |
||
68 | off: 'Inactivo' |
||
69 | }); |
||
70 | }); |
||
71 | |||
72 | </script> |
||
1579 | jmachado | 73 | <div class="form-group"> |
1586 | jmachado | 74 | <label class="col-md-2 control-label">Visibilidade</label> |
75 | <div class="col-md-10"> |
||
76 | <html:checkbox styleClass="checkQuestionarioActivo" property="questionarioReportFileGroup.active"/> |
||
77 | </div> |
||
78 | </div> |
||
79 | <div class="form-group"> |
||
1579 | jmachado | 80 | <label class="col-md-2 control-label">Tipo</label> |
81 | <div class="col-md-10"> |
||
82 | <label class="bg-info" style="padding:2px"><bean:message key="${group.reportProcessorClass}"/></label> |
||
83 | </div> |
||
84 | </div> |
||
85 | |||
86 | <div class="form-group"> |
||
87 | <label class="col-md-2 control-label">Parametros de Serviço</label> |
||
88 | <div class="col-md-6"> |
||
89 | <div class="list-group"> |
||
90 | <div class="list-group-item" ng-repeat="i in inputsJson"> |
||
91 | <div class="list-group-item"><label class="bg-info"/>{{ i.name }}</label>: {{ i.value }}</div> |
||
92 | </div> |
||
93 | </div> |
||
94 | </div> |
||
95 | <script> |
||
96 | //DECLARACAO DA APLICACAO LOCAL EM ANGULAR |
||
97 | var reportParameterInputsApp = angular.module('reportParameterInputsApp', []); |
||
98 | GLOBAL_BacoAngularAppDependencies.push('reportParameterInputsApp'); |
||
99 | |||
100 | reportParameterInputsApp.controller('reportParameterInputsAppController', function($scope) { |
||
101 | $scope.inputsJson = <%=group.getInputsJson()%>;//apenas para a vista |
||
102 | }); |
||
103 | |||
104 | function reloadInputs() |
||
105 | { |
||
106 | widgetCallWithParameters("reloadInputs", |
||
107 | { "questionarioReportFileGroup.id" : ${group.id} }, |
||
108 | $("#reportParameterInputsApp form")[0], //tem d ser com [0] para obter o JavaScript Object original e nao o prototype do JQUERY |
||
109 | // apenas para uso do div web-messages |
||
110 | function(response) |
||
111 | { |
||
112 | angular.element($("#reportParameterInputsApp")).scope().inputsJson = response.jsonInputs; |
||
113 | angular.element($("#reportParameterInputsApp")).scope().$apply(); |
||
114 | } |
||
115 | ); |
||
116 | } |
||
117 | </script> |
||
118 | <div class="col-md-4"> |
||
119 | <a class="btn btn-default" href="#" |
||
120 | data-callback-target-function="reloadInputs" |
||
121 | data-href="<%=request.getContextPath()%>${group.reportGeneratorInstance.widgetAdminInterface}?questionarioReportFileGroup.id=${group.id}" data-title="Administração de Parametros de Serviço" data-toggle="modal" data-target="#modalAjaxRequest"> |
||
122 | <span class="glyphicon glyphicon-wrench"> </span> Parametros |
||
123 | </a> |
||
124 | </div> |
||
125 | |||
1580 | jmachado | 126 | </div> |
127 | <div class="form-group"> |
||
128 | <div class="col-md-2"> |
||
1579 | jmachado | 129 | |
1580 | jmachado | 130 | </div> |
131 | <div class="col-md-10"> |
||
1586 | jmachado | 132 | <button type="button" class="btn btn-success" onclick="set(form,'updateReportGroup'),form.submit();">Salvar</button> |
1580 | jmachado | 133 | <a class="btn btn-danger" href="<%=request.getContextPath()%>/user/listQuestionariosReports.do">Sair</a> |
134 | </div> |
||
135 | </div> |
||
1579 | jmachado | 136 | |
1830 | jmachado | 137 | |
138 | |||
139 | |||
1583 | jmachado | 140 | <bacoTemplates:schedulleTaskProgress |
1830 | jmachado | 141 | targetUrlWithOutContextPath="/user/startAdminQuestionariosReportsGroup.do?questionarioReportFileGroup.id=${group.id}&sigesCode={{sigesCode}}" |
1583 | jmachado | 142 | taskId="${group.reportGenerationTaskId}" |
143 | transactional="true" |
||
144 | logSizeXs="true" |
||
145 | /> |
||
1629 | jmachado | 146 | <% |
147 | boolean callRun = false; |
||
148 | long timeElapsedSinceLastUpdate = 0; |
||
149 | if(request.getAttribute("JOB_UPDATE_DATE") != null) |
||
150 | { |
||
151 | Date updateDateJob = (Date) request.getAttribute("JOB_UPDATE_DATE"); |
||
152 | timeElapsedSinceLastUpdate = (System.currentTimeMillis() - updateDateJob.getTime())/1000; |
||
1583 | jmachado | 153 | |
1629 | jmachado | 154 | if(timeElapsedSinceLastUpdate > 300) |
155 | { |
||
156 | callRun = true; |
||
157 | } |
||
158 | } |
||
1671 | jmachado | 159 | else |
160 | { |
||
161 | callRun=true; |
||
162 | } |
||
1629 | jmachado | 163 | if(callRun) |
164 | { |
||
165 | %> |
||
1830 | jmachado | 166 | <div class="form-group"> |
167 | <label class="col-md-2 control-label">Gerar apenas o curso com o código SIGES</label> |
||
168 | <div class="col-md-10"> |
||
169 | <html:text property="processSigesCode"/> |
||
170 | </div> |
||
171 | </div> |
||
1629 | jmachado | 172 | <div class="clearfix col-md-12"> |
173 | <button type="button" class="btn btn-warning" onclick="set(form,'runJobGenerate'),form.submit();">Gerar Relatórios</button> |
||
174 | </div> |
||
175 | <% |
||
176 | } |
||
177 | else |
||
178 | { |
||
179 | %> |
||
180 | <div class="clearfix col-md-12"> |
||
181 | <p class="alert alert-success">O processo de geração foi atualizado há <%=timeElapsedSinceLastUpdate%> segundos, não pode ser invocado enquanto não terminar</p> |
||
182 | </div> |
||
183 | <% |
||
184 | } |
||
185 | %> |
||
186 | |||
187 | |||
188 | |||
1579 | jmachado | 189 | </html:form> |
190 | </div> |
||
191 | </div> |
||
192 | |||
193 | <% |
||
194 | AbstractDao.getCurrentSession().getTransaction().commit(); |
||
195 | %> |