1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 11:50:30 +02:00

Styling fix on imagepicker();

This commit is contained in:
Cameron
2014-01-24 12:52:26 -08:00
parent 2990f4d376
commit 02bf58c5c7
3 changed files with 97 additions and 9 deletions

View File

@@ -1319,6 +1319,32 @@ class admin_newspost
return true;
}
/**
* For future use: multiple-images.
*/
private function processThumbs($postedImage)
{
if(is_array($postedImage))
{
return implode(",",array_filter($postedImage));
}
else
{
return $postedImage;
}
}
// In USE.
function _observe_submit_item($sub_action, $id)
{
@@ -1355,6 +1381,12 @@ class admin_newspost
$_POST['news_datestamp'] = time();
}
$_POST['news_thumbnail'] = $this->processThumbs($_POST['news_thumbnail']);
/*
$matches = array();
@@ -2342,7 +2374,7 @@ class admin_newspost
$text .= "
<tr>
<td>".NWSLAN_67.":<br />
<td>".NWSLAN_67."s:<br />
".$frm->help(LAN_NEWS_23)."</td>
<td>
";
@@ -2351,9 +2383,17 @@ class admin_newspost
$_POST['news_thumbnail'] = "{e_IMAGE}newspost_images/".$_POST['news_thumbnail'];
}
$text .= $frm->imagepicker('news_thumbnail', $_POST['news_thumbnail'],'','news');
$text .= $frm->imagepicker('news_thumbnail[0]', $_POST['news_thumbnail'] ,'','news');
/*
* XXX Experimental
$thumbTmp = explode(",",$_POST['news_thumbnail']);
$text .= $frm->imagepicker('news_thumbnail[0]', varset($thumbTmp[0]),'','news');
$text .= $frm->imagepicker('news_thumbnail[1]', varset($thumbTmp[1]),'','news');
$text .= $frm->imagepicker('news_thumbnail[2]', varset($thumbTmp[2]),'','news');
$text .= $frm->imagepicker('news_thumbnail[3]', varset($thumbTmp[3]),'','news');
$text .= $frm->imagepicker('news_thumbnail[4]', varset($thumbTmp[4]),'','news');
*/
$text .= "
</td>

View File

@@ -31,6 +31,8 @@ class news_shortcodes extends e_shortcode
protected $commentsDisabled;
private $imageItem;
function __construct($eVars = null)
{
@@ -40,6 +42,8 @@ class news_shortcodes extends e_shortcode
$pref = e107::getPref();
$this->commentsDisabled = vartrue($pref['comments_disabled']);
}
function sc_newstitle()
@@ -388,11 +392,53 @@ class news_shortcodes extends e_shortcode
}
}
/**
* XXX Experimental Images/Video - supports multiple items
* {NEWSMEDIA: item=1}
*/
function sc_newsmedia($parm=array())
{
$media = explode(",", $this->news_item['news_thumbnail']);
if(!vartrue($parm['item']))
{
$parm['item'] = 0;
}
else
{
$parm['item'] = ($parm['item'] -1);
}
$this->imageItem = varset($media[$parm['item']]); // Set the current Image for other image shortcodes.
if(vartrue($parm['placeholder']))
{
return $this->sc_newsimage('placeholder');
}
else
{
return $this->sc_newsimage();
}
}
function sc_newsimage($parm = '')
{
$tp = e107::getParser();
$srcPath = ($this->imageItem) ? $this->imageItem : $this->news_item['news_thumbnail'];
if(!$this->news_item['news_thumbnail'])
if(!$srcPath)
{
if($parm == 'placeholder')
{
@@ -403,14 +449,14 @@ class news_shortcodes extends e_shortcode
return;
}
}
elseif($this->news_item['news_thumbnail'][0] == '{' ) // Always resize. Use {SETIMAGE: w=x&y=x&crop=0} PRIOR to calling shortcode to change.
elseif($srcPath[0] == '{' ) // Always resize. Use {SETIMAGE: w=x&y=x&crop=0} PRIOR to calling shortcode to change.
{
$src = $tp->thumbUrl($this->news_item['news_thumbnail']);
$src = $tp->thumbUrl($srcPath);
}
else
{
// We store SC path in DB now + BC
$src = $this->news_item['news_thumbnail'][0] == '{' ? $tp->replaceConstants($this->news_item['news_thumbnail'], 'abs') : e_IMAGE_ABS."newspost_images/".$this->news_item['news_thumbnail'];
$src = $srcPath[0] == '{' ? $tp->replaceConstants($srcPath, 'abs') : e_IMAGE_ABS."newspost_images/".$srcPath;
}

View File

@@ -496,6 +496,7 @@ class e_form
{
$tp = e107::getParser();
$name_id = $this->name2id($name);
$meta_id = $name_id."-meta";
if(is_string($sc_parameters))
{
@@ -553,7 +554,7 @@ class e_form
$width = vartrue($sc_parameters['w'], 120);
$height = vartrue($sc_parameters['h'], 100);
$ret = "<div class='imgselector-container e-tip' {$title} style='display:block;width:".$width."px;min-height:".$height."px;'>";
$ret = "<div class='imgselector-container e-tip' {$title} style='margin-right:25px; display:inline-block; width:".$width."px;min-height:".$height."px;'>";
$att = 'aw='.$width."'&ah=".$height."'";
$thpath = isset($sc_parameters['nothumb']) || vartrue($hide) ? $default : $tp->thumbUrl($default_thumb, $att, true);
@@ -570,6 +571,7 @@ class e_form
$ret .= $this->mediaUrl($cat, $label,$name_id,$sc_parameters);
$ret .= "</div>\n";
$ret .= "<input type='hidden' name='{$name}' id='{$name_id}' value='{$default}' />";
$ret .= "<input type='hidden' name='mediameta_{$name}' id='{$meta_id}' value='' />";
// $ret .= $this->text($name,$default); // to be hidden eventually.
return $ret;