From e2d67d8ecdae2159c0fce8e6a43d70203dd4b8c5 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 21 Dec 2013 01:32:39 -0800 Subject: [PATCH] Issue #435 - Initial Bootstrap3 theme added. --- .../shortcodes/batch/page_shortcodes.php | 2 +- e107_core/shortcodes/single/wmessage.php | 1 - e107_core/templates/header_default.php | 12 + e107_handlers/form_handler.php | 4 + .../login_menu/login_menu_shortcodes.php | 4 +- e107_themes/bootstrap3/style.css | 5 + e107_themes/bootstrap3/theme.php | 549 ++++++++++++++++++ e107_themes/bootstrap3/theme.xml | 23 + e107_themes/bootstrap3/theme_shortcodes.php | 119 ++++ 9 files changed, 715 insertions(+), 4 deletions(-) create mode 100644 e107_themes/bootstrap3/style.css create mode 100644 e107_themes/bootstrap3/theme.php create mode 100644 e107_themes/bootstrap3/theme.xml create mode 100644 e107_themes/bootstrap3/theme_shortcodes.php diff --git a/e107_core/shortcodes/batch/page_shortcodes.php b/e107_core/shortcodes/batch/page_shortcodes.php index f6af4bb7a..a95c826a6 100644 --- a/e107_core/shortcodes/batch/page_shortcodes.php +++ b/e107_core/shortcodes/batch/page_shortcodes.php @@ -189,7 +189,7 @@ class cpage_shortcodes extends e_shortcode $size = vartrue($options['size'], ""); $inc = ($size) ? " btn-".$size : ""; - return ''.$text.''; + return ''.$text.''; } diff --git a/e107_core/shortcodes/single/wmessage.php b/e107_core/shortcodes/single/wmessage.php index abbd70b9e..993368b91 100644 --- a/e107_core/shortcodes/single/wmessage.php +++ b/e107_core/shortcodes/single/wmessage.php @@ -36,7 +36,6 @@ function wmessage_shortcode($parm) if (strpos($front_url, 'http') === FALSE) $front_url = SITEURL.$front_url; - if (deftrue('e_FRONTPAGE') || ($parm == 'force') || ((e_SELF == $front_url) && (($parm == 'ignore_query') || (e_QUERY == $front_qry)))) { // Actually want to display a welcome message here diff --git a/e107_core/templates/header_default.php b/e107_core/templates/header_default.php index 09b742089..853942bd0 100644 --- a/e107_core/templates/header_default.php +++ b/e107_core/templates/header_default.php @@ -576,6 +576,18 @@ echo "\n"; // ---------- New in 2.0 ------------------------------------------------------- + if(isset($LAYOUT) && is_array($LAYOUT)) // $LAYOUT is a combined $HEADER,$FOOTER. + { + foreach($LAYOUT as $key=>$template) + { + list($hd,$ft) = explode("{...}",$template); + $HEADER[$key] = $hd; + $FOOTER[$key] = $ft; + } + unset($hd,$ft); + } + + $def = THEME_LAYOUT; // The active layout based on custompage matches. // echo "DEF = ".$def."
"; diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 54d7eb674..eb767588c 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -1702,6 +1702,10 @@ class e_form case 'filter e-hide-if-js': // FIXME hide-js shouldn't be here. $options['class'] .= 'btn-primary'; break; + + default: + $options['class'] .= 'btn-default'; + break; } return " diff --git a/e107_plugins/login_menu/login_menu_shortcodes.php b/e107_plugins/login_menu/login_menu_shortcodes.php index 98a3466ab..6d33960ba 100755 --- a/e107_plugins/login_menu/login_menu_shortcodes.php +++ b/e107_plugins/login_menu/login_menu_shortcodes.php @@ -35,7 +35,7 @@ $login_menu_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__); /* SC_BEGIN LM_USERNAME_INPUT global $pref; - return "\n"; + return "\n"; SC_END SC_BEGIN LM_USERNAME_LABEL @@ -54,7 +54,7 @@ SC_END SC_BEGIN LM_PASSWORD_INPUT global $pref; -$t_password = "\n"; +$t_password = "\n"; if (!USER && e107::getSession()->is('challenge') && varset($pref['password_CHAP'],0)) $t_password .= "\n\n"; return $t_password; SC_END diff --git a/e107_themes/bootstrap3/style.css b/e107_themes/bootstrap3/style.css new file mode 100644 index 000000000..2926d92e8 --- /dev/null +++ b/e107_themes/bootstrap3/style.css @@ -0,0 +1,5 @@ +/* Move down content because we have a fixed navbar that is 50px tall */ +body { + padding-top: 50px; + padding-bottom: 20px; +} \ No newline at end of file diff --git a/e107_themes/bootstrap3/theme.php b/e107_themes/bootstrap3/theme.php new file mode 100644 index 000000000..0b0df0e83 --- /dev/null +++ b/e107_themes/bootstrap3/theme.php @@ -0,0 +1,549 @@ +'); + + +function tablestyle($caption, $text, $mode='') +{ + global $style; + + $type = $style; + if(empty($caption)) + { + $type = 'box'; + } + + if($style == 'navdoc') + { + echo $text; + return; + } + + + if($style == 'jumbotron') + { + echo '
+
+

