From: Mike G. v. a. <we...@ma...> - 2005-07-28 19:43:57
|
Log Message: ----------- adding more files to make modelCourse conform with hosted.webwork version Added Files: ----------- webwork2/courses/modelCourse/templates/setMAAtutorial/htmllinksexample: 1-24438.gif 1-31126.gif 1-34859.gif 1-42639.gif 1-76239.gif 1-89540.gif 1-91734.gif 1-96355.gif 1.gif 2-42653.gif 2-49261.gif 2-54427.gif 2-62384.gif 2-64591.gif 2-70190.gif 2-81779.gif 2-92879.gif 2.gif 3-14197.gif 3-14538.gif 3-37616.gif 3-46739.gif 3-52898.gif 3-68458.gif 3-89262.gif 3-99389.gif 3.gif htmllinksexample.pg webwork2/courses/modelCourse/templates/setMAAtutorial/staticgraphicsexample: 1-24438.gif 1-24438.png 1-31126.gif 1-31126.png 1-34859.gif 1-34859.png 1-42639.gif 1-42639.png 1-76239.gif 1-76239.png 1-89540.gif 1-89540.png 1-91734.gif 1-91734.png 1-96355.gif 1-96355.png 1.gif 1.png 2-42653.gif 2-42653.png 2-49261.gif 2-49261.png 2-54427.gif 2-54427.png 2-62384.gif 2-62384.png 2-64591.gif 2-64591.png 2-68458.png 2-68458.pnm 2-70190.gif 2-70190.png 2-81779.gif 2-81779.png 2-92879.gif 2-92879.png 2.gif 2.png 3-14197.gif 3-14197.png 3-14538.gif 3-14538.png 3-37616.gif 3-37616.png 3-46739.gif 3-46739.png 3-52898.gif 3-52898.png 3-68458.gif 3-68458.png 3-89262.gif 3-89262.png 3-99389.gif 3-99389.png 3.gif 3.png staticgraphicsexample.pg tmp Revision Data ------------- --- /dev/null +++ courses/modelCourse/templates/setMAAtutorial/htmllinksexample/htmllinksexample.pg @@ -0,0 +1,80 @@ +DOCUMENT(); +loadMacros("PGbasicmacros.pl", + "PGchoicemacros.pl", + "PGanswermacros.pl" +); +$showPartialCorrectAnswers = 0; + +TEXT(beginproblem(), $BR,$BBOLD, "HTML links example", $EBOLD, $BR,$BR); + +BEGIN_TEXT +This example shows how to link to resources outside the problem itself. +$PAR +Linking to other web pages over the internet is easy. For example, +you can get more information about the buffon needle problem and how it is used by ants to find new nest sites by linking to + \{ htmlLink("http://www.maa.org/mathland/mathtrek_5_15_00.html", + "Ivars Peterson's column on the MAA site") \}. +$PAR +END_TEXT + +# You can write the HTML code yourself, but +# that will look funny when the problem is printed in +# hard copy, so it is probably better to use the +# htmlLink('url','text') function which +# will create something readable when the problem is printed. + +BEGIN_TEXT +All of the files in the html directory of your WeBWorK course site can be read +by anyone with a web browser and the URL (the address of the file). This is a good +place to put files that are referenced by more than one problem in your WeBWorK course. +$PAR +Here is the link to +the +\{ htmlLink(alias("${htmlDirectory}calc.html"), + 'to the calculator page', + qq!target="ww_calculator" + ONCLICK="window.open( this.href, this.target, + 'width=250,height=350,scrollbars=no,resizable=off' + )" +!) \} +stored in the top level of the +html directory of the tutorialCourse. +$PAR +END_TEXT + +# To link to files on your own computer use the alias function whose +# job it is to find the file in question. +# You need to do this access indirectly, because WeBWorK is set up to +# restrict access to most files -- (you don't want everyone reading +# the source text of the WeBWorK problems, they could reconstruct the answer.) +# +# Note that you need double quotes around "${htmlDirectory}calc.html" so that +# the string in $htmlDirectory will be +# concatenated with calc.html to form a string describing +# the DIRECTORY in which the file is to be found. Alias converts +# the directory to a URL + +BEGIN_TEXT +Finally there are files, such as picture files, which are +stored with the problem itself in the same directory. + $BR \{ image("2-70190.gif", width=>200, height=>200) \} + +END_TEXT + +# Image automatically uses alias +# to search for files. + +BEGIN_TEXT +$PAR +And the table below has three more graphs which are stored +in the directory containing the current problem. $PAR +END_TEXT + +TEXT( + begintable(3), + row( image( [ ( '1-24438.gif', '2-49261.gif', '3-37616.gif') ], + tex_size=>200, width=>200, height=>200 )), + endtable() +); + +ENDDOCUMENT(); \ No newline at end of file --- /dev/null +++ courses/modelCourse/templates/setMAAtutorial/staticgraphicsexample/tmp @@ -0,0 +1,3 @@ +#!/usr/bin/csh + +cat $1 | giftopnm | pnmtopng >$2 --- /dev/null +++ courses/modelCourse/templates/setMAAtutorial/staticgraphicsexample/staticgraphicsexample.pg @@ -0,0 +1,115 @@ +DOCUMENT(); +loadMacros("PGbasicmacros.pl", + "PGchoicemacros.pl", + "PGanswermacros.pl" +); +TEXT($BEGIN_ONE_COLUMN); +TEXT(beginproblem(), $BR,$BBOLD, "Static graphics Example", $EBOLD, $BR,$BR); + +$showPartialCorrectAnswers = 0; +# Define which of the three sets of pictures to use + +# The pictures are labeled 1.png, 2.png and 3.png and +# stored in the same directory as staticgraphicsexample.png +# These are the corresponding transformed pictures. +# Be careful with the labeling, since the URL's could give the +# correct answers away. +# (In this example the middle integer tells you +# the correct position.) + +$pictID[1] = [ +"1-31126.png", # "\( F(x+3)\)", +"1-76239.png", # "\(F(x-3) \)" , +"1-96355.png", # "\( -F(-x)\)", +"1-24438.png", # "\( F(-x) \)", +"1-89540.png", # "\( 5F(x) \)", +"1-42639.png", # "\( F(3x) \)" , +"1-91734.png", # "\( F(x/3) \)", +"1-34859.png", # "\( F(x^2) \)", +]; +$pictID[2] = [ +"2-70190.png", # ditto +"2-49261.png", +"2-62384.png", +"2-54427.png", +"2-64591.png", +"2-42653.png", +"2-81779.png", +"2-92879.png", +]; +$pictID[3] = [ +"3-14197.png", +"3-89262.png", +"3-99389.png", +"3-68458.png", +"3-14538.png", +"3-37616.png", +"3-46739.png", +"3-52898.png", +]; +$ml = new_match_list(); + +$pictSet=random(1,3,1); # Choose one of the three picture sets +$pictSet=1; +$pictSetname = $pictSet.".png"; +$ml->qa ( +"\( F(x+3)\) ", +image($pictID[$pictSet][0],tex_size=>200), +"\(F(x-3) \)" , +image($pictID[$pictSet][1],tex_size=>200), +"\( -F(-x)\) ", +image($pictID[$pictSet][2],tex_size=>200), +"\( F(-x) \)", +image($pictID[$pictSet][3],tex_size=>200), +"\( 5F(x) \)", +image($pictID[$pictSet][4],tex_size=>200), +"\( F(3x) \)" , +image($pictID[$pictSet][5],tex_size=>200), +"\( F(x/3) \)", +image($pictID[$pictSet][6],tex_size=>200), +"\( F(x^2) \)", +image($pictID[$pictSet][7],tex_size=>200), +); + +$ml->choose(4); +sub format_graphs { + my $self = shift; + my @in = @_; + my $out = ""; + while(@in) { + $out .= shift(@in). "#" ; + } + $out; # The output has to be a string in order to conform to the + # specs for the match list object, but I've put some + # markers in (#) so that + # I can break the string up into a list for use + # as an input into row. +} + +# We need to change the output, since the normal +# output routine will put the pictures one above another. +$ml->rf_print_a(~~&format_graphs); + +BEGIN_TEXT +This is a graph of the function \( F(x) \): +($BBOLD Click on image for a larger view $EBOLD) +$PAR +\{ image($pictSetname, tex_size => 200) \} +$PAR +Enter the letter of the graph below which corresponds to the transformation +of the function. +\{ $ml -> print_q \} +END_TEXT + +# Place the output into a table +TEXT( + begintable(4), + row( split("#",$ml->print_a() ) ), + row('A', 'B', 'C', 'D' ), + endtable(), +); + +ANS( str_cmp( $ml ->ra_correct_ans() ) ) ; + +TEXT($END_ONE_COLUMN); +ENDDOCUMENT(); \ No newline at end of file |