diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm index 981c5b413d..693c088fe2 100644 --- a/Koha/Template/Plugin/Branches.pm +++ b/Koha/Template/Plugin/Branches.pm @@ -153,4 +153,26 @@ sub pickup_locations { return \@libraries; } +sub GetBranchSpecificJS { + my ($self, $branchcode) = @_; + + return q{} unless defined $branchcode; + + my $library = Koha::Libraries->find($branchcode); + my $userjs = $library ? $library->userjs : q{}; + + return $userjs +} + +sub GetBranchSpecificCSS { + my ($self, $branchcode) = @_; + + return q{} unless defined $branchcode; + + my $library = Koha::Libraries->find($branchcode); + my $usercss = $library ? $library->usercss : q{}; + + return $usercss +} + 1; diff --git a/admin/branches.pl b/admin/branches.pl index 112ca421d3..2ee0a71760 100755 --- a/admin/branches.pl +++ b/admin/branches.pl @@ -81,6 +81,8 @@ if ( $op eq 'add_form' ) { marcorgcode pickup_location public + userjs + usercss ); my $is_a_modif = $input->param('is_a_modif'); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt index 9f4b1e09e2..8020c7aaa1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt @@ -23,6 +23,8 @@ [% t("Koha") | html %] [% END %] [% INCLUDE 'doc-head-close.inc' %] +[% Asset.css("lib/codemirror/codemirror.min.css") | $raw %] +[% Asset.css("lib/codemirror/lint.min.css") | $raw %] @@ -286,6 +288,23 @@
Set to 'yes' to show this library as a search option and on the libraries page in the OPAC.
+
  • + +
    + Click to edit + + +
    +
  • +
  • + +
    + Click to edit + + +
    +
  • +
    @@ -486,7 +505,30 @@ [% INCLUDE 'datatables.inc' %] [% INCLUDE 'columns_settings.inc' %] [% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %] + [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %] + [% Asset.js( "lib/codemirror/css.min.js" ) | $raw %] + [% Asset.js( "lib/codemirror/javascript.min.js" ) | $raw %] + [% Asset.js( "lib/codemirror/xml.min.js" ) | $raw %] + [% Asset.js( "lib/codemirror/yaml.min.js" ) | $raw %] + [% Asset.js( "lib/codemirror/lint.min.js" ) | $raw %] + [% Asset.js( "lib/linters/jshint.min.js" ) | $raw %] + [% Asset.js( "lib/linters/htmlhint.min.js" ) | $raw %] + [% Asset.js( "lib/linters/csslint.min.js" ) | $raw %] + [% Asset.js( "lib/linters/js-yaml.min.js" ) | $raw %] + [% Asset.js( "lib/codemirror/html-lint.min.js" ) | $raw %] + [% Asset.js( "lib/codemirror/javascript-lint.min.js" ) | $raw %] + [% Asset.js( "lib/codemirror/css-lint.min.js" ) | $raw %] + [% Asset.js( "lib/codemirror/yaml-lint.min.js" ) | $raw %] + [% Asset.css("lib/codemirror/codemirror.css") | $raw %] [% INCLUDE 'str/tinymce_i18n.inc' %] + [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc index 7787c62f94..3183783fe1 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc @@ -44,6 +44,11 @@ [% IF ( Koha.Preference('OPACUserCSS') ) %] [% END %] +[% IF Branches.GetBranchSpecificCSS( Branches.GetLoggedInBranchcode() || default_branch) %] + +[% END %] [% IF SCO_login %] [% SET SCOUserCSS = Koha.Preference('SCOUserCSS') %] [% IF SCOUserCSS %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc index e37086e24e..c7ff522e02 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc @@ -1,5 +1,6 @@ [% USE raw %] [% USE Koha %] +[% USE Branches %] [% USE AdditionalContents %] [%- USE KohaPlugins -%] [% USE Asset %] @@ -239,6 +240,11 @@ $(document).ready(function() { [% Koha.Preference('OPACUserJS') | $raw %] [% END %] +[% IF Branches.GetBranchSpecificJS( Branches.GetLoggedInBranchcode() || default_branch) %] + +[% END %] [% IF SCO_login %] [% SET SCOUserJS = Koha.Preference('SCOUserJS') %] [% IF ( SCOUserJS ) %]