Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim
In directory sc8-pr-cvs1:/tmp/cvs-serv12533
Modified Files:
Compile.mpl Question.mpl TextQuestion.mpl
Log Message:
added answerboxsize> flag and related modifications
Index: Compile.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Compile.mpl,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Compile.mpl 19 Sep 2003 04:11:15 -0000 1.7
--- Compile.mpl 4 Oct 2003 01:21:17 -0000 1.8
***************
*** 192,195 ****
--- 192,198 ----
iproc,iproclocals,sproc,mproc,mproctext,
x,y,err,msg,nam,level,partlabel,title,desc,flagnum,
+ # KM
+ ansboxsize,setboxwidth,setboxheight,
+ # END KM
xtype,shft,tlimit;
***************
*** 218,221 ****
--- 221,227 ----
# DIST tlimit := 2.0;
tlimit := Config['TimeLimit'];
+ ansboxsize := NULL;
+ setboxwidth := NULL;
+ setboxheight := NULL;
# END
***************
*** 441,444 ****
--- 447,473 ----
sprintf("questionversion['Prompt'] := `aim/LaTeX/WrapSubs`(%a);\n",text);
##########
+ # KM
+ elif flag = "answerboxsize>" then
+ if ansboxsize = NULL then
+ try ansboxsize := `Util/Parse`(text);
+ catch : return [
+ sprintf(__("Cannot parse answerboxsize> flag: %s\n%s\n\n"),text,lasterr),
+ nam,flagnum,lines];
+ end:
+ if not type([ansboxsize],{[nonnegint],[nonnegint,nonnegint]}) then
+ return [
+ sprintf(__("Answer box size must be of the form w or w,h where w and h are nonnegative integers: %A"),
+ `Util/CommaJoin`(ansboxsize)),
+ nam,flagnum,lines];
+ else
+ if nops([ansboxsize])=2 then
+ setboxheight:=sprintf("questionversion['AnswerBoxHeight'] := %d;\n",ansboxsize[2]);
+ fi:
+ setboxwidth := sprintf("questionversion['AnswerBoxWidth'] := %d;\n",
+ [ansboxsize][1]);
+ fi;
+ fi:
+ # END KM
+ ##########
elif flag = "postprompt>" then
setpost :=
***************
*** 664,668 ****
fi;
! iproc := iproc,setans,setnote,setprompt,setpost,settype;
elif qtype = 'MATRIX' then
--- 693,700 ----
fi;
! # KM
! # WAS: iproc := iproc,setans,setnote,setprompt,setpost,settype;
! iproc := iproc,setans,setnote,setprompt,setboxwidth,setboxheight,setpost,settype;
! # END KM
elif qtype = 'MATRIX' then
***************
*** 1257,1260 ****
--- 1289,1295 ----
"answertest>",
"answervariable>",
+ # KM
+ "answerboxsize>",
+ # END KM
"note>",
"prompt>",
***************
*** 1288,1291 ****
--- 1323,1329 ----
"ap>" = "prompt>",
"av>" = "answervariable>",
+ # KM
+ "as>" = "answerboxsize>",
+ # END KM
"c>" = "mapletype>",
"d>" = "description>",
Index: Question.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Question.mpl,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Question.mpl 6 Sep 2003 13:13:36 -0000 1.7
--- Question.mpl 4 Oct 2003 01:21:17 -0000 1.8
***************
*** 2153,2160 ****
if not(trymode or reviewmode) then
href := sprintf("javascript:Focus('%s');",
! this['Label']);
nav['AddContents',
! ["td",
! [["a","href" = href],__("Focus")]]];
fi;
--- 2153,2160 ----
if not(trymode or reviewmode) then
href := sprintf("javascript:Focus('%s');",
! this['Label']);
nav['AddContents',
! ["td",
! [["a","href" = href],__("Focus")]]];
fi;
***************
*** 2191,2195 ****
[["a",
"href" = sprintf("javascript:EditSource('%s');",
! this['SourceFile'])],
__("Edit source file")])]]);
--- 2191,2195 ----
[["a",
"href" = sprintf("javascript:EditSource('%s');",
! this['SourceFile'])],
__("Edit source file")])]]);
***************
*** 2229,2233 ****
[["a",
"href" = sprintf("javascript:EditSource('%s');",
! this['SourceFile'])],
__("Edit source file")])]]);
--- 2229,2233 ----
[["a",
"href" = sprintf("javascript:EditSource('%s');",
! this['SourceFile'])],
__("Edit source file")])]]);
***************
*** 2924,2928 ****
['Field','Contents'::{list(`aim/Question/Analysis/Entry`),
! list(`aim/Question/Analysis/Summary/Layer`)},
""
],
--- 2924,2928 ----
['Field','Contents'::{list(`aim/Question/Analysis/Entry`),
! list(`aim/Question/Analysis/Summary/Layer`)},
""
],
***************
*** 3075,3079 ****
",
proc(this,indent_::integer)
! local indent,prefix,html;
if nargs > 1 then
--- 3075,3079 ----
",
proc(this,indent_::integer)
! local indent,prefix,html,crstring;
if nargs > 1 then
***************
*** 3085,3092 ****
fi;
! html := "";
if this['Key'] <> NULL then
! html :=
! sprintf("%s%s%a = %a",html,prefix,this['Key'],this['KeyValue']);
fi;
if this['IsSplit'] = true then
--- 3085,3104 ----
fi;
! html := ""; crstring:=false;
if this['Key'] <> NULL then
! # KM
! if type(this['KeyValue'],string) and
! StringTools:-Search("\n",this['KeyValue'])>0 then
! crstring:=true;
! html :=
! sprintf("%s%s%a = <center><table><tr><td><pre>%s</pre></td></tr></table></center>",
! html,prefix,this['Key'],this['KeyValue']);
! else
! # END KM
! html :=
! sprintf("%s%s%a = %a",html,prefix,this['Key'],this['KeyValue']);
! # KM
! fi:
! # END KM
fi;
if this['IsSplit'] = true then
***************
*** 3096,3100 ****
op(map((x,i) -> x['ToHTML',i],this['Contents'],indent+1)));
else
! html := sprintf("%s x %d<br/>\n",html,nops(this['Contents']));
fi;
--- 3108,3118 ----
op(map((x,i) -> x['ToHTML',i],this['Contents'],indent+1)));
else
! # KM
! if not crstring then
! # END KM
! html := sprintf("%s x %d<br/>\n",html,nops(this['Contents']));
! # KM
! fi:
! # END KM
fi;
Index: TextQuestion.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/TextQuestion.mpl,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** TextQuestion.mpl 24 Sep 2003 00:16:08 -0000 1.7
--- TextQuestion.mpl 4 Oct 2003 01:21:18 -0000 1.8
***************
*** 58,61 ****
--- 58,72 ----
"The question of which this is a version."
],
+
+ # KM
+ ['Field','AnswerBoxWidth'::nonnegint = 50,
+ "The width of the html answer box presented to the student for the answer."
+ ],
+
+ ['Field','AnswerBoxHeight'::nonnegint = 1,
+ "The width of the html answer box presented to the student for the answer."
+ ],
+ # END KM
+
['Field','Prompt'::string = __("Answer: "),
***************
*** 260,270 ****
",
proc(this)
cat("<br/>\n",
this['Prompt'],
! sprintf(
! "<input type='text' name='RawAnswer%s' size='50' value = '%s'/>",
this['Label'],
! this['Attempt']['RawAnswer']
! ),
this['PostPrompt'],
"\n<br/>\n"
--- 271,351 ----
",
proc(this)
+
+ # KM
+ local inputbox;
+
+ if this['AnswerBoxHeight'] = 1 then
+ if this['AnswerBoxWidth'] = 0 then
+ inputbox:=""
+ else
+ inputbox:=sprintf(
+ cat("<input type='text' name='RawAnswer%s'",
+ " autocomplete='off' size='%d' value = '%s' />"),
+ this['Label'],
+ this['AnswerBoxWidth'],
+ this['Attempt']['RawAnswer'])
+ fi
+ else
+ inputbox:=sprintf(
+ cat("<textarea name='RawAnswer%s' cols='%d' rows='%d'",
+ " wrap='hard' />%s</textarea>"),
+ this['Label'],
+ this['AnswerBoxWidth'],
+ this['AnswerBoxHeight'],
+ this['Attempt']['RawAnswer'])
+ fi:
+ # END KM
+
cat("<br/>\n",
this['Prompt'],
! # KM
! # WAS: sprintf(
! # WAS: "<input type='text' name='RawAnswer%s' size='50' value = '%s'/>",
! # WAS: this['Label'],
! # WAS: this['Attempt']['RawAnswer']
! # WAS: ),
! inputbox,
! # END KM
! this['PostPrompt'],
! "\n<br/>\n"
! );
! end
! ],
!
! # KM
! ['Method','AnswerBoxSubstitute'::`HTML/String`,
! "Return the HTML string specifying a disabled text box with grey
! background to show the student's previous raw answer.
! ",
! proc(this)
! local inputbox;
!
! if this['AnswerBoxHeight'] = 1 then
! if this['AnswerBoxWidth'] = 0 then
! inputbox:=""
! else
! inputbox:=sprintf(
! cat("<input type='text' name='RawAnswer%s'",
! " autocomplete='off' size='%d' value = '%s'",
! " style='background-color: #E0E0E0;",
! " color=black' disabled />"),
this['Label'],
! this['AnswerBoxWidth'],
! this['Attempt']['RawAnswer'])
! fi
! else
! inputbox:=sprintf(
! cat("<textarea name='RawAnswer%s' cols='%d' rows='%d'",
! " style='background-color: #E0E0E0;",
! " color=black' disabled wrap='hard' />%s</textarea>"),
! this['Label'],
! this['AnswerBoxWidth'],
! this['AnswerBoxHeight'],
! this['Attempt']['RawAnswer'])
! fi:
!
! cat("<br/>\n",
! this['Prompt'],
! inputbox,
this['PostPrompt'],
"\n<br/>\n"
***************
*** 272,275 ****
--- 353,357 ----
end
],
+ # END KM
['Method','ReportLastAnswer'::`HTML/String`,
***************
*** 285,297 ****
if attempt['RawAnswer'] = "" then
html := cat(__("Your last answer was empty"),"\n<br/>\n");
! else
if attempt['Answer'] <> NULL then
! html :=
! cat(
! __("Your last answer was: \n"),
! "<latex>\\[",
! `aim/LaTeX`(attempt['Answer']),
! "\\]</latex>\n<br/>\n"
! );
fi;
if attempt['IsValid'] <> true then
--- 367,395 ----
if attempt['RawAnswer'] = "" then
html := cat(__("Your last answer was empty"),"\n<br/>\n");
! else
if attempt['Answer'] <> NULL then
! # KM
! if type(attempt['Answer'],string) then
!
! html :=
! cat(
! __("Your last answer was: \n"),
! "<br/><pre>",
! attempt['Answer'],
! "</pre>\n"
! );
!
! else
! # END KM
! html :=
! cat(
! __("Your last answer was: \n"),
! "<latex>\\[",
! `aim/LaTeX`(attempt['Answer']),
! "\\]</latex>\n<br/>\n"
! );
! # KM
! fi:
! # END KM
fi;
if attempt['IsValid'] <> true then
|