From c985d1217cd046f0d78bf1f1d1d5a220f45b299e Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Wed, 3 Apr 2013 09:41:33 +0800 Subject: [PATCH] MDL-38016 Theme Bootstrap - Add license information to lib/thirdpartylibs.xml Also minor formatting cleanup. --- lib/thirdpartylibs.xml | 35 +++++++++++++++++++ theme/bootstrap/README.txt | 4 +-- theme/bootstrap/config.php | 3 +- theme/bootstrap/javascript/headercollapse.js | 2 +- theme/bootstrap/javascript/moodlebootstrap.js | 3 +- theme/bootstrap/less/editor.less | 22 ++++++------ theme/bootstrap/less/moodle.less | 23 ++++++------ theme/bootstrap/readme_moodle.txt | 10 +++--- theme/bootstrap/renderers/core.php | 22 +++++++----- theme/bootstrap/version.php | 4 +-- 10 files changed, 82 insertions(+), 46 deletions(-) diff --git a/lib/thirdpartylibs.xml b/lib/thirdpartylibs.xml index 9d5ebfaa2f0..8693e652cb1 100644 --- a/lib/thirdpartylibs.xml +++ b/lib/thirdpartylibs.xml @@ -273,4 +273,39 @@ 1.0 3.0+ + + theme/bootstrap/less/bootstrap + Twitter Bootstrap + Apache + 2.3.0 + 2.0 + + + theme/bootstrap/javascript/html5shiv.js + Html5Shiv + Apache + 3.6.2 + 2.0 + + + theme/bootstrap/javascript/bootstrapcollapse.js + Gallery Bootstrap Collapse + BSD + 2012.08.22-20-00 + + + + theme/bootstrap/javascript/bootstrapdropdown.js + Gallery Bootstrap Dropdown + BSD + 2012.08.22-20-00 + + + + theme/bootstrap/javascript/bootstrapengine.js + Gallery Bootstrap Engine + BSD + 2012.08.22-20-00 + + diff --git a/theme/bootstrap/README.txt b/theme/bootstrap/README.txt index e74a2017ea0..cec1b21e5ee 100644 --- a/theme/bootstrap/README.txt +++ b/theme/bootstrap/README.txt @@ -51,7 +51,6 @@ headercollapse.js Workaround for the collapse button on the Moodle custom menu. Without this Submenu items cannot be opened - Updating Twitter bootstrap and Libraries ======================================== @@ -96,7 +95,6 @@ javascript/bootstrap-collapse.js javascript/bootstrap-dropdown.js javascript/bootstrap-engine.js - Licenses & Authors ================== @@ -148,4 +146,4 @@ limitations under the License. moodlebootstrap.js ------------------ Author: 2013 Bas Brands. www.sonsbeekmedia.nl -license: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later \ No newline at end of file +license: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later diff --git a/theme/bootstrap/config.php b/theme/bootstrap/config.php index 586b499dc53..636fa2eba7e 100644 --- a/theme/bootstrap/config.php +++ b/theme/bootstrap/config.php @@ -38,7 +38,6 @@ $THEME->supportscssoptimisation = false; $THEME->editor_sheets = array('editor'); - $THEME->plugins_exclude_sheets = array( 'block' => array( 'settings', @@ -160,7 +159,7 @@ $THEME->javascripts = array( 'headercollapse', ); -if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 8') || strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') ) { +if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 8') || strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7')) { $THEME->javascripts[] = 'html5shiv'; } diff --git a/theme/bootstrap/javascript/headercollapse.js b/theme/bootstrap/javascript/headercollapse.js index 77ca49f67dd..488d43e3c94 100644 --- a/theme/bootstrap/javascript/headercollapse.js +++ b/theme/bootstrap/javascript/headercollapse.js @@ -7,4 +7,4 @@ YUI().use('node', function(Y) { this.toggleClass('active'); }; Y.delegate('click', toggleShow, Y.config.doc, '.btn-navbar'); -}); \ No newline at end of file +}); diff --git a/theme/bootstrap/javascript/moodlebootstrap.js b/theme/bootstrap/javascript/moodlebootstrap.js index baba3cd463d..85724f89629 100644 --- a/theme/bootstrap/javascript/moodlebootstrap.js +++ b/theme/bootstrap/javascript/moodlebootstrap.js @@ -5,7 +5,6 @@ YUI.add('gallery-bootstrap', function(Y) { var NS = Y.namespace('Bootstrap'); NS.initializer = function(e) { - //console.log('initializer!'); NS.dropdown_delegation(); NS.expandable_delegation(); }; @@ -25,4 +24,4 @@ NS.expandable_delegation = function() { Y.on('domready', NS.initializer); }, '@VERSION@' ,{requires:[ 'gallery-bootstrap-dropdown', 'gallery-bootstrap-collapse', 'gallery-bootstrap-engine']}); -; \ No newline at end of file +; diff --git a/theme/bootstrap/less/editor.less b/theme/bootstrap/less/editor.less index 7ac34d4b0bd..53a758bb0af 100644 --- a/theme/bootstrap/less/editor.less +++ b/theme/bootstrap/less/editor.less @@ -1,30 +1,30 @@ -// strip down core bootstrap for editor +// Strip down core bootstrap for editor. -// Core variables and mixins -@import "bootstrap/variables.less"; // Modify this for custom colors, font-sizes, etc +// Core variables and mixins. +@import "bootstrap/variables.less"; // Modify this for custom colors, font-sizes, etc. @import "bootstrap/mixins.less"; -// CSS Reset +// CSS Reset. @import "bootstrap/reset.less"; -// Base CSS +// Base CSS. @import "bootstrap/type.less"; @import "bootstrap/code.less"; @import "bootstrap/tables.less"; -// Components: common +// Components: common. @import "bootstrap/sprites.less"; @iconSpritePath: ~"[[pix:theme|glyphicons-halflings]]"; @iconWhiteSpritePath: ~"[[pix:theme|glyphicons-halflings-white]]"; @import "bootstrap/wells.less"; -// Components: Buttons & Alerts +// Components: Buttons & Alerts. @import "bootstrap/buttons.less"; -@import "bootstrap/alerts.less"; // Note: alerts share common CSS with buttons and thus have styles in buttons.less +@import "bootstrap/alerts.less"; // Note: alerts share common CSS with buttons and thus have styles in buttons.less. -// Components: Misc +// Components: Misc. @import "bootstrap/thumbnails.less"; @import "bootstrap/labels-badges.less"; -// Utility classes -@import "bootstrap/utilities.less"; // Has to be last to override when necessary +// Utility classes. +@import "bootstrap/utilities.less"; // Has to be last to override when necessary. diff --git a/theme/bootstrap/less/moodle.less b/theme/bootstrap/less/moodle.less index d6df8d3b7e9..66ddf68267e 100644 --- a/theme/bootstrap/less/moodle.less +++ b/theme/bootstrap/less/moodle.less @@ -1,5 +1,6 @@ // Old Moodle stuff from base theme. -@import "moodle/core"; // Massive, needs broken up +// Massive, needs broken up. +@import "moodle/core"; @import "moodle/admin"; @import "moodle/calendar"; @import "moodle/course"; @@ -10,24 +11,24 @@ @import "moodle/user"; -// Upstream Bootstrap +// Upstream Bootstrap. @import "bootstrap/bootstrap"; -// Set image location +// Set image location. @iconSpritePath: ~"[[pix:theme|glyphicons-halflings]]"; @iconWhiteSpritePath: ~"[[pix:theme|glyphicons-halflings-white]]"; -// Roll back nameclashes +// Roll back nameclashes. @import "moodle/undo"; -// extra padding for fixed nav -// needs to be between bootstrap/bootstrap and -// bootstrap/responsive +// Extra padding for fixed nav. +// Needs to be between bootstrap/bootstrap and +// bootstrap/responsive. body { padding-top: 60px; } -// New Moodle stuff that builds on Bootstrap +// New Moodle stuff that builds on Bootstrap. @import "moodle/blocks"; @import "moodle/forms"; @import "moodle/tabs"; @@ -36,14 +37,14 @@ body { @import "moodle/tables"; @import "moodle/buttons"; -// anything below this line is considered expendable, +// Anything below this line is considered expendable, // so it doesn't matter if it doesn't show up in ie < 9 // though at current time (2013-03-13) the whole file is // picked up in IE8, and IE9 fails at some point during the // responsive section, cutting off the last 400 selectors. -// the following responsive imports are copied in -// from @import "bootstrap/responsive"; +// The following responsive imports are copied in +// from "bootstrap/responsive". @import "bootstrap/responsive-utilities.less"; @import "bootstrap/responsive-1200px-min.less"; @import "bootstrap/responsive-768px-979px.less"; diff --git a/theme/bootstrap/readme_moodle.txt b/theme/bootstrap/readme_moodle.txt index 9fe5265ef5b..6b0bb200666 100644 --- a/theme/bootstrap/readme_moodle.txt +++ b/theme/bootstrap/readme_moodle.txt @@ -11,6 +11,7 @@ To update to the latest release of twitter bootstrap: * remove all files from less/bootstrap, * download the new less files and store them in less/bootstrap * regenerate files using recess: recess --compile --compress moodle.less > ../style/generated.css ** +* update lib/thirdpartylibs.xml ** If you want to make changes to the .css generated from these .less files then you need to install recess (https://github.com/twitter/recess) to compile the .less files, @@ -24,12 +25,13 @@ This library is available on: https://github.com/aFarkas/html5shiv/blob/master/src/html5shiv.js -To update to the latest release of html5shiv download and replace: -javascript/html5shiv.js +To update to the latest release of html5shiv: +* download and replace: javascript/html5shiv.js +* update lib/thirdpartylibs.xml bootstrapcollapse.js, bootstrapdropdown.js, bootstrapengine.js -------------------------------------------------------------- -This them uses YUI ports of the Twitter bootstrap jQuery based libs. These ported files are available on: +This theme uses YUI ports of the Twitter bootstrap jQuery based libs. These ported files are available on: https://github.com/jshirley/yui3-gallery/blob/master/src/gallery-bootstrap-collapse/js/bootstrap-collapse.js https://github.com/jshirley/yui3-gallery/blob/master/src/gallery-bootstrap-dropdown/js/bootstrap-dropdown.js @@ -44,4 +46,4 @@ functionality consider switching to the original jQuery version of these file If you do want to update use these file locations: javascript/bootstrap-collapse.js javascript/bootstrap-dropdown.js -javascript/bootstrap-engine.js \ No newline at end of file +javascript/bootstrap-engine.js diff --git a/theme/bootstrap/renderers/core.php b/theme/bootstrap/renderers/core.php index ec18d5a0827..459925f8d4c 100644 --- a/theme/bootstrap/renderers/core.php +++ b/theme/bootstrap/renderers/core.php @@ -22,9 +22,12 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - class theme_bootstrap_core_renderer extends core_renderer { + /* + * This renders a notification message. + * Uses bootstrap compatible html. + */ public function notification($message, $classes = 'notifyproblem') { $message = clean_text($message); $type = ''; @@ -44,6 +47,10 @@ class theme_bootstrap_core_renderer extends core_renderer { return "
$message
"; } + /* + * This renders the navbar. + * Uses bootstrap compatible html. + */ public function navbar() { $items = $this->page->navbar->get_items(); foreach ($items as $item) { @@ -55,11 +62,12 @@ class theme_bootstrap_core_renderer extends core_renderer { $title = ''.get_string('pagepath').''; return $title . ""; } + /* * Overriding the custom_menu function ensures the custom menu is * always shown, even if no menu items are configured in the global * theme settings page. - * We use the sitename as the first menu item + * We use the sitename as the first menu item. */ public function custom_menu($custommenuitems = '') { global $CFG; @@ -71,14 +79,11 @@ class theme_bootstrap_core_renderer extends core_renderer { return $this->render_custom_menu($custommenu); } - /* - * This renders the bootstrap top menu - * - * This renderer is needed to enable the Bootstrap style navigation + * This renders the bootstrap top menu. * + * This renderer is needed to enable the Bootstrap style navigation. */ - protected function render_custom_menu(custom_menu $menu) { // If the menu has no children return an empty string. if (!$menu->has_children()) { @@ -112,9 +117,8 @@ class theme_bootstrap_core_renderer extends core_renderer { /* * This code renders the custom menu items for the - * bootstrap dropdown menu + * bootstrap dropdown menu. */ - protected function render_custom_menu_item(custom_menu_item $menunode, $level = 0 ) { static $submenucount = 0; diff --git a/theme/bootstrap/version.php b/theme/bootstrap/version.php index 65fc02c854a..773ff81b8e3 100644 --- a/theme/bootstrap/version.php +++ b/theme/bootstrap/version.php @@ -27,7 +27,5 @@ defined('MOODLE_INTERNAL') || die; $plugin->version = 2013032800; -$plugin->requires = 2012110900; -$plugin->maturity = MATURITY_STABLE; -$plugin->release = '2.0 (Build: 2013032800)'; +$plugin->requires = 2012112900; $plugin->component = 'theme_bootstrap';