diff --git a/e107_plugins/hero/admin_config.php b/e107_plugins/hero/admin_config.php index de65d11a4..1b6b80fe1 100644 --- a/e107_plugins/hero/admin_config.php +++ b/e107_plugins/hero/admin_config.php @@ -80,7 +80,8 @@ class hero_ui extends e_admin_ui protected $fields = array ( 'checkboxes' => array ( 'title' => '', 'type' => null, 'data' => null, 'width' => '5%', 'thclass' => 'center', 'forced' => '1', 'class' => 'center', 'toggle' => 'e-multiselect', ), 'hero_id' => array ( 'title' => LAN_ID, 'type' => null, 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), - 'hero_image' => array('title'=> LAN_IMAGE, 'type'=>'image', 'data'=>'str', 'readParms'=>array('thumb'=>'100x80'), 'writeParms'=>array('media'=>'hero^')), + 'hero_media' => array('title'=> "Image/Video", 'type'=>'image', 'data'=>'str', 'readParms'=>array('thumb'=>'100x80'), 'writeParms'=>array('media'=>'hero^', 'video' => 1)), + 'hero_bg' => array('title'=> "Background", 'type'=>'image', 'data'=>'str', 'readParms'=>array('thumb'=>'100x80'), 'writeParms'=>array('media'=>'hero^')), 'hero_title' => array ( 'title' => LAN_TITLE, 'type' => 'text', 'data' => 'str', 'width' => '18%', 'inline' => true, 'help' => '', 'readParms' => '', 'writeParms' => array('size'=>'block-level'), 'class' => 'left', 'thclass' => 'left', ), 'hero_description' => array ( 'title' => LAN_DESCRIPTION, 'type' => 'text', 'data' => 'str', 'width' => '30%', 'inline' => true, 'help' => '', 'readParms' => '', 'writeParms' => array('size'=>'block-level'), 'class' => 'left', 'thclass' => 'left', ), @@ -93,7 +94,7 @@ class hero_ui extends e_admin_ui 'options' => array ( 'title' => LAN_OPTIONS, 'type' => null, 'data' => null, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced' => '1', ), ); - protected $fieldpref = array('hero_image', 'hero_title', 'hero_description', 'hero_bullets', 'hero_button1', 'hero_class'); + protected $fieldpref = array('hero_media', 'hero_bg', 'hero_title', 'hero_description', 'hero_bullets', 'hero_button1', 'hero_class'); // protected $preftabs = array('General', 'Other' ); diff --git a/e107_plugins/hero/css/hero.css b/e107_plugins/hero/css/hero.css index 5773d0243..884f0f156 100644 --- a/e107_plugins/hero/css/hero.css +++ b/e107_plugins/hero/css/hero.css @@ -108,8 +108,10 @@ li .hero-list-text { position:relative; text-align: center; margin-top: -80px; - width: 100%; + width: 350px; z-index:1000; + margin-left: auto; + margin-right: auto; } #carousel-hero.carousel .carousel-controls a { diff --git a/e107_plugins/hero/e_shortcode.php b/e107_plugins/hero/e_shortcode.php index 6b434c933..32fe32a28 100644 --- a/e107_plugins/hero/e_shortcode.php +++ b/e107_plugins/hero/e_shortcode.php @@ -48,11 +48,9 @@ class hero_shortcodes extends e_shortcode $data = e107::getDb()->retrieve('hero','*',"hero_class IN(".USERCLASS_LIST.") ORDER BY hero_order",true); + $sc = e107::getScBatch('hero', true, 'hero'); - $sc = e107::getScBatch('hero',true, 'hero'); - - $template = e107::getTemplate('hero','hero','menu'); - + $template = e107::getTemplate('hero','hero','default'); // todo use a table field to make layout dynamic. $tp = e107::getParser(); @@ -96,16 +94,11 @@ class hero_shortcodes extends e_shortcode $sc->count = $cnt; - $text .= $tp->parseTemplate($template['item'],true,$sc); - } - $text .= $tp->parseTemplate($template['end'],true,$sc); - - } $text .= $tp->parseTemplate($template['footer'], true, $sc); diff --git a/e107_plugins/hero/hero_setup.php b/e107_plugins/hero/hero_setup.php index 27b3eb541..c4f7c928f 100644 --- a/e107_plugins/hero/hero_setup.php +++ b/e107_plugins/hero/hero_setup.php @@ -37,6 +37,7 @@ if(!class_exists("hero_setup")) if(!empty($ret['failed'])) { e107::getMessage()->addError("Failed to import default slides."); + e107::getMessage()->addDebug(print_a($ret['failed'],true)); } } diff --git a/e107_plugins/hero/hero_shortcodes.php b/e107_plugins/hero/hero_shortcodes.php index 99e369b29..5327fa43e 100644 --- a/e107_plugins/hero/hero_shortcodes.php +++ b/e107_plugins/hero/hero_shortcodes.php @@ -17,14 +17,35 @@ class plugin_hero_hero_shortcodes extends e_shortcode return $this->var['hero_id']; } - public function sc_hero_image($parm=null) + public function sc_hero_media($parm=null) { - if(empty($this->var['hero_image'])) + if(empty($this->var['hero_media'])) { return null; } - return e107::getParser()->replaceConstants($this->var['hero_image'], 'full'); + if(empty($parm['w']) ) + { + $parm['w'] = e107::getParser()->thumbWidth(); + } + + if(empty($parm['h']) ) + { + $parm['h'] = e107::getParser()->thumbHeight(); + } + + return e107::getMedia()->previewTag($this->var['hero_media'], $parm); + // return e107::getParser()->replaceConstants($this->var['hero_media'], 'full'); + } + + public function sc_hero_bgimage($parm=null) + { + if(empty($this->var['hero_bg'])) + { + return null; + } + + return e107::getParser()->replaceConstants($this->var['hero_bg'], 'full'); } public function sc_hero_carousel_indicators($parm=null) diff --git a/e107_plugins/hero/hero_sql.php b/e107_plugins/hero/hero_sql.php index f736bf164..c7aee62c6 100644 --- a/e107_plugins/hero/hero_sql.php +++ b/e107_plugins/hero/hero_sql.php @@ -1,11 +1,12 @@ CREATE TABLE `hero` ( `hero_id` int(10) NOT NULL AUTO_INCREMENT, `hero_title` varchar(255) NOT NULL, - `hero_description` varchar(255) NOT NULL, - `hero_image` varchar(255) NOT NULL, - `hero_bullets` text NOT NULL, - `hero_button1` text NOT NULL, - `hero_button2` text NOT NULL, + `hero_description` varchar(255) default '', + `hero_bg` varchar(255) NOT NULL, + `hero_media` varchar(255) default '', + `hero_bullets` text default '', + `hero_button1` text default '', + `hero_button2` text default '', `hero_order` tinyint(3) unsigned NOT NULL default '0', `hero_class` int(5) default '0', PRIMARY KEY (hero_id) diff --git a/e107_plugins/hero/templates/hero_template.php b/e107_plugins/hero/templates/hero_template.php index fd7db8aac..e851ec373 100644 --- a/e107_plugins/hero/templates/hero_template.php +++ b/e107_plugins/hero/templates/hero_template.php @@ -7,12 +7,12 @@ if (!defined('e107_INIT')) { exit; } $HERO_TEMPLATE = array(); -$HERO_TEMPLATE['menu']['header'] = '{SETIMAGE: w=400&h=400} +$HERO_TEMPLATE['default']['header'] = '{SETIMAGE: w=400&h=400}