diff --git a/e107_admin/newspost.php b/e107_admin/newspost.php index c85a850b8..add5b1a0a 100644 --- a/e107_admin/newspost.php +++ b/e107_admin/newspost.php @@ -1730,7 +1730,7 @@ class admin_newspost $temp['news_unstemplate'] = intval($_POST['news_unstemplate']); $temp['news_editauthor'] = intval($_POST['news_editauthor']); $temp['news_ping_services'] = explode("\n",$_POST['news_ping_services']); - $temp['news_sefbase'] = preg_replace('#[^\w\pL\-]#u', '', $_POST['news_sefbase']); + $temp['news_default_template'] = preg_replace('#[^\w\pL\-]#u', '', $_POST['news_default_template']); $temp['news_list_limit'] = intval($_POST['news_list_limit']); @@ -3020,12 +3020,14 @@ class admin_newspost $sefbaseDiz = str_replace(array("[br]","[","]"), array("
","",""), NWSLAN_128 ); $pingOpt = array('placeholder'=>'eg. blogsearch.google.com/ping/RPC2'); - + $pingVal = (!empty($pref['news_ping_services'])) ? implode("\n",$pref['news_ping_services']) : ''; + $newsTemplates = array('default'=>'Default', 'list'=>'List'); //TODO 'category'=>'Categories'? research 'Use non-standard template for news layout' and integrate here. $text = " -
-
- ".NWSLAN_90." + "; + + $tab1 = " + @@ -3035,14 +3037,14 @@ class admin_newspost @@ -3059,27 +3061,20 @@ class admin_newspost - - + + - - + + - "; - - - // ##### ADDED FOR NEWS ARCHIVE -------------------------------------------------------------------- - // the possible archive values are from "0" to "< $pref['newsposts']" - // this should really be made as an onchange event on the selectbox for $pref['newsposts'] ... - //SecretR - Done - $text .= " + - "; - // ##### END -------------------------------------------------------------------------------------- - - $text .= " + -
".NWSLAN_127." - ".$frm->text('news_sefbase', $pref['news_sefbase'])." -
".$sefbaseDiz.''.SITEURL.($pref['news_sefbase'] ? $pref['news_sefbase'].'/' : '')."
+ ".$frm->select('news_default_template', $newsTemplates, $pref['news_default_template'])." +
Determines how the default news page should appear.
Ping Services - ".$frm->textarea('news_ping_services', implode("\n",$pref['news_ping_services']), 4, 100,$pingOpt)." + ".$frm->textarea('news_ping_services', $pingVal, 4, 100, $pingOpt)."
Notify these services when you create/update news items.
One per line.
".NWSLAN_88." - ".$frm->select('newsposts', $this->_optrange(50, false), $pref['newsposts'], 'class=tbox')." - ".NWSLAN_88." + ".$frm->select('newsposts', $this->_optrange(50, false), $pref['newsposts'], 'class=tbox')." +
Limit for News-Listing Pages - ".$frm->select('news_list_limit', $this->_optrange(50, false), $pref['news_list_limit'], 'class=tbox')." -
eg. news.php?all or news.php?cat.1 or news.php?tag=xxx
-
Limit for News-Listing Pages + ".$frm->select('news_list_limit', $this->_optrange(50, false), $pref['news_list_limit'], 'class=tbox')." +
eg. news.php?all or news.php?cat.1 or news.php?tag=xxx
+
".NWSLAN_115." @@ -3093,10 +3088,7 @@ class admin_newspost ".$frm->text('newsposts_archive_title', $pref['newsposts_archive_title'])."
".LAN_NEWS_51." @@ -3153,7 +3145,16 @@ class admin_newspost
+ "; + + $text .= $frm->tabs(array( + 'general' => array('caption'=>'General', 'text'=>$tab1), + 'subnews' => array('caption'=>'Submit News', 'text'=>$tab2) + )); + + + $text .= " +
".$frm->admin_button('save_prefs', LAN_UPDATE, 'update')."
diff --git a/e107_core/xml/default_install.xml b/e107_core/xml/default_install.xml index d4c32f3b3..176391a39 100644 --- a/e107_core/xml/default_install.xml +++ b/e107_core/xml/default_install.xml @@ -146,7 +146,7 @@ 10 0 - news + default 0 0 diff --git a/e107_languages/English/admin/lan_newspost.php b/e107_languages/English/admin/lan_newspost.php index 23ece16df..bf96e664d 100644 --- a/e107_languages/English/admin/lan_newspost.php +++ b/e107_languages/English/admin/lan_newspost.php @@ -126,7 +126,7 @@ define("NWSLAN_123", "Posted"); // define("NWSLAN_125", "Email"); // define("NWSLAN_126", "IP"); -define("NWSLAN_127", "URL identifier"); +define("NWSLAN_127", "Default template"); define("NWSLAN_128", "Set a string to be used in news pages URL. This will only work proper .htaccess rules and eURL config
Resolved URL based on current value: "); //FIXME HTML // define("LAN_NEWS_5", "Error! - Was unable to update news item into database!"); diff --git a/news.php b/news.php index c77852fda..5fdce587d 100644 --- a/news.php +++ b/news.php @@ -54,6 +54,8 @@ if(!defined("NEWSLIST_LIMIT")) define("NEWSLIST_LIMIT", varset($pref['news_list_limit'],15)); } +$defTemplate = e107::getPref('news_default_template'); + if (e_QUERY) //TODO add support for $_GET['cat'] and $_GET['mode'] and phase-out the x.x.x format. { @@ -64,6 +66,12 @@ if (e_QUERY) //TODO add support for $_GET['cat'] and $_GET['mode'] and phase-out $newsfrom = intval(varset($tmp[2],0)); // Item number for first item on multi-page lists $cacheString = 'news.php_'.e_QUERY; } +else +{ + + $opt = array('default'=>'', 'list'=>'all'); + $action = varset($opt[$defTemplate],''); +} //$newsfrom = (!is_numeric($action) || !e_QUERY ? 0 : ($action ? $action : e_QUERY)); @@ -197,7 +205,7 @@ if ($action == 'cat' || $action == 'all' || vartrue($_GET['tag'])) AND (n.news_end=0 || n.news_end>".time().") ORDER BY n.news_sticky DESC, n.news_datestamp DESC LIMIT ".intval($newsfrom).",".deftrue('NEWSALL_LIMIT', NEWSLIST_LIMIT); // NEWSALL_LIMIT just for BC. NEWSLIST_LIMIT is sufficient. - $category_name = "All"; + $category_name = ($defTemplate == 'list') ? PAGE_NAME : "All"; } elseif ($action == 'cat') // show archive of all news items in a particular category using list-style template. { @@ -318,8 +326,10 @@ if ($action == 'cat' || $action == 'all' || vartrue($_GET['tag'])) $NEWSLISTTITLE = str_replace("{NEWSCATEGORY}",$tp->toHTML($category_name,FALSE,'TITLE'),$NEWSLISTTITLE); } - $text .= ""; - + if($defTemplate != 'list') + { + $text .= ""; + } ob_start(); $ns->tablerender($NEWSLISTTITLE, $text, 'news');