From cfb4ebb2b6f9ff5adce31196d7d92083105fd2cd Mon Sep 17 00:00:00 2001 From: lawson89 <> Date: Sun, 17 Aug 2014 10:19:51 -0400 Subject: [PATCH] get submenus showing up and animation working --- .../owasp/webgoat/service/HintService_1.java | 56 +++++++++++++++ webapp/WEB-INF/pages/main_new.jsp | 22 +++--- webapp/js/goat.js | 68 ++++++++++--------- 3 files changed, 104 insertions(+), 42 deletions(-) create mode 100644 java/org/owasp/webgoat/service/HintService_1.java diff --git a/java/org/owasp/webgoat/service/HintService_1.java b/java/org/owasp/webgoat/service/HintService_1.java new file mode 100644 index 000000000..5cbb48679 --- /dev/null +++ b/java/org/owasp/webgoat/service/HintService_1.java @@ -0,0 +1,56 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.owasp.webgoat.service; + +import java.util.ArrayList; +import java.util.List; +import javax.servlet.http.HttpSession; +import org.owasp.webgoat.lessons.AbstractLesson; +import org.owasp.webgoat.lessons.model.Hint; +import org.owasp.webgoat.session.WebSession; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +/** + * + * @author rlawson + */ +@Controller +public class HintService extends BaseService { + + /** + * Returns hints for current lesson + * + * @param session + * @return + */ + @RequestMapping(value = "/hint.mvc", produces = "application/json") + public @ResponseBody + List showHint(HttpSession session) { + List listHints = new ArrayList(); + WebSession ws = getWebSesion(session); + AbstractLesson l = ws.getCurrentLesson(); + if (l == null) { + return listHints; + } + List hints; + hints = l.getHintsPublic(ws); + if (hints == null) { + return listHints; + } + int idx = 0; + for (String h : hints) { + Hint hint = new Hint(); + hint.setHint(h); + hint.setLesson(l.getName()); + hint.setNumber(idx); + listHints.add(hint); + idx++; + } + return listHints; + } +} diff --git a/webapp/WEB-INF/pages/main_new.jsp b/webapp/WEB-INF/pages/main_new.jsp index 31a2c367e..0bbb87a8d 100644 --- a/webapp/WEB-INF/pages/main_new.jsp +++ b/webapp/WEB-INF/pages/main_new.jsp @@ -35,7 +35,7 @@ @@ -64,16 +64,16 @@