Subversion Repositories bacoAlunos

Rev

Rev 1830 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1830 Rev 1848
Line 2... Line 2...
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" %>
-
 
8
<%@ page import="pt.estgp.estgweb.services.courses.coursereport.documentmodel.CourseReportDocument" %>
-
 
9
<%@ page import="org.json.JSONException" %>
7
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
10
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
8
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
11
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
9
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
12
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
10
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
13
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
11
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
14
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
Line 89... Line 92...
89
    }
92
    }
90
</script>
93
</script>
91
 
94
 
92
<%
95
<%
93
 
96
 
94
    Long courseId = Long.parseLong(request.getParameter("courseId"));
97
    String courseCode = request.getParameter("courseCode");
95
    AbstractDao.getCurrentSession().beginTransaction();
98
    AbstractDao.getCurrentSession().beginTransaction();
96
    CourseImpl courseImpl = (CourseImpl) DaoFactory.getCourseDaoImpl().get(courseId);
99
    CourseImpl courseImpl = DaoFactory.getCourseDaoImpl().findCourseByCode(courseCode);
97
    request.setAttribute("course",courseImpl);
100
    request.setAttribute("course",courseImpl);
-
 
101
    CourseReportDocument courseReport = null;
-
 
102
    try {
-
 
103
        courseReport = new CourseReportServices().createNewCourseReportDocument("44", "201617");
-
 
104
    } catch (Throwable e) {
-
 
105
        System.out.println(e);
-
 
106
        e.printStackTrace();
-
 
107
    }
-
 
108
    String courseReportJson = courseReport.toJson();
-
 
109
    request.setAttribute("courseDocumentJson",courseReportJson);
-
 
110
    request.setAttribute("courseDocument",courseReport);
98
 
111
 
99
    String classTextComponent = TextComponent.class.getName();
-
 
100
    String classImageComponent = ImageComponent.class.getName();
-
 
101
    request.setAttribute("classTextComponent",classTextComponent);
-
 
102
    request.setAttribute("classImageComponent",classImageComponent);
-
 
103
%>
112
%>
104
<a href="javascript:demoFromHTML()" class="button">Run Code</a>
113
<%--<a href="javascript:demoFromHTML()" class="button">Run Code</a>--%>
105
 
114
 
106
<div class="container-fluid">
115
<div class="container-fluid">
107
 
116
 
108
    <style>
117
    <style>
109
        .separatorSection
118
        .separatorSection
Line 125... Line 134...
125
            <p><b class="label-info">Ano Lectivo:</b> ${course.importYear}</p>
134
            <p><b class="label-info">Ano Lectivo:</b> ${course.importYear}</p>
126
            <p><b class="label-info">Departamento:</b> ${course.department.name}</p>
135
            <p><b class="label-info">Departamento:</b> ${course.department.name}</p>
127
            <p><b class="label-info">Escola:</b> ${course.department.courseSchool.name}</p>
136
            <p><b class="label-info">Escola:</b> ${course.department.courseSchool.name}</p>
128
 
137
 
129
 
138
 
130
            <script>
-
 
131
                function showSep(id)
-
 
132
                {
-
 
133
                    $(".separatorSectionNav").removeClass("active");
-
 
134
                    $(".separatorSection").hide();
-
 
135
                    $("#separatorSectionNav_" + id).addClass("active");
-
 
136
                    $("#separatorSection_" + id).show();
-
 
137
                }
-
 
138
            </script>
-
 
139
 
-
 
140
            <ul class="nav nav-tabs">
-
 
141
                <li id="separatorSectionNav_introducao" class="active separatorSectionNav"><a href="javascript:showSep('introducao')">1 - Introdução</a></li>
-
 
142
                <li id="separatorSectionNav_mapaUnidades" class="separatorSectionNav"><a href="javascript:showSep('mapaUnidades')">2 - Mapa Síntese </a></li>
-
 
143
                <li id="separatorSectionNav_resultados" class="separatorSectionNav"><a href="javascript:showSep('resultados')">3 - Resultados </a></li>
-
 
144
                <li id="separatorSectionNav_inqueritos" class="separatorSectionNav"><a href="javascript:showSep('inqueritos')">4 - Inquéritos </a></li>
