Rev 1974 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1974 | Rev 1992 | ||
---|---|---|---|
1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> |
1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> |
2 | <%@ page import="jomm.dao.impl.AbstractDao" %> |
2 | <%@ page import="jomm.dao.impl.AbstractDao" %> |
3 | <%@ page import="pt.estgp.estgweb.domain.CourseImpl" %> |
3 | <%@ page import="pt.estgp.estgweb.domain.CourseImpl" %> |
4 | <%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %> |
4 | <%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %> |
5 | <%@ page import="pt.estgp.estgweb.utils.documentBuilder.TextComponent" %> |
5 | <%@ page import="pt.estgp.estgweb.utils.documentBuilder.TextComponent" %> |
6 | <%@ page import="pt.estgp.estgweb.utils.documentBuilder.ImageComponent" %> |
6 | <%@ page import="pt.estgp.estgweb.utils.documentBuilder.ImageComponent" %> |
7 | <%@ page import="pt.estgp.estgweb.services.courses.CourseReportServices" %> |
7 | <%@ page import="pt.estgp.estgweb.services.courses.CourseReportServices" %> |
8 | <%@ page import="pt.estgp.estgweb.services.courses.coursereport.documentmodel.CourseReportDocument" %> |
8 | <%@ page import="pt.estgp.estgweb.services.courses.coursereport.documentmodel.CourseReportDocument" %> |
9 | <%@ page import="org.json.JSONException" %> |
9 | <%@ page import="org.json.JSONException" %> |
10 | <%@ page import="pt.estgp.estgweb.services.sigesimports.ImportCourseService" %> |
10 | <%@ page import="pt.estgp.estgweb.services.sigesimports.ImportCourseService" %> |
11 | <%@ page import="pt.estgp.estgweb.domain.UserSession" %> |
11 | <%@ page import="pt.estgp.estgweb.domain.UserSession" %> |
- | 12 | <%@ page import="pt.estgp.estgweb.domain.Course" %> |
|
- | 13 | <%@ page import="pt.estgp.estgweb.utils.documentBuilder.Document" %> |
|
12 | <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %> |
14 | <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %> |
13 | <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %> |
15 | <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %> |
14 | <%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
16 | <%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
15 | <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> |
17 | <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> |
16 | <%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %> |
18 | <%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %> |
17 | <%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %> |
19 | <%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %> |
18 | <%@taglib prefix="t" tagdir="/WEB-INF/tags" %> |
20 | <%@taglib prefix="t" tagdir="/WEB-INF/tags" %> |
19 | <jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSessionImpl" scope="request"/> |
21 | <jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSessionImpl" scope="request"/> |
20 | 22 | ||
- | 23 | <jsp:useBean id="courseReportJson" type="java.lang.String" scope="request"/> |
|
- | 24 | ||
21 | <link rel="stylesheet" href="<%=request.getContextPath()%>/js/jquery-ui-1.12.1/jquery-ui.css"> |
25 | <link rel="stylesheet" href="<%=request.getContextPath()%>/js/jquery-ui-1.12.1/jquery-ui.css"> |
22 | <script src="<%=request.getContextPath()%>/js/jquery-ui-1.12.1/jquery-ui.min.js"></script> |
26 | <script src="<%=request.getContextPath()%>/js/jquery-ui-1.12.1/jquery-ui.min.js"></script> |
23 | <link rel="stylesheet" href="<%=request.getContextPath()%>/css/flora-commons/flora.resizable.css"> |
27 | <link rel="stylesheet" href="<%=request.getContextPath()%>/css/flora-commons/flora.resizable.css"> |
24 | <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.min.js"></script> |
28 | <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.min.js"></script> |
25 | <script> |
29 | <script> |
26 | function demoFromHTML() { |
30 | function demoFromHTML() { |
27 | var pdf = new jsPDF('p', 'pt', 'letter'); |
31 | var pdf = new jsPDF('p', 'pt', 'letter'); |
28 | // source can be HTML-formatted string, or a reference |
32 | // source can be HTML-formatted string, or a reference |
29 | // to an actual DOM element from which the text will be scraped. |
33 | // to an actual DOM element from which the text will be scraped. |
30 | source = $('#courseReportApp')[0]; |
34 | source = $('#courseReportApp')[0]; |
31 | 35 | ||
32 | // we support special element handlers. Register them with jQuery-style |
36 | // we support special element handlers. Register them with jQuery-style |
33 | // ID selector for either ID or node name. ("#iAmID", "div", "span" etc.) |
37 | // ID selector for either ID or node name. ("#iAmID", "div", "span" etc.) |
34 | // There is no support for any other type of selectors |
38 | // There is no support for any other type of selectors |
35 | // (class, of compound) at this time. |
39 | // (class, of compound) at this time. |
36 | specialElementHandlers = { |
40 | specialElementHandlers = { |
37 | // element with id of "bypass" - jQuery style selector |
41 | // element with id of "bypass" - jQuery style selector |
38 | '#bypassme': function (element, renderer) { |
42 | '#bypassme': function (element, renderer) { |
39 | // true = "handled elsewhere, bypass text extraction" |
43 | // true = "handled elsewhere, bypass text extraction" |
40 | return true |
44 | return true |
41 | } |
45 | } |
42 | }; |
46 | }; |
43 | margins = { |
47 | margins = { |
44 | top: 80, |
48 | top: 80, |
45 | bottom: 60, |
49 | bottom: 60, |
46 | left: 40, |
50 | left: 40, |
47 | width: 522 |
51 | width: 522 |
48 | }; |
52 | }; |
49 | // all coords and widths are in jsPDF instance's declared units |
53 | // all coords and widths are in jsPDF instance's declared units |
50 | // 'inches' in this case |
54 | // 'inches' in this case |
51 | pdf.fromHTML( |
55 | pdf.fromHTML( |
52 | source, // HTML string or DOM elem ref. |
56 | source, // HTML string or DOM elem ref. |
53 | margins.left, // x coord |
57 | margins.left, // x coord |
54 | margins.top, { // y coord |
58 | margins.top, { // y coord |
55 | 'width': margins.width, // max width of content on PDF |
59 | 'width': margins.width, // max width of content on PDF |
56 | 'elementHandlers': specialElementHandlers |
60 | 'elementHandlers': specialElementHandlers |
57 | }, |
61 | }, |
58 | 62 | ||
59 | function (dispose) { |
63 | function (dispose) { |
60 | // dispose: object with X, Y of the last line add to the PDF |
64 | // dispose: object with X, Y of the last line add to the PDF |
61 | // this allow the insertion of new lines after html |
65 | // this allow the insertion of new lines after html |
62 | //var pdfDocument = pdf.save('Test.pdf'); |
66 | //var pdfDocument = pdf.save('Test.pdf'); |
63 | var pdfDocument = pdf.output(); |
67 | var pdfDocument = pdf.output(); |
64 | 68 | ||
65 | var boundary = '---------------------------'; |
69 | var boundary = '---------------------------'; |
66 | boundary += Math.floor(Math.random()*32768); |
70 | boundary += Math.floor(Math.random()*32768); |
67 | boundary += Math.floor(Math.random()*32768); |
71 | boundary += Math.floor(Math.random()*32768); |
68 | boundary += Math.floor(Math.random()*32768); |
72 | boundary += Math.floor(Math.random()*32768); |
69 | 73 | ||
70 | var body = ''; |
74 | var body = ''; |
71 | body += '--' + boundary + '\r\n' + |
75 | body += '--' + boundary + '\r\n' + |
72 | 'Content-Disposition: form-data; name="filesInputId-UPLOAD[]"; filename="20170530_210340.pdf"' + '\r\n'; |
76 | 'Content-Disposition: form-data; name="filesInputId-UPLOAD[]"; filename="20170530_210340.pdf"' + '\r\n'; |
73 | body += 'Content-Type: application/pdf'; |
77 | body += 'Content-Type: application/pdf'; |
74 | body += '\r\n\r\n'; |
78 | body += '\r\n\r\n'; |
75 | body += pdfDocument; |
79 | body += pdfDocument; |
76 | body += '\r\n' |
80 | body += '\r\n' |
77 | body += '--' + boundary + '--'; |
81 | body += '--' + boundary + '--'; |
78 | 82 | ||
79 | 83 | ||
80 | 84 | ||
81 | $.ajax({ |
85 | $.ajax({ |
82 | type: "POST", |
86 | type: "POST", |
83 | cache: false, |
87 | cache: false, |
84 | url: "<%=request.getContextPath()%>/filesUpload", |
88 | url: "<%=request.getContextPath()%>/filesUpload", |
85 | data: body , |
89 | data: body , |
86 | processData: false, |
90 | processData: false, |
87 | contentType : 'multipart/form-data; boundary=' + boundary, |
91 | contentType : 'multipart/form-data; boundary=' + boundary, |
88 | success: function (data) { |
92 | success: function (data) { |
89 | alert('success'); |
93 | alert('success'); |
90 | return false; |
94 | return false; |
91 | } |
95 | } |
92 | }); |
96 | }); |
93 | }, margins |
97 | }, margins |
94 | ); |
98 | ); |
95 | } |
99 | } |
96 | </script> |
100 | </script> |
97 | 101 | ||
98 | <% |
102 | <% |
- | 103 | AbstractDao.getCurrentSession().beginTransaction(); |
|
- | 104 | ||
- | 105 | CourseReportDocument courseReportJson1; |
|
- | 106 | courseReportJson1 = Document.fromJson(courseReportJson); |
|
- | 107 | ||
- | 108 | CourseImpl courseImpl = DaoFactory.getCourseDaoImpl().findCourseByCode(courseReportJson1.getCourseCode()); |
|
- | 109 | request.setAttribute("course",courseImpl); |
|
99 | 110 | ||
- | 111 | ||
- | 112 | /*String courseCode = request.getParameter("courseCode"); |
|
- | 113 | AbstractDao.getCurrentSession().beginTransaction(); |
|
- | 114 | CourseImpl courseImpl = DaoFactory.getCourseDaoImpl().findCourseByCode(courseCode); |
|
- | 115 | request.setAttribute("course",courseImpl);*/ |
|
- | 116 | /* |
|
100 | String courseCode = request.getParameter("courseCode"); |
117 | String courseCode = request.getParameter("courseCode"); |
101 | String year = request.getParameter("year"); |
118 | String year = request.getParameter("year"); |
102 | 119 | ||
103 | AbstractDao.getCurrentSession().beginTransaction(); |
120 | AbstractDao.getCurrentSession().beginTransaction(); |
104 | CourseImpl courseImpl = DaoFactory.getCourseDaoImpl().findCourseByCode(courseCode); |
121 | CourseImpl courseImpl = DaoFactory.getCourseDaoImpl().findCourseByCode(courseCode); |
105 | request.setAttribute("course",courseImpl); |
122 | request.setAttribute("course",courseImpl); |
106 | 123 | ||
107 | CourseReportDocument courseReportDocument = new CourseReportDocument(); |
124 | CourseReportDocument courseReportDocument = new CourseReportDocument(); |
108 | 125 | ||
109 | String auxCourseReportDocument; |
126 | //String auxCourseReportDocument; |
110 | auxCourseReportDocument = new CourseReportServices().loadCourseReportDocument(courseCode,year,UserSession); |
127 | //auxCourseReportDocument = new CourseReportServices().loadCourseReportDocument(courseCode,year,UserSession); |
111 | 128 | ||
112 | try { |
129 | try { |
113 | //courseReportDocument = courseReportDocument.fromJson(auxCourseReportDocument); |
130 | //courseReportDocument = courseReportDocument.fromJson(auxCourseReportDocument); |
114 | courseReportDocument = new CourseReportServices().createNewCourseReportDocument(courseCode, year); |
131 | courseReportDocument = new CourseReportServices().createNewCourseReportDocument(courseCode, year); |
115 | }catch (Throwable e) { |
132 | }catch (Throwable e) { |
116 | System.out.println(e); |
133 | System.out.println(e); |
117 | e.printStackTrace(); |
134 | e.printStackTrace(); |
118 | } |
135 | } |
119 | 136 | ||
- | 137 | String courseReportJson = courseReportDocument.toJson(); |
|
- | 138 | request.setAttribute("courseDocumentJson",courseReportJson); |
|
- | 139 | request.setAttribute("courseDocument",courseReportDocument); |
|
120 | 140 | ||
121 | /*try { |
141 | /*try { |
122 | 142 | ||
123 | } catch (Throwable e) { |
143 | } catch (Throwable e) { |
124 | courseReportDocument = new CourseReportServices().createNewCourseReportDocument(courseCode, year); |
144 | courseReportDocument = new CourseReportServices().createNewCourseReportDocument(courseCode, year); |
125 | System.out.println(e); |
145 | System.out.println(e); |
126 | e.printStackTrace(); |
146 | e.printStackTrace(); |
127 | }*/ |
147 | }*/ |
- | 148 | %> |
|
- | 149 | ||
128 | 150 | ||
129 | String courseReportJson = courseReportDocument.toJson(); |
- | |
130 | request.setAttribute("courseDocumentJson",courseReportJson); |
- | |
131 | request.setAttribute("courseDocument",courseReportDocument); |
- | |
132 | 151 | ||
133 | %> |
- | |
134 | <%--<a href="javascript:demoFromHTML()" class="button">Run Code</a>--%> |
152 | <%--<a href="javascript:demoFromHTML()" class="button">Run Code</a>--%> |
135 | 153 | ||
136 | <div class="container-fluid"> |
154 | <div class="container-fluid"> |
137 | 155 | ||
138 | <style> |
156 | <style> |
139 | .separatorSection |
157 | .separatorSection |
140 | { |
158 | { |
141 | border: 1px solid #ddd; |
159 | border: 1px solid #ddd; |
142 | } |
160 | } |
143 | </style> |
161 | </style> |
144 | 162 | ||
145 | 163 | ||
146 | <!-- Apresentacao da Unidade --> |
164 | <!-- Apresentacao da Unidade --> |
147 | 165 | ||
148 | <div class="panel panel-default"> |
166 | <div class="panel panel-default"> |
149 | <div class="panel-heading"> |
167 | <div class="panel-heading"> |
150 | Relatório Anual do curso: ${course.name} |
168 | Relatório Anual do curso: ${course.name} |
151 | </div> |
169 | </div> |
152 | <div class="panel-body"> |
170 | <div class="panel-body"> |
153 | 171 | ||
154 | <p><b class="label-info">Tipo de Curso:</b> <bean:message key="course.${course.degree}"/></p> |
172 | <p><b class="label-info">Tipo de Curso:</b> <bean:message key="course.${course.degree}"/></p> |
155 | <p><b class="label-info">Ano Lectivo:</b> ${course.importYear}</p> |
173 | <p><b class="label-info">Ano Lectivo:</b> ${course.importYear}</p> |
156 | <p><b class="label-info">Departamento:</b> ${course.department.name}</p> |
174 | <p><b class="label-info">Departamento:</b> ${course.department.name}</p> |
157 | <p><b class="label-info">Escola:</b> ${course.department.courseSchool.name}</p> |
175 | <p><b class="label-info">Escola:</b> ${course.department.courseSchool.name}</p> |
158 | 176 | ||
159 | 177 | ||
160 | 178 | ||
161 | 179 | ||
162 | <script> |
180 | <script> |
163 | 181 | ||
164 | //Especifico da aplicacao |
182 | //Especifico da aplicacao |
165 | var courseReportApp = angular.module('courseReportApp', ['ui.tree']); |
183 | var courseReportApp = angular.module('courseReportApp', ['ui.tree']); |
166 | GLOBAL_BacoAngularAppDependencies.push('courseReportApp'); |
184 | GLOBAL_BacoAngularAppDependencies.push('courseReportApp'); |
167 | 185 | ||
168 | 186 | ||
169 | courseReportApp.directive('resizable', function () { |
187 | courseReportApp.directive('resizable', function () { |
170 | return { |
188 | return { |
171 | restrict: 'A', |
189 | restrict: 'A', |
172 | scope: { |
190 | scope: { |
173 | callback: '&onResize' |
191 | callback: '&onResize' |
174 | }, |
192 | }, |
175 | link: function postLink(scope, elem, attrs) { |
193 | link: function postLink(scope, elem, attrs) { |
176 | elem.resizable(); |
194 | elem.resizable(); |
177 | elem.on('resize', function (evt, ui, comp) { |
195 | elem.on('resize', function (evt, ui, comp) { |
178 | scope.$apply(function() { |
196 | scope.$apply(function() { |
179 | if (scope.callback) { |
197 | if (scope.callback) { |
180 | scope.callback({$evt: evt, $ui: ui, $comp: comp }); |
198 | scope.callback({$evt: evt, $ui: ui, $comp: comp }); |
181 | } |
199 | } |
182 | }) |
200 | }) |
183 | }); |
201 | }); |
184 | } |
202 | } |
185 | }; |
203 | }; |
186 | }); |
204 | }); |
187 | 205 | ||
188 | 206 | ||
189 | courseReportApp.controller('courseReportAppController', function($scope) |
207 | courseReportApp.controller('courseReportAppController', function($scope) |
190 | { |
208 | { |
191 | 209 | ||
192 | $scope.docAppSelector = "#courseReportApp"; |
210 | $scope.docAppSelector = "#courseReportApp"; |
193 | $scope.report = <%=courseReportJson%> |
211 | $scope.report = ${courseReportJson} |
194 | 212 | ||
195 | $scope.resize = function(evt,ui,comp) { |
213 | $scope.resize = function(evt,ui,comp) { |
196 | //console.log (evt,ui); |
214 | //console.log (evt,ui); |
197 | comp.width = ui.size.width; |
215 | comp.width = ui.size.width; |
198 | comp.height = ui.size.height; |
216 | comp.height = ui.size.height; |
199 | } |
217 | } |
200 | 218 | ||
201 | /** |
219 | /** |
202 | * @classe class to match |
220 | * @classe class to match |
203 | * @superClasses array of strings |
221 | * @superClasses array of strings |
204 | * */ |
222 | * */ |
205 | $scope.contains = function(obj,classe) |
223 | $scope.contains = function(obj,classe) |
206 | { |
224 | { |
207 | if(obj['@class'] && obj['@class'] == classe) |
225 | if(obj['@class'] && obj['@class'] == classe) |
208 | return true; |
226 | return true; |
209 | if(obj.allSuperClasses) |
227 | if(obj.allSuperClasses) |
210 | { |
228 | { |
211 | for(var i in obj.allSuperClasses) |
229 | for(var i in obj.allSuperClasses) |
212 | { |
230 | { |
213 | if(classe == obj.allSuperClasses[i]) |
231 | if(classe == obj.allSuperClasses[i]) |
214 | return true; |
232 | return true; |
215 | } |
233 | } |
216 | } |
234 | } |
217 | return false; |
235 | return false; |
218 | } |
236 | } |
219 | 237 | ||
220 | $scope.showSep = function(section,subSection) |
238 | $scope.showSep = function(section,subSection) |
221 | { |
239 | { |
222 | var s; |
240 | var s; |
223 | for(s in section.sections) |
241 | for(s in section.sections) |
224 | { |
242 | { |
225 | section.sections[s].active = false; |
243 | section.sections[s].active = false; |
226 | } |
244 | } |
227 | /*$(".separatorSectionNav").each(function() |
245 | /*$(".separatorSectionNav").each(function() |
228 | { |
246 | { |
229 | angular.element($(this)).scope().section.active = false; |
247 | angular.element($(this)).scope().section.active = false; |
230 | });*/ |
248 | });*/ |
231 | subSection.active = true; |
249 | subSection.active = true; |
232 | } |
250 | } |
233 | 251 | ||
234 | /** |
252 | /** |
235 | * Este metodo devolve o template mais profundo na hierarquia de classes |
253 | * Este metodo devolve o template mais profundo na hierarquia de classes |
236 | * permitindo emular o override, quanto mais especifica for a classe |
254 | * permitindo emular o override, quanto mais especifica for a classe |
237 | * e caso exista template é esse o template devolvido |
255 | * e caso exista template é esse o template devolvido |
238 | * procura um script com o id da classe e se nao existir |
256 | * procura um script com o id da classe e se nao existir |
239 | * vai subindo nas super classes |
257 | * vai subindo nas super classes |
240 | * @param obj |
258 | * @param obj |
241 | * @returns {*} |
259 | * @returns {*} |
242 | */ |
260 | */ |
243 | $scope.class2id = function(obj) |
261 | $scope.class2id = function(obj) |
244 | { |
262 | { |
245 | var objClassId = obj["@class"].replaceAll(".","_"); |
263 | var objClassId = obj["@class"].replaceAll(".","_"); |
246 | if($("script#" + objClassId).length > 0) |
264 | if($("script#" + objClassId).length > 0) |
247 | { |
265 | { |
248 | return objClassId; |
266 | return objClassId; |
249 | } |
267 | } |
250 | if(obj.allSuperClasses) |
268 | if(obj.allSuperClasses) |
251 | { |
269 | { |
252 | var s; |
270 | var s; |
253 | for(s in obj.allSuperClasses) |
271 | for(s in obj.allSuperClasses) |
254 | { |
272 | { |
255 | var superClass = obj.allSuperClasses[s]; |
273 | var superClass = obj.allSuperClasses[s]; |
256 | var superClassId = superClass.replaceAll(".","_"); |
274 | var superClassId = superClass.replaceAll(".","_"); |
257 | if($("script#" + superClassId).length > 0) |
275 | if($("script#" + superClassId).length > 0) |
258 | { |
276 | { |
259 | return superClassId; |
277 | return superClassId; |
260 | } |
278 | } |
261 | } |
279 | } |
262 | } |
280 | } |
263 | return obj["@class"].replaceAll(".","_"); |
281 | return obj["@class"].replaceAll(".","_"); |
264 | } |
282 | } |
265 | 283 | ||
266 | $scope.addText = function(parentCustomPane) |
284 | $scope.addText = function(parentCustomPane) |
267 | { |
285 | { |
268 | $scope.addSimpleDocComponent(parentCustomPane,"pt.estgp.estgweb.utils.documentBuilder.TextComponent") |
286 | $scope.addSimpleDocComponent(parentCustomPane,"pt.estgp.estgweb.utils.documentBuilder.TextComponent") |
269 | } |
287 | } |
270 | 288 | ||
271 | $scope.addImage = function(parentCustomPane) |
289 | $scope.addImage = function(parentCustomPane) |
272 | { |
290 | { |
273 | $scope.addSimpleDocComponent(parentCustomPane,"pt.estgp.estgweb.utils.documentBuilder.ImageComponent") |
291 | $scope.addSimpleDocComponent(parentCustomPane,"pt.estgp.estgweb.utils.documentBuilder.ImageComponent") |
274 | } |
292 | } |
275 | 293 | ||
276 | $scope.addSimpleDocComponent = function(parentCustomPane,classComponent) |
294 | $scope.addSimpleDocComponent = function(parentCustomPane,classComponent) |
277 | { |
295 | { |
278 | if(!parentCustomPane.components) |
296 | if(!parentCustomPane.components) |
279 | { |
297 | { |
280 | parentCustomPane.components = []; |
298 | parentCustomPane.components = []; |
281 | } |
299 | } |
282 | parentCustomPane.components.push( |
300 | parentCustomPane.components.push( |
283 | { |
301 | { |
284 | "@class" : classComponent |
302 | "@class" : classComponent |
285 | } |
303 | } |
286 | ); |
304 | ); |
287 | } |
305 | } |
288 | $scope.removeComponent = function(index,array) |
306 | $scope.removeComponent = function(index,array) |
289 | { |
307 | { |
290 | array.splice(index,1); |
308 | array.splice(index,1); |
291 | } |
309 | } |
292 | 310 | ||
293 | $scope.callbackUploadedFiles = function(filesUploadResult,token,targetElement) |
311 | $scope.callbackUploadedFiles = function(filesUploadResult,token,targetElement) |
294 | { |
312 | { |
295 | var modelObject = BacoAngularUtils.getAngularElementModel(targetElement); |
313 | var modelObject = BacoAngularUtils.getAngularElementModel(targetElement); |
296 | 314 | ||
297 | if(modelObject.image && modelObject.image.identifier) |
315 | if(modelObject.image && modelObject.image.identifier) |
298 | { |
316 | { |
299 | widgetCallWithActionParameters( |
317 | widgetCallWithActionParameters( |
300 | "<%=request.getContextPath()%>/user/json/repository.do", |
318 | "<%=request.getContextPath()%>/user/json/repository.do", |
301 | "replaceRepositoryFileFromTempPrivateDomain", |
319 | "replaceRepositoryFileFromTempPrivateDomain", |
302 | { |
320 | { |
303 | "identifier" : modelObject.image.identifier, |
321 | "identifier" : modelObject.image.identifier, |
304 | "fileUploaded" : BacoJS.stringifyOrdered(filesUploadResult.uploadedFiles[0]) |
322 | "fileUploaded" : BacoJS.stringifyOrdered(filesUploadResult.uploadedFiles[0]) |
305 | }, |
323 | }, |
306 | "#courseReportApp", |
324 | "#courseReportApp", |
307 | function(repositoryFile4JsonView) |
325 | function(repositoryFile4JsonView) |
308 | { |
326 | { |
309 | modelObject.image = repositoryFile4JsonView; |
327 | modelObject.image = repositoryFile4JsonView; |
310 | //image URL is generated on reimport just to avoid caching |
328 | //image URL is generated on reimport just to avoid caching |
311 | modelObject.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + modelObject.image.identifier + "?" + new Date().getTime(); |
329 | modelObject.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + modelObject.image.identifier + "?" + new Date().getTime(); |
312 | angular.element($("#courseReportApp")).scope().$apply(); |
330 | angular.element($("#courseReportApp")).scope().$apply(); |
313 | }, |
331 | }, |
314 | function(){} |
332 | function(){} |
315 | ); |
333 | ); |
316 | } |
334 | } |
317 | else |
335 | else |
318 | { |
336 | { |
319 | widgetCallWithActionParameters( |
337 | widgetCallWithActionParameters( |
320 | "<%=request.getContextPath()%>/user/json/repository.do", |
338 | "<%=request.getContextPath()%>/user/json/repository.do", |
321 | "saveRepositoryFileFromTempPrivateDomain", |
339 | "saveRepositoryFileFromTempPrivateDomain", |
322 | { |
340 | { |
323 | "fileUploaded" : BacoJS.stringifyOrdered(filesUploadResult.uploadedFiles[0]) |
341 | "fileUploaded" : BacoJS.stringifyOrdered(filesUploadResult.uploadedFiles[0]) |
324 | }, |
342 | }, |
325 | "#courseReportApp", |
343 | "#courseReportApp", |
326 | function(repositoryFile4JsonView) |
344 | function(repositoryFile4JsonView) |
327 | { |
345 | { |
328 | modelObject.image = repositoryFile4JsonView; |
346 | modelObject.image = repositoryFile4JsonView; |
329 | modelObject.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + modelObject.image.identifier + "?" + new Date().getTime(); |
347 | modelObject.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + modelObject.image.identifier + "?" + new Date().getTime(); |
330 | angular.element($("#courseReportApp")).scope().$apply(); |
348 | angular.element($("#courseReportApp")).scope().$apply(); |
331 | }, |
349 | }, |
332 | function(){} |
350 | function(){} |
333 | ); |
351 | ); |
334 | } |
352 | } |
335 | } |
353 | } |
336 | 354 | ||
337 | $scope.Save = function () { |
355 | $scope.Save = function () { |
338 | widgetCallWithActionParameters( |
356 | widgetCallWithActionParameters( |
339 | "<%=request.getContextPath()%>/user/courseReport.do", |
357 | "<%=request.getContextPath()%>/user/courseReport.do", |
340 | "saveCourseReportDocument", |
358 | "saveCourseReportDocument", |
341 | { |
359 | { |
342 | "courseReportDocument":BacoJS.stringifyOrdered($scope.report) |
360 | "courseReportDocument":BacoJS.stringifyOrdered($scope.report) |
343 | }, |
361 | }, |
344 | "#courseReportApp", |
362 | "#courseReportApp", |
345 | function(json) |
363 | function(json) |
346 | { |
364 | { |
347 | alert(BacoJS.stringifyOrdered(json)); |
365 | alert(BacoJS.stringifyOrdered(json)); |
348 | }, |
366 | }, |
349 | function(){} |
367 | function(){} |
350 | ); |
368 | ); |
351 | } |
369 | } |
352 | 370 | ||
353 | 371 | ||
354 | }); |
372 | }); |
355 | </script> |
373 | </script> |
356 | 374 | ||
357 | <!--TEMPLATES FOR DOCUMENT BUILDER--> |
375 | <!--TEMPLATES FOR DOCUMENT BUILDER--> |
358 | <jsp:include page="../utils/documentsBuilder.jsp"/> |
376 | <jsp:include page="../utils/documentsBuilder.jsp"/> |
359 | 377 | ||
360 | <div class="form-vertical"> |
378 | <div class="form-vertical"> |
361 | <div id="courseReportApp" ng-app="courseReportApp" ng-controller="courseReportAppController"> |
379 | <div id="courseReportApp" ng-app="courseReportApp" ng-controller="courseReportAppController"> |
362 | <div class="web-messages"> </div> |
380 | <div class="web-messages"> </div> |
363 | <button class="btn" ng-click="Save()">Save</button> |
381 | <button class="btn" ng-click="Save()">Save</button> |
364 | <div ng-init="section=report;" ng-include="'pt_estgp_estgweb_utils_documentBuilder_DocumentSection'"> |
382 | <div ng-init="section=report;" ng-include="'pt_estgp_estgweb_utils_documentBuilder_DocumentSection'"> |
365 | 383 | ||
366 | </div> |
384 | </div> |
367 | 385 | ||
368 | <!-- <pre class="code">{{ report | json }}</pre>--> |
386 | <!-- <pre class="code">{{ report | json }}</pre>--> |
369 | 387 | ||
370 | 388 | ||
371 | 389 | ||
372 | </div><!--App--> |
390 | </div><!--App--> |
373 | </div> <!--form--> |
391 | </div> <!--form--> |
374 | 392 | ||
375 | </div><!--Panel Body--> |
393 | </div><!--Panel Body--> |
376 | 394 | ||
377 | </div><!--Panel--> |
395 | </div><!--Panel--> |
378 | 396 | ||
379 | </div><!--container-fluid--> |
397 | </div><!--container-fluid--> |
380 | 398 | ||
381 | <% |
399 | <% |
382 | AbstractDao.getCurrentSession().getTransaction().commit(); |
- | |
- | 400 | ||
383 | %> |
401 | %> |
384 | 402 | ||
385 | Generated by GNU Enscript 1.6.5.2. |
403 | Generated by GNU Enscript 1.6.5.2. |
386 | 404 | ||
387 | 405 |