Rev 1873 | Rev 1906 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1873 | Rev 1905 | ||
---|---|---|---|
Line 72... | Line 72... | ||
72 | body += pdfDocument; |
72 | body += pdfDocument; |
73 | body += '\r\n' |
73 | body += '\r\n' |
74 | body += '--' + boundary + '--'; |
74 | body += '--' + boundary + '--'; |
75 | 75 | ||
76 | 76 | ||
77 | - | ||
78 | $.ajax({ |
77 | $.ajax({ |
79 | type: "POST", |
78 | type: "POST", |
80 | cache: false, |
79 | cache: false, |
81 | url: "<%=request.getContextPath()%>/filesUpload", |
80 | url: "<%=request.getContextPath()%>/filesUpload", |
82 | data: body , |
81 | data: body, |
Line 114... | Line 113... | ||
114 | <%--<a href="javascript:demoFromHTML()" class="button">Run Code</a>--%> |
113 | <%--<a href="javascript:demoFromHTML()" class="button">Run Code</a>--%> |
115 | 114 | ||
116 | <div class="container-fluid"> |
115 | <div class="container-fluid"> |
117 | 116 | ||
118 | <style> |
117 | <style> |
119 | .separatorSection |
118 | .separatorSection { |
120 | { |
- | |
121 | border: 1px solid #ddd; |
119 | border: 1px solid #ddd; |
122 | } |
120 | } |
123 | </style> |
121 | </style> |
124 | 122 | ||
125 | 123 | ||
Line 135... | Line 133... | ||
135 | <p><b class="label-info">Ano Lectivo:</b> ${course.importYear}</p> |
133 | <p><b class="label-info">Ano Lectivo:</b> ${course.importYear}</p> |
136 | <p><b class="label-info">Departamento:</b> ${course.department.name}</p> |
134 | <p><b class="label-info">Departamento:</b> ${course.department.name}</p> |
137 | <p><b class="label-info">Escola:</b> ${course.department.courseSchool.name}</p> |
135 | <p><b class="label-info">Escola:</b> ${course.department.courseSchool.name}</p> |
138 | 136 | ||
139 | 137 | ||
140 | - | ||
141 | - | ||
142 | <script> |
138 | <script> |
143 | 139 | ||
144 | //Especifico da aplicacao |
140 | //Especifico da aplicacao |
145 | var courseReportApp = angular.module('courseReportApp', ['ui.tree']); |
141 | var courseReportApp = angular.module('courseReportApp', ['ui.tree']); |
146 | GLOBAL_BacoAngularAppDependencies.push('courseReportApp'); |
142 | GLOBAL_BacoAngularAppDependencies.push('courseReportApp'); |
Line 164... | Line 160... | ||
164 | } |
160 | } |
165 | }; |
161 | }; |
166 | }); |
162 | }); |
167 | 163 | ||
168 | 164 | ||
169 | courseReportApp.controller('courseReportAppController', function($scope) |
165 | courseReportApp.controller('courseReportAppController', function ($scope) { |
170 | { |
- | |
171 | 166 | ||
172 | $scope.docAppSelector = "#courseReportApp"; |
167 | $scope.docAppSelector = "#courseReportApp"; |
173 | $scope.report = <%=courseReportJson%> |
168 | $scope.report = <%=courseReportJson%> |
174 | 169 | ||
175 | $scope.resize = function(evt,ui,comp) { |
170 | $scope.resize = function (evt, ui, comp) { |
Line 180... | Line 175... | ||
180 | 175 | ||
181 | /** |
176 | /** |
182 | * @classe class to match |
177 | * @classe class to match |
183 | * @superClasses array of strings |
178 | * @superClasses array of strings |
184 | * */ |
179 | * */ |
185 | $scope.contains = function(obj,classe) |
180 | $scope.contains = function (obj, classe) { |
186 | { |
- | |
187 | if(obj['@class'] && obj['@class'] == classe) |
181 | if (obj['@class'] && obj['@class'] == classe) |
188 | return true; |
182 | return true; |
189 | if(obj.allSuperClasses) |
183 | if (obj.allSuperClasses) { |
190 | { |
- | |
191 | for(var i in obj.allSuperClasses) |
184 | for (var i in obj.allSuperClasses) { |
192 | { |
- | |
193 | if(classe == obj.allSuperClasses[i]) |
185 | if (classe == obj.allSuperClasses[i]) |
194 | return true; |
186 | return true; |
195 | } |
187 | } |
196 | } |
188 | } |
197 | return false; |
189 | return false; |
198 | } |
190 | } |
199 | 191 | ||
200 | $scope.showSep = function(section,subSection) |
192 | $scope.showSep = function (section, subSection) { |
201 | { |
- | |
202 | var s; |
193 | var s; |
203 | for(s in section.sections) |
194 | for (s in section.sections) { |
204 | { |
- | |
205 | section.sections[s].active = false; |
195 | section.sections[s].active = false; |
206 | } |
196 | } |
207 | /*$(".separatorSectionNav").each(function() |
197 | /*$(".separatorSectionNav").each(function() |
208 | { |
198 | { |
209 | angular.element($(this)).scope().section.active = false; |
199 | angular.element($(this)).scope().section.active = false; |
Line 218... | Line 208... | ||
218 | * procura um script com o id da classe e se nao existir |
208 | * procura um script com o id da classe e se nao existir |
219 | * vai subindo nas super classes |
209 | * vai subindo nas super classes |
220 | * @param obj |
210 | * @param obj |
221 | * @returns {*} |
211 | * @returns {*} |
222 | */ |
212 | */ |
223 | $scope.class2id = function(obj) |
213 | $scope.class2id = function (obj) { |
224 | { |
- | |
225 | var objClassId = obj["@class"].replaceAll(".","_"); |
214 | var objClassId = obj["@class"].replaceAll(".", "_"); |
226 | if($("script#" + objClassId).length > 0) |
215 | if ($("script#" + objClassId).length > 0) { |
227 | { |
- | |
228 | return objClassId; |
216 | return objClassId; |
229 | } |
217 | } |
230 | if(obj.allSuperClasses) |
218 | if (obj.allSuperClasses) { |
231 | { |
- | |
232 | var s; |
219 | var s; |
233 | for(s in obj.allSuperClasses) |
220 | for (s in obj.allSuperClasses) { |
234 | { |
- | |
235 | var superClass = obj.allSuperClasses[s]; |
221 | var superClass = obj.allSuperClasses[s]; |
236 | var superClassId = superClass.replaceAll(".","_"); |
222 | var superClassId = superClass.replaceAll(".", "_"); |
237 | if($("script#" + superClassId).length > 0) |
223 | if ($("script#" + superClassId).length > 0) { |
238 | { |
- | |
239 | return superClassId; |
224 | return superClassId; |
240 | } |
225 | } |
241 | } |
226 | } |
242 | } |
227 | } |
243 | return obj["@class"].replaceAll(".","_"); |
228 | return obj["@class"].replaceAll(".", "_"); |
244 | } |
229 | } |
245 | 230 | ||
246 | $scope.addText = function(parentCustomPane) |
231 | $scope.addText = function (parentCustomPane) { |
247 | { |
- | |
248 | $scope.addSimpleDocComponent(parentCustomPane,"pt.estgp.estgweb.utils.documentBuilder.TextComponent") |
232 | $scope.addSimpleDocComponent(parentCustomPane, "pt.estgp.estgweb.utils.documentBuilder.TextComponent") |
249 | } |
233 | } |
250 | 234 | ||
251 | $scope.addImage = function(parentCustomPane) |
235 | $scope.addImage = function (parentCustomPane) { |
252 | { |
- | |
253 | $scope.addSimpleDocComponent(parentCustomPane,"pt.estgp.estgweb.utils.documentBuilder.ImageComponent") |
236 | $scope.addSimpleDocComponent(parentCustomPane, "pt.estgp.estgweb.utils.documentBuilder.ImageComponent") |
254 | } |
237 | } |
255 | 238 | ||
256 | $scope.addSimpleDocComponent = function(parentCustomPane,classComponent) |
239 | $scope.addSimpleDocComponent = function (parentCustomPane, classComponent) { |
257 | { |
- | |
258 | if(!parentCustomPane.components) |
240 | if (!parentCustomPane.components) { |
259 | { |
- | |
260 | parentCustomPane.components = []; |
241 | parentCustomPane.components = []; |
261 | } |
242 | } |
262 | parentCustomPane.components.push( |
243 | parentCustomPane.components.push( |
263 | { |
244 | { |
264 | "@class" : classComponent |
245 | "@class": classComponent |
265 | } |
246 | } |
266 | ); |
247 | ); |
267 | } |
248 | } |
268 | $scope.removeComponent = function(index,array) |
249 | $scope.removeComponent = function (index, array) { |
269 | { |
- | |
270 | array.splice(index,1); |
250 | array.splice(index, 1); |
271 | } |
251 | } |
272 | 252 | ||
273 | $scope.callbackUploadedFiles = function(filesUploadResult,token,targetElement) |
253 | $scope.callbackUploadedFiles = function (filesUploadResult, token, targetElement) { |
274 | { |
- | |
275 | var modelObject = BacoAngularUtils.getAngularElementModel(targetElement); |
254 | var modelObject = BacoAngularUtils.getAngularElementModel(targetElement); |
276 | 255 | ||
277 | if(modelObject.image && modelObject.image.identifier) |
256 | if (modelObject.image && modelObject.image.identifier) { |
278 | { |
- | |
279 | widgetCallWithActionParameters( |
257 | widgetCallWithActionParameters( |
280 | "<%=request.getContextPath()%>/user/json/repository.do", |
258 | "<%=request.getContextPath()%>/user/json/repository.do", |
281 | "replaceRepositoryFileFromTempPrivateDomain", |
259 | "replaceRepositoryFileFromTempPrivateDomain", |
282 | { |
260 | { |
283 | "identifier" : modelObject.image.identifier, |
261 | "identifier": modelObject.image.identifier, |
284 | "fileUploaded" : BacoJS.stringifyOrdered(filesUploadResult.uploadedFiles[0]) |
262 | "fileUploaded": BacoJS.stringifyOrdered(filesUploadResult.uploadedFiles[0]) |
285 | }, |
263 | }, |
286 | "#courseReportApp", |
264 | "#courseReportApp", |
287 | function(repositoryFile4JsonView) |
265 | function (repositoryFile4JsonView) { |
288 | { |
- | |
289 | modelObject.image = repositoryFile4JsonView; |
266 | modelObject.image = repositoryFile4JsonView; |
290 | //image URL is generated on reimport just to avoid caching |
267 | //image URL is generated on reimport just to avoid caching |
291 | modelObject.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + modelObject.image.identifier + "?" + new Date().getTime(); |
268 | modelObject.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + modelObject.image.identifier + "?" + new Date().getTime(); |
292 | angular.element($("#courseReportApp")).scope().$apply(); |
269 | angular.element($("#courseReportApp")).scope().$apply(); |
293 | }, |
270 | }, |
294 | function(){} |
271 | function () { |
- | 272 | } |
|
295 | ); |
273 | ); |
296 | } |
274 | } |
297 | else |
275 | else { |
298 | { |
- | |
299 | widgetCallWithActionParameters( |
276 | widgetCallWithActionParameters( |
300 | "<%=request.getContextPath()%>/user/json/repository.do", |
277 | "<%=request.getContextPath()%>/user/json/repository.do", |
301 | "saveRepositoryFileFromTempPrivateDomain", |
278 | "saveRepositoryFileFromTempPrivateDomain", |
302 | { |
279 | { |
303 | "fileUploaded" : BacoJS.stringifyOrdered(filesUploadResult.uploadedFiles[0]) |
280 | "fileUploaded": BacoJS.stringifyOrdered(filesUploadResult.uploadedFiles[0]) |
304 | }, |
281 | }, |
305 | "#courseReportApp", |
282 | "#courseReportApp", |
306 | function(repositoryFile4JsonView) |
283 | function (repositoryFile4JsonView) { |
307 | { |
- | |
308 | modelObject.image = repositoryFile4JsonView; |
284 | modelObject.image = repositoryFile4JsonView; |
309 | modelObject.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + modelObject.image.identifier + "?" + new Date().getTime(); |
285 | modelObject.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + modelObject.image.identifier + "?" + new Date().getTime(); |
310 | angular.element($("#courseReportApp")).scope().$apply(); |
286 | angular.element($("#courseReportApp")).scope().$apply(); |
311 | }, |
287 | }, |
312 | function(){} |
288 | function () { |
- | 289 | } |
|
313 | ); |
290 | ); |
314 | } |
291 | } |
315 | } |
292 | } |
316 | 293 | ||
- | 294 | $scope.save = function () { |
|
- | 295 | widgetCallWithActionParameters( |
|
- | 296 | "<%=request.getContextPath()%>/user/courseReport.do", |
|
- | 297 | "save", |
|
- | 298 | { |
|
- | 299 | "courseReportDocument": BacoJS.stringifyOrdered($scope.report) |
|
- | 300 | }, |
|
- | 301 | "#courseReportApp", |
|
- | 302 | function (resposta) { |
|
317 | 303 | ||
- | 304 | alert(resposta.courseName); |
|
- | 305 | $scope.$apply(); |
|
- | 306 | }, |
|
- | 307 | function () { |
|
- | 308 | } |
|
- | 309 | ); |
|
- | 310 | } |
|
318 | 311 | ||
319 | 312 | ||
320 | }); |
313 | }); |
321 | </script> |
314 | </script> |
322 | 315 | ||
Line 324... | Line 317... | ||
324 | <jsp:include page="../utils/documentsBuilder.jsp"/> |
317 | <jsp:include page="../utils/documentsBuilder.jsp"/> |
325 | <jsp:include page="coursereport/templates.jsp"/> |
318 | <jsp:include page="coursereport/templates.jsp"/> |
326 | 319 | ||
327 | <div class="form-vertical"> |
320 | <div class="form-vertical"> |
328 | <div id="courseReportApp" ng-app="courseReportApp" ng-controller="courseReportAppController"> |
321 | <div id="courseReportApp" ng-app="courseReportApp" ng-controller="courseReportAppController"> |
329 | - | ||
- | 322 | <div class="web-messages"></div> |
|
- | 323 | <button ng-click="save()" class="btn btn-success">Salvar</button> |
|
- | 324 | <div ng-init="section=report;" |
|
330 | <div ng-init="section=report;" ng-include="'pt_estgp_estgweb_utils_documentBuilder_DocumentSection'"> |
325 | ng-include="'pt_estgp_estgweb_utils_documentBuilder_DocumentSection'"> |
331 | 326 | ||
332 | </div> |
327 | </div> |
333 | 328 | ||
334 | <!-- <pre class="code">{{ report | json }}</pre>--> |
329 | <!-- <pre class="code">{{ report | json }}</pre>--> |
335 | 330 | ||
336 | 331 | ||
337 | - | ||
338 | </div><!--App--> |
332 | </div><!--App--> |
339 | </div> <!--form--> |
333 | </div> <!--form--> |
340 | 334 | ||
341 | </div><!--Panel Body--> |
335 | </div><!--Panel Body--> |
342 | 336 | ||
343 | </div><!--Panel--> |
337 | </div><!--Panel--> |
344 | 338 | ||
- | 339 | </div> |
|
345 | </div><!--container-fluid--> |
340 | <!--container-fluid--> |
346 | 341 | ||
347 | <% |
342 | <% |
348 | AbstractDao.getCurrentSession().getTransaction().commit(); |
343 | AbstractDao.getCurrentSession().getTransaction().commit(); |
349 | %> |
344 | %> |
350 | 345 |