diff --git a/e107_core/shortcodes/batch/news_shortcodes.php b/e107_core/shortcodes/batch/news_shortcodes.php index 479cc30c7..30728eba2 100644 --- a/e107_core/shortcodes/batch/news_shortcodes.php +++ b/e107_core/shortcodes/batch/news_shortcodes.php @@ -62,6 +62,11 @@ class news_shortcodes extends e_shortcode $text = e107::getParser()->toAttribute($text); } + if(!empty($this->param['titleLimit'])) + { + $parm['limit'] = $this->param['titleLimit']; + } + if(!empty($parm['limit'])) { $text = e107::getParser()->text_truncate($text, $parm['limit']); @@ -583,6 +588,12 @@ class news_shortcodes extends e_shortcode } } + if(!empty($this->param['summaryLimit'])) + { + $parm['limit'] = $this->param['summaryLimit']; + } + + if(!empty($parm['limit'])) { $text = e107::getParser()->text_truncate($text, $parm['limit']); diff --git a/e107_handlers/news_class.php b/e107_handlers/news_class.php index 19419220d..3cae408c4 100644 --- a/e107_handlers/news_class.php +++ b/e107_handlers/news_class.php @@ -689,6 +689,7 @@ class e_news_tree extends e_front_tree_model $ret = array(); $tp = e107::getParser(); + $param = $parms; $param['current_action'] = 'list'; // TODO more default parameters diff --git a/e107_plugins/news/e_menu.php b/e107_plugins/news/e_menu.php index 09e87f297..9b4990b84 100644 --- a/e107_plugins/news/e_menu.php +++ b/e107_plugins/news/e_menu.php @@ -12,11 +12,13 @@ if (!defined('e107_INIT')) { exit; } //v2.x Standard for extending menu configuration within Menu Manager. (replacement for v1.x config.php) -//TODO Configure for news menus. + class news_menu { + public $tabs = array(); + function __construct() { // e107::lan('news','admin', 'true'); @@ -47,21 +49,24 @@ class news_menu switch($menu) { case "latestnews": - $fields['caption'] = array('title'=> LAN_CAPTION, 'type'=>'text', 'multilan'=>true, 'writeParms'=>array('size'=>'xxlarge')); - $fields['count'] = array('title'=> LAN_LIMIT, 'type'=>'text', 'writeParms'=>array('pattern'=>'[0-9]*', 'size'=>'mini')); - $fields['category'] = array('title'=> LAN_CATEGORY, 'type'=>'dropdown', 'writeParms'=>array('optArray'=>$categories, 'default'=>'blank')); + + $fields['caption'] = array('title'=> LAN_CAPTION, 'tab'=>0, 'type'=>'text', 'multilan'=>true, 'writeParms'=>array('size'=>'xxlarge')); + $fields['count'] = array('title'=> LAN_LIMIT, 'tab'=>1, 'type'=>'text', 'writeParms'=>array('pattern'=>'[0-9]*', 'size'=>'mini')); + $fields['category'] = array('title'=> LAN_CATEGORY, 'type'=>'dropdown', 'writeParms'=>array('optArray'=>$categories, 'default'=>'blank'), 'help'=>'Help Text'); break; case "news_grid": - $fields['caption'] = array('title'=> LAN_CAPTION, 'type'=>'text', 'multilan'=>true, 'writeParms'=>array('size'=>'xxlarge'), 'help'=>LAN_OPTIONAL); - $fields['category'] = array('title'=> LAN_CATEGORY, 'type'=>'dropdown', 'writeParms'=>array('optArray'=>$categories, 'default'=>"(".LAN_ALL.")"), 'help'=>"Limit news items to a specific category"); - $fields['source'] = array('title'=> "Source", 'type'=>'dropdown','writeParms'=>array('optArray'=>$sources), 'help'=>"Assigned items are those with a template assigned to 'News Grid Menu' "); - $fields['template'] = array('title'=> LAN_TEMPLATE, 'type'=>'dropdown', 'writeParms'=>array('optArray'=>$templates)); - $fields['layout'] = array('title'=> "Layout", 'type'=>'method', 'writeParms'=>''); - $fields['count'] = array('title'=> "Number of Items to Display", 'type'=>'number', 'writeParms'=>array('pattern'=>'[0-9]*', 'default'=>4)); - $fields['feature'] = array('title'=> "Number of Feature Items", 'type'=>'number', 'writeParms'=>array('pattern'=>'[0-9]*', 'default'=>0)); - $fields['titleLimit'] = array('title'=> "Title Character Limit", 'type'=>'number', 'writeParms'=>''); - $fields['summaryLimit'] = array('title'=> "Summary Character Limit", 'type'=>'number', 'writeParms'=>''); + $this->tabs = array(0 => LAN_PREFS, 1 => "Limits"); + + $fields['caption'] = array('title'=> LAN_CAPTION, 'type'=>'text', 'tab'=>0, 'multilan'=>true, 'writeParms'=>array('size'=>'xxlarge'), 'help'=>LAN_OPTIONAL); + $fields['category'] = array('title'=> LAN_CATEGORY, 'type'=>'dropdown', 'tab'=>0, 'writeParms'=>array('optArray'=>$categories, 'default'=>"(".LAN_ALL.")"), 'help'=>"Limit news items to a specific category"); + $fields['source'] = array('title'=> "Source", 'type'=>'dropdown','tab'=>0, 'writeParms'=>array('optArray'=>$sources), 'help'=>"Assigned items are those with a template assigned to 'News Grid Menu' "); + $fields['layout'] = array('title'=> LAN_TEMPLATE, 'type'=>'dropdown', 'tab'=>0, 'writeParms'=>array('optArray'=>$templates)); + // $fields['layout'] = array('title'=> "Layout", 'type'=>'method', 'tab'=>0,'writeParms'=>''); + $fields['count'] = array('title'=> "Number of Items to Display", 'tab'=>1, 'type'=>'number', 'writeParms'=>array('pattern'=>'[0-9]*', 'default'=>4)); + $fields['feature'] = array('title'=> "Number of Feature Items", 'tab'=>1, 'type'=>'number', 'writeParms'=>array('pattern'=>'[0-9]*', 'default'=>0)); + $fields['titleLimit'] = array('title'=> "Title Character Limit", 'tab'=>1, 'type'=>'number', 'writeParms'=>''); + $fields['summaryLimit'] = array('title'=> "Summary Character Limit",'tab'=>1, 'type'=>'number', 'writeParms'=>''); break; diff --git a/e107_plugins/news/news_grid_menu.php b/e107_plugins/news/news_grid_menu.php index 72b8cab9e..eac4a9706 100644 --- a/e107_plugins/news/news_grid_menu.php +++ b/e107_plugins/news/news_grid_menu.php @@ -60,14 +60,14 @@ if(false === $cached) } else // New in v2.1.5 { - $tmpl = !empty($parms['template']) ? $parms['template'] : 'default'; + $tmpl = !empty($parms['layout']) ? $parms['layout'] : 'col-md-4'; $template = e107::getTemplate('news', 'news_grid', $tmpl); $parms['tmpl'] = 'news_grid'; $parms['tmpl_key'] = $tmpl; } - $gridSize = vartrue($parms['layout'],'col-md-4'); +// $gridSize = vartrue($parms['layout'],'col-md-4'); $parmSrch = array( '{NEWSGRID}', @@ -76,12 +76,12 @@ if(false === $cached) ); $parmReplace = array( - $gridSize, - vartrue($parms['titleLimit'], 0), - vartrue($parms['summaryLimit'], 0) + // $gridSize, + // vartrue($parms['titleLimit'], 0), + // vartrue($parms['summaryLimit'], 0) ); - $template = str_replace($parmSrch , $parmReplace, $template); + $template = str_replace($parmSrch , '', $template); // clean up deprecated elements. $render = (empty($parms['caption'])) ? false: true; diff --git a/e107_plugins/news/templates/news_grid_template.php b/e107_plugins/news/templates/news_grid_template.php index 84a5bbc52..475a5dbf7 100644 --- a/e107_plugins/news/templates/news_grid_template.php +++ b/e107_plugins/news/templates/news_grid_template.php @@ -9,16 +9,16 @@ */ - $NEWS_GRID_TEMPLATE['default']['start'] = '
'; + $NEWS_GRID_TEMPLATE['col-md-6']['start'] = '
'; - $NEWS_GRID_TEMPLATE['default']['featured'] = '
-

{NEWSTITLE: limit=_titleLimit_}

-

{NEWSSUMMARY: limit=_summaryLimit_}

+

{NEWS_TITLE}

+

{NEWS_SUMMARY}