[system] / trunk / webwork2 / lib / WeBWorK / ContentGenerator / Instructor / ProblemSetEditor.pm Repository:
ViewVC logotype

Diff of /trunk/webwork2/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetEditor.pm

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

Revision 887 Revision 888
49 49
50 ######################################################################### 50 #########################################################################
51 # Determine a name for this set 51 # Determine a name for this set
52 ######################################################################### 52 #########################################################################
53 # Determine the set number, if there is one. Otherwise make setName = "new set". 53 # Determine the set number, if there is one. Otherwise make setName = "new set".
54 # fix me 54 # FIXME:
55# my ($path_info,@components) = $self->gatherInfo(); 55# my ($path_info,@components) = $self->gatherInfo();
56# my $setName = $components[0]; # get GET address for set name 56# my $setName = $components[0]; # get GET address for set name
57 57
58 # Override the setName if it is defined in a form. 58 # Override the setName if it is defined in a form.
59# $setName = $r->param('setName') if defined($r->param('setName')); 59# $setName = $r->param('setName') if defined($r->param('setName'));
64 ######################################################################### 64 #########################################################################
65# $libraryName = $self->{ce}->{courseDirs}->{templates}; 65# $libraryName = $self->{ce}->{courseDirs}->{templates};
66# my $setDirectory = $r->param('setDirectory'); 66# my $setDirectory = $r->param('setDirectory');
67# my $oldSetDirectory = $r->param('oldSetDirectory'); 67# my $oldSetDirectory = $r->param('oldSetDirectory');
68 68
69 #fix me 69 #FIXME:
70 # A user can select a new set AND a problem (in the old set) but the problem won't be in the new set! 70 # A user can select a new set AND a problem (in the old set) but the problem won't be in the new set!
71 # In other words we must prevent the user from changing the problem and the set simultaneously. 71 # In other words we must prevent the user from changing the problem and the set simultaneously.
72 # We solve this by defining a hidden variable oldSetDirectory which matches the currently displayed problem list 72 # We solve this by defining a hidden variable oldSetDirectory which matches the currently displayed problem list
73 # the problem entry for the textarea element and the viewProblem url are 73 # the problem entry for the textarea element and the viewProblem url are
74 # formed using this old version of setDefinition 74 # formed using this old version of setDefinition
79 ######################################################################### 79 #########################################################################
80 #text area region, adding problems to the list 80 #text area region, adding problems to the list
81 ######################################################################### 81 #########################################################################
82 82
83 my $textAreaString; 83 my $textAreaString;
84 #fix me -- this does not handle multiple problem selections correctly. 84 #FIXME: -- this does not handle multiple problem selections correctly.
85# my $problemName = $r->param('pgProblem'); 85# my $problemName = $r->param('pgProblem');
86# my $problemList = $r->param('problemList'); 86# my $problemList = $r->param('problemList');
87 87
88 # Initialize the textarea string if it is empty or hasn't been defined. 88 # Initialize the textarea string if it is empty or hasn't been defined.
89 $problemList = $self->gatherProblemList($setName) unless defined($problemList) and $problemList =~/\S/; 89 $problemList = $self->gatherProblemList($setName) unless defined($problemList) and $problemList =~/\S/;
90 90
91 my $problemEntry = $oldSetDirectory.'/'.$problemName.", 1, -1 \r\n"; 91 my $problemEntry = $oldSetDirectory.'/'.$problemName.", 1, -1 \r\n";
92 # add the new problem entry if the address is complete. (still buggy -- how do insure that oldSetDirectory is not empty? 92 # add the new problem entry if the address is complete. (still buggy -- how do insure that oldSetDirectory is not empty?
93 $problemList .= $problemEntry unless $problemEntry =~ m|^/|; # don't print if oldSetDirectory name is empy (fix me -- more checks are needed?) 93 $problemList .= $problemEntry unless $problemEntry =~ m|^/|; # don't print if oldSetDirectory name is empy (FIXME: -- more checks are needed?)
94 # format the complete textArea string 94 # format the complete textArea string
95 $textAreaString = qq!<textarea name="problemList", cols="40", rows="$rowheight">! . 95 $textAreaString = qq!<textarea name="problemList", cols="40", rows="$rowheight">! .
96 $problemList . 96 $problemList .
97 97
98 qq!</textarea>!; 98 qq!</textarea>!;
99 99
100 100
101 #Determine the headline for the page 101 #Determine the headline for the page
102 102
103 103
104 #fix me Debugging code 104 #FIXME: Debugging code
105# my $header = "Choose problems from $libraryName directory" . 105# my $header = "Choose problems from $libraryName directory" .
106# "<p>This form is not yet operational. 106# "<p>This form is not yet operational.
107# <p>SetDirectory is $setDirectory. 107# <p>SetDirectory is $setDirectory.
108# <p>formURL is $formURL 108# <p>formURL is $formURL
109# <p>path_info is $path_info"; 109# <p>path_info is $path_info";
110 my $header = ''; 110 my $header = '';
111 111
112 112
113 ######################################################################### 113 #########################################################################
114 # Define the popup strings used for selecting the library set directory, and the problem from that directory 114 # Define the popup strings used for selecting the library set directory, and the problem from that directory
115 #fix me 115 #FIXME:
116 # he problem of multiple selections needs to be handled properly. 116 # he problem of multiple selections needs to be handled properly.
117 ######################################################################### 117 #########################################################################
118 my $popUpSetDirectoryString = $self->fetchSetDirectories($setDirectory); #pass default choice as current directory 118 my $popUpSetDirectoryString = $self->fetchSetDirectories($setDirectory); #pass default choice as current directory
119 my $popUpPGProblemString = $self->fetchPGproblems($setDirectory); 119 my $popUpPGProblemString = $self->fetchPGproblems($setDirectory);
120 120
121 121
122 ######################################################################### 122 #########################################################################
123 # Define a link to view the problem 123 # Define a link to view the problem
124 #fix me: 124 #FIXME:
125 # Currently this link used the webwork problem library, which might be out of 125 # Currently this link used the webwork problem library, which might be out of
126 # sync with the local library 126 # sync with the local library
127 ######################################################################### 127 #########################################################################
128 128
129 129
181 CGI::hidden(-name=>'user', -value=>$user), 181 CGI::hidden(-name=>'user', -value=>$user),
182 CGI::hidden(-name=>'key',-value=>$key), 182 CGI::hidden(-name=>'key',-value=>$key),
183 CGI::hidden(-name=>'oldSetDirectory', -value=>$setDirectory), 183 CGI::hidden(-name=>'oldSetDirectory', -value=>$setDirectory),
184 184
185 CGI::end_form(), 185 CGI::end_form(),
186# "<p> the parameters passed are " #fix me -- debugging code 186# "<p> the parameters passed are " #FIXME: -- debugging code
187# . join("<BR>", %{$r->param()}) . $self->gatherProblemList($setName)."setName is $setName"; 187# . join("<BR>", %{$r->param()}) . $self->gatherProblemList($setName)."setName is $setName";
188 ; 188 ;
189 189
190} 190}
191 191
200 my $remaining_path = $path_info; 200 my $remaining_path = $path_info;
201 $remaining_path =~ s/^.*problemSetEditor//; 201 $remaining_path =~ s/^.*problemSetEditor//;
202 my($junk, $setName, @components) = split "/", $remaining_path; 202 my($junk, $setName, @components) = split "/", $remaining_path;
203 # Override the setName if it is defined in a form. 203 # Override the setName if it is defined in a form.
204 $setName = $r->param('setName') if defined($r->param('setName')); 204 $setName = $r->param('setName') if defined($r->param('setName'));
205 # fix me?? -- this insures backward compatibility with the old file naming convention. 205 # FIXME:?? -- this insures backward compatibility with the old file naming convention.
206 $setName = "set$setName" unless $setName =~/^set/; 206 $setName = "set$setName" unless $setName =~/^set/;
207 207
208 # Find the URL for the form 208 # Find the URL for the form
209 $path_info =~s|problemSetEditor.*$|problemSetEditor/|; # remove the setName, if any, from the path 209 $path_info =~s|problemSetEditor.*$|problemSetEditor/|; # remove the setName, if any, from the path
210 my $formURL = "/webwork$path_info"; # . $setName$self->url_authen_args(); 210 my $formURL = "/webwork$path_info"; # . $setName$self->url_authen_args();
215 $libraryName = $ce->{courseDirs}->{templates}; 215 $libraryName = $ce->{courseDirs}->{templates};
216 my $setDirectory = $r->param('setDirectory'); 216 my $setDirectory = $r->param('setDirectory');
217 my $oldSetDirectory = $r->param('oldSetDirectory'); 217 my $oldSetDirectory = $r->param('oldSetDirectory');
218 218
219 # Determine the problem name 219 # Determine the problem name
220 #fix me -- this does not handle multiple problem selections correctly. 220 #FIXME -- this does not handle multiple problem selections correctly.
221 my $problemName = $r->param('pgProblem'); 221 my $problemName = $r->param('pgProblem');
222 # Determine the text area string (contents of set definition "file") 222 # Determine the text area string (contents of set definition "file")
223 my $problemList = $r->param('problemList'); 223 my $problemList = $r->param('problemList');
224 224
225 # get answer dates 225 # get answer dates
284 284
285 my $self = shift; 285 my $self = shift;
286 my $setDirectory = shift; 286 my $setDirectory = shift;
287 287
288 # Handle default for setDirectory 288 # Handle default for setDirectory
289 # fix me -- this is not bullet proof 289 # FIXME -- this is not bullet proof
290 $setDirectory = "set0" unless defined($setDirectory); 290 $setDirectory = "set0" unless defined($setDirectory);
291 my $templateDirectory = $self->{ce}->{courseDirs}->{templates}; 291 my $templateDirectory = $self->{ce}->{courseDirs}->{templates};
292 292
293 ## 293 ##
294 opendir SETDEFDIR, "$templateDirectory/$setDirectory" 294 opendir SETDEFDIR, "$templateDirectory/$setDirectory"

Legend:
Removed from v.887  
changed lines
  Added in v.888

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9