{{lessonUrl}}
About WebGoat
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque volutpat feugiat nunc, non vulputate urna dictum ut. Nam consectetur porttitor diam ut ultricies. Aenean dolor dolor, congue sed ornare non, elementum in mauris. Phasellus orci sem, rhoncus eu laoreet eu, aliquam nec ante. Suspendisse sit amet justo eget eros tempor tincidunt vel quis justo. Sed pulvinar enim id neque pellentesque, eu rhoncus lorem eleifend. Morbi congue tortor sit amet pulvinar posuere.
@@ -184,8 +184,10 @@ alert('status: ' + statusText + '\n\nresponseText: \n' + responseText + '\n\nThe output div should have already been updated with the responseText.'); } + makeFormsAjax(); } function makeFormsAjax() { + //console.log("Hooking any lesson forms to make them ajax"); $("form").ajaxForm(options); } diff --git a/webapp/js/goat.js b/webapp/js/goat.js index 1336734a0..db7d45a59 100644 --- a/webapp/js/goat.js +++ b/webapp/js/goat.js @@ -7,34 +7,47 @@ * prepares and updates menu topic items for the view */ goat.controller('goatMenu', function($scope, $http) { - //TODO: implment via separate promise and use config for menu + //TODO: implement via separate promise and use config for menu $http({method: 'GET', url: 'service/lessonmenu.mvc'}).then( function(menuData) { var menuItems = goat.addMenuClasses(goatConstants.menuPrefix.concat(menuData.data)); $scope.menuTopics = menuItems; - }, function(error) { - var foo = error; - } + }, + function(error) { + // TODO - handle this some way other than an alert + alert("Error rendering menu: " + error); + } ); + $scope.lessonUrl = "hi!"; $scope.renderLesson = function(url) { console.log(url + ' was passed in'); + // use jquery to render lesson content to div + jQuery.get(url, + {}, + function(reply) { + jQuery("#lesson_content").html(reply); + // hook any forms + makeFormsAjax(); + }, + "html"); }; }) -.animation('.slideDown', function() { - var NgHideClassName = 'ng-hide'; - return { - beforeAddClass: function(element, className, done) { - if(className === NgHideClassName) { - jQuery(element).slideUp(done); + .animation('.slideDown', function() { + var NgHideClassName = 'ng-hide'; + return { + beforeAddClass: function(element, className, done) { + if (className === NgHideClassName) { + jQuery(element).slideUp(done); } - }, - removeClass: function(element, className, done) { - if(className === NgHideClassName) { - jQuery(element).hide().slideDown(done); + }, + removeClass: function(element, className, done) { + if (className === NgHideClassName) { + jQuery(element).hide().slideDown(done); } + } } - } -}); + }); + //TODO add recursion to handle arr[i].children objects // ... in case lower-level's need classes as well ... don't right now @@ -42,8 +55,8 @@ goat.addMenuClasses = function(arr) { for (var i = 0; i < arr.length; i++) { var menuItem = arr[i]; //console.log(menuItem); - if (arr[i].type && arr[i].type === 'CATEGORY') { - arr[i].class = 'fa-angle-right pull-right'; + if (menuItem.type && menuItem.type === 'CATEGORY') { + menuItem.class = 'fa-angle-right pull-right'; } } return arr; diff --git a/webapp/lessons/GoatHillsFinancial/error.jsp b/webapp/lessons/GoatHillsFinancial/error.jsp index a3294f134..fdffa05ab 100644 --- a/webapp/lessons/GoatHillsFinancial/error.jsp +++ b/webapp/lessons/GoatHillsFinancial/error.jsp @@ -2,7 +2,7 @@ import="org.owasp.webgoat.session.*, org.owasp.webgoat.lessons.GoatHillsFinancial.GoatHillsFinancial" errorPage="" %> <% - WebSession webSession = ((WebSession)session.getAttribute("websession")); + WebSession webSession = ((WebSession)session.getAttribute(WebSession.SESSION)); // int myUserId = getIntSessionAttribute(webSession, "GoatHillsFinancial." + GoatHillsFinancial.USER_ID); %>An error has occurred.