'.$caption.'

+

'.$text.'

+
+
'; + return; + } + + if($style == 'col-md-4') + { + echo '
+

'.$caption.'

+ '.$text.' +
'; + return; + + } + + + if($mode == 'loginbox') // Login Box Style. + { + echo ''; + return; + } + + if($mode == 'login_page') + { + $type = 'no_caption'; + } + + switch($type) + { + // Default Menu/Side-Panel Style + case 'menu' : + echo ''; + break; + + case 'span4' : + echo $text; + break; + + case 'box': + echo ' +
+
+ '.$text.' +
+
+ '; + break; + + case 'no_caption': + echo $text; + break; + + default: // Main Content Style. + echo ' +

'.$caption.'

+

+ '.$text.' +

+ + '; + break; + } +} + + + +// $LAYOUT is a combined $HEADER and $FOOTER, automatically split at the point of "{...}" +$LAYOUT['jumbotron'] = ' + + + + {SETSTYLE=jumbotron} + {WMESSAGE} + {SETSTYLE=default} +
+ {...} +
+
+ +
+ {SETSTYLE=col-md-4} + {CMENU=jumbotron-menu-1} + {CMENU=jumbotron-menu-2} + {CMENU=jumbotron-menu-3} +
+ +
+ +
+

© Company 2013

+
+
+ +'; + + + + + + + + + + + + + + + + + + + +$HEADER['default'] = ' + +
+
+
+ {NAVIGATION|s=side} + {SETSTYLE=menu} + {MENU=1} +
+
+ {SETSTYLE=default} + {WMESSAGE} +'; + + + +$FOOTER['default'] = ' + {SETSTYLE=span4} + +
+
+ +
+ +
+ {SITEDISCLAIMER} +
+ +
'; + + +$HEADER['default-home'] = $HEADER['default']; + + +$FOOTER['default-home'] = ' + + {SETSTYLE=span4} + +
+ {MENU=2} +
+
+ {MENU=3} +
+ + + + +
+ + + +'; + + + + + + + + + + +// HERO http://twitter.github.com/bootstrap/examples/hero.html +//FIXME insert shortcodes while maintaining only bootstrap classes. + +$HEADER['hero'] = ' + + + +
+ + +
'; + + /* +

Hello, world!

+

This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.

+

Learn more »

+ */ + + +//FIXME insert shortcodes while maintaining classes. +$FOOTER['hero'] = ' +
+ + +
+
+

Heading

+

Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.

+

View details »

+
+
+

Heading

+

Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.

