Bug 2774

Summary: Path to theme is hard-coded in many places
Product: Koha Reporter: Doug Dearden <dearden>
Component: OPACAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Jonathan Druart <jonathan.druart>
Severity: normal    
Priority: P3 CC: dcook, gmcharlt, jonathan.druart, liz, magnus, mtj, tomascohen, wizzyrea
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Medium patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 4048, 10292    
Bug Blocks: 7884    
Attachments: Bug 2774 - Path to theme is hard-coded in many places
Bug 2774 - Path to theme is hard-coded in many places
Bug 2774 - Path to theme is hard-coded in many places
Bug 2774 - Path to theme is hard-coded in many places
Bug 2774 - Path to theme is hard-coded in many places
Bug 2774 - Path to theme is hard-coded in many places
Bug 2774 - Path to theme is hard-coded in many places
Bug 2774 - Path to theme is hard-coded in many places
[PASSED QA] Bug 2774 - Path to theme is hard-coded in many places

Description Chris Cormack 2010-05-21 00:55:43 UTC


---- Reported by dearden@sarsf.org 2008-11-11 08:54:32 ----

I turned on both OPAC xslt options and edited the MARC21slim2OPACDetail.xsl file in the default prog theme to change the way the link under the title works.  I am running multiple databases and only wanted this to apply to a single one.  I copied the prog directory as a new name, and set the xsl file in the prog theme to the original one and the xsl file in my new theme to my new one.  I then changed the opacthemes option to point to the new theme.  I connected to the OPAC and there was no difference from the original.  I then changed a color in the css file in the new theme location to confirm it was looking in the correct place, the color changed on the OPAC.  I renamed prog to progx, and tried again.  I get this error.
Koha error

The following fatal error has occurred:

Could not create file parser context for file "/usr/share/koha/opac/htdocs/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl": No such file or directory at /usr/share/koha/lib/C4/XSLT.pm line 121

Apache	Server version: Apache/2.2.3 Server built: Mar 22 2008 09:29:10
Koha	3.00.00.107
Koha DB	3.0000107
MySQL	mysql Ver 14.12 Distrib 5.0.32, for pc-linux-gnu (i486) using readline 5.2
OS	Linux SAR56Linux 2.6.18-6-686 #1 SMP Sun Feb 10 22:11:31 UTC 2008 i686 GNU/Linux
Perl	5.008008

Looks like the pointer to the xslt directory is still pointing to the one in the prog theme instead of my new theme.



---- Additional Comments From oleonard@myacpl.org 2008-11-11 09:16:45 ----

There are a LOT of instances in templates and code where the "prog" theme is hardcoded.



--- Bug imported by chris@bigballofwax.co.nz 2010-05-21 00:55 UTC  ---

This bug was previously known as _bug_ 2774 at http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=2774

Unknown operating system Linux - Debian. Setting to default OS "All".
Actual time not defined. Setting to 0.0

