Rev 1863 | Rev 1935 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1863 | Rev 1927 | ||
---|---|---|---|
Line 93... | Line 93... | ||
93 | </script> |
93 | </script> |
94 | 94 | ||
95 | <% |
95 | <% |
96 | 96 | ||
97 | String courseCode = request.getParameter("courseCode"); |
97 | String courseCode = request.getParameter("courseCode"); |
- | 98 | String year = request.getParameter("year"); |
|
98 | AbstractDao.getCurrentSession().beginTransaction(); |
99 | AbstractDao.getCurrentSession().beginTransaction(); |
99 | CourseImpl courseImpl = DaoFactory.getCourseDaoImpl().findCourseByCode(courseCode); |
100 | CourseImpl courseImpl = DaoFactory.getCourseDaoImpl().findCourseByCode(courseCode); |
100 | request.setAttribute("course",courseImpl); |
101 | request.setAttribute("course",courseImpl); |
101 | CourseReportDocument courseReport = null; |
102 | CourseReportDocument courseReport = null; |
102 | try { |
103 | try { |
103 | courseReport = new CourseReportServices().createNewCourseReportDocument("44", "201617"); |
104 | courseReport = new CourseReportServices().createNewCourseReportDocument(courseCode, year); |
104 | } catch (Throwable e) { |
105 | } catch (Throwable e) { |
105 | System.out.println(e); |
106 | System.out.println(e); |
106 | e.printStackTrace(); |
107 | e.printStackTrace(); |
107 | } |
108 | } |
108 | String courseReportJson = courseReport.toJson(); |
109 | String courseReportJson = courseReport.toJson(); |
Line 139... | Line 140... | ||
139 | 140 | ||
140 | 141 | ||
141 | <script> |
142 | <script> |
142 | 143 | ||
143 | //Especifico da aplicacao |
144 | //Especifico da aplicacao |
144 | var courseReportApp = angular.module('courseReportApp', []); |
145 | var courseReportApp = angular.module('courseReportApp', ['ui.tree']); |
145 | GLOBAL_BacoAngularAppDependencies.push('courseReportApp'); |
146 | GLOBAL_BacoAngularAppDependencies.push('courseReportApp'); |
146 | 147 | ||
147 | 148 | ||
148 | courseReportApp.directive('resizable', function () { |
149 | courseReportApp.directive('resizable', function () { |
149 | return { |
150 | return { |
Line 194... | Line 195... | ||
194 | } |
195 | } |
195 | } |
196 | } |
196 | return false; |
197 | return false; |
197 | } |
198 | } |
198 | 199 | ||
199 | $scope.showSep = function(section) |
200 | $scope.showSep = function(section,subSection) |
200 | { |
201 | { |
- | 202 | var s; |
|
- | 203 | for(s in section.sections) |
|
- | 204 | { |
|
- | 205 | section.sections[s].active = false; |
|
- | 206 | } |
|
201 | $(".separatorSectionNav").each(function() |
207 | /*$(".separatorSectionNav").each(function() |
202 | { |
208 | { |
203 | angular.element($(this)).scope().section.active = false; |
209 | angular.element($(this)).scope().section.active = false; |
204 | }); |
210 | });*/ |
205 | section.active = true; |
211 | subSection.active = true; |
206 | - | ||
207 | } |
212 | } |
208 | 213 | ||
- | 214 | /** |
|
- | 215 | * Este metodo devolve o template mais profundo na hierarquia de classes |
|
- | 216 | * permitindo emular o override, quanto mais especifica for a classe |
|
- | 217 | * e caso exista template é esse o template devolvido |
|
- | 218 | * procura um script com o id da classe e se nao existir |
|
- | 219 | * vai subindo nas super classes |
|
- | 220 | * @param obj |
|
- | 221 | * @returns {*} |
|
- | 222 | */ |
|
209 | $scope.class2id = function(obj) |
223 | $scope.class2id = function(obj) |
210 | { |
224 | { |
- | 225 | var objClassId = obj["@class"].replaceAll(".","_"); |
|
- | 226 | if($("script#" + objClassId).length > 0) |
|
- | 227 | { |
|
- | 228 | return objClassId; |
|
- | 229 | } |
|
- | 230 | if(obj.allSuperClasses) |
|
- | 231 | { |
|
- | 232 | var s; |
|
- | 233 | for(s in obj.allSuperClasses) |
|
- | 234 | { |
|
- | 235 | var superClass = obj.allSuperClasses[s]; |
|
- | 236 | var superClassId = superClass.replaceAll(".","_"); |
|
- | 237 | if($("script#" + superClassId).length > 0) |
|
- | 238 | { |
|
- | 239 | return superClassId; |
|
- | 240 | } |
|
- | 241 | } |
|
- | 242 | } |
|
211 | return obj["@class"].replaceAll(".","_"); |
243 | return obj["@class"].replaceAll(".","_"); |
212 | } |
244 | } |
213 | 245 | ||
214 | $scope.addText = function(parentCustomPane) |
246 | $scope.addText = function(parentCustomPane) |
215 | { |
247 | { |
Line 234... | Line 266... | ||
234 | ); |
266 | ); |
235 | } |
267 | } |
236 | $scope.removeComponent = function(index,array) |
268 | $scope.removeComponent = function(index,array) |
237 | { |
269 | { |
238 | array.splice(index,1); |
270 | array.splice(index,1); |
239 | - | ||
240 | - | ||
241 | } |
271 | } |
- | 272 | ||
242 | $scope.callbackUploadedFiles = function(filesUploadResult,token,targetElement) |
273 | $scope.callbackUploadedFiles = function(filesUploadResult,token,targetElement) |
243 | { |
274 | { |
244 | var modelObject = BacoAngularUtils.getAngularElementModel(targetElement); |
275 | var modelObject = BacoAngularUtils.getAngularElementModel(targetElement); |
245 | modelObject.filesUploadResult = filesUploadResult; |
- | |
- | 276 | ||
246 | if(modelObject.image && modelObject.image.identifier) |
277 | if(modelObject.image && modelObject.image.identifier) |
247 | { |
278 | { |
248 | widgetCallWithActionParameters( |
279 | widgetCallWithActionParameters( |
249 | "<%=request.getContextPath()%>/user/json/repository.do", |
280 | "<%=request.getContextPath()%>/user/json/repository.do", |
250 | "replaceRepositoryFileFromTempPrivateDomain", |
281 | "replaceRepositoryFileFromTempPrivateDomain", |
Line 254... | Line 285... | ||
254 | }, |
285 | }, |
255 | "#courseReportApp", |
286 | "#courseReportApp", |
256 | function(repositoryFile4JsonView) |
287 | function(repositoryFile4JsonView) |
257 | { |
288 | { |
258 | modelObject.image = repositoryFile4JsonView; |
289 | modelObject.image = repositoryFile4JsonView; |
- | 290 | //image URL is generated on reimport just to avoid caching |
|
259 | modelObject.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + modelObject.image.identifier + "?" + new Date().getTime(); |
291 | modelObject.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + modelObject.image.identifier + "?" + new Date().getTime(); |
260 | delete modelObject.filesUploadResult; |
- | |
261 | angular.element($("#courseReportApp")).scope().$apply(); |
292 | angular.element($("#courseReportApp")).scope().$apply(); |
262 | }, |
293 | }, |
263 | function(){} |
294 | function(){} |
264 | ); |
295 | ); |
265 | } |
296 | } |
Line 274... | Line 305... | ||
274 | "#courseReportApp", |
305 | "#courseReportApp", |
275 | function(repositoryFile4JsonView) |
306 | function(repositoryFile4JsonView) |
276 | { |
307 | { |
277 | modelObject.image = repositoryFile4JsonView; |
308 | modelObject.image = repositoryFile4JsonView; |
278 | modelObject.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + modelObject.image.identifier + "?" + new Date().getTime(); |
309 | modelObject.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + modelObject.image.identifier + "?" + new Date().getTime(); |
279 | delete modelObject.filesUploadResult; |
- | |
280 | angular.element($("#courseReportApp")).scope().$apply(); |
310 | angular.element($("#courseReportApp")).scope().$apply(); |
281 | }, |
311 | }, |
282 | function(){} |
312 | function(){} |
283 | ); |
313 | ); |
284 | } |
314 | } |
285 | } |
315 | } |
286 | 316 | ||
287 | 317 | ||
- | 318 | ||
- | 319 | ||
288 | }); |
320 | }); |
289 | </script> |
321 | </script> |
290 | 322 | ||
291 | <!--TEMPLATES FOR DOCUMENT BUILDER--> |
323 | <!--TEMPLATES FOR DOCUMENT BUILDER--> |
292 | <jsp:include page="../utils/documentsBuilder.jsp"/> |
324 | <jsp:include page="../utils/documentsBuilder.jsp"/> |
- | 325 | <jsp:include page="coursereport/templates.jsp"/> |
|
293 | 326 | ||
294 | <div class="form-vertical"> |
327 | <div class="form-vertical"> |
295 | <div id="courseReportApp" ng-app="courseReportApp" ng-controller="courseReportAppController"> |
328 | <div id="courseReportApp" ng-app="courseReportApp" ng-controller="courseReportAppController"> |
296 | 329 | ||
297 | - | ||
298 | <ul class="nav nav-tabs"> |
- | |
299 | <li ng-model="section" class="separatorSectionNav" ng-class="{ active: section.active}" ng-repeat="section in report.sections"> |
330 | <div ng-init="section=report;" ng-include="'pt_estgp_estgweb_utils_documentBuilder_DocumentSection'"> |
300 | <a ng-click="showSep(section)">{{section.title}}</a> |
- | |
301 | </li> |
- | |
302 | </ul> |
- | |
303 | - | ||
304 | - | ||
305 | - | ||
306 | <!--DocumentSection--> |
- | |
307 | <div ng-model="section" ng-class="{ hidden: !section.active}" ng-repeat="section in report.sections" class="separatorSection clearfix"> |
- | |
308 | - | ||
309 | <div ng-repeat="comp in section.components" ng-include="class2id(comp)"> |
- | |
310 | 331 | ||
311 | </div> |
332 | </div> |
312 | 333 | ||
- | 334 | <!-- <pre class="code">{{ report | json }}</pre>--> |
|
313 | 335 | ||
314 | </div> |
- | |
315 | <!--/DocumentSection--> |
- | |
316 | - | ||
317 | <%-- |
- | |
318 | <pre class="code">{{ report | json }}</pre> |
- | |
319 | --%> |
- | |
320 | 336 | ||
321 | 337 | ||
322 | </div><!--App--> |
338 | </div><!--App--> |
323 | </div> <!--form--> |
339 | </div> <!--form--> |
324 | 340 |