+

View details »

+
+
+

Heading

+

Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.

+

View details »

+
+
+ +
+ +
+

© Company 2012

+
+ +
'; + + +// Marketing Narrow - http://twitter.github.com/bootstrap/examples/marketing-narrow.html +//FIXME insert shortcodes while maintaing classes. + +$HEADER['marketing-narrow'] = ' +
+ +
+ +

Project name

+
+ +
+ +
+

Super awesome marketing speak!

+

Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.

+ Sign up today +'; + + +//FIXME insert shortcodes while maintaing classes. + +$FOOTER['marketing-narrow'] = ' +
+ +
+ +
+
+

Subheading

+

Donec id elit non mi porta gravida at eget metus. Maecenas faucibus mollis interdum.

+ +

Subheading

+

Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Cras mattis consectetur purus sit amet fermentum.

+ +

Subheading

+

Maecenas sed diam eget risus varius blandit sit amet non magna.

+
+ +
+

Subheading

+

Donec id elit non mi porta gravida at eget metus. Maecenas faucibus mollis interdum.

+ +

Subheading

+

Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Cras mattis consectetur purus sit amet fermentum.

+ +

Subheading

+

Maecenas sed diam eget risus varius blandit sit amet non magna.

+
+
+ +
+ + + +
+ +'; + + + + + + + +/* + + $CUSTOMHEADER, CUSTOMFOOTER and $CUSTOMPAGES are deprecated. + Default custom-pages can be assigned in theme.xml + + */ + + + +$HEADER['docs'] = << + + + +
+
+

{PAGE_CHAPTER_NAME}

+

{PAGE_CHAPTER_DESCRIPTION}

+
+
+ + +
+ + +
+ +
+ {SETSTYLE=navdoc} + {PAGE_NAVIGATION: template=navdocs&auto=1} +
+ {SETSTYLE=doc} + +
+ + + + + +TMPL; + + +$FOOTER['docs'] = << +
+
+ + +
+
+

{SITEDISCLAIMER}

+ +
+
+ + + +TMPL; + + + + + + +$NEWSCAT = "\n\n\n\n\n\n\n\n +
+
+ {NEWSCATEGORY} +
+
+ {NEWSCAT_ITEM} +
+
+"; + + +$NEWSCAT_ITEM = "\n\n\n\n\n\n\n\n +
+ + +
•  + {NEWSTITLELINK} +
+"; + + + +?> \ No newline at end of file diff --git a/e107_themes/bootstrap3/theme.xml b/e107_themes/bootstrap3/theme.xml new file mode 100644 index 000000000..9184fb9c6 --- /dev/null +++ b/e107_themes/bootstrap3/theme.xml @@ -0,0 +1,23 @@ + + + + Bootstrap3 e107 theme + a bootstrap 3 theme for the frontend + generic + + bootstrap + clean + + + preview.jpg + fullpreview.jpg + + + + + + + FRONTPAGE + + + \ No newline at end of file diff --git a/e107_themes/bootstrap3/theme_shortcodes.php b/e107_themes/bootstrap3/theme_shortcodes.php new file mode 100644 index 000000000..cad1b9f13 --- /dev/null +++ b/e107_themes/bootstrap3/theme_shortcodes.php @@ -0,0 +1,119 @@ +'; + + if(deftrue('USER_REGISTRATION')) + { + $text .= ' +
  • Sign Up
  • + '; + } + + $text .= ' +
  • + + + + + "; + + + require_once(e_PLUGIN."login_menu/login_menu_shortcodes.php"); + return $tp->parseTemplate($text, false, $login_menu_shortcodes); + } + + + // Logged in. + //TODO Generic LANS. (not theme LANs) + + $avatar = $tp->parseTemplate('{USER_AVATAR}',true); + + + $text = ' + + + + '; + + return $tp->parseTemplate($text,true); + } + + + +} + + + + + +?> \ No newline at end of file