[system] / trunk / webwork-modperl / lib / WeBWorK / ContentGenerator / Instructor / SetMaker.pm Repository:
ViewVC logotype

Diff of /trunk/webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm

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

Revision 2264 Revision 3397
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.17 2004/05/31 02:20:27 jj Exp $ 4# $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm,v 1.37 2005/07/14 16:23:11 glarose 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.
10# 10#
11# This program is distributed in the hope that it will be useful, but WITHOUT 11# This program is distributed in the hope that it will be useful, but WITHOUT
12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13# FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the 13# FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the
14# Artistic License for more details. 14# Artistic License for more details.
15################################################################################ 15################################################################################
16 16
17 17
18package WeBWorK::ContentGenerator::Instructor::SetMaker; 18package WeBWorK::ContentGenerator::Instructor::SetMaker;
27use strict; 27use strict;
28use warnings; 28use warnings;
29 29
30use CGI::Pretty qw(); 30use CGI::Pretty qw();
31use WeBWorK::Form; 31use WeBWorK::Form;
32use WeBWorK::Utils qw(readDirectory max); 32use WeBWorK::Utils qw(readDirectory max sortByName);
33use WeBWorK::Utils::Tasks qw(renderProblems); 33use WeBWorK::Utils::Tasks qw(renderProblems);
34 34
35require WeBWorK::Utils::ListingDB; 35require WeBWorK::Utils::ListingDB;
36 36
37use constant MAX_SHOW_DEFAULT => 20; 37use constant MAX_SHOW_DEFAULT => 20;
38use constant NO_LOCAL_SET_STRING => 'There are no local sets yet'; 38use constant NO_LOCAL_SET_STRING => 'No sets in this course yet';
39use constant SELECT_SET_STRING => 'Select a Set for This Course'; 39use constant SELECT_SET_STRING => 'Select a Set for This Course';
40use constant SELECT_LOCAL_STRING => 'Select a Local Problem Collection'; 40use constant SELECT_LOCAL_STRING => 'Select a Problem Collection';
41use constant MY_PROBLEMS => ' My Problems ';
42use constant MAIN_PROBLEMS => ' Main Problems ';
43use constant CREATE_SET_BUTTON => 'Create New Set';
41 44
42## Flags for operations on files 45## Flags for operations on files
43 46
44use constant ADDED => 1; 47use constant ADDED => 1;
45use constant HIDDEN => (1 << 1); 48use constant HIDDEN => (1 << 1);
46use constant SUCCESS => (1 << 2); 49use constant SUCCESS => (1 << 2);
47 50
51## for additional problib buttons
52my %problib; ## filled in in global.conf
53my %ignoredir = (
54 '.' => 1, '..' => 1, 'Library' => 1,
55 'headers' => 1, 'macros' => 1, 'email' => 1,
56);
57
58##
48## This is for searching the disk for directories containing pg files. 59## This is for searching the disk for directories containing pg files.
49## to make the recursion work, this returns an array where the first 60## to make the recursion work, this returns an array where the first
50## item is 1 or 0 depending on whether or not the current 61## item is the number of pg files in the directory. The second is a
51## directory has any pg files. The second is a list of directories 62## list of directories which contain pg files.
52## which contain pg files. 63##
64## If a directory contains only one pg file and at least one other
65## file, the directory is considered to be part of the parent
66## directory (it is probably in a separate directory only because
67## it has auxiliarly files that want to be kept together with the
68## pg file).
69##
70## If a directory has a file named "=library-ignore", it is never
71## included in the directory menu. If a directory contains a file
72## called "=library-combine-up", then its pg are included with those
73## 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
75## always listed as a separate directory even if it contains only one
76## pg file.
77##
78
53sub get_library_sets { 79sub get_library_sets {
54 my $amtop = shift; 80 my $top = shift; my $dir = shift;
55 my $topdir = shift; 81 # ignore directories that give us an error
82 my @lis = eval { readDirectory($dir) };
83 if ($@) {
84 warn $@;
85 return (0);
86 }
87 return (0) if grep /^=library-ignore$/, @lis;
88
89 my @pgdirs;
90
91 my $pgcount = scalar(grep { m/\.pg$/ and (not m/(Header|-text)\.pg$/) and -f "$dir/$_"} @lis);
92 my $others = scalar(grep { (!m/\.pg$/ || m/(Header|-text)\.pg$/) &&
93 !m/(\.(tmp|bak)|~)$/ && -f "$dir/$_" } @lis);
94
95 my @dirs = grep {!$ignoredir{$_} and -d "$dir/$_"} @lis;
96 if ($top == 1) {@dirs = grep {!$problib{$_}} @dirs}
97 foreach my $subdir (@dirs) {
98 my @results = get_library_sets(0, "$dir/$subdir");
99 $pgcount += shift @results; push(@pgdirs,@results);
100 }
101
102 return ($pgcount, @pgdirs) if $top || $pgcount == 0 || grep /^=library-combine-up$/, @lis;
103 return (0,@pgdirs,$dir) if $pgcount > 1 || $others == 0 || grep /^=library-no-combine$/, @lis;
104 return ($pgcount, @pgdirs);
105}
106
107sub get_library_pgs {
108 my $top = shift; my $base = shift; my $dir = shift;
56 my @lis = readDirectory($topdir); 109 my @lis = readDirectory("$base/$dir");
110 return () if grep /^=library-ignore$/, @lis;
111 return () if !$top && grep /^=library-no-combine$/, @lis;
112
57 my @pgs = grep { m/\.pg$/ and (not m/Header\.pg/) and -f "$topdir/$_"} @lis; 113 my @pgs = grep { m/\.pg$/ and (not m/(Header|-text)\.pg$/) and -f "$base/$dir/$_"} @lis;
58 my $havepg = scalar(@pgs)>0 ? 1 : 0; 114 my $others = scalar(grep { (!m/\.pg$/ || m/(Header|-text)\.pg$/) &&
59 my @mdirs = grep {$_ ne "." and $_ ne ".." and $_ ne "Library" 115 !m/(\.(tmp|bak)|~)$/ && -f "$base/$dir/$_" } @lis);
60 and -d "$topdir/$_"} @lis;
61 if($amtop) { # we don't want the library
62 @mdirs = grep {$_ ne "Library"} @mdirs;
63 }
64 my ($adir, @results, @thisresult);
65 for $adir (@mdirs) {
66 @results = get_library_sets(0, "$topdir/$adir");
67 my $isadirok = shift @results;
68 @thisresult = (@thisresult, @results);
69 if ($isadirok) {
70 @thisresult = ("$topdir/$adir", @thisresult);
71 }
72 }
73 return(($havepg, @thisresult));
74}
75 116
76## List all the pg files in the requested directory 117 my @dirs = grep {!$ignoredir{$_} and -d "$base/$dir/$_"} @lis;
118 if ($top == 1) {@dirs = grep {!$problib{$_}} @dirs}
119 foreach my $subdir (@dirs) {push(@pgs, get_library_pgs(0,"$base/$dir",$subdir))}
120
121 return () unless $top || (scalar(@pgs) == 1 && $others) || grep /^=library-combine-up$/, @lis;
122 return (map {"$dir/$_"} @pgs);
123}
124
77sub list_pg_files { 125sub list_pg_files {
78 my $templatedir = shift; 126 my ($templates,$dir) = @_;
79 my $topdir = shift; 127 my $top = ($dir eq '.')? 1 : 2;
80 128 my @pgs = get_library_pgs($top,$templates,$dir);
81 my @lis = readDirectory("$templatedir/$topdir"); 129 return sortByName(undef,@pgs);
82 my @pgs = grep { m/\.pg$/ and (not m/Header\.pg/) and -f "$templatedir/$topdir/$_"} @lis;
83 @pgs = map { "$topdir/$_" } @pgs;
84 return(@pgs);
85} 130}
86 131
87## go through past page getting a list of identifiers for the problems 132## go through past page getting a list of identifiers for the problems
88## and whether or not they are selected, and whether or not they should 133## and whether or not they are selected, and whether or not they should
89## be hidden 134## be hidden
90 135
91sub get_past_problem_files { 136sub get_past_problem_files {
92 my $r = shift; 137 my $r = shift;
93 my @found=(); 138 my @found=();
94 my $count =1; 139 my $count =1;
95 while (defined($r->param("filetrial$count"))) { 140 while (defined($r->param("filetrial$count"))) {
96 my $val = 0; 141 my $val = 0;
97 $val |= ADDED if($r->param("trial$count")); 142 $val |= ADDED if($r->param("trial$count"));
98 $val |= HIDDEN if($r->param("hideme$count")); 143 $val |= HIDDEN if($r->param("hideme$count"));
99 push @found, [$r->param("filetrial$count"), $val]; 144 push @found, [$r->param("filetrial$count"), $val];
100 $count++; 145 $count++;
101 } 146 }
102 return(\@found); 147 return(\@found);
103} 148}
104 149
105#### For adding new problems 150#### For adding new problems
106 151
107sub add_selected { 152sub add_selected {
108 my $self = shift; 153 my $self = shift;
109 my $db = shift; 154 my $db = shift;
110 my $setName = shift; 155 my $setName = shift;
111 my @past_problems = @{$self->{past_problems}}; 156 my @past_problems = @{$self->{past_problems}};
112 my @selected = @past_problems; 157 my @selected = @past_problems;
113 my (@path, $file, $selected, $freeProblemID); 158 my (@path, $file, $selected, $freeProblemID);
114 $freeProblemID = max($db->listGlobalProblems($setName)) + 1; 159 $freeProblemID = max($db->listGlobalProblems($setName)) + 1;
115 my $addedcount=0; 160 my $addedcount=0;
116 161
117 for $selected (@selected) { 162 for $selected (@selected) {
118 if($selected->[1] & ADDED) { 163 if($selected->[1] & ADDED) {
119 $file = $selected->[0]; 164 $file = $selected->[0];
120 my $problemRecord = $db->newGlobalProblem(); 165 my $problemRecord = $self->addProblemToSet(setName => $setName,
121 $problemRecord->problem_id($freeProblemID++); 166 sourceFile => $file, problemID => $freeProblemID);
122 $problemRecord->set_id($setName); 167 $freeProblemID++;
123 $problemRecord->source_file($file);
124 $problemRecord->value("1");
125 $problemRecord->max_attempts("-1");
126 $db->addGlobalProblem($problemRecord);
127 $self->assignProblemToAllSetUsers($problemRecord); 168 $self->assignProblemToAllSetUsers($problemRecord);
128 $selected->[1] |= SUCCESS; 169 $selected->[1] |= SUCCESS;
129 $addedcount++; 170 $addedcount++;
130 } 171 }
131 } 172 }
132 return($addedcount); 173 return($addedcount);
133} 174}
134 175
135 176
136############# List of sets of problems in templates directory 177############# List of sets of problems in templates directory
137 178
138sub get_problem_directories { 179sub get_problem_directories {
139 my $ce = shift; 180 my $ce = shift;
181 my $lib = shift;
182 my $source = $ce->{courseDirs}{templates};
183 my $main = MY_PROBLEMS; my $isTop = 1;
184 if ($lib) {$source .= "/$lib"; $main = MAIN_PROBLEMS; $isTop = 2}
140 my @all_problem_directories = get_library_sets(1, $ce->{courseDirs}->{templates}); 185 my @all_problem_directories = get_library_sets($isTop, $source);
141 my $includetop = shift @all_problem_directories; 186 my $includetop = shift @all_problem_directories;
142 my $j; 187 my $j;
143 for ($j=0; $j<scalar(@all_problem_directories); $j++) { 188 for ($j=0; $j<scalar(@all_problem_directories); $j++) {
144 $all_problem_directories[$j] =~ s|^$ce->{courseDirs}->{templates}/?||; 189 $all_problem_directories[$j] =~ s|^$ce->{courseDirs}->{templates}/?||;
145 } 190 }
146 @all_problem_directories = sort @all_problem_directories; 191 @all_problem_directories = sortByName(undef, @all_problem_directories);
147 unshift @all_problem_directories, ' My Problems ' if($includetop); 192 unshift @all_problem_directories, $main if($includetop);
148 return (\@all_problem_directories); 193 return (\@all_problem_directories);
149} 194}
150 195
151############# Everyone has a view problems line. Abstract it 196############# Everyone has a view problems line. Abstract it
152sub view_problems_line { 197sub view_problems_line {
153 my $internal_name = shift; 198 my $internal_name = shift;
154 my $label = shift; 199 my $label = shift;
155 my $r = shift; # so we can get parameter values 200 my $r = shift; # so we can get parameter values
156 my $result = CGI::submit(-name=>"$internal_name", -value=>$label); 201 my $result = CGI::submit(-name=>"$internal_name", -value=>$label);
157 202
158 my %display_modes = %{WeBWorK::PG::DISPLAY_MODES()}; 203 my %display_modes = %{WeBWorK::PG::DISPLAY_MODES()};
159 my @active_modes = grep { exists $display_modes{$_} } 204 my @active_modes = grep { exists $display_modes{$_} }
160 @{$r->ce->{pg}->{displayModes}}; 205 @{$r->ce->{pg}->{displayModes}};
161 push @active_modes, 'None'; 206 push @active_modes, 'None';
162 # We have our own displayMode since its value may be None, which is illegal 207 # We have our own displayMode since its value may be None, which is illegal
163 # in other modules. 208 # in other modules.
164 my $mydisplayMode = $r->param('mydisplayMode') || $r->ce->{pg}->{options}->{displayMode}; 209 my $mydisplayMode = $r->param('mydisplayMode') || $r->ce->{pg}->{options}->{displayMode};
165 $result .= '&nbsp;Display&nbsp;Mode:&nbsp;'.CGI::popup_menu(-name=> 'mydisplayMode', 210 $result .= '&nbsp;Display&nbsp;Mode:&nbsp;'.CGI::popup_menu(-name=> 'mydisplayMode',
166 -values=>\@active_modes, 211 -values=>\@active_modes,
167 -default=> $mydisplayMode); 212 -default=> $mydisplayMode);
168 # Now we give a choice of the number of problems to show 213 # Now we give a choice of the number of problems to show
169 my $defaultMax = $r->param('max_shown') || MAX_SHOW_DEFAULT; 214 my $defaultMax = $r->param('max_shown') || MAX_SHOW_DEFAULT;
170 $result .= '&nbsp;Max. Shown:&nbsp'. 215 $result .= '&nbsp;Max. Shown:&nbsp'.
171 CGI::popup_menu(-name=> 'max_shown', 216 CGI::popup_menu(-name=> 'max_shown',
172 -values=>[5,10,15,20,25,30,50,'All'], 217 -values=>[5,10,15,20,25,30,50,'All'],
173 -default=> $defaultMax); 218 -default=> $defaultMax);
174 219
175 return($result); 220 return($result);
176} 221}
177 222
178 223
179### The browsing panel has three versions 224### The browsing panel has three versions
180##### Version 1 is local problems 225##### Version 1 is local problems
181sub browse_local_panel { 226sub browse_local_panel {
182 my $self = shift; 227 my $self = shift;
183 my $library_selected = shift; 228 my $library_selected = shift;
229 my $lib = shift || ''; $lib =~ s/^browse_//;
230 my $name = ($lib eq '')? 'Local' : $problib{$lib};
184 231
185 my $list_of_prob_dirs= get_problem_directories($self->r->ce); 232 my $list_of_prob_dirs= get_problem_directories($self->r->ce,$lib);
186 if(scalar(@$list_of_prob_dirs) == 0) { 233 if(scalar(@$list_of_prob_dirs) == 0) {
187 $library_selected = "Found no directories containing problems"; 234 $library_selected = "Found no directories containing problems";
188 unshift @{$list_of_prob_dirs}, $library_selected; 235 unshift @{$list_of_prob_dirs}, $library_selected;
189 } else { 236 } else {
190 my $default_value = SELECT_LOCAL_STRING; 237 my $default_value = SELECT_LOCAL_STRING;
191 if (not $library_selected or $library_selected eq $default_value) { 238 if (not $library_selected or $library_selected eq $default_value) {
192 unshift @{$list_of_prob_dirs}, $default_value; 239 unshift @{$list_of_prob_dirs}, $default_value;
193 $library_selected = $default_value; 240 $library_selected = $default_value;
194 } 241 }
195 } 242 }
196 my $view_problem_line = view_problems_line('view_local_set', 'View Problems', $self->r); 243 my $view_problem_line = view_problems_line('view_local_set', 'View Problems', $self->r);
197 print CGI::Tr(CGI::td({-class=>"InfoPanel", -align=>"left"}, "Local Problems: ", 244 print CGI::Tr(CGI::td({-class=>"InfoPanel", -align=>"left"}, "$name Problems: ",
198 CGI::popup_menu(-name=> 'library_sets', 245 CGI::popup_menu(-name=> 'library_sets',
199 -values=>$list_of_prob_dirs, 246 -values=>$list_of_prob_dirs,
200 -default=> $library_selected), 247 -default=> $library_selected),
201 CGI::br(), 248 CGI::br(),
202 $view_problem_line, 249 $view_problem_line,
203 )); 250 ));
204} 251}
205 252
206##### Version 2 is local problem sets 253##### Version 2 is local problem sets
207sub browse_mysets_panel { 254sub browse_mysets_panel {
208 my $self = shift; 255 my $self = shift;
209 my $library_selected = shift; 256 my $library_selected = shift;
210 my $list_of_local_sets = shift; 257 my $list_of_local_sets = shift;
211 my $default_value = "Select a Problem Set"; 258 my $default_value = "Select a Homework Set";
212 259
213 if(scalar(@$list_of_local_sets) == 0) { 260 if(scalar(@$list_of_local_sets) == 0) {
214 $list_of_local_sets = [NO_LOCAL_SET_STRING]; 261 $list_of_local_sets = [NO_LOCAL_SET_STRING];
215 } elsif (not $library_selected or $library_selected eq $default_value) { 262 } elsif (not $library_selected or $library_selected eq $default_value) {
216 unshift @{$list_of_local_sets}, $default_value; 263 unshift @{$list_of_local_sets}, $default_value;
217 $library_selected = $default_value; 264 $library_selected = $default_value;
218 } 265 }
219 266
220 my $view_problem_line = view_problems_line('view_mysets_set', 'View Problems', $self->r); 267 my $view_problem_line = view_problems_line('view_mysets_set', 'View Problems', $self->r);
221 print CGI::Tr(CGI::td({-class=>"InfoPanel", -align=>"left"}, "Browse from: ", 268 print CGI::Tr(CGI::td({-class=>"InfoPanel", -align=>"left"}, "Browse from: ",
222 CGI::popup_menu(-name=> 'library_sets', 269 CGI::popup_menu(-name=> 'library_sets',
223 -values=>$list_of_local_sets, 270 -values=>$list_of_local_sets,
224 -default=> $library_selected), 271 -default=> $library_selected),
225 CGI::br(), 272 CGI::br(),
226 $view_problem_line 273 $view_problem_line
227 )); 274 ));
228} 275}
229 276
230##### Version 3 is the problem library 277##### Version 3 is the problem library
231 278
232 279
233# There a different levels, and you can pick a new chapter, 280# There a different levels, and you can pick a new chapter,
234# pick a new section, pick all from chapter, pick all from section 281# pick a new section, pick all from chapter, pick all from section
235# 282#
236# Incoming data - current chapter, current section 283# Incoming data - current chapter, current section
237sub browse_library_panel { 284sub browse_library_panel {
238 my $self = shift; 285 my $self = shift;
239 my $r = $self->r; 286 my $r = $self->r;
240 my $ce = $r->ce; 287 my $ce = $r->ce;
241 288
242 my $libraryRoot = $r->{ce}->{problemLibrary}->{root}; 289 my $libraryRoot = $r->{ce}->{problemLibrary}->{root};
243 290
244 unless($libraryRoot) { 291 unless($libraryRoot) {
245 print CGI::Tr(CGI::td(CGI::div({class=>'ResultsWithError', align=>"center"}, 292 print CGI::Tr(CGI::td(CGI::div({class=>'ResultsWithError', align=>"center"},
246 "The problem library has not been installed."))); 293 "The problem library has not been installed.")));
247 return; 294 return;
248 } 295 }
249 # Test if the Library directory exists. If not, try to make it 296 # Test if the Library directory exists. If not, try to make it
250 unless(-d "$ce->{courseDirs}->{templates}/Library") { 297 unless(-d "$ce->{courseDirs}->{templates}/Library") {
251 unless(symlink($libraryRoot, "$ce->{courseDirs}->{templates}/Library")) { 298 unless(symlink($libraryRoot, "$ce->{courseDirs}->{templates}/Library")) {
252 my $msg = <<"HERE"; 299 my $msg = <<"HERE";
253You are missing the directory <code>templates/Library</code>, which is needed 300You are missing the directory <code>templates/Library</code>, which is needed
254for the Problem Library to function. It should be a link pointing to 301for the Problem Library to function. It should be a link pointing to
255<code>$libraryRoot</code>, which you set in <code>conf/global.conf</code>. 302<code>$libraryRoot</code>, which you set in <code>conf/global.conf</code>.
256I tried to make the link for you, but that failed. Check the permissions 303I tried to make the link for you, but that failed. Check the permissions
257in your <code>templates</code> directory. 304in your <code>templates</code> directory.
258HERE 305HERE
259 $self->addbadmessage($msg); 306 $self->addbadmessage($msg);
260 } 307 }
261 } 308 }
262 309
263 my $default_chap = "All Chapters"; 310 my $default_chap = "All Chapters";
264 my $default_sect = "All Sections"; 311 my $default_sect = "All Sections";
265 312
266 my @chaps = WeBWorK::Utils::ListingDB::getAllChapters($r->{ce}); 313 my @chaps = WeBWorK::Utils::ListingDB::getAllChapters($r->{ce});
267 unshift @chaps, $default_chap; 314 unshift @chaps, $default_chap;
268 my $chapter_selected = $r->param('library_chapters') || $default_chap; 315 my $chapter_selected = $r->param('library_chapters') || $default_chap;
269 316
270 my @sects=(); 317 my @sects=();
271 if ($chapter_selected ne $default_chap) { 318 if ($chapter_selected ne $default_chap) {
272 @sects = WeBWorK::Utils::ListingDB::getAllSections($r->{ce}, $chapter_selected); 319 @sects = WeBWorK::Utils::ListingDB::getAllSections($r->{ce}, $chapter_selected);
273 } 320 }
274 321
275 my @textbooks = ('Textbook info not ready'); 322 my @textbooks = ('Textbook info not ready');
276 323
277 unshift @sects, $default_sect; 324 unshift @sects, $default_sect;
278 my $section_selected = $r->param('library_sections') || $default_sect; 325 my $section_selected = $r->param('library_sections') || $default_sect;
279 my $view_problem_line = view_problems_line('lib_view', 'View Problems', $self->r); 326 my $view_problem_line = view_problems_line('lib_view', 'View Problems', $self->r);
280 327
281 print CGI::Tr(CGI::td({-class=>"InfoPanel", -align=>"left"}, 328 print CGI::Tr(CGI::td({-class=>"InfoPanel", -align=>"left"},
282 CGI::start_table(), 329 CGI::start_table(),
283 CGI::Tr( 330 CGI::Tr(
284 CGI::td(["Chapter:", 331 CGI::td(["Chapter:",
285 CGI::popup_menu(-name=> 'library_chapters', 332 CGI::popup_menu(-name=> 'library_chapters',
286 -values=>\@chaps, 333 -values=>\@chaps,
287 -default=> $chapter_selected, 334 -default=> $chapter_selected,
288 -onchange=>"submit();return true" 335 -onchange=>"submit();return true"
289 ), 336 ),
290 CGI::submit(-name=>"lib_select_chapter", -value=>"Update Section List")])), 337 CGI::submit(-name=>"lib_select_chapter", -value=>"Update Section List")])),
291 CGI::Tr( 338 CGI::Tr(
292 CGI::td("Section:"), 339 CGI::td("Section:"),
293 CGI::td({-colspan=>2}, 340 CGI::td({-colspan=>2},
294 CGI::popup_menu(-name=> 'library_sections', 341 CGI::popup_menu(-name=> 'library_sections',
295 -values=>\@sects, 342 -values=>\@sects,
296 -default=> $section_selected 343 -default=> $section_selected
297 ))), 344 ))),
298 345
299# CGI::Tr( 346 #CGI::Tr(
300# CGI::td("Textbook:"), 347 # CGI::td("Textbook:"),
301# CGI::td({-colspan=>2}, 348 # CGI::td({-colspan=>2},
302# CGI::popup_menu(-name=> 'library_textbooks', 349 # CGI::popup_menu(-name=> 'library_textbooks',
303# -values=>\@textbooks, 350 # -values=>\@textbooks,
304# # -default=> $section_selected 351 # #-default=> $section_selected
305# ))), 352 #))),
306 353
307# CGI::Tr( 354 #CGI::Tr(
308# CGI::td("Keywords:"), 355 # CGI::td("Keywords:"),
309# CGI::td({-colspan=>2}, CGI::textfield(-name=>"keywords",
310# -default=>"Keywords not implemented yet",
311# -override=>1, -size=>60))),
312 CGI::Tr(CGI::td({-colspan=>3}, 356 # CGI::td({-colspan=>2},
313 $view_problem_line)), 357 # CGI::textfield(-name=>"keywords",
358 # -default=>"Keywords not implemented yet",
359 # -override=>1, -size=>60
360 #))),
361 CGI::Tr(CGI::td({-colspan=>3}, $view_problem_line)),
314 CGI::end_table(), 362 CGI::end_table(),
315 )); 363 ));
316} 364}
317 365
318sub make_top_row { 366sub make_top_row {
319 my $self = shift; 367 my $self = shift;
320 my $r = $self->r; 368 my $r = $self->r;
369 my $ce = $r->ce;
321 my %data = @_; 370 my %data = @_;
322 371
323 my $list_of_local_sets = $data{all_set_defs}; 372 my $list_of_local_sets = $data{all_set_defs};
324 my $have_local_sets = scalar(@$list_of_local_sets); 373 my $have_local_sets = scalar(@$list_of_local_sets);
325 my $browse_which = $data{browse_which}; 374 my $browse_which = $data{browse_which};
326 my $library_selected = $r->param('library_sets'); 375 my $library_selected = $r->param('library_sets');
327 my $set_selected = $r->param('local_sets'); 376 my $set_selected = $r->param('local_sets');
328 377
329 my ($dis1, $dis2, $dis3) = ("","",""); 378 my ($dis1, $dis2, $dis3) = ("","","");
330 $dis1 = '-disabled' if($browse_which eq 'browse_library'); 379 $dis1 = '-disabled' if($browse_which eq 'browse_library');
331 $dis2 = '-disabled' if($browse_which eq 'browse_local'); 380 $dis2 = '-disabled' if($browse_which eq 'browse_local');
332 $dis3 = '-disabled' if($browse_which eq 'browse_mysets'); 381 $dis3 = '-disabled' if($browse_which eq 'browse_mysets');
333 382
383 ## Make buttons for additional problem libraries
384 my $libs = '';
385 foreach my $lib (sort(keys(%problib))) {
386 $libs .= ' '. CGI::submit(-name=>"browse_$lib", -value=>$problib{$lib},
387 ($browse_which eq "browse_$lib")? '-disabled': '')
388 if (-d "$ce->{courseDirs}{templates}/$lib");
389 }
390 $libs = CGI::br()."or Problems from".$libs if $libs ne '';
391
334 my $these_widths = "width: 27ex"; 392 my $these_widths = "width: 23ex";
335 print CGI::Tr(CGI::td({-class=>"InfoPanel", -align=>"center"},
336 CGI::submit(-name=>"browse_library", -value=>"Browse Problem Library", -style=>$these_widths, $dis1),
337 CGI::submit(-name=>"browse_local", -value=>"Browse Local Problems", -style=>$these_widths, $dis2),
338 CGI::submit(-name=>"browse_mysets", -value=>"Browse From This Course", -style=>$these_widths, $dis3),
339 ));
340 393
341 print CGI::Tr(CGI::td({-bgcolor=>"black"}));
342
343 if ($browse_which eq 'browse_local') {
344 $self->browse_local_panel($library_selected);
345 } elsif ($browse_which eq 'browse_mysets') {
346 $self->browse_mysets_panel($library_selected, $list_of_local_sets);
347 } else {
348 $self->browse_library_panel();
349 }
350
351 print CGI::Tr(CGI::td({-bgcolor=>"black"}));
352
353 if($have_local_sets ==0) { 394 if($have_local_sets ==0) {
354 $list_of_local_sets = [NO_LOCAL_SET_STRING]; 395 $list_of_local_sets = [NO_LOCAL_SET_STRING];
355 } elsif (not $set_selected or $set_selected eq SELECT_SET_STRING) { 396 } elsif (not $set_selected or $set_selected eq SELECT_SET_STRING) {
356 if ($list_of_local_sets->[0] eq "Select a Problem Set") { 397 if ($list_of_local_sets->[0] eq "Select a Homework Set") {
357 shift @{$list_of_local_sets}; 398 shift @{$list_of_local_sets};
358 } 399 }
359 unshift @{$list_of_local_sets}, SELECT_SET_STRING; 400 unshift @{$list_of_local_sets}, SELECT_SET_STRING;
360 $set_selected = SELECT_SET_STRING; 401 $set_selected = SELECT_SET_STRING;
361 } 402 }
403 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;';
362 404
363 print CGI::Tr(CGI::td({-class=>"InfoPanel", -align=>"left"}, "Adding Problems to ", 405 print CGI::Tr(CGI::td({-class=>"InfoPanel", -align=>"left"}, "Add problems to ",
364 CGI::b("Target Set: "), 406 CGI::b("Target Set: "),
365 CGI::popup_menu(-name=> 'local_sets', 407 CGI::popup_menu(-name=> 'local_sets',
366 -values=>$list_of_local_sets, 408 -values=>$list_of_local_sets,
367 -default=> $set_selected), 409 -default=> $set_selected),
368 CGI::submit(-name=>"edit_local", -value=>"Edit Target Set"), 410 CGI::submit(-name=>"edit_local", -value=>"Edit Target Set"),
411 CGI::hidden(-name=>"selfassign", -default=>[0]).
369 CGI::br(), 412 CGI::br(),
370 CGI::br(), 413 CGI::br(),
371 CGI::submit(-name=>"new_local_set", -value=>"Create a New Set in This Course:", 414 CGI::submit(-name=>"new_local_set", -value=>"Create a New Set in This Course:",
372 #-onclick=>$myjs 415 -onclick=>$myjs
373 ), 416 ),
374 " ", 417 " ",
375 CGI::textfield(-name=>"new_set_name", 418 CGI::textfield(-name=>"new_set_name",
376 -default=>"Name for new set here", 419 -default=>"Name for new set here",
377 -override=>1, -size=>30), 420 -override=>1, -size=>30),
378 CGI::br(), 421 ));
379 ));
380 422
381 print CGI::Tr(CGI::td({-bgcolor=>"black"})); 423 print CGI::Tr(CGI::td({-bgcolor=>"black"}));
382 424
383 print CGI::Tr(CGI::td({-class=>"InfoPanel", -align=>"center"}, 425 print CGI::Tr(CGI::td({-class=>"InfoPanel", -align=>"center"},
384 CGI::start_table({-border=>"0"}), 426 "Browse ",
385 CGI::Tr( CGI::td({ -align=>"center"}, 427 CGI::submit(-name=>"browse_library", -value=>"Problem Library", -style=>$these_widths, $dis1),
428 CGI::submit(-name=>"browse_local", -value=>"Local Problems", -style=>$these_widths, $dis2),
429 CGI::submit(-name=>"browse_mysets", -value=>"From This Course", -style=>$these_widths, $dis3),
430 $libs,
431 ));
432
433 print CGI::Tr(CGI::td({-bgcolor=>"black"}));
434
435 if ($browse_which eq 'browse_local') {
436 $self->browse_local_panel($library_selected);
437 } elsif ($browse_which eq 'browse_mysets') {
438 $self->browse_mysets_panel($library_selected, $list_of_local_sets);
439 } elsif ($browse_which eq 'browse_library') {
440 $self->browse_library_panel();
441 } else { ## handle other problem libraries
442 $self->browse_local_panel($library_selected,$browse_which);
443 }
444
445 print CGI::Tr(CGI::td({-bgcolor=>"black"}));
446
447 print CGI::Tr(CGI::td({-class=>"InfoPanel", -align=>"center"},
448 CGI::start_table({-border=>"0"}),
449 CGI::Tr( CGI::td({ -align=>"center"},
386 CGI::submit(-name=>"select_all", -style=>$these_widths, 450 CGI::submit(-name=>"select_all", -style=>$these_widths,
387 -value=>"Mark All For Adding"), 451 -value=>"Mark All For Adding"),
388 CGI::submit(-name=>"select_none", -style=>$these_widths, 452 CGI::submit(-name=>"select_none", -style=>$these_widths,
389 -value=>"Clear All Marks"), 453 -value=>"Clear All Marks"),
390 )), 454 )),
391 CGI::Tr( CGI::td( 455 CGI::Tr(CGI::td(
392 CGI::submit(-name=>"update", -style=>$these_widths. "; font-weight:bold", 456 CGI::submit(-name=>"update", -style=>$these_widths. "; font-weight:bold",
393 -value=>"Update"), 457 -value=>"Update Set"),
394 CGI::submit(-name=>"rerandomize", 458 CGI::submit(-name=>"rerandomize",
395 -style=>$these_widths, 459 -style=>$these_widths,
396 -value=>"Rerandomize"), 460 -value=>"Rerandomize"),
397 CGI::submit(-name=>"cleardisplay", 461 CGI::submit(-name=>"cleardisplay",
398 -style=>$these_widths, 462 -style=>$these_widths,
399 -value=>"Clear Problem Display") 463 -value=>"Clear Problem Display")
400 )), 464 )),
401 CGI::end_table())); 465 CGI::end_table()));
402
403} 466}
404 467
405sub make_data_row { 468sub make_data_row {
406 my $self = shift; 469 my $self = shift;
407 my $sourceFileName = shift; 470 my $sourceFileName = shift;
408 my $pg = shift; 471 my $pg = shift;
409 my $cnt = shift; 472 my $cnt = shift;
410 my $mark = shift || 0; 473 my $mark = shift || 0;
411 474
412 $sourceFileName =~ s|^./||; # clean up top ugliness 475 $sourceFileName =~ s|^./||; # clean up top ugliness
413 476
414 my $urlpath = $self->r->urlpath; 477 my $urlpath = $self->r->urlpath;
415 my $problem_output = $pg->{flags}->{error_flag} ? 478 my $problem_output = $pg->{flags}->{error_flag} ?
416 CGI::div({class=>"ResultsWithError"}, CGI::em("This problem produced an error")) 479 CGI::div({class=>"ResultsWithError"}, CGI::em("This problem produced an error"))
417 : CGI::div({class=>"RenderSolo"}, $pg->{body_text}); 480 : CGI::div({class=>"RenderSolo"}, $pg->{body_text});
418 481
419 482
420 my $edit_link = ''; 483 my $edit_link = '';
421 #if($self->{r}->param('browse_which') ne 'browse_library') { 484 #if($self->{r}->param('browse_which') ne 'browse_library') {
485 my $problem_seed = $self->{r}->param('problem_seed') || 0;
422 if($sourceFileName !~ /^Library\//) { 486 if($sourceFileName !~ /^Library\//) {
487 $edit_link = CGI::a({href=>$self->systemLink(
423 $edit_link = CGI::a({href=>$self->systemLink($urlpath->newFromModule("WeBWorK::ContentGenerator::Instructor::PGProblemEditor", 488 $urlpath->newFromModule("WeBWorK::ContentGenerator::Instructor::PGProblemEditor",
424 courseID =>$urlpath->arg("courseID"), 489 courseID =>$urlpath->arg("courseID"),
425 setID=>"Undefined_Set", 490 setID=>"Undefined_Set",
426 problemID=>"1"), 491 problemID=>"1"),
427 params=>{sourceFilePath => "$sourceFileName"} 492 params=>{sourceFilePath => "$sourceFileName", problemSeed=> $problem_seed}
428 )}, "Edit it" ); 493 )}, "Edit it" );
429 } 494 }
430 495
431 my $try_link = CGI::a({href=>$self->systemLink($urlpath->newFromModule("WeBWorK::ContentGenerator::Problem", 496 my $try_link = CGI::a({href=>$self->systemLink(
497 $urlpath->newFromModule("WeBWorK::ContentGenerator::Problem",
432 courseID =>$urlpath->arg("courseID"), 498 courseID =>$urlpath->arg("courseID"),
433 setID=>"Undefined_Set", 499 setID=>"Undefined_Set",
434 problemID=>"1"), 500 problemID=>"1"),
501 params =>{
435 params =>{effectiveUser => $self->r->param('user'), 502 effectiveUser => scalar($self->r->param('user')),
436 editMode => "SetMaker", 503 editMode => "SetMaker",
504 problemSeed=> $problem_seed,
437 sourceFilePath => "$sourceFileName"} )}, "Try it"); 505 sourceFilePath => "$sourceFileName"
506 }
507 )}, "Try it");
438 508
439 my %add_box_data = ( -name=>"trial$cnt",-value=>1,-label=>"Add me to the current set on the next update"); 509 my %add_box_data = ( -name=>"trial$cnt",-value=>1,-label=>"Add this problem to the current set on the next update");
440 if($mark & SUCCESS) { 510 if($mark & SUCCESS) {
441 $add_box_data{ -label } .= " (just added this problem)"; 511 $add_box_data{ -label } .= " (just added this problem)";
442 } elsif($mark & ADDED) { 512 } elsif($mark & ADDED) {
443 $add_box_data{ -checked } = 1; 513 $add_box_data{ -checked } = 1;
444 } 514 }
445 515
446 print CGI::Tr({-align=>"left"}, CGI::td( 516 print CGI::Tr({-align=>"left"}, CGI::td(
447
448 CGI::div({-style=>"background-color: #DDDDDD; margin: 0px auto"}, 517 CGI::div({-style=>"background-color: #DDDDDD; margin: 0px auto"},
449CGI::span({-style=>"float:left ; text-align: left"},"File name: $sourceFileName "), 518 CGI::span({-style=>"float:left ; text-align: left"},"File name: $sourceFileName "),
450CGI::span({-style=>"float:right ; text-align: right"}, $edit_link, " ", $try_link) 519 CGI::span({-style=>"float:right ; text-align: right"}, $edit_link, " ", $try_link)
451 ), CGI::br(), 520 ), CGI::br(),
452
453
454
455
456 CGI::checkbox(-name=>"hideme$cnt",-value=>1,-label=>"Don't show me on the next update"), 521 CGI::checkbox(-name=>"hideme$cnt",-value=>1,-label=>"Don't show this problem on the next update"),
457 CGI::br(), 522 CGI::br(),
458 CGI::checkbox((%add_box_data)), 523 CGI::checkbox((%add_box_data)),
459 CGI::hidden(-name=>"filetrial$cnt", -default=>[$sourceFileName]). 524 CGI::hidden(-name=>"filetrial$cnt", -default=>[$sourceFileName]).
460 CGI::p($problem_output), 525 CGI::p($problem_output),
461 )); 526 ));
462} 527}
463 528
464 529
465sub pre_header_initialize { 530sub pre_header_initialize {
466 my ($self) = @_; 531 my ($self) = @_;
467 my $r = $self->r; 532 my $r = $self->r;
468 ## For all cases, lets set some things 533 ## For all cases, lets set some things
469 $self->{error}=0; 534 $self->{error}=0;
470 my $ce = $r->ce; 535 my $ce = $r->ce;
471 my $db = $r->db; 536 my $db = $r->db;
472 my $maxShown = $r->param('max_shown') || MAX_SHOW_DEFAULT; 537 my $maxShown = $r->param('max_shown') || MAX_SHOW_DEFAULT;
473 $maxShown = 10000000 if($maxShown eq 'All'); # let's hope there aren't more 538 $maxShown = 10000000 if($maxShown eq 'All'); # let's hope there aren't more
474 539
540 ## These directories will have individual buttons
541 %problib = %{$ce->{courseFiles}{problibs}} if $ce->{courseFiles}{problibs};
475 542
476 my $userName = $r->param('user'); 543 my $userName = $r->param('user');
477 my $user = $db->getUser($userName); # checked 544 my $user = $db->getUser($userName); # checked
478 die "record for user $userName (real user) does not exist." 545 die "record for user $userName (real user) does not exist."
479 unless defined $user; 546 unless defined $user;
480 my $authz = $r->authz; 547 my $authz = $r->authz;
481 unless ($authz->hasPermissions($userName, "modify_problem_sets")) { 548 unless ($authz->hasPermissions($userName, "modify_problem_sets")) {
482 return(""); # Error message already produced in the body 549 return(""); # Error message already produced in the body
483 } 550 }
484 551
485 ## Now one action we have to deal with here 552 ## Now one action we have to deal with here
486 if ($r->param('edit_local')) { 553 if ($r->param('edit_local')) {
487 my $urlpath = $r->urlpath; 554 my $urlpath = $r->urlpath;
488 my $db = $r->db; 555 my $db = $r->db;
489 my $checkset = $db->getGlobalSet($r->param('local_sets')); 556 my $checkset = $db->getGlobalSet($r->param('local_sets'));
490 if (not defined($checkset)) { 557 if (not defined($checkset)) {
491 $self->{error} = 1; 558 $self->{error} = 1;
492 $self->addbadmessage('You need to select a "Target Set" before you can edit it.'); 559 $self->addbadmessage('You need to select a "Target Set" before you can edit it.');
493 } else { 560 } else {
494 my $page = $urlpath->newFromModule('WeBWorK::ContentGenerator::Instructor::ProblemSetEditor', setID=>$r->param('local_sets'), courseID=>$urlpath->arg("courseID")); 561 my $page = $urlpath->newFromModule('WeBWorK::ContentGenerator::Instructor::ProblemSetDetail', setID=>$r->param('local_sets'), courseID=>$urlpath->arg("courseID"));
495 my $url = $self->systemLink($page); 562 my $url = $self->systemLink($page);
496 $self->reply_with_redirect($url); 563 $self->reply_with_redirect($url);
497 } 564 }
498 } 565 }
499 566
500 ## Next, lots of set up so that errors can be reported with message() 567 ## Next, lots of set up so that errors can be reported with message()
501 568
502 ############# List of problems we have already printed 569 ############# List of problems we have already printed
503 570
504 $self->{past_problems} = get_past_problem_files($r); 571 $self->{past_problems} = get_past_problem_files($r);
505 # if we don't end up reusing problems, this will be wiped out 572 # if we don't end up reusing problems, this will be wiped out
506 # if we do redisplay the same problems, we must adjust this accordingly 573 # if we do redisplay the same problems, we must adjust this accordingly
507 my @past_marks = map {$_->[1]} @{$self->{past_problems}}; 574 my @past_marks = map {$_->[1]} @{$self->{past_problems}};
508 my $none_shown = scalar(@{$self->{past_problems}})==0; 575 my $none_shown = scalar(@{$self->{past_problems}})==0;
509 my @pg_files=(); 576 my @pg_files=();
510 my $use_previous_problems = 1; 577 my $use_previous_problems = 1;
511 my $first_shown = $r->param('first_shown') || 0; 578 my $first_shown = $r->param('first_shown') || 0;
512 my $last_shown = $r->param('last_shown'); 579 my $last_shown = $r->param('last_shown');
513 if (not defined($last_shown)) { 580 if (not defined($last_shown)) {
514 $last_shown = -1; 581 $last_shown = -1;
515 } 582 }
516 my @all_past_list = (); # these are include requested, but not shown 583 my @all_past_list = (); # these are include requested, but not shown
517 my $j = 0; 584 my $j = 0;
518 while (defined($r->param("all_past_list$j"))) { 585 while (defined($r->param("all_past_list$j"))) {
519 push @all_past_list, $r->param("all_past_list$j"); 586 push @all_past_list, $r->param("all_past_list$j");
520 $j++; 587 $j++;
521 } 588 }
522 589
523 ############# Default of which problem selector to display 590 ############# Default of which problem selector to display
524 591
525 my $browse_which = $r->param('browse_which') || 'browse_local'; 592 my $browse_which = $r->param('browse_which') || 'browse_local';
526 593
527 my $problem_seed = $r->param('problem_seed') || 0; 594 my $problem_seed = $r->param('problem_seed') || 0;
528 $r->param('problem_seed', $problem_seed); # if it wasn't defined before 595 $r->param('problem_seed', $problem_seed); # if it wasn't defined before
529 596
597 ## check for problem lib buttons
598 my $browse_lib = '';
599 foreach my $lib (keys %problib) {
600 if ($r->param("browse_$lib")) {
601 $browse_lib = "browse_$lib";
602 last;
603 }
604 }
605
530 ########### Start the logic through if elsif elsif ... 606 ########### Start the logic through if elsif elsif ...
531 607
532 ##### Asked to browse certain problems 608 ##### Asked to browse certain problems
609 if ($browse_lib ne '') {
610 $browse_which = $browse_lib;
611 $r->param('library_sets', "");
612 $use_previous_problems = 0; @pg_files = (); ## clear old problems
533 if ($r->param('browse_library')) { 613 } elsif ($r->param('browse_library')) {
534 $browse_which = 'browse_library'; 614 $browse_which = 'browse_library';
535 $r->param('library_sets', ""); 615 $r->param('library_sets', "");
616 $use_previous_problems = 0; @pg_files = (); ## clear old problems
536 } elsif ($r->param('browse_local')) { 617 } elsif ($r->param('browse_local')) {
537 $browse_which = 'browse_local'; 618 $browse_which = 'browse_local';
538 $r->param('library_sets', ""); 619 $r->param('library_sets', "");
620 $use_previous_problems = 0; @pg_files = (); ## clear old problems
539 } elsif ($r->param('browse_mysets')) { 621 } elsif ($r->param('browse_mysets')) {
540 $browse_which = 'browse_mysets'; 622 $browse_which = 'browse_mysets';
541 $r->param('library_sets', ""); 623 $r->param('library_sets', "");
624 $use_previous_problems = 0; @pg_files = (); ## clear old problems
542 625
543 ##### Change the seed value 626 ##### Change the seed value
544 627
545 } elsif ($r->param('rerandomize')) { 628 } elsif ($r->param('rerandomize')) {
546 $problem_seed++; 629 $problem_seed++;
547 $r->param('problem_seed', $problem_seed); 630 $r->param('problem_seed', $problem_seed);
548 $self->addbadmessage('Changing the problem seed for display, but there are no problems showing.') if $none_shown; 631 $self->addbadmessage('Changing the problem seed for display, but there are no problems showing.') if $none_shown;
549 632
550 ##### Clear the display 633 ##### Clear the display
551 634
552 } elsif ($r->param('cleardisplay')) { 635 } elsif ($r->param('cleardisplay')) {
553 @pg_files = (); 636 @pg_files = ();
554 $use_previous_problems=0; 637 $use_previous_problems=0;
555 $self->addbadmessage('The display was already cleared.') if $none_shown; 638 $self->addbadmessage('The display was already cleared.') if $none_shown;
556 639
557 ##### View problems selected from the local list 640 ##### View problems selected from the local list
558 641
559 } elsif ($r->param('view_local_set')) { 642 } elsif ($r->param('view_local_set')) {
560 643
561 my $set_to_display = $r->param('library_sets'); 644 my $set_to_display = $r->param('library_sets');
562 if (not defined($set_to_display) or $set_to_display eq SELECT_LOCAL_STRING or $set_to_display eq "Found no directories containing problems") { 645 if (not defined($set_to_display) or $set_to_display eq SELECT_LOCAL_STRING or $set_to_display eq "Found no directories containing problems") {
563 $self->addbadmessage('You need to select a set to view.'); 646 $self->addbadmessage('You need to select a set to view.');
564 } else { 647 } else {
565 $set_to_display = '.' if $set_to_display eq ' My Problems '; 648 $set_to_display = '.' if $set_to_display eq MY_PROBLEMS;
649 $set_to_display = substr($browse_which,7) if $set_to_display eq MAIN_PROBLEMS;
566 @pg_files = list_pg_files($ce->{courseDirs}->{templates}, 650 @pg_files = list_pg_files($ce->{courseDirs}->{templates},
567 "$set_to_display"); 651 "$set_to_display");
568 $use_previous_problems=0; 652 $use_previous_problems=0;
569 } 653 }
570 654
571 ##### View problems selected from the a set in this course 655 ##### View problems selected from the a set in this course
572 656
573 } elsif ($r->param('view_mysets_set')) { 657 } elsif ($r->param('view_mysets_set')) {
574 658
575 my $set_to_display = $r->param('library_sets'); 659 my $set_to_display = $r->param('library_sets');
576 if (not defined($set_to_display) 660 if (not defined($set_to_display)
577 or $set_to_display eq "Select a Problem Set" 661 or $set_to_display eq "Select a Homework Set"
578 or $set_to_display eq NO_LOCAL_SET_STRING) { 662 or $set_to_display eq NO_LOCAL_SET_STRING) {
579 $self->addbadmessage("You need to select a set from this course to view."); 663 $self->addbadmessage("You need to select a set from this course to view.");
580 } else { 664 } else {
581 my @problemList = $db->listGlobalProblems($set_to_display); 665 my @problemList = $db->listGlobalProblems($set_to_display);
582 my $problem; 666 my $problem;
583 @pg_files=(); 667 @pg_files=();
584 for $problem (@problemList) { 668 for $problem (@problemList) {
585 my $problemRecord = $db->getGlobalProblem($set_to_display, $problem); # checked 669 my $problemRecord = $db->getGlobalProblem($set_to_display, $problem); # checked
586 die "global $problem for set $set_to_display not found." unless 670 die "global $problem for set $set_to_display not found." unless
587 $problemRecord; 671 $problemRecord;
588 push @pg_files, $problemRecord->source_file; 672 push @pg_files, $problemRecord->source_file;
589 673
590 } 674 }
591 $use_previous_problems=0; 675 $use_previous_problems=0;
592 } 676 }
593 677
594 ##### View whole chapter from the library 678 ##### View whole chapter from the library
595 ## This will change somewhat later 679 ## This will change somewhat later
596 680
597 } elsif ($r->param('lib_view')) { 681 } elsif ($r->param('lib_view')) {
598 682
599 @pg_files=(); 683 @pg_files=();
600 my $chap = $r->param('library_chapters') || ""; 684 my $chap = $r->param('library_chapters') || "";
601 $chap = "" if($chap eq "All Chapters"); 685 $chap = "" if($chap eq "All Chapters");
602 my $sect = $r->param('library_sections') || ""; 686 my $sect = $r->param('library_sections') || "";
603 $sect = "" if($sect eq "All Sections"); 687 $sect = "" if($sect eq "All Sections");
604 my @dbsearch = WeBWorK::Utils::ListingDB::getSectionListings($r->{ce}, "$chap", "$sect"); 688 my @dbsearch = WeBWorK::Utils::ListingDB::getSectionListings($r->{ce}, "$chap", "$sect");
605 my ($result, $tolibpath); 689 my ($result, $tolibpath);
606 for $result (@dbsearch) { 690 for $result (@dbsearch) {
607 $tolibpath = "Library/$result->{path}/$result->{filename}"; 691 $tolibpath = "Library/$result->{path}/$result->{filename}";
608 692
609 ## Too clunky!!!! 693 ## Too clunky!!!!
610 push @pg_files, $tolibpath; 694 push @pg_files, $tolibpath;
611 } 695 }
612 $use_previous_problems=0; 696 $use_previous_problems=0;
613 697
614 ##### Edit the current local problem set 698 ##### Edit the current local problem set
615 699
616 } elsif ($r->param('edit_local')) { ## Jump to set edit page 700 } elsif ($r->param('edit_local')) { ## Jump to set edit page
617 701
618 ; # already handled 702 ; # already handled
619 703
620 704
621 ##### Make a new local problem set 705 ##### Make a new local problem set
622 706
623 } elsif ($r->param('new_local_set')) { 707 } elsif ($r->param('new_local_set')) {
624 if ($r->param('new_set_name') !~ /^[\w.-]*$/) { 708 if ($r->param('new_set_name') !~ /^[\w.-]*$/) {
625 $self->addbadmessage("The name ".$r->param('new_set_name')." is not a valid set name. Use only letters, digits, -, _, and ."); 709 $self->addbadmessage("The name ".$r->param('new_set_name')." is not a valid set name. Use only letters, digits, -, _, and .");
626 } else { 710 } else {
627 my $newSetName = $r->param('new_set_name'); 711 my $newSetName = $r->param('new_set_name');
628 $newSetName =~ s/^set//; 712 # if we want to munge the input set name, do it here
629 $newSetName =~ s/\.def$//;
630 $r->param('local_sets',$newSetName); 713 $r->param('local_sets',$newSetName);
631 my $newSetRecord = $db->getGlobalSet($newSetName); 714 my $newSetRecord = $db->getGlobalSet($newSetName);
632 if (defined($newSetRecord)) { 715 if (defined($newSetRecord)) {
633 $self->addbadmessage("The set name $newSetName is already in use. Pick a different name if you would like to start a new set."); 716 $self->addbadmessage("The set name $newSetName is already in use. Pick a different name if you would like to start a new set.");
634 } else { # Do it! 717 } else { # Do it!
635 $newSetRecord = $db->{set}->{record}->new(); 718 $newSetRecord = $db->{set}->{record}->new();
636 $newSetRecord->set_id($newSetName); 719 $newSetRecord->set_id($newSetName);
637 $newSetRecord->set_header(""); 720 $newSetRecord->set_header("");
638 $newSetRecord->problem_header(""); 721 $newSetRecord->hardcopy_header("");
639 $newSetRecord->open_date(time()+60*60*24*7); # in one week 722 $newSetRecord->open_date(time()+60*60*24*7); # in one week
640 $newSetRecord->due_date(time()+60*60*24*7*2); # in two weeks 723 $newSetRecord->due_date(time()+60*60*24*7*2); # in two weeks
641 $newSetRecord->answer_date(time()+60*60*24*7*3); # in three weeks 724 $newSetRecord->answer_date(time()+60*60*24*7*3); # in three weeks
642 eval {$db->addGlobalSet($newSetRecord)}; 725 eval {$db->addGlobalSet($newSetRecord)};
643 } 726 $self->addgoodmessage("Set $newSetName has been created.");
644 } 727 my $selfassign = $r->param('selfassign') || "";
728 $selfassign = "" if($selfassign =~ /false/i); # deal with javascript false
729 if($selfassign) {
730 $self->assignSetToUser($userName, $newSetRecord);
731 $self->addgoodmessage("Set $newSetName was assigned to $userName.");
732 }
733 }
734 }
645 735
646 ##### Add selected problems to the current local set 736 ##### Add selected problems to the current local set
647 737
648 } elsif ($r->param('update')) { 738 } elsif ($r->param('update')) {
649 ## first handle problems to be added before we hide them 739 ## first handle problems to be added before we hide them
650 my($localSet, @selected); 740 my($localSet, @selected);
651 741
652 @pg_files = grep {($_->[1] & ADDED) != 0 } @{$self->{past_problems}}; 742 @pg_files = grep {($_->[1] & ADDED) != 0 } @{$self->{past_problems}};
653 @selected = map {$_->[0]} @pg_files; 743 @selected = map {$_->[0]} @pg_files;
654 744
655 my @action_files = grep {$_->[1] > 0 } @{$self->{past_problems}}; 745 my @action_files = grep {$_->[1] > 0 } @{$self->{past_problems}};
656 # There are now good reasons to do an update without selecting anything. 746 # There are now good reasons to do an update without selecting anything.
657 #if(scalar(@action_files) == 0) { 747 #if(scalar(@action_files) == 0) {
658 # $self->addbadmessage('Update requested, but no problems were marked.'); 748 # $self->addbadmessage('Update requested, but no problems were marked.');
659 #} 749 #}
660 750
661 if (scalar(@selected)>0) { # if some are to be added, they need a place to go 751 if (scalar(@selected)>0) { # if some are to be added, they need a place to go
662 $localSet = $r->param('local_sets'); 752 $localSet = $r->param('local_sets');
663 if (not defined($localSet) or 753 if (not defined($localSet) or
664 $localSet eq SELECT_SET_STRING or 754 $localSet eq SELECT_SET_STRING or
665 $localSet eq NO_LOCAL_SET_STRING) { 755 $localSet eq NO_LOCAL_SET_STRING) {
666 $self->addbadmessage('You are trying to add problems to something, but you did not select a "Target Set" name as a target.'); 756 $self->addbadmessage('You are trying to add problems to something, but you did not select a "Target Set" name as a target.');
667 } else { 757 } else {
668 my $newSetRecord = $db->getGlobalSet($localSet); 758 my $newSetRecord = $db->getGlobalSet($localSet);
669 if (not defined($newSetRecord)) { 759 if (not defined($newSetRecord)) {
670 $self->addbadmessage("You are trying to add problems to $localSet, but that set does not seem to exist! I bet you used your \"Back\" button."); 760 $self->addbadmessage("You are trying to add problems to $localSet, but that set does not seem to exist! I bet you used your \"Back\" button.");
671 } else { 761 } else {
672 my $addcount = add_selected($self, $db, $localSet); 762 my $addcount = add_selected($self, $db, $localSet);
673 if($addcount > 0) { 763 if($addcount > 0) {
674 $self->addgoodmessage("Added $addcount problem".(($addcount>1)?'s':''). 764 $self->addgoodmessage("Added $addcount problem".(($addcount>1)?'s':'').
675 " to $localSet."); 765 " to $localSet.");
676 }
677 } 766 }
678 } 767 }
679 } 768 }
769 }
680 ## now handle problems to be hidden 770 ## now handle problems to be hidden
681 771
682 ## only keep the ones which are not hidden 772 ## only keep the ones which are not hidden
683 @pg_files = grep {($_->[1] & HIDDEN) ==0 } @{$self->{past_problems}}; 773 @pg_files = grep {($_->[1] & HIDDEN) ==0 } @{$self->{past_problems}};
684 @past_marks = map {$_->[1]} @pg_files; 774 @past_marks = map {$_->[1]} @pg_files;
685 @pg_files = map {$_->[0]} @pg_files; 775 @pg_files = map {$_->[0]} @pg_files;
686 @all_past_list = (@all_past_list[0..($first_shown-1)], 776 @all_past_list = (@all_past_list[0..($first_shown-1)],
687 @pg_files, 777 @pg_files,
688 @all_past_list[($last_shown+1)..(scalar(@all_past_list)-1)]); 778 @all_past_list[($last_shown+1)..(scalar(@all_past_list)-1)]);
689 $last_shown = $first_shown+$maxShown -1; 779 $last_shown = $first_shown+$maxShown -1;
690 $last_shown = (scalar(@all_past_list)-1) if($last_shown>=scalar(@all_past_list)); 780 $last_shown = (scalar(@all_past_list)-1) if($last_shown>=scalar(@all_past_list));
691 781
692 } elsif ($r->param('next_page')) { 782 } elsif ($r->param('next_page')) {
693 $first_shown = $last_shown+1; 783 $first_shown = $last_shown+1;
694 $last_shown = $first_shown+$maxShown-1; 784 $last_shown = $first_shown+$maxShown-1;
695 $last_shown = (scalar(@all_past_list)-1) if($last_shown>=scalar(@all_past_list)); 785 $last_shown = (scalar(@all_past_list)-1) if($last_shown>=scalar(@all_past_list));
696 @past_marks = (); 786 @past_marks = ();
697 } elsif ($r->param('prev_page')) { 787 } elsif ($r->param('prev_page')) {
698 $last_shown = $first_shown-1; 788 $last_shown = $first_shown-1;
699 $first_shown = $last_shown - $maxShown+1; 789 $first_shown = $last_shown - $maxShown+1;
700 790
701 $first_shown = 0 if($first_shown<0); 791 $first_shown = 0 if($first_shown<0);
702 @past_marks = (); 792 @past_marks = ();
703 793
704 } elsif ($r->param('select_all')) { 794 } elsif ($r->param('select_all')) {
705 @past_marks = map {1} @past_marks; 795 @past_marks = map {1} @past_marks;
706 } elsif ($r->param('select_none')) { 796 } elsif ($r->param('select_none')) {
707 @past_marks = (); 797 @past_marks = ();
708 798
709 ##### No action requested, probably our first time here 799 ##### No action requested, probably our first time here
710 800
711 } else { 801 } else {
712 #my $c = $r->connection; 802 #my $c = $r->connection;
713 #print "Debug info: ". $r->get_remote_host ."<p>". $c->remote_ip ; 803 #print "Debug info: ". $r->get_remote_host ."<p>". $c->remote_ip ;
714 ; 804 ;
715 } ##### end of the if elsif ... 805 } ##### end of the if elsif ...
716 806
717 807
718 ############# List of local sets 808 ############# List of local sets
719 809
720 my @all_set_defs = $db->listGlobalSets; 810 my @all_set_defs = $db->listGlobalSets;
721 for ($j=0; $j<scalar(@all_set_defs); $j++) { 811 @all_set_defs = sortByName(undef, @all_set_defs);
722 $all_set_defs[$j] =~ s|^set||;
723 $all_set_defs[$j] =~ s|\.def||;
724 }
725 812
726 if ($use_previous_problems) { 813 if ($use_previous_problems) {
727 @pg_files = @all_past_list; 814 @pg_files = @all_past_list;
728 } else { 815 } else {
729 $first_shown = 0; 816 $first_shown = 0;
730 $last_shown = scalar(@pg_files)<$maxShown ? scalar(@pg_files) : $maxShown; 817 $last_shown = scalar(@pg_files)<$maxShown ? scalar(@pg_files) : $maxShown;
731 $last_shown--; # to make it an array index 818 $last_shown--; # to make it an array index
732 @past_marks = (); 819 @past_marks = ();
733 } 820 }
734 ############# Now store data in self for retreival by body 821 ############# Now store data in self for retreival by body
735 $self->{first_shown} = $first_shown; 822 $self->{first_shown} = $first_shown;
736 $self->{last_shown} = $last_shown; 823 $self->{last_shown} = $last_shown;
737 $self->{browse_which} = $browse_which; 824 $self->{browse_which} = $browse_which;
738 $self->{problem_seed} = $problem_seed; 825 $self->{problem_seed} = $problem_seed;
739 $self->{pg_files} = \@pg_files; 826 $self->{pg_files} = \@pg_files;
740 $self->{past_marks} = \@past_marks; 827 $self->{past_marks} = \@past_marks;
741 $self->{all_set_defs} = \@all_set_defs; 828 $self->{all_set_defs} = \@all_set_defs;
742 829
743} 830}
744 831
745 832
746sub title { 833sub title {
747 return "Problem Set Maker"; 834 return "Library Browser";
748} 835}
749 836
750sub body { 837sub body {
751 my ($self) = @_; 838 my ($self) = @_;
752 839
753 my $r = $self->r; 840 my $r = $self->r;
754 my $ce = $r->ce; # course environment 841 my $ce = $r->ce; # course environment
755 my $db = $r->db; # database 842 my $db = $r->db; # database
756 my $j; # garden variety counter 843 my $j; # garden variety counter
757 844
758 my $userName = $r->param('user'); 845 my $userName = $r->param('user');
759 846
760 my $user = $db->getUser($userName); # checked 847 my $user = $db->getUser($userName); # checked
761 die "record for user $userName (real user) does not exist." 848 die "record for user $userName (real user) does not exist."
762 unless defined $user; 849 unless defined $user;
763 850
764 ### Check that this is a professor 851 ### Check that this is a professor
765 my $authz = $r->authz; 852 my $authz = $r->authz;
766 unless ($authz->hasPermissions($userName, "modify_problem_sets")) { 853 unless ($authz->hasPermissions($userName, "modify_problem_sets")) {
767 print "User $userName returned " . 854 print "User $userName returned " .
768 $authz->hasPermissions($user, "modify_problem_sets") . 855 $authz->hasPermissions($user, "modify_problem_sets") .
769 " for permission"; 856 " for permission";
770 return(CGI::div({class=>'ResultsWithError'}, 857 return(CGI::div({class=>'ResultsWithError'},
771 CGI::em("You are not authorized to access the Instructor tools."))); 858 CGI::em("You are not authorized to access the Instructor tools.")));
772 } 859 }
773 860
774 ########## Extract information computed in pre_header_initialize 861 ########## Extract information computed in pre_header_initialize
775 862
776 my $first_shown = $self->{first_shown}; 863 my $first_shown = $self->{first_shown};
777 my $last_shown = $self->{last_shown}; 864 my $last_shown = $self->{last_shown};
778 my $browse_which = $self->{browse_which}; 865 my $browse_which = $self->{browse_which};
779 my $problem_seed = $self->{problem_seed}; 866 my $problem_seed = $self->{problem_seed};
780 my @pg_files = @{$self->{pg_files}}; 867 my @pg_files = @{$self->{pg_files}};
781 my @all_set_defs = @{$self->{all_set_defs}}; 868 my @all_set_defs = @{$self->{all_set_defs}};
782 869
783 my @pg_html=($last_shown>=$first_shown) ? 870 my @pg_html=($last_shown>=$first_shown) ?
784 renderProblems(r=> $r, 871 renderProblems(r=> $r,
785 user => $user, 872 user => $user,
786 problem_list => [@pg_files[$first_shown..$last_shown]], 873 problem_list => [@pg_files[$first_shown..$last_shown]],
787 displayMode => $r->param('mydisplayMode')) : (); 874 displayMode => $r->param('mydisplayMode')) : ();
788 875
789 ########## Top part 876 ########## Top part
790 print CGI::startform({-method=>"POST", -action=>$r->uri}), 877 print CGI::startform({-method=>"POST", -action=>$r->uri, -name=>'mainform'}),
791 $self->hidden_authen_fields, 878 $self->hidden_authen_fields,
792 '<div align="center">', 879 '<div align="center">',
793 CGI::start_table({-border=>2}); 880 CGI::start_table({-border=>2});
794 $self->make_top_row('all_set_defs'=>\@all_set_defs, 881 $self->make_top_row('all_set_defs'=>\@all_set_defs,
795 'browse_which'=> $browse_which); 882 'browse_which'=> $browse_which);
796 print CGI::hidden(-name=>'browse_which', -default=>[$browse_which]), 883 print CGI::hidden(-name=>'browse_which', -default=>[$browse_which]),
797 CGI::hidden(-name=>'problem_seed', -default=>[$problem_seed]); 884 CGI::hidden(-name=>'problem_seed', -default=>[$problem_seed]);
798 for ($j = 0 ; $j < scalar(@pg_files) ; $j++) { 885 for ($j = 0 ; $j < scalar(@pg_files) ; $j++) {
799 print CGI::hidden(-name=>"all_past_list$j", -default=>$pg_files[$j]); 886 print CGI::hidden(-name=>"all_past_list$j", -default=>$pg_files[$j]);
800 } 887 }
801 888
802 print CGI::hidden(-name=>'first_shown', -default=>[$first_shown]); 889 print CGI::hidden(-name=>'first_shown', -default=>[$first_shown]);
803 print CGI::hidden(-name=>'last_shown', -default=>[$last_shown]); 890 print CGI::hidden(-name=>'last_shown', -default=>[$last_shown]);
804 891
805 892
806 ########## Now print problems 893 ########## Now print problems
807 my $jj; 894 my $jj;
808 for ($jj=0; $jj<scalar(@pg_html); $jj++) { 895 for ($jj=0; $jj<scalar(@pg_html); $jj++) {
809 $pg_files[$jj] =~ s|^$ce->{courseDirs}->{templates}/?||; 896 $pg_files[$jj] =~ s|^$ce->{courseDirs}->{templates}/?||;
810 $self->make_data_row($pg_files[$jj+$first_shown], $pg_html[$jj], $jj+1, $self->{past_marks}->[$jj]); 897 $self->make_data_row($pg_files[$jj+$first_shown], $pg_html[$jj], $jj+1, $self->{past_marks}->[$jj]);
811 } 898 }
812 899
813 ########## Finish things off 900 ########## Finish things off
814 print CGI::end_table(); 901 print CGI::end_table();
815 print '</div>'; 902 print '</div>';
816 # if($first_shown>0 or (1+$last_shown)<scalar(@pg_files)) { 903 # if($first_shown>0 or (1+$last_shown)<scalar(@pg_files)) {
817 my ($next_button, $prev_button) = ("", ""); 904 my ($next_button, $prev_button) = ("", "");
818 if ($first_shown > 0) { 905 if ($first_shown > 0) {
819 $prev_button = CGI::submit(-name=>"prev_page", -style=>"width:15ex", 906 $prev_button = CGI::submit(-name=>"prev_page", -style=>"width:15ex",
820 -value=>"Previous page"); 907 -value=>"Previous page");
821 } 908 }
822 if ((1+$last_shown)<scalar(@pg_files)) { 909 if ((1+$last_shown)<scalar(@pg_files)) {
823 $next_button = CGI::submit(-name=>"next_page", -style=>"width:15ex", 910 $next_button = CGI::submit(-name=>"next_page", -style=>"width:15ex",
824 -value=>"Next page"); 911 -value=>"Next page");
825 } 912 }
826 if (scalar(@pg_files)>0) { 913 if (scalar(@pg_files)>0) {
827 print CGI::p(($first_shown+1)."-".($last_shown+1)." of ".scalar(@pg_files). 914 print CGI::p(($first_shown+1)."-".($last_shown+1)." of ".scalar(@pg_files).
828 " shown.", $prev_button, " ", $next_button); 915 " shown.", $prev_button, " ", $next_button);
829 } 916 }
830 # } 917 # }
831 print CGI::endform(), "\n"; 918 print CGI::endform(), "\n";
832 919
833 return ""; 920 return "";
834} 921}
835 922
836############################################## End of Body 923############################################## End of Body
837 924
838# SKEL: To emit your own HTTP header, uncomment this: 925# SKEL: To emit your own HTTP header, uncomment this:
839# 926#
840#sub header { 927#sub header {
841# my ($self) = @_; 928# my ($self) = @_;
842# 929#
843# # Generate your HTTP header here. 930# # Generate your HTTP header here.
844# 931#
845# # If you return something, it will be used as the HTTP status code for this 932# # If you return something, it will be used as the HTTP status code for this
846# # request. The Apache::Constants module might be useful for gerating status 933# # request. The Apache::Constants module might be useful for gerating status
847# # codes. If you don't return anything, the status code "OK" will be used. 934# # codes. If you don't return anything, the status code "OK" will be used.
848# return ""; 935# return "";
849#} 936#}
850 937
851# SKEL: If you need to do any processing after the HTTP header is sent, but before 938# SKEL: If you need to do any processing after the HTTP header is sent, but before
852# any template processing occurs, or you need to calculate values that will be 939# any template processing occurs, or you need to calculate values that will be
853# used in multiple methods, do it in this method: 940# used in multiple methods, do it in this method:
857#} 944#}
858 945
859# SKEL: If you need to add tags to the document <HEAD>, uncomment this method: 946# SKEL: If you need to add tags to the document <HEAD>, uncomment this method:
860# 947#
861#sub head { 948#sub head {
862# my ($self) = @_; 949# my ($self) = @_;
863# 950#
864# # You can print head tags here, like <META>, <SCRIPT>, etc. 951# # You can print head tags here, like <META>, <SCRIPT>, etc.
865# 952#
866# return ""; 953# return "";
867#} 954#}
868 955
869# SKEL: To fill in the "info" box (to the right of the main body), use this 956# SKEL: To fill in the "info" box (to the right of the main body), use this
870# method: 957# method:
871# 958#
872#sub info { 959#sub info {
873# my ($self) = @_; 960# my ($self) = @_;
874# 961#
875# # Print HTML here. 962# # Print HTML here.
876# 963#
877# return ""; 964# return "";
878#} 965#}
879 966
880# SKEL: To provide navigation links, use this method: 967# SKEL: To provide navigation links, use this method:
881# 968#
882#sub nav { 969#sub nav {
883# my ($self, $args) = @_; 970# my ($self, $args) = @_;
884# 971#
885# # See the documentation of path() and pathMacro() in 972# # See the documentation of path() and pathMacro() in
886# # WeBWorK::ContentGenerator for more information. 973# # WeBWorK::ContentGenerator for more information.
887# 974#
888# return ""; 975# return "";
889#} 976#}
890 977
891# SKEL: For a little box for display options, etc., use this method: 978# SKEL: For a little box for display options, etc., use this method:
892# 979#
893#sub options { 980#sub options {
894# my ($self) = @_; 981# my ($self) = @_;
895# 982#
896# # Print HTML here. 983# # Print HTML here.
897# 984#
898# return ""; 985# return "";
899#} 986#}
900 987
901# SKEL: For a list of sibling objects, use this method: 988# SKEL: For a list of sibling objects, use this method:
902# 989#
903#sub siblings { 990#sub siblings {
904# my ($self, $args) = @_; 991# my ($self, $args) = @_;
905# 992#
906# # See the documentation of siblings() and siblingsMacro() in 993# # See the documentation of siblings() and siblingsMacro() in
907# # WeBWorK::ContentGenerator for more information. 994# # WeBWorK::ContentGenerator for more information.
908# # 995# #
909# # Refer to implementations in ProblemSet and Problem. 996# # Refer to implementations in ProblemSet and Problem.
910# 997#
911# return ""; 998# return "";
912#} 999#}
913 1000
914=head1 AUTHOR 1001=head1 AUTHOR
915 1002
916Written by John Jones, jj (at) asu.edu. 1003Written by John Jones, jj (at) asu.edu.

Legend:
Removed from v.2264  
changed lines
  Added in v.3397

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9