Merge branch 'MDL-30243' of git://github.com/lazydaisy/moodle
authorAparup Banerjee <aparup@moodle.com>
Mon, 28 Nov 2011 06:33:57 +0000 (14:33 +0800)
committerAparup Banerjee <aparup@moodle.com>
Mon, 28 Nov 2011 06:33:57 +0000 (14:33 +0800)
theme/afterburner/config.php
theme/afterburner/lang/en/theme_afterburner.php
theme/afterburner/layout/default.php
theme/afterburner/lib.php [new file with mode: 0644]
theme/afterburner/pix/images/logo.jpg [new file with mode: 0644]
theme/afterburner/settings.php [new file with mode: 0644]
theme/afterburner/style/afterburner_styles.css

index 47ef877..ca351e3 100644 (file)
@@ -130,4 +130,6 @@ $THEME->layouts = array(
 
 $THEME->enable_dock = true;
 
-$THEME->rendererfactory = 'theme_overridden_renderer_factory';
\ No newline at end of file
+$THEME->rendererfactory = 'theme_overridden_renderer_factory';
+
+$THEME->csspostprocess = 'afterburner_process_css';
\ No newline at end of file
index 48d12c4..fb5736e 100644 (file)
  * @copyright 2011
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
+$string['configtitle'] = 'Afterburner Custom Settings';
 $string['pluginname'] = 'Afterburner';
 $string['region-side-post'] = 'Right';
 $string['region-side-pre'] = 'Left';
+$string['logo'] = 'Logo';
+$string['logodesc'] = 'Please add the URL to your new logo only if you want to replace the default logo for this theme.<br />For your information, the default logo is a JPG image 320px (wide) by 75px (high)';
+$string['footnote'] = 'Footnote';
+$string['footnotedesc'] = 'Whatever you add to this textarea will be displayed in the footer of every page.';
+$string['customcss'] = 'Custom CSS';
+$string['customcssdesc'] = 'Whatever CSS rules you add to this textarea will be reflected in every page, making for easier customization of this theme.';
 $string['choosereadme'] = '
 <div class="clearfix">
  <div class="theme_screenshot">
index 8c29b7c..d462c17 100644 (file)
@@ -13,6 +13,8 @@ $showsidepost = ($hassidepost && !$PAGE->blocks->region_completely_docked('side-
 $custommenu = $OUTPUT->custom_menu();
 $hascustommenu = (empty($PAGE->layout_options['nocustommenu']) && !empty($custommenu));
 
+$hasfootnote = (!empty($PAGE->theme->settings->footnote));
+
 $bodyclasses = array();
 if ($showsidepre && !$showsidepost) {
     $bodyclasses[] = 'side-pre-only';
@@ -108,6 +110,11 @@ echo $OUTPUT->doctype() ?>
     <div id="page-footer" class="clearfix">
 
         <div class="footer-left">
+
+                       <?php if ($hasfootnote) { ?>
+                               <div id="footnote"><?php echo $PAGE->theme->settings->footnote;?></div>
+                       <?php } ?>
+
             <a href="http://moodle.org" title="Moodle">
                 <img src="<?php echo $OUTPUT->pix_url('footer/moodle-logo','theme')?>" alt="Moodle logo" />
             </a>
diff --git a/theme/afterburner/lib.php b/theme/afterburner/lib.php
new file mode 100644 (file)
index 0000000..afcc49a
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+
+function afterburner_process_css($css, $theme) {
+
+       // Set the background image for the logo
+       if (!empty($theme->settings->logo)) {
+               $logo = $theme->settings->logo;
+       } else {
+               $logo = null;
+       }
+       $css = afterburner_set_logo($css, $logo);
+
+    // Set custom CSS
+    if (!empty($theme->settings->customcss)) {
+        $customcss = $theme->settings->customcss;
+    } else {
+        $customcss = null;
+    }
+    $css = afterburner_set_customcss($css, $customcss);
+
+    return $css;
+}
+
+function afterburner_set_logo($css, $logo) {
+       global $OUTPUT;
+       $tag = '[[setting:logo]]';
+       $replacement = $logo;
+       if (is_null($replacement)) {
+               $replacement = $OUTPUT->pix_url('images/logo','theme');
+       }
+
+       $css = str_replace($tag, $replacement, $css);
+
+       return $css;
+
+}
+
+function afterburner_set_customcss($css, $customcss) {
+    $tag = '[[setting:customcss]]';
+    $replacement = $customcss;
+    if (is_null($replacement)) {
+        $replacement = '';
+    }
+
+       $css = str_replace($tag, $replacement, $css);
+
+       return $css;
+}
\ No newline at end of file
diff --git a/theme/afterburner/pix/images/logo.jpg b/theme/afterburner/pix/images/logo.jpg
new file mode 100644 (file)
index 0000000..fcd2fe0
Binary files /dev/null and b/theme/afterburner/pix/images/logo.jpg differ
diff --git a/theme/afterburner/settings.php b/theme/afterburner/settings.php
new file mode 100644 (file)
index 0000000..3316625
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+
+defined('MOODLE_INTERNAL') || die;
+
+if ($ADMIN->fulltree) {
+
+       // Logo file setting
+       $name = 'theme_afterburner/logo';
+       $title = get_string('logo','theme_afterburner');
+       $description = get_string('logodesc', 'theme_afterburner');
+       $default = '';
+       $setting = new admin_setting_configtext($name, $title, $description, $default, PARAM_URL);
+       $settings->add($setting);
+
+       // Foot note setting
+       $name = 'theme_afterburner/footnote';
+       $title = get_string('footnote','theme_afterburner');
+       $description = get_string('footnotedesc', 'theme_afterburner');
+       $default = '';
+       $setting = new admin_setting_confightmleditor($name, $title, $description, $default);
+       $settings->add($setting);
+
+       // Custom CSS file
+       $name = 'theme_afterburner/customcss';
+       $title = get_string('customcss','theme_afterburner');
+       $description = get_string('customcssdesc', 'theme_afterburner');
+       $default = '';
+       $setting = new admin_setting_configtextarea($name, $title, $description, $default);
+       $settings->add($setting);
+
+}
\ No newline at end of file
index 6c1b5bd..d6d4855 100644 (file)
@@ -19,8 +19,8 @@ a:hover, a:active {
     text-decoration: none;
 }
 hr {
-    border-bottom:1px dotted gray;
-    border-top:0px;
+    border-bottom: 1px dotted #808080;
+    border-top: 0px;
 }
 h2.headingblock {
     border-bottom: 1px solid #ddd;
@@ -46,11 +46,11 @@ Header and Logo
     background: #fff;
 }
 #logo {
-    background: url([[pix:theme|images/light3]]) no-repeat 0 -272px;
-    width: 288px;
-    height: 58px;
+    background: url([[setting:logo]]) no-repeat 0 0;
+    width: 320px;
+    height: 75px;
     display: block;
-    margin: 20px 15px;
+    margin: 15px 10px 10px;
     float: left;
 }
 .headermenu,
@@ -72,13 +72,13 @@ Page Footer
 #page-footer {
     background: #fff url([[pix:theme|core/h2grad]]) repeat-x left top;
     height: auto;
-    clear:both;
-    float:left;
-    width:98%;
+    clear: both;
+    float: left;
+    width: 98%;
     margin: 0;
     padding: 1%;
     color: #4b4b4b;
-    border-top:1px solid #fff;
+    border-top: 1px solid #fff;
     line-height: 2em;
     font-size: 1em;
 }
@@ -97,6 +97,12 @@ Page Footer
     text-align: left;
     color: #999;
 }
+#page-footer .footer-left p {
+    margin: 0;
+    padding: 0;
+    font-size: 100%;
+    line-height: 1;
+}
 #page-footer .footer-right {
     float: right;
     text-align: right;
@@ -433,4 +439,8 @@ tab styles for ie6 & ie7
 }
 .yui-skin-sam .yui-panel-container {
     z-index: 999999!important;
-}
\ No newline at end of file
+}
+
+/* Custom CSS Settings
+-------------------------*/
+[[setting:customcss]]
\ No newline at end of file