Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23785/WEB-INF/maple/aim
Modified Files:
Question.mpl Quiz.mpl
Log Message:
Index: Question.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Question.mpl,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Question.mpl 10 Mar 2004 02:04:44 -0000 1.11
--- Question.mpl 11 Mar 2004 13:39:42 -0000 1.12
***************
*** 99,106 ****
],
- # KM
- # DIST ['Field','TimeLimit'::numeric = 2.0,
['Field','TimeLimit'::numeric = Config['TimeLimit'],
- # END KM
"The maximum time allowed for the @IProc@, @SProc@, @MProc@ or
@AProc@ procedures to run.
--- 99,103 ----
***************
*** 705,712 ****
tlimit := this['TimeLimit'];
if not(type([tlimit],[numeric])) then
- # KM
- # DIST tlimit := 2.0;
tlimit := Config['TimeLimit'];
- # END KM
fi;
--- 702,706 ----
***************
*** 1767,1771 ****
if b = 0 or r = 0. then
msg := sprintf(__("Your mark is %.2f"),mark);
- # KM
if b>0 then
msg := cat(msg,sprintf(__(".    You have made %d incorrect attempts."),b+1));
--- 1761,1764 ----
***************
*** 1773,1777 ****
msg := cat(msg,".    You have made one incorrect attempt.");
fi:
- # END KM
elif b = 1 then
msg :=
--- 1766,1769 ----
***************
*** 2012,2018 ****
local attempt,history,quizcontext,
ansvar,locals,savedframe,err,sproc,tlimit;
- # KM
global Config;
! # END KM
if type([vrsion],[`aim/MultiQuestion/Version`]) then
ERROR(__("The `aim/Question/Instance` constructor cannot be used for multipart questions"));
--- 2004,2009 ----
local attempt,history,quizcontext,
ansvar,locals,savedframe,err,sproc,tlimit;
global Config;
!
if type([vrsion],[`aim/MultiQuestion/Version`]) then
ERROR(__("The `aim/Question/Instance` constructor cannot be used for multipart questions"));
***************
*** 2208,2215 ****
",
proc(this,quizcontext::`aim/Quiz/Context`,labels::list(string))
- # KM
- # DIST local reviewmode, trymode, qtrymode,
local reviewmode, trymode, qtrymode, jscript,
! # END KM
focused, focuslabel, focusindex,
nav, href, header, control, editlink, label;
--- 2199,2204 ----
",
proc(this,quizcontext::`aim/Quiz/Context`,labels::list(string))
local reviewmode, trymode, qtrymode, jscript,
!
focused, focuslabel, focusindex,
nav, href, header, control, editlink, label;
***************
*** 2625,2635 ****
["hr"],
[["div", "class" = "rightanswer"],
- # KM
[["table", "width"="100%", "bgcolor"="PaleGoldenRod"],
["tr",
[["td", "width"="100%"],
this['ReportRightAnswer']]]]]];
- # DIST this['ReportRightAnswer']]];
- # END KM
fi;
fi; # ends if type([this],[`aim/MultiQuestion/Instance`])
--- 2614,2621 ----
***************
*** 2638,2644 ****
this['Solution'] <> "" then
html['AddContents',
- # DIST ["hr"],
[["div", "class" = "solution"],
- # KM
[["table", "width"="100%", "bgcolor"="PaleGoldenRod"],
["tr",[["td", "width"="100%"],["hr"]]],
--- 2624,2628 ----
***************
*** 2649,2656 ****
["tr",
[["td", "width"="100%"],this['Solution']]]]]];
- # DIST ["b",__("Solution:")],
- # DIST ["br"],
- # DIST this['Solution']]];
- # END KM
fi;
--- 2633,2636 ----
***************
*** 2829,2833 ****
],
- # KM
['Field','PartLabel'::string,
"If this is the 3rd subsubquestion of the 5th subquestion of a
--- 2809,2812 ----
***************
*** 2836,2840 ****
"
],
- # END KM
['Field','NumHistories'::integer,
--- 2815,2818 ----
***************
*** 2986,2990 ****
nam := this['QuestionName'];
partlabel := this['PartLabel'];
! questionhistory := eval(nametable[nam,partlabel]);
if type([questionhistory],[`aim/Question/History`]) then
this['AddHistory',questionhistory];
--- 2964,2973 ----
nam := this['QuestionName'];
partlabel := this['PartLabel'];
! try
! questionhistory :=
! eval(quizhistory['GetQuestionByName',
! this['QuestionName'],this['PartLabel']]);
! catch:
! end:
if type([questionhistory],[`aim/Question/History`]) then
this['AddHistory',questionhistory];
Index: Quiz.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Quiz.mpl,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Quiz.mpl 10 Mar 2004 02:04:45 -0000 1.6
--- Quiz.mpl 11 Mar 2004 13:39:42 -0000 1.7
***************
*** 568,572 ****
fi;
else
! h['ReMarkQuestion',questionname,question];
this['SaveHistory',id,h];
fi;
--- 568,572 ----
fi;
else
! h['ReMarkQuestion',question];
this['SaveHistory',id,h];
fi;
***************
*** 853,856 ****
--- 853,873 ----
],
+ ['Method','ContainsLabel'::boolean,
+ "Return @true@ if this quiz history contains a question history for
+ the question with the specified label.
+ ",
+ proc(this,label::string)
+ local msg,questionhistory;
+
+ if member(label,this['Labels']) then
+ questionhistory := eval(this['LabelTable'][label]);
+ if type([questionhistory],[`aim/Question/History`]) then
+ return(true);
+ fi;
+ fi;
+ false;
+ end
+ ],
+
['Method','GetQuestionByLabel'::`aim/Question/History`,
"Return the #`aim/Question/History`# object for the question with the
***************
*** 858,870 ****
",
proc(this,label::string)
! local msg;
if member(label,this['Labels']) then
! RETURN(eval(this['QuestionHistory'][label]));
! else
! msg :=
! sprintf(__("Quiz history contains no question with label %s"),label);
! ERROR(msg);
fi;
end
],
--- 875,906 ----
",
proc(this,label::string)
! local msg,questionhistory;
if member(label,this['Labels']) then
! questionhistory := eval(this['LabelTable'][label]);
! if type([questionhistory],[`aim/Question/History`]) then
! return(eval(questionhistory));
! fi;
! fi;
! msg := sprintf(__("Quiz history contains no question with label %s"),label);
! ERROR(msg);
! end
! ],
!
! ['Method','ContainsName'::boolean,
! "Return @true@ if this quiz history contains a question history for
! the question with the specified name and part label.
! ",
! proc(this,questionname::string,
! # optional
! partlabel_::string)
! local partlabel,msg,questionhistory;
!
! partlabel := `if`(nargs > 2,partlabel_,"");
! questionhistory := eval(this['NameTable'][questionname,partlabel]);
! if type([questionhistory],[`aim/Question/History`]) then
! return(true);
fi;
+ false;
end
],
***************
*** 895,898 ****
--- 931,958 ----
],
+
+ ['Method','PutQuestion'::void,
+ "Puts the history for a specified question into the quiz history.
+ ",
+ proc(this,questionname::string,label::string,
+ questionhistory::`aim/Question/History`)
+ local nametable,labeltable,partlabel,msg,i;
+
+ i := searchtext(".",label);
+ partlabel := `if`(i>0,substring(label,i..-1),"");
+
+ nametable := eval(this['NameTable']);
+ labeltable := eval(this['LabelTable']);
+
+ if not(member(label,this['Labels'])) then
+ this['Labels'] := [op(this['Labels']),label];
+ fi;
+
+ nametable[questionname,partlabel] := eval(questionhistory);
+ labeltable[label] := eval(questionhistory);
+ NULL;
+ end
+ ],
+
['Field','TotalMarks'::list(numeric) = [],""],
***************
*** 1124,1149 ****
['Method','ReMarkQuestion'::void,
! "Re-mark the question with the specified name (if present). The
! question itself can be supplied as an optional third argument.
! This is just for efficiency when re-marking the same question
! for many students.
<br/><br/>
This method does not save the re-marked history.
",
! proc(this,
! questionname::string,
! question_::`aim/Question`)
! local question,questionhistory,questionseed,vrsion,msg,
parts,part,parthistories,newparthistories,parthistory,
attemptcount,rawtable,wasmarked,quizcontext,inst,
! multipleattempt,attempt,err,i;
!
! question :=
! traperror(
! eval(`if`(nargs > 2,question_,this['GetQuestion',questionname])));
!
! if not(type([question],[`aim/Question`])) then
! ERROR(__("Could not load question to re-mark"));
! fi;
if type([question],[`aim/MultiQuestion`]) then
--- 1184,1198 ----
['Method','ReMarkQuestion'::void,
! "Re-mark the specified question (if present).
<br/><br/>
This method does not save the re-marked history.
",
! proc(this,question::`aim/Question`)
! local questionname,questionhistory,questionseed,vrsion,msg,
parts,part,parthistories,newparthistories,parthistory,
attemptcount,rawtable,wasmarked,quizcontext,inst,
! multipleattempt,attempt,err,toplabel,i,j,q;
!
! questionname := question['Name'];
if type([question],[`aim/MultiQuestion`]) then
***************
*** 1154,1163 ****
if parts = [] then RETURN(); end;
part := parts[1];
questionhistory :=
eval(this['GetQuestionByName',questionname,part]);
! if questionhistory = NULL then
! RETURN();
! elif not(type([questionhistory],[`aim/Question/History`])) then
ERROR(__("Malformed question history"));
fi;
--- 1203,1215 ----
if parts = [] then RETURN(); end;
part := parts[1];
+
+ if not(this['ContainsName',questionname,part]) then
+ RETURN();
+ fi;
+
questionhistory :=
eval(this['GetQuestionByName',questionname,part]);
! if not(type([questionhistory],[`aim/Question/History`])) then
ERROR(__("Malformed question history"));
fi;
***************
*** 1167,1170 ****
--- 1219,1242 ----
questionseed := questionhistory['QuestionSeed'];
+ # We need a clumsy hack to find out the label of the top-level
+ # question. This should really be recorded more explicitly.
+ toplabel := NULL;
+ for i in this['Labels'] do
+ q := eval(this['LabelTable'][i]);
+ if q['QuestionName'] = question['Name'] then
+ j := searchtext(".",i);
+ if j > 0 then
+ toplabel := substring(i,1..(j-1));
+ else
+ toplabel := i;
+ fi;
+ break;
+ fi;
+ od;
+
+ if toplabel = NULL then
+ ERROR(__("Cannot find question label"));
+ fi;
+
vrsion :=
traperror(
***************
*** 1226,1230 ****
eval(vrsion),eval(rawtable),
eval(newparthistories),eval(quizcontext));
! od
else # not a multipart question
--- 1298,1309 ----
eval(vrsion),eval(rawtable),
eval(newparthistories),eval(quizcontext));
! od;
!
! for part in parts do
! this['PutQuestion',
! questionname,
! cat(toplabel,part),
! eval(newparthistories[part])];
! od;
else # not a multipart question
|