[system] / trunk / webwork / system / courseScripts / displayMacros.pl Repository:
ViewVC logotype

Diff of /trunk/webwork/system/courseScripts/displayMacros.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 471 Revision 472
23sub displaySelectModeLine_string 23sub displaySelectModeLine_string
24 # called from probSet.pl 24 # called from probSet.pl
25 # displays the option line for selecting display modes 25 # displays the option line for selecting display modes
26{ 26{
27 my ($displayMode) =@_ ; 27 my ($displayMode) =@_ ;
28 my $out = ""; 28 my $out = "Display Mode: <BR>";
29# Modes can be added, or commented out here
30# Format is [internal symbol, external name, ""], where the third
31# argument is changed to checked below for the current displayMode
32 my $mode_list = [
33 ['HTML', 'text', ""],
34 ['HTML_tth', 'formatted-text',""],
35# ['HTML_dpng' ,'dvipng',""],
36 ['Latex2HTML', 'typeset',""]
37 ];
38
29 if (! defined($displayMode) ) {$displayMode = $Global::htmldisplayModeDefault;} 39 if (! defined($displayMode) ) {$displayMode = $Global::htmldisplayModeDefault;}
30 if ($displayMode eq 'HTML') { 40
31 $out .= "Display Mode: <BR><INPUT TYPE=RADIO NAME=\"Mode\" VALUE=\"HTML\" CHECKED>text<BR>\n"; 41
32 $out .= "<INPUT TYPE=RADIO NAME=\"Mode\" VALUE=\"HTML_tth\" >formatted-text<BR>\n"; 42 my ($j, $found)=(0,0);
33 $out .= "<INPUT TYPE=RADIO NAME=\"Mode\" VALUE=\"Latex2HTML\">typeset<BR>\n"; 43# Search through all modes to match for displayMode
34 } elsif($displayMode eq 'HTML_tth') { 44# If we don't find one, found=0 will trigger warn message below
35 $out .= "Display Mode:<BR> <INPUT TYPE=RADIO NAME=\"Mode\" VALUE=\"HTML\">text<BR>\n"; 45 for $j (0..(scalar(@{$mode_list})-1)) {
36 $out .= "<INPUT TYPE=RADIO NAME=\"Mode\" VALUE=\"HTML_tth\" CHECKED >formatted-text<BR>\n"; 46 if($mode_list->[$j]->[0] eq $displayMode) {
37 $out .= "<INPUT TYPE=RADIO NAME=\"Mode\" VALUE=\"Latex2HTML\" >typeset<BR>\n"; 47 $mode_list->[$j]->[2] = "CHECKED";
38 } elsif($displayMode eq 'Latex2HTML') { 48 $found=1;
39 $out .= "Display Mode:<BR> <INPUT TYPE=RADIO NAME=\"Mode\" VALUE=\"HTML\">text<BR>\n"; 49 last;
40 $out .= "<INPUT TYPE=RADIO NAME=\"Mode\" VALUE=\"HTML_tth\" > formatted-text<BR>\n"; 50 }
41 $out .= "<INPUT TYPE=RADIO NAME=\"Mode\" VALUE=\"Latex2HTML\" CHECKED>typeset<BR>\n"; 51 }
42 } else { 52
53 for $j (@{$mode_list}) {
54 $out .= qq!<INPUT TYPE=RADIO NAME="Mode" VALUE="$j->[0]" $j->[2]>$j->[1]<BR>\n!;
55 }
56 if(! $found) {
43 warn(" Error: displayMacros.pl: sub displaySelectModeLine. Unrecognized mode |$displayMode| . 57 my $wstr = " Error: displayMacros.pl: sub displaySelectModeLine. Unrecognized mode |$displayMode| . The acceptable modes are: ";
44 The acceptable modes are HTML HTML_tth and Latex2HTML .", '','',''); 58 for $j (@{$mode_list}) {
59 $wstr .= " $j->[0] ";
60 }
61 warn $wstr;
45 } 62 }
46 $out; 63 $out;
47} 64}
48 65
49sub displaySelectModeLine { 66sub displaySelectModeLine {

Legend:
Removed from v.471  
changed lines
  Added in v.472

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9