Index: lams_tool_survey/conf/language/ApplicationResources.properties =================================================================== diff -u -rc4a429ad90657aa55fb72fccf49cf717a3e7fd12 -rec918a1f6fa717d59f8074f508fe798eb3cbdf41 --- lams_tool_survey/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision c4a429ad90657aa55fb72fccf49cf717a3e7fd12) +++ lams_tool_survey/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision ec918a1f6fa717d59f8074f508fe798eb3cbdf41) @@ -26,6 +26,7 @@ label.authoring.basic.instruction =Instruction # Survey question label.question =Question +label.optional= Optional label.authoring.basic.add.survey.question =Add question label.authoring.basic.add.survey.open.question=Add open text label.authoring.basic.add.option =Add more options Index: lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/action/AuthoringAction.java =================================================================== diff -u -rc4a429ad90657aa55fb72fccf49cf717a3e7fd12 -rec918a1f6fa717d59f8074f508fe798eb3cbdf41 --- lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/action/AuthoringAction.java (.../AuthoringAction.java) (revision c4a429ad90657aa55fb72fccf49cf717a3e7fd12) +++ lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/action/AuthoringAction.java (.../AuthoringAction.java) (revision ec918a1f6fa717d59f8074f508fe798eb3cbdf41) @@ -276,6 +276,9 @@ if(!errors.isEmpty()){ this.addErrors(request,errors); + //add at least 2 instruction list + for(int idx=instructionList.size();idx < 2;idx++) + instructionList.add(""); request.setAttribute(SurveyConstants.ATTR_INSTRUCTION_LIST,instructionList); if(itemForm.getItemType() == SurveyConstants.QUESTION_TYPE_TEXT_ENTRY) return mapping.findForward(SurveyConstants.FORWARD_OPEN_QUESTION); @@ -736,6 +739,11 @@ */ private List getInstructionsFromRequest(HttpServletRequest request) { String list = request.getParameter("instructionList"); + List instructionList = new ArrayList(); + //for open text entry question + if(list == null) + return instructionList; + String[] params = list.split("&"); Map paramMap = new HashMap(); String[] pair; @@ -751,7 +759,6 @@ } int count = NumberUtils.stringToInt(paramMap.get(INSTRUCTION_ITEM_COUNT)); - List instructionList = new ArrayList(); for(int idx=0;idx -

 


