mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 20:57:26 +02:00
Submitnews image preview fix.
This commit is contained in:
@@ -21,6 +21,11 @@ if (!getperms('H|N|H0|H1|H2|H3|H4|H5'))
|
|||||||
e107::coreLan('newspost', true);
|
e107::coreLan('newspost', true);
|
||||||
|
|
||||||
|
|
||||||
|
e107::css('inline', "
|
||||||
|
|
||||||
|
.submitnews.modal-body { height: 500px; overflow-y: scroll; }
|
||||||
|
|
||||||
|
");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -304,7 +309,7 @@ class news_sub_form_ui extends e_admin_form_ui
|
|||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
<h4>'.$tp->toHtml($submitnews_title,false,'TITLE').'</h4>
|
<h4>'.$tp->toHtml($submitnews_title,false,'TITLE').'</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="submitnews modal-body">
|
||||||
<p>';
|
<p>';
|
||||||
|
|
||||||
$text .= $tp->toHTML($submitnews_item,TRUE);
|
$text .= $tp->toHTML($submitnews_item,TRUE);
|
||||||
@@ -317,8 +322,13 @@ class news_sub_form_ui extends e_admin_form_ui
|
|||||||
|
|
||||||
|
|
||||||
foreach($tmp as $imgfile)
|
foreach($tmp as $imgfile)
|
||||||
{
|
{
|
||||||
$url = $tp->thumbUrl(e_UPLOAD.$imgfile,array('aw'=>400),true);
|
if(strpos("{e_UPLOAD}",$imgfile) === false)
|
||||||
|
{
|
||||||
|
$imgfile = e_UPLOAD.$imgfile;
|
||||||
|
}
|
||||||
|
|
||||||
|
$url = $tp->thumbUrl($imgfile,array('aw'=>400),true);
|
||||||
$text .= "<br /><img src='".$url."' alt='".$imgfile."' />";
|
$text .= "<br /><img src='".$url."' alt='".$imgfile."' />";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -366,7 +376,7 @@ class news_sub_form_ui extends e_admin_form_ui
|
|||||||
if($approved == 0)
|
if($approved == 0)
|
||||||
{
|
{
|
||||||
//$text = $this->submit_image('submitnews['.$id.']', 1, 'execute', NWSLAN_58);
|
//$text = $this->submit_image('submitnews['.$id.']', 1, 'execute', NWSLAN_58);
|
||||||
$text .= "<a class='btn btn-default btn-large' href='".e_SELF."?mode=main&action=create&sub={$id}'>".ADMIN_EXECUTE_ICON."</a>";
|
$text .= "<a class='btn btn-default btn-large' title=\"Approve\" href='".e_SELF."?mode=main&action=create&sub={$id}'>".ADMIN_EXECUTE_ICON."</a>";
|
||||||
// NWSLAN_103;
|
// NWSLAN_103;
|
||||||
}
|
}
|
||||||
else // Already submitted;
|
else // Already submitted;
|
||||||
@@ -513,30 +523,21 @@ class news_admin_ui extends e_admin_ui
|
|||||||
$new = array();
|
$new = array();
|
||||||
foreach($row as $k=>$v)
|
foreach($row as $k=>$v)
|
||||||
{
|
{
|
||||||
$tmp = urldecode($v);
|
if(empty($v))
|
||||||
if(strpos($tmp,'{e_UPLOAD}')!==false)
|
|
||||||
{
|
{
|
||||||
list($root,$qry) = explode("?",$tmp);
|
continue;
|
||||||
parse_str($qry,$opt);
|
|
||||||
if(!empty($opt['src']))
|
|
||||||
{
|
|
||||||
|
|
||||||
$f = str_replace('{e_UPLOAD}','',$opt['src']);
|
|
||||||
// e107::getMessage()->addInfo("<h3>Importing File</h3>".print_a($f,true));
|
|
||||||
if($bbpath = e107::getMedia()->importFile($f,'news', e_UPLOAD.$f))
|
|
||||||
{
|
|
||||||
$new[] = $bbpath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
elseif(!empty($v))
|
|
||||||
|
$f = str_replace('{e_UPLOAD}','',$v);
|
||||||
|
|
||||||
|
if($bbpath = e107::getMedia()->importFile($f,'news', e_UPLOAD.$f))
|
||||||
{
|
{
|
||||||
$new[] = $v;
|
$new[] = $bbpath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// e107::getMessage()->addInfo("<h3>Process SubNews Images</h3>".print_a($new,true));
|
|
||||||
|
e107::getMessage()->addDebug("<h3>Processing/importing SubNews Images</h3>".print_a($new,true));
|
||||||
|
|
||||||
return implode(",",$new);
|
return implode(",",$new);
|
||||||
|
|
||||||
@@ -1548,14 +1549,17 @@ class news_form_ui extends e_admin_form_ui
|
|||||||
|
|
||||||
if($mode == 'read')
|
if($mode == 'read')
|
||||||
{
|
{
|
||||||
if(!vartrue($curval)) return;
|
|
||||||
|
|
||||||
if(strpos($curval, ",")!==false)
|
if(strpos($curval, ",")!==false)
|
||||||
{
|
{
|
||||||
$tmp = explode(",",$curval);
|
$tmp = explode(",",$curval);
|
||||||
$curval = $tmp[0];
|
$curval = $tmp[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(empty($curval))
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$vparm = array('thumb'=>'tag','w'=> 80);
|
$vparm = array('thumb'=>'tag','w'=> 80);
|
||||||
|
|
||||||
if($thumb = e107::getParser()->toVideo($curval,$vparm))
|
if($thumb = e107::getParser()->toVideo($curval,$vparm))
|
||||||
@@ -1577,17 +1581,17 @@ class news_form_ui extends e_admin_form_ui
|
|||||||
|
|
||||||
if($mode == 'write')
|
if($mode == 'write')
|
||||||
{
|
{
|
||||||
|
$paths = array();
|
||||||
|
|
||||||
if(!empty($_GET['sub']))
|
if(!empty($_GET['sub']))
|
||||||
{
|
{
|
||||||
$thumbTmp = explode(",",$curval);
|
$thumbTmp = explode(",",$curval);
|
||||||
$paths = array();
|
|
||||||
foreach($thumbTmp as $key=>$path)
|
foreach($thumbTmp as $key=>$path)
|
||||||
{
|
{
|
||||||
$paths[] = e107::getParser()->thumbUrl(e_TEMP.$path,'aw=800'); ;
|
$url = ($path[0] == '{') ? $path : e_TEMP.$path;
|
||||||
|
$paths[] = e107::getParser()->thumbUrl($url,'aw=800'); ;
|
||||||
}
|
}
|
||||||
|
|
||||||
$curval = implode(",", $paths);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1605,11 +1609,11 @@ class news_form_ui extends e_admin_form_ui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$text = $frm->imagepicker('news_thumbnail[0]', varset($thumbTmp[0]),'','media=news&video=1');
|
$text = $frm->imagepicker('news_thumbnail[0]', varset($thumbTmp[0]), varset($paths[0]),'media=news&video=1');
|
||||||
$text .= $frm->imagepicker('news_thumbnail[1]', varset($thumbTmp[1]),'','media=news&video=1');
|
$text .= $frm->imagepicker('news_thumbnail[1]', varset($thumbTmp[1]), varset($paths[1]),'media=news&video=1');
|
||||||
$text .= $frm->imagepicker('news_thumbnail[2]', varset($thumbTmp[2]),'','media=news&video=1');
|
$text .= $frm->imagepicker('news_thumbnail[2]', varset($thumbTmp[2]), varset($paths[2]),'media=news&video=1');
|
||||||
$text .= $frm->imagepicker('news_thumbnail[3]', varset($thumbTmp[3]),'','media=news&video=1');
|
$text .= $frm->imagepicker('news_thumbnail[3]', varset($thumbTmp[3]), varset($paths[3]),'media=news&video=1');
|
||||||
$text .= $frm->imagepicker('news_thumbnail[4]', varset($thumbTmp[4]),'','media=news&video=1');
|
$text .= $frm->imagepicker('news_thumbnail[4]', varset($thumbTmp[4]), varset($paths[4]),'media=news&video=1');
|
||||||
|
|
||||||
// $text .= "<div class='field-help'>Insert image/video into designated area of template.</div>";
|
// $text .= "<div class='field-help'>Insert image/video into designated area of template.</div>";
|
||||||
return $text;
|
return $text;
|
||||||
|
@@ -1079,7 +1079,7 @@ class e_form
|
|||||||
* @example $frm->imagepicker('banner_image', $_POST['banner_image'], '', 'media=banner&w=600');
|
* @example $frm->imagepicker('banner_image', $_POST['banner_image'], '', 'media=banner&w=600');
|
||||||
* @return string html output
|
* @return string html output
|
||||||
*/
|
*/
|
||||||
function imagepicker($name, $default, $label = '', $sc_parameters = '')
|
function imagepicker($name, $default, $previewURL = '', $sc_parameters = '')
|
||||||
{
|
{
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$name_id = $this->name2id($name);
|
$name_id = $this->name2id($name);
|
||||||
@@ -1132,8 +1132,7 @@ class e_form
|
|||||||
$class = 'image-selector-empty';
|
$class = 'image-selector-empty';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//$width = intval(vartrue($sc_parameters['width'], 150));
|
//$width = intval(vartrue($sc_parameters['width'], 150));
|
||||||
$cat = $tp->toDB(vartrue($sc_parameters['media']));
|
$cat = $tp->toDB(vartrue($sc_parameters['media']));
|
||||||
|
|
||||||
@@ -1172,8 +1171,13 @@ class e_form
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!empty($previewURL))
|
||||||
|
{
|
||||||
|
$default_url = $previewURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$ret .= $this->mediaUrl($cat, $label,$name_id,$sc_parameters);
|
$ret .= $this->mediaUrl($cat, $label,$name_id,$sc_parameters);
|
||||||
|
|
||||||
if($cat != '_icon' && $blank == false) // ICONS
|
if($cat != '_icon' && $blank == false) // ICONS
|
||||||
|
Reference in New Issue
Block a user