mirror of
https://github.com/e107inc/e107.git
synced 2025-08-19 21:02:09 +02:00
Updated {IMAGESELECTOR} to use ajax and replaceSC function. sitebutton shortcode added to work with it.
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
// $Id: imageselector.sc,v 1.3 2008-01-16 00:39:03 e107coders Exp $
|
||||
// $Id: imageselector.sc,v 1.4 2008-01-16 10:52:33 e107coders Exp $
|
||||
|
||||
global $sql,$parm;
|
||||
global $sql,$parm,$tp;
|
||||
|
||||
if(strstr($parm,"=")){ // query style parms.
|
||||
parse_str($parm, $tmp);
|
||||
extract($tmp);
|
||||
}else{ // comma separated parms.
|
||||
list($name,$path,$default,$width,$height,$multiple,$label,$subdirs,$filter) = explode(",",$parm);
|
||||
}
|
||||
else
|
||||
{ // comma separated parms.
|
||||
list($name,$path,$default,$width,$height,$multiple,$label,$subdirs,$filter,$fullpath) = explode(",",$parm);
|
||||
}
|
||||
|
||||
|
||||
require_once(e_HANDLER."file_class.php");
|
||||
$fl = new e_file;
|
||||
|
||||
$paths = explode("|",$path);
|
||||
$recurse = ($subdirs) ? $subdirs : 0;
|
||||
$imagelist = array();
|
||||
@@ -23,28 +25,40 @@ global $sql,$parm;
|
||||
|
||||
if($imagelist)
|
||||
{
|
||||
sort($imagelist);
|
||||
sort($imagelist);
|
||||
}
|
||||
|
||||
if(!$fullpath && (count($paths) > 1))
|
||||
{
|
||||
$fullpath = TRUE;
|
||||
}
|
||||
|
||||
$multi = ($multiple == "TRUE" || $multiple == "1") ? "multiple='multiple' style='height:{$height}'" : "style='float:left'";
|
||||
$width = ($width) ? $width : "*";
|
||||
$height = ($height) ? $height : "*";
|
||||
$label = ($label) ? $label : " -- -- ";
|
||||
|
||||
$text .= "<select {$multi} class='tbox' name='$name' id='$name' onchange=\"preview_image('$name','$path','".e_IMAGE_ABS."generic/blank.gif');\">
|
||||
$text .= "<select {$multi} class='tbox' name='$name' id='$name' onchange=\"replaceSC('$name',this.form,'{$name}_prev');\">
|
||||
<option value=''>".$label."</option>\n";
|
||||
foreach($imagelist as $icon)
|
||||
{
|
||||
$dir = str_replace($paths,"",$icon['path']);
|
||||
$selected = ($default == $dir.$icon['fname']) ? " selected='selected'" : "";
|
||||
if(!$filter || ($filter && ereg($filter,$dir.$icon['fname'])))
|
||||
{
|
||||
$text .= "<option value='".$dir.$icon['fname']."'".$selected.">".$dir.$icon['fname']."</option>\n";
|
||||
|
||||
if(!$filter || ($filter && ereg($filter,$dir.$icon['fname'])))
|
||||
{
|
||||
$pth = ($fullpath) ? $tp->createConstants($icon['path'],1) : $dir;
|
||||
$selected = ($default == $pth.$icon['fname']) ? " selected='selected'" : "";
|
||||
$text .= "<option value='".$pth.$icon['fname']."'".$selected.">".$dir.$icon['fname']."</option>\n";
|
||||
}
|
||||
}
|
||||
$text .= "</select>";
|
||||
|
||||
$pvw_default = ($default) ? $path.$default : e_IMAGE_ABS."generic/blank.gif";
|
||||
$text .= " <img id='{$name}_prev' src='{$pvw_default}' alt='' style='width:{$width};height:{$height}' />\n";
|
||||
if($default[0]=="{")
|
||||
{
|
||||
$pvw_default = $tp->replaceConstants($default);
|
||||
}
|
||||
$text .= " <span id='{$name}_prev'><img src='{$pvw_default}' alt='' style='width:{$width};height:{$height}' /></span>\n";
|
||||
|
||||
|
||||
return "\n\n<!-- Start Image Selector -->\n\n".$text."\n\n<!-- End Image Selector -->\n\n";
|
3
e107_files/shortcode/sitebutton.sc
Normal file
3
e107_files/shortcode/sitebutton.sc
Normal file
@@ -0,0 +1,3 @@
|
||||
global $tp;
|
||||
$path = ($_POST['sitebutton'] && $_POST['ajax_used']) ? $tp->replaceConstants($_POST['sitebutton']) : (strstr(SITEBUTTON, "http:") ? SITEBUTTON : e_IMAGE.SITEBUTTON);
|
||||
return "<a href='".SITEURL."'><img src='".$path."' alt=\"".SITENAME."\" style='border: 0px; width: 88px; height: 31px' /></a>";
|
Reference in New Issue
Block a user