Commit beac4400 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic

Bug 1750485: removing Old Raw theme

behatnotneeded

Change-Id: I696fb49a0c365fca675625b481e3ec105c76c666
parent 5b686926
......@@ -113,6 +113,7 @@ $string['networkingdescription'] = 'Configure networking for Mahara';
$string['cookieconsent'] = 'Cookie Consent';
$string['cookieconsentdescription'] = 'Configure the "Cookie Consent" user privacy system.';
$string['thememissing'] = 'The theme "%s" is missing. The theme has been set to the default theme.';
$string['parentthememissing'] = 'Theme "%s" has its parent theme "%s" missing and needs to be fixed. The theme has been set to the default theme.';
$string['staffusers'] = 'Staff users';
$string['staffusersdescription'] = 'Assign users staff permissions';
$string['adminusers'] = 'Admin users';
......
......@@ -1207,6 +1207,7 @@ $string['deleteduser'] = 'Deleted user';
$string['theme'] = 'Theme';
$string['choosetheme'] = 'Choose theme...';
$string['missingparent'] = 'Theme "%s" has missing parent theme "%s".';
// Homepage info block
$string['Hide2'] = 'Hide information box';
......
......@@ -876,6 +876,26 @@ function validate_theme($theme, $institution = null, $new = false) {
return false;
}
}
// validate parent theme
if (($themeconfig = Theme::get_theme_config($theme)) && $themeconfig->parent !== false) {
$parentthemename = $themeconfig->parent;
$parentthemeconfig = Theme::get_theme_config($parentthemename);
if (!$parentthemeconfig) {
if ($institution) {
set_config_institution($institution, 'theme', null);
}
else {
set_config('theme', 'default');
}
$SESSION->add_info_msg(get_string('parentthememissing', 'admin', $themeconfig->displayname, $parentthemename));
return false;
}
}
return true;
}
......
......@@ -730,16 +730,10 @@ EOF;
$smarty->assign('publicsearchallowed', $publicsearchallowed);
if ($USER->is_logged_in()) {
global $SELECTEDSUBNAV; // It's evil, but rightnav & mainnav stuff are now in different templates.
if (in_array('raw_old', $THEME->inheritance)) {
$menutype = (in_admin_section() ? 'adminnav' : null);
$smarty->assign('MAINNAV', main_nav($menutype));
}
else {
$smarty->assign('MAINNAV', main_nav());
$is_admin = $USER->get('admin') || $USER->is_institutional_admin() || $USER->get('staff') || $USER->is_institutional_staff();
if ($is_admin) {
$smarty->assign('MAINNAVADMIN', main_nav('adminnav'));
}
$smarty->assign('MAINNAV', main_nav());
$is_admin = $USER->get('admin') || $USER->is_institutional_admin() || $USER->get('staff') || $USER->is_institutional_staff();
if ($is_admin) {
$smarty->assign('MAINNAVADMIN', main_nav('adminnav'));
}
$mainnavsubnav = $SELECTEDSUBNAV;
$smarty->assign('RIGHTNAV', right_nav());
......@@ -1112,37 +1106,38 @@ class Theme {
return (preg_match('/^[a-zA-Z0-9_-]+$/', $themename) == 1);
}
/**
* Given a theme name, retrieves the $theme variable in the themeconfig.php file
*/
public static function get_theme_config($themename) {
$themeconfigfile = get_config('docroot') . 'theme/' . $themename . '/themeconfig.php';
if (is_readable($themeconfigfile)) {
require( get_config('docroot') . 'theme/' . $themename . '/themeconfig.php' );
return $theme;
}
else {
return false;
}
}
/**
* Given a theme name, reads in all config and sets fields on this object
*/
private function init_theme($themename, $themedata) {
// A little anonymous function to retrieve *only* the $theme variable from
// the themeconfig.php file
$getthemeconfig = function($themename) {
$themeconfigfile = get_config('docroot') . 'theme/' . $themename . '/themeconfig.php';
if (is_readable($themeconfigfile)) {
require( get_config('docroot') . 'theme/' . $themename . '/themeconfig.php' );
return $theme;
}
else {
return false;
}
};
$themeconfig = $getthemeconfig($themename);
$themeconfig = self::get_theme_config($themename);
if (!$themeconfig) {
// We can check if we have been given a viewbasename
if (!empty($themedata->viewbasename)) {
$themename = $themedata->viewbasename;
$themeconfig = $getthemeconfig($themename);
$themeconfig = self::get_theme_config($themename);
}
if (!$themeconfig) {
// We can safely assume that the default theme is installed, users
// should never be able to remove it
$themename = 'default';
$themeconfig = $getthemeconfig($themename);
$themeconfig = self::get_theme_config($themename);
}
}
......@@ -1173,13 +1168,13 @@ class Theme {
// Now go through the theme hierarchy assigning variables from the
// parent themes
$parentthemename = $themeconfig->parent;
$parentthemeconfig = $getthemeconfig($parentthemename);
$parentthemeconfig = self::get_theme_config($parentthemename);
// If the parent theme is missing, short-circuit to the "raw" theme
if (!$parentthemeconfig) {
log_warn("Theme \"{$currentthemename}\" has missing parent theme \"{$parentthemename}\".");
log_info(get_string('missingparent', 'mahara', $currentthemename, $parentthemename));
$parentthemename = 'raw';
$parentthemeconfig = $getthemeconfig($parentthemename);
$parentthemeconfig = self::get_theme_config($parentthemename);
}
$currentthemename = $parentthemename;
$themeconfig = $parentthemeconfig;
......
style/
\ No newline at end of file
Old raw theme used before the new navigation menu.
Will be obsolete soon.
FontAwesome
===========
Website: http://fontawesome.io
Version: 4.7.0
License: http://fontawesome.io/license Font: SIL OFL 1.1 License
See also: theme/raw/sass/lib/font-awesome/ for CSS license information
This library is for the Font awesome icon glyphs. Note
that it also includes content in theme/raw/sass/lib/font-awesome.
Open Sans
=========
Website: https://www.google.com/fonts/specimen/Open+Sans
Version: 1
Author: Steve Matteson
License: Apache License, version 2.0
Open Sans is a humanist sans serif typeface designed by Steve
Matteson, Type Director of Ascender Corp. This version contains the
complete 897 character set, which includes the standard ISO Latin 1,
Latin CE, Greek and Cyrillic character sets. Open Sans was designed
with an upright stress, open forms and a neutral, yet friendly
appearance. It was optimized for print, web, and mobile interfaces,
and has excellent legibility characteristics in its letterforms.
Roboto Slab
===========
Website: https://www.google.com/fonts/specimen/Roboto+Slab
Version: 1
Author: Christian Robertson
License: Apache License, version 2.0
Roboto has a dual nature. It has a mechanical skeleton and the forms
are largely geometric. At the same time, the font features friendly
and open curves. While some grotesks distort their letterforms to
force a rigid rhythm, Roboto doesn’t compromise, allowing letters to
be settled into their natural width. This makes for a more natural
reading rhythm more commonly found in humanist and serif types.
Bootstrap Glyphicons Halflings
==============================
Website: http://getbootstrap.com/components/#glyphicons
Version: 1.9
License: MIT License
Includes over 250 glyphs in font format from the Glyphicon Halflings
set. Glyphicons Halflings are normally not available for free, but
their creator has made them available for Bootstrap free of cost.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.