mirror of
https://github.com/e107inc/e107.git
synced 2025-04-22 13:41:52 +02:00
"No News" message formatting and css class. Page list sitelink function fixed.
This commit is contained in:
parent
4fb0205945
commit
d861727470
@ -43,6 +43,7 @@ define("LAN_NEWS_85", "Back to category overview");
|
||||
define("LAN_NEWS_86", "Older News");
|
||||
define("LAN_NEWS_87", "Newer News");
|
||||
define("LAN_NEWS_462", "No news items for specified month");
|
||||
define("LAN_NEWS_463", "There are no news items for the specified category - please check back soon.");
|
||||
|
||||
// Following used by alt_news
|
||||
// define("LAN_NEWS_99", "Comments");
|
||||
|
@ -91,8 +91,9 @@ class banner_shortcodes extends e_shortcode
|
||||
$src = e_IMAGE_ABS.'banners/'.$row['banner_image'];
|
||||
$style = "'border:0'";
|
||||
}
|
||||
// Somehow, can't use vartrue core function when referencing $parm['class'], gives bug....
|
||||
$ban_ret = $tp->toImage($src, array('class'=>($parm['class'] == ''?"e-banner img-responsive img-rounded":$parm['class']) , 'alt'=>$row['banner_clickurl'], 'style'=>$style));
|
||||
// Somehow, can't use vartrue core function when referencing $parm['class'], gives bug...
|
||||
$class = empty($parm['class']) ? "e-banner img-responsive" : $parm['class'];
|
||||
$ban_ret = $tp->toImage($src, array('class'=> $class , 'alt'=>$row['banner_clickurl'], 'style'=>$style));
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ global $sc_style;
|
||||
$NEWS_MENU_TEMPLATE['category']['start'] = '<ul class="nav nav-list news-menu-category">';
|
||||
$NEWS_MENU_TEMPLATE['category']['end'] = '</ul>';
|
||||
$NEWS_MENU_TEMPLATE['category']['item'] = '
|
||||
<li><a class="e-menu-link newscats{active}" href="{NEWS_CATEGORY_URL}">{NEWS_CATEGORY_TITLE} {NEWS_CATEGORY_NEWS_COUNT}</a></li>
|
||||
<li><a class="e-menu-link newscats{active}" href="{NEWS_CATEGORY_URL}">{NEWS_CATEGORY_TITLE} <span>{NEWS_CATEGORY_NEWS_COUNT}</span></a></li>
|
||||
';
|
||||
|
||||
$NEWS_MENU_WRAPPER['category']['NEWS_CATEGORY_NEWS_COUNT'] = "({---})"; // Wrap brackets around the news count when value is returned.
|
||||
@ -34,7 +34,7 @@ $NEWS_MENU_WRAPPER['category']['NEWS_CATEGORY_NEWS_COUNT'] = "({---})"; // Wrap
|
||||
$NEWS_MENU_TEMPLATE['months']['start'] = '<ul class="nav nav-list news-menu-months">';
|
||||
$NEWS_MENU_TEMPLATE['months']['end'] = '</ul>';
|
||||
$NEWS_MENU_TEMPLATE['months']['item'] = '
|
||||
<li><a class="e-menu-link newsmonths{active}" href="{url}">{month} ({count})</a></li>
|
||||
<li><a class="e-menu-link newsmonths{active}" href="{url}">{month} <span>({count})</span></a></li>
|
||||
';
|
||||
//$NEWS_MENU_TEMPLATE['months']['separator'] = '<br />';
|
||||
|
||||
@ -46,7 +46,7 @@ $NEWS_MENU_TEMPLATE['months']['item'] = '
|
||||
// latest menu
|
||||
$NEWS_MENU_TEMPLATE['latest']['start'] = '<ul class="nav nav-list news-menu-latest">';
|
||||
$NEWS_MENU_TEMPLATE['latest']['end'] = '</ul>'; // Example: $NEWS_MENU_TEMPLATE['latest']['end'] '<br />{currentTotal} from {total}';
|
||||
$NEWS_MENU_TEMPLATE['latest']['item'] = '<li><a class="e-menu-link newsmonths" href="{NEWSURL}">{NEWSTITLE} {NEWSCOMMENTCOUNT}</a></li>';
|
||||
$NEWS_MENU_TEMPLATE['latest']['item'] = '<li><a class="e-menu-link newsmonths" href="{NEWSURL}">{NEWSTITLE} <span>{NEWSCOMMENTCOUNT}</span></a></li>';
|
||||
|
||||
$NEWS_MENU_WRAPPER['latest']['NEWSCOMMENTCOUNT'] = "({---})";
|
||||
|
||||
|
@ -65,10 +65,22 @@ class page_sitelink // include plugin-folder in the name.
|
||||
'description' => "A list of all chapters from the book ".$row['chapter_name']
|
||||
);
|
||||
}
|
||||
|
||||
$chaps = $sql->retrieve("SELECT * FROM #page_chapters WHERE chapter_parent !=0 ORDER BY chapter_order ASC" , true);
|
||||
|
||||
foreach($chaps as $row)
|
||||
{
|
||||
$links[] = array(
|
||||
'name' => "All Pages from ".$row['chapter_name'],
|
||||
'function' => "pagesFromChapter",
|
||||
'parm' => $row['chapter_id'],
|
||||
'description' => "A list of all pages from the chapter ".$row['chapter_name']
|
||||
);
|
||||
}
|
||||
|
||||
$links[] = array(
|
||||
'name' => "All Pages",
|
||||
'function' => "pageNav",
|
||||
'function' => "pageList",
|
||||
'parm' => "",
|
||||
'description' => "A list of all pages"
|
||||
);
|
||||
@ -83,7 +95,66 @@ class page_sitelink // include plugin-folder in the name.
|
||||
{
|
||||
return $this->pageNav('book=0');
|
||||
}
|
||||
|
||||
|
||||
public function pagesFromChapter($id)
|
||||
{
|
||||
|
||||
return $this->pageList($id);
|
||||
}
|
||||
|
||||
|
||||
private function pageList($parm)
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
$arr = array();
|
||||
|
||||
|
||||
if(!empty($parm))
|
||||
{
|
||||
$query = "SELECT * FROM `#page` WHERE page_class IN (".USERCLASS_LIST.") AND page_chapter = ".intval($parm)." ORDER BY page_order ASC" ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = "SELECT * FROM `#page` WHERE page_class IN (".USERCLASS_LIST.") ORDER BY page_order ASC" ;
|
||||
}
|
||||
|
||||
$pages = $sql->retrieve($query, true);
|
||||
|
||||
foreach($pages as $row)
|
||||
{
|
||||
$chapter_parent = $this->getParent($row['page_chapter']);
|
||||
|
||||
$row['book_sef'] = $this->getSef($chapter_parent);
|
||||
|
||||
$row['chapter_sef'] = $this->getSef($row['page_chapter']);
|
||||
|
||||
if(!vartrue($row['chapter_sef']))
|
||||
{
|
||||
// $row['chapter_sef'] = '--sef-not-assigned--';
|
||||
}
|
||||
|
||||
$arr[] = array(
|
||||
'link_id' => $row['page_id'],
|
||||
'link_name' => $row['page_title'] ? $row['page_title'] : 'No title', // FIXME lan
|
||||
'link_url' => e107::getUrl()->create('page/view', $row, array('allow' => 'page_sef,page_title,page_id,chapter_sef,book_sef')),
|
||||
'link_description' => '',
|
||||
// 'link_button' => $row['menu_image'],
|
||||
'link_category' => '',
|
||||
'link_order' => $row['page_order'],
|
||||
'link_parent' => $row['page_chapter'],
|
||||
'link_open' => '',
|
||||
'link_class' => intval($row['page_class']),
|
||||
'link_active' => (isset($options['cpage']) && $row['page_id'] == $options['cpage']),
|
||||
'link_identifier' => 'page-nav-'.intval($row['page_id']) // used for css id.
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
return $arr;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all chapters from a sepcific book.
|
||||
*/
|
||||
|
@ -21,4 +21,6 @@ mark { text-decoration: underline; color:#FF0000; font-weight:bold; }
|
||||
.list-unstyled { list-style: outside none none; }
|
||||
|
||||
#login-template { width:60%; max-width:350px; margin-right:auto;margin-left:auto; }
|
||||
div.form-group { padding-top: 5px }
|
||||
div.form-group { padding-top: 5px }
|
||||
|
||||
div.news-empty { text-align:center; font-weight: bold }
|
18
news.php
18
news.php
@ -411,7 +411,7 @@ e107::getDebug()->log("PageTitle: ".e_PAGETITLE);
|
||||
}
|
||||
else // No News - empty.
|
||||
{
|
||||
$text .= "<div class='alert alert-info'>".(strstr(e_QUERY, "month") ? LAN_NEWS_462 : LAN_NEWS_83)."</div>";
|
||||
$text .= "<div class='news-empty'><div class='alert alert-info'>".(strstr(e_QUERY, "month") ? LAN_NEWS_462 : LAN_NEWS_83)."</div></div>";
|
||||
}
|
||||
|
||||
if(vartrue($template['end']))
|
||||
@ -624,6 +624,8 @@ $order = $tp -> toDB($order, true); /// @todo - try not to use toDB() - trigge
|
||||
|
||||
$interval = $pref['newsposts'];
|
||||
|
||||
|
||||
|
||||
switch ($action)
|
||||
{
|
||||
case "list" :
|
||||
@ -639,6 +641,8 @@ switch ($action)
|
||||
AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")
|
||||
AND n.news_category={$sub_action}
|
||||
ORDER BY n.news_sticky DESC,".$order." DESC LIMIT ".intval($newsfrom).",".ITEMVIEW;
|
||||
|
||||
$noNewsMessage = LAN_NEWS_463;
|
||||
break;
|
||||
|
||||
|
||||
@ -669,8 +673,11 @@ switch ($action)
|
||||
WHERE n.news_id={$sub_action} AND 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().")";
|
||||
}
|
||||
|
||||
$noNewsMessage = LAN_NEWS_83;
|
||||
break;
|
||||
|
||||
|
||||
case "month" :
|
||||
case "day" :
|
||||
$item = $tp -> toDB($sub_action).'20000101';
|
||||
@ -700,6 +707,9 @@ switch ($action)
|
||||
AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")
|
||||
AND (FIND_IN_SET('0', n.news_render_type) OR FIND_IN_SET(1, n.news_render_type)) AND n.news_datestamp BETWEEN {$startdate} AND {$enddate}
|
||||
ORDER BY ".$order." DESC LIMIT ".intval($newsfrom).",".ITEMVIEW;
|
||||
|
||||
$noNewsMessage = LAN_NEWS_462;
|
||||
|
||||
break;
|
||||
|
||||
case 'default' :
|
||||
@ -743,6 +753,8 @@ switch ($action)
|
||||
AND (FIND_IN_SET('0', n.news_render_type) OR FIND_IN_SET(1, n.news_render_type))
|
||||
ORDER BY n.news_sticky DESC, ".$order." DESC LIMIT ".intval($newsfrom).",".ITEMVIEW;
|
||||
}
|
||||
|
||||
$noNewsMessage = LAN_NEWS_83;
|
||||
} // END - switch($action)
|
||||
|
||||
|
||||
@ -780,10 +792,10 @@ if($newsCachedPage = checkCache($cacheString)) // normal news front-page - with
|
||||
}
|
||||
|
||||
|
||||
if (!($news_total = $sql->db_Select_gen($query)))
|
||||
if (!($news_total = $sql->gen($query)))
|
||||
{ // No news items
|
||||
require_once(HEADERF);
|
||||
echo "<br /><br /><div style='text-align:center'><b>".(strstr(e_QUERY, "month") ? LAN_NEWS_462 : LAN_NEWS_83)."</b></div><br /><br />";
|
||||
echo "<div class='news-empty'><div class='alert alert-info' style='text-align:center'>".$noNewsMessage."</div></div>";
|
||||
require_once(FOOTERF);
|
||||
exit;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user