Index: lams_tool_survey/conf/xdoclet/struts-actions.xml =================================================================== diff -u -r6a5d35ec57dde95eae93fb628d669af257d36949 -r7ed78ed8506a377056c19c18d0c105cafc384f44 --- lams_tool_survey/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision 6a5d35ec57dde95eae93fb628d669af257d36949) +++ lams_tool_survey/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision 7ed78ed8506a377056c19c18d0c105cafc384f44) @@ -106,6 +106,17 @@ + + + + + + + - - - - - - - - - - - - - - - - + surveyList = getSurveyItemList(sessionMap); + List rList = new ArrayList(surveyList); + //get current and the target item, and switch their sequnece + SurveyQuestion item = rList.get(itemIdx); + SurveyQuestion repItem; + if(up) + repItem = rList.get(--itemIdx); + else + repItem = rList.get(++itemIdx); + int upSeqId = repItem.getSequenceId(); + repItem.setSequenceId(item.getSequenceId()); + item.setSequenceId(upSeqId); + + //put back list, it will be sorted again + surveyList.clear(); + surveyList.addAll(rList); + } + + request.setAttribute(SurveyConstants.ATTR_SESSION_MAP_ID, sessionMapID); + return mapping.findForward(SurveyConstants.SUCCESS); + } /** * Display edit page for existed survey item. Index: lams_tool_survey/web/pages/authoring/basic.jsp =================================================================== diff -u -r12085431903d9ea39d8b405bb70c7f01c936c409 -r7ed78ed8506a377056c19c18d0c105cafc384f44 --- lams_tool_survey/web/pages/authoring/basic.jsp (.../basic.jsp) (revision 12085431903d9ea39d8b405bb70c7f01c936c409) +++ lams_tool_survey/web/pages/authoring/basic.jsp (.../basic.jsp) (revision 7ed78ed8506a377056c19c18d0c105cafc384f44) @@ -48,13 +48,56 @@ } ); } + function upQuestion(idx,sessionMapID){ + var url = ""; + var reqIDVar = new Date(); + var param = "itemIndex=" + idx +"&reqID="+reqIDVar.getTime()+"&sessionMapID="+sessionMapID;; + deleteItemLoading(); + var myAjax = new Ajax.Updater( + surveyListTargetDiv, + url, + { + method:'get', + parameters:param, + onComplete:deleteItemComplete, + evalScripts:true + } + ); + } + function downQuestion(idx,sessionMapID){ + var url = ""; + var reqIDVar = new Date(); + var param = "itemIndex=" + idx +"&reqID="+reqIDVar.getTime()+"&sessionMapID="+sessionMapID;; + deleteItemLoading(); + var myAjax = new Ajax.Updater( + surveyListTargetDiv, + url, + { + method:'get', + parameters:param, + onComplete:deleteItemComplete, + evalScripts:true + } + ); + } function deleteItemLoading(){ showBusy(surveyListTargetDiv); } function deleteItemComplete(){ hideBusy(surveyListTargetDiv); } + function showBusy(targetDiv){ + if($(targetDiv+"_Busy") != null){ + Element.show(targetDiv+"_Busy"); + } + } + function hideBusy(targetDiv){ + if($(targetDiv+"_Busy") != null){ + Element.hide(targetDiv+"_Busy"); + } + } + Index: lams_tool_survey/web/pages/authoring/parts/itemlist.jsp =================================================================== diff -u -r12085431903d9ea39d8b405bb70c7f01c936c409 -r7ed78ed8506a377056c19c18d0c105cafc384f44 --- lams_tool_survey/web/pages/authoring/parts/itemlist.jsp (.../itemlist.jsp) (revision 12085431903d9ea39d8b405bb70c7f01c936c409) +++ lams_tool_survey/web/pages/authoring/parts/itemlist.jsp (.../itemlist.jsp) (revision 7ed78ed8506a377056c19c18d0c105cafc384f44) @@ -28,13 +28,33 @@ + + + + + + + + + + + +
+ + "> + +    + + "> + + - + - +