Best practice forum (Archived)

La discussione è stata rimossa.

 
L'intervento è stato rimosso
Friday, 13 December 2013, 06:47
Il contenuto di questo intervento è stato rimosso, non è più possibile visualizzarlo.
? ?
Re: Upgrade to 2.5 Broke my Logo based on Custom Totara
di ? ? - Sunday, 15 December 2013, 14:37
 

Hi Alan,

I think in 2.5 one of the theme admin settings changed. The 2.4 version for the logo picker in your theme/settings.php would have been something like

$setting = new admin_setting_configfilepicker($name, $title, $description, $default, array('web_image'));

but the 2.5 version is

$setting = new admin_setting_configstoredfile($name, $title, $description, 'logo');

 

Making that change should fix your custom theme, I think.

The Totara menu is defined in totara/core/totara.php in the function totara_build_menu() so that is where you would need to make code changes to add or remove items from the standard menu. There is an outstanding feature request to make the menu fully customisable through a web interface, but it is very unlikely that this will make it into Totara core before 2.6 at the earliest.

L'intervento è stato rimosso
Monday, 16 December 2013, 05:03
Il contenuto di questo intervento è stato rimosso, non è più possibile visualizzarlo.
? ?
Re: Upgrade to 2.5 Broke my Logo based on Custom Totara
di ? ? - Monday, 16 December 2013, 19:25
 

Hi Alan,

I've gone through all the changes in the base customtotara from 2.4 to 2.5. You are right, there are some code changes. You will probably need to be change all these as well in your 2.5 theme - replace customtotara with the directory your theme is in in all the lines below:

 

/theme/customtotara/config.php change the last line

$THEME->csspostprocess = 'customtotara_process_css';

to

$THEME->csspostprocess = 'theme_customtotara_process_css';

 

theme/customtotara/lib.php, Rename

function customtotara_process_css($css, $theme) {

to

function theme_customtotara_process_css($css, $theme) {

And in that function on the second-last line change

$css = customtotara_set_customcss($css, $customcss); 

to

$css = theme_customtotara_set_customcss($css, $customcss);

 

Still in lib.php, Rename

function customtotara_set_customcss($css, $customcss) {

to

function theme_customtotara_set_customcss($css, $customcss) {

 

Immediately after function theme_customtotara_set_customcss add a new function:

/**
 * Serves any files associated with the theme settings.
 *
 * @param stdClass $course
 * @param stdClass $cm
 * @param context $context
 * @param string $filearea
 * @param array $args
 * @param bool $forcedownload
 * @param array $options
 * @return bool
 */
function theme_customtotara_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
    if ($context->contextlevel == CONTEXT_SYSTEM && ($filearea === 'logo' || $filearea === 'favicon')) {
        $theme = theme_config::load('customtotara');
        return $theme->setting_file_serve($filearea, $args, $forcedownload, $options);
    } else {
        send_file_not_found();
    }

 

And lastly, in settings.php where you changed "new admin_setting_configfilepicker" to "new admin_setting_configstoredfile" in my first reply, you should add the line

$setting->set_updatedcallback('theme_reset_all_caches');

This line should also be added after all the $setting = new admin_setting_* lines in that file - 7 of them in the base standardtotara.

 

If all that works then I'll put together instructions for all the clients who may have 2.4 custom themes as I can see this being a problem for quite a few clients.

L'intervento è stato rimosso
Tuesday, 17 December 2013, 04:45
Il contenuto di questo intervento è stato rimosso, non è più possibile visualizzarlo.
L'intervento è stato rimosso
Tuesday, 17 December 2013, 05:11
Il contenuto di questo intervento è stato rimosso, non è più possibile visualizzarlo.
L'intervento è stato rimosso
Tuesday, 17 December 2013, 09:14
Il contenuto di questo intervento è stato rimosso, non è più possibile visualizzarlo.
? ?
Re: Upgrade to 2.5 Broke my Logo based on Custom Totara
di ? ? - Tuesday, 17 December 2013, 12:05
 

Hi Ciaran,

We experienced a similar problem upgrading a stock Totara 2.4 to 2.5, with no customized themes. The upgrade seemed to loose the theme settings made by the admin (in this case colours) and the link to the logo image they uploaded. These had to be reset.

Regards,

Richard

? ?
Re: Upgrade to 2.5 Broke my Logo based on Custom Totara
di ? ? - Tuesday, 17 December 2013, 15:07
 

Hi Richard,

I'm not surprised by the logo, because the way the theme logos are uploaded and stored radically changed in Moodle and I'm not really sure if we can add anything to the upgrade script to migrate the logos properly, though we will look into it.

Other non-file settings like the colours though should definitely have been migrated so there may be a different, if related, bug there.

? ?
Re: Upgrade to 2.5 Broke my Logo based on Custom Totara
di ? ? - Tuesday, 17 December 2013, 15:03
 

Hi Alan,

Did you try turning on debugging to see if there was an error message on the white screen? You should take a clean copy of the old working 2.4 theme from the original 2.4 install, add the theme directory to 2.5, make the changes above (and no others), turn on debugging, and see what happens. You may still have to reset the logo in the theme settings because of the new logo filepicker.

Unfortunately without actually having your custom theme code it's almost impossible to try and diagnose the problem from here. If your theme is mainly just CSS and image changes to the base customtotara then alternatively it should be relatively straightforward to apply those changes on top of a copy of the 2.5 version of customtotara. However if it is a heavily customised theme with lots of custom code then there will probably always be issues with such a theme on every major version upgrade, depending on what changes Moodle have made.

L'intervento è stato rimosso
Wednesday, 18 December 2013, 04:40
Il contenuto di questo intervento è stato rimosso, non è più possibile visualizzarlo.