Versão com ajustes no cabeçalho do caderno

parent 8f223bfb
......@@ -38,6 +38,7 @@
<liferay-ui:error key="erroListagemNula" message="No existem matrias cadastradas para os parmetros utilizados." />
<aui:form id="<portlet:namespace />formDO" name="<portlet:namespace />formDO" method="POST" action="<%= submitActionURL%>" data-senna-off="true">
<div class="sheet sheet-lg" style="margin-top: 24px">
......@@ -74,7 +75,7 @@
</div>
<aui:button-row>
<aui:button type="reset" id="limparFormDO" name="limparFormDO" value="Limpar" />
<aui:button type="submit" id="enviarFormDO" name="enviarFormDO" value="Gerar Caderno" />
<aui:button type="submit" id="enviarFormDO" name="enviarFormDO" value="Gerar Caderno"/>
<aui:button type="button" id="jobForm" name="jobForm" class="oculto" style="display: none" value="no aperte" />
</aui:button-row>
......@@ -104,4 +105,12 @@
createDatesValidation();
}
});
$('button[type="submit"]').click(function(){
setTimeout(function(){
$('button[type="submit"]').removeAttr('disabled');
$('button[type="submit"]').css("opacity", "1");
}, 1000);
});
</script>
\ No newline at end of file
......@@ -137,12 +137,15 @@ public class MprjDoerjCadernoPortlet extends MVCPortlet {
RestServices rest = new RestServices();
String dataDivulgacaoRest = dataDivulgacao.replace("/", "");
listaConteudos = rest.getRest(dataDivulgacaoRest,idStatus,actionRequest);
//SessionMessages.add(actionRequest, PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_SUCCESS_MESSAGE);
SessionMessages.add(actionRequest, PortalUtil.getPortletId(actionRequest));
SessionMessages.add(actionRequest, PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_SUCCESS_MESSAGE);
//SessionMessages.add(actionRequest, PortalUtil.getPortletId(actionRequest));
if(!mensagensDeErro(listaConteudos, dataDivulgacao, actionRequest)){
GeraCaderno caderno = new GeraCaderno();
caderno.processaCaderno(actionRequest, actionResponse,listaConteudos,dataDivulgacao);
//SessionMessages.add(actionRequest, "sucessoMessage");
}else{
//String portletName = (String) actionRequest.getAttribute(WebKeys.PORTLET_ID);
......
package mprj.doerj.caderno.util;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.portlet.LiferayPortletResponse;
import com.liferay.portal.kernel.servlet.SessionErrors;
import com.liferay.portal.kernel.servlet.SessionMessages;
import com.liferay.portal.kernel.theme.ThemeDisplay;
import com.liferay.portal.kernel.util.ContentTypes;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.PortalUtil;
import com.liferay.portal.kernel.util.WebKeys;
......@@ -79,9 +81,9 @@ public class GeraCaderno {
JSONObject cabecalho = new JSONObject(listaConteudos.getJSONObject(0).toString());
String edicao = "EDIO TESTE";
String edicao = "--";
String disponibilizacao = util.gerarDataCabecalho(dataDivulgacao);
String publicacao = "PUBLICAO TESTE";
String publicacao = "--";
......@@ -226,14 +228,21 @@ public class GeraCaderno {
File exportFile = File.createTempFile("caderno_doerj_tmp_", ".docx");
try {
templatePackage.save(exportFile);
PortletResponse pResponse = PortalUtil.getLiferayPortletResponse(actionResponse);
HttpServletResponse res = PortalUtil.getHttpServletResponse(pResponse);
res.setHeader("Content-Disposition", "attachment; filename=" + nomeArquivo);//
res.setContentType(ContentTypes.APPLICATION_MSWORD);
/*String redirectURL = ParamUtil.getString(actionRequest, "/view-admin.jsp");
actionResponse.sendRedirect(redirectURL);*/
try (FileInputStream in = new FileInputStream(exportFile);) {
OutputStream out = res.getOutputStream();
......
......@@ -38,6 +38,7 @@
<liferay-ui:error key="erroListagemNula" message="No existem matrias cadastradas para os parmetros utilizados." />
<aui:form id="<portlet:namespace />formDO" name="<portlet:namespace />formDO" method="POST" action="<%= submitActionURL%>" data-senna-off="true">
<div class="sheet sheet-lg" style="margin-top: 24px">
......@@ -74,7 +75,7 @@
</div>
<aui:button-row>
<aui:button type="reset" id="limparFormDO" name="limparFormDO" value="Limpar" />
<aui:button type="submit" id="enviarFormDO" name="enviarFormDO" value="Gerar Caderno" />
<aui:button type="submit" id="enviarFormDO" name="enviarFormDO" value="Gerar Caderno"/>
<aui:button type="button" id="jobForm" name="jobForm" class="oculto" style="display: none" value="no aperte" />
</aui:button-row>
......@@ -104,4 +105,12 @@
createDatesValidation();
}
});
$('button[type="submit"]').click(function(){
setTimeout(function(){
$('button[type="submit"]').removeAttr('disabled');
$('button[type="submit"]').css("opacity", "1");
}, 1000);
});
</script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment