Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 1927 → Rev 1935

/branches/grupo5/impl/src/java/pt/estgp/estgweb/services/courses/CourseReportServices.java
540,6 → 540,29
return courseReportDocument.toJson();
}
 
public String loadCourseReportDocument (String courseCode,String year,UserSession session) throws IOException
{
 
//Vai buscar (conjunto de anos??) à BaseDados (porquê uma lista)
List<CourseYear> courseYear = DaoFactory.getCourseYearDaoImpl().findCourseYear(courseCode, year);
String courseReport = null;
 
if(courseYear.isEmpty())
{
try {
courseReport = new CourseReportServices().createNewCourseReportDocument(courseCode, year).toJson();
} catch (Throwable e) {
System.out.println(e);
e.printStackTrace();
}
}
else
{
courseReport = courseYear.get(0).getCourseReportDocument();
}
 
return courseReport;
}
/**
*
* Para um determinado curso e ano o serviço faz uma listagem de todas as suas unidades curriculares
/branches/grupo5/impl/src/java/pt/estgp/estgweb/web/controllers/courses/CoursesServicesController.java
52,7 → 52,7
return new JSONObject(json);
}
 
public JSONObject SaveCourseReportDocument(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws Throwable {
public JSONObject saveCourseReportDocument(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws Throwable {
String courseReportDocument = request.getParameter("courseReportDocument");
 
IServiceManager sm = ServiceManager.getInstance();
65,15 → 65,24
 
/* AA 7/12/2017 */
 
public JSONObject saveCourseReportDoc(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws Throwable {
public JSONObject SaveCourseReportDocument(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws Throwable {
 
String courseReportDocument = request.getParameter("courseReportDocument");
 
IServiceManager sm = ServiceManager.getInstance();
String json = (String) sm.execute(RequestUtils.getRequester(request, response),
"SaveCourseReportDoc",
"SaveCourseReportDocument",
new Object[]{courseReportDocument});
return new JSONObject(json);
}
 
public JSONObject loadCourseReportDoc(ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Throwable {
String courseReportDocument = request.getParameter("courseReportDocument");
 
IServiceManager sm = ServiceManager.getInstance();
String json = (String) sm.execute(RequestUtils.getRequester(request, response),
"LoadCourseReportDocument",
new Object[]{courseReportDocument});
return new JSONObject(json);
}
}
/branches/grupo5/impl/src/web/user/courses/courseReportEdit.jsp
93,7 → 93,9
</script>
 
<%
//Falta Chamar Serviço
 
 
String courseCode = request.getParameter("courseCode");
String year = request.getParameter("year");
AbstractDao.getCurrentSession().beginTransaction();
314,9 → 316,23
}
}
 
$scope.Save = function () {
widgetCallWithActionParameters(
"<%=request.getContextPath()%>/user/courseReport.do",
"SaveCourseReportDocument",
{
"courseReportDocument":BacoJS.stringifyOrdered($scope.report)
},
"#courseReportApp",
function(json)
{
alert(BacoJS.stringifyOrdered(json));
},
function(){}
);
}
 
 
 
});
</script>
 
324,9 → 340,11
<jsp:include page="../utils/documentsBuilder.jsp"/>
<jsp:include page="coursereport/templates.jsp"/>
 
 
<div class="form-vertical">
<div id="courseReportApp" ng-app="courseReportApp" ng-controller="courseReportAppController">
 
<div class="web-messages"> </div>
<button ng-click="Save()">Click me</button>
<div ng-init="section=report;" ng-include="'pt_estgp_estgweb_utils_documentBuilder_DocumentSection'">
 
</div>
346,4 → 364,4
 
<%
AbstractDao.getCurrentSession().getTransaction().commit();
%>
%>
/branches/grupo5/impl/src/web/user/utils/documentsBuilder.jsp
1,138 → 1,178
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<style>
.buttonTools
{
border: 1px solid gray;
background-color: lightgray;
padding: 5px;
}
.customComponent
{
padding: 0;
}
.documentSimpleComponent
{
border: 1px solid gray;
padding: 5px;
margin-bottom: 5px;
}
.componentBody
{
border: 1px solid gray;
padding: 5px;
}
</style>
 
 
<%--
customPane Need component customPane in variable customPane
docAppSelector selector usualy an html ID for ng-app example #docReport
--%>
<script type="text/ng-template" id="pt_estgp_estgweb_utils_documentBuilder_CustomPane">
<div class="customComponent clearfix component">
<div class="buttonTools clearfix">
<button class="btn btn-default pullleft" type="button" ng-click="addText(comp)">
<span class="glyphicon glyphicon-plus"></span>
<span class="glyphicon glyphicon-font"></span>
</button>
 
