[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 2128 Revision 2130
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/ProblemSetEditor.pm,v 1.52 2004/05/18 18:22:25 toenail Exp $ 4# $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetEditor.pm,v 1.53 2004/05/18 18:39:40 toenail 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.
136 if (defined($r->param($_))) { 136 if (defined($r->param($_))) {
137 if (m/_date$/) { 137 if (m/_date$/) {
138 $setRecord->$_(parseDateTime($r->param($_))); 138 $setRecord->$_(parseDateTime($r->param($_)));
139 } else { 139 } else {
140 $setRecord->$_($r->param($_)) unless ($_ eq 'set_header' and $r->param($_) eq "Use System Default"); 140 $setRecord->$_($r->param($_)) unless ($_ eq 'set_header' and $r->param($_) eq "Use System Default");
141
141 if($_ eq 'set_header') { 142 if($_ eq 'set_header') {
142 # be nice and copy the default file here if it doesn't exist yet 143 # be nice and copy the default file here if it doesn't exist yet
143 # empty set headers lead to trouble 144 # empty set headers lead to trouble
145 my $set_header = ($r->param($_) eq "Use System Default") ? $setRecord->set_header : $r->param($_);
146
144 my $newheaderpath = $r->{ce}->{courseDirs}->{templates} . '/'. $r->param('set_header'); 147 my $newheaderpath = $r->{ce}->{courseDirs}->{templates} . '/'. $set_header;
145 unless(($r->param('set_header') !~ /\S/) or -e $newheaderpath) { 148 unless(($set_header !~ /\S/) or -e $newheaderpath) {
146 my $default_header = $ce->{webworkFiles}->{screenSnippets}->{setHeader}; 149 my $default_header = $ce->{webworkFiles}->{screenSnippets}->{setHeader};
147 File::Copy::copy($default_header, $newheaderpath); 150 File::Copy::copy($default_header, $newheaderpath);
148 } 151 }
149 } 152 }
150 } 153 }
430sub saveProblem { 433sub saveProblem {
431 my $self = shift; 434 my $self = shift;
432 my ($body, $probFileName)= @_; 435 my ($body, $probFileName)= @_;
433 local(*PROBLEM); 436 local(*PROBLEM);
434 open (PROBLEM, ">$probFileName") || 437 open (PROBLEM, ">$probFileName") ||
435 $self->submission_error("Could not open $probFileName for writing. 438 $self->addmessage(CGI::div({class=>"ResultsWithError"}, CGI::p("Could not open $probFileName for writing. Check that the permissions for this problem are 660 (-rw-rw----)")));
436 Check that the permissions for this problem are 660 (-rw-rw----)");
437 print PROBLEM $body; 439 print PROBLEM $body;
438 close PROBLEM; 440 close PROBLEM;
439 chmod 0660, "$probFileName" || 441 chmod 0660, "$probFileName" ||
440 $self->submission_error(" 442 $self->addmessage(CGI::div({class=>"ResultsWithError"}, CGI::p("CAN'T CHANGE PERMISSIONS ON FILE $probFileName")));
441 CAN'T CHANGE PERMISSIONS ON FILE $probFileName");
442} 443}
4431; 4441;

Legend:
Removed from v.2128  
changed lines
  Added in v.2130

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9