Răsfoiți Sursa

Removed use of location and redirect, and fixed gantt colors

Mario Martínez Hernández 4 luni în urmă
părinte
comite
ef4fc4160a

+ 6 - 6
src/main/java/es/uv/saic/dto/InstanciaGanttDTOImp.java

@@ -10,7 +10,7 @@ public class InstanciaGanttDTOImp implements InstanciaGanttDTO{
 	private String start;
 	private String end;
 	private Integer progress;
-	private String customClass;
+	private String custom_class;
 
     public InstanciaGanttDTOImp(BigInteger id, String name, String titCas, String titVal, String start, String end,
             Integer progress, String customClass) {
@@ -21,7 +21,7 @@ public class InstanciaGanttDTOImp implements InstanciaGanttDTO{
         this.start = start;
         this.end = end;
         this.progress = progress;
-        this.customClass = customClass;
+        this.custom_class = customClass;
     }
 
     public InstanciaGanttDTOImp(InstanciaGanttDTO instanciaGanttDTO) {
@@ -32,7 +32,7 @@ public class InstanciaGanttDTOImp implements InstanciaGanttDTO{
         this.start = instanciaGanttDTO.getStart();
         this.end = instanciaGanttDTO.getEnd();
         this.progress = instanciaGanttDTO.getProgress();
-        this.customClass = instanciaGanttDTO.getCustom_class();
+        this.custom_class = instanciaGanttDTO.getCustom_class();
     }
 
     public void setId(BigInteger id) {
@@ -56,8 +56,8 @@ public class InstanciaGanttDTOImp implements InstanciaGanttDTO{
     public void setProgress(Integer progress) {
         this.progress = progress;
     }
-    public void setCustomClass(String customClass) {
-        this.customClass = customClass;
+    public void setCustom_class(String customClass) {
+        this.custom_class = customClass;
     }
     @Override
     public BigInteger getId() {
@@ -90,6 +90,6 @@ public class InstanciaGanttDTOImp implements InstanciaGanttDTO{
 
     @Override
     public String getCustom_class() {
-        return customClass;
+        return custom_class;
     }   
 }

+ 1 - 1
src/main/java/es/uv/saic/feign/ProceduresClient.java

@@ -41,7 +41,7 @@ public interface ProceduresClient {
 
     @PostMapping("/procedure/save/{id}")
 	@ResponseBody
-	public HashMap<String, Object> saveDraft(@RequestParam String location, @PathVariable BigInteger id, @RequestParam String text, 
+	public HashMap<String, Object> saveDraft(@PathVariable BigInteger id, @RequestParam String text, 
         @RequestParam boolean manual, @RequestParam String usuari);
 
     @GetMapping("/procedure/drafts/{id}")

+ 34 - 28
src/main/java/es/uv/saic/web/OrganController.java

@@ -30,12 +30,13 @@ public class OrganController {
 	public String getTitulationsByCenter(Model model, Authentication auth,
 			@RequestParam(name="centers[]", required=false) List<Integer> centres) throws IOException {	
 		HashMap<String, Object> response = oc.getTitulationsByCenter(centres, ((Usuari) auth.getPrincipal()).getUsuari());      
-        if (response != null && response.get("redirect") != null) {
-			model.addAllAttributes(response);
-			return response.get("redirect").toString();
+        
+		if (response == null) {
+			return "401";	
         }
 
-		return "401";
+		model.addAllAttributes(response);
+		return "components/selector_titulacions";
     }
 
 	@PostMapping("/ajax/search/managers/titulations")
@@ -43,12 +44,13 @@ public class OrganController {
 			@RequestParam("center") Integer centre,
 			HttpSession session) {
 		HashMap<String, Object> response = oc.getCenterTitulations(centre);
-        if (response != null && response.get("redirect") != null) {
-			model.addAllAttributes(response);
-			return response.get("redirect").toString();
+       
+		if (response == null) {
+			return "401";	
         }
 
-		return "401";
+		model.addAllAttributes(response);
+		return "components/selector_titulacions_managers";
 	}
 
 	@PostMapping("/ajax/find/titulations2")
@@ -56,12 +58,13 @@ public class OrganController {
 			@RequestParam("centers[]") List<Integer> centres, @RequestParam("procedure") Integer idProces) throws IOException {	
 		HashMap<String, Object> response =
                 oc.getTitulationsByCenters(centres, idProces);
-            if (response != null && response.get("redirect") != null) {
-                model.addAllAttributes(response);
-                return response.get("redirect").toString();
-            }
+      
+		if (response == null) {
+			return "401";	
+        }
 
-		return "401";
+		model.addAllAttributes(response);
+		return "components/selector_titulacions_managers";
 	}
 	
 	@PostMapping("/ajax/find/titulations")
@@ -69,35 +72,38 @@ public class OrganController {
 			@RequestParam("center") Integer centre, @RequestParam("procedure") Integer idProces) throws IOException {	
 		HashMap<String, Object> response =
                 oc.getTitulationsByCenter(centre, idProces);
-            if (response != null && response.get("redirect") != null) {
-                model.addAllAttributes(response);
-                return response.get("redirect").toString();
-            }
+		
+		if (response == null) {
+			return "401";	
+		}
 
-		return "401";
+		model.addAllAttributes(response);
+		return "components/selector_titulacions";
 	}
 
 	@PostMapping("/ajax/get/titulations")
 	public String getAllTitulationsByCenter(Model model, Authentication auth, @RequestParam("center") Integer centre) throws IOException {	
 		HashMap<String, Object> response =
                 oc.getAllTitulationsByCenter(centre);
-            if (response != null && response.get("redirect") != null) {
-                model.addAllAttributes(response);
-                return response.get("redirect").toString();
-            }
+            
+		if (response == null) {
+			return "401";	
+        }
 
-		return "401";
+		model.addAllAttributes(response);
+		return "components/selector_titulacions";
 	}
 
 	@PostMapping("/ajax/find/centers")
 	public String getAllCentresByAmbit(Model model, Authentication auth, @RequestParam("procedure") Integer idProces) throws IOException {	
 		HashMap<String, Object> response =
                 oc.getAllCentresByAmbit(idProces);
-            if (response != null && response.get("redirect") != null) {
-                model.addAllAttributes(response);
-                return response.get("redirect").toString();
-            }
+		
+		if (response == null) {
+			return "401";	
+        }
 
-		return "401";
+		model.addAllAttributes(response);
+		return "components/selector_centres";
 	}
 }

+ 44 - 34
src/main/java/es/uv/saic/web/ProceduresController.java

@@ -71,13 +71,13 @@ public class ProceduresController {
 		HashMap<String, Object> response =
                 pc.getActiveInstances( _new, ((Usuari) auth.getPrincipal()).getUsuari());
 
-        if (response != null && response.get("redirect") != null) {
-			model.addAllAttributes(response);
-			session.setAttribute("location", model.getAttribute("location"));
-            return response.get("redirect").toString();
+        if (response == null) {
+			return "401";
         }
 
-		return "401";
+		model.addAllAttributes(response);
+
+		return "procedures";
 	}
 	
 	/*
@@ -133,9 +133,9 @@ public class ProceduresController {
 			
 		HashMap<String, Object> response =
                 pc.updateInstanciaTascaEvidencia(id, params, evidencias, ((Usuari) auth.getPrincipal()).getUsuari());
-        if (response != null && response.get("ammount") != null) {
+        
+		if (response != null && response.get("ammount") != null) {
 			model.addAllAttributes(response);
-			session.setAttribute("location", model.getAttribute("location"));
 			return response.get("ammount").toString();
         }
 	
@@ -159,13 +159,13 @@ public class ProceduresController {
 		
 		HashMap<String, Object> response =
                 pc.updateInstanciaTasca(id, params, evidencias, ((Usuari) auth.getPrincipal()).getUsuari());
-        if (response != null && response.get("redirect") != null) {
-			model.addAllAttributes(response);
-			session.setAttribute("location", model.getAttribute("location"));
-			return response.get("redirect").toString();
-        }
+        
+		if (response == null) {
+			return "401";
+		}
 
-		return "401";
+		model.addAllAttributes(response);
+		return "procedures";
 	}
 	
 
@@ -185,14 +185,21 @@ public class ProceduresController {
 	public String saveDraft(Model model, Authentication auth, HttpSession session, @PathVariable BigInteger id, @RequestParam String text, 
 							@RequestParam boolean manual) {
 		HashMap<String, Object> response =
-                pc.saveDraft(session.getAttribute("location").toString(), id, text, manual, ((Usuari) auth.getPrincipal()).getUsuari());
-		if (response != null && response.get("date") != null) {
-			model.addAllAttributes(response);
-			session.setAttribute("location", model.getAttribute("location"));
-			return response.get("date").toString();
-        }
+                pc.saveDraft(id, text, manual, ((Usuari) auth.getPrincipal()).getUsuari());
 		
-		return "401";
+		if(session.getAttribute("location") != null) {
+			model.addAttribute("location", session.getAttribute("location"));
+		}
+		else {
+			session.setAttribute("location", "procedures");
+			model.addAttribute("location", "procedures");
+		}
+		
+		if (response == null) {
+			return "401";
+		}
+		
+		return "procedures";
 	}
 
 	/*
@@ -207,12 +214,13 @@ public class ProceduresController {
 	public String getDrafts(Model model, Authentication auth, HttpSession session, @PathVariable BigInteger id) {
 		HashMap<String, Object> response =
                 pc.getDrafts(id);
-		if (response != null && response.get("redirect") != null) {
-			model.addAllAttributes(response);
-			return response.get("redirect").toString();
+		
+		if (response == null) {
+			return "401";	
         }
 
-		return "401";
+		model.addAllAttributes(response);
+		return "procedure_versions";
 	}
 
 	/*
@@ -253,12 +261,13 @@ public class ProceduresController {
 			
 		HashMap<String, Object> response =
 			pc.getYearsByCenterTitulation(centres, titulacions, ((Usuari) auth.getPrincipal()).getUsuari());
-		if (response != null && response.get("redirect") != null) {
-			model.addAllAttributes(response);
-			return response.get("redirect").toString();
-		}
+		
+		if (response == null) {
+			return "401";	
+        }
 
-		return "401";
+		model.addAllAttributes(response);
+		return "components/selector_cursos";
 	}
 
     // POST que se utiliza para conseguir los procedimiento que se han llevado a cabo por cursos y por titulación
@@ -269,12 +278,13 @@ public class ProceduresController {
 			@RequestParam("titulations[]") List<Integer> titulacions) throws IOException {	
 		HashMap<String, Object> response =
                 pc.getProceduresByCenterTitulationYear(centres, cursos, titulacions, ((Usuari) auth.getPrincipal()).getUsuari());
-            if (response != null && response.get("redirect") != null) {
-                model.addAllAttributes(response);
-                return response.get("redirect").toString();
-            }
+        
+		if (response == null) {
+			return "401";	
+        }
 
-		return "401";
+		model.addAllAttributes(response);
+		return "components/selector_processos";
 	}
 
     @PostMapping("/ajax/find/procedure")

+ 4 - 4
src/main/java/es/uv/saic/web/StatsController.java

@@ -76,11 +76,11 @@ public class StatsController {
 		HashMap<String, Object> response =
                 sc.getStats();
 
-        if (response != null && response.get("redirect") != null) {
-			model.addAllAttributes(response);
-            return response.get("redirect").toString();
+        if (response == null) {
+			return "401";	
         }
 
-        return "401";
+		model.addAllAttributes(response);
+		return "adminStats";
 	}	
 }

+ 14 - 19
src/main/java/es/uv/saic/web/SupervisionController.java

@@ -37,14 +37,14 @@ public class SupervisionController {
 			sc.supervisionForm(((Usuari) auth.getPrincipal()).getUsuari(),
 			(SupervisionSearchParams) session.getAttribute("searchParams"));
 
-        if (response != null && response.get("redirect") != null) {
-			model.addAllAttributes(response);
-			if(response.get("removeAttribute") != null)
-				session.removeAttribute(response.get("removeAttribute").toString());
-            return response.get("redirect").toString();
+        if (response == null) {
+			return "401";
         }
 
-        return "401";
+		model.addAllAttributes(response);
+		if(response.get("removeAttribute") != null)
+			session.removeAttribute(response.get("removeAttribute").toString());
+		return "supervision";
 	}
 	
 	/*
@@ -74,14 +74,11 @@ public class SupervisionController {
 		HashMap<String, Object> response =
 			sc.supervisionSearch(centres, cursos, titulacions, procediments, evidencies, searchType, searchType);
 
-        if (response != null && response.get("redirect") != null) {
-			model.addAllAttributes(response);
-			session.setAttribute("searchParams", response.get("searchParams"));
-			session.setAttribute("location", response.get("location"));
-            return response.get("redirect").toString();
-        }
+		if (response == null) {
+        	return "401";
+		}
 
-        return "401";
+		return "supervisionProcedures";
 	}
 	
 	/*
@@ -98,12 +95,10 @@ public class SupervisionController {
 			sc.restoreSearch(((Usuari) auth.getPrincipal()).getUsuari(),
 			(SupervisionSearchParams) session.getAttribute("searchParams"));
 
-        if (response != null && response.get("redirect") != null) {
-			model.addAllAttributes(response);
-			session.setAttribute("location", response.get("location"));
-            return response.get("redirect").toString();
-        }
+        if (response == null) {
+        	return "401";
+		}
 
-        return "401";
+		return "supervisionProcedures";
 	}
 }

+ 5 - 6
src/main/java/es/uv/saic/web/TascaController.java

@@ -1,7 +1,6 @@
 package es.uv.saic.web;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 
@@ -28,12 +27,12 @@ public class TascaController {
 		
         HashMap<String, Object> response =
                 tc.getEvidencesByCenterTitulationYear(centres, cursos, titulacions);
-            if (response != null && response.get("redirect") != null) {
-                model.addAllAttributes(response);
-                return response.get("redirect").toString();
-            }
+        
+		if (response == null) {
+        	return "401";
+		}
 
-		return "401";
+		return "components/selector_evidencies";
 	}
 
     //NO se usa

+ 1 - 1
src/main/resources/templates/dashboardUniversitat.html

@@ -156,7 +156,7 @@
 										<tbody>
 											<tr th:each="item,inRowID : ${titulacions}">
 												<td>
-													<span th:text="${item.ruct2}"></span>
+													<span th:text="${item.ruct}"></span>
 												</td>
 												<td>
 													<span th:text="${item.codis2}"></span>