From 009fb7d943a9a6b5cf6b93324ece5729db8a5052 Mon Sep 17 00:00:00 2001 From: Mary Evans Date: Sun, 27 Jan 2013 20:33:17 +0000 Subject: [PATCH] MDL-32420 theme_anomaly: Added custom css settings and tagline. --- theme/anomaly/config.php | 31 ++++++- theme/anomaly/lang/en/theme_anomaly.php | 8 +- theme/anomaly/layout/frontpage.php | 115 ++++++++++++++++++++++++ theme/anomaly/layout/general.php | 35 ++++---- theme/anomaly/layout/report.php | 15 ++-- theme/anomaly/lib.php | 30 +++++-- theme/anomaly/settings.php | 23 +++++ theme/anomaly/style/base.css | 2 +- theme/anomaly/style/general.css | 58 +++++++++--- theme/anomaly/style/menu.css | 6 +- theme/anomaly/style/settings.css | 3 + 11 files changed, 278 insertions(+), 48 deletions(-) create mode 100644 theme/anomaly/layout/frontpage.php create mode 100644 theme/anomaly/settings.php create mode 100644 theme/anomaly/style/settings.css diff --git a/theme/anomaly/config.php b/theme/anomaly/config.php index d94f1086013b7..9e840f361bcf6 100644 --- a/theme/anomaly/config.php +++ b/theme/anomaly/config.php @@ -7,12 +7,19 @@ $THEME->name = 'anomaly'; -$THEME->sheets = array('base', 'general', 'browser', 'dock', 'menu'); +$THEME->sheets = array( + 'base', + 'general', + 'browser', + 'dock', + 'menu', + 'settings' +); /// This variable is an array containing the names of all the /// stylesheet files you want included in this theme, and in what order //////////////////////////////////////////////////////////////////////////////// -$THEME->parents = array('base'); // TODO: new themes can not be based on standardold, instead use 'base' as the base +$THEME->parents = array('base'); /// This variable can be set to the name of a parent theme /// which you want to have included before the current theme. /// This can make it easy to make modifications to another @@ -54,7 +61,7 @@ 'options' => array('langmenu' => true) ), 'frontpage' => array( - 'file' => 'general.php', + 'file' => 'frontpage.php', 'regions' => array('side-pre', 'side-post'), 'defaultregion' => 'side-pre', 'options' => array('langmenu' => true) @@ -113,16 +120,32 @@ 'regions' => array(), 'options' => array('nofooter'=>true, 'nonavbar'=>false, 'noblocks'=>true, 'nocourseheaderfooter'=>true), ), + // The pagelayout used when a redirection is occuring. + 'redirect' => array( + 'file' => 'embedded.php', + 'regions' => array(), + 'options' => array('nofooter'=>true, 'nonavbar'=>true, 'nocustommenu'=>true, 'nocourseheaderfooter'=>true), + ), + // The pagelayout used for reports. 'report' => array( 'file' => 'report.php', 'regions' => array('side-pre'), 'defaultregion' => 'side-pre', - 'options' => array('langmenu' => true) + 'options' => array('langmenu' => true), + ), + // The pagelayout used for safebrowser and securewindow. + 'secure' => array( + 'file' => 'general.php', + 'regions' => array('side-pre', 'side-post'), + 'defaultregion' => 'side-pre', + 'options' => array('nofooter'=>true, 'nonavbar'=>true, 'nocustommenu'=>true, 'nologinlinks'=>true, 'nocourseheaderfooter'=>true), ), ); $THEME->rendererfactory = 'theme_overridden_renderer_factory'; +$THEME->csspostprocess = 'anomaly_process_css'; + $THEME->enable_dock = true; $THEME->editor_sheets = array('editor'); diff --git a/theme/anomaly/lang/en/theme_anomaly.php b/theme/anomaly/lang/en/theme_anomaly.php index c38f679f5adcd..18967aa48e7c1 100644 --- a/theme/anomaly/lang/en/theme_anomaly.php +++ b/theme/anomaly/lang/en/theme_anomaly.php @@ -22,8 +22,12 @@ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - +$string['choosereadme'] = '

About

Anomaly is a fluid-width, three-column Moodle 2.0 theme with rounded corners.

Tweaks

This theme is built upon the Base theme inside the Moodle core. If you want to modify this theme, we recommend that you first duplicate it, then rename it before making your changes. This will prevent your customized theme from being overwritten by future Moodle upgrades, and you\'ll still have the original files if you make a mess. More information on modifying themes can be found in the MoodleDocs.

Credits

