| 1 | ################################################################################ |
1 | ################################################################################ |
| 2 | # WeBWorK Online Homework Delivery System |
2 | # WeBWorK Online Homework Delivery System |
| 3 | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ |
3 | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ |
| 4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm,v 1.41 2005/07/26 17:39:22 jj Exp $ |
4 | # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm,v 1.60 2006/01/11 22:41:51 dpvc Exp $ |
| 5 | # |
5 | # |
| 6 | # This program is free software; you can redistribute it and/or modify it under |
6 | # This program is free software; you can redistribute it and/or modify it under |
| 7 | # the terms of either: (a) the GNU General Public License as published by the |
7 | # the terms of either: (a) the GNU General Public License as published by the |
| 8 | # Free Software Foundation; either version 2, or (at your option) any later |
8 | # Free Software Foundation; either version 2, or (at your option) any later |
| 9 | # version, or (b) the "Artistic License" which comes with this package. |
9 | # version, or (b) the "Artistic License" which comes with this package. |
| … | |
… | |
| 25 | =cut |
25 | =cut |
| 26 | |
26 | |
| 27 | use strict; |
27 | use strict; |
| 28 | use warnings; |
28 | use warnings; |
| 29 | |
29 | |
| 30 | use CGI::Pretty qw(); |
30 | use CGI qw(); |
|
|
31 | use WeBWorK::Debug; |
| 31 | use WeBWorK::Form; |
32 | use WeBWorK::Form; |
| 32 | use WeBWorK::Utils qw(readDirectory max sortByName); |
33 | use WeBWorK::Utils qw(readDirectory max sortByName); |
| 33 | use WeBWorK::Utils::Tasks qw(renderProblems); |
34 | use WeBWorK::Utils::Tasks qw(renderProblems); |
| 34 | use File::Find; |
35 | use File::Find; |
| 35 | |
36 | |
| … | |
… | |
| 38 | use constant MAX_SHOW_DEFAULT => 20; |
39 | use constant MAX_SHOW_DEFAULT => 20; |
| 39 | use constant NO_LOCAL_SET_STRING => 'No sets in this course yet'; |
40 | use constant NO_LOCAL_SET_STRING => 'No sets in this course yet'; |
| 40 | use constant SELECT_SET_STRING => 'Select a Set from this Course'; |
41 | use constant SELECT_SET_STRING => 'Select a Set from this Course'; |
| 41 | use constant SELECT_LOCAL_STRING => 'Select a Problem Collection'; |
42 | use constant SELECT_LOCAL_STRING => 'Select a Problem Collection'; |
| 42 | use constant MY_PROBLEMS => ' My Problems '; |
43 | use constant MY_PROBLEMS => ' My Problems '; |
| 43 | use constant MAIN_PROBLEMS => ' Main Problems '; |
44 | use constant MAIN_PROBLEMS => ' Unclassified Problems '; |
| 44 | use constant CREATE_SET_BUTTON => 'Create New Set'; |
45 | use constant CREATE_SET_BUTTON => 'Create New Set'; |
|
|
46 | use constant ALL_CHAPTERS => 'All Chapters'; |
|
|
47 | use constant ALL_SUBJECTS => 'All Subjects'; |
|
|
48 | use constant ALL_SECTIONS => 'All Sections'; |
|
|
49 | use constant ALL_TEXTBOOKS => 'All Textbooks'; |
|
|
50 | |
|
|
51 | use constant LIB2_DATA => { |
|
|
52 | 'dbchapter' => {name => 'library_chapters', all => 'All Chapters'}, |
|
|
53 | 'dbsection' => {name => 'library_sections', all =>'All Sections' }, |
|
|
54 | 'dbsubject' => {name => 'library_subjects', all => 'All Subjects' }, |
|
|
55 | 'textbook' => {name => 'library_textbook', all => 'All Textbooks'}, |
|
|
56 | 'textchapter' => {name => 'library_textchapter', all => 'All Chapters'}, |
|
|
57 | 'textsection' => {name => 'library_textsection', all => 'All Sections'}, |
|
|
58 | 'keywords' => {name => 'library_keywords', all => '' }, |
|
|
59 | }; |
| 45 | |
60 | |
| 46 | ## Flags for operations on files |
61 | ## Flags for operations on files |
| 47 | |
62 | |
| 48 | use constant ADDED => 1; |
63 | use constant ADDED => 1; |
| 49 | use constant HIDDEN => (1 << 1); |
64 | use constant HIDDEN => (1 << 1); |
| 50 | use constant SUCCESS => (1 << 2); |
65 | use constant SUCCESS => (1 << 2); |
| 51 | |
66 | |
| 52 | ## for additional problib buttons |
67 | ## for additional problib buttons |
| 53 | my %problib; ## filled in in global.conf |
68 | my %problib; ## filled in in global.conf |
| 54 | my %ignoredir = ( |
69 | my %ignoredir = ( |
| 55 | '.' => 1, '..' => 1, 'Library' => 1, |
70 | '.' => 1, '..' => 1, 'Library' => 1, 'CVS' => 1, 'tmpEdit' => 1, |
| 56 | 'headers' => 1, 'macros' => 1, 'email' => 1, |
71 | 'headers' => 1, 'macros' => 1, 'email' => 1, |
| 57 | ); |
72 | ); |
| 58 | |
73 | |
|
|
74 | sub prepare_activity_entry { |
|
|
75 | my $self=shift; |
|
|
76 | my $r = $self->r; |
|
|
77 | my $user = $self->r->param('user') || 'NO_USER'; |
|
|
78 | return("In SetMaker as user $user"); |
|
|
79 | } |
|
|
80 | |
| 59 | ## This is for searching the disk for directories containing pg files. |
81 | ## This is for searching the disk for directories containing pg files. |
| 60 | ## to make the recursion work, this returns an array where the first |
82 | ## to make the recursion work, this returns an array where the first |
| 61 | ## item is the number of pg files in the directory. The second is a |
83 | ## item is the number of pg files in the directory. The second is a |
| 62 | ## list of directories which contain pg files. |
84 | ## list of directories which contain pg files. |
| 63 | ## |
85 | ## |
| 64 | ## If a directory contains only one pg file and at least one other |
86 | ## If a directory contains only one pg file and the directory name |
| 65 | ## file, the directory is considered to be part of the parent |
87 | ## is the same as the file name, then the directory is considered |
| 66 | ## directory (it is probably in a separate directory only because |
88 | ## to be part of the parent directory (it is probably in a separate |
| 67 | ## it has auxiliarly files that want to be kept together with the |
89 | ## directory only because it has auxiliary files that want to be |
| 68 | ## pg file). |
90 | ## kept together with the pg file). |
| 69 | ## |
91 | ## |
| 70 | ## If a directory has a file named "=library-ignore", it is never |
92 | ## If a directory has a file named "=library-ignore", it is never |
| 71 | ## included in the directory menu. If a directory contains a file |
93 | ## included in the directory menu. If a directory contains a file |
| 72 | ## called "=library-combine-up", then its pg are included with those |
94 | ## called "=library-combine-up", then its pg are included with those |
| 73 | ## in the parent directory (and the directory does not appear in the |
95 | ## in the parent directory (and the directory does not appear in the |
| 74 | ## menu). If it has a file called "=library-no-combine" then it is |
96 | ## menu). If it has a file called "=library-no-combine" then it is |
| 75 | ## always listed as a separate directory even if it contains only one |
97 | ## always listed as a separate directory even if it contains only one |
| 76 | ## pg file. |
98 | ## pg file. |
| 77 | |
99 | |
| 78 | sub get_library_sets { |
100 | sub get_library_sets { |
| 79 | my $top = shift; my $dir = shift; |
101 | my $top = shift; my $dir = shift; |
| 80 | # ignore directories that give us an error |
102 | # ignore directories that give us an error |
| 81 | my @lis = eval { readDirectory($dir) }; |
103 | my @lis = eval { readDirectory($dir) }; |
| 82 | if ($@) { |
104 | if ($@) { |
| 83 | warn $@; |
105 | warn $@; |
| 84 | return (0); |
106 | return (0); |
| 85 | } |
107 | } |
| 86 | return (0) if grep /^=library-ignore$/, @lis; |
108 | return (0) if grep /^=library-ignore$/, @lis; |
| 87 | |
109 | |
|
|
110 | my @pgfiles = grep { m/\.pg$/ and (not m/(Header|-text)\.pg$/) and -f "$dir/$_"} @lis; |
|
|
111 | my $pgcount = scalar(@pgfiles); |
|
|
112 | my $pgname = $dir; $pgname =~ s!.*/!!; $pgname .= '.pg'; |
|
|
113 | my $combineUp = ($pgcount == 1 && $pgname eq $pgfiles[0] && !(grep /^=library-no-combine$/, @lis)); |
|
|
114 | |
| 88 | my @pgdirs; |
115 | my @pgdirs; |
| 89 | |
|
|
| 90 | my $pgcount = scalar(grep { m/\.pg$/ and (not m/(Header|-text)\.pg$/) and -f "$dir/$_"} @lis); |
|
|
| 91 | my $others = scalar(grep { (!m/\.pg$/ || m/(Header|-text)\.pg$/) && |
|
|
| 92 | !m/(\.(tmp|bak)|~)$/ && -f "$dir/$_" } @lis); |
|
|
| 93 | |
|
|
| 94 | my @dirs = grep {!$ignoredir{$_} and -d "$dir/$_"} @lis; |
116 | my @dirs = grep {!$ignoredir{$_} and -d "$dir/$_"} @lis; |
| 95 | if ($top == 1) {@dirs = grep {!$problib{$_}} @dirs} |
117 | if ($top == 1) {@dirs = grep {!$problib{$_}} @dirs} |
| 96 | foreach my $subdir (@dirs) { |
118 | foreach my $subdir (@dirs) { |
| 97 | my @results = get_library_sets(0, "$dir/$subdir"); |
119 | my @results = get_library_sets(0, "$dir/$subdir"); |
| 98 | $pgcount += shift @results; push(@pgdirs,@results); |
120 | $pgcount += shift @results; push(@pgdirs,@results); |
| 99 | } |
121 | } |
| 100 | |
122 | |
| 101 | return ($pgcount, @pgdirs) if $top || $pgcount == 0 || grep /^=library-combine-up$/, @lis; |
123 | return ($pgcount, @pgdirs) if $top || $combineUp || grep /^=library-combine-up$/, @lis; |
| 102 | return (0,@pgdirs,$dir) if $pgcount > 1 || $others == 0 || grep /^=library-no-combine$/, @lis; |
124 | return (0,@pgdirs,$dir); |
| 103 | return ($pgcount, @pgdirs); |
|
|
| 104 | } |
125 | } |
| 105 | |
126 | |
| 106 | sub get_library_pgs { |
127 | sub get_library_pgs { |
| 107 | my $top = shift; my $base = shift; my $dir = shift; |
128 | my $top = shift; my $base = shift; my $dir = shift; |
| 108 | my @lis = readDirectory("$base/$dir"); |
129 | my @lis = readDirectory("$base/$dir"); |
| 109 | return () if grep /^=library-ignore$/, @lis; |
130 | return () if grep /^=library-ignore$/, @lis; |
| 110 | return () if !$top && grep /^=library-no-combine$/, @lis; |
131 | return () if !$top && grep /^=library-no-combine$/, @lis; |
| 111 | |
132 | |
| 112 | my @pgs = grep { m/\.pg$/ and (not m/(Header|-text)\.pg$/) and -f "$base/$dir/$_"} @lis; |
133 | my @pgs = grep { m/\.pg$/ and (not m/(Header|-text)\.pg$/) and -f "$base/$dir/$_"} @lis; |
| … | |
… | |
| 128 | return sortByName(undef,@pgs); |
149 | return sortByName(undef,@pgs); |
| 129 | } |
150 | } |
| 130 | |
151 | |
| 131 | ## Search for set definition files |
152 | ## Search for set definition files |
| 132 | |
153 | |
| 133 | # initialize global variable for search |
|
|
| 134 | my @found_set_defs = (); |
|
|
| 135 | |
|
|
| 136 | sub get_set_defs_wanted { |
|
|
| 137 | my $fn = $_; |
|
|
| 138 | my $fdir = $File::Find::dir; |
|
|
| 139 | return() if($fn !~ /^set.*\.def$/); |
|
|
| 140 | #return() if(not -T $fn); |
|
|
| 141 | push @found_set_defs, "$fdir/$fn"; |
|
|
| 142 | } |
|
|
| 143 | |
|
|
| 144 | sub get_set_defs { |
154 | sub get_set_defs { |
| 145 | my $topdir = shift; |
155 | my $topdir = shift; |
| 146 | @found_set_defs = (); |
156 | my @found_set_defs; |
|
|
157 | # get_set_defs_wanted is a closure over @found_set_defs |
|
|
158 | my $get_set_defs_wanted = sub { |
|
|
159 | #my $fn = $_; |
|
|
160 | #my $fdir = $File::Find::dir; |
|
|
161 | #return() if($fn !~ /^set.*\.def$/); |
|
|
162 | ##return() if(not -T $fn); |
|
|
163 | #push @found_set_defs, "$fdir/$fn"; |
|
|
164 | push @found_set_defs, $_ if m|/set[^/]*\.def$|; |
|
|
165 | }; |
| 147 | find({ wanted => \&get_set_defs_wanted, follow_fast=>1}, $topdir); |
166 | find({ wanted => $get_set_defs_wanted, follow_fast=>1, no_chdir=>1}, $topdir); |
| 148 | map { $_ =~ s|^$topdir/?|| } @found_set_defs; |
167 | map { $_ =~ s|^$topdir/?|| } @found_set_defs; |
| 149 | return @found_set_defs; |
168 | return @found_set_defs; |
| 150 | } |
169 | } |
| 151 | |
170 | |
| 152 | ## Try to make reading of set defs more flexible. Additional strategies |
171 | ## Try to make reading of set defs more flexible. Additional strategies |
| … | |
… | |
| 349 | $view_problem_line |
368 | $view_problem_line |
| 350 | )); |
369 | )); |
| 351 | } |
370 | } |
| 352 | |
371 | |
| 353 | ##### Version 3 is the problem library |
372 | ##### Version 3 is the problem library |
|
|
373 | # |
|
|
374 | # This comes in 3 forms, problem library version 1, and for version 2 there |
|
|
375 | # is the basic, and the advanced interfaces. This function checks what we are |
|
|
376 | # supposed to do, or aborts if the problem library has not been installed. |
| 354 | |
377 | |
| 355 | |
|
|
| 356 | # There a different levels, and you can pick a new chapter, |
|
|
| 357 | # pick a new section, pick all from chapter, pick all from section |
|
|
| 358 | # |
|
|
| 359 | # Incoming data - current chapter, current section |
|
|
| 360 | sub browse_library_panel { |
378 | sub browse_library_panel { |
| 361 | my $self=shift; |
379 | my $self=shift; |
| 362 | my $r = $self->r; |
380 | my $r = $self->r; |
| 363 | my $ce = $r->ce; |
381 | my $ce = $r->ce; |
| 364 | |
382 | |
| 365 | # See if the problem library is installed |
383 | # See if the problem library is installed |
| 366 | my $libraryRoot = $r->{ce}->{problemLibrary}->{root}; |
384 | my $libraryRoot = $r->{ce}->{problemLibrary}->{root}; |
| 367 | |
385 | |
| 368 | unless($libraryRoot) { |
386 | unless($libraryRoot) { |
| 369 | print CGI::Tr(CGI::td(CGI::div({class=>'ResultsWithError', align=>"center"}, |
387 | print CGI::Tr(CGI::td(CGI::div({class=>'ResultsWithError', align=>"center"}, |
| … | |
… | |
| 382 | HERE |
400 | HERE |
| 383 | $self->addbadmessage($msg); |
401 | $self->addbadmessage($msg); |
| 384 | } |
402 | } |
| 385 | } |
403 | } |
| 386 | |
404 | |
| 387 | |
|
|
| 388 | # Now check what version we are supposed to use |
405 | # Now check what version we are supposed to use |
| 389 | my $libraryVersion = $r->{ce}->{problemLibrary}->{version} || 1; |
406 | my $libraryVersion = $r->{ce}->{problemLibrary}->{version} || 1; |
| 390 | if($libraryVersion == 1) { |
407 | if($libraryVersion == 1) { |
| 391 | return $self->browse_library_panel1; |
408 | return $self->browse_library_panel1; |
| 392 | } elsif($libraryVersion == 2) { |
409 | } elsif($libraryVersion == 2) { |
|
|
410 | return $self->browse_library_panel2 if($self->{library_basic}==1); |
| 393 | return $self->browse_library_panel2; |
411 | return $self->browse_library_panel2adv; |
| 394 | } else { |
412 | } else { |
| 395 | print CGI::Tr(CGI::td(CGI::div({class=>'ResultsWithError', align=>"center"}, |
413 | print CGI::Tr(CGI::td(CGI::div({class=>'ResultsWithError', align=>"center"}, |
| 396 | "The problem library version is set to an illegal value."))); |
414 | "The problem library version is set to an illegal value."))); |
| 397 | return; |
415 | return; |
| 398 | } |
416 | } |
| … | |
… | |
| 401 | sub browse_library_panel1 { |
419 | sub browse_library_panel1 { |
| 402 | my $self = shift; |
420 | my $self = shift; |
| 403 | my $r = $self->r; |
421 | my $r = $self->r; |
| 404 | my $ce = $r->ce; |
422 | my $ce = $r->ce; |
| 405 | |
423 | |
| 406 | my $default_chap = "All Chapters"; |
|
|
| 407 | my $default_sect = "All Sections"; |
|
|
| 408 | |
|
|
| 409 | my @chaps = WeBWorK::Utils::ListingDB::getAllChapters($r->{ce}); |
424 | my @chaps = WeBWorK::Utils::ListingDB::getAllChapters($r->{ce}); |
| 410 | unshift @chaps, $default_chap; |
425 | unshift @chaps, LIB2_DATA->{dbchapter}{all}; |
| 411 | my $chapter_selected = $r->param('library_chapters') || $default_chap; |
426 | my $chapter_selected = $r->param('library_chapters') || LIB2_DATA->{dbchapter}->{all}; |
| 412 | |
427 | |
| 413 | my @sects=(); |
428 | my @sects=(); |
| 414 | if ($chapter_selected ne $default_chap) { |
429 | if ($chapter_selected ne LIB2_DATA->{dbchapter}{all}) { |
| 415 | @sects = WeBWorK::Utils::ListingDB::getAllSections($r->{ce}, $chapter_selected); |
430 | @sects = WeBWorK::Utils::ListingDB::getAllSections($r->{ce}, $chapter_selected); |
| 416 | } |
431 | } |
| 417 | |
432 | |
| 418 | my @textbooks = ('Textbook info not ready'); |
433 | unshift @sects, ALL_SECTIONS; |
| 419 | |
|
|
| 420 | unshift @sects, $default_sect; |
|
|
| 421 | my $section_selected = $r->param('library_sections') || $default_sect; |
434 | my $section_selected = $r->param('library_sections') || LIB2_DATA->{dbsection}{all}; |
|
|
435 | |
| 422 | my $view_problem_line = view_problems_line('lib_view', 'View Problems', $self->r); |
436 | my $view_problem_line = view_problems_line('lib_view', 'View Problems', $self->r); |
| 423 | |
437 | |
| 424 | print CGI::Tr(CGI::td({-class=>"InfoPanel", -align=>"left"}, |
438 | print CGI::Tr(CGI::td({-class=>"InfoPanel", -align=>"left"}, |
| 425 | CGI::start_table(), |
439 | CGI::start_table(), |
| 426 | CGI::Tr( |
440 | CGI::Tr( |
| … | |
… | |
| 437 | CGI::popup_menu(-name=> 'library_sections', |
451 | CGI::popup_menu(-name=> 'library_sections', |
| 438 | -values=>\@sects, |
452 | -values=>\@sects, |
| 439 | -default=> $section_selected |
453 | -default=> $section_selected |
| 440 | ))), |
454 | ))), |
| 441 | |
455 | |
| 442 | #CGI::Tr( |
|
|
| 443 | # CGI::td("Textbook:"), |
|
|
| 444 | # CGI::td({-colspan=>2}, |
|
|
| 445 | # CGI::popup_menu(-name=> 'library_textbooks', |
|
|
| 446 | # -values=>\@textbooks, |
|
|
| 447 | # #-default=> $section_selected |
|
|
| 448 | #))), |
|
|
| 449 | |
|
|
| 450 | #CGI::Tr( |
|
|
| 451 | # CGI::td("Keywords:"), |
|
|
| 452 | # CGI::td({-colspan=>2}, |
|
|
| 453 | # CGI::textfield(-name=>"keywords", |
|
|
| 454 | # -default=>"Keywords not implemented yet", |
|
|
| 455 | # -override=>1, -size=>60 |
|
|
| 456 | #))), |
|
|
| 457 | CGI::Tr(CGI::td({-colspan=>3}, $view_problem_line)), |
456 | CGI::Tr(CGI::td({-colspan=>3}, $view_problem_line)), |
| 458 | CGI::end_table(), |
457 | CGI::end_table(), |
| 459 | )); |
458 | )); |
| 460 | } |
459 | } |
| 461 | |
460 | |
| 462 | sub browse_library_panel2 { |
461 | sub browse_library_panel2 { |
| 463 | my $self = shift; |
462 | my $self = shift; |
| 464 | my $r = $self->r; |
463 | my $r = $self->r; |
| 465 | my $ce = $r->ce; |
464 | my $ce = $r->ce; |
| 466 | |
465 | |
| 467 | my $default_chap = "All Chapters"; |
466 | my @subjs = WeBWorK::Utils::ListingDB::getAllDBsubjects($r); |
| 468 | my $default_sect = "All Sections"; |
467 | unshift @subjs, LIB2_DATA->{dbsubject}{all}; |
| 469 | |
468 | |
| 470 | my @chaps = WeBWorK::Utils::ListingDB::getAllDBchapters($ce); |
469 | my @chaps = WeBWorK::Utils::ListingDB::getAllDBchapters($r); |
| 471 | unshift @chaps, $default_chap; |
470 | unshift @chaps, LIB2_DATA->{dbchapter}{all}; |
| 472 | my $chapter_selected = $r->param('library_chapters') || $default_chap; |
|
|
| 473 | |
471 | |
| 474 | my @sects=(); |
472 | my @sects=(); |
| 475 | if ($chapter_selected ne $default_chap) { |
|
|
| 476 | @sects = WeBWorK::Utils::ListingDB::getAllDBsections($ce, $chapter_selected); |
473 | @sects = WeBWorK::Utils::ListingDB::getAllDBsections($r); |
| 477 | } |
474 | unshift @sects, LIB2_DATA->{dbsection}{all}; |
| 478 | unshift @sects, $default_sect; |
475 | |
|
|
476 | my $subject_selected = $r->param('library_subjects') || LIB2_DATA->{dbsubject}{all}; |
|
|
477 | my $chapter_selected = $r->param('library_chapters') || LIB2_DATA->{dbchapter}{all}; |
| 479 | my $section_selected = $r->param('library_sections') || $default_sect; |
478 | my $section_selected = $r->param('library_sections') || LIB2_DATA->{dbsection}{all}; |
|
|
479 | |
| 480 | my $view_problem_line = view_problems_line('lib_view', 'View Problems', $self->r); |
480 | my $view_problem_line = view_problems_line('lib_view', 'View Problems', $self->r); |
| 481 | |
481 | |
|
|
482 | my $count_line = WeBWorK::Utils::ListingDB::countDBListings($r); |
|
|
483 | if($count_line==0) { |
|
|
484 | $count_line = "There are no matching pg files"; |
|
|
485 | } else { |
|
|
486 | $count_line = "There are $count_line matching WeBWorK problem files"; |
|
|
487 | } |
|
|
488 | |
| 482 | print CGI::Tr(CGI::td({-class=>"InfoPanel", -align=>"left"}, |
489 | print CGI::Tr(CGI::td({-class=>"InfoPanel", -align=>"left"}, |
| 483 | CGI::start_table(), |
490 | CGI::hidden(-name=>"library_is_basic", -default=>[1]), |
|
|
491 | CGI::start_table({-width=>"100%"}), |
|
|
492 | CGI::Tr( |
|
|
493 | CGI::td(["Subject:", |
|
|
494 | CGI::popup_menu(-name=> 'library_subjects', |
|
|
495 | -values=>\@subjs, |
|
|
496 | -default=> $subject_selected, |
|
|
497 | -onchange=>"submit();return true" |
|
|
498 | )]), |
|
|
499 | CGI::td({-colspan=>2, -align=>"right"}, |
|
|
500 | CGI::submit(-name=>"lib_select_subject", -value=>"Update Chapter/Section Lists")) |
|
|
501 | ), |
| 484 | CGI::Tr( |
502 | CGI::Tr( |
| 485 | CGI::td(["Chapter:", |
503 | CGI::td(["Chapter:", |
| 486 | CGI::popup_menu(-name=> 'library_chapters', |
504 | CGI::popup_menu(-name=> 'library_chapters', |
| 487 | -values=>\@chaps, |
505 | -values=>\@chaps, |
| 488 | -default=> $chapter_selected, |
506 | -default=> $chapter_selected, |
| 489 | -onchange=>"submit();return true" |
507 | -onchange=>"submit();return true" |
|
|
508 | )]), |
|
|
509 | CGI::td({-colspan=>2, -align=>"right"}, |
|
|
510 | CGI::submit(-name=>"library_advanced", -value=>"Advanced Search")) |
| 490 | ), |
511 | ), |
| 491 | CGI::submit(-name=>"lib_select_chapter", -value=>"Update Section List")])), |
|
|
| 492 | CGI::Tr( |
512 | CGI::Tr( |
| 493 | CGI::td("Section:"), |
513 | CGI::td(["Section:", |
| 494 | CGI::td({-colspan=>2}, |
|
|
| 495 | CGI::popup_menu(-name=> 'library_sections', |
514 | CGI::popup_menu(-name=> 'library_sections', |
| 496 | -values=>\@sects, |
515 | -values=>\@sects, |
| 497 | -default=> $section_selected |
516 | -default=> $section_selected, |
|
|
517 | -onchange=>"submit();return true" |
|
|
518 | )]), |
| 498 | ))), |
519 | ), |
| 499 | CGI::Tr(CGI::td({-colspan=>3}, $view_problem_line)), |
520 | CGI::Tr(CGI::td({-colspan=>3}, $view_problem_line)), |
|
|
521 | CGI::Tr(CGI::td({-colspan=>3, -align=>"center"}, $count_line)), |
| 500 | CGI::end_table(), |
522 | CGI::end_table(), |
| 501 | )); |
523 | )); |
|
|
524 | |
|
|
525 | } |
| 502 | |
526 | |
|
|
527 | sub browse_library_panel2adv { |
|
|
528 | my $self = shift; |
|
|
529 | my $r = $self->r; |
|
|
530 | my $ce = $r->ce; |
|
|
531 | my $right_button_style = "width: 18ex"; |
|
|
532 | |
|
|
533 | my @subjs = WeBWorK::Utils::ListingDB::getAllDBsubjects($r); |
|
|
534 | if(! grep { $_ eq $r->param('library_subjects') } @subjs) { |
|
|
535 | $r->param('library_subjects', ''); |
|
|
536 | } |
|
|
537 | unshift @subjs, LIB2_DATA->{dbsubject}{all}; |
|
|
538 | |
|
|
539 | my @chaps = WeBWorK::Utils::ListingDB::getAllDBchapters($r); |
|
|
540 | if(! grep { $_ eq $r->param('library_chapters') } @chaps) { |
|
|
541 | $r->param('library_chapters', ''); |
|
|
542 | } |
|
|
543 | unshift @chaps, LIB2_DATA->{dbchapter}{all}; |
|
|
544 | |
|
|
545 | my @sects = WeBWorK::Utils::ListingDB::getAllDBsections($r); |
|
|
546 | if(! grep { $_ eq $r->param('library_sections') } @sects) { |
|
|
547 | $r->param('library_sections', ''); |
|
|
548 | } |
|
|
549 | unshift @sects, LIB2_DATA->{dbsection}{all}; |
|
|
550 | |
|
|
551 | my $texts = WeBWorK::Utils::ListingDB::getDBTextbooks($r); |
|
|
552 | my @textarray = map { $_->[0] } @{$texts}; |
|
|
553 | my %textlabels = (); |
|
|
554 | for my $ta (@{$texts}) { |
|
|
555 | $textlabels{$ta->[0]} = $ta->[1]." by ".$ta->[2]." (edition ".$ta->[3].")"; |
|
|
556 | } |
|
|
557 | if(! grep { $_ eq $r->param('library_textbook') } @textarray) { |
|
|
558 | $r->param('library_textbook', ''); |
|
|
559 | } |
|
|
560 | unshift @textarray, LIB2_DATA->{textbook}{all}; |
|
|
561 | my $atb = LIB2_DATA->{textbook}{all}; $textlabels{$atb} = LIB2_DATA->{textbook}{all}; |
|
|
562 | |
|
|
563 | my $textchap_ref = WeBWorK::Utils::ListingDB::getDBTextbooks($r, 'textchapter'); |
|
|
564 | my @textchaps = map { $_->[0] } @{$textchap_ref}; |
|
|
565 | if(! grep { $_ eq $r->param('library_textchapter') } @textchaps) { |
|
|
566 | $r->param('library_textchapter', ''); |
|
|
567 | } |
|
|
568 | unshift @textchaps, LIB2_DATA->{textchapter}{all}; |
|
|
569 | |
|
|
570 | my $textsec_ref = WeBWorK::Utils::ListingDB::getDBTextbooks($r, 'textsection'); |
|
|
571 | my @textsecs = map { $_->[0] } @{$textsec_ref}; |
|
|
572 | if(! grep { $_ eq $r->param('library_textsection') } @textsecs) { |
|
|
573 | $r->param('library_textsection', ''); |
|
|
574 | } |
|
|
575 | unshift @textsecs, LIB2_DATA->{textsection}{all}; |
|
|
576 | |
|
|
577 | my %selected = (); |
|
|
578 | for my $j (qw( dbsection dbchapter dbsubject textbook textchapter textsection )) { |
|
|
579 | $selected{$j} = $r->param(LIB2_DATA->{$j}{name}) || LIB2_DATA->{$j}{all}; |
|
|
580 | } |
|
|
581 | |
|
|
582 | my $text_popup = CGI::popup_menu(-name => 'library_textbook', |
|
|
583 | -values =>\@textarray, |
|
|
584 | -labels => \%textlabels, |
|
|
585 | -default=>$selected{textbook}, |
|
|
586 | -onchange=>"submit();return true"); |
|
|
587 | |
|
|
588 | |
|
|
589 | my $library_keywords = $r->param('library_keywords') || ''; |
|
|
590 | |
|
|
591 | my $view_problem_line = view_problems_line('lib_view', 'View Problems', $self->r); |
|
|
592 | |
|
|
593 | my $count_line = WeBWorK::Utils::ListingDB::countDBListings($r); |
|
|
594 | if($count_line==0) { |
|
|
595 | $count_line = "There are no matching pg files"; |
|
|
596 | } else { |
|
|
597 | $count_line = "There are $count_line matching WeBWorK problem files"; |
|
|
598 | } |
|
|
599 | |
|
|
600 | print CGI::Tr(CGI::td({-class=>"InfoPanel", -align=>"left"}, |
|
|
601 | CGI::hidden(-name=>"library_is_basic", -default=>[2]), |
|
|
602 | CGI::start_table({-width=>"100%"}), |
|
|
603 | # Html done by hand since it is temporary |
|
|
604 | CGI::Tr(CGI::td({-colspan=>4, -align=>"center"}, 'All Selected Constraints Joined by "And"')), |
|
|
605 | CGI::Tr( |
|
|
606 | CGI::td(["Subject:", |
|
|
607 | CGI::popup_menu(-name=> 'library_subjects', |
|
|
608 | -values=>\@subjs, |
|
|
609 | -default=> $selected{dbsubject}, |
|
|
610 | -onchange=>"submit();return true" |
|
|
611 | )]), |
|
|
612 | CGI::td({-colspan=>2, -align=>"right"}, |
|
|
613 | CGI::submit(-name=>"lib_select_subject", -value=>"Update Menus", |
|
|
614 | -style=> $right_button_style))), |
|
|
615 | CGI::Tr( |
|
|
616 | CGI::td(["Chapter:", |
|
|
617 | CGI::popup_menu(-name=> 'library_chapters', |
|
|
618 | -values=>\@chaps, |
|
|
619 | -default=> $selected{dbchapter}, |
|
|
620 | -onchange=>"submit();return true" |
|
|
621 | )]), |
|
|
622 | CGI::td({-colspan=>2, -align=>"right"}, |
|
|
623 | CGI::submit(-name=>"library_reset", -value=>"Reset", |
|
|
624 | -style=>$right_button_style)) |
|
|
625 | ), |
|
|
626 | CGI::Tr( |
|
|
627 | CGI::td(["Section:", |
|
|
628 | CGI::popup_menu(-name=> 'library_sections', |
|
|
629 | -values=>\@sects, |
|
|
630 | -default=> $selected{dbsection}, |
|
|
631 | -onchange=>"submit();return true" |
|
|
632 | )]), |
|
|
633 | CGI::td({-colspan=>2, -align=>"right"}, |
|
|
634 | CGI::submit(-name=>"library_basic", -value=>"Basic Search", |
|
|
635 | -style=>$right_button_style)) |
|
|
636 | ), |
|
|
637 | CGI::Tr( |
|
|
638 | CGI::td(["Textbook:", $text_popup]), |
|
|
639 | ), |
|
|
640 | CGI::Tr( |
|
|
641 | CGI::td(["Text chapter:", |
|
|
642 | CGI::popup_menu(-name=> 'library_textchapter', |
|
|
643 | -values=>\@textchaps, |
|
|
644 | -default=> $selected{textchapter}, |
|
|
645 | -onchange=>"submit();return true" |
|
|
646 | )]), |
|
|
647 | ), |
|
|
648 | CGI::Tr( |
|
|
649 | CGI::td(["Text section:", |
|
|
650 | CGI::popup_menu(-name=> 'library_textsection', |
|
|
651 | -values=>\@textsecs, |
|
|
652 | -default=> $selected{textsection}, |
|
|
653 | -onchange=>"submit();return true" |
|
|
654 | )]), |
|
|
655 | ), |
|
|
656 | CGI::Tr(CGI::td("Keywords:"),CGI::td({-colspan=>2}, |
|
|
657 | CGI::textfield(-name=>"library_keywords", |
|
|
658 | -default=>$library_keywords, |
|
|
659 | -override=>1, |
|
|
660 | -size=>40))), |
|
|
661 | CGI::Tr(CGI::td({-colspan=>3}, $view_problem_line)), |
|
|
662 | CGI::Tr(CGI::td({-colspan=>3, -align=>"center"}, $count_line)), |
|
|
663 | CGI::end_table(), |
|
|
664 | )); |
| 503 | |
665 | |
| 504 | } |
666 | } |
| 505 | |
667 | |
| 506 | |
668 | |
| 507 | ##### Version 4 is the set definition file panel |
669 | ##### Version 4 is the set definition file panel |
| … | |
… | |
| 510 | my $self = shift; |
672 | my $self = shift; |
| 511 | my $r = $self->r; |
673 | my $r = $self->r; |
| 512 | my $ce = $r->ce; |
674 | my $ce = $r->ce; |
| 513 | my $library_selected = shift; |
675 | my $library_selected = shift; |
| 514 | my $default_value = "Select a Set Definition File"; |
676 | my $default_value = "Select a Set Definition File"; |
|
|
677 | # in the following line, the parens after sort are important. if they are |
|
|
678 | # omitted, sort will interpret get_set_defs as the name of the comparison |
|
|
679 | # function, and ($ce->{courseDirs}{templates}) as a single element list to |
|
|
680 | # be sorted. *barf* |
| 515 | my @list_of_set_defs = get_set_defs($ce->{courseDirs}{templates}); |
681 | my @list_of_set_defs = sort(get_set_defs($ce->{courseDirs}{templates})); |
| 516 | if(scalar(@list_of_set_defs) == 0) { |
682 | if(scalar(@list_of_set_defs) == 0) { |
| 517 | @list_of_set_defs = (NO_LOCAL_SET_STRING); |
683 | @list_of_set_defs = (NO_LOCAL_SET_STRING); |
| 518 | } elsif (not $library_selected or $library_selected eq $default_value) { |
684 | } elsif (not $library_selected or $library_selected eq $default_value) { |
| 519 | unshift @list_of_set_defs, $default_value; |
685 | unshift @list_of_set_defs, $default_value; |
| 520 | $library_selected = $default_value; |
686 | $library_selected = $default_value; |
| … | |
… | |
| 561 | |
727 | |
| 562 | my $these_widths = "width: 23ex"; |
728 | my $these_widths = "width: 23ex"; |
| 563 | |
729 | |
| 564 | if($have_local_sets ==0) { |
730 | if($have_local_sets ==0) { |
| 565 | $list_of_local_sets = [NO_LOCAL_SET_STRING]; |
731 | $list_of_local_sets = [NO_LOCAL_SET_STRING]; |
| 566 | } elsif (not $set_selected or $set_selected eq SELECT_SET_STRING) { |
732 | } elsif (not defined($set_selected) or $set_selected eq "" |
|
|
733 | or $set_selected eq SELECT_SET_STRING) { |
| 567 | unshift @{$list_of_local_sets}, SELECT_SET_STRING; |
734 | unshift @{$list_of_local_sets}, SELECT_SET_STRING; |
| 568 | $set_selected = SELECT_SET_STRING; |
735 | $set_selected = SELECT_SET_STRING; |
| 569 | } |
736 | } |
| 570 | my $myjs = 'document.mainform.selfassign.value=confirm("Should I assign the new set to you now?\nUse OK for yes and Cancel for no.");true;'; |
737 | my $myjs = 'document.mainform.selfassign.value=confirm("Should I assign the new set to you now?\nUse OK for yes and Cancel for no.");true;'; |
| 571 | |
738 | |
| … | |
… | |
| 652 | |
819 | |
| 653 | my $urlpath = $self->r->urlpath; |
820 | my $urlpath = $self->r->urlpath; |
| 654 | my $problem_output = $pg->{flags}->{error_flag} ? |
821 | my $problem_output = $pg->{flags}->{error_flag} ? |
| 655 | CGI::div({class=>"ResultsWithError"}, CGI::em("This problem produced an error")) |
822 | CGI::div({class=>"ResultsWithError"}, CGI::em("This problem produced an error")) |
| 656 | : CGI::div({class=>"RenderSolo"}, $pg->{body_text}); |
823 | : CGI::div({class=>"RenderSolo"}, $pg->{body_text}); |
|
|
824 | $problem_output .= $pg->{flags}->{comment} if($pg->{flags}->{comment}); |
| 657 | |
825 | |
| 658 | |
826 | |
| 659 | my $edit_link = ''; |
|
|
| 660 | #if($self->{r}->param('browse_which') ne 'browse_library') { |
827 | #if($self->{r}->param('browse_which') ne 'browse_library') { |
| 661 | my $problem_seed = $self->{r}->param('problem_seed') || 0; |
828 | my $problem_seed = $self->{r}->param('problem_seed') || 0; |
| 662 | if($sourceFileName !~ /^Library\//) { |
|
|
| 663 | $edit_link = CGI::a({href=>$self->systemLink( |
829 | my $edit_link = CGI::a({href=>$self->systemLink( |
| 664 | $urlpath->newFromModule("WeBWorK::ContentGenerator::Instructor::PGProblemEditor", |
830 | $urlpath->newFromModule("WeBWorK::ContentGenerator::Instructor::PGProblemEditor", |
| 665 | courseID =>$urlpath->arg("courseID"), |
831 | courseID =>$urlpath->arg("courseID"), |
| 666 | setID=>"Undefined_Set", |
832 | setID=>"Undefined_Set", |
| 667 | problemID=>"1"), |
833 | problemID=>"1"), |
| 668 | params=>{sourceFilePath => "$sourceFileName", problemSeed=> $problem_seed} |
834 | params=>{sourceFilePath => "$sourceFileName", problemSeed=> $problem_seed} |
| 669 | )}, "Edit it" ); |
835 | ), target=>"WW_Editor"}, "Edit it" ); |
| 670 | } |
836 | |
| 671 | |
837 | my $displayMode = $self->r->param("mydisplayMode"); |
|
|
838 | $displayMode = $self->r->ce->{pg}->{options}->{displayMode} |
|
|
839 | if not defined $displayMode or $displayMode eq "None"; |
| 672 | my $try_link = CGI::a({href=>$self->systemLink( |
840 | my $try_link = CGI::a({href=>$self->systemLink( |
| 673 | $urlpath->newFromModule("WeBWorK::ContentGenerator::Problem", |
841 | $urlpath->newFromModule("WeBWorK::ContentGenerator::Problem", |
| 674 | courseID =>$urlpath->arg("courseID"), |
842 | courseID =>$urlpath->arg("courseID"), |
| 675 | setID=>"Undefined_Set", |
843 | setID=>"Undefined_Set", |
| 676 | problemID=>"1"), |
844 | problemID=>"1"), |
| 677 | params =>{ |
845 | params =>{ |
| 678 | effectiveUser => scalar($self->r->param('user')), |
846 | effectiveUser => scalar($self->r->param('user')), |
| 679 | editMode => "SetMaker", |
847 | editMode => "SetMaker", |
| 680 | problemSeed=> $problem_seed, |
848 | problemSeed=> $problem_seed, |
| 681 | sourceFilePath => "$sourceFileName" |
849 | sourceFilePath => "$sourceFileName", |
|
|
850 | displayMode => $displayMode, |
| 682 | } |
851 | } |
| 683 | )}, "Try it"); |
852 | ), target=>"WW_View"}, "Try it"); |
| 684 | |
853 | |
| 685 | my %add_box_data = ( -name=>"trial$cnt",-value=>1,-label=>"Add this problem to the current set on the next update"); |
854 | my %add_box_data = ( -name=>"trial$cnt",-value=>1,-label=>"Add this problem to the target set on the next update"); |
| 686 | if($mark & SUCCESS) { |
855 | if($mark & SUCCESS) { |
| 687 | $add_box_data{ -label } .= " (just added this problem)"; |
856 | $add_box_data{ -label } .= " (just added this problem)"; |
| 688 | } elsif($mark & ADDED) { |
857 | } elsif($mark & ADDED) { |
| 689 | $add_box_data{ -checked } = 1; |
858 | $add_box_data{ -checked } = 1; |
| 690 | } |
859 | } |
| … | |
… | |
| 700 | CGI::hidden(-name=>"filetrial$cnt", -default=>[$sourceFileName]). |
869 | CGI::hidden(-name=>"filetrial$cnt", -default=>[$sourceFileName]). |
| 701 | CGI::p($problem_output), |
870 | CGI::p($problem_output), |
| 702 | )); |
871 | )); |
| 703 | } |
872 | } |
| 704 | |
873 | |
|
|
874 | sub clear_default { |
|
|
875 | my $r = shift; |
|
|
876 | my $param = shift; |
|
|
877 | my $default = shift; |
|
|
878 | my $newvalue = $r->param($param) || ''; |
|
|
879 | $newvalue = '' if($newvalue eq $default); |
|
|
880 | $r->param($param, $newvalue); |
|
|
881 | } |
| 705 | |
882 | |
| 706 | sub pre_header_initialize { |
883 | sub pre_header_initialize { |
| 707 | my ($self) = @_; |
884 | my ($self) = @_; |
| 708 | my $r = $self->r; |
885 | my $r = $self->r; |
| 709 | ## For all cases, lets set some things |
886 | ## For all cases, lets set some things |
| 710 | $self->{error}=0; |
887 | $self->{error}=0; |
| 711 | my $ce = $r->ce; |
888 | my $ce = $r->ce; |
| 712 | my $db = $r->db; |
889 | my $db = $r->db; |
| 713 | my $maxShown = $r->param('max_shown') || MAX_SHOW_DEFAULT; |
890 | my $maxShown = $r->param('max_shown') || MAX_SHOW_DEFAULT; |
| 714 | $maxShown = 10000000 if($maxShown eq 'All'); # let's hope there aren't more |
891 | $maxShown = 10000000 if($maxShown eq 'All'); # let's hope there aren't more |
|
|
892 | my $library_basic = $r->param('library_is_basic') || 1; |
|
|
893 | |
|
|
894 | ## Fix some parameters |
|
|
895 | for my $key (keys(%{ LIB2_DATA() })) { |
|
|
896 | clear_default($r, LIB2_DATA->{$key}->{name}, LIB2_DATA->{$key}->{all} ); |
|
|
897 | } |
| 715 | |
898 | |
| 716 | ## These directories will have individual buttons |
899 | ## These directories will have individual buttons |
| 717 | %problib = %{$ce->{courseFiles}{problibs}} if $ce->{courseFiles}{problibs}; |
900 | %problib = %{$ce->{courseFiles}{problibs}} if $ce->{courseFiles}{problibs}; |
| 718 | |
901 | |
| 719 | my $userName = $r->param('user'); |
902 | my $userName = $r->param('user'); |
| … | |
… | |
| 853 | |
1036 | |
| 854 | } |
1037 | } |
| 855 | $use_previous_problems=0; |
1038 | $use_previous_problems=0; |
| 856 | } |
1039 | } |
| 857 | |
1040 | |
| 858 | ##### View whole chapter from the library |
1041 | ##### View from the library database |
| 859 | ## This will change somewhat later |
|
|
| 860 | |
1042 | |
| 861 | } elsif ($r->param('lib_view')) { |
1043 | } elsif ($r->param('lib_view')) { |
| 862 | |
1044 | |
| 863 | @pg_files=(); |
1045 | @pg_files=(); |
| 864 | my $chap = $r->param('library_chapters') || ""; |
|
|
| 865 | $chap = "" if($chap eq "All Chapters"); |
|
|
| 866 | my $sect = $r->param('library_sections') || ""; |
|
|
| 867 | $sect = "" if($sect eq "All Sections"); |
|
|
| 868 | my @dbsearch = WeBWorK::Utils::ListingDB::getSectionListings($r->{ce}, "$chap", "$sect"); |
1046 | my @dbsearch = WeBWorK::Utils::ListingDB::getSectionListings($r); |
| 869 | my ($result, $tolibpath); |
1047 | my ($result, $tolibpath); |
| 870 | for $result (@dbsearch) { |
1048 | for $result (@dbsearch) { |
| 871 | $tolibpath = "Library/$result->{path}/$result->{filename}"; |
1049 | $tolibpath = "Library/$result->{path}/$result->{filename}"; |
| 872 | |
1050 | |
| 873 | ## Too clunky!!!! |
1051 | ## Too clunky!!!! |
| … | |
… | |
| 990 | $first_shown = 0 if($first_shown<0); |
1168 | $first_shown = 0 if($first_shown<0); |
| 991 | @past_marks = (); |
1169 | @past_marks = (); |
| 992 | |
1170 | |
| 993 | } elsif ($r->param('select_all')) { |
1171 | } elsif ($r->param('select_all')) { |
| 994 | @past_marks = map {1} @past_marks; |
1172 | @past_marks = map {1} @past_marks; |
|
|
1173 | } elsif ($r->param('library_basic')) { |
|
|
1174 | $library_basic = 1; |
|
|
1175 | for my $jj (qw(textchapter textsection textbook)) { |
|
|
1176 | $r->param('library_'.$jj,''); |
|
|
1177 | } |
|
|
1178 | } elsif ($r->param('library_advanced')) { |
|
|
1179 | $library_basic = 2; |
|
|
1180 | } elsif ($r->param('library_reset')) { |
|
|
1181 | for my $jj (qw(chapters sections subjects textbook keywords)) { |
|
|
1182 | $r->param('library_'.$jj,''); |
|
|
1183 | } |
| 995 | } elsif ($r->param('select_none')) { |
1184 | } elsif ($r->param('select_none')) { |
| 996 | @past_marks = (); |
1185 | @past_marks = (); |
| 997 | |
1186 | |
| 998 | ##### No action requested, probably our first time here |
1187 | ##### No action requested, probably our first time here |
| 999 | |
1188 | |
| … | |
… | |
| 1023 | $self->{browse_which} = $browse_which; |
1212 | $self->{browse_which} = $browse_which; |
| 1024 | $self->{problem_seed} = $problem_seed; |
1213 | $self->{problem_seed} = $problem_seed; |
| 1025 | $self->{pg_files} = \@pg_files; |
1214 | $self->{pg_files} = \@pg_files; |
| 1026 | $self->{past_marks} = \@past_marks; |
1215 | $self->{past_marks} = \@past_marks; |
| 1027 | $self->{all_db_sets} = \@all_db_sets; |
1216 | $self->{all_db_sets} = \@all_db_sets; |
| 1028 | |
1217 | $self->{library_basic} = $library_basic; |
| 1029 | } |
1218 | } |
| 1030 | |
1219 | |
| 1031 | |
1220 | |
| 1032 | sub title { |
1221 | sub title { |
| 1033 | return "Library Browser"; |
1222 | return "Library Browser"; |
|
|
1223 | } |
|
|
1224 | |
|
|
1225 | # hide view options panel since it distracts from SetMaker's built-in view options |
|
|
1226 | sub options { |
|
|
1227 | return ""; |
| 1034 | } |
1228 | } |
| 1035 | |
1229 | |
| 1036 | sub body { |
1230 | sub body { |
| 1037 | my ($self) = @_; |
1231 | my ($self) = @_; |
| 1038 | |
1232 | |
| … | |
… | |
| 1117 | print CGI::endform(), "\n"; |
1311 | print CGI::endform(), "\n"; |
| 1118 | |
1312 | |
| 1119 | return ""; |
1313 | return ""; |
| 1120 | } |
1314 | } |
| 1121 | |
1315 | |
| 1122 | ############################################## End of Body |
|
|
| 1123 | |
|
|
| 1124 | # SKEL: To emit your own HTTP header, uncomment this: |
|
|
| 1125 | # |
|
|
| 1126 | #sub header { |
|
|
| 1127 | # my ($self) = @_; |
|
|
| 1128 | # |
|
|
| 1129 | # # Generate your HTTP header here. |
|
|
| 1130 | # |
|
|
| 1131 | # # If you return something, it will be used as the HTTP status code for this |
|
|
| 1132 | # # request. The Apache::Constants module might be useful for gerating status |
|
|
| 1133 | # # codes. If you don't return anything, the status code "OK" will be used. |
|
|
| 1134 | # return ""; |
|
|
| 1135 | #} |
|
|
| 1136 | |
|
|
| 1137 | # SKEL: If you need to do any processing after the HTTP header is sent, but before |
|
|
| 1138 | # any template processing occurs, or you need to calculate values that will be |
|
|
| 1139 | # used in multiple methods, do it in this method: |
|
|
| 1140 | # |
|
|
| 1141 | #sub initialize { |
|
|
| 1142 | #my ($self) = @_; |
|
|
| 1143 | #} |
|
|
| 1144 | |
|
|
| 1145 | # SKEL: If you need to add tags to the document <HEAD>, uncomment this method: |
|
|
| 1146 | # |
|
|
| 1147 | #sub head { |
|
|
| 1148 | # my ($self) = @_; |
|
|
| 1149 | # |
|
|
| 1150 | # # You can print head tags here, like <META>, <SCRIPT>, etc. |
|
|
| 1151 | # |
|
|
| 1152 | # return ""; |
|
|
| 1153 | #} |
|
|
| 1154 | |
|
|
| 1155 | # SKEL: To fill in the "info" box (to the right of the main body), use this |
|
|
| 1156 | # method: |
|
|
| 1157 | # |
|
|
| 1158 | #sub info { |
|
|
| 1159 | # my ($self) = @_; |
|
|
| 1160 | # |
|
|
| 1161 | # # Print HTML here. |
|
|
| 1162 | # |
|
|
| 1163 | # return ""; |
|
|
| 1164 | #} |
|
|
| 1165 | |
|
|
| 1166 | # SKEL: To provide navigation links, use this method: |
|
|
| 1167 | # |
|
|
| 1168 | #sub nav { |
|
|
| 1169 | # my ($self, $args) = @_; |
|
|
| 1170 | # |
|
|
| 1171 | # # See the documentation of path() and pathMacro() in |
|
|
| 1172 | # # WeBWorK::ContentGenerator for more information. |
|
|
| 1173 | # |
|
|
| 1174 | # return ""; |
|
|
| 1175 | #} |
|
|
| 1176 | |
|
|
| 1177 | # SKEL: For a little box for display options, etc., use this method: |
|
|
| 1178 | # |
|
|
| 1179 | #sub options { |
|
|
| 1180 | # my ($self) = @_; |
|
|
| 1181 | # |
|
|
| 1182 | # # Print HTML here. |
|
|
| 1183 | # |
|
|
| 1184 | # return ""; |
|
|
| 1185 | #} |
|
|
| 1186 | |
|
|
| 1187 | # SKEL: For a list of sibling objects, use this method: |
|
|
| 1188 | # |
|
|
| 1189 | #sub siblings { |
|
|
| 1190 | # my ($self, $args) = @_; |
|
|
| 1191 | # |
|
|
| 1192 | # # See the documentation of siblings() and siblingsMacro() in |
|
|
| 1193 | # # WeBWorK::ContentGenerator for more information. |
|
|
| 1194 | # # |
|
|
| 1195 | # # Refer to implementations in ProblemSet and Problem. |
|
|
| 1196 | # |
|
|
| 1197 | # return ""; |
|
|
| 1198 | #} |
|
|
| 1199 | |
|
|
| 1200 | =head1 AUTHOR |
1316 | =head1 AUTHOR |
| 1201 | |
1317 | |
| 1202 | Written by John Jones, jj (at) asu.edu. |
1318 | Written by John Jones, jj (at) asu.edu. |
| 1203 | |
1319 | |
| 1204 | =cut |
1320 | =cut |
| 1205 | |
1321 | |
| 1206 | |
|
|
| 1207 | |
|
|
| 1208 | 1; |
1322 | 1; |