mirror of
https://github.com/e107inc/e107.git
synced 2025-04-20 12:41:51 +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:
parent
089d734839
commit
99b74405d9
@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $
|
||||
| $Revision: 1.11 $
|
||||
| $Date: 2008-02-19 19:33:45 $
|
||||
| $Author: mcfly_e107 $
|
||||
| $Revision: 1.12 $
|
||||
| $Date: 2008-03-18 00:38:53 $
|
||||
| $Author: e107coders $
|
||||
+---------------------------------------------------------------+
|
||||
|
||||
*/
|
||||
@ -557,6 +557,7 @@ class newspost
|
||||
$parms .= "&click_prefix=[img][[e_IMAGE]]newspost_images/";
|
||||
$parms .= "&click_postfix=[/img]";
|
||||
|
||||
|
||||
$text .= $tp->parseTemplate("{IMAGESELECTOR={$parms}}");
|
||||
|
||||
$text .= "</div>
|
||||
|
@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/prefs.php,v $
|
||||
| $Revision: 1.11 $
|
||||
| $Date: 2008-01-16 10:52:30 $
|
||||
| $Revision: 1.12 $
|
||||
| $Date: 2008-03-18 00:38:53 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -205,6 +205,7 @@ $text = "<script type=\"text/javascript\">
|
||||
$parms .= "&label=-- No Image --";
|
||||
$parms .= "&subdirs=1";
|
||||
|
||||
|
||||
$text .= $tp->parseTemplate("{IMAGESELECTOR={$parms}}");
|
||||
|
||||
$text .= "
|
||||
|
@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_files/e_ajax.php,v $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2008-01-27 11:02:34 $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2008-03-18 00:38:53 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -35,7 +35,9 @@ ob_implicit_flush(0);
|
||||
|
||||
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;
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
|
15
e107_files/shortcode/imagepreview.sc
Normal file
15
e107_files/shortcode/imagepreview.sc
Normal 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}' />";
|
@ -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 .= " <img id='{$name}_prev' src='{$pvw_default}' alt='' style='width:{$width};height:{$height}' />\n";
|
||||
$text .= " <span id='{$name}_prev'><img src='{$pvw_default}' alt='' style='width:{$width};height:{$height}' /></span>\n";
|
||||
if(varset($click_target))
|
||||
{
|
||||
$text .= "</a>";
|
||||
|
Loading…
x
Reference in New Issue
Block a user