Index: lams_tool_assessment/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -ra3e987093464232bfb4536f3335acc9851291b95 -rc437e028a3802f01fa80d40d99813c06944d0e9a --- lams_tool_assessment/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision a3e987093464232bfb4536f3335acc9851291b95) +++ lams_tool_assessment/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision c437e028a3802f01fa80d40d99813c06944d0e9a) @@ -24,15 +24,14 @@ label.authoring.basic.default.question.grade =Default question grade label.authoring.basic.penalty.factor =Penalty factor label.authoring.basic.general.feedback =General feedback +label.authoring.basic.feedback =Feedback label.authoring.basic.shuffle.the.choices =Shuffle the choices? label.authoring.basic.add.question =Add question label.authoring.basic.question.list.title =Question List label.authoring.basic.list.header.type =Type label.authoring.basic.list.header.question =Question -label.authoring.basic.type.choice =Choice label.authoring.basic.type.multiple.choice =Multiple choice label.authoring.basic.type.matching.pairs =Matching pairs -label.authoring.basic.type.fill.the.gap =Fill the gap label.authoring.basic.type.short.answer =Short answer label.authoring.basic.type.numerical =Numerical label.authoring.basic.type.true.false =True/False @@ -45,6 +44,7 @@ label.authoring.basic.down =Move down label.authoring.basic.up =Move Up label.authoring.basic.option.answer =Answer +label.authoring.basic.option.question =Question label.authoring.basic.option.grade =Grade label.authoring.basic.option.grade.none =None label.authoring.basic.option.feedback =Feedback @@ -55,12 +55,25 @@ label.authoring.basic.resource.description.input =Description label.authoring.basic.resource.zip.file.input =Zip file: label.authoring.basic.none =None -label.authoring.choice.add.choice =Add Choice +label.authoring.choice.add.multiple.choice =Add Multiple Choice label.authoring.choice.field.required =This field is required. label.authoring.choice.enter.integer =Please enter an integer. label.authoring.choice.enter.float =Please enter a float. -label.authoring.choice.answer.options =You should provide at least 2 answer options. +label.authoring.choice.error.answer.options =You should provide at least 2 answer options. +label.authoring.choice.one.multiple.answers =One or multiple answers? +label.authoring.choice.one.answer =One answer only +label.authoring.choice.multiple.answers =Multiple answers allowed +label.authoring.choice.overall.feedback =Overall feedback +label.authoring.choice.feedback.on.correct =For any correct response +label.authoring.choice.feedback.on.partially.correct =For any partially correct response +label.authoring.choice.feedback.on.incorrect =For any incorrect response +label.authoring.choice.add.option =Add Blank Option +label.authoring.matching.pairs.add.matching.pairs =Add Matching Pairs +label.authoring.matching.pairs.matching.pairs =Matching Pairs +label.authoring.matching.pairs.error.one.matching.pair =You should provide at least 1 matching pair. +label.authoring.matching.pairs.add.matching.pair =Add Blank Matching Pair +label.authoring.essay.add.essay =Add Essay label.authoring.online.file =Upload online file label.authoring.offline.file =Upload offline file label.authoring.choosefile.button =Choose file @@ -92,7 +105,6 @@ label.authoring.heading.instructions =Instructions label.authoring.heading.instructions.desc =Please input online and offline instructions label.authoring.basic.instruction =Instruction -label.authoring.basic.add.option =Add Blank Option label.authoring.online.instruction =Online Instructions label.authoring.offline.instruction =Offline Instructions label.description =Description: Index: lams_tool_assessment/conf/xdoclet/struts-actions.xml =================================================================== diff -u -ra3e987093464232bfb4536f3335acc9851291b95 -rc437e028a3802f01fa80d40d99813c06944d0e9a --- lams_tool_assessment/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision a3e987093464232bfb4536f3335acc9851291b95) +++ lams_tool_assessment/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision c437e028a3802f01fa80d40d99813c06944d0e9a) @@ -81,7 +81,6 @@ scope="request" validate="false" parameter="newQuestionInit"> - @@ -95,7 +94,6 @@ scope="request" parameter="editQuestion" validate="false"> - @@ -109,13 +107,6 @@ name="assessmentQuestionForm" scope="request" validate="false"> - - - - - - - + + + + optionList = getOptionsFromRequest(request, true); AssessmentQuestionForm questionForm = (AssessmentQuestionForm) form; - ActionErrors errors = new ActionErrors();//validateAssessmentQuestion(questionForm, optionList); + extractFormToAssessmentQuestion(request, questionForm); -// if (!errors.isEmpty()) { -// this.addErrors(request, errors); -// request.setAttribute(AssessmentConstants.ATTR_OPTION_LIST, optionList); -// return findForward(questionForm.getQuestionType(), mapping); -// } - - try { - extractFormToAssessmentQuestion(request, questionForm, optionList); - } catch (Exception e) { - // any upload exception will display as normal error message rather then throw exception directly - errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(AssessmentConstants.ERROR_MSG_UPLOAD_FAILED, e - .getMessage())); - if (!errors.isEmpty()) { - this.addErrors(request, errors); - return findForward(questionForm.getQuestionType(), mapping); - } - } // set session map ID so that questionlist.jsp can get sessionMAP request.setAttribute(AssessmentConstants.ATTR_SESSION_MAP_ID, questionForm.getSessionMapID()); - // return null to close this window return mapping.findForward(AssessmentConstants.SUCCESS); } @@ -820,6 +802,8 @@ option.setGrade(0); optionList.add(option); + request.setAttribute(AssessmentConstants.ATTR_QUESTION_TYPE, WebUtil.readIntParam(request, + AssessmentConstants.ATTR_QUESTION_TYPE)); request.setAttribute(AssessmentConstants.ATTR_OPTION_LIST, optionList); return mapping.findForward(AssessmentConstants.SUCCESS); } @@ -847,6 +831,8 @@ // delList.add(question); } + request.setAttribute(AssessmentConstants.ATTR_QUESTION_TYPE, WebUtil.readIntParam(request, + AssessmentConstants.ATTR_QUESTION_TYPE)); request.setAttribute(AssessmentConstants.ATTR_OPTION_LIST, optionList); return mapping.findForward(AssessmentConstants.SUCCESS); } @@ -904,6 +890,8 @@ optionList.addAll(rList); } + request.setAttribute(AssessmentConstants.ATTR_QUESTION_TYPE, WebUtil.readIntParam(request, + AssessmentConstants.ATTR_QUESTION_TYPE)); request.setAttribute(AssessmentConstants.ATTR_OPTION_LIST, optionList); return mapping.findForward(AssessmentConstants.SUCCESS); } @@ -1061,9 +1049,6 @@ private ActionForward findForward(short type, ActionMapping mapping) { ActionForward forward; switch (type) { - case AssessmentConstants.QUESTION_TYPE_CHOICE: - forward = mapping.findForward("choice"); - break; case AssessmentConstants.QUESTION_TYPE_MULTIPLE_CHOICE: forward = mapping.findForward("multiplechoice"); break; @@ -1104,6 +1089,8 @@ form.setDefaultGrade(String.valueOf(question.getDefaultGrade())); form.setPenaltyFactor(String.valueOf(question.getPenaltyFactor())); form.setGeneralFeedback(question.getGeneralFeedback()); + form.setFeedback(question.getFeedback()); + form.setMultipleAnswersAllowed(question.isMultipleAnswersAllowed()); form.setFeedbackOnCorrect(question.getFeedbackOnCorrect()); form.setFeedbackOnPartiallyCorrect(question.getFeedbackOnPartiallyCorrect()); form.setFeedbackOnIncorrect(question.getFeedbackOnIncorrect()); @@ -1114,7 +1101,8 @@ } short questionType = question.getType(); - if (questionType == AssessmentConstants.QUESTION_TYPE_CHOICE) { + if ((questionType == AssessmentConstants.QUESTION_TYPE_MULTIPLE_CHOICE) || + (questionType == AssessmentConstants.QUESTION_TYPE_MATCHING_PAIRS)) { Set optionList = question.getAnswerOptions(); request.setAttribute(AssessmentConstants.ATTR_OPTION_LIST, optionList); } @@ -1128,7 +1116,7 @@ * @param questionForm * @throws AssessmentApplicationException */ - private void extractFormToAssessmentQuestion(HttpServletRequest request, AssessmentQuestionForm questionForm, Set optionList) throws Exception { + private void extractFormToAssessmentQuestion(HttpServletRequest request, AssessmentQuestionForm questionForm) { /* * BE CAREFUL: This method will copy nessary info from request form to an old or new AssessmentQuestion instance. It * gets all info EXCEPT AssessmentQuestion.createDate and AssessmentQuestion.createBy, which need be set when persisting @@ -1163,65 +1151,44 @@ question.setHide(false); question.setDefaultGrade(Integer.parseInt(questionForm.getDefaultGrade())); - question.setPenaltyFactor(Float.parseFloat(questionForm.getPenaltyFactor())); question.setGeneralFeedback(questionForm.getGeneralFeedback()); - - if ((type == AssessmentConstants.QUESTION_TYPE_CHOICE) - || (type == AssessmentConstants.QUESTION_TYPE_MULTIPLE_CHOICE)) { + + if ((type == AssessmentConstants.QUESTION_TYPE_MULTIPLE_CHOICE)) { + question.setMultipleAnswersAllowed(questionForm.isMultipleAnswersAllowed()); + question.setPenaltyFactor(Float.parseFloat(questionForm.getPenaltyFactor())); question.setShuffle(questionForm.isShuffle()); question.setFeedbackOnCorrect(questionForm.getFeedbackOnCorrect()); question.setFeedbackOnPartiallyCorrect(questionForm.getFeedbackOnPartiallyCorrect()); question.setFeedbackOnIncorrect(questionForm.getFeedbackOnIncorrect()); - // set instructions + // set options + Set optionList = getOptionsFromRequest(request, true); Set options = new LinkedHashSet(); int seqId = 0; for (AssessmentAnswerOption option : optionList) { option.setSequenceId(seqId++); options.add(option); } question.setAnswerOptions(options); + } else if ((type == AssessmentConstants.QUESTION_TYPE_MATCHING_PAIRS)) { + question.setPenaltyFactor(Float.parseFloat(questionForm.getPenaltyFactor())); + question.setShuffle(questionForm.isShuffle()); + + // set options + Set matchingPairsList = getOptionsFromRequest(request, true); + Set matchingPairs = new LinkedHashSet(); + int seqId = 0; + for (AssessmentAnswerOption matchingPair : matchingPairsList) { + matchingPair.setSequenceId(seqId++); + matchingPairs.add(matchingPair); + } + question.setAnswerOptions(matchingPairs); + }else if ((type == AssessmentConstants.QUESTION_TYPE_ESSAY)) { + question.setFeedback(questionForm.getFeedback()); } } -// /** -// * Vaidate assessment question regards to their type (url/file/learning object/website zip file) -// * -// * @param questionForm -// * @return -// */ -// private ActionErrors validateAssessmentQuestion(AssessmentQuestionForm questionForm, Set optionList) { -// ActionErrors errors = new ActionErrors(); -// if (StringUtils.isBlank(questionForm.getTitle())) { -// errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(AssessmentConstants.ERROR_MSG_QUESTION_NAME_BLANK)); -// } -//// if (StringUtils.isBlank(questionForm.getQuestion())) { -//// errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(AssessmentConstants.ERROR_MSG_QUESTION_TEXT_BLANK)); -//// } -// -// if (questionForm.getQuestionType() == AssessmentConstants.QUESTION_TYPE_CHOICE) { -// /* Checks if entered value is integer. */ -// try { -// Integer.parseInt(questionForm.getDefaultGrade()); -// } catch (NumberFormatException nfe) { -// errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage( -// AssessmentConstants.ERROR_MSG_DEFAULT_GRADE_WRONG_FORMAT)); -// } -// try { -// Float.parseFloat(questionForm.getPenaltyFactor()); -// } catch (NumberFormatException nfe) { -// errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage( -// AssessmentConstants.ERROR_MSG_PENALTY_FACTOR_WRONG_FORMAT)); -// } -// -// if (optionList.size() < 2) { -// errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(AssessmentConstants.ERROR_MSG_NOT_ENOUGH_OPTIONS)); -// } -// } -// return errors; -// } - /** * Get ToolAccessMode from HttpRequest parameters. Default value is AUTHOR mode. * @@ -1246,38 +1213,41 @@ * */ private TreeSet getOptionsFromRequest(HttpServletRequest request, boolean skipBlankOptions) { - String list = request.getParameter(AssessmentConstants.ATTR_OPTION_LIST); - String[] params = list.split("&"); - Map paramMap = new HashMap(); - String[] pair; - for (String item : params) { - pair = item.split("="); - if (pair == null || pair.length != 2) - continue; - try { - paramMap.put(pair[0], URLDecoder.decode(pair[1], "UTF-8")); - } catch (UnsupportedEncodingException e) { - log.error("Error occurs when decode instruction string:" + e.toString()); - }request.getParameter("optionAnswer1"); - } + Map paramMap = splitRequestParameter(request, AssessmentConstants.ATTR_OPTION_LIST); int count = NumberUtils.stringToInt(paramMap.get(AssessmentConstants.ATTR_OPTION_COUNT)); + int questionType = WebUtil.readIntParam(request,AssessmentConstants.ATTR_QUESTION_TYPE); TreeSet optionList = new TreeSet(new AssessmentAnswerOptionComparator()); for (int i = 0; i < count; i++) { - String answerString = paramMap.get(AssessmentConstants.ATTR_OPTION_ANSWER_PREFIX + i); - float grade = Float.valueOf(paramMap.get(AssessmentConstants.ATTR_OPTION_GRADE_PREFIX + i)); - String feedback = paramMap.get(AssessmentConstants.ATTR_OPTION_FEEDBACK_PREFIX + i); - String sequenceId = paramMap.get(AssessmentConstants.ATTR_OPTION_SEQUENCE_ID_PREFIX + i); - - if ((answerString == null) && skipBlankOptions){ - continue; + if (questionType == AssessmentConstants.QUESTION_TYPE_MULTIPLE_CHOICE) { + String answerString = paramMap.get(AssessmentConstants.ATTR_OPTION_ANSWER_PREFIX + i); + float grade = Float.valueOf(paramMap.get(AssessmentConstants.ATTR_OPTION_GRADE_PREFIX + i)); + String feedback = paramMap.get(AssessmentConstants.ATTR_OPTION_FEEDBACK_PREFIX + i); + String sequenceId = paramMap.get(AssessmentConstants.ATTR_OPTION_SEQUENCE_ID_PREFIX + i); + + if ((answerString == null) && skipBlankOptions) { + continue; + } + AssessmentAnswerOption option = new AssessmentAnswerOption(); + option.setSequenceId(NumberUtils.stringToInt(sequenceId)); + option.setAnswerString(answerString); + option.setGrade(grade); + option.setFeedback(feedback); + optionList.add(option); + } else if (questionType == AssessmentConstants.QUESTION_TYPE_MATCHING_PAIRS) { + String answerString = paramMap.get(AssessmentConstants.ATTR_OPTION_ANSWER_PREFIX + i); + String question = paramMap.get(AssessmentConstants.ATTR_OPTION_QUESTION_PREFIX + i); + String sequenceId = paramMap.get(AssessmentConstants.ATTR_OPTION_SEQUENCE_ID_PREFIX + i); + + if ((question == null) && skipBlankOptions) { + continue; + } + AssessmentAnswerOption option = new AssessmentAnswerOption(); + option.setSequenceId(NumberUtils.stringToInt(sequenceId)); + option.setAnswerString(answerString); + option.setQuestion(question); + optionList.add(option); } - AssessmentAnswerOption option = new AssessmentAnswerOption(); - option.setSequenceId(NumberUtils.stringToInt(sequenceId)); - option.setAnswerString(answerString); - option.setGrade(grade); - option.setFeedback(feedback); - optionList.add(option); } return optionList; } @@ -1319,23 +1289,8 @@ * @param request */ private TreeSet getOverallFeedbacksFromForm(HttpServletRequest request, boolean skipBlankOverallFeedbacks) { - String list = request.getParameter(AssessmentConstants.ATTR_OVERALL_FEEDBACK_LIST); - String[] params = list.split("&"); - Map paramMap = new HashMap(); - String[] pair; - for (String item : params) { - pair = item.split("="); - if (pair == null || pair.length != 2) - continue; - try { - paramMap.put(pair[0], URLDecoder.decode(pair[1], "UTF-8")); - } catch (UnsupportedEncodingException e) { - log.error("Error occurs when decode instruction string:" + e.toString()); - }request.getParameter("optionAnswer1"); - } + Map paramMap = splitRequestParameter(request, AssessmentConstants.ATTR_OVERALL_FEEDBACK_LIST); - - int count = NumberUtils.stringToInt(paramMap.get(AssessmentConstants.ATTR_OVERALL_FEEDBACK_COUNT)); TreeSet overallFeedbackList = new TreeSet( new AssessmentOverallFeedbackComparator()); @@ -1360,7 +1315,32 @@ } return overallFeedbackList; } + + /** + * Split Request Parameter from HttpRequest + * + * @param request + * @param parameterName parameterName + */ + private Map splitRequestParameter(HttpServletRequest request, String parameterName) { + String list = request.getParameter(parameterName); + String[] params = list.split("&"); + Map paramMap = new HashMap(); + String[] pair; + for (String item : params) { + pair = item.split("="); + if (pair == null || pair.length != 2) + continue; + try { + paramMap.put(pair[0], URLDecoder.decode(pair[1], "UTF-8")); + } catch (UnsupportedEncodingException e) { + log.error("Error occurs when decode instruction string:" + e.toString()); + } + } + return paramMap; + } + private ActionMessages validate(AssessmentForm assessmentForm, ActionMapping mapping, HttpServletRequest request) { ActionMessages errors = new ActionMessages(); // if (StringUtils.isBlank(assessmentForm.getAssessment().getTitle())) { Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/LearningAction.java =================================================================== diff -u -ra3e987093464232bfb4536f3335acc9851291b95 -rc437e028a3802f01fa80d40d99813c06944d0e9a --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/LearningAction.java (.../LearningAction.java) (revision a3e987093464232bfb4536f3335acc9851291b95) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/LearningAction.java (.../LearningAction.java) (revision c437e028a3802f01fa80d40d99813c06944d0e9a) @@ -388,7 +388,7 @@ // LearningAction.log.error("Failed upload Assessment File " + e.toString()); // return mapping.findForward(AssessmentConstants.ERROR); // } - } else if (type == AssessmentConstants.QUESTION_TYPE_CHOICE) { +// } else if (type == AssessmentConstants.QUESTION_TYPE_CHOICE) { // question.setUrl(questionForm.getUrl()); // question.setOpenUrlNewWindow(questionForm.isOpenUrlNewWindow()); } @@ -586,9 +586,6 @@ private ActionForward findForward(short type, ActionMapping mapping) { ActionForward forward; switch (type) { - case AssessmentConstants.QUESTION_TYPE_CHOICE: - forward = mapping.findForward("url"); - break; case AssessmentConstants.QUESTION_TYPE_MULTIPLE_CHOICE: forward = mapping.findForward("file"); break; @@ -637,7 +634,7 @@ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(AssessmentConstants.ERROR_MSG_QUESTION_NAME_BLANK)); } - if (questionForm.getQuestionType() == AssessmentConstants.QUESTION_TYPE_CHOICE) { + if (questionForm.getQuestionType() == AssessmentConstants.QUESTION_TYPE_MULTIPLE_CHOICE) { // if (StringUtils.isBlank(questionForm.getUrl())) { // errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(AssessmentConstants.ERROR_MSG_URL_BLANK)); // // URL validation: Commom URL validate(1.3.0) work not very well: it can not support http://address:port Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/form/AssessmentQuestionForm.java =================================================================== diff -u -rc56857991e269aa7f5bd250a05b52c767a9957ad -rc437e028a3802f01fa80d40d99813c06944d0e9a --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/form/AssessmentQuestionForm.java (.../AssessmentQuestionForm.java) (revision c56857991e269aa7f5bd250a05b52c767a9957ad) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/form/AssessmentQuestionForm.java (.../AssessmentQuestionForm.java) (revision c437e028a3802f01fa80d40d99813c06944d0e9a) @@ -48,6 +48,8 @@ private String defaultGrade; private String penaltyFactor; private String generalFeedback; + private String feedback; + private boolean multipleAnswersAllowed; private String feedbackOnCorrect; private String feedbackOnPartiallyCorrect; private String feedbackOnIncorrect; @@ -133,7 +135,23 @@ public void setGeneralFeedback(String generalFeedback) { this.generalFeedback = generalFeedback; } + + public String getFeedback() { + return feedback; + } + public void setFeedback(String feedback) { + this.feedback = feedback; + } + + public boolean isMultipleAnswersAllowed() { + return multipleAnswersAllowed; + } + + public void setMultipleAnswersAllowed(boolean multipleAnswersAllowed) { + this.multipleAnswersAllowed = multipleAnswersAllowed; + } + public String getFeedbackOnCorrect() { return feedbackOnCorrect; } Index: lams_tool_assessment/web/includes/javascript/assessmentoption.js =================================================================== diff -u --- lams_tool_assessment/web/includes/javascript/assessmentoption.js (revision 0) +++ lams_tool_assessment/web/includes/javascript/assessmentoption.js (revision c437e028a3802f01fa80d40d99813c06944d0e9a) @@ -0,0 +1,56 @@ + /* + This is Assessment Question option area. + */ + var optionTargetDiv = "#optionArea"; + // Please set these 2 variables in JSP file for using tag reason: + // var removeOptionUrl = ""; + // var addOptionUrl = ""; + function addOption(){ + var url= addOptionUrl; + var optionList = $("#optionForm").serialize(true); + $(optionTargetDiv).load( + url, + { + questionType: questionType, + optionList: optionList + } + ); + } + function removeOption(idx){ + var url= removeOptionUrl; + var optionList = $("#optionForm").serialize(true); + $(optionTargetDiv).load( + url, + { + questionType: questionType, + optionIndex: idx, + optionList: optionList + } + ); + } + function upOption(idx){ + var url= upOptionUrl; + var optionList = $("#optionForm").serialize(true); + $(optionTargetDiv).load( + url, + { + questionType: questionType, + optionIndex: idx, + optionList: optionList + } + ); + } + function downOption(idx){ + var url= downOptionUrl; + var optionList = $("#optionForm").serialize(true); + $(optionTargetDiv).load( + url, + { + questionType: questionType, + optionIndex: idx, + optionList: optionList + } + ); + } + + Fisheye: Tag c437e028a3802f01fa80d40d99813c06944d0e9a refers to a dead (removed) revision in file `lams_tool_assessment/web/includes/javascript/assessmentquestion.js'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c437e028a3802f01fa80d40d99813c06944d0e9a refers to a dead (removed) revision in file `lams_tool_assessment/web/includes/javascript/cmxforms.js'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_assessment/web/includes/javascript/jquery.FCKEditor.js =================================================================== diff -u --- lams_tool_assessment/web/includes/javascript/jquery.FCKEditor.js (revision 0) +++ lams_tool_assessment/web/includes/javascript/jquery.FCKEditor.js (revision c437e028a3802f01fa80d40d99813c06944d0e9a) @@ -0,0 +1,251 @@ +/* + ### jQuery FCKEditor Plugin v1.3 - 2008-10-09 ### + * http://www.fyneworks.com/ - diego@fyneworks.com + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + ### + Project: http://jquery.com/plugins/project/FCKEditor/ + Website: http://www.fyneworks.com/jquery/FCKEditor/ +*/ +/* + USAGE: $('textarea').fck({ path:'/path/to/fck/editor/' }); // initialize FCK editor + ADVANCED USAGE: $.fck.update(); // update value in textareas of each FCK editor instance +*/ + +/*# AVOID COLLISIONS #*/ +;if(window.jQuery) (function($){ +/*# AVOID COLLISIONS #*/ + +$.extend($, { + fck:{ + waitFor: 10,// in seconds, how long should we wait for the script to load? + config: { Config: {} }, // default configuration + path: '/fckeditor/', // default path to FCKEditor directory + editors: [], // array of editor instances + loaded: false, // flag indicating whether FCK script is loaded + intercepted: null, // variable to store intercepted method(s) + + // utility method to read contents of FCK editor + content: function(i, v){ + //try{ + //if(window.console) console.log(['fck.content',arguments]); + var x = FCKeditorAPI.GetInstance(i); + //if(window.console) console.log(['fck.content','x',x]); + // Look for textare with matching name for backward compatibility + if(!x){ + x = $('#'+i.replace(/\./gi,'\\\.')+'')[0]; + //if(window.console) console.log(['fck.content','ele',x]); + if(x) x = FCKeditorAPI.GetInstance(x.id); + }; + if(!x){ + alert('FCKEditor instance "'+i+'" could not be found!'); + return ''; + }; + if(v) x.SetHTML(v); + //if(window.console) console.log(['fck.content','x',x.GetXHTML]); + return x.GetXHTML(true); + //}catch(e){ return 'OOPS!'; }; + }, // fck.content function + + // inspired by Sebasti�n Barrozo + setHTML: function(i, v){ + if(typeof i=='object'){ + v = i.html; + i = i.InstanceName || i.instance; + }; + return $.fck.content(i, v); + }, + + // utility method to update textarea contents before ajax submission + update: function(){ + // Ignore missing editors + $.fck.clean(); + // Update contents of all instances + var e = $.fck.editors; + alert($.fck); + //if(window.console) console.log(['fck.update',e]); + for(var i=0;i0) + b[this.InstanceName] = this; + }); + //if(window.console) console.log(['fck.clean','b',b]); + $.each(b, function(){ c[c.length] = this; }); + //if(window.console) console.log(['fck.clean','c',c]); + $.fck.editors = c; + //if(window.console) console.log(['fck.clean',$.fck.editors]); + }, // fck.clean + + // utility method to create instances of FCK editor (if any) + create: function(option){ + // Create a new options object + var o = $.extend({}/* new object */, $.fck.config || {}, option || {}); + // Normalize plugin options + $.extend(o, { + selector: (o.selector || 'textarea.fck, textarea.fckeditor'), + BasePath: (o.path || o.BasePath || $.fck.path) + }); + // Find fck.editor-instance 'wannabes' + var e = $(o.e); + if(!e.length>0) e = $(o.selector); + if(!e.length>0) return; + // Accept settings from metadata plugin + o = $.extend({}, o, + ($.meta ? e.data()/*NEW metadata plugin*/ : + ($.metadata ? e.metadata()/*OLD metadata plugin*/ : + null/*metadata plugin not available*/)) || {} + ); + // Load script and create instances + if(!$.fck.loading && !$.fck.loaded){ + $.fck.loading = true; + $.getScript( + o.BasePath+'fckeditor.js', + function(){ $.fck.loaded = true; } + ); + }; + // Start editor + var start = function(){//e){ + if($.fck.loaded){ + //if(window.console) console.log(['fck.create','start',e,o]); + $.fck.editor(e,o); + } + else{ + //if(window.console) console.log(['fck.create','waiting for script...',e,o]); + if($.fck.waited<=0){ + alert('jQuery.fckeditor plugin error: The FCKEditor script did not load.'); + } + else{ + $.fck.waitFor--; + window.setTimeout(start,1000); + }; + } + }; + start(e); + // Return matched elements... + return e; + }, + + // utility method to integrate this plugin with others... + intercept: function(){ + if($.fck.intercepted) return; + // This method intercepts other known methods which + // require up-to-date code from FCKEditor + $.fck.intercepted = { + ajaxSubmit: $.fn.ajaxSubmit || function(){} + }; + $.fn.ajaxSubmit = function(){ + //if(window.console) console.log(['fck.intercepted','$.fn.ajaxSubmit',$.fck.editors]); + $.fck.update(); // update html + return $.fck.intercepted.ajaxSubmit.apply( this, arguments ); + }; + // Also attach to conventional form submission + //$('form').submit(function(){ + // $.fck.update(); // update html + //}); + }, + + // utility method to create an instance of FCK editor + editor: function(e /* elements */, o /* options */){ + //if(window.console) console.log(['fck.editor','OPTIONS',o]); + o = $.extend({}, $.fck.config || {}, o || {}); + // Default configuration + $.extend(o,{ + Width: (o.width || o.Width || '100%'), + Height: (o.height || o.Height|| '500px'), + BasePath: (o.path || o.BasePath || $.fck.path), + ToolbarSet: (o.toolbar || o.ToolbarSet || 'Default'), + Config: (o.config || o.Config || {}) + }); + // Make sure we have a jQuery object + e = $(e); + //if(window.console) console.log(['fck.editor','E',e,o]); + if(e.size()>0){ + // Local array to store instances + var a = $.fck.editors;// || []; + // Go through objects and initialize fck.editor + e.each( + function(i,t){ + if((t.tagName||'').toLowerCase()!='textarea') + return alert(['An invalid parameter has been passed to the $.fckeditor.editor function','tagName:'+t.tagName,'name:'+t.name,'id:'+t.id].join('\n')); + + var T = $(t);// t = element, T = jQuery + if(!t.fck/* not already installed */){ + t.id = t.id || 'fck'+($.fck.editors.length+1); + t.name = t.name || t.id; + var n = a.length; + // create FCKeditor instance + //if(window.console) console.log(['fck.editor','new FCKeditor',t.id,t]); + a[n] = new FCKeditor(t.id); + // Apply inline configuration + //if(window.console) console.log(['fck.editor','Apply inline configuration',o]); + $.extend(a[n], o, o.Config || {}); + // Start FCKeditor + a[n].ReplaceTextarea(); + // Store reference to original element + a[n].textarea = T; + // Store reference to FCKeditor in element + //if(window.console) console.log(['fck.editor','Store reference to FCKeditor in element',a[n]]); + t.fck = a[n]; + }; + } + ); + // Store editor instances in global array + //if(window.console) console.log(['fck.editor','Store editor instances in global array',a]); + $.fck.editors = a; + //if(window.console) console.log(['fck.editor','$.fck.editors',$.fck.editors]); + // Remove old non-existing editors from memory + $.fck.clean(); + }; + // return jQuery array of elements + return e; + }, // fck.editor function + + // start-up method + start: function(o/* options */){ + // Attach itself to known plugins... + $.fck.intercept(); + // Create FCK editors + return $.fck.create(o); + } // fck.start + + } // fck object + //############################## + +}); +// extend $ +//############################## + + +$.extend($.fn, { + fck: function(o){ + //(function(opts){ $.fck.start(opts); })($.extend(o || {}, {e: this})); + $.fck.start($.extend(o || {}, {e: this})); + } +}); +// extend $.fn +//############################## + +/*# AVOID COLLISIONS #*/ +})(jQuery); +/*# AVOID COLLISIONS #*/ Index: lams_tool_assessment/web/pages/authoring/basic.jsp =================================================================== diff -u -ra3e987093464232bfb4536f3335acc9851291b95 -rc437e028a3802f01fa80d40d99813c06944d0e9a --- lams_tool_assessment/web/pages/authoring/basic.jsp (.../basic.jsp) (revision a3e987093464232bfb4536f3335acc9851291b95) +++ lams_tool_assessment/web/pages/authoring/basic.jsp (.../basic.jsp) (revision c437e028a3802f01fa80d40d99813c06944d0e9a) @@ -102,8 +102,7 @@

