1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 20:57:26 +02:00

News administration: category edit works now

News shortcode batch: icons/images paths fixed, minor cleanup
This commit is contained in:
secretr
2010-03-16 17:33:21 +00:00
parent ce565c1167
commit 9f69cf1d0b
3 changed files with 32 additions and 38 deletions

View File

@@ -1994,7 +1994,7 @@ class admin_newspost
//Send the prefered response type //Send the prefered response type
$jshelper->sendResponse('fill-form'); $jshelper->sendResponse('XML');
} }
function ajax_exec_cat_list_refresh() function ajax_exec_cat_list_refresh()

View File

@@ -75,18 +75,8 @@ class news_shortcodes
function sc_newsicon($parm) function sc_newsicon($parm)
{ {
$category_icon = str_replace('../', '', trim($this->news_item['category_icon']));
if ($category_icon && strstr('images', $category_icon))
{
$category_icon = THEME_ABS.$category_icon;
}
else
{
$category_icon = e_IMAGE_ABS.'icons/'.$category_icon;
}
if (!$category_icon) { return ''; }
return "<a href='".$this->e107->url->getUrl('core:news', 'main', 'action=list&id='.$this->news_item['news_category'].'&sef='.$this->news_item['news_category_rewrite_string'])."'><img style='".$this->param['caticon']."' src='".$category_icon."' alt='' /></a>"; return $this->sc_newscaticon('url');
} }
function sc_newsauthor($parm) function sc_newsauthor($parm)
@@ -156,13 +146,7 @@ class news_shortcodes
function sc_newsheader($parm) function sc_newsheader($parm)
{ {
$category_icon = str_replace("../", "", trim($this->news_item['category_icon'])); return $this->sc_newscaticon('src');
if (!$category_icon) return '';
if ($category_icon && strstr("images", $category_icon)) {
return THEME_ABS.$category_icon;
} else {
return e_IMAGE_ABS."icons/".$category_icon;
}
} }
@@ -297,38 +281,53 @@ class news_shortcodes
return ($this->news_item['news_summary']) ? $this->news_item['news_summary'].'<br />' : ''; return ($this->news_item['news_summary']) ? $this->news_item['news_summary'].'<br />' : '';
} }
// FIXME - REAL thumbnail - already possible on the fly
function sc_newsthumbnail($parm = '') function sc_newsthumbnail($parm = '')
{ {
if(!$this->news_item['news_thumbnail'])
{
return '';
}
// We store SC path in DB now + BC
$src = $this->news_item['news_thumbnail'][0] == '{' ? e107::getParser()->replaceConstants($this->news_item['news_thumbnail'], 'abs') : e_IMAGE_ABS."newspost_images/".$this->news_item['news_thumbnail'];
switch($parm) switch($parm)
{ {
case 'src': case 'src':
return (isset($this->news_item['news_thumbnail']) && $this->news_item['news_thumbnail'] ? e_IMAGE_ABS."newspost_images/".$this->news_item['news_thumbnail'] : ''); return $src;
break; break;
case 'tag': case 'tag':
return (isset($this->news_item['news_thumbnail']) && $this->news_item['news_thumbnail'] ? "<img class='news_image' src='".e_IMAGE_ABS."newspost_images/".$this->news_item['news_thumbnail']."' alt='' style='".$this->param['thumbnail']."' />" : ''); return "<img class='news_image' src='".$src."' alt='' style='".$this->param['thumbnail']."' />";
break; break;
default: default:
return (isset($this->news_item['news_thumbnail']) && $this->news_item['news_thumbnail']) ? "<a href='".$this->e107->url->getUrl('core:news', 'main', "action=extend&id={$this->news_item['news_id']}&catid={$this->news_item['news_category']}&sef={$this->news_item['news_rewrite_string']}")."'><img class='news_image' src='".e_IMAGE_ABS."newspost_images/".$this->news_item['news_thumbnail']."' alt='' style='".$this->param['thumbnail']."' /></a>" : ''; return "<a href='".$this->e107->url->getUrl('core:news', 'main', "action=extend&id={$this->news_item['news_id']}&catid={$this->news_item['news_category']}&sef={$this->news_item['news_rewrite_string']}")."'><img class='news_image' src='".$src."' alt='' style='".$this->param['thumbnail']."' /></a>";
break; break;
} }
} }
function sc_newsimage($parm = '') function sc_newsimage($parm = '')
{ {
if(!$this->news_item['news_thumbnail'])
{
return '';
}
// We store SC path in DB now + BC
$src = $this->news_item['news_thumbnail'][0] == '{' ? e107::getParser()->replaceConstants($this->news_item['news_thumbnail'], 'abs') : e_IMAGE_ABS."newspost_images/".$this->news_item['news_thumbnail'];
switch($parm) switch($parm)
{ {
case 'src': case 'src':
return (isset($this->news_item['news_thumbnail']) && $this->news_item['news_thumbnail'] ? e_IMAGE_ABS.$this->news_item['news_thumbnail'] : ''); return $src;
break; break;
case 'tag': case 'tag':
return (isset($this->news_item['news_thumbnail']) && $this->news_item['news_thumbnail'] ? "<img class='news_image' src='".e_IMAGE_ABS."newspost_images/".$this->news_item['news_thumbnail']."' alt='' style='".$this->param['thumbnail']."' />" : ''); return "<img class='news_image' src='".$src."' alt='' style='".$this->param['thumbnail']."' />";
break; break;
case 'url':
default: default:
return (isset($this->news_item['news_thumbnail']) && $this->news_item['news_thumbnail']) ? "<a href='".$this->e107->url->getUrl('core:news', 'main', "action=extend&id={$this->news_item['news_id']}&catid={$this->news_item['news_category']}&sef={$this->news_item['news_rewrite_string']}")."'><img class='news_image' src='".e_IMAGE_ABS."newspost_images/".$this->news_item['news_thumbnail']."' alt='' style='".$this->param['thumbnail']."' /></a>" : ''; return "<a href='".$this->e107->url->getUrl('core:news', 'main', "action=extend&id={$this->news_item['news_id']}&catid={$this->news_item['news_category']}&sef={$this->news_item['news_rewrite_string']}")."'><img class='news_image' src='".$src."' alt='' style='".$this->param['thumbnail']."' /></a>";
break; break;
} }
} }
@@ -351,16 +350,12 @@ class news_shortcodes
function sc_newscaticon($parm = '') function sc_newscaticon($parm = '')
{ {
// BC
$category_icon = str_replace('../', '', trim($this->news_item['category_icon'])); $category_icon = str_replace('../', '', trim($this->news_item['category_icon']));
if (!$category_icon) { return ''; } if (!$category_icon) { return ''; }
if ($category_icon && strstr('images', $category_icon))
{ // We store SC path in DB now + BC
$category_icon = THEME_ABS.$category_icon; $src = $category_icon[0] == '{' ? e107::getParser()->replaceConstants($category_icon, 'abs') : e_IMAGE_ABS."newspost_images/".$category_icon;
}
else
{
$category_icon = e_IMAGE_ABS.'icons/'.$category_icon;
}
//TODO - remove inline styles //TODO - remove inline styles
if($this->param['caticon'] == ''){$this->param['caticon'] = 'border:0px';} if($this->param['caticon'] == ''){$this->param['caticon'] = 'border:0px';}
@@ -372,11 +367,12 @@ class news_shortcodes
break; break;
case 'tag': case 'tag':
return "<img class='news_image' src='{$category_icon}' alt='' style='".$this->param['caticon']."' />"; return "<img class='news_image' src='{$src}' alt='' style='".$this->param['caticon']."' />";
break; break;
case 'url':
default: default:
return "<a href='".$this->e107->url->getUrl('core:news', 'main', "action=list&id={$this->news_item['news_category']}&sef={$this->news_item['news_category_rewrite_string']}")."'><img style='".$this->param['caticon']."' src='".$category_icon."' alt='' /></a>"; return "<a href='".$this->e107->url->getUrl('core:news', 'main', "action=list&id={$this->news_item['news_category']}&sef={$this->news_item['news_category_rewrite_string']}")."'><img style='".$this->param['caticon']."' src='".$src."' alt='' /></a>";
break; break;
} }
} }

View File

@@ -9,9 +9,7 @@
* Form Handler * Form Handler
* *
* $URL$ * $URL$
* $Revision$ * $Id$
* $Date$
* $Author$
* *
*/ */