Permalink
Browse files

MDL-32420 theme_anomaly: Added custom css settings and tagline.

  • Loading branch information...
1 parent b3778a0 commit 009fb7d943a9a6b5cf6b93324ece5729db8a5052 @lazydaisy lazydaisy committed Jan 27, 2013
View
31 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');
View
8 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'] = '<div class="clearfix"><div class="theme_screenshot"><h2>Anomaly</h2><img src="anomaly/pix/screenshot.jpg" /><h3>Theme Discussion Forum:</h3><p><a href="http://moodle.org/mod/forum/view.php?id=46">http://moodle.org/mod/forum/view.php?id=46</a></p><h3>Theme Credits</h3><p><a href="http://docs.moodle.org/en/Theme_credits">http://docs.moodle.org/en/Theme_credits</a></p><h3>Theme Documentation:</h3><p><a href="http://docs.moodle.org/en/Themes">http://docs.moodle.org/en/Themes</a></p><h3>Report a bug:</h3><p><a href="http://tracker.moodle.org">http://tracker.moodle.org</a></p></div><div class="theme_description"><h2>About</h2><p>Anomaly is a fluid-width, three-column Moodle 2.0 theme with rounded corners. <h2>Tweaks</h2><p>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 <a href="http://docs.moodle.org/en/Theme">MoodleDocs</a>.</p><h2>Credits</h2><p>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.</p><h2>License</h2><p>This, and all other themes included in the Moodle core, are licensed under the <a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a>.</div></div>';
+$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'] = '<div class="clearfix"><div class="theme_screenshot"><h2>Anomaly</h2><img src="anomaly/pix/screenshot.jpg" /><h3>Theme Discussion Forum:</h3><p><a href="http://moodle.org/mod/forum/view.php?id=46">http://moodle.org/mod/forum/view.php?id=46</a></p><h3>Theme Credits</h3><p><a href="http://docs.moodle.org/en/Theme_credits">http://docs.moodle.org/en/Theme_credits</a></p><h3>Theme Documentation:</h3><p><a href="http://docs.moodle.org/en/Themes">http://docs.moodle.org/en/Themes</a></p><h3>Report a bug:</h3><p><a href="http://tracker.moodle.org">http://tracker.moodle.org</a></p></div><div class="theme_description"><h2>About</h2><p>Anomaly is a fluid-width, three-column Moodle 2.0 theme with rounded corners. <h2>Tweaks</h2><p>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 <a href="http://docs.moodle.org/en/Theme">MoodleDocs</a>.</p><h2>Credits</h2><p>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.</p><h2>License</h2><p>This, and all other themes included in the Moodle core, are licensed under the <a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a>.</div></div>';
+$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.';
View
115 theme/anomaly/layout/frontpage.php
@@ -0,0 +1,115 @@
+<?php
+
+$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);
+
+$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() ?>
+<html <?php echo $OUTPUT->htmlattributes() ?>>
+<head>
+ <title><?php echo $PAGE->title ?></title>
+ <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
+ <meta name="description" content="<?php p(strip_tags(format_text($SITE->summary, FORMAT_HTML))) ?>" />
+ <?php echo $OUTPUT->standard_head_html() ?>
+</head>
+<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
+<?php echo $OUTPUT->standard_top_of_body_html() ?>
+
+<div id="page">
+
+<div id="page-header">
+
+ <div class="rounded-corner top-left"></div>
+ <div class="rounded-corner top-right"></div>
+
+ <div class="headermenu"><?php
+ echo $OUTPUT->login_info();
+ echo $OUTPUT->lang_menu();
+ echo $PAGE->headingmenu;
+ ?></div>
+
+ <h1 class="headermain"><?php echo $PAGE->heading ?></h1>
+
+ <?php if ($hastagline) { ?>
+ <h2 class="tagline"><?php echo $PAGE->theme->settings->tagline;?></h2>
+ <?php } ?>
+
+
+ <?php
+ if ($hascustommenu) { ?>
+ <div id="custommenu"><?php echo $custommenu; ?></div>
+ <?php
+ } ?>
+
+</div>
+<!-- END OF HEADER -->
+
+ <div id="page-content">
+ <div id="region-main-box">
+ <div id="region-post-box">
+
+ <div id="region-main-wrap">
+ <div id="region-main">
+ <div class="region-content">
+ <?php echo $OUTPUT->main_content() ?>
+ </div>
+ </div>
+ </div>
+
+ <?php if ($hassidepre) { ?>
+ <div id="region-pre" class="block-region">
+ <div class="region-content">
+ <?php echo $OUTPUT->blocks_for_region('side-pre') ?>
+ </div>
+ </div>
+ <?php } ?>
+
+ <?php if ($hassidepost) { ?>
+ <div id="region-post" class="block-region">
+ <div class="region-content">
+ <?php echo $OUTPUT->blocks_for_region('side-post') ?>
+ </div>
+ </div>
+ <?php } ?>
+
+ </div>
+ </div>
+ </div>
+
+<!-- START OF FOOTER -->
+ <div id="page-footer">
+ <p class="helplink">
+ <?php echo page_doc_link(get_string('moodledocslink')) ?>
+ </p>
+
+ <?php
+ echo $OUTPUT->login_info();
+ echo $OUTPUT->home_link();
+ echo $OUTPUT->standard_footer_html();
+ ?>
+ <div class="rounded-corner bottom-left"></div>
+ <div class="rounded-corner bottom-right"></div>
+ </div>
+ <div class="clearfix"></div>
+</div>
+<?php echo $OUTPUT->standard_end_of_body_html() ?>
+</body>
+</html>
View
35 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() ?>
<html <?php echo $OUTPUT->htmlattributes() ?>>
<head>
@@ -65,7 +68,7 @@
<?php } ?>
<?php if ($hascustommenu) { ?>
<div id="custommenu"><?php echo $custommenu; ?></div>
- <?php } ?>
+ <?php } ?>
<?php if ($hasnavbar) { ?>
<div class="navbar clearfix">
@@ -131,4 +134,4 @@
</div>
<?php echo $OUTPUT->standard_end_of_body_html() ?>
</body>
-</html>
+</html>
View
15 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 @@
<div id="course-header"><?php echo $courseheader; ?></div>
<?php } ?>
<?php if ($hascustommenu) { ?>
- <div id="custommenu"><?php echo $custommenu; ?></div>
- <?php } ?>
+ <div id="custommenu"><?php echo $custommenu; ?></div>
+ <?php } ?>
<?php if ($hasnavbar) { ?>
<div class="navbar clearfix">
@@ -110,4 +115,4 @@
</div>
<?php echo $OUTPUT->standard_end_of_body_html() ?>
</body>
-</html>
+</html>
View
30 theme/anomaly/lib.php
@@ -1,8 +1,26 @@
<?php
-/**
- * Functions needed by the anomaly theme should be put here.
- *
- * Any functions that get created here should ALWAYS contain the theme name
- * to reduce complications for other theme designers who may be copying this theme.
- */
+function anomaly_process_css($css, $theme) {
+
+ // Set custom CSS
+ if (!empty($theme->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;
+}
View
23 theme/anomaly/settings.php
@@ -0,0 +1,23 @@
+<?php
+
+defined('MOODLE_INTERNAL') || die;
+
+if ($ADMIN->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);
+
+}
View
2 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;
}
View
58 theme/anomaly/style/general.css
@@ -24,46 +24,66 @@ 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 {
color: #fff;
}
#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;
+}
View
6 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
-------------------------------------------------*/
View
3 theme/anomaly/style/settings.css
@@ -0,0 +1,3 @@
+/* Custom CSS Settings
+-------------------------*/
+[[setting:customcss]]

0 comments on commit 009fb7d

Please sign in to comment.