mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 12:48:24 +01:00
fixed #59 - default news template
This commit is contained in:
parent
4e6924e3a5
commit
2f76ca5635
@ -294,7 +294,7 @@ class news_admin_ui extends e_admin_ui
|
||||
'checkboxes' => array('title' => '', 'type' => null, 'width' => '3%', 'thclass' => 'center first', 'class' => 'center', 'nosort' => true, 'toggle' => 'news_selected', 'forced' => TRUE),
|
||||
'news_id' => array('title' => LAN_NEWS_45, 'type' => 'number', 'width' => '5%', 'thclass' => 'center', 'class' => 'center', 'nosort' => false),
|
||||
'news_thumbnail' => array('title' => NWSLAN_67, 'type' => 'method', 'width' => '110px', 'thclass' => 'center', 'class' => "center", 'nosort' => false, 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','readonly'=>false),
|
||||
'news_title' => array('title' => NWSLAN_40, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'readParms'=>'link={e_BASE}news.php?extend.[id]&dialog=1'),
|
||||
'news_title' => array('title' => NWSLAN_40, 'type' => 'method', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'readParms'=>'link={e_BASE}news.php?extend.[id]&dialog=1'),
|
||||
'news_summary' => array('title' => LAN_NEWS_27, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
||||
|
||||
'news_meta_keywords' => array('title' => LAN_KEYWORDS, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
||||
@ -524,6 +524,17 @@ class news_form_ui extends e_admin_form_ui
|
||||
|
||||
return "<a class='e-dialog' href='{$link}'><img src='{$url}' alt='{$curval}' /></a>";
|
||||
}
|
||||
|
||||
function news_title($value, $mode)
|
||||
{
|
||||
if($mode == 'read')
|
||||
{
|
||||
$news_item = $this->getController()->getListModel()->toArray();
|
||||
$url = e107::getUrl()->create('news/view/item', $news_item);
|
||||
return "<a class='e-tip' href='{$url}' title='Open in new tab' rel='external'>".$value."</a>";
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
new news_admin();
|
||||
|
75
e107_plugins/news/templates/news_template.php
Normal file
75
e107_plugins/news/templates/news_template.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||
* $Id$
|
||||
*
|
||||
* News default templates
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) exit;
|
||||
|
||||
global $sc_style;
|
||||
|
||||
###### Default list item (temporary) - TODO rewrite news, template standards ######
|
||||
//$NEWS_MENU_TEMPLATE['list']['start'] = '<ul class="nav nav-list news-menu-months">';
|
||||
//$NEWS_MENU_TEMPLATE['list']['end'] = '</ul>';
|
||||
$NEWS_TEMPLATE['list']['item'] = '
|
||||
<div class="newsbox">
|
||||
<div class="leftbox">
|
||||
<div class="leftbox_title_bg">
|
||||
<div class="leftbox_title">
|
||||
{NEWSTITLE}
|
||||
</div>
|
||||
</div>
|
||||
<div class="meta">
|
||||
<div class="author">
|
||||
{NEWSDATE=short} {NEWSAUTHOR}
|
||||
</div>
|
||||
</div>
|
||||
<div class="newsbbody">
|
||||
{NEWSIMAGE}
|
||||
{NEWSBODY} {EXTENDED}
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div class="metabottom">
|
||||
<div class="metaicons">
|
||||
{EMAILICON} {PRINTICON} {PDFICON} {ADMINOPTIONS}
|
||||
</div>
|
||||
{NEWSCOMMENTS}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
//$NEWS_MENU_TEMPLATE['list']['separator'] = '<br />';
|
||||
|
||||
###### Default view item (temporary) - TODO rewrite news, template standards ######
|
||||
//$NEWS_MENU_TEMPLATE['view']['start'] = '<ul class="nav nav-list news-menu-months">';
|
||||
//$NEWS_MENU_TEMPLATE['view']['end'] = '</ul>';
|
||||
$NEWS_TEMPLATE['view']['item'] = '
|
||||
<div class="newsbox">
|
||||
<div class="leftbox">
|
||||
<div class="leftbox_title_bg">
|
||||
<div class="leftbox_title">
|
||||
{NEWSTITLE}
|
||||
</div>
|
||||
</div>
|
||||
<div class="meta">
|
||||
<div class="author mediumtext">
|
||||
{NEWSDATE=short} {NEWSAUTHOR}
|
||||
</div>
|
||||
</div>
|
||||
<div class="newsbbody">
|
||||
{NEWSIMAGE}
|
||||
{NEWSBODY} {EXTENDED}
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div class="metabottom">
|
||||
<div class="metaicons">
|
||||
{EMAILICON} {PRINTICON} {PDFICON} {ADMINOPTIONS}
|
||||
</div>
|
||||
{NEWSCOMMENTS}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
//$NEWS_MENU_TEMPLATE['view']['separator'] = '<br />';
|
72
news.php
72
news.php
@ -214,27 +214,36 @@ if ($action == 'cat' || $action == 'all' || vartrue($_GET['tag']))
|
||||
require_once(HEADERF);
|
||||
$action = $currentNewsAction;
|
||||
|
||||
/*
|
||||
if(!$NEWSLISTSTYLE)
|
||||
{
|
||||
$NEWSLISTSTYLE = "
|
||||
<div style='padding:3px;width:100%'>
|
||||
<table style='border-bottom:1px solid black;width:100%' cellpadding='0' cellspacing='0'>
|
||||
<tr>
|
||||
<td style='vertical-align:top;padding:3px;width:20px'>
|
||||
{NEWSCATICON}
|
||||
</td><td style='text-align:left;padding:3px'>
|
||||
{NEWSTITLELINK=extend}
|
||||
<br />
|
||||
{NEWSSUMMARY}
|
||||
<span class='smalltext'>
|
||||
{NEWSDATE}
|
||||
{NEWSCOMMENTS}
|
||||
</span>
|
||||
</td><td style='width:55px'>
|
||||
{NEWSTHUMBNAIL}
|
||||
</td></tr></table>
|
||||
</div>\n";
|
||||
|
||||
}*/
|
||||
|
||||
if(vartrue($NEWSLISTSTYLE)) $template = $NEWSLISTSTYLE;
|
||||
else
|
||||
{
|
||||
$NEWSLISTSTYLE = "
|
||||
<div style='padding:3px;width:100%'>
|
||||
<table style='border-bottom:1px solid black;width:100%' cellpadding='0' cellspacing='0'>
|
||||
<tr>
|
||||
<td style='vertical-align:top;padding:3px;width:20px'>
|
||||
{NEWSCATICON}
|
||||
</td><td style='text-align:left;padding:3px'>
|
||||
{NEWSTITLELINK=extend}
|
||||
<br />
|
||||
{NEWSSUMMARY}
|
||||
<span class='smalltext'>
|
||||
{NEWSDATE}
|
||||
{NEWSCOMMENTS}
|
||||
</span>
|
||||
</td><td style='width:55px'>
|
||||
{NEWSTHUMBNAIL}
|
||||
</td></tr></table>
|
||||
</div>\n";
|
||||
|
||||
$tmp = e107::getTemplate('news', 'news', 'list');
|
||||
$template = $tmp['item'];
|
||||
unset($tmp);
|
||||
}
|
||||
|
||||
$param = array();
|
||||
@ -249,7 +258,7 @@ if ($action == 'cat' || $action == 'all' || vartrue($_GET['tag']))
|
||||
|
||||
foreach($newsList as $row)
|
||||
{
|
||||
$text .= $ix->render_newsitem($row, 'return', '', $NEWSLISTSTYLE, $param);
|
||||
$text .= $ix->render_newsitem($row, 'return', '', $template, $param);
|
||||
}
|
||||
|
||||
$icon = ($row['category_icon']) ? "<img src='".e_IMAGE."icons/".$row['category_icon']."' alt='' />" : "";
|
||||
@ -389,9 +398,15 @@ if ($action == 'extend')
|
||||
|
||||
$param = array();
|
||||
$param['current_action'] = $action;
|
||||
|
||||
if(vartrue($NEWSSTYLE)) $template = $NEWSSTYLE;
|
||||
else
|
||||
{
|
||||
$tmp = e107::getTemplate('news', 'news', 'view');
|
||||
$template = $tmp['item'];
|
||||
unset($tmp);
|
||||
}
|
||||
ob_start();
|
||||
$ix->render_newsitem($news, 'extend', '', '', $param);
|
||||
$ix->render_newsitem($news, 'extend', '', $template, $param);
|
||||
if(e107::getRegistry('news/page_allow_comments'))
|
||||
{
|
||||
global $comment_edit_query; //FIXME - kill me
|
||||
@ -501,7 +516,7 @@ switch ($action)
|
||||
|
||||
case 'default' :
|
||||
default :
|
||||
$action = '';
|
||||
//$action = '';
|
||||
$cacheString = 'news.php_default_'; // Make sure its sensible
|
||||
// $news_total = $sql->db_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().") AND news_render_type<2" );
|
||||
|
||||
@ -601,7 +616,9 @@ switch($action)
|
||||
case 'item':
|
||||
setNewsFrontMeta($newsAr[1]);
|
||||
break;
|
||||
|
||||
case 'list':
|
||||
default:
|
||||
setNewsFrontMeta($newsAr[1], 'category');
|
||||
break;
|
||||
}
|
||||
@ -698,6 +715,13 @@ else
|
||||
$thispostday = 0;
|
||||
$pref['newsHeaderDate'] = 1;
|
||||
$gen = new convert();
|
||||
if(vartrue($NEWSLISTSTYLE)) $template = $NEWSLISTSTYLE;
|
||||
else
|
||||
{
|
||||
$tmp = e107::getTemplate('news', 'news', 'list');
|
||||
$template = $tmp['item'];
|
||||
unset($tmp);
|
||||
}
|
||||
|
||||
if (!defined("DATEHEADERCLASS")) {
|
||||
define("DATEHEADERCLASS", "nextprev");
|
||||
@ -741,7 +765,7 @@ else
|
||||
unset($news['news_render_type']);
|
||||
}
|
||||
|
||||
$ix->render_newsitem($news, 'default', '', '', $param);
|
||||
$ix->render_newsitem($news, 'default', '', $template, $param);
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user