<button class="btn btn-default pullleft" type="button" ng-click="addImage(comp)">
<span class="glyphicon glyphicon-plus"></span>
<span class="glyphicon glyphicon-picture"></span>
</button>
Secção personalizada
</div>
<div class="componentBody">
<div class="clearfix" ng-repeat="subComp in comp.components" ng-init="parent=comp;comp=subComp" ng-include="class2id(subComp)">
 
</div>
<div>
</div>
</script>
 
<script type="text/ng-template" id="pt_estgp_estgweb_utils_documentBuilder_ImageComponent">
<div class="imageComponent component">
<div ng-if="parent['@class']=='pt.estgp.estgweb.utils.documentBuilder.CustomPane'" class="buttonTools clearfix">
<button class="btn btn-danger pull-right" type="button" ng-click="removeComponent($index,parent.components)">
<span class="glyphicon glyphicon-remove"></span>
</button>
<label>Componente de Imagem (Use esta funcinalidade para adicionar gráficos ou tabelas que ache necessárias)</label>
</div>
 
<div class="componentBody" ng-if="comp['@class']=='pt.estgp.estgweb.utils.documentBuilder.ImageComponent'">
<div class="form-group clearfix" ng-if="comp.image.identifier">
<label class="col-md-2 control-label">Legenda</label>
<div class="col-md-10">
<input type="text" class="form-control" rows="10" ng-model="comp.title">
</div>
</div>
<div class="form-group clearfix">
<div class="col-md-2 control-label">
<a class="btn btn-default" href="#" ng-model="comp"
data-title="Escolha Imagem"
data-showmetafields="false"
data-confirmonupload="true"
data-toggle="modal"
data-target="#filesUploadModal"
data-multiple="false"
data-allowed-extensions="jpg,png,gif"
data-callback-target-function="angular.element($('{{docAppSelector}}')).scope().callbackUploadedFiles">
<span ng-if="comp.image.identifier">
Substituir Imagem
</span>
<span ng-if="!(comp.image.identifier)">
Carregar Imagem
</span>
 
<span class="glyphicon glyphicon-upload"/>
 
</a>
</div>
 
<div class="col-md-10">
<div ng-if="!(comp.image.identifier)">
Clique em carregar imagens e escolha uma imagem para adicionar nesta secção.
</div>
 
<label ng-if="comp.image.identifier"> Limites do PDF </label>
<div ng-if="comp.image.identifier" style="text-align: center; width: 595px; border: 1px solid black; padding: 45px">
<center>
<div style="width: 200px;height: 200px; max-width: 500px; max-height: 750px" resizable on-resize="resize($evt, $ui, comp)">
<img style="width: 100%;height: 100%" ng-src="{{comp.imageUrl}}">
</div>
(Se desejar altere o tamanho da imagem arrastando no canto inferior direito)
</center>
</div>
</div>
</div>
</div>
</div>
</script>
 
<script type="text/ng-template" id="pt_estgp_estgweb_utils_documentBuilder_TextComponent">
<div class="textComponent component">
 
<div ng-if="parent['@class']=='pt.estgp.estgweb.utils.documentBuilder.CustomPane'" class="buttonTools clearfix">
<button class="btn btn-danger pull-right" type="button" ng-click="removeComponent($index,parent.components)">
<span class="glyphicon glyphicon-remove"></span>
</button>
<label>Componente de Texto</label>
</div>
<div class="componentBody">
<div ng-if="parent['@class']=='pt.estgp.estgweb.utils.documentBuilder.CustomPane'" class="form-group clearfix">
<label class="col-md-2 control-label">Titulo de Parágrafo</label>
<div class="col-md-10">
<input type="text" class="form-control" rows="10" ng-model="comp.title">
</div>
</div>
<div class="form-group clearfix">
<label class="col-md-2 control-label">Texto</label>
<div class="col-md-10">
<textarea class="form-control" rows="10" ng-model="comp.text">
 
</textarea>
</div>
</div>
</div>
</div>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<style>
.sections
{
padding-left: 20px;
}
.buttonTools
{
border: 1px solid gray;
background-color: lightgray;
padding: 5px;
}
.customComponent
{
padding: 0;
}
.documentSimpleComponent
{
border: 1px solid gray;
padding: 5px;
margin-bottom: 5px;
}
.componentBody
{
border: 1px solid gray;
padding: 5px;
}
</style>
 
<!--Require templateObj-->
<script type="text/ng-template" id="callDocumentTemplate">
 
<div ng-include="class2id(templateObj)"></div>
</script>
 
<%--
customPane Need component customPane in variable customPane
docAppSelector selector usualy an html ID for ng-app example #docReport
--%>
<script type="text/ng-template" id="pt_estgp_estgweb_utils_documentBuilder_CustomPane">
<div class="customComponent clearfix component">
<div class="buttonTools clearfix">
<button class="btn btn-default pullleft" type="button" ng-click="addText(comp)">
<span class="glyphicon glyphicon-plus"></span>
<span class="glyphicon glyphicon-font"></span>
</button>
 