-
 
145
                <li id="separatorSectionNav_conclusoes" class="separatorSectionNav"><a href="javascript:showSep('conclusoes')">4 - Conclusões </a></li>
-
 
146
 
-
 
147
            </ul>
-
 
148
 
-
 
149
 
139
 
150
 
140
 
151
            <script>
141
            <script>
-
 
142
 
152
                //Especifico da aplicacao
143
                //Especifico da aplicacao
153
                var courseReportApp = angular.module('courseReportApp', []);
144
                var courseReportApp = angular.module('courseReportApp', []);
154
                GLOBAL_BacoAngularAppDependencies.push('courseReportApp');
145
                GLOBAL_BacoAngularAppDependencies.push('courseReportApp');
155
 
146
 
156
 
147
 
Line 175... Line 166...
175
 
166
 
176
 
167
 
177
                courseReportApp.controller('courseReportAppController', function($scope)
168
                courseReportApp.controller('courseReportAppController', function($scope)
178
                {
169
                {
179
 
170
 
180
                    $scope.report =
171
                    $scope.docAppSelector = "#courseReportApp";
181
                    {
172
                    $scope.report = <%=courseReportJson%>
182
 
-
 
183
                    }
-
 
184
 
173
 
185
                    $scope.resize = function(evt,ui,comp) {
174
                    $scope.resize = function(evt,ui,comp) {
186
                        //console.log (evt,ui);
175
                        //console.log (evt,ui);
187
                        comp.width = ui.size.width;
176
                        comp.width = ui.size.width;
188
                        comp.height = ui.size.height;
177
                        comp.height = ui.size.height;
189
                    }
178
                    }
190
 
179
 
-
 
180
                    /**
-
 
181
                     * @classe class to match
-
 
182
                     * @superClasses array of strings
-
 
183
                     * */
-
 
184
                    $scope.contains = function(obj,classe)
-
 
185
                    {
-
 
186
                        if(obj['@class'] && obj['@class'] == classe)
-
 
187
                            return true;
-
 
188
                        if(obj.allSuperClasses)
-
 
189
                        {
-
 
190
                            for(var i in obj.allSuperClasses)
-
 
191
                            {
-
 
192
                                if(classe == obj.allSuperClasses[i])
-
 
193
                                    return true;
-
 
194
                            }
-
 
195
                        }
-
 
196
                        return false;
-
 
197
                    }
-
 
198
 
-
 
199
                    $scope.showSep = function(section)
-
 
200
                    {
-
 
201
                        $(".separatorSectionNav").each(function()
-
 
202
                        {
-
 
203
                            angular.element($(this)).scope().section.active = false;
-
 
204
                        });
-
 
205
                        section.active = true;
-
 
206
 
-
 
207
                    }
-
 
208
 
-
 
209
                    $scope.class2id = function(obj)
-
 
210
                    {
-
 
211
                        return obj["@class"].replaceAll(".","_");
-
 
212
                    }
-
 
213
 
191
                    $scope.addText = function(parentCustomPane)
214
                    $scope.addText = function(parentCustomPane)
192
                    {
215
                    {
193
                        $scope.addSimpleDocComponent(parentCustomPane,"${classTextComponent}")
216
                        $scope.addSimpleDocComponent(parentCustomPane,"pt.estgp.estgweb.utils.documentBuilder.TextComponent")
194
                    }
217
                    }
195
 
218
 
196
                    $scope.addImage = function(parentCustomPane)
219
                    $scope.addImage = function(parentCustomPane)
197
                    {
220
                    {
198
                        $scope.addSimpleDocComponent(parentCustomPane,"${classImageComponent}")
221
                        $scope.addSimpleDocComponent(parentCustomPane,"pt.estgp.estgweb.utils.documentBuilder.ImageComponent")
199
                    }
222
                    }
200
 
223
 
201
                    $scope.addSimpleDocComponent = function(parentCustomPane,classComponent)
224
                    $scope.addSimpleDocComponent = function(parentCustomPane,classComponent)
202
                    {
225
                    {
203
                        if(!parentCustomPane.components)
226
                        if(!parentCustomPane.components)
204
                        {
227
                        {
205
                            parentCustomPane.components = [];
228
                            parentCustomPane.components = [];
206
                        }
229
                        }
207
                        parentCustomPane.components.push(
230
                        parentCustomPane.components.push(
208
                                {
231
                                {
209
                                    "@class" : classComponent,
232
                                    "@class" : classComponent
210
                                    "text" : "",
-
 
211
                                    "title" : ""
-
 
212
                                }
233
                                }
213
                        );
234
                        );
214
                    }
235
                    }
215
                    $scope.removeComponent = function(index,array)
236
                    $scope.removeComponent = function(index,array)
216
                    {
237
                    {
Line 264... Line 285...
264
                    }
285
                    }
265
 
286
 
266
 
287
 
267
                });
288
                });
