From d861727470f715a9529b242c1c248e16f9b6bf45 Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 8 Jul 2016 17:37:41 -0700 Subject: [PATCH] "No News" message formatting and css class. Page list sitelink function fixed. --- e107_languages/English/lan_news.php | 1 + e107_plugins/banner/e_shortcode.php | 5 +- .../news/templates/news_menu_template.php | 6 +- e107_plugins/page/e_sitelink.php | 75 ++++++++++++++++++- e107_web/css/backcompat.css | 4 +- news.php | 18 ++++- 6 files changed, 98 insertions(+), 11 deletions(-) diff --git a/e107_languages/English/lan_news.php b/e107_languages/English/lan_news.php index e75839e82..d7807b579 100644 --- a/e107_languages/English/lan_news.php +++ b/e107_languages/English/lan_news.php @@ -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"); diff --git a/e107_plugins/banner/e_shortcode.php b/e107_plugins/banner/e_shortcode.php index b6707a257..37f6d0e7c 100644 --- a/e107_plugins/banner/e_shortcode.php +++ b/e107_plugins/banner/e_shortcode.php @@ -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; } diff --git a/e107_plugins/news/templates/news_menu_template.php b/e107_plugins/news/templates/news_menu_template.php index e7886f93f..4b4c12dc7 100644 --- a/e107_plugins/news/templates/news_menu_template.php +++ b/e107_plugins/news/templates/news_menu_template.php @@ -19,7 +19,7 @@ global $sc_style; $NEWS_MENU_TEMPLATE['category']['start'] = ''; $NEWS_MENU_TEMPLATE['category']['item'] = ' -
  • {NEWS_CATEGORY_TITLE} {NEWS_CATEGORY_NEWS_COUNT}
  • +
  • {NEWS_CATEGORY_TITLE} {NEWS_CATEGORY_NEWS_COUNT}
  • '; $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'] = ''; $NEWS_MENU_TEMPLATE['months']['item'] = ' -
  • {month} ({count})
  • +
  • {month} ({count})
  • '; //$NEWS_MENU_TEMPLATE['months']['separator'] = '
    '; @@ -46,7 +46,7 @@ $NEWS_MENU_TEMPLATE['months']['item'] = ' // latest menu $NEWS_MENU_TEMPLATE['latest']['start'] = ''; // Example: $NEWS_MENU_TEMPLATE['latest']['end'] '
    {currentTotal} from {total}'; -$NEWS_MENU_TEMPLATE['latest']['item'] = '
  • {NEWSTITLE} {NEWSCOMMENTCOUNT}
  • '; +$NEWS_MENU_TEMPLATE['latest']['item'] = '
  • {NEWSTITLE} {NEWSCOMMENTCOUNT}
  • '; $NEWS_MENU_WRAPPER['latest']['NEWSCOMMENTCOUNT'] = "({---})"; diff --git a/e107_plugins/page/e_sitelink.php b/e107_plugins/page/e_sitelink.php index 5c1bb8cbb..d2d951b99 100644 --- a/e107_plugins/page/e_sitelink.php +++ b/e107_plugins/page/e_sitelink.php @@ -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. */ diff --git a/e107_web/css/backcompat.css b/e107_web/css/backcompat.css index 4c4de2ad5..f97d9c145 100644 --- a/e107_web/css/backcompat.css +++ b/e107_web/css/backcompat.css @@ -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 } \ No newline at end of file +div.form-group { padding-top: 5px } + +div.news-empty { text-align:center; font-weight: bold } \ No newline at end of file diff --git a/news.php b/news.php index 43abf8960..03dbb4abb 100644 --- a/news.php +++ b/news.php @@ -411,7 +411,7 @@ e107::getDebug()->log("PageTitle: ".e_PAGETITLE); } else // No News - empty. { - $text .= "
    ".(strstr(e_QUERY, "month") ? LAN_NEWS_462 : LAN_NEWS_83)."
    "; + $text .= "
    ".(strstr(e_QUERY, "month") ? LAN_NEWS_462 : LAN_NEWS_83)."
    "; } 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 "

    ".(strstr(e_QUERY, "month") ? LAN_NEWS_462 : LAN_NEWS_83)."


    "; + echo "
    ".$noNewsMessage."
    "; require_once(FOOTERF); exit; }