[system] / branches / ghe3_dev / webwork2 / lib / WeBWorK / ContentGenerator / Instructor / ProblemSetList.pm Repository:
ViewVC logotype

Diff of /branches/ghe3_dev/webwork2/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList.pm

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

Revision 2777 Revision 2778
78# make one $mode variable that contains a string like "edit", "view", or "export" 78# make one $mode variable that contains a string like "edit", "view", or "export"
79 79
80use strict; 80use strict;
81use warnings; 81use warnings;
82use CGI qw(); 82use CGI qw();
83use WeBWorK::Utils qw(formatDateTime parseDateTime readFile listFilesRecursive cryptPassword sortByName); 83use WeBWorK::Utils qw(readFile listFilesRecursive cryptPassword sortByName);
84 84
85use constant HIDE_SETS_THRESHOLD => 50; 85use constant HIDE_SETS_THRESHOLD => 50;
86use constant DEFAULT_PUBLISHED_STATE => 1; 86use constant DEFAULT_PUBLISHED_STATE => 1;
87 87
88use constant EDIT_FORMS => [qw(cancelEdit saveEdit)]; 88use constant EDIT_FORMS => [qw(cancelEdit saveEdit)];
1135 1135
1136 foreach my $field ($Set->NONKEYFIELDS()) { 1136 foreach my $field ($Set->NONKEYFIELDS()) {
1137 my $param = "set.${setID}.${field}"; 1137 my $param = "set.${setID}.${field}";
1138 if (defined $tableParams->{$param}->[0]) { 1138 if (defined $tableParams->{$param}->[0]) {
1139 if ($field =~ /_date/) { 1139 if ($field =~ /_date/) {
1140 $Set->$field(parseDateTime($tableParams->{$param}->[0])); 1140 $Set->$field($self->parseDateTime($tableParams->{$param}->[0]));
1141 } else { 1141 } else {
1142 $Set->$field($tableParams->{$param}->[0]); 1142 $Set->$field($tableParams->{$param}->[0]);
1143 } 1143 }
1144 } 1144 }
1145 } 1145 }
1197 my %hash = %$hashRef; 1197 my %hash = %$hashRef;
1198 1198
1199 my %result; 1199 my %result;
1200 foreach my $key (keys %hash) { 1200 foreach my $key (keys %hash) {
1201 my $count = @{ $hash{$key} }; 1201 my $count = @{ $hash{$key} };
1202 my $displayKey = formatDateTime($key) || "<none>"; 1202 my $displayKey = $self->formatDateTime($key) || "<none>";
1203 $result{$key} = "$displayKey ($count sets)"; 1203 $result{$key} = "$displayKey ($count sets)";
1204 } 1204 }
1205 return %result; 1205 return %result;
1206} 1206}
1207 1207
1352 } 1352 }
1353 1353
1354 ##################################################################### 1354 #####################################################################
1355 # Check and format dates 1355 # Check and format dates
1356 ##################################################################### 1356 #####################################################################
1357 my ($time1, $time2, $time3) = map { $_ =~ s/\s*at\s*/ /; WeBWorK::Utils::parseDateTime($_); } ($openDate, $dueDate, $answerDate); 1357 my ($time1, $time2, $time3) = map { $_ =~ s/\s*at\s*/ /; $self->parseDateTime($_); } ($openDate, $dueDate, $answerDate);
1358 1358
1359 unless ($time1 <= $time2 and $time2 <= $time3) { 1359 unless ($time1 <= $time2 and $time2 <= $time3) {
1360 warn "The open date: $openDate, due date: $dueDate, and answer date: $answerDate must be defined and in chronological order."; 1360 warn "The open date: $openDate, due date: $dueDate, and answer date: $answerDate must be defined and in chronological order.";
1361 } 1361 }
1362 1362
1438 if(-e $filePath) { 1438 if(-e $filePath) {
1439 rename($filePath, "$filePath.bak") or 1439 rename($filePath, "$filePath.bak") or
1440 $reason{$set} = "Existing file $filePath could not be backed up and was lost."; 1440 $reason{$set} = "Existing file $filePath could not be backed up and was lost.";
1441 } 1441 }
1442 1442
1443 my $openDate = formatDateTime($setRecord->open_date); 1443 my $openDate = $self->formatDateTime($setRecord->open_date);
1444 my $dueDate = formatDateTime($setRecord->due_date); 1444 my $dueDate = $self->formatDateTime($setRecord->due_date);
1445 my $answerDate = formatDateTime($setRecord->answer_date); 1445 my $answerDate = $self->formatDateTime($setRecord->answer_date);
1446 my $setHeader = $setRecord->set_header; 1446 my $setHeader = $setRecord->set_header;
1447 my @problemList = $db->listGlobalProblems($set); 1447 my @problemList = $db->listGlobalProblems($set);
1448 1448
1449 my $problemList = ''; 1449 my $problemList = '';
1450 foreach my $prob (sort {$a <=> $b} @problemList) { 1450 foreach my $prob (sort {$a <=> $b} @problemList) {
1642 foreach my $field ($Set->NONKEYFIELDS) { 1642 foreach my $field ($Set->NONKEYFIELDS) {
1643 my $fieldName = "set." . $set_id . "." . $field, 1643 my $fieldName = "set." . $set_id . "." . $field,
1644 my $fieldValue = $Set->$field; 1644 my $fieldValue = $Set->$field;
1645 my %properties = %{ FIELD_PROPERTIES()->{$field} }; 1645 my %properties = %{ FIELD_PROPERTIES()->{$field} };
1646 $properties{access} = "readonly" unless $editMode; 1646 $properties{access} = "readonly" unless $editMode;
1647 $fieldValue = formatDateTime($fieldValue) if $field =~ /_date/; 1647 $fieldValue = $self->formatDateTime($fieldValue) if $field =~ /_date/;
1648 $fieldValue =~ s/ /&nbsp;/g unless $editMode; 1648 $fieldValue =~ s/ /&nbsp;/g unless $editMode;
1649 $fieldValue = ($fieldValue) ? "Yes" : "No" if $field =~ /published/ and not $editMode; 1649 $fieldValue = ($fieldValue) ? "Yes" : "No" if $field =~ /published/ and not $editMode;
1650 push @tableCells, CGI::font({class=>$publishedClass}, $self->fieldEditHTML($fieldName, $fieldValue, \%properties)); 1650 push @tableCells, CGI::font({class=>$publishedClass}, $self->fieldEditHTML($fieldName, $fieldValue, \%properties));
1651 $fakeRecord{$field} = CGI::font({class=>$publishedClass}, $self->fieldEditHTML($fieldName, $fieldValue, \%properties)); 1651 $fakeRecord{$field} = CGI::font({class=>$publishedClass}, $self->fieldEditHTML($fieldName, $fieldValue, \%properties));
1652 } 1652 }

Legend:
Removed from v.2777  
changed lines
  Added in v.2778

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9