diff --git a/Gruntfile.js b/Gruntfile.js index 7ad5e691..8f2cdc83 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -99,7 +99,7 @@ * * @package theme * @subpackage essential - * @author G J Barnard - gjbarnard at gmail dot com and {@link http://moodle.org/user/profile.php?id=442195} + * @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195} * @author Based on code originally written by Joby Harding, Bas Brands, David Scotson and many other contributors. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/README.txt b/README.txt index 1a580874..a7e74081 100644 --- a/README.txt +++ b/README.txt @@ -14,66 +14,65 @@ on sites where Moodle would potentially serve as a company homepage rather than Cool things to know about the theme. - It attempts to load as many as possible icons from a font - - Most of what you think are "graphics" are actually the [Awesome font](http://fortawesome.github.io/Font-Awesome/) + - Most of what you think are "graphics" are actually the [Awesome font](fontawesome.io) - The slider on the front page is completely customisable through theme settings. - - I am really trying to push what [Bootstrap](http://twitter.github.io/bootstrap/) Grids can do. As such the theme is fully + - I am really trying to push what [Bootstrap](twitter.github.io/bootstrap/) Grids can do. As such the theme is fully responsive. - The footer is all custom Moodle regions. This means blocks can be added. - - The theme can use [Google web fonts](http://www.google.com/fonts/) to give it that extra bit of shazam! + - The theme can use [Google web fonts](fonts.google.com) to give it that extra bit of shazam! - Social network icons appear at the top of the page dynamically based on theme settings. - The entire colour scheme can be modified with theme settings. Developed and maintained by =========================== Gareth J Barnard MSc. BSc(Hons)(Sndw). MBCS. CEng. CITP. PGCE. -Moodle profile | http://moodle.org/user/profile.php?id=442195 -Web profile | http://about.me/gjbarnard +Moodle profile: moodle.org/user/profile.php?id=442195 +Web profile: about.me/gjbarnard Original Developer ================== Julian Ridden -Moodle profile: https://moodle.org/user/profile.php?id=39680 -Web profile: http://au.linkedin.com/in/eduridden/ +Moodle profile: moodle.org/user/profile.php?id=39680 +Web profile: au.linkedin.com/in/eduridden/ Previous Developer ================== David Bezemer -Moodle profile | https://moodle.org/user/profile.php?id=1416592 -Web profile | http://www.davidbezemer.nl +Moodle profile: moodle.org/user/profile.php?id=1416592 +Web profile: www.davidbezemer.nl Free Software ============= The Essential theme is 'free' software under the terms of the GNU GPLv3 License, please see 'COPYING.txt'. It can be obtained for free from: -http://moodle.org/plugins/view.php?plugin=theme_essential +moodle.org/plugins/view.php?plugin=theme_essential and -https://github.com/gjb2048/moodle-theme_essential/releases +github.com/gjb2048/moodle-theme_essential/releases You have all the rights granted to you by the GPLv3 license. If you are unsure about anything, then the -FAQ - http://www.gnu.org/licenses/gpl-faq.html - is a good place to look. +FAQ - www.gnu.org/licenses/gpl-faq.html - is a good place to look. If you reuse any of the code then I kindly ask that you make reference to the theme. If you make improvements or bug fixes then I would appreciate if you would send them back to me by forking from -https://github.com/gjb2048/moodle-theme_essential and doing a 'Pull Request' so that the rest of the -Moodle community benefits. +github.com/gjb2048/moodle-theme_essential and doing a 'Pull Request' so that the rest of the Moodle community benefits. Support ======= As Essential is licensed under the GNU GPLv3 License it comes with NO support. If you would like support from -me (Gareth) then I'm happy to provide it for a fee (please see my contact details above). Otherwise, the 'Themes' forum: -moodle.org/mod/forum/view.php?id=46 is an excellent place to ask questions. +me (Gareth) then I'm happy to provide it for a fee. Please contact me via my 'Moodle profile' in 'Developed and maintained by' +above. Otherwise, the 'Themes' forum: moodle.org/mod/forum/view.php?id=46 is an alternative. Sponsorships ============ This theme is provided to you for free, and if you want to express your gratitude for using this theme, please consider sponsoring by: -PayPal - Please contact me (Gareth) via my 'Moodle profile' (above) for details as I am an individual and therefore am unable to have -'buy me now' buttons under their terms. +PayPal - Please contact me (Gareth) via my 'Moodle profile' in 'Developed and maintained by' above for details as I am an individual +and therefore am unable to have 'buy me now' buttons under their terms. -Flattr - https://flattr.com/profile/gjb2048 +Flattr - flattr.com/profile/gjb2048 Sponsorships help to facilitate maintenance and allow me to provide you with more and better features. Without your support the theme cannot be maintained. @@ -112,8 +111,8 @@ Toshimi Hatanaka Customisation ============= If you like this theme and would like me to customise it, transpose functionality to another theme, build a new theme from scratch -or create a child theme then I offer competitive rates. Please contact me via 'www.gjbarnard.co.uk/contact/' or -'gjbarnard at gmail dot com' or 'about.me/gjbarnard' to discuss your requirements. +or create a child theme then I offer competitive rates. Please contact me via my 'Moodle profile' in 'Developed and maintained by' +above to discuss your requirements. Required version of Moodle ========================== @@ -176,25 +175,18 @@ to do so: CSlider ======= -The original version of Essential used 'CSlider' - - http://tympanus.net/codrops/2012/03/15/parallax-content-slider-with-css3-and-jquery/. +The original version of Essential used 'CSlider' - tympanus.net/codrops/2012/03/15/parallax-content-slider-with-css3-and-jquery/. -It has been removed because of licencing issues: https://github.com/gjb2048/moodle-theme_essential/issues/61 +It has been removed because of licencing issues: github.com/gjb2048/moodle-theme_essential/issues/61 Please do not request that it be put back. The licence that CSlider has is incompatible with GPLv3 and therefore cannot be a part of or redistributed with the theme. Videos and FitVids ================== -Essential uses FitVids.js - http://fitvidsjs.com/ - to make embedded videos responsive. If you do not want this feature for a +Essential uses FitVids.js - fitvidsjs.com - to make embedded videos responsive. If you do not want this feature for a particular video, then please add the class 'fitvidsignore' to the video element. -WOFF2 Font Support -================== -WOFF2 font support will automatically kick in if you are running Moodle 2.8.5+ (Build: 20150313) - 2014111005.01 or above. If you -are and the settings do not appear on the font setting page when using 'Custom font' for 'fontselect', then perform a -'Purge all caches'. - Category course title image in a course ======================================= If you wish to override the category course title image in a course when this is enabled, then edit the course summary in the course @@ -203,7 +195,7 @@ settings and add an image. Then edit in HTML mode, remove the surrounding 'p' t the height (px) and the contained title text colour, background colour and opacity, use the following attributes: 'ctih', 'ctit', 'ctib' and ctio respectively, for example: - This image will not be shown in the summary itself when viewing the list of courses. @@ -215,8 +207,7 @@ that you are operating the required version of Moodle as stated at the top - thi functionality that is out of its control. When reporting an issue you can post in the theme's forum on Moodle.org (currently 'moodle.org/mod/forum/view.php?id=46') -or check the issue list https://github.com/gjb2048/moodle-theme_essential/issues and if the problem does not exist, create an -issue. +or check the issue list github.com/gjb2048/moodle-theme_essential/issues and if the problem does not exist, create an issue. It is essential that you provide as much information as possible, the critical information being the contents of the theme's 'version.php' file. Other version information such as specific Moodle version, theme name and version also helps. A screen shot @@ -228,9 +219,9 @@ Please look in CHANGES.txt. See the theme in Action ======================= -A video showing many of the core features is available for viewing at https://www.youtube.com/watch?v=grhmR5PmWtA +A video showing many of the core features is available for viewing at www.youtube.com/watch?v=grhmR5PmWtA Documentation ============= -As always, documentation is a work in progress. Available documentation is available at http://docs.moodle.org/31/en/Essential_theme -If you have questions you can post them in the issue tracker at https://github.com/gjb2048/moodle-theme_essential/issues \ No newline at end of file +As always, documentation is a work in progress. Available documentation is available at docs.moodle.org/31/en/Essential_theme +If you have questions you can post them in the issue tracker at github.com/gjb2048/moodle-theme_essential/issues \ No newline at end of file diff --git a/classes/toolbox.php b/classes/toolbox.php index 8abc2f15..93e341b7 100644 --- a/classes/toolbox.php +++ b/classes/toolbox.php @@ -832,6 +832,14 @@ static public function compile_properties($themename, $array = true) { if ($array) { $props['moodle_version'] = $CFG->version; + // Put the theme version next so that it will be at the top of the table. + foreach ($themeprops as $themeprop) { + if ($themeprop->name == 'version') { + $props['theme_version'] = $themeprop->value; + unset($themeprops[$themeprop->id]); + break; + } + } foreach ($themeprops as $themeprop) { $props[$themeprop->name] = $themeprop->value; @@ -841,6 +849,18 @@ static public function compile_properties($themename, $array = true) { $data->id = 0; $data->value = $CFG->version; $props['moodle_version'] = $data; + // Convert 'version' to 'theme_version'. + foreach ($themeprops as $themeprop) { + if ($themeprop->name == 'version') { + $data = new \stdClass(); + $data->id = $themeprop->id; + $data->name = 'theme_version'; + $data->value = $themeprop->value; + $props['theme_version'] = $data; + unset($themeprops[$themeprop->id]); + break; + } + } foreach ($themeprops as $themeprop) { $data = new \stdClass(); $data->id = $themeprop->id; @@ -855,15 +875,24 @@ static public function compile_properties($themename, $array = true) { static public function put_properties($themename, $props) { global $DB; - $report = get_string('putpropertiereport', 'theme_essential').PHP_EOL; - $report .= 'Moodle '.get_string('putpropertieversion', 'theme_essential').' '.$props['moodle_version'].'.'.PHP_EOL; - unset($props['moodle_version']); - $report .= ucfirst($themename).' '.get_string('putpropertieversion', 'theme_essential').' '.$props['version'].'.'.PHP_EOL.PHP_EOL; - unset($props['version']); - - // Get the current properties as a reference. + // Get the current properties as a reference and for theme version information. $currentprops = self::compile_properties($themename, false); + // Build the report. + $report = get_string('putpropertyreport', 'theme_essential').PHP_EOL; + $report .= get_string('putpropertyproperties', 'theme_essential').' \'Moodle\' '. + get_string('putpropertyversion', 'theme_essential').' '.$props['moodle_version'].'.'.PHP_EOL; + unset($props['moodle_version']); + $report .= get_string('putpropertyour', 'theme_essential').' \'Moodle\' '. + get_string('putpropertyversion', 'theme_essential').' '.$currentprops['moodle_version']->value.'.'.PHP_EOL; + unset($currentprops['moodle_version']); + $report .= get_string('putpropertyproperties', 'theme_essential').' \''.ucfirst($themename).'\' '. + get_string('putpropertyversion', 'theme_essential').' '.$props['theme_version'].'.'.PHP_EOL; + unset($props['theme_version']); + $report .= get_string('putpropertyour', 'theme_essential').' \''.ucfirst($themename).'\' '. + get_string('putpropertyversion', 'theme_essential').' '.$currentprops['theme_version']->value.'.'.PHP_EOL.PHP_EOL; + unset($currentprops['theme_version']); + // Pre-process files - using 'theme_essential_pluginfile' in lib.php as a reference. // TODO: refactor into one method for both this and that. $filestoreport = ''; @@ -922,7 +951,6 @@ static public function put_properties($themename, $props) { // Need to ignore and report on any unknown settings. $report .= get_string('putpropertiessettingsreport', 'theme_essential').PHP_EOL; - $changedprops = array(); $changed = ''; $unchanged = ''; $added = ''; @@ -932,7 +960,6 @@ static public function put_properties($themename, $props) { $settinglog = '\''.$propkey.'\' '.get_string('putpropertiesvalue', 'theme_essential').' \''.$propvalue.'\''; if (array_key_exists($propkey, $currentprops)) { if ($propvalue != $currentprops[$propkey]->value) { - $changedprops[] = $propkey; $settinglog .= ' '.get_string('putpropertiesfrom', 'theme_essential').' \''.$currentprops[$propkey]->value.'\''; $changed .= $settinglog.'.'.PHP_EOL; $DB->update_record('config_plugins', array('id' => $currentprops[$propkey]->id, 'value' => $propvalue), true); @@ -961,11 +988,6 @@ static public function put_properties($themename, $props) { $report .= get_string('putpropertiesignored', 'theme_essential').PHP_EOL.$ignored.PHP_EOL; } - if (!empty($changedprops)) { - // We need the 'id's for the records. - global $DB; - } - return $report; } diff --git a/essential_admin_setting_configinteger.php b/essential_admin_setting_configinteger.php index 2e1965c1..48fbbc50 100644 --- a/essential_admin_setting_configinteger.php +++ b/essential_admin_setting_configinteger.php @@ -20,7 +20,7 @@ * @package theme * @subpackage essential * @copyright © 2014-onwards G J Barnard. - * @author G J Barnard - gjbarnard at gmail dot com and {@link http://moodle.org/user/profile.php?id=442195} + * @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/essential_admin_setting_configradio.php b/essential_admin_setting_configradio.php index c2f87c08..823df79d 100644 --- a/essential_admin_setting_configradio.php +++ b/essential_admin_setting_configradio.php @@ -20,7 +20,7 @@ * @package theme * @subpackage essential * @copyright © 2016-onwards G J Barnard. - * @author G J Barnard - gjbarnard at gmail dot com and {@link http://moodle.org/user/profile.php?id=442195} + * @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/essential_admin_setting_configselect.php b/essential_admin_setting_configselect.php index 5180c4bb..d028f5f9 100644 --- a/essential_admin_setting_configselect.php +++ b/essential_admin_setting_configselect.php @@ -20,7 +20,7 @@ * @package theme * @subpackage essential * @copyright © 2016-onwards G J Barnard. - * @author G J Barnard - gjbarnard at gmail dot com and {@link http://moodle.org/user/profile.php?id=442195} + * @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/essential_admin_setting_configtext.php b/essential_admin_setting_configtext.php index ed7e0183..d4ef9ff4 100644 --- a/essential_admin_setting_configtext.php +++ b/essential_admin_setting_configtext.php @@ -20,7 +20,7 @@ * @package theme * @subpackage essential * @copyright © 2016-onwards G J Barnard. - * @author G J Barnard - gjbarnard at gmail dot com and {@link http://moodle.org/user/profile.php?id=442195} + * @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/essential_admin_setting_getprops.php b/essential_admin_setting_getprops.php index ac55b68d..c9cd6553 100644 --- a/essential_admin_setting_getprops.php +++ b/essential_admin_setting_getprops.php @@ -20,7 +20,7 @@ * @package theme * @subpackage essential * @copyright © 2017-onwards G J Barnard. - * @author G J Barnard - gjbarnard at gmail dot com and {@link http://moodle.org/user/profile.php?id=442195} + * @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/essential_admin_setting_putprops.php b/essential_admin_setting_putprops.php index 6ba26c20..20c7b780 100644 --- a/essential_admin_setting_putprops.php +++ b/essential_admin_setting_putprops.php @@ -20,7 +20,7 @@ * @package theme * @subpackage essential * @copyright © 2017-onwards G J Barnard. - * @author G J Barnard - gjbarnard at gmail dot com and {@link http://moodle.org/user/profile.php?id=442195} + * @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -66,24 +66,32 @@ public function write_setting($data) { } /** - * Validate data before storage - * @param string data - * @return mixed true if ok string if error found + * Validate data before storage. + * @param string data. + * @return mixed true if alright, string if error found. */ public function validate($data) { $validated = parent::validate($data); // Pass parent validation first. if ($validated == true) { - $props = json_decode($data, true); - if ($props === null) { - if (function_exists('json_last_error_msg')) { - $validated = json_last_error_msg(); + if (!empty($data)) { + // Only attempt decode if we have the start of a JSON string, otherwise will certainly be the saved report. + if ($data[0] == '{') { + $props = json_decode($data, true); + if ($props === null) { + if (function_exists('json_last_error_msg')) { + $validated = json_last_error_msg(); + } else { + // Fall back to numeric error for older PHP version. + $validated = json_last_error(); + } + } else { + $this->report = call_user_func($this->callable, $this->themename, $props); + } } else { - // Fall back to numeric error for older PHP version. - $validated = json_last_error(); + // Keep what we have. + $this->report = $data; } - } else { - $this->report = call_user_func($this->callable, $this->themename, $props); } } diff --git a/essential_admin_setting_styleguide.php b/essential_admin_setting_styleguide.php index 7dafa1b2..2a470cfc 100644 --- a/essential_admin_setting_styleguide.php +++ b/essential_admin_setting_styleguide.php @@ -20,7 +20,7 @@ * @package theme * @subpackage essential * @copyright © 2016-onwards G J Barnard. - * @author G J Barnard - gjbarnard at gmail dot com and {@link http://moodle.org/user/profile.php?id=442195} + * @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195} * @license PHP Code: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. * @license Source HTML Code: http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0: * diff --git a/lang/en/theme_essential.php b/lang/en/theme_essential.php index 61301db0..5797b3af 100644 --- a/lang/en/theme_essential.php +++ b/lang/en/theme_essential.php @@ -92,7 +92,7 @@
If you like this theme and would like me to customise it, transpose functionality to another theme, build a new theme from scratch or create a child theme then I offer competitive rates. Please contact me via \'www.gjbarnard.co.uk/contact/\' or \'gjbarnard at gmail dot com\' or \'about.me/gjbarnard\' to discuss your requirements.
+If you like this theme and would like me to customise it, transpose functionality to another theme, build a new theme from scratch or create a child theme then I offer competitive rates. Please contact me via \'http://moodle.org/user/profile.php?id=442195\' to discuss your requirements.
'; // General. @@ -866,8 +866,10 @@ $string['putpropertiesname'] = 'Put properties - Experimental!'; $string['putpropertiesdesc'] = 'Paste the JSON string and \'Save changes\'. Warning! Does not valiate setting values and performs a \'Purge all caches\'.'; -$string['putpropertiereport'] = 'Report:'; -$string['putpropertieversion'] = 'version:'; +$string['putpropertyreport'] = 'Report:'; +$string['putpropertyversion'] = 'version:'; +$string['putpropertyproperties'] = 'Properties'; +$string['putpropertyour'] = 'Our'; $string['putpropertiesignorecti'] = 'Ignoring all course title image settings.'; $string['putpropertiesreportfiles'] = 'Remember to upload the following files to their settings:'; $string['putpropertiessettingsreport'] = 'Settings report:'; diff --git a/layout/tiles/additionaljs.php b/layout/tiles/additionaljs.php index e0222efc..4263d86e 100644 --- a/layout/tiles/additionaljs.php +++ b/layout/tiles/additionaljs.php @@ -20,7 +20,7 @@ * @package theme_essential * @copyright 2016 Gareth J Barnard * @copyright 2015 Gareth J Barnard in respect to modifications of the Bootstrap theme. - * @author G J Barnard - gjbarnard at gmail dot com and {@link http://moodle.org/user/profile.php?id=442195} + * @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/pages/styleguide.php b/pages/styleguide.php index 66371414..23e0c380 100644 --- a/pages/styleguide.php +++ b/pages/styleguide.php @@ -20,7 +20,7 @@ * @package theme * @subpackage essential * @copyright © 2016-onwards G J Barnard in respect to modifications of the Bootstrap theme. - * @author G J Barnard - gjbarnard at gmail dot com and {@link http://moodle.org/user/profile.php?id=442195} + * @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/settings.php b/settings.php index c28848c4..32eb0beb 100644 --- a/settings.php +++ b/settings.php @@ -2543,7 +2543,7 @@ get_string('propertiessub', 'theme_essential'), format_text(get_string('propertiesdesc', 'theme_essential'), FORMAT_MARKDOWN))); - $essentialexportprops = optional_param('theme_essential_props_saveprops', 0, PARAM_INT); + $essentialexportprops = optional_param('theme_essential_getprops_saveprops', 0, PARAM_INT); $essentialprops = \theme_essential\toolbox::compile_properties('essential'); $essentialsettingsprops->add(new essential_admin_setting_getprops('theme_essential_getprops', get_string('propertiesproperty', 'theme_essential'), diff --git a/tests/corerenderer_test.php b/tests/corerenderer_test.php index 2528734c..9ab53353 100644 --- a/tests/corerenderer_test.php +++ b/tests/corerenderer_test.php @@ -20,7 +20,7 @@ * @package theme * @subpackage essential * @copyright © 2015-onwards G J Barnard in respect to modifications of the Bootstrap theme. - * @author G J Barnard - gjbarnard at gmail dot com and {@link http://moodle.org/user/profile.php?id=442195} + * @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195} * @author Based on code originally written by Bas Brands, David Scotson and many other contributors. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/tests/toolbox_test.php b/tests/toolbox_test.php index 6eff39c9..fbf49fba 100644 --- a/tests/toolbox_test.php +++ b/tests/toolbox_test.php @@ -20,7 +20,7 @@ * @package theme * @subpackage essential * @copyright © 2015-onwards G J Barnard in respect to modifications of the Bootstrap theme. - * @author G J Barnard - gjbarnard at gmail dot com and {@link http://moodle.org/user/profile.php?id=442195} + * @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195} * @author Based on code originally written by Bas Brands, David Scotson and many other contributors. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */