Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1524 | jmachado | 1 | <%@ page import="jomm.dao.impl.AbstractDao" %> |
2 | <%@ page import="pt.estgp.estgweb.domain.*" %> |
||
3 | <%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %> |
||
4 | <%@ page import="java.util.List" %> |
||
5 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> |
||
6 | <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %> |
||
7 | <%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %> |
||
8 | <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %> |
||
9 | <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> |
||
10 | <%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %> |
||
11 | <%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %> |
||
12 | <%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
||
13 | <baco:hasRole role="admin,all,event_class_manager"> |
||
14 | <% |
||
15 | long classId = Long.parseLong(request.getParameter("classId")); |
||
16 | EventFormacoes event = null; |
||
17 | AbstractDao.getCurrentSession().beginTransaction(); |
||
18 | EventClass eventClass = DaoFactory.getEventClassDaoImpl().load(classId); |
||
19 | if(request.getParameter("eventId") != null) |
||
20 | { |
||
21 | event = (EventFormacoesImpl) DaoFactory.getEventFormacoesDaoImpl().load(Long.parseLong(request.getParameter("eventId"))); |
||
22 | } |
||
23 | else |
||
24 | { |
||
25 | event = DomainObjectFactory.createEventFormacoesImpl(); |
||
26 | } |
||
27 | %> |
||
28 | <script> |
||
29 | |||
30 | function submitEventClassForm(form) |
||
31 | { |
||
32 | |||
33 | $("#dispatch").val("saveClassAjax"); |
||
34 | var data = $("#formEventClass").serialize().replace(/%0D%0A/g, '%0A').replace(/\r?\n/g, "\r\n"); |
||
35 | $("#saveProgress").html('<div class="alert alert-info">Enviando ...</div>'); |
||
36 | $.ajax({ |
||
37 | url: "<%=request.getContextPath()%>/user/submitEventClassAjax.do", |
||
38 | type: "POST", |
||
39 | data: data, |
||
40 | dataType: "json", |
||
41 | success: function(resposta) { |
||
42 | if(resposta.service && resposta.service == "ok") |
||
43 | { |
||
44 | $("#saveProgress").html('<div class="alert alert-success">Salvo com sucesso</div>'); |
||
45 | $('#modalAjaxRequest').modal('hide'); |
||
46 | window.location.href = "<%=request.getContextPath()%>/user/startManageEventsClass.do"; |
||
47 | } |
||
48 | else if(resposta.service == "errors") |
||
49 | { |
||
50 | $("#saveProgress").html(resposta.errors); |
||
51 | } |
||
52 | }, |
||
53 | error: function() { |
||
54 | $("#saveProgress").html('<div class="alert alert-danger">Erro de comunicação, por favor tente novamente</div>'); |
||
55 | } |
||
56 | }); |
||
57 | |||
58 | } |
||
59 | |||
60 | </script> |
||
61 | |||
62 | |||
63 | <div class="panel panel-default"> |
||
64 | <div class="panel-body"> |
||
65 | <div class="text-info" id="saveProgress"></div> |
||
66 | <html:form styleId="formEvent" action="/user/submitEventFormacoesAjax" styleClass="form-horizontal"> |
||
67 | <input type="hidden" name="dispatch" value="saveEventAjax"> |
||
68 | <jsp:useBean id="MyEventFormacoesForm" type="pt.estgp.estgweb.web.form.events.MyEventFormacoesForm" scope="request"/> |
||
69 | <% |
||
70 | if(event != null) |
||
71 | MyEventFormacoesForm.setEvent(event); |
||
72 | %> |
||
73 | <html:hidden property="event.id"/> |
||
74 | <div class="form-group"> |
||
75 | <label class="control-label col-sm-2">Titulo</label> |
||
76 | <div class="col-sm-10"> |
||
77 | <html:text styleClass="form-control" property="event.title"/> |
||
78 | </div> |
||
79 | </div> |
||
80 | <div class="form-group"> |
||
81 | <label class="control-label col-sm-2">Descrição</label> |
||
82 | <div class="col-sm-10"> |
||
83 | <html:textarea rows="5" styleClass="form-control" property="event.description"/> |
||
84 | </div> |
||
85 | </div> |
||
86 | <div class="form-group"> |
||
87 | <label class="control-label col-sm-2">Observações</label> |
||
88 | <div class="col-sm-10"> |
||
89 | <html:textarea rows="5" styleClass="form-control" property="event.observacoes"/> |
||
90 | </div> |
||
91 | </div> |
||
92 | <div class="form-group"> |
||
93 | <label class="control-label col-sm-2">Locais</label> |
||
94 | <div class="col-sm-10"> |
||
95 | <html:textarea rows="5" styleClass="form-control" property="event.locais"/> |
||
96 | </div> |
||
97 | </div> |
||
98 | |||
99 | <button type="button" class="btn btn-success" onclick="submitEventClassForm(form);"><bean:message key="confirm"/></button> |
||
100 | </html:form> |
||
101 | |||
102 | </div> |
||
103 | </div> |
||
104 | |||
105 | <% |
||
106 | |||
107 | AbstractDao.getCurrentSession().getTransaction().commit(); |
||
108 | %> |
||
109 | |||
110 | </baco:hasRole> |