diff --git a/theme/nonzero/config.php b/theme/nonzero/config.php index 651ffadf6ec..15e83c6769a 100644 --- a/theme/nonzero/config.php +++ b/theme/nonzero/config.php @@ -172,7 +172,7 @@ $THEME->layouts = array( // specific page. /////////////////////////////////////////////////////////////// -// $THEME->csspostprocess +$THEME->csspostprocess = 'nonzero_process_css'; //////////////////////////////////////////////////// // Allows the user to provide the name of a function @@ -252,4 +252,4 @@ $THEME->layouts = array( //////////////////////////////////////////////////// // Controls the colours for the MP3 player -//////////////////////////////////////////////////// +//////////////////////////////////////////////////// \ No newline at end of file diff --git a/theme/nonzero/lang/en/theme_nonzero.php b/theme/nonzero/lang/en/theme_nonzero.php index 6ab2021178e..6b28d3d5537 100644 --- a/theme/nonzero/lang/en/theme_nonzero.php +++ b/theme/nonzero/lang/en/theme_nonzero.php @@ -26,4 +26,14 @@ $string['pluginname'] = 'Nonzero'; $string['region-side-post'] = 'Right'; $string['region-side-pre'] = 'Left'; -$string['choosereadme'] = '

Nonzero

Theme Discussion Forum:

http://moodle.org/mod/forum/view.php?id=46

Theme Credits

http://docs.moodle.org/en/Theme_credits

Theme Documentation:

http://docs.moodle.org/en/Themes

Report a bug:

http://tracker.moodle.org

About

Nonzero is a nontraditional, three-column, fluid-width theme for Moodle. It\'s nontraditional in the sense that it uses a fresh three-column layout that displays the content to the left of both block columns.

Tweaks

This theme is built upon both Base and Canvas, two parent themes included in 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.

h3>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['choosereadme'] = '

Nonzero

Theme Discussion Forum:

http://moodle.org/mod/forum/view.php?id=46

Theme Credits

http://docs.moodle.org/en/Theme_credits

Theme Documentation:

http://docs.moodle.org/en/Themes

Report a bug:

http://tracker.moodle.org

About

Nonzero is a nontraditional, three-column, fluid-width theme for Moodle. It\'s nontraditional in the sense that it uses a fresh three-column layout that displays the content to the left of both block columns.

Tweaks

This theme is built upon both Base and Canvas, two parent themes included in 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.

h3>License

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

'; + +// Config + +$string['configtitle'] = 'Nonzero Settings'; +$string['customcss'] = 'Custom CSS'; +$string['customcssdesc'] = 'Any CSS you enter here will be added to every page allowing your to easily customise this theme.'; +$string['regionprewidth'] = 'Left column width'; +$string['regionprewidthdesc'] = 'This sets the width of the block region that forms the left column. This column is displayed in the middle of the page while using blog layout'; +$string['regionpostwidth'] = 'Right column width'; +$string['regionpostwidthdesc'] = 'This sets the width of the block region that forms the right column.'; \ No newline at end of file diff --git a/theme/nonzero/lib.php b/theme/nonzero/lib.php new file mode 100755 index 00000000000..98c9a481c5b --- /dev/null +++ b/theme/nonzero/lib.php @@ -0,0 +1,100 @@ +. + +/** + * This file contains the settings for the Nonzero theme. + * + * Currently you can set the following settings: + * - Region pre width + * - Region post width + * - Some custom CSS + * + * @package moodlecore + * @copyright 2010 Dietmar Wagner + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +function nonzero_process_css($css, $theme) { + + + // Set the region-pre and region-post widths + if (!empty($theme->settings->regionprewidth) && !empty($theme->settings->regionpostwidth)) { + $regionprewidth = $theme->settings->regionprewidth; + $regionpostwidth = $theme->settings->regionpostwidth; + } else { + $regionprewidth = null; + $regionpostwidth = null; + } + $css = nonzero_set_regionwidths($css, $regionprewidth, $regionpostwidth); + + + // Set the custom CSS + if (!empty($theme->settings->customcss)) { + $customcss = $theme->settings->customcss; + } else { + $customcss = null; + } + $css = nonzero_set_customcss($css, $customcss); + + // Return the CSS + return $css; +} + +/** + * Sets the region width variable in CSS + * + * @param string $css + * @param mixed $regionwidth + * @return string + */ + +function nonzero_set_regionwidths($css, $regionprewidth, $regionpostwidth) { + $tag1 = '[[setting:regionprewidth]]'; + $tag2 = '[[setting:regionpostwidth]]'; + $tag3 = '[[setting:regionsumwidth]]'; + $tag4 = '[[setting:regiondoublepresumwidth]]'; + $replacement1 = $regionprewidth; + $replacement2 = $regionpostwidth; + if (is_null($replacement1) or is_null($replacement2)) { + $replacement1 = 200; + $replacement2 = 200; + } + $css = str_replace($tag1, $replacement1.'px', $css); + $css = str_replace($tag2, $replacement2.'px', $css); + $css = str_replace($tag3, ($replacement1+$replacement2).'px', $css); + $css = str_replace($tag4, (2*$replacement1+$replacement2).'px', $css); + return $css; +} + + +/** + * Sets the custom css variable in CSS + * + * @param string $css + * @param mixed $customcss + * @return string + */ + +function nonzero_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/nonzero/settings.php b/theme/nonzero/settings.php new file mode 100755 index 00000000000..426fd9391d6 --- /dev/null +++ b/theme/nonzero/settings.php @@ -0,0 +1,60 @@ +. + +/** + * This file contains the settings for the Nonzero theme. + * + * Currently you can set the following settings: + * - Region pre width + * - Region post width + * - Some custom CSS + * + * @package moodlecore + * @copyright 2010 Dietmar Wagner + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +// Create our admin page +$temp = new admin_settingpage('theme_nonzero', get_string('configtitle','theme_nonzero')); + +// Block region-pre width +$name = 'theme_nonzero/regionprewidth'; +$title = get_string('regionprewidth','theme_nonzero'); +$description = get_string('regionprewidthdesc', 'theme_nonzero'); +$default = 200; +$choices = array(180=>'180px', 190=>'190px', 200=>'200px', 210=>'210px', 220=>'220px', 230=>'230px', 240=>'240px', 250=>'250px', 260=>'260px'); +$setting = new admin_setting_configselect($name, $title, $description, $default, $choices); +$temp->add($setting); + +// Block region-post width +$name = 'theme_nonzero/regionpostwidth'; +$title = get_string('regionpostwidth','theme_nonzero'); +$description = get_string('regionpostwidthdesc', 'theme_nonzero'); +$default = 200; +$choices = array(180=>'180px', 190=>'190px', 200=>'200px', 210=>'210px', 220=>'220px', 230=>'230px', 240=>'240px', 250=>'250px', 260=>'260px'); +$setting = new admin_setting_configselect($name, $title, $description, $default, $choices); +$temp->add($setting); + +// Custom CSS file +$name = 'theme_nonzero/customcss'; +$title = get_string('customcss','theme_nonzero'); +$description = get_string('customcssdesc', 'theme_nonzero'); +$setting = new admin_setting_configtextarea($name, $title, $description, ''); +$temp->add($setting); + +// Add our page to the structure of the admin tree +$ADMIN->add('themes', $temp); \ No newline at end of file diff --git a/theme/nonzero/style/pagelayout.css b/theme/nonzero/style/pagelayout.css index 2bda63b7db9..dbba66bb657 100644 --- a/theme/nonzero/style/pagelayout.css +++ b/theme/nonzero/style/pagelayout.css @@ -1,143 +1,137 @@ -/** Path: theme pagelayout **/ - -/********************************************************************************************* - - left column: 250px - right column: 350px - padding left/right column: 10px - padding center column: 30px - -**********************************************************************************************/ -body {margin:auto 0px;width:auto;} -#page {width:100%;overflow:hidden;} -#page-content { - clear: both; - overflow: hidden; - position: relative; - width: 100%; -} - -#page-content #region-main-box { - float: left; - margin-left: -200px; - position: relative; - width: 200%; - right: 100%; -} - -#page-content #region-main-box #region-post-box { - float: left; - margin-left: -200px; - width: 100%; -} - -#page-content #region-main-box #region-post-box #region-main-wrap { - float: left; - width: 50%; -} - -#page-content #region-main-box #region-post-box #region-main-wrap #region-main { - overflow: hidden; - position: relative; - margin-left: 400px; - left: 100%; -} - -#page-content #region-main-box #region-post-box #region-pre { - float: right; - position: relative; - left: 200px; - width: 200px; -} - -#page-content #region-main-box #region-post-box #region-post { - float: right; - position: relative; - left: 600px; - width: 200px; -} - -#page-content #region-main-box #region-post-box #region-main-wrap #region-main .region-content { - overflow: hidden; - padding: 20px 20px 20px 0; -} - -#page-content #region-main-box #region-post-box #region-pre .region-content, -#page-content #region-main-box #region-post-box #region-post .region-content { - overflow: hidden; - padding: 20px 10px; -} - -#page-footer { - clear: both; - float: left; - width: 100%; -} - -/** Only side pre **/ - -.side-pre-only #page-content #region-main-box { - margin-left: 0px; -} - -.side-pre-only #page-content #region-main-box #region-post-box { - margin-left: -200px; -} - -.side-pre-only #page-content #region-main-box #region-post-box #region-main-wrap #region-main { - margin-left: 200px; -} - -.side-pre-only #page-content #region-main-box #region-post-box #region-pre { - left: 200px; - width: 200px; -} - -.side-pre-only #page-content #region-main-box #region-post-box #region-post { - width: 0%; -} - -/** Only side post **/ - -.side-post-only #page-content #region-main-box { - margin-left: 0px; -} - -.side-post-only #page-content #region-main-box #region-post-box { - margin-left: -200px; -} - -.side-post-only #page-content #region-main-box #region-post-box #region-main-wrap #region-main { - margin-left: 200px; -} - -.side-post-only #page-content #region-main-box #region-post-box #region-post { - left: 200px; - width: 200px; -} - -.has_dock.side-post-only .page-middle #region-main-box #region-post-box #region-main-wrap #region-main { - margin-left: 200px; -} - -/** No blocks whatsoever **/ - -.content-only #page-content #region-main-box { - margin-left: 0px; -} - -.content-only #page-content #region-main-box #region-post-box { - margin-left: 0px; -} - -.content-only #page-content #region-main-box #region-post-box #region-main-wrap #region-main { - margin-left: 0px; -} - -.content-only #page-content #region-main-box #region-post-box #region-pre { - width: 0px; -} - -.content-only #page-content #region-main-box #region-post-box #region-post { - width: 0px; +/** Path: theme pagelayout **/ + + + +body {margin:auto 0px;width:auto;} +#page {width:100%;overflow:hidden;} +#page-content { + clear: both; + overflow: hidden; + position: relative; + width: 100%; +} + +#page-content #region-main-box { + float: left; + margin-left: -[[setting:regionpostwidth]];; + position: relative; + width: 200%; + right: 100%; +} + +#page-content #region-main-box #region-post-box { + float: left; + margin-left: -[[setting:regionprewidth]];; + width: 100%; +} + +#page-content #region-main-box #region-post-box #region-main-wrap { + float: left; + width: 50%; +} + +#page-content #region-main-box #region-post-box #region-main-wrap #region-main { + overflow: hidden; + position: relative; + margin-left: [[setting:regionsumwidth]]; + left: 100%; +} + +#page-content #region-main-box #region-post-box #region-pre { + float: right; + position: relative; + width: [[setting:regionprewidth]]; + left: [[setting:regionprewidth]]; +} + +#page-content #region-main-box #region-post-box #region-post { + float: right; + position: relative; + left: [[setting:regiondoublepresumwidth]]; + width: [[setting:regionpostwidth]]; +} + +#page-content #region-main-box #region-post-box #region-main-wrap #region-main .region-content { + overflow: hidden; + padding: 20px 20px 20px 0; +} + +#page-content #region-main-box #region-post-box #region-pre .region-content, +#page-content #region-main-box #region-post-box #region-post .region-content { + overflow: hidden; + padding: 20px 10px; +} + +#page-footer { + clear: both; + float: left; + width: 100%; +} + +/** Only side pre **/ + +.side-pre-only #page-content #region-main-box { + margin-left: 0px; +} + +.side-pre-only #page-content #region-main-box #region-post-box { + margin-left: -[[setting:regionprewidth]]; +} + +.side-pre-only #page-content #region-main-box #region-post-box #region-main-wrap #region-main { + margin-left: [[setting:regionprewidth]]; +} + +.side-pre-only #page-content #region-main-box #region-post-box #region-pre { + left: [[setting:regionprewidth]]; + width: [[setting:regionprewidth]]; +} + +.side-pre-only #page-content #region-main-box #region-post-box #region-post { + width: 0%; +} + +/** Only side post **/ + +.side-post-only #page-content #region-main-box { + margin-left: 0px; +} + +.side-post-only #page-content #region-main-box #region-post-box { + margin-left: -[[setting:regionpostwidth]]; +} + +.side-post-only #page-content #region-main-box #region-post-box #region-main-wrap #region-main { + margin-left: [[setting:regionpostwidth]]; +} + +.side-post-only #page-content #region-main-box #region-post-box #region-post { + left: [[setting:regionpostwidth]]; + width: [[setting:regionpostwidth]]; +} + +.has_dock.side-post-only .page-middle #region-main-box #region-post-box #region-main-wrap #region-main { + margin-left: [[setting:regionprewidth]]; +} + +/** No blocks whatsoever **/ + +.content-only #page-content #region-main-box { + margin-left: 0px; +} + +.content-only #page-content #region-main-box #region-post-box { + margin-left: 0px; +} + +.content-only #page-content #region-main-box #region-post-box #region-main-wrap #region-main { + margin-left: 0px; +} + +.content-only #page-content #region-main-box #region-post-box #region-pre { + width: 0px; +} + +.content-only #page-content #region-main-box #region-post-box #region-post { + width: 0px; } \ No newline at end of file