1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-26 01:11:28 +02:00

NewsTags shortcode, some admin-ui fixes and newspost thumbnail BC fixes.

This commit is contained in:
CaMer0n
2012-07-15 03:01:30 +00:00
parent 5f61a512ae
commit 187bb8f53b
8 changed files with 71 additions and 13 deletions

View File

@@ -203,7 +203,7 @@ class page_admin_ui extends e_admin_ui
protected $fields = array(
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
'page_id' => array('title'=> 'ID', 'width'=>'5%', 'forced'=> TRUE),
'page_title' => array('title'=> LAN_TITLE, 'type' => 'method', 'width'=>'auto'),
'page_title' => array('title'=> LAN_TITLE, 'type' => 'text', 'width'=>'auto','readParms'=>'link={e_BASE}page.php?[id]&dialog=1'),
'page_theme' => array('title'=> CUSLAN_2, 'type' => 'text', 'width' => 'auto','nolist'=>true),
'page_template' => array('title'=> 'Template', 'type' => 'text', 'width' => 'auto'),
'page_author' => array('title'=> LAN_AUTHOR, 'type' => 'user', 'width' => 'auto', 'thclass' => 'left'),

View File

@@ -298,8 +298,8 @@ class news_admin_ui extends e_admin_ui
protected $fields = array(
'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' => 'image', '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),
'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_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),
@@ -497,7 +497,20 @@ class news_admin_ui extends e_admin_ui
class news_form_ui extends e_admin_form_ui
{
function news_thumbnail($curval,$mode)
{
if(!vartrue($curval)) return;
if($curval[0] != "{")
{
$curval = "{e_IMAGE}newspost_images/".$curval;
}
$url = e107::getParser()->thumbUrl($curval,'aw=80');
$link = e107::getParser()->replaceConstants($curval);
return "<a class='e-dialog' href='{$link}'><img src='{$url}' alt='{$curval}' /></a>";
}
}
new news_admin();
@@ -2053,6 +2066,11 @@ class admin_newspost
".$frm->help(LAN_NEWS_23)."</td>
<td>
";
if(vartrue($_POST['news_thumbnail']) && $_POST['news_thumbnail'][0] != "{")//BC compat
{
$_POST['news_thumbnail'] = "{e_IMAGE}newspost_images/".$_POST['news_thumbnail'];
}
$text .= $frm->imagepicker('news_thumbnail', $_POST['news_thumbnail'],'','news');

View File

@@ -446,6 +446,18 @@ class news_shortcodes extends e_shortcode
return $info;
}
function sc_newstags($parm=5)
{
$tmp = explode(",",$this->news_item['news_meta_keywords']);
$words = array();
foreach($tmp as $val)
{
$words[] = "<a href='".e_BASE."news.php?tag=".$val."'>".$val."</a>";
}
return implode(", ",$words);
}
}
?>

View File

