mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #61637
[Bug 1912709] Re: Having 'js' folder in theme breaks HTML exports
Hi Zander. Thank you for pointing out this limitation with the theme
export. Since you created a customisation, it's not a fault of Mahara to
not cater to where you located the JavaScript.
Did you try putting your JS file into the folder that exists in a Mahara
theme? As you have a custom theme, it wouldn't be overwritten by core
files.
** Changed in: mahara
Status: New => Invalid
--
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1912709
Title:
Having 'js' folder in theme breaks HTML exports
Status in Mahara:
Invalid
Bug description:
We've created a custom theme for a client and added some JavaScript to
tweak something minor when viewing a collection. This file was put in
`<siteroot>/mahara/htdocs/theme/customtheme/js/theme.js`.
When exporting a portfolio, it looks like the HTML files are exported with the assumption that all the necessary js files are in the active theme's `js` folder.
For example, in the attached HTML file you'll see the below references in the `<head>` element - files which are not present in the export under the modern theme, but rather the raw theme (I just tested the core theme 'modern' in this case, but the same happens with custom themes):
```
<script type='text/javascript' src='../../../HTML/static/theme/modern/static/js/jquery.js'></script>
<script type='text/javascript' src='../../../HTML/static/theme/modern/static/js/bootstrap.min.js'></script>
<script type='text/javascript' src='../../../HTML/static/theme/modern/static/js/dock.js'></script>
<script type='text/javascript' src='../../../HTML/static/theme/modern/static/js/modal.js'></script>
<script type='text/javascript' src='../../../HTML/static/theme/modern/static/js/lodash.js'></script>
<script type='text/javascript' src='../../../HTML/static/theme/modern/static/js/gridstack.js'></script>
<script type='text/javascript' src='../../../HTML/static/theme/modern/static/js/gridlayout.js'></script>
<script type='text/javascript' src='../../../HTML/static/theme/modern/static/js/masonry.min.js'></script>
<script type='text/javascript' src='../../../HTML/static/theme/modern/static/js/select2.full.js'></script>
<script type='text/javascript' src='../../../HTML/static/theme/modern/static/js/theme.js'></script>
```
From what I can tell, it's due to the code starting at around about `htdocs/export/html/lib.php:876`:
```
$jsdir = $staticdir . 'theme/' . $theme . '/static/js/';
```
It appears to be preventing the blocks from being rendered/populated
correctly on the page and the page appears mostly blank.
As a workaround, we added the snippet of JS to
`$cfg->additionalhtmlhead` for now and removed the `js` folder from
the theme.
Not sure if this is expected behaviour or a bug or enhancement I'm recommending! :)
But hope it helps.
------------------------------
Application/System version(s):
Mahara
$config->version = 2020013013;
$config->series = '20.04';
$config->release = '20.04.2';
OS
Ubuntu 18.04.5 LTS
DB
MySQL 5.7
------------------------------
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1912709/+subscriptions
References