From 7efdd3f31fb30cc99e73b489346f89414e5daed8 Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 6 Jan 2014 07:52:13 -0800 Subject: [PATCH] Bootstrap3 styling fixes and embedded featurebox layout added. --- e107_core/shortcodes/single/wmessage.php | 5 +++ e107_plugins/featurebox/e_shortcode.php | 9 +++- e107_plugins/featurebox/featurebox_setup.php | 31 +++++++------- e107_plugins/featurebox/includes/item.php | 10 +++-- .../templates/featurebox_template.php | 41 +++++++++++++------ e107_themes/bootstrap3/style.css | 30 ++++++++++++++ e107_themes/bootstrap3/theme.php | 35 ++++++++++++++-- e107_themes/bootstrap3/theme.xml | 5 ++- 8 files changed, 128 insertions(+), 38 deletions(-) diff --git a/e107_core/shortcodes/single/wmessage.php b/e107_core/shortcodes/single/wmessage.php index 993368b91..8a5f10be4 100644 --- a/e107_core/shortcodes/single/wmessage.php +++ b/e107_core/shortcodes/single/wmessage.php @@ -2,6 +2,11 @@ function wmessage_shortcode($parm) { + if($parm == 'hide') + { + return; + } + $e107 = e107::getInstance(); $e107cache = e107::getCache(); $pref = e107::getPref(); diff --git a/e107_plugins/featurebox/e_shortcode.php b/e107_plugins/featurebox/e_shortcode.php index 777d720e3..afdc3a7cc 100644 --- a/e107_plugins/featurebox/e_shortcode.php +++ b/e107_plugins/featurebox/e_shortcode.php @@ -28,9 +28,16 @@ class featurebox_shortcodes// must match the plugin's folder name. ie. [PLUGIN_F * @param string $mod category template * @example {FEATUREBOX=cols=2|tabs} */ - function sc_featurebox($parm, $mod = '') + function sc_featurebox($parm=null, $mod = '') { + if($parm == null && $mod == '') // ie {FEATUREBOX} + { + $type = vartrue(e107::getPlugPref('featurebox','menu_category'),'bootstrap_carousel'); + $text = e107::getParser()->parseTemplate("{FEATUREBOX|".$type."}"); + return $text; + } + // TODO cache if(!e107::isInstalled('featurebox')) //just in case { diff --git a/e107_plugins/featurebox/featurebox_setup.php b/e107_plugins/featurebox/featurebox_setup.php index fcd5b9eac..67ebadddc 100644 --- a/e107_plugins/featurebox/featurebox_setup.php +++ b/e107_plugins/featurebox/featurebox_setup.php @@ -40,35 +40,36 @@ class featurebox_setup $count = 0; foreach($e107_featurebox_category as $insert) { - $count = e107::getDb()->db_Insert('featurebox_category', $insert) ? $count + 1 : $count; + $count = e107::getDb()->insert('featurebox_category', $insert) ? $count + 1 : $count; } $status = ($count == 3) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; + $mes->add(FBLAN_INSTALL_01, $status); if($status) { - $query = array(); - $query['fb_id'] = 0; - $query['fb_category'] = $inserted; - $query['fb_title'] = 'Default Title'; - $query['fb_text'] = 'Default Message'; - $query['fb_mode'] = 0; - $query['fb_class'] = e_UC_PUBLIC; - $query['fb_rendertype'] = 0; - $query['fb_template'] = 'bootstrap_carousel'; - $query['fb_order'] = 0; - $query['fb_image'] = ''; - $query['fb_imageurl'] = ''; + $e107_featurebox = array( + array('fb_id'=>'4','fb_title'=>'Slide 1','fb_text'=>'Default Message - this is the default','fb_mode'=>'0','fb_class'=>'0','fb_rendertype'=>'0','fb_template'=>'bootstrap_carousel_default','fb_order'=>'3','fb_image'=>'','fb_imageurl'=>'','fb_category'=>'1'), + array('fb_id'=>'6','fb_title'=>'Slide 2','fb_text'=>'Suspendisse ac dui purus. Cras eleifend, velit sed dapibus pharetra, elit dolor mattis tellus, ac luctus nisi massa at ligula. Ut sagittis, neque consequat elementum convallis, lorem nulla molestie arcu, eu rutrum velit quam at metus! Nullam eu eleifend magna. Praesent eget leo felis, vel euismod nibh. Morbi sem eros, pellentesque eu scelerisque id, pretium id enim. Mauris aliquet molestie dui vel ultricies. Etiam consequat quam sed tellus facilisis sollicitudin. Vivamus malesuada iaculis metus. + ','fb_mode'=>'0','fb_class'=>'0','fb_rendertype'=>'0','fb_template'=>'bootstrap_carousel_left','fb_order'=>'4','fb_image'=>'','fb_imageurl'=>'','fb_category'=>'1'), + array('fb_id'=>'10','fb_title'=>'Slide 3','fb_text'=>'Suspendisse ac dui purus. Cras eleifend, velit sed dapibus pharetra, elit dolor mattis tellus, ac luctus nisi massa at ligula. Ut sagittis, neque consequat elementum convallis, lorem nulla molestie arcu, eu rutrum velit quam at metus! Nullam eu eleifend magna. Praesent eget leo felis, vel euismod nibh. Morbi sem eros, pellentesque eu scelerisque id, pretium id enim. Mauris aliquet molestie dui vel ultricies. Etiam consequat quam sed tellus facilisis sollicitudin. Vivamus malesuada iaculis metus. + ','fb_mode'=>'0','fb_class'=>'0','fb_rendertype'=>'0','fb_template'=>'bootstrap_carousel_right','fb_order'=>'4','fb_image'=>'','fb_imageurl'=>'','fb_category'=>'1') + ); - $status = e107::getDb('sql2')->db_Insert('featurebox', $query) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; + foreach($e107_featurebox as $qry) + { + $status = e107::getDb('sql2')->insert('featurebox', $qry) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; + } + $mes->add(FBLAN_INSTALL_02, $status); } else { $status = E_MESSAGE_ERROR; + $mes->add(FBLAN_INSTALL_02, $status); } - $mes->add(FBLAN_INSTALL_02, $status); + } /* function uninstall_options() diff --git a/e107_plugins/featurebox/includes/item.php b/e107_plugins/featurebox/includes/item.php index e01d10dde..c8dc41704 100644 --- a/e107_plugins/featurebox/includes/item.php +++ b/e107_plugins/featurebox/includes/item.php @@ -120,27 +120,29 @@ class plugin_featurebox_item extends e_model */ public function sc_featurebox_image($parm = '') { - if(!$this->get('fb_image')) + if(!$this->get('fb_image') && $parm != 'placeholder') { return ''; } parse_str($parm, $parm); $tp = e107::getParser(); + $imageSrc = ($parm != 'placeholder') ? $this->get('fb_image') : ""; + if($tp->thumbWidth > 100 || $tp->thumbHeight > 100) //Guessing it's a featurebox image. Use {SETIMAGE} inside theme.php to configure. { - $src = $tp->thumbUrl($this->get('fb_image')); //XXX TODO TBD Add a pref to use without resizing? Or, detect {SETIMAGE} in template to enable? + $src = $tp->thumbUrl($imageSrc); //XXX TODO TBD Add a pref to use without resizing? Or, detect {SETIMAGE} in template to enable? } else { - $src = $tp->replaceConstants($this->get('fb_image'), 'full'); + $src = $tp->replaceConstants($imageSrc, 'full'); } if(isset($parm['src'])) { return $src; } - $tag = ''.$tp->toAttribute($this->get('fb_title')).''; + $tag = ''.$tp->toAttribute($this->get('fb_title')).''; if(isset($parm['nourl']) || !$this->get('fb_imageurl')) { return $tag; diff --git a/e107_plugins/featurebox/templates/featurebox_template.php b/e107_plugins/featurebox/templates/featurebox_template.php index fc5d36dec..27bc956df 100644 --- a/e107_plugins/featurebox/templates/featurebox_template.php +++ b/e107_plugins/featurebox/templates/featurebox_template.php @@ -11,12 +11,24 @@ global $sc_style; // e107 v2.x Defaults. +$FEATUREBOX_TEMPLATE['bootstrap_carousel_default'] = '{SETIMAGE: w=1900&h=500&crop=1} +
+ {FEATUREBOX_IMAGE=placeholder} +
+ +
+
'; + + $FEATUREBOX_TEMPLATE['bootstrap_carousel_left'] = ' - + {SETIMAGE: w=600&h=500&crop=1}
-
+
- {FEATUREBOX_IMAGE} + {FEATUREBOX_IMAGE=placeholder}

@@ -31,27 +43,32 @@ $FEATUREBOX_TEMPLATE['bootstrap_carousel_left'] = ' '; $FEATUREBOX_TEMPLATE['bootstrap_carousel_right'] = ' + {SETIMAGE: w=600&h=500&crop=1}
-
-
+
+
+ {FEATUREBOX_IMAGE=placeholder} +
+

{FEATUREBOX_TITLE}

{FEATUREBOX_TEXT}
-
- {FEATUREBOX_IMAGE} -
'; -$FEATUREBOX_TEMPLATE['bootstrap_carousel_image'] = ' -
- {FEATUREBOX_IMAGE} -
+$FEATUREBOX_TEMPLATE['bootstrap_carousel_image'] = '{SETIMAGE: w=1900&h=500&crop=1} + +
+ {FEATUREBOX_IMAGE=placeholder} +
'; + + + // ---------------------------- diff --git a/e107_themes/bootstrap3/style.css b/e107_themes/bootstrap3/style.css index 9eb35635f..61c1a1298 100644 --- a/e107_themes/bootstrap3/style.css +++ b/e107_themes/bootstrap3/style.css @@ -51,4 +51,34 @@ body { margin-bottom: 10px; border-top-left-radius: 0; border-top-right-radius: 0; +} + + + + + +/* CUSTOMIZE THE CAROUSEL +-------------------------------------------------- */ + +/* Carousel base class */ +.carousel { + height: 500px; + margin-bottom: 60px; +} +/* Since positioning the image, we need to help out the caption */ +.carousel-caption { + z-index: 10; +} + +/* Declare heights because of positioning of img element */ +.carousel .item { + height: 500px; + background-color: #777; +} +.carousel-inner > .item > img { + position: absolute; + top: 0; + left: 0; + min-width: 100%; + height: 500px; } \ No newline at end of file diff --git a/e107_themes/bootstrap3/theme.php b/e107_themes/bootstrap3/theme.php index 9a5217281..72c25c020 100644 --- a/e107_themes/bootstrap3/theme.php +++ b/e107_themes/bootstrap3/theme.php @@ -30,7 +30,7 @@ function tablestyle($caption, $text, $mode='') $type = 'box'; } - if($style == 'navdoc') + if($style == 'navdoc' || $mode == 'featurebox') { echo $text; return; @@ -101,9 +101,7 @@ $LAYOUT['_header_'] = '
- - {SETSTYLE=jumbotron} - {WMESSAGE} + '; @@ -121,7 +119,11 @@ $LAYOUT['_footer_'] = '
// $LAYOUT is a combined $HEADER and $FOOTER, automatically split at the point of "{---}" $LAYOUT['jumbotron_home'] = ' + + {SETSTYLE=jumbotron} + {WMESSAGE=force} + {SETSTYLE=default}
{ALERTS} @@ -141,6 +143,31 @@ $LAYOUT['jumbotron_home'] = ' '; +$LAYOUT['jumbotron_carousel'] = ' + + {SETSTYLE=jumbotron} + + {WMESSAGE=hide} + + {FEATUREBOX} + + {SETSTYLE=default} +
+ {ALERTS} + + {---} + +
+
+ +
+ {SETSTYLE=col-md-4} + {CMENU=jumbotron-menu-1} + {CMENU=jumbotron-menu-2} + {CMENU=jumbotron-menu-3} +
+ + '; $LAYOUT['jumbotron_full'] = ' diff --git a/e107_themes/bootstrap3/theme.xml b/e107_themes/bootstrap3/theme.xml index dd23b5a10..1ab1ceacf 100644 --- a/e107_themes/bootstrap3/theme.xml +++ b/e107_themes/bootstrap3/theme.xml @@ -18,8 +18,9 @@ FRONTPAGE - - + + + /news