@@ -4566,8 +4566,8 @@ class e_admin_form_ui extends e_form
break;
case 'userclass':
//case 'userclasses':
$classes = e107::getUserClass()->uc_required_class_list(vartrue($parms['classlist'], ''));
case 'userclasses':
$classes = e107::getUserClass()->uc_required_class_list(vartrue($parms['classlist'], 'public,nobody,guest,admin,main,classes'));
foreach($classes as $k => $name)
{
$option[$key.'__'.$k] = $name;

View File

@@ -1587,7 +1587,7 @@ class e_form
if(!is_array($attributes['readParms'])) parse_str($attributes['readParms'], $attributes['readParms']);
$parms = $attributes['readParms'];
}
$tp = e107::getParser();
switch($field) // special fields
{
@@ -1741,7 +1741,7 @@ class e_form
break;
case 'text':
if(vartrue($parms['truncate']))
{
$value = $tp->text_truncate($value, $parms['truncate'], '...');
@@ -1754,6 +1754,14 @@ class e_form
{
$value = $tp->htmlwrap($value, (int)$parms['wrap'], varset($parms['wrapChar'], ' '));
}
if(vartrue($parms['link']) && $id && is_numeric($id) )
{
$link = str_replace('[id]',$id,$parms['link']);
$link = $tp->replaceConstants($link); // SEF URL is not important since we're in admin.
$dialog = vartrue($parms['dialog']) ? "e-dialog" : "";
$value = "<a class='e-tip {$dialog}' href='".$link."' title='Quick View'>".$value."</a>";
}
$value = vartrue($parms['pre']).$value.vartrue($parms['post']);
break;

View File

@@ -509,7 +509,7 @@ class e_media
$media_path = ($w || $h) ? $tp->thumbUrl($im['media_url'], "w={$w}&h={$h}") : $tp->replaceConstants($im['media_url'],'full'); // max-size
$realPath = $tp->thumbUrl($im['media_url'], $att);
$diz = $tp->toAttribute($im['media_title']);
$diz = $tp->toAttribute($im['media_title'])."\n".$im['media_dimensions'];
$repl = array($im['media_url'],$media_path);
if($bbcode == null) // e107 Media Manager
@@ -537,8 +537,8 @@ class e_media
$img_url = ($cat !='_icon') ? e107::getParser()->thumbUrl($im['media_url'], $att) : $media_path;
$text .= "<a class='{$class} ' data-id='{$im['media_id']}' data-src='{$media_path}' data-bbcode='{$data_bb}' data-target='{$tagid}' data-path='{$im['media_url']}' data-preview='{$realPath}' title=\"".$diz."\" style='float:left' href='#' onclick=\"{$onclicki}\" >";
$text .= "<img src='".$img_url."' alt=\"".$im['media_title']."\" />";
$text .= "<a class='{$class} e-tip' data-id='{$im['media_id']}' data-src='{$media_path}' data-bbcode='{$data_bb}' data-target='{$tagid}' data-path='{$im['media_url']}' data-preview='{$realPath}' title=\"".$diz."\" style='float:left' href='#' onclick=\"{$onclicki}\" >";
$text .= "<img src='".$img_url."' alt=\"".$im['media_title']."\" title=\"{$diz}\" />";
$text .= "</a>\n\n";
}

View File

@@ -62,6 +62,9 @@ class GdWatermarkTTF
$shadowcolor = imagecolorallocatealpha($im, $scol[0], $scol[1], $scol[2], $opacity);
$white = imagecolorallocatealpha($im, $col[0], $col[1], $col[2], $opacity);
// imagefilter($shadowcolor, IMG_FILTER_GAUSSIAN_BLUR);
imagefilter($shadowcolor, IMG_FILTER_SELECTIVE_BLUR);
imagettftext($im, $size, 0, $x + 1, $y + 1, $shadowcolor, $font, $text);
imagettftext($im, $size, 0, $x -1, $y + 1, $shadowcolor, $font, $text);
imagettftext($im, $size, 0, $x + 0, $y + 0, $white, $font, $text);

View File

@@ -46,7 +46,7 @@ if (!defined('ITEMVIEW'))
define('ITEMVIEW', varset($pref['newsposts'],15));
}
if (e_QUERY)
if (e_QUERY) //TODO add support for $_GET['cat'] and $_GET['mode'] and phase-out the x.x.x format.
{
$tmp = explode(".",e_QUERY);
@@ -123,7 +123,8 @@ $nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'";
// DISPLAY NEWS IN 'CATEGORY' FORMAT HERE
//------------------------------------------------------
// Just title and a few other details
if ($action == 'cat' || $action == 'all')
if ($action == 'cat' || $action == 'all' || vartrue($_GET['tag']))
{ // --> Cache
if($newsCachedPage = checkCache($cacheString))
{
@@ -175,6 +176,22 @@ if ($action == 'cat' || $action == 'all')
ORDER BY n.news_datestamp DESC
LIMIT ".intval($newsfrom).",".NEWSLIST_LIMIT;
}
elseif(vartrue($_GET['tag']))
{
$tagsearch = preg_replace('#[^a-zA-Z0-9\-]#','', $_GET['tag']);
$query = "
SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon, nc.category_meta_keywords,
nc.category_meta_description{$rewrite_cols_cat}{$rewrite_cols}
FROM #news AS n
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
WHERE n.news_meta_keywords LIKE '%".$tagsearch."%'
AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")
AND n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.")
ORDER BY n.news_datestamp DESC
LIMIT ".intval($newsfrom).",".NEWSLIST_LIMIT;
$category_name = 'Tag: "'.$tagsearch.'"';
}
$newsList = array();
if($sql->db_Select_gen($query))