1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-11 00:54:49 +02:00

Fixed imageselector to work in both admin->prefs and admin->newspost. Now uses it's own preview shortcode.

This commit is contained in:
CaMer0n
2008-03-18 00:39:02 +00:00
parent 089d734839
commit 99b74405d9
5 changed files with 40 additions and 17 deletions

View File

@@ -0,0 +1,15 @@
// $Id: imagepreview.sc,v 1.1 2008-03-18 00:39:02 e107coders Exp $
global $tp;
list($name,$width,$height,$img_path) = explode("|",$parm);
if(!$width)
{
$width = "32px";
}
if(!$height)
{
$height = "32px";
}
$path = ($_POST[$name] && $_POST['ajax_used']) ? $img_path.$tp->replaceConstants($_POST[$name]) : e_IMAGE_ABS."generic/blank.gif";
return "<img src='".$path."' alt=\"\" style='border: 0px; width: {$width}; height: {$height}' />";

View File

@@ -1,4 +1,4 @@
// $Id: imageselector.sc,v 1.5 2008-02-19 19:33:45 mcfly_e107 Exp $
// $Id: imageselector.sc,v 1.6 2008-03-18 00:39:02 e107coders Exp $
global $sql,$parm,$tp;
@@ -19,9 +19,9 @@ $paths = explode("|",$path);
$recurse = ($subdirs) ? $subdirs : 0;
$imagelist = array();
foreach($paths as $path)
foreach($paths as $pths)
{
$imagelist += $fl->get_files($path,".jpg|.gif|.png|.JPG|.GIF|.PNG", 'standard', $recurse);
$imagelist += $fl->get_files($pths,".jpg|.gif|.png|.JPG|.GIF|.PNG", 'standard', $recurse);
}
if($imagelist)
@@ -39,7 +39,13 @@ $width = ($width) ? $width : "*";
$height = ($height) ? $height : "*";
$label = ($label) ? $label : " -- -- ";
$text .= "<select {$multi} class='tbox' name='$name' id='$name' onchange=\"replaceSC('$name',this.form,'{$name}_prev');\">
if(trim($default[0])=="{")
{
$pvw_default = $tp->replaceConstants($default);
$path = ""; // remove the default path if a constant is used.
}
$text .= "<select {$multi} class='tbox' name='$name' id='$name' onchange=\"replaceSC('imagepreview={$name}|{$width}|{$height}|{$path}',this.form,'{$name}_prev');\">
<option value=''>".$label."</option>\n";
foreach($imagelist as $icon)
{
@@ -53,11 +59,9 @@ foreach($imagelist as $icon)
}
}
$text .= "</select>";
$pvw_default = ($default) ? $path.$default : e_IMAGE_ABS."generic/blank.gif";
if($default[0]=="{")
if(!$pvw_default)
{
$pvw_default = $tp->replaceConstants($default);
$pvw_default = ($default) ? $path.$default : e_IMAGE_ABS."generic/blank.gif";
}
if(varset($click_target))
@@ -66,7 +70,7 @@ if(varset($click_target))
$post = varset($click_postfix);
$text .= "<a href='#' onclick='addtext(\"{$pre}\"+document.getElementById(\"{$name}\").value+\"{$post}\", true);document.getElementById(\"{$name}\").selectedIndex = -1;return false;'>";
}
$text .= "&nbsp;<img id='{$name}_prev' src='{$pvw_default}' alt='' style='width:{$width};height:{$height}' />\n";
$text .= "&nbsp;<span id='{$name}_prev'><img src='{$pvw_default}' alt='' style='width:{$width};height:{$height}' /></span>\n";
if(varset($click_target))
{
$text .= "</a>";