1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 12:48:26 +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

@@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $
| $Revision: 1.11 $ | $Revision: 1.12 $
| $Date: 2008-02-19 19:33:45 $ | $Date: 2008-03-18 00:38:53 $
| $Author: mcfly_e107 $ | $Author: e107coders $
+---------------------------------------------------------------+ +---------------------------------------------------------------+
*/ */
@@ -557,6 +557,7 @@ class newspost
$parms .= "&click_prefix=[img][[e_IMAGE]]newspost_images/"; $parms .= "&click_prefix=[img][[e_IMAGE]]newspost_images/";
$parms .= "&click_postfix=[/img]"; $parms .= "&click_postfix=[/img]";
$text .= $tp->parseTemplate("{IMAGESELECTOR={$parms}}"); $text .= $tp->parseTemplate("{IMAGESELECTOR={$parms}}");
$text .= "</div> $text .= "</div>

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/prefs.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/prefs.php,v $
| $Revision: 1.11 $ | $Revision: 1.12 $
| $Date: 2008-01-16 10:52:30 $ | $Date: 2008-03-18 00:38:53 $
| $Author: e107coders $ | $Author: e107coders $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -205,6 +205,7 @@ $text = "<script type=\"text/javascript\">
$parms .= "&label=-- No Image --"; $parms .= "&label=-- No Image --";
$parms .= "&subdirs=1"; $parms .= "&subdirs=1";
$text .= $tp->parseTemplate("{IMAGESELECTOR={$parms}}"); $text .= $tp->parseTemplate("{IMAGESELECTOR={$parms}}");
$text .= " $text .= "

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_files/e_ajax.php,v $ | $Source: /cvs_backup/e107_0.8/e107_files/e_ajax.php,v $
| $Revision: 1.3 $ | $Revision: 1.4 $
| $Date: 2008-01-27 11:02:34 $ | $Date: 2008-03-18 00:38:53 $
| $Author: e107coders $ | $Author: e107coders $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -35,7 +35,9 @@ ob_implicit_flush(0);
if($_POST['ajax_sc'] && $_POST['ajax_used']) if($_POST['ajax_sc'] && $_POST['ajax_used'])
{ {
echo $tp->parseTemplate("{".strtoupper($_POST['ajax_sc'])."}",TRUE,$shortcodes); list($fld,$parm) = explode("=",$_POST['ajax_sc']);
$prm = ($parm) ? "=".$parm : "";
echo $tp->parseTemplate("{".strtoupper($fld).$prm."}",TRUE,$shortcodes);
exit; exit;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

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; global $sql,$parm,$tp;
@@ -19,9 +19,9 @@ $paths = explode("|",$path);
$recurse = ($subdirs) ? $subdirs : 0; $recurse = ($subdirs) ? $subdirs : 0;
$imagelist = array(); $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) if($imagelist)
@@ -39,7 +39,13 @@ $width = ($width) ? $width : "*";
$height = ($height) ? $height : "*"; $height = ($height) ? $height : "*";
$label = ($label) ? $label : " -- -- "; $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"; <option value=''>".$label."</option>\n";
foreach($imagelist as $icon) foreach($imagelist as $icon)
{ {
@@ -53,11 +59,9 @@ foreach($imagelist as $icon)
} }
} }
$text .= "</select>"; $text .= "</select>";
if(!$pvw_default)
$pvw_default = ($default) ? $path.$default : e_IMAGE_ABS."generic/blank.gif";
if($default[0]=="{")
{ {
$pvw_default = $tp->replaceConstants($default); $pvw_default = ($default) ? $path.$default : e_IMAGE_ABS."generic/blank.gif";
} }
if(varset($click_target)) if(varset($click_target))
@@ -66,7 +70,7 @@ if(varset($click_target))
$post = varset($click_postfix); $post = varset($click_postfix);
$text .= "<a href='#' onclick='addtext(\"{$pre}\"+document.getElementById(\"{$name}\").value+\"{$post}\", true);document.getElementById(\"{$name}\").selectedIndex = -1;return false;'>"; $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)) if(varset($click_target))
{ {
$text .= "</a>"; $text .= "</a>";