Comment 1 Liz Rea 2012-05-02 16:05:48 UTC
Have we fixed many of these?
Comment 2 Magnus Enger 2012-05-08 09:20:54 UTC
(In reply to comment #1)
> Have we fixed many of these?

Try running this command in the base Koha directory: 

grep -r --exclude=*.po "/prog/" *

Looks like there are quite a few instances left...
Comment 3 Owen Leonard 2012-05-21 15:02:16 UTC
I'm making this bug dependent on Bug 4048 because it doesn't make sense to modify hard-coded paths if the path is going to change.
Comment 4 Owen Leonard 2013-03-25 19:18:51 UTC Comment hidden (obsolete)
Comment 5 David Cook 2013-04-02 23:36:55 UTC
(In reply to comment #4)
> Created attachment 16863 [details] [review] [review]
> Bug 2774 - Path to theme is hard-coded in many places
> 
> Many templates have instances where the path to the prog template is
> hard-coded. Now that interface and theme template variables are
> available everywhere these paths should be corrected to use them.
> 
> Image paths corrected:
> 
> - 'Patron image missing' image on circulation pages
> - 'Locked' icon on fund planning page
> - Tag and subfield edit icons on the authority, biblio editor, and batch
>   item modification pages (Clone tag, delete tag, clone subfield,
>   delete subfield, move subfield)
> - 'Loading' icon when importing frameworks
> 
> Audio file paths corrected:
> 
> - Sounds for circulation.pl and returns.pl
> 
> Paths to DataTables assets corrected on:
> 
> - Transfers to receive report
> - Holds queue report
> - Holds awaiting pickup report
> - Patron detail page (moremember.pl)
> - Patron circulation history
> - Update child to adult patron page
> - Process offline circulations
> - Catalog by item type report
> - Serials statistics wizard
> - Serial claims page
> - Koha news
> - Notices
> - Batch patron modifications
> 
> Path to progress bar assets corrected on:
> 
> - Process offline circulations page
> - Progressbar include file
> - Stage MARC imports
> - Manage MARC imports
> - Local cover image upload
> 
> Other image paths:
> 
> - "Approved" checkmark image on tags review page
> - Table sort icons on lists page
> - Feed icon on OPAC search result page
> - "Loading" image for OPAC plain MARC view
> 
> Path to ratings JavaScript on OPAC detail and results pages

Awesome work, Owen. 

Any thoughts on how to test this one? Is there a way to automate the testing to make sure that each path actually gets formed correctly?
Comment 6 Kyle M Hall 2013-04-12 13:28:50 UTC Comment hidden (obsolete)
Comment 7 Jonathan Druart 2013-04-23 10:28:30 UTC
QA comment:

No issue found.

There are still some occurrences:
- reserve/request.tt
- labels/label-manage.tt
- reports/guided_reports_start.tt
- authorities/detail.tt

- opac-auth-MARCdetail.tt
- opac-auth-detail.tt
- opac-reserve.tt

Not blocker, but is there a reason?

Marked as Passed QA.
Comment 8 Jonathan Druart 2013-04-23 10:28:43 UTC Comment hidden (obsolete)
Comment 9 Jared Camins-Esakov 2013-04-27 11:33:20 UTC
This looks good to me, but I am bumping it to 3.14 because I am concerned about the number of files it changes.
Comment 10 Mason James 2013-04-27 12:25:07 UTC
(In reply to comment #9)
> This looks good to me, but I am bumping it to 3.14 because I am concerned
> about the number of files it changes.

hmm, i might bump the severity to 'critical', so this bug gets noticed more...

i hope no-one objects to this?
Comment 11 Galen Charlton 2013-05-20 16:22:15 UTC
(In reply to comment #10)
> (In reply to comment #9)
> > This looks good to me, but I am bumping it to 3.14 because I am concerned
> > about the number of files it changes.
> 
> hmm, i might bump the severity to 'critical', so this bug gets noticed
> more...
> 
> i hope no-one objects to this?

I do.  From http://wiki.koha-community.org/wiki/Bug_Reporting_Guidelines#Severity, the critical severity is defined as "Koha or component crashes and/or there is a potential loss of data".  While this definition is a guideline, not an absolute rule, this bug simply does not qualify as a critical bug by that definition.

If you want to call attention to a bug, please do so by (for example) discussing it on the IRC channel or koha-devel.  Setting the severity of a bug higher than necessary would be a bad habit for us to get into, as it reduces the utility of that BZ field.

Consequently, I am setting the severity back to normal.

This should not be construed as a statement that I am not going to review the patch; I will, in due course.
Comment 12 Galen Charlton 2013-05-20 17:56:22 UTC
I've added bug 10292 as a dependency -- not so much because it is directly related to the patch that was submitted, but because it touches on the specific issue that was originally reported by Doug Dearden.
Comment 13 Galen Charlton 2013-05-20 18:17:05 UTC
I've pushed Owen's patch to master.  Thanks, Owen!

I'm also setting this back to In Discussion, as there are some places that still make hard-coded references to prog.  Here is a list of potential candidates for replacing references:

./C4/Record.pm
./C4/Templates.pm
./C4/Koha.pm
./C4/Items.pm
./C4/XSLT.pm
./misc/translator/translate
./misc/translator/LangInstaller.pm
./installer/InstallAuth.pm
./admin/systempreferences.pl
./koha-tmpl/intranet-tmpl/prog/en/includes/error-messages.inc
./koha-tmpl/intranet-tmpl/prog/en/includes/installer-doc-head-close.inc
./koha-tmpl/intranet-tmpl/prog/en/css/blue.css
./koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
./koha-tmpl/intranet-tmpl/prog/en/css/mainpage.css
./koha-tmpl/intranet-tmpl/prog/en/js/ajax.js
./koha-tmpl/intranet-tmpl/prog/en/modules/help/labels/spinelabel-home.tt
./koha-tmpl/intranet-tmpl/prog/en/modules/help/mainpage.tt
./koha-tmpl/intranet-tmpl/prog/en/modules/installer/step1.tt
./koha-tmpl/intranet-tmpl/prog/en/modules/installer/step2.tt
./koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt
./koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tt
./koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt
./koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
./koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl
./koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslim2intranetDetail.xsl
./koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARC_compact.xsl
./koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslim2intranetResults.xsl
./koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl
./koha-tmpl/opac-tmpl/prog/en/xslt/NORMARCslim2OPACDetail.xsl
./koha-tmpl/opac-tmpl/gmc/en/xslt/NORMARCslim2OPACDetail.xsl
./koha-tmpl/opac-tmpl/gmc/en/xslt/MARC21slim2OPACDetail.xsl
./opac/unapi
./opac/opac-showmarc.pl
./opac/oai.pl
./catalogue/cardview.pl
./cataloguing/value_builder/marc21_field_008.pl
./cataloguing/value_builder/marc21_field_006.pl
./cataloguing/addbiblio.pl
Comment 14 Galen Charlton 2013-05-20 18:18:04 UTC
Comment on attachment 17611 [details] [review]
Bug 2774 - Path to theme is hard-coded in many places

Marking patch attachment obsolete now that it's been pushed to master, because bug should remain open for additional followup.
Comment 15 Owen Leonard 2013-06-05 17:53:10 UTC Comment hidden (obsolete)
Comment 16 Liz Rea 2013-06-06 23:48:18 UTC Comment hidden (obsolete)
Comment 17 Jonathan Druart 2013-06-07 09:59:57 UTC
QA comment:
Looks good to me too. I will provide a patch for qa tools in order to avoid another intranet-tmpl or opac-tmpl.
Marked as Passed QA.
Comment 18 Jonathan Druart 2013-06-07 10:00:14 UTC Comment hidden (obsolete)
Comment 19 Galen Charlton 2013-06-07 16:15:56 UTC
Comment on attachment 18728 [details] [review]
Bug 2774 - Path to theme is hard-coded in many places

Pushed latest patch to master.  Thanks, Owen!
Comment 20 Owen Leonard 2013-07-02 15:29:49 UTC Comment hidden (obsolete)
Comment 21 Chris Cormack 2013-07-06 08:29:48 UTC Comment hidden (obsolete)
Comment 22 Katrin Fischer 2013-07-11 06:16:48 UTC
Created attachment 19540 [details] [review]
[PASSED QA] Bug 2774 - Path to theme is hard-coded in many places

This patch corrects more places in Koha where the path to the "prog"
theme is hard-coded in templates, CSS, and scripts.

Staff client home page:

Paths to the Koha logo background image and the module image sprite have
been corrected. Inactive and hover states of the module links
(circulation, patrons, etc) should look correct.

addbiblio.pl:

An <img> tag is replaced with a text link and an
additional CSS class. CSS uses an image-replacement technique to display
the image as before.

To test, open a blank or existing bibliographic record for editing.
Confirm that the "tag editor" icon displays correctly in two cases: 1)
tags linked to plugin editors and 2) tags linked to authorities. Both
should look correct and work correctly.

System preferences:

The system preferences editor appends a "loading" image to system
preference submit buttons when they are clicked. This patch changes
ajax.js to insert a <span> styled with a background-image instead.

To test, open system preferences and modify any preference. Submit the
change and confirm that the "loading" image appears correctly.

Background jobs:

Any place in Koha where a background job is used displays a progress
bar. This patch corrects the path in CSS to the progress bar image. To
test, perform an action which triggers the display of a progress bar.
For instance, batch modification of items. Confirm that the progress bar
image displays correctly.

blue.css:

I don't know if this is still used by anyone, but a couple of image
paths in this CSS file have been corrected.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests, QA script and test plan.
Comment 23 Galen Charlton 2013-07-18 16:54:14 UTC
Pushed to master.  Thanks, Owen!
Comment 24 Tomás Cohen Arazi 2013-08-14 14:32:03 UTC
Latest patch has been pushed to 3.12.x, will be in 3.12.4.

Thanks Owen!