Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/EjercitarWeb
diff options
context:
space:
mode:
authorceci <caggsld@gmail.com>2013-09-22 21:07:47 (GMT)
committer ceci <caggsld@gmail.com>2013-09-22 21:07:47 (GMT)
commit8834331afd8c63710a9adb13639fad02cc2c3bac (patch)
tree493d5c257ba2d870242c56fc2736268760985c54 /EjercitarWeb
parent40f460faf988086df63c948e8afba141dfa41f6c (diff)
Se modifico iniciar curso para persistir pesos de temas y conceptos.
Diffstat (limited to 'EjercitarWeb')
-rw-r--r--EjercitarWeb/WebContent/Tema.jsp4
-rw-r--r--EjercitarWeb/WebContent/iniciar_curso.jsp11
-rw-r--r--EjercitarWeb/WebContent/tema_ed.jsp4
-rw-r--r--EjercitarWeb/src/src/EditarConceptoServlet.java6
-rw-r--r--EjercitarWeb/src/src/EditarTemaServlet.java4
-rw-r--r--EjercitarWeb/src/src/IniciarCursoServlet.java28
6 files changed, 43 insertions, 14 deletions
diff --git a/EjercitarWeb/WebContent/Tema.jsp b/EjercitarWeb/WebContent/Tema.jsp
index 775e646..6ea9814 100644
--- a/EjercitarWeb/WebContent/Tema.jsp
+++ b/EjercitarWeb/WebContent/Tema.jsp
@@ -27,10 +27,10 @@
<input type="text" name="descripcion" id="descripcion"></input>
</p>
- <p>
+ <!-- >p>
<label>Peso:</label>
<input type="text" name="peso" id= "peso">
- </p>
+ </p-->
<p class="nolabel">
<button type="submit" name="Submit"> <img src="css/img/guardar.png" align="middle"/> Guardar </button>
diff --git a/EjercitarWeb/WebContent/iniciar_curso.jsp b/EjercitarWeb/WebContent/iniciar_curso.jsp
index 95e9c91..8f2fb5e 100644
--- a/EjercitarWeb/WebContent/iniciar_curso.jsp
+++ b/EjercitarWeb/WebContent/iniciar_curso.jsp
@@ -45,6 +45,7 @@
if(total != 1){
document.getElementById("total_temas").style.background="#DC2D2D";
+ document.getElementById('temas_img').src="css/img/delete.png";
}else if (total == 1){
document.getElementById("total_temas").style.background="#71FC9A";
document.getElementById('temas_img').src="css/img/guardar.png";
@@ -72,6 +73,8 @@
var imgTem = "tema_"+id_tema;
if(total != 1){
document.getElementById(idt).style.background="#FE2E2E";
+ document.getElementById('temas_img').src="css/img/delete.png";
+
}else if (total == 1){
document.getElementById(idt).style.background="#71FC9A";
document.getElementById(imgTem).src="css/img/guardar.png";
@@ -88,7 +91,7 @@
<div id= "content">
<form style="width: 1071px; height: 521px;" method="post" name="form">
<div id="accordion">
- <h3>Temas <img src="css/img/agregar.png" id="temas_img"></h3>
+ <h3>Temas <img src="css/img/delete.png" id="temas_img"></h3>
<div>
<p>
@@ -106,7 +109,7 @@
<tr>
<td ><a > <%= tema.getNombre() %></a> </td>
- <td><input type="text" name="peso" id= "peso_<%=cont %>" onChange='totalTemas(<%=temaList.size() %>)'/></td>
+ <td><input type="text" name= "peso_<%=cont %>" id= "peso_<%=cont %>" onChange='totalTemas(<%=temaList.size() %>)'/></td>
</tr>
<% cont = cont + 1; %>
@@ -124,7 +127,7 @@
<%for(Tema tema : temaList) {%>
<% int cant_concepto = 0;%>
- <h3>Tema: <%= tema.getNombre() %> <img src="css/img/agregar.png" id="tema_<%=cant_tema%>"> </h3>
+ <h3>Tema: <%= tema.getNombre() %> <img src="css/img/delete.png" id="tema_<%=cant_tema%>"> </h3>
<table>
<thead>
<tr>
@@ -136,7 +139,7 @@
<%for(Concepto concepto : tema.getConceptoList()) {%>
<tr>
<td><a > <%= concepto.getNombre()%></a> </td>
- <td><input type="text" name="cpeso" id= "cpeso_<%=cant_concepto %>_t_<%=cant_tema%>" onChange='totalConceptos(<%=tema.getConceptoList().size() %>,<%=cant_tema%>)'/></td>
+ <td><input type="text" name="cpeso_<%=cant_concepto %>_t_<%=cant_tema%>" id= "cpeso_<%=cant_concepto %>_t_<%=cant_tema%>" onChange='totalConceptos(<%=tema.getConceptoList().size() %>,<%=cant_tema%>)'/></td>
</tr>
diff --git a/EjercitarWeb/WebContent/tema_ed.jsp b/EjercitarWeb/WebContent/tema_ed.jsp
index 8cb49e6..f0a60c9 100644
--- a/EjercitarWeb/WebContent/tema_ed.jsp
+++ b/EjercitarWeb/WebContent/tema_ed.jsp
@@ -34,10 +34,10 @@
<input type="hidden" name="asignatura" id="asignatura" value=<%= request.getParameter("asignatura") %>>
</p>
- <p>
+ <!-- p>
<label>Peso:</label>
<input type="text" name="peso" id= "peso" value=<%= tema.getPeso() %> <% if(asignatura.getIniciado()==true){ %>disabled <%} %> >
- </p>
+ </p-->
<p class="nolabel">
<% if(asignatura.getIniciado()!=true) {%>
<button type="submit" name="Submit"> <img src="css/img/guardar.png" align="middle"/> Guardar </button>
diff --git a/EjercitarWeb/src/src/EditarConceptoServlet.java b/EjercitarWeb/src/src/EditarConceptoServlet.java
index 1cda12f..e3e217a 100644
--- a/EjercitarWeb/src/src/EditarConceptoServlet.java
+++ b/EjercitarWeb/src/src/EditarConceptoServlet.java
@@ -83,7 +83,7 @@ public class EditarConceptoServlet extends HttpServlet {
String adivinanza = request.getParameter("adivinanza");
String apriori = request.getParameter("a_priori");
String descuido = request.getParameter("descuido");
- String peso = request.getParameter("peso");
+ //String peso = request.getParameter("peso");
String descripcion = request.getParameter("descripcion");
String nombre = request.getParameter("nombre");
int idProfesor = Integer.valueOf(request.getParameter("profesor"));
@@ -91,7 +91,7 @@ public class EditarConceptoServlet extends HttpServlet {
concepto.setAdivinanza(Double.parseDouble(adivinanza));
concepto.setApriori(Double.parseDouble(apriori));
concepto.setDescuido(Double.parseDouble(descuido));
- concepto.setPeso(Double.valueOf(peso));
+ //concepto.setPeso(Double.valueOf(peso));
concepto.setDescripcion(descripcion);
concepto.setNombre(nombre);
@@ -101,7 +101,7 @@ public class EditarConceptoServlet extends HttpServlet {
Tema tema = em.find(Tema.class, idTema);
concepto.setTema(tema);
- abr.editarConcepto(concepto);
+ abr.editarConcepto(concepto,asignatura);
}
diff --git a/EjercitarWeb/src/src/EditarTemaServlet.java b/EjercitarWeb/src/src/EditarTemaServlet.java
index ea34d24..a9ee13a 100644
--- a/EjercitarWeb/src/src/EditarTemaServlet.java
+++ b/EjercitarWeb/src/src/EditarTemaServlet.java
@@ -76,8 +76,8 @@ public class EditarTemaServlet extends HttpServlet {
tema.setDescripcion(request.getParameter("enunciado"));
tema.setNombre(request.getParameter("nombre"));
- Double peso = Double.valueOf(request.getParameter("peso"));
- tema.setPeso(peso);
+ /*Double peso = Double.valueOf(request.getParameter("peso"));
+ tema.setPeso(peso);*/
int idProfesor = Integer.valueOf(request.getParameter("profesor"));
Profesor profesor = em.find(Profesor.class, idProfesor);
diff --git a/EjercitarWeb/src/src/IniciarCursoServlet.java b/EjercitarWeb/src/src/IniciarCursoServlet.java
index 5089e36..2a1d4c9 100644
--- a/EjercitarWeb/src/src/IniciarCursoServlet.java
+++ b/EjercitarWeb/src/src/IniciarCursoServlet.java
@@ -73,7 +73,33 @@ public class IniciarCursoServlet extends HttpServlet {
//falta validar los montos
int idAsignatura= Integer.valueOf(request.getParameter("asignatura"));
Asignatura asignatura = em.find(Asignatura.class, idAsignatura);
-
+ int cant_tema=0;
+ int cant_concep=0;
+ List<Tema> temas = em.createQuery("Select e from Tema e where e.asignatura = :asignatura")
+ .setParameter("asignatura", asignatura).getResultList();
+
+ for (Tema tema: temas){
+
+ System.out.print("valoooorrrrrrrrrrrr peso_"+cant_tema);
+ Double peso= Double.valueOf(request.getParameter("peso_"+cant_tema));
+
+
+ tema.setPeso(peso);
+ abr.editarTema(tema);
+
+ for(Concepto concepto: tema.getConceptoList()){
+
+
+ System.out.print("valoooo############### cpeso_"+cant_concep+"_t_"+cant_tema);
+ Double peso_concepto= Double.valueOf(request.getParameter("cpeso_"+cant_concep+"_t_"+cant_tema));
+ cant_concep ++;
+ concepto.setPeso(peso_concepto);
+ abr.editarConcepto(concepto, request.getParameter("asignatura"));
+
+ }
+ cant_tema++;
+ }
+
abr.calcularProbabilidades(idAsignatura);
abr.crearRedAlumnos(idAsignatura);