MDL-50661 theme_more: New small logo setting
authorDavid Monllao <davidm@moodle.com>
Wed, 11 Nov 2015 07:34:19 +0000 (15:34 +0800)
committerDavid Monllao <davidm@moodle.com>
Mon, 30 Nov 2015 01:14:22 +0000 (09:14 +0800)
Adding required bits so theme_more can also set a small logo.

theme/more/lang/en/theme_more.php
theme/more/lib.php
theme/more/settings.php
theme/more/style/custom.css
theme/more/version.php

index 69a4583..2653cf7 100644 (file)
@@ -72,6 +72,11 @@ $string['region-side-post'] = 'Right';
 $string['region-side-pre'] = 'Left';
 $string['secondarybackground'] = 'Secondary background colour';
 $string['secondarybackground_desc'] = 'The background colour of any secondary content, such as blocks.';
+$string['sitelogo'] = 'Site logo';
+$string['sitename'] = 'Display site name along with small logo';
+$string['sitenamedesc'] = 'This setting is only applied if a "Small logo" is set. If no small logo is set the site name is always displayed in the navigation bar, but if it is you can use this setting to display it or not.';
+$string['smalllogo'] = 'Small logo';
+$string['smalllogodesc'] = 'This logo is displayed in the navbar next to the site name, if a "Logo" is set, then it is only displayed on the pages where the logo is not displayed.';
 $string['textcolor'] = 'Text colour';
 $string['textcolor_desc'] = 'The colour of the text.';
 
index 0e8017f..b1f6f45 100644 (file)
@@ -147,7 +147,8 @@ function theme_more_set_logo($css, $logo) {
  * @return bool
  */
 function theme_more_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
-    if ($context->contextlevel == CONTEXT_SYSTEM && ($filearea === 'logo' || $filearea === 'backgroundimage')) {
+    if ($context->contextlevel == CONTEXT_SYSTEM &&
+            ($filearea === 'logo' || $filearea === 'smalllogo' || $filearea === 'backgroundimage')) {
         $theme = theme_config::load('more');
         // By default, theme files must be cache-able by both browsers and proxies.
         if (!array_key_exists('cacheability', $options)) {
index 8b41c30..69c800f 100644 (file)
@@ -149,6 +149,22 @@ if ($ADMIN->fulltree) {
     $setting->set_updatedcallback('theme_reset_all_caches');
     $settings->add($setting);
 
+    // Small logo file setting.
+    $name = 'theme_more/smalllogo';
+    $title = get_string('smalllogo', 'theme_more');
+    $description = get_string('smalllogodesc', 'theme_more');
+    $setting = new admin_setting_configstoredfile($name, $title, $description, 'smalllogo');
+    $setting->set_updatedcallback('theme_reset_all_caches');
+    $settings->add($setting);
+
+    // Show site name along with small logo.
+    $name = 'theme_more/sitename';
+    $title = get_string('sitename', 'theme_more');
+    $description = get_string('sitenamedesc', 'theme_more');
+    $setting = new admin_setting_configcheckbox($name, $title, $description, 1);
+    $setting->set_updatedcallback('theme_reset_all_caches');
+    $settings->add($setting);
+
     // Custom CSS file.
     $name = 'theme_more/customcss';
     $title = get_string('customcss', 'theme_more');
index bb4cc68..b8d37a0 100644 (file)
@@ -16,6 +16,37 @@ div.logo {
     float: right;
 }
 
+img.small-logo {
+    float: left;
+    height: 35px;
+    margin: 3px 10px 3px 0;
+}
+
+.dir-rtl img.small-logo {
+    float: right;
+    margin: 3px 0 3px 10px;
+}
+
+@media (max-width: 767px) {
+    .dir-rtl img.small-logo,
+    img.small-logo {
+        margin: 3px;
+    }
+}
+
+@media (max-width: 480px) {
+    .navbar img.small-logo {
+        max-width: 150px;
+    }
+    /* Applying accesshide styles */
+    .navbar .small-logo-container + .brand {
+        position: absolute;
+        left: -10000px;
+        font-size: 1em;
+        font-weight: normal;
+    }
+}
+
 /* Custom CSS Settings
 -------------------------*/
 [[setting:customcss]]
index 13ea56f..22f3624 100644 (file)
 
 defined('MOODLE_INTERNAL') || die;
 
-$plugin->version   = 2015111600;
+$plugin->version   = 2015111601;
 $plugin->requires  = 2015111000;
 $plugin->component = 'theme_more';
 $plugin->dependencies = array(
     'theme_bootstrapbase'  => 2015111000,
-    'theme_clean'  => 2015111000,
+    'theme_clean'  => 2015111601,
 );