mirror of
https://github.com/e107inc/e107.git
synced 2025-07-26 01:11:28 +02:00
Corrected some of the confusion with news-preference labels. Option added to choose what displays in the news list page. $frm->checkboxes now renders field-help correctly.
This commit is contained in:
@@ -725,6 +725,7 @@ class news_admin_ui extends e_admin_ui
|
|||||||
$temp['news_ping_services'] = explode("\n",$_POST['news_ping_services']);
|
$temp['news_ping_services'] = explode("\n",$_POST['news_ping_services']);
|
||||||
$temp['news_default_template'] = preg_replace('#[^\w\pL\-]#u', '', $_POST['news_default_template']);
|
$temp['news_default_template'] = preg_replace('#[^\w\pL\-]#u', '', $_POST['news_default_template']);
|
||||||
$temp['news_list_limit'] = intval($_POST['news_list_limit']);
|
$temp['news_list_limit'] = intval($_POST['news_list_limit']);
|
||||||
|
$temp['news_list_templates'] = e107::getParser()->toDB($_POST['news_list_templates']);
|
||||||
|
|
||||||
e107::getConfig()->updatePref($temp);
|
e107::getConfig()->updatePref($temp);
|
||||||
|
|
||||||
@@ -960,6 +961,8 @@ class news_admin_ui extends e_admin_ui
|
|||||||
$pingVal = (!empty($pref['news_ping_services'])) ? implode("\n",$pref['news_ping_services']) : '';
|
$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.
|
$newsTemplates = array('default'=>'Default', 'list'=>'List'); //TODO 'category'=>'Categories'? research 'Use non-standard template for news layout' and integrate here.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$text = "
|
$text = "
|
||||||
<form method='post' action='".e_SELF."?pref' id='core-newspost-settings-form'>";
|
<form method='post' action='".e_SELF."?pref' id='core-newspost-settings-form'>";
|
||||||
|
|
||||||
@@ -978,25 +981,7 @@ class news_admin_ui extends e_admin_ui
|
|||||||
<div class='field-help'>".LAN_NEWS_88."</div>
|
<div class='field-help'>".LAN_NEWS_88."</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td>Ping Services</td>
|
|
||||||
<td>
|
|
||||||
".$frm->textarea('news_ping_services', $pingVal, 4, 100, $pingOpt)."
|
|
||||||
<div class='field-help'>".LAN_NEWS_89."<br />".LAN_NEWS_90."</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>".NWSLAN_86."</td>
|
|
||||||
<td>
|
|
||||||
".$frm->radio_switch('news_cats', $pref['news_cats'])."
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>".NWSLAN_87."</td>
|
|
||||||
<td>
|
|
||||||
".$frm->select('nbr_cols', $this->_optrange(6, false), $pref['nbr_cols'], 'class=tbox')."
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>".NWSLAN_88."</td>
|
<td>".NWSLAN_88."</td>
|
||||||
<td>
|
<td>
|
||||||
@@ -1012,6 +997,33 @@ class news_admin_ui extends e_admin_ui
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>".LAN_NEWS_93."</td>
|
||||||
|
<td>
|
||||||
|
".$frm->checkboxes('news_list_templates', $this->news_renderTypes, varset($pref['news_list_templates'],0), array('useKeyValues' => 1))."
|
||||||
|
<div class='field-help'>".LAN_NEWS_94."</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Ping Services</td>
|
||||||
|
<td>
|
||||||
|
".$frm->textarea('news_ping_services', $pingVal, 4, 100, $pingOpt)."
|
||||||
|
<div class='field-help'>".LAN_NEWS_89."<br />".LAN_NEWS_90."</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>".NWSLAN_86."</td>
|
||||||
|
<td>
|
||||||
|
".$frm->radio_switch('news_cats', $pref['news_cats'])."
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>".NWSLAN_87."</td>
|
||||||
|
<td>
|
||||||
|
".$frm->select('nbr_cols', $this->_optrange(6, false), $pref['nbr_cols'], 'class=tbox')."
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>".NWSLAN_115."</td>
|
<td>".NWSLAN_115."</td>
|
||||||
<td id='newsposts-archive-cont'>
|
<td id='newsposts-archive-cont'>
|
||||||
|
@@ -1410,7 +1410,7 @@ class e_form
|
|||||||
* @param string $name
|
* @param string $name
|
||||||
* @param array $option_array
|
* @param array $option_array
|
||||||
* @param mixed $checked
|
* @param mixed $checked
|
||||||
* @param array $options [optional]
|
* @param array $options [optional useKeyValues]
|
||||||
*/
|
*/
|
||||||
function checkboxes($name, $option_array, $checked, $options=array())
|
function checkboxes($name, $option_array, $checked, $options=array())
|
||||||
{
|
{
|
||||||
@@ -1439,6 +1439,11 @@ class e_form
|
|||||||
$text .= $this->checkbox($cname, $key, $c, $label);
|
$text .= $this->checkbox($cname, $key, $c, $label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!empty($text))
|
||||||
|
{
|
||||||
|
return "<div class='checkboxes' style='display:inline-block'>".$text."</div>";
|
||||||
|
}
|
||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -90,9 +90,9 @@ define("NWSLAN_77", "Post to other news menu");
|
|||||||
define("NWSLAN_83","Extended news post");
|
define("NWSLAN_83","Extended news post");
|
||||||
define("NWSLAN_84","Choose which visitors will see news item");
|
define("NWSLAN_84","Choose which visitors will see news item");
|
||||||
|
|
||||||
define("NWSLAN_86", "Show News-Category Footer Menu");
|
define("NWSLAN_86", "News-category footer menu");
|
||||||
define("NWSLAN_87", "News Category Columns?");
|
define("NWSLAN_87", "News-category columns");
|
||||||
define("NWSLAN_88", "News posts to display per page?");
|
define("NWSLAN_88", "Default-view limit per page");
|
||||||
//define("NWSLAN_89", "Save News Preferences");
|
//define("NWSLAN_89", "Save News Preferences");
|
||||||
define("NWSLAN_90", "News Preferences");
|
define("NWSLAN_90", "News Preferences");
|
||||||
define("NWSLAN_100", "Enable Image uploading on Submit News page");
|
define("NWSLAN_100", "Enable Image uploading on Submit News page");
|
||||||
@@ -111,7 +111,7 @@ define("NWSLAN_112", "If this box is ticked, a box containing the date will be d
|
|||||||
define("NWSLAN_113", "Use non-standard template for news layout");
|
define("NWSLAN_113", "Use non-standard template for news layout");
|
||||||
define("NWSLAN_114", "if the theme you're using has a news layout template, use this instead of the generic layout");
|
define("NWSLAN_114", "if the theme you're using has a news layout template, use this instead of the generic layout");
|
||||||
|
|
||||||
define("NWSLAN_115", "News posts to display in archive ?");
|
define("NWSLAN_115", "Archive limit");
|
||||||
define("NWSLAN_116", "First update the preferences with the changed display per page setting, then update again after setting the news archive preference. (0 is un-activated)");
|
define("NWSLAN_116", "First update the preferences with the changed display per page setting, then update again after setting the news archive preference. (0 is un-activated)");
|
||||||
define("NWSLAN_117", "Set the title for the news archive");
|
define("NWSLAN_117", "Set the title for the news archive");
|
||||||
// define("NWSLAN_118", "View Images"); already defined above.
|
// define("NWSLAN_118", "View Images"); already defined above.
|
||||||
@@ -214,7 +214,9 @@ define("LAN_NEWS_87", "eg. blogsearch.google.com/ping/RPC2");
|
|||||||
define("LAN_NEWS_88", "Determines how the default news page should appear.");
|
define("LAN_NEWS_88", "Determines how the default news page should appear.");
|
||||||
define("LAN_NEWS_89", "Notify these services when you create/update news items.");
|
define("LAN_NEWS_89", "Notify these services when you create/update news items.");
|
||||||
define("LAN_NEWS_90", "One per line.");
|
define("LAN_NEWS_90", "One per line.");
|
||||||
define("LAN_NEWS_91", "Limit for News-Listing Pages");
|
define("LAN_NEWS_91", "List-view limit per page");
|
||||||
define("LAN_NEWS_92", "eg. news.php?all or news.php?cat.1 or news.php?tag=xxx");
|
define("LAN_NEWS_92", "eg. news.php?all or news.php?cat.1 or news.php?tag=xxx");
|
||||||
|
define("LAN_NEWS_93", "List-view content");
|
||||||
|
define("LAN_NEWS_94", "Items assigned to these templates will be displayed in the list.");
|
||||||
|
|
||||||
?>
|
?>
|
@@ -345,10 +345,10 @@ $(document).ready(function()
|
|||||||
});
|
});
|
||||||
|
|
||||||
// run tips on .field-help
|
// run tips on .field-help
|
||||||
$("div.tbox,input,textarea,select,label,.e-tip").each(function(c) {
|
$("div.tbox,div.checkboxes,input,textarea,select,label,.e-tip").each(function(c) {
|
||||||
|
|
||||||
var t = $(this).nextAll(".field-help");
|
var t = $(this).nextAll(".field-help");
|
||||||
|
|
||||||
var placement = 'right';
|
var placement = 'right';
|
||||||
|
|
||||||
if($(this).is("textarea"))
|
if($(this).is("textarea"))
|
||||||
|
17
news.php
17
news.php
@@ -189,12 +189,18 @@ if ($action == 'cat' || $action == 'all' || vartrue($_GET['tag']))
|
|||||||
extract($row); // still required for the table-render. :(
|
extract($row); // still required for the table-render. :(
|
||||||
}
|
}
|
||||||
|
|
||||||
//XXX These are all correctly using LIST templates.
|
//XXX These are all correctly using LIST templates.
|
||||||
|
|
||||||
if ($action == 'all') // show archive of all news items using list-style template.
|
if ($action == 'all') // show archive of all news items using list-style template.
|
||||||
{
|
{
|
||||||
|
$renTypeQry = '';
|
||||||
|
|
||||||
|
if(!empty($pref['news_list_templates']) && is_array($pref['news_list_templates']))
|
||||||
|
{
|
||||||
|
$renTypeQry = " AND (n.news_render_type REGEXP '(^|,)(".implode("|", $pref['news_list_templates']).")(,|$)')";
|
||||||
|
}
|
||||||
|
|
||||||
$news_total = $sql->count("news", "(*)", "WHERE news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") AND news_start < ".time()." AND (news_end=0 || news_end>".time().")");
|
$news_total = $sql->count("news", "(*)", "WHERE news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") AND news_start < ".time()." AND (news_end=0 || news_end>".time().")". str_replace("n.news", "news", $renTypeQry));
|
||||||
$query = "
|
$query = "
|
||||||
SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon,
|
SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon,
|
||||||
nc.category_meta_keywords, nc.category_meta_description
|
nc.category_meta_keywords, nc.category_meta_description
|
||||||
@@ -202,10 +208,15 @@ if ($action == 'cat' || $action == 'all' || vartrue($_GET['tag']))
|
|||||||
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
||||||
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
|
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
|
||||||
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()."
|
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()."
|
||||||
AND (n.news_end=0 || n.news_end>".time().")
|
AND (n.news_end=0 || n.news_end>".time().") ";
|
||||||
|
|
||||||
|
$query .= $renTypeQry;
|
||||||
|
|
||||||
|
$query .= "
|
||||||
ORDER BY n.news_sticky DESC, n.news_datestamp DESC
|
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.
|
LIMIT ".intval($newsfrom).",".deftrue('NEWSALL_LIMIT', NEWSLIST_LIMIT); // NEWSALL_LIMIT just for BC. NEWSLIST_LIMIT is sufficient.
|
||||||
$category_name = ($defTemplate == 'list') ? PAGE_NAME : "All";
|
$category_name = ($defTemplate == 'list') ? PAGE_NAME : "All";
|
||||||
|
unset($renTypeQry);
|
||||||
}
|
}
|
||||||
elseif ($action == 'cat') // show archive of all news items in a particular category using list-style template.
|
elseif ($action == 'cat') // show archive of all news items in a particular category using list-style template.
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user