View | Details | Raw Unified | Return to bug 12539
Collapse All | Expand All

(-)a/C4/Templates.pm (-14 / +9 lines)
Lines 201-213 sub _get_template_file { Link Here
201
    my $is_intranet = $interface eq 'intranet';
201
    my $is_intranet = $interface eq 'intranet';
202
    my $htdocs = C4::Context->config($is_intranet ? 'intrahtdocs' : 'opachtdocs');
202
    my $htdocs = C4::Context->config($is_intranet ? 'intrahtdocs' : 'opachtdocs');
203
    my ($theme, $lang, $availablethemes) = themelanguage($htdocs, $tmplbase, $interface, $query);
203
    my ($theme, $lang, $availablethemes) = themelanguage($htdocs, $tmplbase, $interface, $query);
204
205
    # if the template doesn't exist, load the English one as a last resort
206
    my $filename = "$htdocs/$theme/$lang/modules/$tmplbase";
204
    my $filename = "$htdocs/$theme/$lang/modules/$tmplbase";
207
    unless (-f $filename) {
205
208
        $lang = 'en';
209
        $filename = "$htdocs/$theme/$lang/modules/$tmplbase";
210
    }
211
    return ($htdocs, $theme, $lang, $filename);
206
    return ($htdocs, $theme, $lang, $filename);
212
}
207
}
213
208
Lines 248-253 sub gettemplate { Link Here
248
243
249
#---------------------------------------------------------------------------------------------------------
244
#---------------------------------------------------------------------------------------------------------
250
# FIXME - POD
245
# FIXME - POD
246
# FIXME - Rewritten to remove hardcoded theme with minimal changes, need to be rethinked
251
sub themelanguage {
247
sub themelanguage {
252
    my ($htdocs, $tmpl, $interface, $query) = @_;
248
    my ($htdocs, $tmpl, $interface, $query) = @_;
253
    ($query) or warn "no query in themelanguage";
249
    ($query) or warn "no query in themelanguage";
Lines 255-274 sub themelanguage { Link Here
255
    # Select a language based on cookie, syspref available languages & browser
251
    # Select a language based on cookie, syspref available languages & browser
256
    my $lang = C4::Languages::getlanguage($query);
252
    my $lang = C4::Languages::getlanguage($query);
257
253
258
    # Select theme
254
    # Get theme
259
    my $is_intranet = $interface eq 'intranet';
255
    my @themes   = ( C4::Context->preference( ($interface eq 'intranet') ? 'template' : 'opacthemes' ) );
260
    my @themes = split(" ", C4::Context->preference(
256
    my $fallback =   C4::Context->preference( ($interface eq 'intranet') ? 'template' : 'OPACFallback' );
261
        $is_intranet ? "template" : "opacthemes" ));
257
    push @themes, $fallback;
262
    push @themes, 'prog';
263
258
264
    # Try to find first theme for the selected language
259
    # Try to find first theme for the selected language
265
    for my $theme (@themes) {
260
    for my $theme (@themes) {
266
        if ( -e "$htdocs/$theme/$lang/modules/$tmpl" ) {
261
        if ( -e "$htdocs/$theme/$lang/modules/$tmpl" ) {
267
            return ($theme, $lang, \@themes)
262
            return ($theme, $lang, \@themes);
268
        }
263
        }
269
    }
264
    }
270
    # Otherwise, return prog theme in English 'en'
265
    # Otherwise, return fallback theme in English 'en'
271
    return ('prog', 'en', \@themes);
266
    return ($fallback, 'en', \@themes);
272
}
267
}
273
268
274
269
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 231-236 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
231
('OPACdidyoumean',NULL,NULL,'Did you mean? configuration for the OPAC. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'),
231
('OPACdidyoumean',NULL,NULL,'Did you mean? configuration for the OPAC. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'),
232
('OPACDisplay856uAsImage','OFF','OFF|Details|Results|Both','Display the URI in the 856u field as an image, the corresponding OPACXSLT option must be on','Choice'),
232
('OPACDisplay856uAsImage','OFF','OFF|Details|Results|Both','Display the URI in the 856u field as an image, the corresponding OPACXSLT option must be on','Choice'),
233
('OpacExportOptions','bibtex|dc|marcxml|marc8|utf8|marcstd|mods|ris','','Define export options available on OPAC detail page.','free'),
233
('OpacExportOptions','bibtex|dc|marcxml|marc8|utf8|marcstd|mods|ris','','Define export options available on OPAC detail page.','free'),
234
('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'),
234
('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'),
235
('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'),
235
('OPACFineNoRenewals','100','','Fine limit above which user cannot renew books via OPAC','Integer'),
236
('OPACFineNoRenewals','100','','Fine limit above which user cannot renew books via OPAC','Integer'),
236
('OPACFinesTab','1','','If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
237
('OPACFinesTab','1','','If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
(-)a/installer/data/mysql/updatedatabase.pl (+8 lines)
Lines 8670-8675 if ( CheckVersion($DBversion) ) { Link Here
8670
}
8670
}
8671
8671
8672
8672
8673
$DBversion = "3.17.00.XXX";
8674
if ( CheckVersion($DBversion) ) {
8675
    $dbh->do("INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES
8676
    ('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes')");
8677
    print "Upgrade to $DBversion done (Bug 12539 - PROG/CCSR deprecation: Remove hardcoded theme from C4/Templates.pm)\n";
8678
    SetVersion ($DBversion);
8679
}
8680
8673
=head1 FUNCTIONS
8681
=head1 FUNCTIONS
8674
8682
8675
=head2 TableExists($table)
8683
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-1 / +7 lines)
Lines 6-11 OPAC: Link Here
6
              choices: opac-templates
6
              choices: opac-templates
7
            - theme on the OPAC.
7
            - theme on the OPAC.
8
        -
8
        -
9
            - Use the
10
            - pref: OPACFallback
11
              choices:
12
                  bootstrap: bootstrap
13
                  prog: prog
14
            - theme as the fallback theme on the OPAC.
15
        -
9
            - "The OPAC is located at http://"
16
            - "The OPAC is located at http://"
10
            - pref: OPACBaseURL
17
            - pref: OPACBaseURL
11
              class: url
18
              class: url
12
- 

Return to bug 12539