<button class="btn btn-default pullleft" type="button" ng-click="addImage(comp)">
<span class="glyphicon glyphicon-plus"></span>
<span class="glyphicon glyphicon-picture"></span>
</button>
Secção personalizada
</div>
<div class="componentBody">
<div class="clearfix" ng-repeat="subComp in comp.components" ng-init="parent=comp;comp=subComp" ng-include="class2id(subComp)">
 
</div>
<div>
</div>
</div>
</div>
</script>
 
<script type="text/ng-template" id="pt_estgp_estgweb_utils_documentBuilder_ImageComponent">
<div class="imageComponent component">
<div ng-if="parent['@class']=='pt.estgp.estgweb.utils.documentBuilder.CustomPane'" class="buttonTools clearfix">
<button class="btn btn-danger pull-right" type="button" ng-click="removeComponent($index,parent.components)">
<span class="glyphicon glyphicon-remove"></span>
</button>
<label>Componente de Imagem (Use esta funcinalidade para adicionar gráficos ou tabelas que ache necessárias)</label>
</div>
 
<div class="componentBody">
<div class="form-group clearfix" ng-if="comp.image.identifier">
<label class="col-md-2 control-label">Legenda</label>
<div class="col-md-10">
<input type="text" class="form-control" rows="10" ng-model="comp.title">
</div>
</div>
<div class="form-group clearfix">
<div class="col-md-2 control-label">
<a class="btn btn-default" href="#" ng-model="comp"
data-title="Escolha Imagem"
data-showmetafields="false"
data-confirmonupload="true"
data-toggle="modal"
data-target="#filesUploadModal"
data-multiple="false"
data-allowed-extensions="jpg,png,gif"
data-callback-target-function="angular.element($('{{docAppSelector}}')).scope().callbackUploadedFiles">
<span ng-if="comp.image.identifier">
Substituir Imagem
</span>
<span ng-if="!(comp.image.identifier)">
Carregar Imagem
</span>
 
<span class="glyphicon glyphicon-upload"/>
 
</a>
</div>
 
<div class="col-md-10">
<div ng-if="!(comp.image.identifier)">
Clique em carregar imagens e escolha uma imagem para adicionar nesta secção.
</div>
 
<label ng-if="comp.image.identifier"> Limites do PDF </label>
<div ng-if="comp.image.identifier" style="text-align: center; width: 595px; border: 1px solid black; padding: 45px">
<center>
<div style="width: 200px;height: 200px; max-width: 500px; max-height: 750px" resizable on-resize="resize($evt, $ui, comp)">
<img style="width: 100%;height: 100%" ng-src="{{comp.imageUrl}}">
</div>
(Se desejar altere o tamanho da imagem arrastando no canto inferior direito)
</center>
</div>
</div>
</div>
</div>
</div>
</script>
 
<script type="text/ng-template" id="pt_estgp_estgweb_utils_documentBuilder_TextComponent">
<div class="textComponent component">
 
<div ng-if="parent['@class']=='pt.estgp.estgweb.utils.documentBuilder.CustomPane'" class="buttonTools clearfix">
<button class="btn btn-danger pull-right" type="button" ng-click="removeComponent($index,parent.components)">
<span class="glyphicon glyphicon-remove"></span>
</button>
<label>Componente de Texto</label>
</div>
<div class="componentBody">
<div ng-if="parent['@class']=='pt.estgp.estgweb.utils.documentBuilder.CustomPane'" class="form-group clearfix">
<label class="col-md-2 control-label">Titulo de Parágrafo</label>
<div class="col-md-10">
<input type="text" class="form-control" rows="10" ng-model="comp.title">
</div>
</div>
<div class="form-group clearfix">
<label class="col-md-2 control-label">Texto</label>
<div class="col-md-10">
<textarea class="form-control" rows="10" ng-model="comp.text">
 
</textarea>
</div>
</div>
</div>
</div>
</script>
 
<!--
@section objeto com seccoes e componentes
@optional @chapter capitulo do documento para esta seccao para contcatenar às subsections
-->
<script type="text/ng-template" id="pt_estgp_estgweb_utils_documentBuilder_DocumentSection">
<div class="sections">
<ul class="nav nav-tabs">
<li ng-model="section" class="separatorSectionNav"
ng-class="{ active : subSection.active}"
ng-repeat="subSection in section.sections">
<a ng-click="showSep(section,subSection)"> {{$chapter}}{{$index+1}} - {{subSection.title}}</a>
</li>
</ul>
<div ng-model="subSection"
ng-class="{ hidden: !subSection.active }"
ng-repeat="subSection in section.sections"
class="separatorSection clearfix">
<div ng-repeat="comp in subSection.components"
ng-include="class2id(comp)">
 
</div>
<div ng-if="subSection.sections"
ng-init="section=subSection;$chapter=$chapter+($index+1)+'.'"
ng-include="class2id(subSection)">
</div>
</div>
</div>
</script>