From 69860b072151eb46f127e549df19bc53bbc2f81b Mon Sep 17 00:00:00 2001 From: Michael Gage Date: Fri, 7 Jun 2013 08:57:58 -0400 Subject: [PATCH 1/2] set default editor choices for release/2.7 classlist editor 2, homeworkset editor 2, and PGProblemEditors 2 and 3 (need both because editor 3 is iffy with older themes --- conf/defaults.config | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/conf/defaults.config b/conf/defaults.config index 3b502d49b9..1264c97aa6 100644 --- a/conf/defaults.config +++ b/conf/defaults.config @@ -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, ); ############################################################################### From 13cf32451effc6cfc106e85d0a1d5c246c3453ee Mon Sep 17 00:00:00 2001 From: Michael Gage Date: Fri, 7 Jun 2013 09:00:20 -0400 Subject: [PATCH 2/2] Provide graceful fall back if theme is not available. This is a bit of a hack since it hardwires math4 theme as the default theme that is always available. A future iteration should make this defaultDefaultTheme configurable in defaults.config. (We should also clean up the variable names. :-) ) --- lib/WeBWorK/ContentGenerator.pm | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/WeBWorK/ContentGenerator.pm b/lib/WeBWorK/ContentGenerator.pm index 13a5dc45ce..7565742645 100644 --- a/lib/WeBWorK/ContentGenerator.pm +++ b/lib/WeBWorK/ContentGenerator.pm @@ -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); } @@ -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)));