Skip to content

Commit

Permalink
Merge pull request openwebwork#74 from mgage/release/2.7
Browse files Browse the repository at this point in the history
Add graceful failure if theme is not available.
  • Loading branch information
goehle committed Jun 7, 2013
2 parents 0a27723 + 13cf324 commit 28425f7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
13 changes: 7 additions & 6 deletions conf/defaults.config
Original file line number Diff line number Diff line change
Expand Up @@ -1101,18 +1101,19 @@ $webservices = {
# The items below can be placed in localOverrides.conf override the settings in this file
# One can also use $showeditors{classlisteditor1}=0; to override a setting.
%showeditors = (
classlisteditor1 => 1,
classlisteditor2 => 0,
classlisteditor1 => 0,
classlisteditor2 => 1,

homeworkseteditor1 => 1,
homeworkseteditor2 => 0,
homeworkseteditor1 => 0,
homeworkseteditor2 => 1,

librarybrowser1 => 1,
librarybrowser2 => 0,
librarybrowser3 => 0,

pgproblemeditor1 => 1,
pgproblemeditor2 => 0,
pgproblemeditor1 => 0,
pgproblemeditor2 => 1,
pgproblemeditor3 => 1,
);

###############################################################################
Expand Down
19 changes: 16 additions & 3 deletions lib/WeBWorK/ContentGenerator.pm
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,20 @@ sub content {
# this means that the {stylesheet} option in defaults.config is never used
my $template = $self->can("templateName") ? $self->templateName : $ce->{defaultThemeTemplate};
my $templateFile = "$themesDir/$theme/$template.template";

unless (-r $templateFile) { #hack to prevent disaster when missing theme directory
if (-r "$themesDir/math4/$template.template") {
$templateFile = "$themesDir/math4/$template.template";
warn "Theme $theme is not one of the available themes. ".
"Please check the theme configuration ".
"in the files localOverrides.conf, course.conf and ".
"simple.conf and on the course configuration page.\n"
} else {
die "Neither the theme $theme nor the defaultTheme math4 are available. ".
"Please notify your site administrator that the structure of the ".
"themes directory needs attention.";

}
}
template($templateFile, $self);
}

Expand Down Expand Up @@ -1020,8 +1033,8 @@ sub footer(){
my $self = shift;
my $r = $self->r;
my $ce = $r->ce;
my $ww_version = $ce->{WW_VERSION}||"unknown -- set ww version in defaults.config";
my $pg_version = $ce->{PG_VERSION}||"unknown -- set pg version in defaults.config";
my $ww_version = $ce->{WW_VERSION}||"unknown -- set ww version VERSION";
my $pg_version = $ce->{PG_VERSION}||"unknown -- set pg version PG_VERSION link to ../pg/VERSION";
my $theme = $ce->{defaultTheme}||"unknown -- set defaultTheme in localOverides.conf";
my $copyright_years = $ce->{WW_COPYRIGHT_YEARS}||"1996-2011";
print CGI::div({-id=>"last-modified"}, $r->maketext("Page generated at [_1]", timestamp($self)));
Expand Down

0 comments on commit 28425f7

Please sign in to comment.