diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/bundle/AuthorMessages.properties b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/bundle/AuthorMessages.properties index 89c31dae5323..2234022555c1 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/bundle/AuthorMessages.properties +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/bundle/AuthorMessages.properties @@ -647,8 +647,8 @@ upload=Upload browse=Browse note_negative_point_value_part=REQUIRED: Overrides corresponding value in originating pool. Pertains only to 'True False' or 'Multiple Choice, Single Correct' questions. -note_negative_point_value_question=Optional. Pertains only to 'True False' or 'Multiple Choice, Single Correct' questions. -negative_point_value=* Negative point value for incorrect answer selection +negative_point_value=Negative point value for incorrect answer selection +negative_point_value_note=Negative point is disabled due to the use of minimum point or partial credit features. select_action=-- Select Action -- action_scores=Scores diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/ItemAuthorBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/ItemAuthorBean.java index 3225806a66f1..88f58370cfe2 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/ItemAuthorBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/ItemAuthorBean.java @@ -1554,4 +1554,24 @@ public void setAllowMinScore(Boolean allowMinScore) { this.allowMinScore = allowMinScore; } + public boolean isDisableNegativePoints() { + Long type = null; + try { + type = Long.parseLong(currentItem.getItemType()); + } catch (NumberFormatException nfe) { + return true; + } + boolean value = true; + if (currentItem != null && !getAllowMinScore() && // disable if using min score + (currentItem.getPartialCreditFlag().equals("false") || !currentItem.isPartialCreditEnabled()) && // disable if using partial credit + (type == TypeFacade.MULTIPLE_CHOICE || // enable for single correct + type == TypeFacade.MULTIPLE_CORRECT_SINGLE_SELECTION || // enable for multiple correct single selection + type == TypeFacade.TRUE_FALSE || // enable for multiple correct single selection + (type == TypeFacade.MULTIPLE_CORRECT && // enable for multiple correct multiple selection and + (currentItem.getMcmsPartialCredit().equals("false"))))) { // not using multiple choice multiple correct partial credit + value = false; + } + log.debug("Disable negative points: " + Boolean.toString(value)); + return value; + } } diff --git a/samigo/samigo-app/src/webapp/js/authoring.js b/samigo/samigo-app/src/webapp/js/authoring.js index ff4ee9795b43..e01b4031b457 100644 --- a/samigo/samigo-app/src/webapp/js/authoring.js +++ b/samigo/samigo-app/src/webapp/js/authoring.js @@ -234,10 +234,48 @@ function disableImport(){ } } -function toPoint(id) -{ - var x=document.getElementById(id).value - document.getElementById(id).value=x.replace(',','.') +$( document ).ready( function() { + + // inputText with class ConvertPoint changes + $( "input.ConvertPoint[type='text']" ).change( function() { + var value = $( this ).val(); + if (value) { + $( this ).val(value.replace(',','.')); + } else { + $( this ).val("0") + } + }); + + // validation for minPoints + $( "#itemForm\\:minPoints\\:answerminptr" ).change( function() { + var pointValue = parseFloat( $( "#itemForm\\:answerptr" ).val() ); + var minValue = parseFloat ( $( this ).val() ); + if (!pointValue.isNaN && !minValue.isNaN) { + // minValue should not be equal to or greater than pointValue + if (minValue < 0 || minValue >= pointValue) { + validationWarningSetDefault($( this ), "0") + } + } + }); + + // validation for negative points + $( "#itemForm\\:answerdsc" ).change( function() { + var pointValue = parseFloat( $( "#itemForm\\:answerptr" ).val() ); + var negativeValue = parseFloat ( $( this ).val() ); + if (!pointValue.isNaN && !negativeValue.isNaN) { + // minValue should not be equal to or greater than pointValue + if (negativeValue < 0 || negativeValue > pointValue) { + validationWarningSetDefault($( this ), "0") + } + } + }); + +}); + +function validationWarningSetDefault(element, value) { + $( element ).animate({ backgroundColor: "red" }); + $( element ).val(value); + $( element ).animate({ backgroundColor: "transparent" }); } /** @@ -654,18 +692,6 @@ function mySetMainFrameHeight(id, minHeight) } } -function toggleNegativePointVal(val){ - var negPointField = document.getElementById('itemForm:answerdsc'); - if(negPointField){ - if(val){ - negPointField.value = 0; - negPointField.disabled = true; - }else{ - negPointField.disabled = false; - } - } -} - function resetSelectMenus(){ var selectlist = document.getElementsByTagName("SELECT"); @@ -681,4 +707,3 @@ function clickInsertLink(field){ var hiddenSelector = "#" + insertlinkid.replace( /(:|\.|\[|\]|,)/g, "\\$1" ); $(hiddenSelector).click(); } - diff --git a/samigo/samigo-app/src/webapp/jsf/author/editAssessment.jsp b/samigo/samigo-app/src/webapp/jsf/author/editAssessment.jsp index b00aa9a423fc..668982800c2a 100755 --- a/samigo/samigo-app/src/webapp/jsf/author/editAssessment.jsp +++ b/samigo/samigo-app/src/webapp/jsf/author/editAssessment.jsp @@ -362,7 +362,7 @@ $(window).load( function() { - + diff --git a/samigo/samigo-app/src/webapp/jsf/author/editPart.jsp b/samigo/samigo-app/src/webapp/jsf/author/editPart.jsp index fe0defdd0524..38687804648c 100755 --- a/samigo/samigo-app/src/webapp/jsf/author/editPart.jsp +++ b/samigo/samigo-app/src/webapp/jsf/author/editPart.jsp @@ -119,12 +119,12 @@ - + - + diff --git a/samigo/samigo-app/src/webapp/jsf/author/item/audioRecording.jsp b/samigo/samigo-app/src/webapp/jsf/author/item/audioRecording.jsp index cc21c8c03fce..0a305c88ad4e 100644 --- a/samigo/samigo-app/src/webapp/jsf/author/item/audioRecording.jsp +++ b/samigo/samigo-app/src/webapp/jsf/author/item/audioRecording.jsp @@ -78,8 +78,7 @@
+ required="true" disabled="#{author.isEditPoolFlow}" styleClass="form-control ConvertPoint"> @@ -100,7 +99,7 @@ Ths is commented out since it doesn't make sense to have a min value for a question that doesn't automatically calculate a score
- +
diff --git a/samigo/samigo-app/src/webapp/jsf/author/item/extendedMatchingItems.jsp b/samigo/samigo-app/src/webapp/jsf/author/item/extendedMatchingItems.jsp index ecefc95b71db..06f4443ebbca 100644 --- a/samigo/samigo-app/src/webapp/jsf/author/item/extendedMatchingItems.jsp +++ b/samigo/samigo-app/src/webapp/jsf/author/item/extendedMatchingItems.jsp @@ -495,7 +495,7 @@
- diff --git a/samigo/samigo-app/src/webapp/jsf/author/item/fileUpload.jsp b/samigo/samigo-app/src/webapp/jsf/author/item/fileUpload.jsp index ba4d73a17875..eca9820891f8 100644 --- a/samigo/samigo-app/src/webapp/jsf/author/item/fileUpload.jsp +++ b/samigo/samigo-app/src/webapp/jsf/author/item/fileUpload.jsp @@ -69,14 +69,13 @@

-
+ required="true" disabled="#{author.isEditPoolFlow}" styleClass="form-control ConvertPoint">
@@ -87,7 +86,7 @@ Ths is commented out since it doesn't make sense to have a min value for a question that doesn't automatically calculate a score
- +
@@ -183,9 +182,6 @@
- - -

diff --git a/samigo/samigo-app/src/webapp/jsf/author/item/fillInNumeric.jsp b/samigo/samigo-app/src/webapp/jsf/author/item/fillInNumeric.jsp index b9bbdb4fff97..453e80544085 100644 --- a/samigo/samigo-app/src/webapp/jsf/author/item/fillInNumeric.jsp +++ b/samigo/samigo-app/src/webapp/jsf/author/item/fillInNumeric.jsp @@ -69,8 +69,7 @@

+ required="true" disabled="#{author.isEditPoolFlow}" styleClass="form-control ConvertPoint"> @@ -82,8 +81,7 @@
- + diff --git a/samigo/samigo-app/src/webapp/jsf/author/item/fillInTheBlank.jsp b/samigo/samigo-app/src/webapp/jsf/author/item/fillInTheBlank.jsp index cc96a721d8b7..bfbfb95e1f2c 100644 --- a/samigo/samigo-app/src/webapp/jsf/author/item/fillInTheBlank.jsp +++ b/samigo/samigo-app/src/webapp/jsf/author/item/fillInTheBlank.jsp @@ -80,7 +80,7 @@
+ required="true" disabled="#{author.isEditPoolFlow}" styleClass="form-control ConvertPoint"> @@ -102,8 +102,7 @@
- + diff --git a/samigo/samigo-app/src/webapp/jsf/author/item/imageMapQuestion.jsp b/samigo/samigo-app/src/webapp/jsf/author/item/imageMapQuestion.jsp index 4ed3aa297739..33664cd8327f 100644 --- a/samigo/samigo-app/src/webapp/jsf/author/item/imageMapQuestion.jsp +++ b/samigo/samigo-app/src/webapp/jsf/author/item/imageMapQuestion.jsp @@ -127,7 +127,7 @@
- +
diff --git a/samigo/samigo-app/src/webapp/jsf/author/item/matching.jsp b/samigo/samigo-app/src/webapp/jsf/author/item/matching.jsp index 02a7340a04d1..1b477c4a1b0a 100644 --- a/samigo/samigo-app/src/webapp/jsf/author/item/matching.jsp +++ b/samigo/samigo-app/src/webapp/jsf/author/item/matching.jsp @@ -92,7 +92,7 @@
+ required="true" disabled="#{author.isEditPoolFlow}" styleClass="form-control ConvertPoint"> @@ -114,8 +114,7 @@
- + @@ -139,7 +138,7 @@ <%@ include file="/jsf/author/item/attachment.jsp" %> - +
diff --git a/samigo/samigo-app/src/webapp/jsf/author/item/matrixChoicesSurvey.jsp b/samigo/samigo-app/src/webapp/jsf/author/item/matrixChoicesSurvey.jsp index 921dd249346c..0b209b7f1243 100644 --- a/samigo/samigo-app/src/webapp/jsf/author/item/matrixChoicesSurvey.jsp +++ b/samigo/samigo-app/src/webapp/jsf/author/item/matrixChoicesSurvey.jsp @@ -84,7 +84,6 @@

-
@@ -92,7 +91,7 @@
+ required="true" size="6" styleClass="form-control ConvertPoint"> diff --git a/samigo/samigo-app/src/webapp/jsf/author/item/multipleChoice.jsp b/samigo/samigo-app/src/webapp/jsf/author/item/multipleChoice.jsp index 785f46e01b76..d4fb26b1d962 100755 --- a/samigo/samigo-app/src/webapp/jsf/author/item/multipleChoice.jsp +++ b/samigo/samigo-app/src/webapp/jsf/author/item/multipleChoice.jsp @@ -57,7 +57,7 @@
- + @@ -81,7 +81,7 @@
- + @@ -153,14 +153,13 @@
- + - + + - - -
diff --git a/samigo/samigo-app/src/webapp/jsf/author/item/shortAnswer.jsp b/samigo/samigo-app/src/webapp/jsf/author/item/shortAnswer.jsp index 0110e5795372..819fe2a4b4f0 100644 --- a/samigo/samigo-app/src/webapp/jsf/author/item/shortAnswer.jsp +++ b/samigo/samigo-app/src/webapp/jsf/author/item/shortAnswer.jsp @@ -54,7 +54,7 @@
- + @@ -79,7 +79,7 @@
- + diff --git a/samigo/samigo-app/src/webapp/jsf/author/item/trueFalse.jsp b/samigo/samigo-app/src/webapp/jsf/author/item/trueFalse.jsp index 936d4c6ea3a2..ab0f7dffe1f4 100644 --- a/samigo/samigo-app/src/webapp/jsf/author/item/trueFalse.jsp +++ b/samigo/samigo-app/src/webapp/jsf/author/item/trueFalse.jsp @@ -71,15 +71,13 @@

-
+ required="true" disabled="#{author.isEditPoolFlow}" styleClass="form-control ConvertPoint"> @@ -101,8 +99,7 @@
- + @@ -111,16 +108,16 @@
- +
- + + -