Commit 5a72857a authored by Lisa Seeto's avatar Lisa Seeto Committed by Robert Lyon
Browse files

Bug 1817809: Add small logo to a theme



Added default mobile logo to theme.
It will change from light to dark version accordingly.

behatnotneeded

Change-Id: I0bfcdc93a159bad54cf974d3dc3993e22a2ba1eb
Signed-off-by: default avatarLisa Seeto <lisaseeto@catalyst.net.nz>
parent 988ef71e
......@@ -432,7 +432,7 @@ if ($institution || $add) {
// logo-xs
$elements['logoxs'] = array(
'type' => 'file',
'title' => get_string('Logosmall', 'admin'),
'title' => get_string('Logomobile', 'admin'),
'description' => get_string('logoxsdescription', 'admin'),
'maxfilesize' => get_max_upload_size(false),
);
......@@ -440,12 +440,12 @@ if ($institution || $add) {
$logoxsurl = get_config('wwwroot') . 'thumb.php?type=logobyid&id=' . $data->logoxs;
$elements['logoxshtml'] = array(
'type' => 'html',
'value' => '<img src="' . $logoxsurl . '" alt="' . get_string('Logosmall', 'admin') . '">',
'value' => '<img src="' . $logoxsurl . '" alt="' . get_string('Logomobile', 'admin') . '">',
);
$elements['deletelogoxs'] = array(
'type' => 'switchbox',
'title' => get_string('deletelogoxs', 'admin'),
'description' => get_string('deletelogoxsdescription2', 'admin'),
'title' => get_string('deletelogoxsmobile', 'admin'),
'description' => get_string('deletelogoxsdescription3', 'admin'),
);
}
......
......@@ -981,13 +981,13 @@ $string['licensedefaultdescription'] = 'The default license for content created
$string['licensedefaultmandatory'] = 'If users are required to choose a license, you need to choose a default license here. If you do not want to choose a default license, do not make it required for users.';
$string['Logo'] = 'Logo';
$string['Logosmall'] = 'Small logo';
$string['Logomobile'] = 'Mobile logo';
$string['logodescription1'] = 'You can upload an image here that will be displayed to your institution\'s members as logo for your theme. The logo will be resized to fit the space available.';
$string['logoxsdescription'] = 'You can upload a second logo that is to be used on small devices when there is not much space. The logo should be square for best results.';
$string['deletelogo'] = 'Delete logo';
$string['deletelogoxs'] = 'Delete small logo';
$string['deletelogoxsmobile'] = 'Delete mobile logo';
$string['deletelogodescription2'] = 'Revert to the standard header logo for your institution\'s theme.';
$string['deletelogoxsdescription2'] = 'Revert to the standard header small logo for your institution\'s theme.';
$string['deletelogoxsdescription3'] = 'Revert to the standard header mobile logo for your institution\'s theme.';
$string['customtheme'] = 'Custom theme configuration';
$string['customtheme.background'] = 'Header background';
$string['customtheme.backgroundfg'] = 'Text on header background';
......
......@@ -716,10 +716,11 @@ EOF;
$smarty->assign('sitelogocustom', $sitelogocustom);
$sitelogo = $THEME->header_logo();
$sitelogo = append_version_number($sitelogo);
$sitelogosmall = $THEME->header_logo_small();
$sitelogosmall = ($sitelogosmall ? append_version_number($sitelogosmall) : null);
$sitelogocustomsmall = $THEME->header_logo_small_custom();
$sitelogocustomsmall = ($sitelogocustomsmall ? append_version_number($sitelogocustomsmall) : null);
$smarty->assign('sitelogo', $sitelogo);
$smarty->assign('sitelogosmall', $sitelogosmall);
$smarty->assign('sitelogosmall', $THEME->header_logo_small());
$smarty->assign('sitelogocustomsmall', $sitelogocustomsmall);
$smarty->assign('sitelogo4facebook', $THEME->facebook_logo());
$smarty->assign('sitedescription4facebook', get_string('facebookdescription', 'mahara'));
......@@ -1290,11 +1291,16 @@ class Theme {
return $this->get_image_url('site-logo');
}
/* Set the default theme's small logo */
public function header_logo_small() {
return $this->get_image_url('site-logo-small');
}
/**
* Displaying of the small header logo of an institution
* false will be returned if no small logo for the institution or site small logo is found
*/
public function header_logo_small() {
public function header_logo_small_custom() {
if (!empty($this->headerlogosmall)) {
return get_config('wwwroot') . 'thumb.php?type=logobyid&id=' . $this->headerlogosmall;
}
......@@ -1302,8 +1308,8 @@ class Theme {
require_once('ddl.php');
$table = new XMLDBTable('institution');
$field = new XMLDBField('logoxs');
if (field_exists($table, $field) && $sitelogosmallid = get_field('institution', 'logoxs', 'name', 'mahara')) {
return get_config('wwwroot') . 'thumb.php?type=logobyid&id=' . $sitelogosmallid;
if (field_exists($table, $field) && $sitelogocustomsmallid = get_field('institution', 'logoxs', 'name', 'mahara')) {
return get_config('wwwroot') . 'thumb.php?type=logobyid&id=' . $sitelogocustomsmallid;
}
}
return false;
......
......@@ -216,7 +216,7 @@ jQuery(function($) {
/*
* Display appropriate Mahara logo depending on the header background.
*
* Return if user uploaded custom logo as we assume that the colour
* Return if user uploaded custom logo as we assume that's the colour
*/
function displayCorrectLogo() {
var headerBgColour = $('.navbar-default.navbar-main').css("background-color");
......@@ -234,6 +234,24 @@ jQuery(function($) {
}
}
/*
* Display appropriate Mahara mobile logo depending on the header background.
* Displays the default only if a custom logo hasn't been uploaded.
*/
function displayCorrectSmallLogo() {
var headerBgColour = $('.navbar-default.navbar-main').css("background-color");
var headerLogo = $('.header .logoxs > img');
if ($('.change-to-small-default').length > 0) {
if (isDark(headerBgColour)) {
headerLogo.attr('src', config.wwwroot + 'theme/raw/images/site-logo-small-light.svg');
}
else {
headerLogo.attr('src', config.wwwroot + 'theme/raw/images/site-logo-small-dark.svg');
}
}
}
$(window).on('resize colresize', function(){
carouselHeight();
initThumbnailMasonry();
......@@ -277,6 +295,7 @@ jQuery(function($) {
calculateObjectVideoAspectRatio();
responsiveObjectVideo();
displayCorrectLogo();
displayCorrectSmallLogo();
if ($('.js-dropdown-group').length > 0) {
attachInputDropdown();
......
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="full_color" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 49.6 49.6" style="enable-background:new 0 0 49.6 49.6;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<path class="st0" d="M25,36.4c0-6.8-5.8-14.5-6.3-14.2c-1.4,0.9,4,5.3,4,13.6c0,4.6-2.7,9.2-8.7,9.2c-5.9,0-10-3.7-10-9.4
C4,30.3,7.7,25,9.9,22.4c0.9,1.3,2.9,4.4,3.4,5.1c0.6,0.9,1.3,2.9-0.1,3.1c-2,0.3-2.1-2.9-2.2-3.8c0-0.3-0.5-0.4-0.7-0.1
c-0.6,1.1-1.1,4.6,0.8,6.2c1.3,1.1,3.7,1.2,4.7-1.4c1.5,2.6,1.9,5,2.1,6.6c0,0.3,0.4,0.3,0.5,0c0.9-5.3-1.6-9.1-2.4-10.7
c-0.8-1.7-4.3-6.5-4.9-7.5S8.9,16.1,8.9,13c0-4.6,3.8-9.1,4.5-9.1s4.7,3.7,4.7,9.2c0,2.1-0.5,3.6-1,4.7c-0.2,0.4-0.7,0.4-0.9,0
c-2.2-3.4-2.2-4.2-0.8-5.1c0.9-0.7-3.6-2.5-3.4,1.3c0.1,2,2.9,6.1,3.6,6.9c0.7,0.8,4.7-0.9,4.7-8.2s-6.2-12-7-12s-7,5.9-7,12.2
c0,3.1,1.1,5.7,2.4,7.8c-0.2,0.1-8,6.4-7.9,15.7c0.1,7.2,4.9,12.3,12.7,12.3C20.5,48.7,25,44,25,36.4z"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="full_color" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 49.6 49.6" style="enable-background:new 0 0 49.6 49.6;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<path class="st0" d="M25,36.4c0-6.8-5.8-14.5-6.3-14.2c-1.4,0.9,4,5.3,4,13.6c0,4.6-2.7,9.2-8.7,9.2c-5.9,0-10-3.7-10-9.4
C4,30.3,7.7,25,9.9,22.4c0.9,1.3,2.9,4.4,3.4,5.1c0.6,0.9,1.3,2.9-0.1,3.1c-2,0.3-2.1-2.9-2.2-3.8c0-0.3-0.5-0.4-0.7-0.1
c-0.6,1.1-1.1,4.6,0.8,6.2c1.3,1.1,3.7,1.2,4.7-1.4c1.5,2.6,1.9,5,2.1,6.6c0,0.3,0.4,0.3,0.5,0c0.9-5.3-1.6-9.1-2.4-10.7
c-0.8-1.7-4.3-6.5-4.9-7.5S8.9,16.1,8.9,13c0-4.6,3.8-9.1,4.5-9.1s4.7,3.7,4.7,9.2c0,2.1-0.5,3.6-1,4.7c-0.2,0.4-0.7,0.4-0.9,0
c-2.2-3.4-2.2-4.2-0.8-5.1c0.9-0.7-3.6-2.5-3.4,1.3c0.1,2,2.9,6.1,3.6,6.9c0.7,0.8,4.7-0.9,4.7-8.2s-6.2-12-7-12s-7,5.9-7,12.2
c0,3.1,1.1,5.7,2.4,7.8c-0.2,0.1-8,6.4-7.9,15.7c0.1,7.2,4.9,12.3,12.7,12.3C20.5,48.7,25,44,25,36.4z"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="full_color" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 49.6 49.6" style="enable-background:new 0 0 49.6 49.6;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<path class="st0" d="M25,36.4c0-6.8-5.8-14.5-6.3-14.2c-1.4,0.9,4,5.3,4,13.6c0,4.6-2.7,9.2-8.7,9.2c-5.9,0-10-3.7-10-9.4
C4,30.3,7.7,25,9.9,22.4c0.9,1.3,2.9,4.4,3.4,5.1c0.6,0.9,1.3,2.9-0.1,3.1c-2,0.3-2.1-2.9-2.2-3.8c0-0.3-0.5-0.4-0.7-0.1
c-0.6,1.1-1.1,4.6,0.8,6.2c1.3,1.1,3.7,1.2,4.7-1.4c1.5,2.6,1.9,5,2.1,6.6c0,0.3,0.4,0.3,0.5,0c0.9-5.3-1.6-9.1-2.4-10.7
c-0.8-1.7-4.3-6.5-4.9-7.5S8.9,16.1,8.9,13c0-4.6,3.8-9.1,4.5-9.1s4.7,3.7,4.7,9.2c0,2.1-0.5,3.6-1,4.7c-0.2,0.4-0.7,0.4-0.9,0
c-2.2-3.4-2.2-4.2-0.8-5.1c0.9-0.7-3.6-2.5-3.4,1.3c0.1,2,2.9,6.1,3.6,6.9c0.7,0.8,4.7-0.9,4.7-8.2s-6.2-12-7-12s-7,5.9-7,12.2
c0,3.1,1.1,5.7,2.4,7.8c-0.2,0.1-8,6.4-7.9,15.7c0.1,7.2,4.9,12.3,12.7,12.3C20.5,48.7,25,44,25,36.4z"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="full_color" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 49.6 49.6" style="enable-background:new 0 0 49.6 49.6;" xml:space="preserve">
<style type="text/css">
.st0{fill:#566D31;}
</style>
<path class="st0" d="M25,36.4c0-6.8-5.8-14.5-6.3-14.2c-1.4,0.9,4,5.3,4,13.6c0,4.6-2.7,9.2-8.7,9.2c-5.9,0-10-3.7-10-9.4
C4,30.3,7.7,25,9.9,22.4c0.9,1.3,2.9,4.4,3.4,5.1c0.6,0.9,1.3,2.9-0.1,3.1c-2,0.3-2.1-2.9-2.2-3.8c0-0.3-0.5-0.4-0.7-0.1
c-0.6,1.1-1.1,4.6,0.8,6.2c1.3,1.1,3.7,1.2,4.7-1.4c1.5,2.6,1.9,5,2.1,6.6c0,0.3,0.4,0.3,0.5,0c0.9-5.3-1.6-9.1-2.4-10.7
c-0.8-1.7-4.3-6.5-4.9-7.5S8.9,16.1,8.9,13c0-4.6,3.8-9.1,4.5-9.1s4.7,3.7,4.7,9.2c0,2.1-0.5,3.6-1,4.7c-0.2,0.4-0.7,0.4-0.9,0
c-2.2-3.4-2.2-4.2-0.8-5.1c0.9-0.7-3.6-2.5-3.4,1.3c0.1,2,2.9,6.1,3.6,6.9c0.7,0.8,4.7-0.9,4.7-8.2s-6.2-12-7-12s-7,5.9-7,12.2
c0,3.1,1.1,5.7,2.4,7.8c-0.2,0.1-8,6.4-7.9,15.7c0.1,7.2,4.9,12.3,12.7,12.3C20.5,48.7,25,44,25,36.4z"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="full_color" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 49.6 49.6" style="enable-background:new 0 0 49.6 49.6;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<path class="st0" d="M25,36.4c0-6.8-5.8-14.5-6.3-14.2c-1.4,0.9,4,5.3,4,13.6c0,4.6-2.7,9.2-8.7,9.2c-5.9,0-10-3.7-10-9.4
C4,30.3,7.7,25,9.9,22.4c0.9,1.3,2.9,4.4,3.4,5.1c0.6,0.9,1.3,2.9-0.1,3.1c-2,0.3-2.1-2.9-2.2-3.8c0-0.3-0.5-0.4-0.7-0.1
c-0.6,1.1-1.1,4.6,0.8,6.2c1.3,1.1,3.7,1.2,4.7-1.4c1.5,2.6,1.9,5,2.1,6.6c0,0.3,0.4,0.3,0.5,0c0.9-5.3-1.6-9.1-2.4-10.7
c-0.8-1.7-4.3-6.5-4.9-7.5S8.9,16.1,8.9,13c0-4.6,3.8-9.1,4.5-9.1s4.7,3.7,4.7,9.2c0,2.1-0.5,3.6-1,4.7c-0.2,0.4-0.7,0.4-0.9,0
c-2.2-3.4-2.2-4.2-0.8-5.1c0.9-0.7-3.6-2.5-3.4,1.3c0.1,2,2.9,6.1,3.6,6.9c0.7,0.8,4.7-0.9,4.7-8.2s-6.2-12-7-12s-7,5.9-7,12.2
c0,3.1,1.1,5.7,2.4,7.8c-0.2,0.1-8,6.4-7.9,15.7c0.1,7.2,4.9,12.3,12.7,12.3C20.5,48.7,25,44,25,36.4z"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="full_color" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 49.6 49.6" style="enable-background:new 0 0 49.6 49.6;" xml:space="preserve">
<style type="text/css">
.st0{fill:#566D31;}
</style>
<path class="st0" d="M25,36.4c0-6.8-5.8-14.5-6.3-14.2c-1.4,0.9,4,5.3,4,13.6c0,4.6-2.7,9.2-8.7,9.2c-5.9,0-10-3.7-10-9.4
C4,30.3,7.7,25,9.9,22.4c0.9,1.3,2.9,4.4,3.4,5.1c0.6,0.9,1.3,2.9-0.1,3.1c-2,0.3-2.1-2.9-2.2-3.8c0-0.3-0.5-0.4-0.7-0.1
c-0.6,1.1-1.1,4.6,0.8,6.2c1.3,1.1,3.7,1.2,4.7-1.4c1.5,2.6,1.9,5,2.1,6.6c0,0.3,0.4,0.3,0.5,0c0.9-5.3-1.6-9.1-2.4-10.7
c-0.8-1.7-4.3-6.5-4.9-7.5S8.9,16.1,8.9,13c0-4.6,3.8-9.1,4.5-9.1s4.7,3.7,4.7,9.2c0,2.1-0.5,3.6-1,4.7c-0.2,0.4-0.7,0.4-0.9,0
c-2.2-3.4-2.2-4.2-0.8-5.1c0.9-0.7-3.6-2.5-3.4,1.3c0.1,2,2.9,6.1,3.6,6.9c0.7,0.8,4.7-0.9,4.7-8.2s-6.2-12-7-12s-7,5.9-7,12.2
c0,3.1,1.1,5.7,2.4,7.8c-0.2,0.1-8,6.4-7.9,15.7c0.1,7.2,4.9,12.3,12.7,12.3C20.5,48.7,25,44,25,36.4z"/>
</svg>
......@@ -49,11 +49,16 @@
<div class="navbar navbar-default navbar-main">
<div class="container">
<div id="logo-area" class="logo-area">
<a href="{$WWWROOT}" class="logo {if $sitelogosmall}change-to-small{/if} ">
<img src="{$sitelogo}" alt="{$sitename}" data-customlogo="{$sitelogocustom}">
<a href="{$WWWROOT}" class="logo {if $sitelogocustomsmall || (!$sitelogocustomsmall && !$sitelogocustom)}change-to-small{/if}">
<img src="{$sitelogo}" alt="{$sitename}" data-customlogo="{$sitelogocustom}" >
</a>
{if $sitelogosmall}
{if $sitelogocustomsmall}
<a href="{$WWWROOT}" class="logoxs">
<img src="{$sitelogocustomsmall}" alt="{$sitename}">
</a>
{/if}
{if !$sitelogocustom && !$sitelogocustomsmall}
<a href="{$WWWROOT}" class="logoxs change-to-small-default">
<img src="{$sitelogosmall}" alt="{$sitename}">
</a>
{/if}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment