Update for WEB-69. Fix for JSONInjection lesson. Stub in javascript for CSRF lesson update/fix

This commit is contained in:
Jason White 2014-09-19 15:37:45 -06:00
parent bcf7c9a159
commit 13e3bb87c4
4 changed files with 11 additions and 6 deletions

View File

@ -106,7 +106,7 @@ public class JSONInjection extends LessonAdapter
protected Element createContent(WebSession s) protected Element createContent(WebSession s)
{ {
ElementContainer ec = new ElementContainer(); ElementContainer ec = new ElementContainer();
String lineSep = System.getProperty("line.separator"); String lineSep = System.getProperty("line.separator");
String script = "<script>" String script = "<script>"
+ lineSep + lineSep
+ "function getFlights() {" + "function getFlights() {"
@ -192,11 +192,11 @@ public class JSONInjection extends LessonAdapter
"function check(){" "function check(){"
+ lineSep + lineSep
+ " if ( document.getElementById('radio0').checked )" + " if ( document.getElementById('radio0') && document.getElementById('radio0').checked )"
+ lineSep + lineSep
+ " { document.getElementById('price2Submit').value = document.getElementById('priceID0').innerHTML; return true;}" + " { document.getElementById('price2Submit').value = document.getElementById('priceID0').innerHTML; return true;}"
+ lineSep + lineSep
+ " else if ( document.getElementById('radio1').checked )" + " else if ( document.getElementById('radio1') && document.getElementById('radio1').checked )"
+ lineSep + lineSep
+ " { document.getElementById('price2Submit').value = document.getElementById('priceID1').innerHTML; return true;}" + " { document.getElementById('price2Submit').value = document.getElementById('priceID1').innerHTML; return true;}"
+ lineSep + " else " + lineSep + " { alert('Please choose one flight'); return false;}" + lineSep + "}" + lineSep + " else " + lineSep + " { alert('Please choose one flight'); return false;}" + lineSep + "}"

View File

@ -148,8 +148,8 @@
<span class="glyphicon-class glyphicon glyphicon-circle-arrow-left" id="showPrevHintBtn" ng-click="viewPrevHint()"></span> <span class="glyphicon-class glyphicon glyphicon-circle-arrow-left" id="showPrevHintBtn" ng-click="viewPrevHint()"></span>
<span class="glyphicon-class glyphicon glyphicon-circle-arrow-right" id="showNextHintBtn" ng-click="viewNextHint()"></span> <span class="glyphicon-class glyphicon glyphicon-circle-arrow-right" id="showNextHintBtn" ng-click="viewNextHint()"></span>
<br/> <br/>
<span bind-html-unsafe="curHint"></span>
<span id="curHintContainer"></span><!--{{curHint}}--> <!--<span id="curHintContainer"></span>-->
</div> </div>
</div> </div>
</div> </div>

View File

@ -82,10 +82,12 @@ var goatMenu = function($scope, $http, $modal, $log, $templateCache) {
$("#lessonTitle").text(reply.data); $("#lessonTitle").text(reply.data);
} }
); );
//TODO encode html or get angular js portion working
$("#lesson_content").html(reply.data); $("#lesson_content").html(reply.data);
//hook forms //hook forms
goat.utils.makeFormsAjax(); goat.utils.makeFormsAjax();
$('#leftside-navigation').height($('#main-content').height()+15)//TODO: get ride of fixed value (15)here $('#leftside-navigation').height($('#main-content').height()+15)//TODO: get ride of fixed value (15)here
//notifies goatLesson Controller of the less change
$scope.$emit('lessonUpdate',{params:curScope.parameters}); $scope.$emit('lessonUpdate',{params:curScope.parameters});
} }
) )
@ -207,7 +209,7 @@ var goatLesson = function($scope,$http,$log) {
$scope.curHint = $scope.hints[$scope.hintIndex].hint; $scope.curHint = $scope.hints[$scope.hintIndex].hint;
//$scope.curHint = $sce.trustAsHtml($scope.hints[$scope.hintIndex].hint); //$scope.curHint = $sce.trustAsHtml($scope.hints[$scope.hintIndex].hint);
//TODO get html binding workin in the UI ... in the meantime ... //TODO get html binding workin in the UI ... in the meantime ...
$scope.renderCurHint(); //$scope.renderCurHint();
$scope.manageHintButtons(); $scope.manageHintButtons();
}; };

View File

@ -90,6 +90,9 @@ goat.utils = {
}, },
makeId: function (lessonName) { makeId: function (lessonName) {
return lessonName.replace(/\s|\(|\)|\!|\:|\;|\@|\#|\$|\%|\^|\&|\*/g,'');//TODO move the replace routine into util function return lessonName.replace(/\s|\(|\)|\!|\:|\;|\@|\#|\$|\%|\^|\&|\*/g,'');//TODO move the replace routine into util function
},
ajaxifyAttackHREF: function () {
// stub for dealing with CSRF lesson link issues and other similar issues
} }
}; };