+ + + + + + + +

+ +

+ +
+ + Required field +
+ + +
+ +
+ + + +
+ + Required field +
+ + +
+ + Required field +
+ + +
+ +
+ + +
+ +
+ + +

+ +
+ +
+ + + + +
+ <%@ include file="optionlist.jsp"%> + + + +
+ +


+ + + + + + + + + + + + + + + + + Index: lams_tool_assessment/web/pages/authoring/parts/addmultiplechoice.jsp =================================================================== diff -u --- lams_tool_assessment/web/pages/authoring/parts/addmultiplechoice.jsp (revision 0) +++ lams_tool_assessment/web/pages/authoring/parts/addmultiplechoice.jsp (revision c437e028a3802f01fa80d40d99813c06944d0e9a) @@ -0,0 +1,208 @@ + + +<%@ include file="/common/taglibs.jsp"%> + + + <%@ include file="/common/header.jsp"%> + + + + + + + + + + + + + + + + + +
+ <%@ include file="/common/messages.jsp"%> + + + + + + + + + + + + + +

+ +

+ +
+ + Required field +
+ + +
+ +
+ + + +
+ + Required field +
+ + +
+ + Required field +
+ + +
+ +
+ + +
+ +
+ + + + + +
+ +
+ + +

+ + +
+ +
+ +
+ + +
+ <%@ include file="optionlist.jsp"%> + + + +
+ + +
+ +
+
+
+ +
+ + +
+ +
+ + +
+ +
+ +
+ + + + + + + + + + +
+ + + + + + +
Fisheye: Tag c437e028a3802f01fa80d40d99813c06944d0e9a refers to a dead (removed) revision in file `lams_tool_assessment/web/pages/authoring/parts/addurl.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c437e028a3802f01fa80d40d99813c06944d0e9a refers to a dead (removed) revision in file `lams_tool_assessment/web/pages/authoring/parts/addwebsite.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_assessment/web/pages/authoring/parts/matchingpair.jsp =================================================================== diff -u --- lams_tool_assessment/web/pages/authoring/parts/matchingpair.jsp (revision 0) +++ lams_tool_assessment/web/pages/authoring/parts/matchingpair.jsp (revision c437e028a3802f01fa80d40d99813c06944d0e9a) @@ -0,0 +1,24 @@ + + + + + + + + + +
+ + + + + + +
+ + + + + +
\ No newline at end of file Index: lams_tool_assessment/web/pages/authoring/parts/matchingpairslist.jsp =================================================================== diff -u --- lams_tool_assessment/web/pages/authoring/parts/matchingpairslist.jsp (revision 0) +++ lams_tool_assessment/web/pages/authoring/parts/matchingpairslist.jsp (revision c437e028a3802f01fa80d40d99813c06944d0e9a) @@ -0,0 +1,59 @@ +<%@ include file="/common/taglibs.jsp"%> +
+
+ + +
+ +
+ + + + + + + + + + + + +
+ ${status.index+1} + + + + + " + onclick="upOption(${status.index})"> + + "> + + + + + + "> + + + " + onclick="downOption(${status.index})"> + + + " + onclick="removeOption(${status.index})" /> +
+ + + + + +
+
\ No newline at end of file Index: lams_tool_assessment/web/pages/authoring/parts/option.jsp =================================================================== diff -u --- lams_tool_assessment/web/pages/authoring/parts/option.jsp (revision 0) +++ lams_tool_assessment/web/pages/authoring/parts/option.jsp (revision c437e028a3802f01fa80d40d99813c06944d0e9a) @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + +
+ + + + + + +
+ + + + + + 100 % + 90 % + 83.333 % + 80 % + 75% + 70 % + 66.666 % + 60 % + 50 % + 40 % + 33.333 % + 30 % + 25 % + 20 % + 16.666 % + 14.2857 % + 12.5 % + 11.111 % + 10 % + 5 % + + -5 % + -10 % + -11.111 % + -12.5 % + -14.2857 % + -16.666 % + -20 % + -25 % + -30 % + -33.333 % + -40 % + -50 % + -60 % + -66.666 % + -70 % + -75 % + -80 % + -83.333 % + -90 % + -100 % + +
+ + + + + +
Index: lams_tool_assessment/web/pages/authoring/parts/optionlist.jsp =================================================================== diff -u -ra3e987093464232bfb4536f3335acc9851291b95 -rc437e028a3802f01fa80d40d99813c06944d0e9a --- lams_tool_assessment/web/pages/authoring/parts/optionlist.jsp (.../optionlist.jsp) (revision a3e987093464232bfb4536f3335acc9851291b95) +++ lams_tool_assessment/web/pages/authoring/parts/optionlist.jsp (.../optionlist.jsp) (revision c437e028a3802f01fa80d40d99813c06944d0e9a) @@ -1,145 +1,56 @@ <%@ include file="/common/taglibs.jsp"%> - -
-
- + + -
- - -
- - - - - - +
- ${status.index+1} - - - - - - - - - - - - - - - -
- - - - - - -
- - - - - - 100 % - 90 % - 83.333 % - 80 % - 75% - 70 % - 66.666 % - 60 % - 50 % - 40 % - 33.333 % - 30 % - 25 % - 20 % - 16.666 % - 14.2857 % - 12.5 % - 11.111 % - 10 % - 5 % - - -5 % - -10 % - -11.111 % - -12.5 % - -14.2857 % - -16.666 % - -20 % - -25 % - -30 % - -33.333 % - -40 % - -50 % - -60 % - -66.666 % - -70 % - -75 % - -80 % - -83.333 % - -90 % - -100 % - -
- - - - - -
-
+ + + + - + + " + onclick="downOption(${status.index})"> + + - - - -
+ ${status.index+1} + + + + <%@ include file="option.jsp"%> + + + <%@ include file="matchingpair.jsp"%> + + + - - " - onclick="upOption(${status.index})"> - - "> - + + + " + onclick="upOption(${status.index})"> + + "> + - - - "> - - - " - onclick="downOption(${status.index})"> + + + "> - - " - onclick="removeOption(${status.index})" /> -
- - - - - -
-
- -<%-- This script will adjust assessment item input area height according to the new instruction item amount. --%> - + + " + onclick="removeOption(${status.index})" /> + + + + + \ No newline at end of file Index: lams_tool_assessment/web/pages/authoring/parts/questionlist.jsp =================================================================== diff -u -rc56857991e269aa7f5bd250a05b52c767a9957ad -rc437e028a3802f01fa80d40d99813c06944d0e9a --- lams_tool_assessment/web/pages/authoring/parts/questionlist.jsp (.../questionlist.jsp) (revision c56857991e269aa7f5bd250a05b52c767a9957ad) +++ lams_tool_assessment/web/pages/authoring/parts/questionlist.jsp (.../questionlist.jsp) (revision c437e028a3802f01fa80d40d99813c06944d0e9a) @@ -24,27 +24,21 @@ - - - - + - - - - + - + - + - +