Having to write [% KOHA_VERSION %] for each url is bad because:
- It's easily forgettable when adding new <script> or <link>
- It prevents grep'ing for the full filename
- It violates the DRY principle
- If at some point we want to change the "force js and css reload"
mechanism, it will be tedious
This patch:
- adds a Template::Toolkit plugin that generates <script> and
<link> tags for JS and CSS files, and inserts automatically the Koha
version in the filename
- use the new plugin to remove all occurences of [% KOHA_VERSION %]
- remove the code that was adding KOHA_VERSION as a template variable
Test plan:
1. Apply patch
2. Go to several different pages in Koha (opac and intranet) while
checking your browser's dev tools (there should be no 404 for JS and
CSS files, and the Koha version should appear in filenames) and the
server logs (there should be no "File not found")
3. `git grep KOHA_VERSION` should return nothing
4. prove t/db_dependent/Koha/Template/Plugin/Asset.t
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch makes C4::Templates::gettemplate set the KOHA_VERSION param
for the template. This way this template parameter, which is required by
(probably) all pages that include CSS/JS content is available in all
circumstances.
A noticeable problem with the current approach is when using the SCO and
SCI modules with wrong/forbidden users: C4::Auth short-circuits and
redirects to the login page, without setting the KOHA_VERSION param.
This patch solves it for good.
To test:
- Enable the SCI module
- Open the browser at
http://localhost:8080/cgi-bin/koha/sci/sci-main.pl
- Login with the db user (koha_kohadev / password)
=> FAIL: Login failure, but styling is broken
- Apply this patch
- Retry
=> SUCCESS: Everything looks as it should!
- Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
*** WARNING: Verbatim paragraph in NAME section at line 28 in file C4/Templates.pm
Test plan:
Run podchecker on C4::Templates and verify that the warning is resolved.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Similar to the full path test in sub themelanguage, this patch makes a
change in _get_template_file. This allows you to pass a template
outside the modules directory to get_template_and_user. (Note: the sub
badtemplatecheck already blocks bad paths.)
Especially, this would be helpful for plugins using templates. As can be
seen in Templates.pm, a change was made earlier to overwrite the filename
for a plugin in sub gettemplate. This exception can now be removed.
Also note the small change in Koha/Plugin/Base.pm; mbf_path is already
absolute and if we pass a full path, we do not need it. This allows use of
a regular Koha template or a shared template between plugins (as long as
badtemplatecheck allows the path).
What are the side-effects of this change?
[1] We should not pass absolute paths if we mean relative ones.
A follow-up patch deals with one occurrence in the codebase.
No regressions for regular use.
[2] Plugins can call get_template_and_user directly or go via get_template
in Koha/Plugin/Base (absolute paths don't go via mbf_path).
Note: replaced two single quotes in Auth.pm to show template name in test
description.
Test plan:
[1] Open some page on OPAC or staff client to trigger a template.
[2] Run t/db_dependent/Auth.t to verify not allowing some bad templates.
[3] Run t/db_dependent/Templates.t to verify an absolute path.
[4] Run t/db_dependent/Plugins.t to verify using templates in a plugin.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
The check is now extended by only allowing templates from the regular
Koha template directories and additional plugin directories as defined
in koha-conf.xml.
Note: In order to prevent an uninitialized warning on $theme from sub
themelanguage for a not-existing file, I added a trivial assignment. Will
get further attention in a follow-up.
Test plan:
[1] Run t/db_dependent/Auth.t
[2] Run t/db_dependent/Templates.t
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
The bad template check in get_template_and_user can be removed, since
this check has been added in gettemplate on bug 18010.
The check moves here to a new sub in C4::Templates. And will be extended
in a follow-up.
Removed unused variable $path in gettemplatefile.
Test plan:
[1] Run t/db_dependent/Auth.t (get_template_and_user bad calls).
[2] Run t/db_dependent/Templates.t (bad call to gettemplate).
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
A similar bad template check from C4::Auth::get_template_and_user
should be applied in C4::Templates::gettemplate.
Before this patch it would be possible to expose files like:
my $template = C4::Templates::gettemplate(
'/etc/passwd', 'intranet', CGI::new, 1
);
print $template->output;
Note that the is_plugin flag in the above call is the culprit. This patch
provides a quick security fix without touching get_template_and_user, and
can be backported to stable branches.
I will provide an enhanced and centralized check on report 17989, also
removing the is_plugin flag.
Note: We allow .pref here too for use in admin/preferences.pl.
Test plan:
[1] Run t/db_dependent/Auth.t (triggering get_template_and_user and
gettemplate).
[2] Run t/db_dependent/Templates.t again (see first test plan).
The tests should no longer fail.
[3] Open a page on opac or intranet.
[4] Open a systempreferences tab.
[5] Add a book to the cart and send it ([opac-]sendbasket uses gettemplate).
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
Doing uniq( \@themes ) is useless. It will just return to you the only
reference you gave it.
List::MoreUtils::uniq requires a list instead of an arrayref.
So it is a trivial fix that makes sub themelanguage return one theme instead
of three themes like [ 'prog', 'prog', 'prog' ].
Note that Template->new inserts one or two include paths to TT for each of
these three identical themes.
Test plan:
[1] Run t/db_dependent/Templates.t (should no longer fail)
[2] Run t/db_dependent/Auth.t (triggering themelanguage)
[3] Open a page on OPAC or intranet. (Did you restart Plack?)
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
EDIT (Marcel): Amended test plan for additional unit test.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
The goal of this patch is to avoid unecessary flush of the L1 cache on
creating a new CGI object each time C4::Languages::getlanguage is called
without a CGI object.
The new class Koha::Cache::Memory::Lite must be flushed by the CGI
constructor overide done in the psgi file. This new class will ease
caching of specific stuffs used by running script.
Test plan:
At the OPAC and the intranet interfaces:
Open 2 different browser session to simulate several users
- Clear the cookies of the browsers
- User 1 (U1) an User 2 (U2) should be set to the default language
(depending on the browser settings)
- U1 chooses another language
- U2 refreshes and the language used must be the default one
- U2 chooses a third language
- U1 refreshes and must be still using the one he has choosen.
Try to use a language which is not defined:
Add &language=es-ES (if es-ES is not translated) to the url, you should
not see the Spanish interface.
Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
From C4::Templates::output
# add variables set via param to $vars for processing
for my $k ( keys %{ $self->{VARS} } ) {
$vars->{$k} = $self->{VARS}->{$k};
}
This loop is not necessary, we could do the same with
$vars = { %$vars, %{ $self->{VARS} } };
After a quick benchmark, it gains 100 microseconds when we pass 170 vars
to the template.
Test plan:
Do some clicks on the interface, everything should be ok.
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
Perl idiosyncratic way of merging hash, clearer, if not quicker (not
verified)
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
Revert "DBRev to make notes of the XSS patches and the new important dependency."
This reverts commit e140603a59.
Revert "Bug 13618: Specific for branches.opac_info"
This reverts commit 06e4a50f00.
Revert "Bug 13618: (follow-up) Specific for other prefs"
This reverts commit d6475a111f.
Revert "Bug 13618: Fix for debarredcomment and patron messages"
This reverts commit dd98c9df92.
Revert "Bug 13618: Do not display html tags in patron's notices"
This reverts commit a065b243fe.
Revert "Bug 13618: Do not display and html tags in item fields content"
This reverts commit baeeaffbf8.
Revert "Bug 13618: Fix for system preference description"
This reverts commit a967a09261.
Revert "Bug 13618: Remove html filters for newly pushed code"
This reverts commit 0e98662b10.
Revert "Bug 13618: (follow-up) add missing lines for opac-shelves"
This reverts commit fc2fb605e5.
Revert "Bug 13618: (follow-up) Specific for ColumnsSettings"
This reverts commit bc308fdd9c.
Revert "Bug 13618: Fix for edit biblios and items"
This reverts commit 811c4e8402.
Revert "Bug 13618: followup to remove tabs"
This reverts commit ca8e8c397c.
Revert "Bug 13618: Fix last occurrences recently introduced to master"
This reverts commit bb417b256b.
Revert "Bug 13618: Fix for news"
This reverts commit ae5b98020a.
Revert "Bug 13618: Fix escape on sending baskets or shelves by email"
This reverts commit a7731ffe25.
Revert "Bug 13618: Specific for XSLTBloc"
This reverts commit 11fa38dc29.
Revert "Bug 13618: Specific for Salutation on editing a patron"
This reverts commit 36c07ad6d3.
Revert "Bug 13618: Specific for other prefs"
This reverts commit e6ea281a3b.
Revert "Bug 13618 - memberentrygen.tt errors Not a GLOB reference"
This reverts commit 7824874557.
Revert "Bug 13618: Specific for ColumnsSettings"
This reverts commit 1834da3da3.
Revert "Bug 13618: Specific for IntranetUser* and OPACUser* prefs"
This reverts commit 21ae62b253.
Revert "Bug 13618: Fix error 'Not a GLOB reference'"
This reverts commit 602bdbab4c.
Revert "Bug 13618: Specific for the ISBD view"
This reverts commit d254362435.
Revert "Bug 13618: Specific for pagination_bar"
This reverts commit 8837a8ae68.
Revert "Bug 13618: Specific places where we don't need to escape variables - intra"
This reverts commit 00eff140b3.
Revert "Bug 13618: Remove html filters at the intranet"
This reverts commit 7db851ff03.
Revert "Bug 13618: Specific places where we don't need to escape variables"
This reverts commit 49a3738b8d.
Revert "Bug 13618: Remove html filters at the OPAC"
This reverts commit cedaa0e23e.
Revert "Bug 13618: Use Template::Stash::AutoEscaping to use the html filter"
This reverts commit 01b38d3b13.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
Test plan:
1/ Use a translated template (fr-FR or ar-Arab)
2/ Go on the tools/import_patrons.pl page
3/ The field names in the "default values" block should be correctly
encoded.
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
TEST PLAN
---------
1) $ prove t/db_dependent/Auth.t
-- warnings
2) Apply this patch
3) $ prove t/db_dependent/Auth.t
-- only one specific type of warning
4) Apply bug 5010 patch
5) $ prove t/db_dependent/Auth.t
-- noisy is eliminated
6) koha qa test tools.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
With patch only one warn
With 5010 no more warns
No errors
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Test plan (from comment #1)
1) Apply this patch
2) Run updatedatabase.pl
3) Verify the system pref OpacColorStyleSheet still works
i.e. no change should be noted
Additionally, I changed the path to an other stylesheet and verified that it worked.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described and no more occurences of opaccolorstylesheet were found.
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
When trying to execute or configure the plugin on 3.18 I got:
Template process failed: file error - doc-head-open.inc: not found at
/usr/share/koha/lib/C4/Templates.pm line 129.
Test Plan:
1) Install the Kitchen Sink plugin
2) Go to the configuration page of the plugin
3) Note the template processing error
4) Apply this patch
5) Refresh the page
6) Note the page now loads
Signed-off-by: Nick <nick@quecheelibrary.org>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
We don't need to decode manually which provide nice performance boost.
Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This patch
- removes all html_entity usages in tt file which hide utf8 bugs
- removes all encode utf8 in tt plugins because we should get correctly
marked data from DBIC and other sources directly (cf plugin EncodeUTF8
used in renew.tt)
- adds some cleanup in C4::Templates::output: we now use perl utf8 file
handler output so we don't need to decode tt variables manually.
Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
You may define in config a folder (usually /tmp) for TT cache :
template_cache_dir in etc/koha-conf.xml.
Some perl pages may be launched from commandline, like tools/export.pl.
Also, the script gather_print_notices.pl uses C4::Templates.
The problem is that when script is launched from Apache, the Unix owner of cache files will be www-data. When script is launched from commandline, like in a cronjob, the Unix owner will be different (like a user named "koha"), causing a crash because cache files can only be read by its owner.
This script disables the template cache if perl script is called from commandline. This cache is certainly only useful for web access.
Using GATEWAY_INTERFACE env var comes from tools/export.pl
Test plan :
- Use a dev install of koha installed in a user home, ie "/home/kohadev"
- Define a folder for template_cache_dir in etc/koha-conf.xml. For example : <template_cache_dir>/tmp</template_cache_dir>
- Check there is no cached templates already in this forder
- Create a file "bib.list" containing a few existing biblionumbers
- As user kohadev, launch : tools/export.pl --record-type=bibs --id_list_file=bib.list
- Look at cache folder
=> Without patch you see cache files owned by user kohadev
=> With patch there are no cache files
- Use the Koha interfaces OPAC and Intranet
=> Without patch you get an error : Template process failed: file error - cache failed to write ...
=> With patch you have no error and cache files are generated with Apache user as owner
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, good test plan!
Passes tests and QA script.
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
In the OPAC if you view the MARC details for a title (and have
OPACXSLTDetailsDisplay enabled) there is a "view plain" link which displays the
output of opac-showmarc.pl. This is broken in master: fixed by this patch.
Test plan:
(1) Set OPACXSLTDetailsDisplay to default
(2) Do a search on OPAC, then display a specific biblio record
(3) Click on MARC view tab. Then click on 'view plain' link. Nothing is
displayed.
(4) Apply the patch. And refresh the MARC detail page.
(5) Click on 'view plain' link. Check that a plain text MARC record is
displayed.
Signed-off-by: Chris <chris@bigballofwax.co.nz>
Note: This makes a small change to C4::Templates::themelanguage so that
it works with .xsl files too (They live in the xslt dir)
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, passes tests and QA script.
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
With the aim to remove hardcoded themes the C4::Templates::themelanguage
got dependent on the DB being populated. This patch reintroduced the
hardcoded defaults as a last resort.
To test:
- Do a fresh install, clean your browser's cache, empty DB
- Open the staff interface
=> FAIL: A "Software error" screen shows "Template process failed: file error..."
- Apply the patch
- Reload
=> SUCCESS: The webinstaller prompts for login correctly.
- Sign off :-D
Regards
Signed-off-by: Nick Clemens <nick@quecheelibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
With the OPAC prog template going away, the only remaining use of the
yuipath preference is on the basketgroups template. The yuipath
preference should be removed and the local path hard-coded.
This patch:
- removes yuipath handling from C4/Templates.pm
- removes the preference from sysprefs.sql
- deletes the preference via updatedatabase.pl
- removes the preference from the staff client preferences file
- removes unused references to the YUI assets from the help file
header include
- adds the local YUI asset path to acqui/basketgroup.tt
To test, apply the patch and run the database update. View some online
help pages and confirm that they function correctly. View the
basketgroups page (Acquisition -> Vendor -> Basket groups), edit a
basket group, and confirm that basket drag and drop operations work
correctly.
Signed-off-by: Aleisha <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Online help and basket group drag&drop functionality still work correctly.
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
The is a problem in the logic, fallback must be:
1. Requested (theme, lang, tmpl)
a. return (theme, lang, tmpl), if not
b. return (fallback, lang, tmpl), if not
c. return (theme, 'en', tmpl), if not as last resort
d. return (fallback, 'en', tmpl)
Previous patch missed option 'c', worked for CCSR
but not bootstrap, sorry.
Signed-off-by: Petter Goksoyr Asen <boutrosboutrosboutros@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This patch removes hardcoded 'prog' from themelanguage on C4/Templates.pm
It adds a new syspref OPACFallback to hold the prefferred fallback
theme for new themes with minimal changes.
This does not brake CCSR if new syspref value is 'prog',
using 'bootstrap' works somehow, but with strange results.
To test:
1) Apply the patch
2) Run updatedatbase.pl
3) CCSR, prog & bootstrap must work as usual
4) Need to test theme/language fallback
a) translate for your preferred language (xx-YY)
b) enable language on opac
c) go to opac, select that language
d) login on opac, go to personal details
e) remove koha-tmpl/opac-tmpl/bootstrap/xx-YY/modules/opac-memberentry.tt
d) reload page, must load in English
f) click other member options, must load on translated language
(can use other pages, ccsr, prog or bootstrap)
5) Do a similar test but for a staff page, enable lang, switch to it,
rm koha-tmpl/intranet-tmpl/prog/xx-YY/modules/admin/admin-home.tt,
any page must be translated except for admin home.
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Petter Goksoyr Asen <boutrosboutrosboutros@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
To reproduce:
- Go to Tools > Import patrons
- Notice branchcode and categorycode don't have dropdown menus with
valid options.
- Notice dateofbirth, dateenrolled and dateexpiry don't have date-pickers
- Notice each input field is labeled with the column name instead of a
proper description.
To test:
- Apply the patch, go to Tools > Import patrons
- Notice branchcode and categorycode have dropdown menus with valid options,
and by default the empty value is selected.
- Notice that if you go into the dateofbirth, dateenrolled and dateexpiry
fields, a nice date picker widget appears.
- Notice each field is labeled with the field description, and that the
column name is conveniently shown at the right of the input field.
Important: test switching the ExtendedPatronAttributes syspref, and verify that
if enabled, the patron_attributes field appears, and also the checkbox selector
controlling the extended patron attributes import behaviour shows too.
Bonus points: Verify that on a different language, the descriptions get translated,
and the column names show correctly
Regards
To+
Signed-off-by: Aleisha <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes tests and QA script.
Works as described, no regressions found.
Dates are output in ISO/database format, this is ok.
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
The opacsmallimage system preference is unused in the bootstrap theme.
It can be removed now that prog and ccsr are deprecated. This patch does
so.
To test, apply the patch and run updatedatabase. Confirm that the OPAC
works properly and the preference can no longer be found.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Preference removed, no koha-qa errors
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Since all scripts use the '.tt' sufix for template names
there's no need for and regexp that changes from '.tmpl'
to '.tt'.
Regards
To+
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Use C4::Languages::getlanguage() instead of
C4::Templates::_current_language()
Test plan:
1/ Set one of the 4 XSLT sysprefs to 'default'
2/ Go to the corresponding page
3/ Switch language and check that the right XSLT is used
4/ Set the same syspref to something with '{langcode}' in it. For
example:
"../koha-tmpl/opac-tmpl/bootstrap/{langcode}/xslt/UNIMARCslim2OPACDetail.xsl"
5/ Go back to the corresponding page
6/ Switch language and check that the right XSLT is used
7/ Change a compact.xsl for a language (for example
koha-tmpl/intranet-tmpl/prog/fr-FR/xslt/compact.xsl) to be able to see
differences
8/ Go to a biblio detail page in staff interface and click on "MARC
Preview: Show"
9/ Close the popup, switch language and click again on the same link
10/ Check that the correct XSLT is used.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works as described following test plan.
No koha-qa errors
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
No problems found, passes tests and QA script.
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Also store interface (intranet, opac) in context to not have to pass it
as parameter.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
No koha-qa errors
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Comments on last patch.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This was tricky to catch. In current implementation, Bug 6755
introduced in C4/Templates.pm as condition to send the array of
hashrefs of languages that (@$languages_loop<2), but with one
language group that condition is false, there is only one
element in that array.
This patch changes that condition to have more than one language
selected, grouped or not.
Also send $bidi value always, that was only sent if there is
more than one group language.
To test:
1. Translate to en-GB and en-NZ, or simply do mkdirs
on intranet-tmpl/prog and opac-tmpl/bootstrap
2. Go to Administration > System preferences > I18N
enable those languages on staff/opac
3. Check that language chooser is nowhere to be found
4. Apply the patch
5. Reload staff/opac, now you can see language chooser
NOTE: I made little changes on staff, but can't replicate
bootstrap colors for selected/unselected language. Someone
need to touch css files to make it happen. But that is
current behavior.
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Good catch!
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
* when a file was uploaded and the comparison with catalogue range
requested, the comparison was wrong: the logic was wrong
* items that were not supposed to be scanned (ie: supposed to be on another shelf)
didn't had the author and title, it was hard to retrieve them on the shelved
* some useful fields were missing, like homebranch, location, status
* the CSV export contained all the item information. It should contain the same
informations as the screen
Behaviour now:
* scan a list of barcode & select a range of location
* if a barcode has been scanned and should not be (misplaced item),
the information is displayed
* if you choose "compare barcodes list to result option", the
resulting list contains all items that have been scanned and those
that were supposed to be. Any item not in both list appears with a
specific message on the last column
Signed-off-by: Leila <koha.aixmarseille@gmail.com>
Signed-off-by: Koha Team Amu <koha.aixmarseille@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Passing language=<valid_language_code> as a parameter in any Koha's URL
can be used to set the desired language.
This patch touches
- C4::Templates
- C4::Auth
Adds a new method getlanguagecookie that does exactly that, for use in
get_template_and_user.
Also modifies getlanguage so it checks (a) if there's a 'language'
parameter in the CGI object and (b) checks if its valid and enabled for
the desired interface.
To test:
* Without the patch
- access any koha page
- add ?language=code to the end of the URL (change code for a valid language code
it needs to be installed using perl translate install code, and enabled either for
the staff or opac interface, depending where are you testing)
- Nothing happens with the language parameter
* With the patch
- access any koha page
- add ?language=code (the same as before) and hit enter
- the language should be changed to the one you chose
- if you browse through some links, you will see
koha 'remembers' the language you passed as a parameter
(i.e. the language cookie has been updated).
Sponsored-by: Universidad Nacional de Córdoba
Signed-off-by: Brendan <brendan@bywatersolutions.com>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: Works very well. No errors.
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
More comments on last patch.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
If you enable another translation, and disable English, then if you dont
have a cookie set, or your browser is not set to that language, you will
get English. So you can not disable English in either the staff client
or the OPAC.
This patch fixes the language selection to do the right thing.
To test you must have at least one other language installed besides
English. Apply the patch and disable the en translation. Koha should
fall back to one of the enabled translations.
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
I added a patch description and test plan, missing from the
original patch.
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
I have tested with various combinations of activated languages
and have found no regression. If the cookie is set, the right
language is shown accordingly. Else the first language in the
list seems to be picked. It did never fall back to English
in my tests, when English was explicitly deactivated.
Passes all tests and QA script.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
In current implementation (mostly commented out in this patch)
uses heuristic to guess which strings need decoding from utf-8
to binary representation and doesn't support utf-8 characters
in templates and has problems with utf-8 data from database.
With this changes, Koha perl code always uses utf-8 encoding
correctly. All incomming data from database is allready
correctly marked as utf-8, and decoding of utf8 is required
only from Zebra and XSLT transfers which don't set utf-8 flag
correctly.
For output, standard perl :encoding(utf8) handler is used
so it also removes various "wide character" warnings as side-effect.
Test scenario:
1. make sure that you have utf-8 characters in your biblio
records, patrons, categories etc.
2. try to search records on intranet and opac which contain
utf-8 characters
3. install language which has utf-8 characters, e.g. uk-UA
dpavlin@koha-dev:/srv/koha/misc/translator(bug_6554) $
PERL5LIB=/srv/koha/ perl translate install uk-UA
4. switch language to uk-UA and verify that templates
display correctly
5. test search and Z39.50 search and verify that caracters
are correct
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
I followed the test plan, adding utf-8 characters to library names,
patron categories, titles, and authorized values. I tried the uk-UA
translation and everything looked good.
When performing Z39.50 searches for titles containing utf-8 characters I
got results which were still occasionally contaminated with dummy
characters [?] but I assume this is Z39.50's fault not the patch's.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Already signed, add mine.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Adds support for custom plugins. At the moment the Plugins
feature supports two types of plugins, reports and tools.
Plugins are installed by uploading KPZ ( Koha Plugin Zip )
packages. A KPZ file is just a zip file containing the
perl files, template files, and any other files neccessary
to make the plugin work.
Test plan:
1) Apply patch
2) Run updatedatabase.pl
3) Create the directory /var/lib/koha/plugins
4) Add the lines
<pluginsdir>/var/lib/koha/plugins</pluginsdir>
<enable_plugins>1</enable_plugins>"
to your koha-conf.xml file
5) Add the line
Alias /plugin/ "/var/lib/koha/plugins/"
to your koha-httpd.conf file
6) Restart your webserver
7) Access the plugins system from the "More" pulldown
8) Upload the example plugin file provided here
9) Try it out!
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
This patch moves the YUI assets from koha-tmpl/opac-tmpl/prog/en/lib/yui
to koha-tmpl/opac-tmpl/lib/yui.
NOTE: This was tested on Chrome, FF, and Safari on a Mac, and IE and FF
on Windows.
To test:
1) View a smattering of pages on the OPAC and intranet. If the move
did not work flawlessly, layout will be way off.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This patch does the following:
1) Enables fallback for includes between different themes and different
languages (with the exact same precedence as for .tt files)
2) Enable fallback for XSLT files between different themes and different
languages (again, same precedence)
3) Change the semantics of the TT [% themelang %] variable so that it always
refers to the preferred theme and language, rather than the fallback
theme/language. As a result, all themes must include all javascript,
css and image resources they use.
Note that these changes actually have no impact whatsoever on an
installation where the default (prog) themes are in use.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Mason James <mtj@kohaaloha.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This patch makes the use of opaccolorstylesheet and opaclayoutstylesheet more consistent. They may be: 1) just a file name, 2) a complete local path or 3) a full URL starting with http: for a remote css file.
This makes the syspref opacstylesheet that was only used for a remote css file obsolete.
June 20, 2012 Rebased.
July 18, 2012: Regex allows https too (thanks to Owen Leonard).
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Language choice in Opac an Staff client was not preserved between Browser sessions.
Changed expiry date of cookie 'KohaOpacLanguage' from '' (= expire after session) to '+3y' (3 years from now)
To test:
- In a multilingual Koha istallation, choose a language.
- Log out, close all Browser instances. Go to login screen. Login should show up in same language as before.
- Repeat with other languages.
modified: C4/Templates.pm
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Refactor code to be more idiomatic and clarify its intention was testing
undef against languages causing log warn was creating and assigning to
unnecessary variables calling accept_language with an undef is an
expensive way to get undef returned to the caller test we are asking it
a meabingful question use any rather than first ( we dont care about
firstness it should be unique anyway but it obscures the meaning of the
test ) split takes a pattern not a string
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
Having put my hands recently in this part of Koha code, I can confirm
that this patch fix log warnings, and add clarity and conciseness.
http://bugs.koha-community.org/show_bug.cgi?id=7874
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Just add to your Koha configuration file
<template_cache_dir>/path/writable/by/apache/user</template_cache_dir>
in the <config> block, and Koha will use template caching, for about
10% CPU time saving.
on linux servers, /tmp is usually OK
(also fixes an indenting with a TAB)
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
The results of using this are very striking. Based on an insufficient
sample size, it would seem that the time spent in T::T is reduced by a
factor of at least 5.
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This patch introduces a Filter (KohaDates) for use in templates
[% USE KohaDates %]
[% somevariable | $KohaDates %]
This will format the date in the format specified by the systempreference
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
- ensure that without cookie, language selection is based on browser
preferences
- refactor function to obtain langugage for stem in search (opac + intranet)
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
To reproduce the bug:
- Activate en and fr-FR for OPAC
- Clear your browser cookies
- Select your language preference in your browser: fr, fr-fr, en
- Load OPAC main page
- OPAC is displayed in English, rather than French as asked by browser
preferences
Apply the patch and test:
- Clear your browser cookies
- Load OPAC main page
- Pages are displayed in French
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
I dont think we can use only 2 digits, some languages is much longer
zh-hans-TW for example
But the regex should stop it bening able handle nasty chars,
whitelisting safe ones instead
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
I checked the patch doesn't break language switching and language selection.
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
I confirm the bug security issue was not here for master, but this fix improve the behaviour, so pushing it