From 524bed7a17b1f0f7790f6ffaa78b32faa3903a99 Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 11 Mar 2016 10:27:40 -0800 Subject: [PATCH] Banner plugin enhancements. Text may be added below banner/images. --- e107_languages/English/admin/lan_admin.php | 3 ++ e107_languages/English/admin/lan_mailout.php | 3 +- e107_plugins/banner/admin_banner.php | 53 ++++++++++++++----- e107_plugins/banner/banner_sql.php | 1 + e107_plugins/banner/e_shortcode.php | 15 +++++- .../banner/languages/English_admin.php | 2 +- 6 files changed, 61 insertions(+), 16 deletions(-) diff --git a/e107_languages/English/admin/lan_admin.php b/e107_languages/English/admin/lan_admin.php index 9b084bd45..9635fd1a6 100644 --- a/e107_languages/English/admin/lan_admin.php +++ b/e107_languages/English/admin/lan_admin.php @@ -423,5 +423,8 @@ define("LAN_WILL_OVERWRITE_SEF", "This will overwrite your existing SEF URL."); define("LAN_CAPTION", "Caption"); define("LAN_LIMIT", "Limit"); +define("LAN_BASIC", "Basic"); +define("LAN_ADVANCED", "Advanced"); + // TODO - move e_form related LANS below, add new lan_form.php file (for both front/back-end) diff --git a/e107_languages/English/admin/lan_mailout.php b/e107_languages/English/admin/lan_mailout.php index d267064d2..8ea65f180 100644 --- a/e107_languages/English/admin/lan_mailout.php +++ b/e107_languages/English/admin/lan_mailout.php @@ -280,8 +280,7 @@ define("LAN_MAILOUT_259", ""); define("LAN_SEND", "Send"); define("LAN_HOLD", "Hold"); define("LAN_MAILOUT_260", "User-Type"); -define("LAN_BASIC", "Basic"); -define("LAN_ADVANCED", "Advanced"); + //define("LAN_SUBMIT", "Do it!"); LAN_RUN diff --git a/e107_plugins/banner/admin_banner.php b/e107_plugins/banner/admin_banner.php index 3ad7ec23a..e8e30dfe8 100644 --- a/e107_plugins/banner/admin_banner.php +++ b/e107_plugins/banner/admin_banner.php @@ -30,7 +30,30 @@ if (!getperms('D') && !getperms('P')) $e_sub_cat = 'banner'; e107::lan('banner',false,'front'); -e107::lan('banner',true,true); +e107::lan('banner',true,true); + +e107::js('footer-inline',' + + $("#banner-campaign-sel").on("change", function() { + + vr = $(this).val(); + if(vr == "_new_") + { + $("#banner-campaign").show("slow"); + } + else + { + $("#banner-campaign").hide("slow"); + } + + }); + + + + +'); + + class banner_admin extends e_admin_dispatcher @@ -82,7 +105,7 @@ class banner_ui extends e_admin_ui // protected $batchCopy = true; // protected $sortField = 'somefield_order'; // protected $orderStep = 10; - // protected $tabs = array('General','Advanced'); // Use 'tab'=>0 OR 'tab'=>1 in the $fields below to enable. + protected $tabs = array(LAN_BASIC, LAN_ADVANCED); // Use 'tab'=>0 OR 'tab'=>1 in the $fields below to enable. // protected $listQry = "SELECT * FROM `#tableName` WHERE field != '' "; // Example Custom Query. LEFT JOINS allowed. Should be without any Order or Limit. @@ -91,18 +114,20 @@ class banner_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', ), 'banner_id' => array ( 'title' => LAN_ID, 'data' => 'int', 'width' => '2%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), - 'banner_campaign' => array ( 'title' => 'Campaign', 'type' => 'method', 'data' => 'str', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), + 'banner_campaign' => array ( 'title' => 'Campaign', 'type' => 'method', 'data' => 'str', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => array( 'tdClassRight'=>'form-inline'), 'class' => 'left', 'thclass' => 'left', ), - 'banner_clientname' => array ( 'title' => 'Clientname', 'type' => 'method', 'data' => 'str', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), - 'banner_clientlogin' => array ( 'title' => BNRLAN_12, 'type' => 'method', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ), - 'banner_clientpassword' => array ( 'title' => BNRLAN_13, 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => 'strength=1&password=1&required=0&generate=1&nomask=1', 'class' => 'center', 'thclass' => 'center', ), + 'banner_clientname' => array ( 'title' => 'Clientname', 'type' => 'method', 'tab'=>1, 'data' => 'str', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), + 'banner_clientlogin' => array ( 'title' => BNRLAN_12, 'type' => 'method', 'tab'=>1, 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ), + 'banner_clientpassword' => array ( 'title' => BNRLAN_13, 'type' => 'text', 'tab'=>1,'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => 'strength=1&password=1&required=0&generate=1&nomask=1', 'class' => 'center', 'thclass' => 'center', ), 'banner_image' => array ( 'title' => BNRLAN_14, 'type' => 'image', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => 'thumb=0x50', 'writeParms' => 'media=banner&w=600', 'class' => 'left', 'thclass' => 'left', ), 'banner_clickurl' => array ( 'title' => BNRLAN_15, 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'inline' => true, 'help' => '', 'readParms' => '', 'writeParms' => 'size=xxlarge&required=1', 'class' => 'left', 'thclass' => 'left', ), 'banner_impurchased' => array ( 'title' => BNRLAN_16, 'type' => 'number', 'data' => 'int', 'width' => 'auto', 'inline' => true, 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', 'help'=>'0 = unlimited' ), - 'banner_description' => array ( 'title' => BNRLAN_49, 'type' => 'textarea', 'data' => 'str', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ), + 'banner_tooltip' => array ( 'title' => BNRLAN_49, 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => array('size'=>'xxlarge'), 'class' => 'center', 'thclass' => 'center', ), - 'banner_startdate' => array ( 'title' => BNRLAN_17, 'type' => 'datestamp', 'data' => 'int', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ), - 'banner_enddate' => array ( 'title' => BNRLAN_18, 'type' => 'datestamp', 'data' => 'int', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ), + 'banner_description' => array ( 'title' => LAN_DESCRIPTION, 'type' => 'textarea', 'data' => 'str', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ), + + 'banner_startdate' => array ( 'title' => BNRLAN_17, 'type' => 'datestamp', 'tab'=>1,'data' => 'int', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ), + 'banner_enddate' => array ( 'title' => BNRLAN_18, 'type' => 'datestamp', 'tab'=>1, 'data' => 'int', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ), 'banner_active' => array ( 'title' => LAN_VISIBILITY, 'type' => 'userclass', 'data' => 'int', 'width' => 'auto', 'filter' => true, 'inline' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), 'banner_clicks' => array ( 'title' => BANNERLAN_24, 'type' => 'number', 'noedit'=>true, 'readonly'=>2, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ), @@ -145,7 +170,7 @@ class banner_ui extends e_admin_ui } - if(!empty($new_data['banner_campaign_sel'])) + if(!empty($new_data['banner_campaign_sel']) && $new_data['banner_campaign_sel'] != '_new_') { $new_data['banner_campaign'] = $new_data['banner_campaign_sel']; @@ -360,6 +385,10 @@ class banner_form_ui extends e_admin_form_ui $sql = e107::getDb(); if ($sql->select("banner")) { + + $this->campaigns['_new_'] = "(New Campaign)"; + + while ($banner_row = $sql->fetch()) { if (strpos($banner_row['banner_campaign'], "^") !== FALSE) @@ -494,11 +523,11 @@ class banner_form_ui extends e_admin_form_ui if (count($this->campaigns)) { $text = $frm->select('banner_campaign_sel',$this->campaigns, $curVal,'',LAN_SELECT); - $text .= $frm->text('banner_campaign','','',array('placeholder'=> 'Or enter a new campaign')); + $text .= $frm->text('banner_campaign','','',array('size'=>'xlarge', 'class'=>'e-hideme','placeholder'=> 'Enter a campaign name')); } else { - $text = $frm->text('banner_campaign',$curVal); + $text = $frm->text('banner_campaign',$curVal, '', array('size'=>'xlarge', 'placeholder'=> 'Enter a campaign name')); } return $text; // $frm->text('banner_campaign',$curVal); break; diff --git a/e107_plugins/banner/banner_sql.php b/e107_plugins/banner/banner_sql.php index 6469658e3..7c35d5d7a 100644 --- a/e107_plugins/banner/banner_sql.php +++ b/e107_plugins/banner/banner_sql.php @@ -12,6 +12,7 @@ CREATE TABLE banner ( banner_clicks int(10) unsigned NOT NULL default '0', banner_impressions int(10) unsigned NOT NULL default '0', banner_ip text NOT NULL, + banner_tooltip varchar(250) NOT NULL default '', banner_description text NOT NULL, banner_campaign varchar(150) NOT NULL default '', PRIMARY KEY (banner_id) diff --git a/e107_plugins/banner/e_shortcode.php b/e107_plugins/banner/e_shortcode.php index e13454e03..0dd09f318 100644 --- a/e107_plugins/banner/e_shortcode.php +++ b/e107_plugins/banner/e_shortcode.php @@ -94,10 +94,23 @@ class banner_shortcodes extends e_shortcode $src = ($row['banner_image'][0] == '{') ? $tp->thumbUrl($row['banner_image']) : e_IMAGE_ABS.'banners/'.$row['banner_image']; $ban_ret = "".$row["; + + break; } - return "toAttribute($row['banner_description'])."\">".$ban_ret.''; + $start = "toAttribute($row['banner_tooltip'])."\">"; + $item = $ban_ret; + $end = ''; + + $text = $start.$item.$end; + + if(!empty($row['banner_description'])) + { + $text .= "
".$start.$tp->toHtml($row['banner_description'], true).$end. "
"; + } + + return $text; } diff --git a/e107_plugins/banner/languages/English_admin.php b/e107_plugins/banner/languages/English_admin.php index caa6fbf05..3a3980a7b 100644 --- a/e107_plugins/banner/languages/English_admin.php +++ b/e107_plugins/banner/languages/English_admin.php @@ -64,5 +64,5 @@ define("BNRLAN_46", "All selected campaigns rendered in one single menu"); // BA define("BNRLAN_47", "All selected campaigns rendered in separate menus"); // BANNER_MENU_L14 define("BNRLAN_48", "All selected campaigns (no box rendering)"); -define("BNRLAN_49", "Description/Tooltip"); +define("BNRLAN_49", "Tooltip"); ?> \ No newline at end of file