Forum OpenACS Development: Xowiki/Templating best practice

Collapse
Posted by Paul Babin on
Is it possible to load files found in /packages/xowiki/tcl in a theme package?

Motivation - there are a number of bootstrap 3 customizations for xowiki found in the following files
bootstrap-procs.tcl
resource-info-procs.tcl
resource-init.tcl
tree-procs.tcl

I'm basically taking the openacs-bootstrap3-theme and creating a bootstrap4 theme which needs to tweak a few of these settings to display correctly.

(aside - thank you so much for creating these theme as it has massively helped us in our development)

I've tried placing these at /packages/bootstrap4-theme/resources/templates/packages/xowiki/tcl and /packages/bootstrap4-theme/resources/templates/packages/xowiki/www/tcl as my trial and error process and neither seem to take. Do I need to name my package such that it is loading last during startup - or is the tcl folder not included in the templating system for themes.

If the latter, do you have any recommendations on how I can update these procedures without making local changes to the the xowiki package.

Collapse
Posted by Gustaf Neumann on
The theme packages OpenACS we have now are mostly for site-specific theming (colors, logos, css, js) but these are not sufficient for programmatic modifications introduced by different JS toolkits. E.g. some tree renders are purely JavaScript-based, others are based on e.g. div or list structures.

Therefore, xowiki has a site-wide parameter "PreferredCSSToolkit", which can be used to switch in essence between the old YUI style to the newer boostrap3 style of rendering. There are certainly for newer bootstrap versions (4 and 5) some differences, such as different button classes, or differences in the icon management (e.g. dropped glyphicon library in bootstrap4(, grid changes, etc... but many things work as before.

To address this, the change [1] was introduced shortly before the release of OpenACS 5.10.0 to provide a basis for a common bootstrap version, supporting as well newer versions. Our take was to skip Bootstrap4 and to go for Bootstrap5 which offers more options for the icon library. One challenge is to provide an easy setup optionally using the CDN like what we have for Bootstrap3. But for now, it is not clear, how much resources we can invest here in the short-range.

The way to go is to extend the "PreferredCSSToolkit" with newer bootstrap versions and to use the abstractions provided by [1]. The provided dict has to be extended, but when this is done, the goal is to switch between these major bootstrap revisions without code changes.

[1] https://github.com/openacs/xowiki/commit/99e3331c64d0af4f26c2ff41ec9f707cf40af3ef

Collapse
Posted by Paul Babin on
As always, thank you greatly for this insight into the development process. This helps me greatly in developing on our end without hacking "core" files. I believe this will be sufficient for us to modify what we need on our end
Collapse
Posted by Gustaf Neumann on
Dear Paul,

you might have noticed the new bootstrap5 theme in the oacs-5-10 branch. The support (including theme switching for programmatically generated HTML) is growing and should be part of OpenACS 5.10.1

all the best
-g