Index: lams_tool_survey/web/includes/javascript/surveyitem.js =================================================================== diff -u -r0b9b61d67c2dcf6f83c513325afca117cb1967f2 -rec918a1f6fa717d59f8074f508fe798eb3cbdf41 --- lams_tool_survey/web/includes/javascript/surveyitem.js (.../surveyitem.js) (revision 0b9b61d67c2dcf6f83c513325afca117cb1967f2) +++ lams_tool_survey/web/includes/javascript/surveyitem.js (.../surveyitem.js) (revision ec918a1f6fa717d59f8074f508fe798eb3cbdf41) @@ -25,49 +25,6 @@ ); } - function changeMaxAnswerOptions(initVal){ - var tb = document.getElementById("questionTable"); - var num = tb.getElementsByTagName("tr"); - var numLen = num.length; - //remove button row - if(numLen > 0) - --numLen; - - var sel = document.getElementById("maxAnswerSelect"); - var newField = sel.options; - var len = sel.length; - - if(numLen == 0){ - sel.disabled = true; - return; - }else - sel.disabled = false; - - //when first enter, it should get value from Resource - var selIdx=initVal < 0?-1:initVal; - //there is bug in Opera8.5: if add alert before this loop, it will work,weird. - for (var idx=0;idx 0 && selIdx==i){ - opt.selected = true; - }else{ - opt.selected = false; - } - opt.appendChild(optT); - sel.appendChild(opt); - } - } function addInstruction(){ var url= addInstructionUrl; var reqIDVar = new Date(); @@ -109,7 +66,6 @@ function removeInstructionComplete(){ hideBusy(instructionTargetDiv); - changeMaxAnswerOptions(-1); } function addInstructionLoading(){ @@ -118,7 +74,6 @@ function addInstructionComplete(){ hideBusy(instructionTargetDiv); - changeMaxAnswerOptions(-1); } function showBusy(targetDiv){ if($(targetDiv+"_Busy") != null){ @@ -132,10 +87,9 @@ } function submitSurveyItem(){ - $("instructionList").value = Form.serialize("instructionForm"); + if($("instructionList") != null) + $("instructionList").value = Form.serialize("instructionForm"); $("surveyItemForm").submit(); - //after submit, it direct to itemlist.jsp, - // then refresh "basic tab" surveylist and close this window. } function cancelSurveyItem(){ window.top.hideMessage(); Index: lams_tool_survey/web/pages/authoring/basic.jsp =================================================================== diff -u -rc4a429ad90657aa55fb72fccf49cf717a3e7fd12 -rec918a1f6fa717d59f8074f508fe798eb3cbdf41 --- lams_tool_survey/web/pages/authoring/basic.jsp (.../basic.jsp) (revision c4a429ad90657aa55fb72fccf49cf717a3e7fd12) +++ lams_tool_survey/web/pages/authoring/basic.jsp (.../basic.jsp) (revision ec918a1f6fa717d59f8074f508fe798eb3cbdf41) @@ -25,9 +25,9 @@ } - function editItem(idx,sessionMapID){ + function editItem(idx,itemType,sessionMapID){ var reqIDVar = new Date(); - var url = "" + idx +"&reqID="+reqIDVar.getTime()+"&sessionMapID="+sessionMapID;; + var url = "" + idx +"&itemType="+itemType+"&reqID="+reqIDVar.getTime()+"&sessionMapID="+sessionMapID;; showMessage(url); } //The panel of survey list panel Index: lams_tool_survey/web/pages/authoring/parts/addchoicequestion.jsp =================================================================== diff -u -rc4a429ad90657aa55fb72fccf49cf717a3e7fd12 -rec918a1f6fa717d59f8074f508fe798eb3cbdf41 --- lams_tool_survey/web/pages/authoring/parts/addchoicequestion.jsp (.../addchoicequestion.jsp) (revision c4a429ad90657aa55fb72fccf49cf717a3e7fd12) +++ lams_tool_survey/web/pages/authoring/parts/addchoicequestion.jsp (.../addchoicequestion.jsp) (revision ec918a1f6fa717d59f8074f508fe798eb3cbdf41) @@ -39,6 +39,8 @@ + <%-- This value should be 1 or 2 --%> +
Index: lams_tool_survey/web/pages/authoring/parts/addopenquestion.jsp =================================================================== diff -u -rc4a429ad90657aa55fb72fccf49cf717a3e7fd12 -rec918a1f6fa717d59f8074f508fe798eb3cbdf41 --- lams_tool_survey/web/pages/authoring/parts/addopenquestion.jsp (.../addopenquestion.jsp) (revision c4a429ad90657aa55fb72fccf49cf717a3e7fd12) +++ lams_tool_survey/web/pages/authoring/parts/addopenquestion.jsp (.../addopenquestion.jsp) (revision ec918a1f6fa717d59f8074f508fe798eb3cbdf41) @@ -35,10 +35,9 @@ <%@ include file="/common/messages.jsp"%> - <%-- This field is not belong STRUTS form --%> - + +
Index: lams_tool_survey/web/pages/authoring/parts/itemlist.jsp =================================================================== diff -u -rb3c59c3c9ce71b16c7754c776d78c6fe1f04470c -rec918a1f6fa717d59f8074f508fe798eb3cbdf41 --- lams_tool_survey/web/pages/authoring/parts/itemlist.jsp (.../itemlist.jsp) (revision b3c59c3c9ce71b16c7754c776d78c6fe1f04470c) +++ lams_tool_survey/web/pages/authoring/parts/itemlist.jsp (.../itemlist.jsp) (revision ec918a1f6fa717d59f8074f508fe798eb3cbdf41) @@ -24,7 +24,12 @@ ${survey.shortTitle} - + + + + +