268
            </script>
289
            </script>
269
            <jsp:include page="../utils/documentsBuilder.jsp"/>
-
 
270
 
-
 
271
 
-
 
272
            <div  id="courseReportApp" ng-app="courseReportApp" ng-controller="courseReportAppController" class="form-vertical">
-
 
273
 
290
 
-
 
291
            <!--TEMPLATES FOR DOCUMENT BUILDER-->
-
 
292
            <jsp:include page="../utils/documentsBuilder.jsp"/>
274
 
293
 
275
                <!--Introducao-->
-
 
276
                <div id="separatorSection_introducao" class="separatorSection clearfix">
-
 
277
 
-
 
278
                    <div class="documentSimpleComponent form-group clearfix">
-
 
279
                        <label class="col-md-2 control-label">Texto</label>
-
 
280
                        <div class="col-md-10">
294
            <div class="form-vertical">
281
                            <textarea class="form-control" rows="10" ng-model="report.introSection.textComponent.text">
295
                <div id="courseReportApp" ng-app="courseReportApp" ng-controller="courseReportAppController">
282
 
-
 
283
                            </textarea>
-
 
284
                        </div>
-
 
285
                    </div>
-
 
286
                    <div ng-include="'customPane_renderer.html'"
-
 
287
                         ng-init="report.introSection.customPane = {};customPane = report.introSection.customPane;docAppSelector='#courseReportApp'">
-
 
288
                    </div>
-
 
289
 
296
 
290
 
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">
-
 
300
                            <a ng-click="showSep(section)">{{section.title}}</a>
291
                </div>
301
                        </li>
292
                <!--/Introducao-->
302
                    </ul>
293
 
303
 
294
                <!--Mapa Unidades-->
-
 
295
                <div id="separatorSection_mapaUnidades" class="separatorSection">
-
 
296
 
304
 
297
                </div>
-
 
298
                <!--/Mapa Unidades-->
-
 
299
 
305
 
300
                <!--Resultados-->
306
                    <!--DocumentSection-->
301
                <div id="separatorSection_resultados" class="separatorSection">
307
                    <div ng-model="section" ng-class="{ hidden: !section.active}" ng-repeat="section in report.sections" class="separatorSection clearfix">
302
 
308
 
303
                </div>
-
 
304
                <!--/Resultados-->
309
                       <div ng-repeat="comp in section.components" ng-include="class2id(comp)">
305
 
310
 
306
                <!--Inqueritos-->
311
                        </div>
307
                <div id="separatorSection_inqueritos" class="separatorSection">
-
 
308
 
312
 
309
                </div>
-
 
310
                <!--/Inqueritos-->
-
 
311
 
313
 
312
                <!--Conclusoes-->
314
                    </div>
313
                <div id="separatorSection_conclusoes" class="separatorSection">
315
                    <!--/DocumentSection-->
314
 
316
 
315
                </div>
317
<%--
316
                <!--/Conclusoes-->
318
                    <pre class="code">{{ report | json }}</pre>
-
 
319
--%>
317
 
320
 
318
                <pre class="code">{{ report | json }}</pre>
-
 
319
 
321
 
320
            </div><!--App-->
322
                </div><!--App-->
-
 
323
            </div> <!--form-->
321
 
324
 
322
        </div><!--Panel Body-->
325
        </div><!--Panel Body-->
323
 
326
 
324
    </div><!--Panel-->
327
    </div><!--Panel-->
325
 
328