Index: lams_common/src/java/org/lamsfoundation/lams/tool/OutputFactory.java =================================================================== diff -u -r7ec5fb1ceecbc55268fd3a8cc5ce950eaef7e3bb -recf2d6525b774341cc093ab44448b2a18ac704ff --- lams_common/src/java/org/lamsfoundation/lams/tool/OutputFactory.java (.../OutputFactory.java) (revision 7ec5fb1ceecbc55268fd3a8cc5ce950eaef7e3bb) +++ lams_common/src/java/org/lamsfoundation/lams/tool/OutputFactory.java (.../OutputFactory.java) (revision ecf2d6525b774341cc093ab44448b2a18ac704ff) @@ -23,6 +23,7 @@ /* $Id$ */ package org.lamsfoundation.lams.tool; +import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.SortedMap; @@ -35,6 +36,7 @@ import org.springframework.context.MessageSource; import org.springframework.context.NoSuchMessageException; import org.springframework.context.i18n.LocaleContextHolder; +import org.lamsfoundation.lams.learningdesign.BranchCondition; /** * This class forms the basic implementation of an output definition and output value factory, which is the class in a tool that @@ -178,7 +180,6 @@ return definition; } - //The mark for a user's last attempt at answering the question(s). /** Build a tool definition designed for a range of integer values. * It will get the definition's description from the I18N file using the getDescription() method and * set the type to OUTPUT_LONG. */ @@ -210,13 +211,27 @@ } /** Build a tool definition designed for a single boolean value, which is likely to be a test such as - * user has answered all questions correctly. - * It will get the definition's description from the I18N file using the getDescription() method and - * set the type to OUTPUT_BOOLEAN. */ + * user has answered all questions correctly. It will get the definition's description from the I18N file using the getDescription() method and + * set the type to OUTPUT_BOOLEAN. A Boolean tool definition should have default condition name for the + * true and false conditions. The code will automatically look for two strings in the I18N file + * output.desc..true and output.desc..false */ protected ToolOutputDefinition buildBooleanOutputDefinition(String definitionName) { - return buildDefinition(definitionName, OutputType.OUTPUT_BOOLEAN, null, null, null); - } + ToolOutputDefinition definition = buildDefinition(definitionName, OutputType.OUTPUT_BOOLEAN, null, null, null); + List defaultConditions = new ArrayList(); + defaultConditions.add(new BranchCondition(null, null, new Integer(1), definitionName, + getDescription(definitionName+".true"), + OutputType.OUTPUT_BOOLEAN.toString(), null, null, Boolean.TRUE.toString())); + + defaultConditions.add(new BranchCondition(null, null, new Integer(2), definitionName, + getDescription(definitionName+".false"), + OutputType.OUTPUT_BOOLEAN.toString(), null, null, Boolean.FALSE.toString())); + + definition.setDefaultConditions(defaultConditions); + + return definition; + } + /** Build a tool definition designed for a single String value. * It will get the definition's description from the I18N file using the getDescription() method and * set the type to OUTPUT_STRING. */ Index: lams_common/src/java/org/lamsfoundation/lams/tool/ToolOutputDefinition.java =================================================================== diff -u -r530c208895bfea0ba15e8bd8f1c799b163c059c9 -recf2d6525b774341cc093ab44448b2a18ac704ff --- lams_common/src/java/org/lamsfoundation/lams/tool/ToolOutputDefinition.java (.../ToolOutputDefinition.java) (revision 530c208895bfea0ba15e8bd8f1c799b163c059c9) +++ lams_common/src/java/org/lamsfoundation/lams/tool/ToolOutputDefinition.java (.../ToolOutputDefinition.java) (revision ecf2d6525b774341cc093ab44448b2a18ac704ff) @@ -23,10 +23,13 @@ /* $Id$ */ package org.lamsfoundation.lams.tool; +import java.util.List; + import org.apache.commons.lang.builder.CompareToBuilder; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; +import org.lamsfoundation.lams.learningdesign.BranchCondition; /** * Each tool that has outputs will define a set of output definitions. Some definitions will be @@ -58,6 +61,7 @@ private Object startValue; private Object endValue; private Object complexDefinition; + private List defaultConditions; /** Name must be unique within the current tool content. This will be used to identify the output. * If the definition is a predefined definition then the name will always be the same (e.g. LEARNER_MARK) but @@ -149,6 +153,16 @@ .append(this.type, myClass.type) .toComparison(); } + /** Default Conditions are sample conditions that should be presented to the user as a starting point + * for using this OutputDefinition + * @return + */ + public List getDefaultConditions() { + return defaultConditions; + } + public void setDefaultConditions(List defaultConditions) { + this.defaultConditions = defaultConditions; + } } Index: lams_common/src/java/org/lamsfoundation/lams/tool/dto/ToolOutputDefinitionDTO.java =================================================================== diff -u -r2927201b0bf594425125fac209db2815fb0f4412 -recf2d6525b774341cc093ab44448b2a18ac704ff --- lams_common/src/java/org/lamsfoundation/lams/tool/dto/ToolOutputDefinitionDTO.java (.../ToolOutputDefinitionDTO.java) (revision 2927201b0bf594425125fac209db2815fb0f4412) +++ lams_common/src/java/org/lamsfoundation/lams/tool/dto/ToolOutputDefinitionDTO.java (.../ToolOutputDefinitionDTO.java) (revision ecf2d6525b774341cc093ab44448b2a18ac704ff) @@ -23,8 +23,10 @@ /* $$Id$$ */ package org.lamsfoundation.lams.tool.dto; +import java.util.ArrayList; + import org.apache.commons.lang.builder.ToStringBuilder; -import org.lamsfoundation.lams.learningdesign.dto.BranchConditionDTO; +import org.lamsfoundation.lams.learningdesign.BranchCondition; import org.lamsfoundation.lams.tool.ToolOutputDefinition; /** @@ -44,7 +46,8 @@ private String startValue; private String endValue; private String complexDefinition; - + private ArrayList defaultConditions; + public ToolOutputDefinitionDTO(String name, String description, String type, String startValue, String endValue, String complexDefinition) { super(); this.name = name; @@ -67,6 +70,13 @@ this.endValue = (definition.getEndValue() != null) ? definition.getEndValue().toString() : null; this.complexDefinition = (definition.getComplexDefinition() != null) ? definition.getComplexDefinition().toString() : null; + + if ( definition.getDefaultConditions() != null && definition.getDefaultConditions().size() > 0 ) { + defaultConditions = new ArrayList(); + for ( BranchCondition condition : definition.getDefaultConditions() ) { + defaultConditions.add(condition.getBranchConditionDTO(null)); + } + } } /** @@ -117,6 +127,14 @@ return complexDefinition; } + public ArrayList getDefaultConditions() { + return defaultConditions; + } + + public void setDefaultConditions(ArrayList defaultConditions) { + this.defaultConditions = defaultConditions; + } + public String toString() { return new ToStringBuilder(this) .append("name", name) Index: lams_tool_lamc/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r74ffab851fd581b97034f58a87d5ac4fb12f995b -recf2d6525b774341cc093ab44448b2a18ac704ff --- lams_tool_lamc/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 74ffab851fd581b97034f58a87d5ac4fb12f995b) +++ lams_tool_lamc/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision ecf2d6525b774341cc093ab44448b2a18ac704ff) @@ -242,7 +242,9 @@ errors.maxfilesize =The uploaded file has exceeded the maximum file size limit of {0} bytes radiobox.defineLater =Define in Monitor output.desc.learner.mark =Learner's total mark -output.desc.learner.all.correct =Learner has all answers correct +output.desc.learner.all.correct =Are learner's answers all correct? +output.desc.learner.all.correct.true =All correct +output.desc.learner.all.correct.false =Not all correct label.displayAnswers =Display answers after last question label.monitoring.noDisplayAnswers2 =Do you want to allow learners to see the answers now? button.monitoring.noDisplayAnswers =Yes Index: lams_tool_lamc/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -r74ffab851fd581b97034f58a87d5ac4fb12f995b -recf2d6525b774341cc093ab44448b2a18ac704ff --- lams_tool_lamc/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 74ffab851fd581b97034f58a87d5ac4fb12f995b) +++ lams_tool_lamc/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision ecf2d6525b774341cc093ab44448b2a18ac704ff) @@ -242,7 +242,9 @@ errors.maxfilesize =The uploaded file has exceeded the maximum file size limit of {0} bytes radiobox.defineLater =Define in Monitor output.desc.learner.mark =Learner's total mark -output.desc.learner.all.correct =Learner has all answers correct +output.desc.learner.all.correct =Are learner's answers all correct? +output.desc.learner.all.correct.true =All correct +output.desc.learner.all.correct.false =Not all correct label.displayAnswers =Display answers after last question label.monitoring.noDisplayAnswers2 =Do you want to allow learners to see the answers now? button.monitoring.noDisplayAnswers =Yes