Permalink
Browse files

add a simplelogin setting

  • Loading branch information...
1 parent b12794d commit 2b8fb5ad089d53352082ee06ec9ea80115299a22 Danny Wahl committed Apr 26, 2012
Showing with 47 additions and 15 deletions.
  1. +10 −10 config.php
  2. +3 −0 lang/en/theme_zebra.php
  3. +9 −5 layout/header.php
  4. +8 −0 settings.php
  5. +17 −0 style/pagelayout.css
View
@@ -54,7 +54,7 @@
'file' => 'general.php',
'regions' => array('side-pre', 'side-post'),
'defaultregion' => 'side-pre',
- 'options' => array('langmenu'=>true)
+ 'options' => array('langmenu'=>true, 'noblocks'=>true)
),
'standard' => array(
'file' => 'general.php',
@@ -66,19 +66,19 @@
'file' => 'general.php',
'regions' => array('side-pre', 'side-post'),
'defaultregion' => 'side-pre',
- 'options' => array()
+ 'options' => array('langmenu'=>true)
),
'coursecategory' => array(
'file' => 'general.php',
'regions' => array('side-pre', 'side-post'),
'defaultregion' => 'side-pre',
- 'options' => array()
+ 'options' => array('langmenu'=>true)
),
'incourse' => array(
'file' => 'general.php',
'regions' => array('side-pre', 'side-post'),
'defaultregion' => 'side-pre',
- 'options' => array()
+ 'options' => array('langmenu'=>true)
),
'frontpage' => array(
'file' => 'general.php',
@@ -90,24 +90,24 @@
'file' => 'general.php',
'regions' => array('side-pre'),
'defaultregion' => 'side-pre',
- 'options' => array()
+ 'options' => array('langmenu'=>true)
),
'mydashboard' => array(
'file' => 'general.php',
'regions' => array('side-pre', 'side-post'),
'defaultregion' => 'side-pre',
- 'options' => array()
+ 'options' => array('langmenu'=>true)
),
'mypublic' => array(
'file' => 'general.php',
'regions' => array('side-pre', 'side-post'),
'defaultregion' => 'side-pre',
- 'options' => array()
+ 'options' => array('langmenu'=>true)
),
'login' => array(
'file' => 'general.php',
'regions' => array(),
- 'options' => array('nofooter'=>true, 'noblocks'=>true, 'nonavbar'=>true, 'nocustommenu'=>true, 'nologininfo'=>true)
+ 'options' => array('langmenu'=>true)
),
'popup' => array(
'file' => 'general.php',
@@ -122,7 +122,7 @@
'maintenance' => array(
'file' => 'general.php',
'regions' => array(),
- 'options' => array('nofooter'=>true, 'nonavbar'=>true, 'nocustommenu'=>true, 'nologininfo'=>true)
+ 'options' => array('nofooter'=>true, 'noblocks'=>true, 'nonavbar'=>true, 'nocustommenu'=>true, 'nologininfo'=>true)
),
'embedded' => array(
'file' => 'general.php',
@@ -132,7 +132,7 @@
'print' => array(
'file' => 'general.php',
'regions' => array(),
- 'options' => array('nofooter'=>true, 'noblocks'=>true)
+ 'options' => array('nofooter'=>true, 'noblocks'=>true, 'nonavbar'=>true, 'nocustommenu'=>true, 'nologininfo'=>true)
),
'redirect' => array(
'file' => 'general.php',
@@ -147,6 +147,9 @@
$string['colwidth'] = 'Column width';
$string['colwidthdesc'] = '<p>Width of columns. This is <code>region-pre</code> and <code>region-post</code>.</p>';
+$string['simplelogin'] = 'Use a basic login form';
+$string['simplelogindesc'] = '<p>Enabling this option will simply the login page layout by not displaying the header, footer, navbar, lang menu, or custommenu. This option can be use for sites that require authentication before access to those items is granted.</p>';
+
$string['compatinfo'] = 'Browser compatibility settings';
$string['compatinfodesc'] = '<p>Various settings to attempt to improve browser compatibility with this theme for a more consistent user experience.</p>';
View
@@ -21,18 +21,19 @@
* @copyright 2011 Danny Wahl
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+$simplelogin = (($PAGE->theme->settings->simplelogin) && (strpos($PAGE->bodyclasses, 'path-login'))); //Check for simplelogin setting
$hasheading = ($PAGE->heading); //Check for the page title
-$hasnavbar = (empty($PAGE->layout_options['nonavbar']) && $PAGE->has_navbar()); //Check to see if this page-lay has a navbar
-$hasfooter = (empty($PAGE->layout_options['nofooter'])); //Check to see if this page-layout has a footer
+$hasnavbar = (empty($PAGE->layout_options['nonavbar']) && $PAGE->has_navbar() && !$simplelogin); //Check to see if this page-lay has a navbar
+$hasfooter = (empty($PAGE->layout_options['nofooter']) && !$simplelogin); //Check to see if this page-layout has a footer
$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'])); //Check if the login info (user name, etc...) is available in this page-layout
-$haslangmenu = (!empty($PAGE->layout_options['langmenu'])); //Check if the language menu is available in this page-layout
+$haslogininfo = (empty($PAGE->layout_options['nologininfo']) && !$simplelogin); //Check if the login info (user name, etc...) is available in this page-layout
+$haslangmenu = (!empty($PAGE->layout_options['langmenu']) && !$simplelogin); //Check if the language menu is available in this page-layout
$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)); //Check if this page-layout has a custommenu and if it has content
+$hascustommenu = (empty($PAGE->layout_options['nocustommenu']) && !empty($custommenu) && !$simplelogin); //Check if this page-layout has a custommenu and if it has content
$bodyclasses = array();
if ($showsidepre && !$showsidepost) {
$bodyclasses[] = 'side-pre-only';
@@ -41,6 +42,9 @@
} else if (!$showsidepost && !$showsidepre) {
$bodyclasses[] = 'content-only';
}
+if ($simplelogin) {
+ $bodyclasses[] = 'pagelayout-simple-login'; //Add class to body tag for styling
+}
if ($hascustommenu) {
$bodyclasses[] = 'has_custom_menu';
}
View
@@ -309,6 +309,14 @@
$setting = new admin_setting_configtext($name, $title, $description, $default, PARAM_CLEAN, 5);
$settings->add($setting);
+ //Set whether or not to use the simple login layout
+ $name = 'theme_zebra/simplelogin';
+ $visiblename = get_string('simplelogin', 'theme_zebra');
+ $title = get_string('simplelogin', 'theme_zebra');
+ $description = get_string('simplelogindesc', 'theme_zebra');
+ $setting = new admin_setting_configcheckbox($name, $visiblename, $description, 0);
+ $settings->add($setting);
+
//Set column width for region-pre and region-post
$name = 'theme_zebra/colwidth';
$title = get_string('colwidth','theme_zebra');
View
@@ -217,4 +217,21 @@ body {
.dir-rtl {
direction: ltr;
overflow-x: hidden;
+}
+
+/* Simple Login Layout */
+.path-login.pagelayout-simple-login #page {
+ display: table; /* Force the page width to that of the content */
+}
+
+.path-login.pagelayout-simple-login .loginbox {
+ max-width: [[setting:twocolmin]]; /* single column width */
+}
+
+.path-login.pagelayout-simple-login .loginbox.twocolumns {
+ max-width: [[setting:threecolmin]]; /* two column width */
+}
+
+.path-login .loginbox.twocolumns .loginpanel {
+ border-right: 0 none; /* Remove the border between the columns */
}

0 comments on commit 2b8fb5a

Please sign in to comment.