Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'MDL-34119_M23' of git://github.com/lazydaisy/moodle int…

…o MOODLE_23_STABLE
  • Loading branch information...
commit 4fa4a727b4d41fa225597c2aa99ba06708f86b89 2 parents 4be7107 + 3705a88
@stronk7 stronk7 authored
View
38 theme/splash/config.php
@@ -33,10 +33,10 @@
'pagelayout',
'core',
'menus',
- 'red',
- 'green',
- 'blue',
'orange',
+ 'blue',
+ 'green',
+ 'red',
'settings',
);
@@ -53,48 +53,57 @@
'standard' => array(
'file' => 'general.php',
'regions' => array('side-pre', 'side-post'),
- 'defaultregion' => 'side-pre'
+ 'defaultregion' => 'side-pre',
+ 'options' => array('langmenu'=>true),
),
// Course page
'course' => array(
'file' => 'general.php',
'regions' => array('side-pre', 'side-post'),
- 'defaultregion' => 'side-pre'
+ 'defaultregion' => 'side-pre',
+ 'options' => array('langmenu'=>true),
),
// Course page
'coursecategory' => array(
'file' => 'general.php',
'regions' => array('side-pre', 'side-post'),
- 'defaultregion' => 'side-pre'
+ 'defaultregion' => 'side-pre',
+ 'options' => array('langmenu'=>true),
),
'incourse' => array(
'file' => 'general.php',
'regions' => array('side-pre', 'side-post'),
- 'defaultregion' => 'side-pre'
+ 'defaultregion' => 'side-pre',
+ 'options' => array('langmenu'=>true),
),
'frontpage' => array(
'file' => 'general.php',
'regions' => array('side-pre', 'side-post'),
- 'defaultregion' => 'side-pre'
+ 'defaultregion' => 'side-pre',
+ 'options' => array('langmenu'=>true),
),
'admin' => array(
'file' => 'general.php',
'regions' => array('side-pre'),
- 'defaultregion' => 'side-pre'
+ 'defaultregion' => 'side-pre',
+ 'options' => array('langmenu'=>true),
),
'mydashboard' => array(
'file' => 'general.php',
'regions' => array('side-pre', 'side-post'),
- 'defaultregion' => 'side-pre'
+ 'defaultregion' => 'side-pre',
+ 'options' => array('langmenu'=>true),
),
'mypublic' => array(
'file' => 'general.php',
'regions' => array('side-pre', 'side-post'),
- 'defaultregion' => 'side-pre'
+ 'defaultregion' => 'side-pre',
+ 'options' => array('langmenu'=>true),
),
'login' => array(
'file' => 'general.php',
- 'regions' => array()
+ 'regions' => array(),
+ 'options' => array('langmenu'=>true),
),
// Pages that appear in pop-up windows - no navigation, no blocks, no header.
'popup' => array(
@@ -137,8 +146,11 @@
'report' => array(
'file' => 'report.php',
'regions' => array('side-pre'),
- 'defaultregion' => 'side-pre'
+ 'defaultregion' => 'side-pre',
+ 'options' => array('langmenu'=>true),
),
);
$THEME->csspostprocess = 'splash_process_css';
+
+$THEME->javascripts = array('colourswitcher');
View
63 theme/splash/javascript/colourswitcher.js
@@ -0,0 +1,63 @@
+YUI.add('moodle-theme_splash-colourswitcher', function(Y) {
+
+// Available colours
+var COLOURS = ['red','green','blue','orange'];
+
+/**
+ * Splash theme colour switcher class.
+ * Initialise this class by calling M.theme_splash.init
+ */
+var ColourSwitcher = function() {
+ ColourSwitcher.superclass.constructor.apply(this, arguments);
+};
+ColourSwitcher.prototype = {
+ /**
+ * Constructor for this class
+ * @param {object} config
+ */
+ initializer : function(config) {
+ var i, c;
+ // Attach events to the links to change colours so we can do it with
+ // JavaScript without refreshing the page
+ for (i in COLOURS) {
+ c = COLOURS[i];
+ // Check if this is the current colour
+ if (Y.one(document.body).hasClass('splash-'+c)) {
+ this.set('colour', c);
+ }
+ Y.all(config.div+' .colour-'+c).on('click', this.setColour, this, c);
+ }
+ },
+ /**
+ * Sets the colour being used for the splash theme
+ * @param {Y.Event} e The event that fired
+ * @param {string} colour The new colour
+ */
+ setColour : function(e, colour) {
+ // Prevent the event from refreshing the page
+ e.preventDefault();
+ // Switch over the CSS classes on the body
+ Y.one(document.body).replaceClass('splash-'+this.get('colour'), 'splash-'+colour);
+ // Update the current colour
+ this.set('colour', colour);
+ // Store the users selection (Uses AJAX to save to the database)
+ M.util.set_user_preference('theme_splash_chosen_colour', colour);
+ }
+};
+// Make the colour switcher a fully fledged YUI module
+Y.extend(ColourSwitcher, Y.Base, ColourSwitcher.prototype, {
+ NAME : 'Splash theme colour switcher',
+ ATTRS : {
+ colour : {
+ value : 'red'
+ }
+ }
+});
+// Our splash theme namespace
+M.theme_splash = M.theme_splash || {};
+// Initialisation function for the colour switcher
+M.theme_splash.initColourSwitcher = function(cfg) {
+ return new ColourSwitcher(cfg);
+}
+
+}, '@VERSION@', {requires:['base','node']});
View
7 theme/splash/layout/general.php
@@ -107,7 +107,12 @@ class="styleswitch colour-orange"><img src="<?php echo $OUTPUT->pix_url('orange-
alt="orange" /></a></li>
</ul>
</div>
- <?php echo $OUTPUT->lang_menu();?>
+ <?php
+ if (!empty($PAGE->layout_options['langmenu'])) {
+ echo $OUTPUT->lang_menu();
+ }
+ echo $PAGE->headingmenu
+ ?>
</div>
<div id="logobox">
<?php
View
7 theme/splash/layout/report.php
@@ -107,7 +107,12 @@ class="styleswitch colour-orange"><img src="<?php echo $OUTPUT->pix_url('orange-
alt="orange" /></a></li>
</ul>
</div>
- <?php echo $OUTPUT->lang_menu();?>
+ <?php
+ if (!empty($PAGE->layout_options['langmenu'])) {
+ echo $OUTPUT->lang_menu();
+ }
+ echo $PAGE->headingmenu
+ ?>
</div>
<div id="logobox">
<?php
View
6 theme/splash/lib.php
@@ -90,12 +90,14 @@ function splash_set_customcss($css, $customcss) {
/**
* Adds the JavaScript for the colour switcher to the page.
*
+ * The colour switcher is a YUI moodle module that is located in
+ * theme/splash/yui/splash/splash.js
+ *
* @param moodle_page $page
*/
function splash_initialise_colourswitcher(moodle_page $page) {
user_preference_allow_ajax_update('theme_splash_chosen_colour', PARAM_ALPHA);
- $page->requires->yui_module('moodle-theme_splash-colourswitcher',
- 'M.theme_splash.initColourSwitcher', array(array('div'=>'#colourswitcher')));
+ $page->requires->yui_module('moodle-theme_splash-colourswitcher', 'M.theme_splash.initColourSwitcher', array(array('div'=>'#colourswitcher')));
}
/**
View
3  theme/splash/style/pagelayout.css
@@ -199,7 +199,6 @@ p.prolog a:link {
margin:10px 0 0 15px;
}
.logininfo{
- background:url([[pix:theme|loginicon]]) left no-repeat;
color:#fff;
margin:0;
padding:10px 10px 10px 40px;
@@ -213,7 +212,7 @@ p.prolog a:link {
}
#headermenu .langmenu{
position:relative;
- top:35px;
+ top:30px;
width:210px;
}
a,
Please sign in to comment.
Something went wrong with that request. Please try again.