Index: impl/src/test/org/sakaiproject/evaluation/utils/TemplateItemUtilsTest.java
===================================================================
--- impl/src/test/org/sakaiproject/evaluation/utils/TemplateItemUtilsTest.java (.../trunk) (revision 69137)
+++ impl/src/test/org/sakaiproject/evaluation/utils/TemplateItemUtilsTest.java (.../branches/EVALSYS-951) (revision 69279)
@@ -264,8 +264,8 @@
assertTrue( TemplateItemUtils.isRequireable(etdl.templateItem1U) );
assertTrue( TemplateItemUtils.isRequireable(etdl.templateItem2B) );
assertTrue( TemplateItemUtils.isRequireable(etdl.templateItem3A) );
- assertFalse( TemplateItemUtils.isRequireable(etdl.templateItem5U) );
- assertFalse( TemplateItemUtils.isRequireable(etdl.templateItem6UU) );
+ assertTrue( TemplateItemUtils.isRequireable(etdl.templateItem5U) );
+ assertTrue( TemplateItemUtils.isRequireable(etdl.templateItem6UU) );
assertFalse( TemplateItemUtils.isRequireable(etdl.templateItem9B) );
}
@@ -283,37 +283,11 @@
List list = null;
list = TemplateItemUtils.getRequireableTemplateItems(itemList);
assertNotNull(list);
- assertEquals(2, list.size());
+ assertEquals(3, list.size());
assertEquals(etdl.templateItem1U, list.get(0));
assertEquals(etdl.templateItem3U, list.get(1));
}
- public void testIsCompulsory() {
- EvalTestDataLoad etdl = new EvalTestDataLoad(null);
-
- assertTrue( TemplateItemUtils.isCompulsory(etdl.templateItem1U) );
- assertFalse( TemplateItemUtils.isCompulsory(etdl.templateItem2B) );
- assertFalse( TemplateItemUtils.isCompulsory(etdl.templateItem3A) );
- assertFalse( TemplateItemUtils.isCompulsory(etdl.templateItem5U) );
- assertFalse( TemplateItemUtils.isCompulsory(etdl.templateItem6UU) );
- assertFalse( TemplateItemUtils.isCompulsory(etdl.templateItem9B) );
- }
-
- public void testGetCompulsoryTemplateItems() {
- EvalTestDataLoad etdl = new EvalTestDataLoad(null);
- List itemList = new ArrayList();
-
- itemList.add(etdl.templateItem1U);
- itemList.add(etdl.templateItem3U);
- itemList.add(etdl.templateItem5U);
-
- List list = null;
- list = TemplateItemUtils.getCompulsoryTemplateItems(itemList);
- assertNotNull(list);
- assertEquals(1, list.size());
- assertEquals(etdl.templateItem1U, list.get(0));
- }
-
/**
* Test method for {@link org.sakaiproject.evaluation.utils.TemplateItemUtils#isBlockParent(org.sakaiproject.evaluation.model.EvalTemplateItem)}.
*/
Index: impl/src/test/org/sakaiproject/evaluation/logic/EvalAuthoringServiceImplTest.java
===================================================================
--- impl/src/test/org/sakaiproject/evaluation/logic/EvalAuthoringServiceImplTest.java (.../trunk) (revision 69137)
+++ impl/src/test/org/sakaiproject/evaluation/logic/EvalAuthoringServiceImplTest.java (.../branches/EVALSYS-951) (revision 69279)
@@ -21,6 +21,7 @@
import org.sakaiproject.evaluation.constant.EvalConstants;
import org.sakaiproject.evaluation.logic.externals.EvalSecurityChecksImpl;
+import org.sakaiproject.evaluation.model.EvalEvaluation;
import org.sakaiproject.evaluation.model.EvalItem;
import org.sakaiproject.evaluation.model.EvalItemGroup;
import org.sakaiproject.evaluation.model.EvalScale;
@@ -3123,5 +3124,31 @@
assertNull(items);
}
+
+ public void testIsCompulsory() {
+ EvalTestDataLoad etdl = new EvalTestDataLoad(null);
+ assertTrue( authoringService.isCompulsory(etdl.templateItem1U, etdl.evaluationActive) );
+ assertFalse( authoringService.isCompulsory(etdl.templateItem2B, null) );
+ assertFalse( authoringService.isCompulsory(etdl.templateItem3A, etdl.evaluationActiveUntaken) );
+ assertFalse( authoringService.isCompulsory(etdl.templateItem5U, etdl.evaluationPartial) );
+ assertFalse( authoringService.isCompulsory(etdl.templateItem6UU, etdl.evaluationViewable) );
+ assertFalse( authoringService.isCompulsory(etdl.templateItem9B, null) );
+ }
+
+ public void testGetCompulsoryTemplateItems() {
+ EvalTestDataLoad etdl = new EvalTestDataLoad(null);
+ List itemList = new ArrayList();
+
+ itemList.add(etdl.templateItem1U);
+ itemList.add(etdl.templateItem3U);
+ itemList.add(etdl.templateItem5U);
+
+ List list = null;
+ list = authoringService.getCompulsoryTemplateItems(itemList, null);
+ assertNotNull(list);
+ assertEquals(1, list.size());
+ assertEquals(etdl.templateItem1U, list.get(0));
+ }
+
}
Index: impl/src/java/org/sakaiproject/evaluation/dao/PreloadDataImpl.java
===================================================================
--- impl/src/java/org/sakaiproject/evaluation/dao/PreloadDataImpl.java (.../trunk) (revision 69137)
+++ impl/src/java/org/sakaiproject/evaluation/dao/PreloadDataImpl.java (.../branches/EVALSYS-951) (revision 69279)
@@ -148,6 +148,7 @@
saveConfig(EvalSettings.ENABLE_EVAL_REOPEN, true);
saveConfig(EvalSettings.ENABLE_MY_TOPLINKS, true);
saveConfig(EvalSettings.ENABLE_ADMINISTRATING_BOX, true);
+ saveConfig(EvalSettings.ENABLE_TEXT_ITEM_REQUIRED, false);
// REPORTING
saveConfig(EvalSettings.ENABLE_CSV_REPORT_EXPORT, true);
Index: impl/src/java/org/sakaiproject/evaluation/logic/EvalAuthoringServiceImpl.java
===================================================================
--- impl/src/java/org/sakaiproject/evaluation/logic/EvalAuthoringServiceImpl.java (.../trunk) (revision 69137)
+++ impl/src/java/org/sakaiproject/evaluation/logic/EvalAuthoringServiceImpl.java (.../branches/EVALSYS-951) (revision 69279)
@@ -28,12 +28,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.sakaiproject.evaluation.constant.EvalConstants;
import org.sakaiproject.evaluation.dao.EvaluationDao;
import org.sakaiproject.evaluation.logic.exceptions.BlankRequiredFieldException;
import org.sakaiproject.evaluation.logic.externals.EvalExternalLogic;
import org.sakaiproject.evaluation.logic.externals.EvalSecurityChecksImpl;
+import org.sakaiproject.evaluation.model.EvalEvaluation;
import org.sakaiproject.evaluation.model.EvalItem;
import org.sakaiproject.evaluation.model.EvalItemGroup;
import org.sakaiproject.evaluation.model.EvalScale;
@@ -2127,4 +2127,44 @@
}
}
+
+
+
+ public List getCompulsoryTemplateItems(List templateItemsList, EvalEvaluation evaluation) {
+ List compulsoryItemsList = new ArrayList();
+
+ List orderedItems = TemplateItemUtils.orderTemplateItems(templateItemsList, false);
+
+ for (int i=0; i responses, Boolean blankResponsesAllowed,
Boolean modifyResponsesAllowed, Boolean unregisteredAllowed, Boolean locked,
- String authControl, String evalCategory, String selectionSettings, Boolean emailOpenNotification) {
+ String authControl, String evalCategory, String selectionSettings, Boolean emailOpenNotification, Boolean compulsoryTextItemsAllowed) {
this.lastModified = new Date();
this.type = type;
@@ -335,6 +340,7 @@
this.evalCategory = evalCategory;
this.selectionSettings = selectionSettings;
this.sendAvailableNotifications = emailOpenNotification;
+ this.compulsoryTextItemsAllowed = compulsoryTextItemsAllowed;
}
@Override
@@ -774,7 +780,15 @@
selectionSettings = EvalAssignGroup.validateSelectionSettings(selectionSettings);
this.selectionSettings = selectionSettings;
}
+
+ public Boolean getCompulsoryTextItemsAllowed() {
+ return compulsoryTextItemsAllowed;
+ }
+ public void setCompulsoryTextItemsAllowed(Boolean compulsoryTextItemsAllowed) {
+ this.compulsoryTextItemsAllowed = compulsoryTextItemsAllowed;
+ }
+
/**
* NON_PERSISTENT list of assign groups for this eval, may be limited by user
* @return the evalAssignGroups, will be NULL if the groups were not populated, will be empty if populated but none are set
Index: api/src/java/org/sakaiproject/evaluation/utils/TemplateItemDataList.java
===================================================================
--- api/src/java/org/sakaiproject/evaluation/utils/TemplateItemDataList.java (.../trunk) (revision 69137)
+++ api/src/java/org/sakaiproject/evaluation/utils/TemplateItemDataList.java (.../branches/EVALSYS-951) (revision 69279)
@@ -754,15 +754,6 @@
}
/**
- * @return true if this item is compulsory (i.e. must be answered),
- * false otherwise
- * @see TemplateItemUtils#isCompulsory(EvalTemplateItem)
- */
- public boolean isCompulsory() {
- return TemplateItemUtils.isCompulsory(this.templateItem);
- }
-
- /**
* @return the auto insertion tag for this item or null if none found
*/
public String getAutoInsertionTag() {
Index: api/src/java/org/sakaiproject/evaluation/utils/TemplateItemUtils.java
===================================================================
--- api/src/java/org/sakaiproject/evaluation/utils/TemplateItemUtils.java (.../trunk) (revision 69137)
+++ api/src/java/org/sakaiproject/evaluation/utils/TemplateItemUtils.java (.../branches/EVALSYS-951) (revision 69279)
@@ -233,7 +233,6 @@
/**
* Check if a templateItem can be required (must be answered by a user taking an evaluation
* which does not allow blank responses) or not,
- * all answerable items that are not textual are requireable,
* this is not checking against the evaluation settings and is only checking
* the settings for this template item,
* does not include compulsory check
@@ -243,18 +242,9 @@
* @param templateItem a templateItem persistent object
* @return true if the item is requireable, false otherwise
*/
- public static boolean isRequireable(EvalTemplateItem templateItem) {
- // all answerable items that are not textual are requireable
- boolean result = false;
- if (isAnswerable(templateItem)) {
- String type = getTemplateItemType(templateItem);
- if ( EvalConstants.ITEM_TYPE_TEXT.equals(type) ) {
- result = false;
- } else {
- result = true;
- }
- }
- return result;
+ public static boolean isRequireable(EvalTemplateItem templateItem) {
+ // all answerable items can now be requireable re: EVALSYS-951
+ return isAnswerable(templateItem);
}
/**
@@ -282,54 +272,6 @@
return requireableItemsList;
}
- /**
- * Check if a templateItem is compulsory (must be answered by a user taking an evaluation) or not,
- * this is checking the compulsory settings for this template item,
- * all answerable items that are marked as compulsory are included
- *
- * NOTE use {@link #getCompulsoryTemplateItems(List)} to do a large set
- *
- * @param templateItem a templateItem persistent object
- * @return true if the item is compulsory, false otherwise
- */
- public static boolean isCompulsory(EvalTemplateItem templateItem) {
- // all answerable items that are not textual are required
- boolean result = false;
- if (isAnswerable(templateItem)) {
- String type = getTemplateItemType(templateItem);
- if ( EvalConstants.ITEM_TYPE_TEXT.equals(type) ) {
- result = false;
- } else if ( EvalUtils.safeBool(templateItem.isCompulsory()) ) {
- result = true;
- }
- }
- return result;
- }
-
- /**
- * Get the list of all templateItems which are compulsory (must be answered),
- * this will include any scaled items or items which are part of a block (but not a block parent)
- *
- * @param templateItemsList a List of {@link EvalTemplateItem} objects from a template
- * @return a List of {@link EvalTemplateItem} objects
- * @see #isCompulsory(EvalTemplateItem)
- */
- public static List getCompulsoryTemplateItems(List templateItemsList) {
- List compulsoryItemsList = new ArrayList();
-
- List orderedItems = orderTemplateItems(templateItemsList, false);
-
- for (int i=0; i
+
+
+
+
Index: api/src/java/org/sakaiproject/evaluation/logic/EvalSettings.java
===================================================================
--- api/src/java/org/sakaiproject/evaluation/logic/EvalSettings.java (.../trunk) (revision 69137)
+++ api/src/java/org/sakaiproject/evaluation/logic/EvalSettings.java (.../branches/EVALSYS-951) (revision 69279)
@@ -344,6 +344,11 @@
*/
public static final String ALLOW_EVALSPECIFIC_TOGGLE_EMAIL_NOTIFICATION = "ALLOW_EVALSPECIFIC_TOGGLE_EMAIL_NOTIFICATION:java.lang.Boolean";
+ /**
+ * CONSTANT: Can a text item be flagged as required? - {@link Boolean}, default False
+ * Note: If this is NULL then the evaluation settings override, otherwise this overrides the evaluation setting
+ */
+ public static final String ENABLE_TEXT_ITEM_REQUIRED = "ENABLE_TEXT_ITEM_REQUIRED:java.lang.Boolean";
/**
* This is here to identify all the boolean ONLY settings in the system,
@@ -405,7 +410,8 @@
INSTRUCTOR_ALLOWED_VIEW_RESULTS,
STUDENT_ALLOWED_LEAVE_UNANSWERED,
STUDENT_MODIFY_RESPONSES,
- STUDENT_ALLOWED_VIEW_RESULTS
+ STUDENT_ALLOWED_VIEW_RESULTS,
+ ENABLE_TEXT_ITEM_REQUIRED
};
/**
Index: api/src/java/org/sakaiproject/evaluation/logic/EvalAuthoringService.java
===================================================================
--- api/src/java/org/sakaiproject/evaluation/logic/EvalAuthoringService.java (.../trunk) (revision 69137)
+++ api/src/java/org/sakaiproject/evaluation/logic/EvalAuthoringService.java (.../branches/EVALSYS-951) (revision 69279)
@@ -24,6 +24,8 @@
import org.sakaiproject.evaluation.model.EvalScale;
import org.sakaiproject.evaluation.model.EvalTemplate;
import org.sakaiproject.evaluation.model.EvalTemplateItem;
+import org.sakaiproject.evaluation.utils.TemplateItemDataList;
+import org.sakaiproject.evaluation.utils.TemplateItemUtils;
/**
@@ -708,4 +710,31 @@
*/
public int getNonBlockItemCountForTemplate(Long templateId);
+
+ /**
+ * Check if a {@link EvalTemplateItem} is compulsory (must be answered by a user taking an evaluation) or not,
+ * this is checking the compulsory settings for this template item,
+ * all answerable items that are marked as compulsory are included.
+ * Text items can be required if the and {@link EvalSettings.ENABLE_TEXT_ITEM_REQUIRED} is set to YES or CONFIGURABLE.
+ *
+ * NOTE use {@link #getCompulsoryTemplateItems(List, EvalEvaluation)} to do a large set
+ *
+ * @param templateItem a {@link EvalTemplateItem} persistent object
+ * @param evaluation If specified (not null
) and {@link EvalSettings.ENABLE_TEXT_ITEM_REQUIRED} is CONFIGURABLE, method will consider {@link EvalEvaluation} settings
+ * @return true if the item is compulsory, false otherwise
+ */
+
+ public boolean isCompulsory(EvalTemplateItem templateItem, EvalEvaluation evaluation);
+
+ /**
+ * Get the list of all templateItems which are compulsory (must be answered),
+ * this will include any scaled items or items which are part of a block (but not a block parent)
+ *
+ * @param templateItemsList a List of {@link EvalTemplateItem} objects from a template
+ * @param evaluation If specified (not null
) and {@link EvalSettings.ENABLE_TEXT_ITEM_REQUIRED} is CONFIGURABLE, method will consider {@link EvalEvaluation} settings
+ * @return a List of {@link EvalTemplateItem} objects
+ * @see #isCompulsory(EvalTemplateItem, EvalEvaluation)
+ */
+ public List getCompulsoryTemplateItems(List templateItemsList, EvalEvaluation evaluation);
+
}
Index: tool/src/java/org/sakaiproject/evaluation/tool/utils/RenderingUtils.java
===================================================================
--- tool/src/java/org/sakaiproject/evaluation/tool/utils/RenderingUtils.java (.../trunk) (revision 69137)
+++ tool/src/java/org/sakaiproject/evaluation/tool/utils/RenderingUtils.java (.../branches/EVALSYS-951) (revision 69279)
@@ -23,6 +23,7 @@
import javax.servlet.http.HttpServletResponse;
import org.sakaiproject.evaluation.constant.EvalConstants;
+import org.sakaiproject.evaluation.logic.EvalAuthoringService;
import org.sakaiproject.evaluation.model.EvalEvaluation;
import org.sakaiproject.evaluation.tool.renderers.ItemRenderer;
import org.sakaiproject.evaluation.utils.EvalUtils;
@@ -36,8 +37,13 @@
* @author Aaron Zeckoski (aaron@caret.cam.ac.uk)
*/
public class RenderingUtils {
+
+ private EvalAuthoringService authoringService;
+ public void setAuthoringService(EvalAuthoringService authoringService) {
+ this.authoringService = authoringService;
+ }
- /**
+ /**
* Calculates the weighted average and number of counted answers from the responseArray
* (this comes from the {@link TemplateItemDataList#getAnswerChoicesCounts(String, int, List)})
* http://en.wikipedia.org/wiki/Weighted_mean
@@ -127,7 +133,7 @@
* @param renderProperties (OPTIONAL) the existing map of rendering properties (one is created if this is null)
* @return the map of render properties (created if the input map is null)
*/
- public static Map makeRenderProps(DataTemplateItem dti,
+ public Map makeRenderProps(DataTemplateItem dti,
EvalEvaluation eval, Set missingKeys,
Map renderProperties) {
if (dti == null || dti.templateItem == null) {
@@ -142,7 +148,10 @@
if (eval != null) {
evalRequiresItems = ! EvalUtils.safeBool(eval.getBlankResponsesAllowed(), true);
}
- if ( dti.isCompulsory() || (evalRequiresItems && dti.isRequireable()) ) {
+
+ boolean isDtiCompulsory = authoringService.isCompulsory(dti.templateItem, eval);
+
+ if ( isDtiCompulsory || (evalRequiresItems && dti.isRequireable()) ) {
renderProperties.put(ItemRenderer.EVAL_PROP_ANSWER_REQUIRED, Boolean.TRUE);
} else {
renderProperties.remove(ItemRenderer.EVAL_PROP_ANSWER_REQUIRED);
@@ -161,7 +170,7 @@
List children = dti.getBlockChildren();
for (DataTemplateItem childDTI : children) {
HashMap childRenderProps = new HashMap();
- RenderingUtils.makeRenderProps(childDTI, eval, missingKeys, childRenderProps);
+ makeRenderProps(childDTI, eval, missingKeys, childRenderProps);
String key = "child-"+childDTI.templateItem.getId();
renderProperties.put(key, childRenderProps);
}
Index: tool/src/java/org/sakaiproject/evaluation/tool/producers/TakeEvalProducer.java
===================================================================
--- tool/src/java/org/sakaiproject/evaluation/tool/producers/TakeEvalProducer.java (.../trunk) (revision 69137)
+++ tool/src/java/org/sakaiproject/evaluation/tool/producers/TakeEvalProducer.java (.../branches/EVALSYS-951) (revision 69279)
@@ -162,6 +162,11 @@
public void setHttpServletResponse(HttpServletResponse httpServletResponse) {
this.httpServletResponse = httpServletResponse;
}
+
+ private RenderingUtils renderingUtils;
+ public void setRenderingUtils(RenderingUtils renderingUtils) {
+ this.renderingUtils = renderingUtils;
+ }
Long responseId;
@@ -646,7 +651,7 @@
}
// setup the render properties to send along
- Map renderProps = RenderingUtils.makeRenderProps(dti, eval, missingKeys, null);
+ Map renderProps = renderingUtils.makeRenderProps(dti, eval, missingKeys, null);
// render the item
itemRenderer.renderItem(parent, "renderedItem:", currentAnswerOTP, templateItem, displayNumber, false, renderProps);
Index: tool/src/java/org/sakaiproject/evaluation/tool/producers/AdministrateProducer.java
===================================================================
--- tool/src/java/org/sakaiproject/evaluation/tool/producers/AdministrateProducer.java (.../trunk) (revision 69137)
+++ tool/src/java/org/sakaiproject/evaluation/tool/producers/AdministrateProducer.java (.../branches/EVALSYS-951) (revision 69279)
@@ -268,6 +268,13 @@
administrateConfigurableLabels,
EvalSettings.STUDENT_ALLOWED_VIEW_RESULTS, true);
UIMessage.make(form, "students-view-results-note","administrate.students.view.results.note");
+
+ //Select for whether students can ignore text items flagged as required
+ makeSelect(form, "students-answer-text-required-items",
+ administrateConfigurableValues,
+ administrateConfigurableLabels,
+ EvalSettings.ENABLE_TEXT_ITEM_REQUIRED, true);
+ UIMessage.make(form, "students-answer-text-required-items-note","administrate.general.allow.required.textitem");
// Administrator Settings
UIMessage.make(form, "administrator-settings-header","administrate.admin.settings.header");
Index: tool/src/java/org/sakaiproject/evaluation/tool/producers/EvaluationSettingsProducer.java
===================================================================
--- tool/src/java/org/sakaiproject/evaluation/tool/producers/EvaluationSettingsProducer.java (.../trunk) (revision 69137)
+++ tool/src/java/org/sakaiproject/evaluation/tool/producers/EvaluationSettingsProducer.java (.../branches/EVALSYS-951) (revision 69279)
@@ -407,8 +407,16 @@
"modifyResponsesAllowed", evaluationOTP + "modifyResponsesAllowed", studentModifyReponses, form,
EvalUtils.checkStateAfter(currentEvalState, EvalConstants.EVALUATION_STATE_ACTIVE, true) );
+ //compulsory text items
+ Boolean compulsoryTextItemsAllowed = (Boolean) settings.get(EvalSettings.ENABLE_TEXT_ITEM_REQUIRED);
+ if( compulsoryTextItemsAllowed == null){
+ Boolean compulsoryTextItemsEval = evaluation.getCompulsoryTextItemsAllowed() == null ? Boolean.FALSE : evaluation.getCompulsoryTextItemsAllowed() ;
+ UIBranchContainer compulsoryTextItemsAllowedBranch = UIBranchContainer.make(form, "compulsoryTextItemsAllowed_branch:");
+ UIBoundBoolean checkbox = UIBoundBoolean.make(compulsoryTextItemsAllowedBranch, "compulsoryTextItemsAllowed", evaluationOTP + "compulsoryTextItemsAllowed", compulsoryTextItemsEval);
+ UIMessage.make(compulsoryTextItemsAllowedBranch, "compulsoryTextItemsAllowed_label", "evalsettings.compulsoryTextItemsAllowed.label")
+ .decorate( new UILabelTargetDecorator(checkbox) );
+ }
-
// ADMIN SETTINGS SECTION
UISelect authControlSelect = UISelect.make(form, "auth-control-choose", EvalToolConstants.AUTHCONTROL_VALUES,
Index: tool/src/java/org/sakaiproject/evaluation/tool/producers/PreviewItemProducer.java
===================================================================
--- tool/src/java/org/sakaiproject/evaluation/tool/producers/PreviewItemProducer.java (.../trunk) (revision 69137)
+++ tool/src/java/org/sakaiproject/evaluation/tool/producers/PreviewItemProducer.java (.../branches/EVALSYS-951) (revision 69279)
@@ -58,9 +58,13 @@
public void setItemRenderer(ItemRenderer itemRenderer) {
this.itemRenderer = itemRenderer;
}
+
+ private RenderingUtils renderingUtils;
+ public void setRenderingUtils(RenderingUtils renderingUtils) {
+ this.renderingUtils = renderingUtils;
+ }
-
- /* (non-Javadoc)
+ /* (non-Javadoc)
* @see uk.org.ponder.rsf.view.ComponentProducer#fillComponents(uk.org.ponder.rsf.components.UIContainer, uk.org.ponder.rsf.viewstate.ViewParameters, uk.org.ponder.rsf.view.ComponentChecker)
*/
public void fillComponents(UIContainer tofill, ViewParameters viewparams, ComponentChecker checker) {
@@ -89,7 +93,7 @@
TemplateItemDataList tidl = new TemplateItemDataList(templateItems, null, null, null);
DataTemplateItem dti = tidl.getDataTemplateItem(templateItem.getId());
itemRenderer.renderItem(tofill, "previewed-item:", null, templateItem, templateItem.getDisplayOrder(), true,
- RenderingUtils.makeRenderProps(dti, null, null, null) );
+ renderingUtils.makeRenderProps(dti, null, null, null) );
// render the close button
UIMessage.make(tofill, "close-button", "general.close.window.button");
Index: tool/src/java/org/sakaiproject/evaluation/tool/producers/ModifyItemProducer.java
===================================================================
--- tool/src/java/org/sakaiproject/evaluation/tool/producers/ModifyItemProducer.java (.../trunk) (revision 69137)
+++ tool/src/java/org/sakaiproject/evaluation/tool/producers/ModifyItemProducer.java (.../branches/EVALSYS-951) (revision 69279)
@@ -461,16 +461,20 @@
}
}
- if (! EvalConstants.ITEM_TYPE_TEXT.equals(itemClassification)) {
- //compulsory
- Boolean selectOptionsCompulsory = true;
- if (selectOptionsCompulsory) {
- UIBranchContainer showComp = UIBranchContainer.make(itemDisplayHintsBranch, "showItemCompulsory:");
- UIBoundBoolean bb = UIBoundBoolean.make(showComp, "item-compulsory", commonDisplayOTP + "compulsory", compulsory);
- UIMessage.make(showComp,"item-compulsory-header", "modifyitem.item.compulsory.header")
- .decorate( new UILabelTargetDecorator(bb) );
- }
+ //compulsory
+ Boolean selectOptionsCompulsory = true;
+ if (EvalConstants.ITEM_TYPE_TEXT.equals(itemClassification)) {
+ //Check global configuration if text items can be compulsory
+ Boolean textItemsCanBeRequired = (Boolean) settings.get(EvalSettings.ENABLE_TEXT_ITEM_REQUIRED);
+ selectOptionsCompulsory = (textItemsCanBeRequired == null || textItemsCanBeRequired);
}
+ if (selectOptionsCompulsory) {
+ UIBranchContainer showComp = UIBranchContainer.make(itemDisplayHintsBranch, "showItemCompulsory:");
+ UIBoundBoolean bb = UIBoundBoolean.make(showComp, "item-compulsory", commonDisplayOTP + "compulsory", compulsory);
+ UIMessage.make(showComp,"item-compulsory-header", "modifyitem.item.compulsory.header")
+ .decorate( new UILabelTargetDecorator(bb) );
+ }
+
}
if (! useCourseCategoryOnly && ! isGroupable && ! isGrouped ) {
Index: tool/src/java/org/sakaiproject/evaluation/tool/producers/PreviewEvalProducer.java
===================================================================
--- tool/src/java/org/sakaiproject/evaluation/tool/producers/PreviewEvalProducer.java (.../trunk) (revision 69137)
+++ tool/src/java/org/sakaiproject/evaluation/tool/producers/PreviewEvalProducer.java (.../branches/EVALSYS-951) (revision 69279)
@@ -106,6 +106,11 @@
public void setHttpServletResponse(HttpServletResponse httpServletResponse) {
this.httpServletResponse = httpServletResponse;
}
+
+ private RenderingUtils renderingUtils;
+ public void setRenderingUtils(RenderingUtils renderingUtils) {
+ this.renderingUtils = renderingUtils;
+ }
int displayNumber = 1; // determines the number to display next to each item
@@ -280,7 +285,7 @@
// render the item
itemRenderer.renderItem(parent, "renderedItem:", null, templateItem, displayNumber, true,
- RenderingUtils.makeRenderProps(dti, eval, null, null) );
+ renderingUtils.makeRenderProps(dti, eval, null, null) );
// increment the display number
displayNumber += displayIncrement;
Index: tool/src/java/org/sakaiproject/evaluation/tool/bundle/messages.properties
===================================================================
--- tool/src/java/org/sakaiproject/evaluation/tool/bundle/messages.properties (.../trunk) (revision 69137)
+++ tool/src/java/org/sakaiproject/evaluation/tool/bundle/messages.properties (.../branches/EVALSYS-951) (revision 69279)
@@ -152,6 +152,7 @@
administrate.general.enable.importing.note=Enable importing options and controls (UM)
administrate.general.disable.item.bank=Disable the Item Bank
administrate.general.disable.question.blocks=Disable Question Blocks
+administrate.general.allow.required.textitem=Students must answer text items that are required
administrate.save.settings.button=Save Settings
administrate.top.import.data=Import Data
administrate.top.control.hierarchy=Control Hierarchy
@@ -310,12 +311,15 @@
evalsettings.instructorViewResults.label=Instructors in the courses this evaluation is assigned to can view results
evalsettings.instructorViewResults.disabled=Results cannot be viewed by instructors in the courses this evaluation is assigned to
evalsettings.view.results.date.label=Results viewable after evaluation due/view date
-evalsettings.blankResponsesAllowed.label=Blank non-text question responses allowed
-evalsettings.blankResponsesAllowed.disabled=All non-text questions must be answered
-evalsettings.blank.responses.allowed.note=Participants cannot submit the evaluation without completing all non-text items.
+evalsettings.blankResponsesAllowed.label=Blank question responses allowed
+evalsettings.blankResponsesAllowed.disabled=All questions must be answered
+evalsettings.blank.responses.allowed.note=Participants cannot submit the evaluation without completing all items.
evalsettings.modifyResponsesAllowed.label=Modification of answers allowed as long as evaluation is not closed
evalsettings.modifyResponsesAllowed.disabled=Answers cannot be changed after they have been submitted
evalsettings.modify.responses.allowed.note=Participants may change and resubmit their responses if this is enabled
+evalsettings.text.items.compulsory.note=Students must answer all compulsory free text/essay questions
+evalsettings.compulsoryTextItemsAllowed.label=If compulsory text question exist, they must be answered
+evalsettings.compulsoryTextItemsAllowed.disabled=If compulsory text question exist, they must be answered
evalsettings.admin.settings.instructions=This setting allows you to give the instructor control over whether to use the evaluation (or simply require them to).
evalsettings.reminder.settings.header=Evaluation Notifications
evalsettings.instructor.opt.desc=Instructor opt in setting
Index: tool/src/webapp/WEB-INF/requestContext.xml
===================================================================
--- tool/src/webapp/WEB-INF/requestContext.xml (.../trunk) (revision 69137)
+++ tool/src/webapp/WEB-INF/requestContext.xml (.../branches/EVALSYS-951) (revision 69279)
@@ -228,6 +228,12 @@
+
+
+
+
@@ -431,6 +437,7 @@
ref="org.sakaiproject.evaluation.logic.EvalAuthoringService" />
+
@@ -666,6 +673,7 @@
+
@@ -683,6 +691,7 @@
ref="org.sakaiproject.evaluation.logic.EvalSettings" />
+
Index: tool/src/webapp/content/templates/administrate.html
===================================================================
--- tool/src/webapp/content/templates/administrate.html (.../trunk) (revision 69137)
+++ tool/src/webapp/content/templates/administrate.html (.../branches/EVALSYS-951) (revision 69279)
@@ -115,7 +115,11 @@
-
+
+
+
+