This theme was originally designed for Moodle 1.9 by Patrick Malley. It was then coded for 2.0 and is maintained by Sam Hemelryk at Moodle HQ. He can be contacted at sam@moodle.com.

License

This, and all other themes included in the Moodle core, are licensed under the GNU General Public License.

'; +$string['configtitle'] = 'Anomaly Theme'; +$string['customcss'] = 'Custom CSS'; +$string['customcssdesc'] = 'Whatever CSS rules you add to this Custom CSS box will be reflected in every page, making for easier customization of this theme.'; $string['pluginname'] = 'Anomaly'; $string['region-side-post'] = 'Right'; $string['region-side-pre'] = 'Left'; -$string['choosereadme'] = '

About

Anomaly is a fluid-width, three-column Moodle 2.0 theme with rounded corners.

Tweaks

This theme is built upon the Base theme inside the Moodle core. If you want to modify this theme, we recommend that you first duplicate it, then rename it before making your changes. This will prevent your customized theme from being overwritten by future Moodle upgrades, and you\'ll still have the original files if you make a mess. More information on modifying themes can be found in the MoodleDocs.

Credits

This theme was originally designed for Moodle 1.9 by Patrick Malley. It was then coded for 2.0 and is maintained by Sam Hemelryk at Moodle HQ. He can be contacted at sam@moodle.com.

License

This, and all other themes included in the Moodle core, are licensed under the GNU General Public License.

'; \ No newline at end of file +$string['tagline'] = 'Tagline'; +$string['taglinedesc'] = 'Whatever text you add to this Tagline text box will be displayed below the heading on the front page of your Moodle site only.'; diff --git a/theme/anomaly/layout/frontpage.php b/theme/anomaly/layout/frontpage.php new file mode 100644 index 0000000000000..01292c5929813 --- /dev/null +++ b/theme/anomaly/layout/frontpage.php @@ -0,0 +1,115 @@ +blocks->region_has_content('side-pre', $OUTPUT); +$hassidepost = $PAGE->blocks->region_has_content('side-post', $OUTPUT); +$showsidepre = $hassidepre && !$PAGE->blocks->region_completely_docked('side-pre', $OUTPUT); +$showsidepost = $hassidepost && !$PAGE->blocks->region_completely_docked('side-post', $OUTPUT); + +$hastagline = (!empty($PAGE->theme->settings->tagline)); + +$custommenu = $OUTPUT->custom_menu(); +$hascustommenu = (empty($PAGE->layout_options['nocustommenu']) && !empty($custommenu)); + +$bodyclasses = array(); +if ($showsidepre && !$showsidepost) { + $bodyclasses[] = 'side-pre-only'; +} else if ($showsidepost && !$showsidepre) { + $bodyclasses[] = 'side-post-only'; +} else if (!$showsidepost && !$showsidepre) { + $bodyclasses[] = 'content-only'; +} +if ($hascustommenu) { + $bodyclasses[] = 'has_custom_menu'; +} + +echo $OUTPUT->doctype() ?> +htmlattributes() ?>> + + <?php echo $PAGE->title ?> + + + standard_head_html() ?> + + +standard_top_of_body_html() ?> + +
+ + + + +
+
+
+ +
+
+
+ main_content() ?> +
+
+
+ + +
+
+ blocks_for_region('side-pre') ?> +
+
+ + + +
+
+ blocks_for_region('side-post') ?> +
+
+ + +
+
+
+ + + +
+
+standard_end_of_body_html() ?> + + diff --git a/theme/anomaly/layout/general.php b/theme/anomaly/layout/general.php index 4037cce44d62e..d7831016a40d9 100644 --- a/theme/anomaly/layout/general.php +++ b/theme/anomaly/layout/general.php @@ -3,13 +3,26 @@ $hasheading = ($PAGE->heading); $hasnavbar = (empty($PAGE->layout_options['nonavbar']) && $PAGE->has_navbar()); $hasfooter = (empty($PAGE->layout_options['nofooter'])); -$hassidepre = $PAGE->blocks->region_has_content('side-pre', $OUTPUT); -$hassidepost = $PAGE->blocks->region_has_content('side-post', $OUTPUT); -$showsidepre = $hassidepre && !$PAGE->blocks->region_completely_docked('side-pre', $OUTPUT); -$showsidepost = $hassidepost && !$PAGE->blocks->region_completely_docked('side-post', $OUTPUT); +$hassidepre = (empty($PAGE->layout_options['noblocks']) && $PAGE->blocks->region_has_content('side-pre', $OUTPUT)); +$hassidepost = (empty($PAGE->layout_options['noblocks']) && $PAGE->blocks->region_has_content('side-post', $OUTPUT)); +$haslogininfo = (empty($PAGE->layout_options['nologininfo'])); + +$showsidepre = ($hassidepre && !$PAGE->blocks->region_completely_docked('side-pre', $OUTPUT)); +$showsidepost = ($hassidepost && !$PAGE->blocks->region_completely_docked('side-post', $OUTPUT)); + $custommenu = $OUTPUT->custom_menu(); $hascustommenu = (empty($PAGE->layout_options['nocustommenu']) && !empty($custommenu)); +$courseheader = $coursecontentheader = $coursecontentfooter = $coursefooter = ''; +if (empty($PAGE->layout_options['nocourseheaderfooter'])) { + $courseheader = $OUTPUT->course_header(); + $coursecontentheader = $OUTPUT->course_content_header(); + if (empty($PAGE->layout_options['nocoursefooter'])) { + $coursecontentfooter = $OUTPUT->course_content_footer(); + $coursefooter = $OUTPUT->course_footer(); + } +} + $bodyclasses = array(); if ($showsidepre && !$showsidepost) { $bodyclasses[] = 'side-pre-only'; @@ -25,16 +38,6 @@ $bodyclasses[] = 'hasnavbar'; } -$courseheader = $coursecontentheader = $coursecontentfooter = $coursefooter = ''; -if (empty($PAGE->layout_options['nocourseheaderfooter'])) { - $courseheader = $OUTPUT->course_header(); - $coursecontentheader = $OUTPUT->course_content_header(); - if (empty($PAGE->layout_options['nocoursefooter'])) { - $coursecontentfooter = $OUTPUT->course_content_footer(); - $coursefooter = $OUTPUT->course_footer(); - } -} - echo $OUTPUT->doctype() ?> htmlattributes() ?>> @@ -65,7 +68,7 @@
- + standard_end_of_body_html() ?> - \ No newline at end of file + diff --git a/theme/anomaly/layout/report.php b/theme/anomaly/layout/report.php index ffb240dd3de68..d7207b372b600 100644 --- a/theme/anomaly/layout/report.php +++ b/theme/anomaly/layout/report.php @@ -3,8 +3,13 @@ $hasheading = ($PAGE->heading); $hasnavbar = (empty($PAGE->layout_options['nonavbar']) && $PAGE->has_navbar()); $hasfooter = (empty($PAGE->layout_options['nofooter'])); -$hassidepre = $PAGE->blocks->region_has_content('side-pre', $OUTPUT); -$showsidepre = $hassidepre && !$PAGE->blocks->region_completely_docked('side-pre', $OUTPUT); +$hassidepre = (empty($PAGE->layout_options['noblocks']) && $PAGE->blocks->region_has_content('side-pre', $OUTPUT)); +$hassidepost = (empty($PAGE->layout_options['noblocks']) && $PAGE->blocks->region_has_content('side-post', $OUTPUT)); +$haslogininfo = (empty($PAGE->layout_options['nologininfo'])); + +$showsidepre = ($hassidepre && !$PAGE->blocks->region_completely_docked('side-pre', $OUTPUT)); +$showsidepost = ($hassidepost && !$PAGE->blocks->region_completely_docked('side-post', $OUTPUT)); + $custommenu = $OUTPUT->custom_menu(); $hascustommenu = (empty($PAGE->layout_options['nocustommenu']) && !empty($custommenu)); @@ -58,8 +63,8 @@
-
- +
+ standard_end_of_body_html() ?> - \ No newline at end of file + diff --git a/theme/anomaly/lib.php b/theme/anomaly/lib.php index dc33c817474c3..42c31007f544d 100644 --- a/theme/anomaly/lib.php +++ b/theme/anomaly/lib.php @@ -1,8 +1,26 @@ settings->customcss)) { + $customcss = $theme->settings->customcss; + } else { + $customcss = null; + } + $css = anomaly_set_customcss($css, $customcss); + + return $css; +} + +function anomaly_set_customcss($css, $customcss) { + $tag = '[[setting:customcss]]'; + $replacement = $customcss; + if (is_null($replacement)) { + $replacement = ''; + } + + $css = str_replace($tag, $replacement, $css); + + return $css; +} diff --git a/theme/anomaly/settings.php b/theme/anomaly/settings.php new file mode 100644 index 0000000000000..73f5aa9f12579 --- /dev/null +++ b/theme/anomaly/settings.php @@ -0,0 +1,23 @@ +fulltree) { + + // Tagline setting + $name = 'theme_anomaly/tagline'; + $title = get_string('tagline','theme_anomaly'); + $description = get_string('taglinedesc', 'theme_anomaly'); + $default = ''; + $setting = new admin_setting_configtext($name, $title, $description, $default); + $settings->add($setting); + + // Custom CSS file + $name = 'theme_anomaly/customcss'; + $title = get_string('customcss','theme_anomaly'); + $description = get_string('customcssdesc', 'theme_anomaly'); + $default = ''; + $setting = new admin_setting_configtextarea($name, $title, $description, $default); + $settings->add($setting); + +} diff --git a/theme/anomaly/style/base.css b/theme/anomaly/style/base.css index c7a4be1c9eb9b..35980ce1c2ccb 100644 --- a/theme/anomaly/style/base.css +++ b/theme/anomaly/style/base.css @@ -2,7 +2,7 @@ * Core */ -h1, h2, h3, h4, h5 { +h1, h1.headermain, h2, h2.tagline, h3, h4, h5 { font-family: Georgia,Times,"Times New Roman",serif; } diff --git a/theme/anomaly/style/general.css b/theme/anomaly/style/general.css index cfc2ecfc03f95..f1d7bff649c73 100644 --- a/theme/anomaly/style/general.css +++ b/theme/anomaly/style/general.css @@ -24,38 +24,49 @@ html, body { } /** Header **/ +.pagelayout-frontpage #page-header { + border-bottom: 5px solid #697F55; +} #page-header { background-color: #222; color: #FFF; - border-bottom: 5px solid #697F55; margin: 0; padding: 0; width: 100%; } h1.headermain { + font-size: 30px; + margin: 20px; + font-weight: 400; +} +.pagelayout-frontpage h1.headermain, +h2.tagline { float: left; - font-size: 2.3em; - margin: 15px; line-height: 1; + padding: 0; +} +.pagelayout-frontpage h1.headermain { + margin-bottom: 0; } -#page-header .headermain span { - color: #C8C9C7; +h2.tagline { + clear: left; + color: #bbb; + margin-top: 0; + margin-bottom: 20px; + margin-left: 20px; + font-size: 100%; + font-weight: normal; } /** Navbar **/ -.hasnavbar #page-header { - border-bottom-color: #3A4D28; - border-bottom-width: 3px; -} #page-header .navbar { background-color: #697F55; width: 100%; margin: 0; padding: 0; -} -#page-header .navbar { color: #000; + height: 30px; } #page-header .navbar a:link, #page-header .navbar a:visited { @@ -63,7 +74,16 @@ h1.headermain { } #page-header .navbar .breadcrumb, #page-header .navbar .navbutton { - margin: 5px 1em; + line-height: 1.5; +} +#page-header .navbar .breadcrumb { + margin: 5px 5px 0 20px; +} +#page-header .navbar .navbutton { + margin: 3px 5px 3px; +} +#page-header .navbar .navbutton .singlebutton { + margin: 0; } /** Footer **/ @@ -72,6 +92,9 @@ h1.headermain { background-color: #222; color: #FFF; } +#page-footer .helplink { + margin-top: 10px; +} /** General **/ .generalbox { @@ -678,4 +701,13 @@ h1.headermain { /* Add Block -------------------------*/ -.block .content .singleselect form#add_block .select.menubui_addblock { width: 160px;} +.block .content .singleselect form#add_block .select.menubui_addblock { + width: 160px; +} + +/* Admin settings +-------------------------*/ +#adminsettings .form-buttons { + margin: 0; + text-align: center; +} \ No newline at end of file diff --git a/theme/anomaly/style/menu.css b/theme/anomaly/style/menu.css index 09a8c1403c575..58b137996879a 100644 --- a/theme/anomaly/style/menu.css +++ b/theme/anomaly/style/menu.css @@ -6,9 +6,13 @@ padding: 0; clear: both; height: 30px; - background: #222; + background: #333; margin:0; } +#custommenu ul li { + border-right: 1px solid #444; + border-left: 1px solid #555 +} /* Dropdown Menu - CSS from DeCaf Theme by Lei Zhang -------------------------------------------------*/ diff --git a/theme/anomaly/style/settings.css b/theme/anomaly/style/settings.css new file mode 100644 index 0000000000000..82955ebd2218c --- /dev/null +++ b/theme/anomaly/style/settings.css @@ -0,0 +1,3 @@ +/* Custom CSS Settings +-------------------------*/ +[[setting:customcss]] \ No newline at end of file