1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-08 07:36:32 +02:00

Updated {IMAGESELECTOR} to use ajax and replaceSC function. sitebutton shortcode added to work with it.

This commit is contained in:
CaMer0n
2008-01-16 10:52:34 +00:00
parent 8e8e68ce67
commit b5de0e26d1
3 changed files with 51 additions and 22 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/prefs.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/prefs.php,v $
| $Revision: 1.10 $ | $Revision: 1.11 $
| $Date: 2008-01-13 10:51:34 $ | $Date: 2008-01-16 10:52:30 $
| $Author: e107steved $ | $Author: e107coders $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
require_once("../class2.php"); require_once("../class2.php");
@@ -85,12 +85,14 @@ if (isset($_POST['updateprefs']))
} }
} }
$e107cache->clear('',TRUE);
$e107cache->clear(); $saved = save_prefs();
save_prefs();
$sql -> db_Select_gen("TRUNCATE ".MPREFIX."online"); $sql -> db_Select_gen("TRUNCATE ".MPREFIX."online");
if($saved)
{
header("location:".e_ADMIN."prefs.php?u"); header("location:".e_ADMIN."prefs.php?u");
exit; exit;
}
} }
if($sql->db_Select("plugin", "plugin_path", "plugin_installflag='1' AND plugin_path = 'alt_auth'")) if($sql->db_Select("plugin", "plugin_path", "plugin_installflag='1' AND plugin_path = 'alt_auth'"))
@@ -192,8 +194,18 @@ $text = "<script type=\"text/javascript\">
<td class='forumheader3'>".PRFLAN_4."</td> <td class='forumheader3'>".PRFLAN_4."</td>
<td style='text-align:right' class='forumheader3'>"; <td style='text-align:right' class='forumheader3'>";
$param = "sitebutton,".e_IMAGE.",".SITEBUTTON.",81px,30px,"; $parms = "name=sitebutton";
$text .= $tp->parseTemplate("{IMAGESELECTOR={$param}}"); $parms .= "&path=".e_THEME.$pref['sitetheme']."/images/|".e_IMAGE;
$parms .= "&filter=0";
$parms .= "&fullpath=1";
$parms .= "&default=".urlencode($pref['sitebutton']);
$parms .= "&width=81px";
$parms .= "&height=30px";
$parms .= "&multiple=FALSE";
$parms .= "&label=-- No Image --";
$parms .= "&subdirs=1";
$text .= $tp->parseTemplate("{IMAGESELECTOR={$parms}}");
$text .= " $text .= "
</td> </td>

View File

@@ -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. if(strstr($parm,"=")){ // query style parms.
parse_str($parm, $tmp); parse_str($parm, $tmp);
extract($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"); require_once(e_HANDLER."file_class.php");
$fl = new e_file; $fl = new e_file;
$paths = explode("|",$path); $paths = explode("|",$path);
$recurse = ($subdirs) ? $subdirs : 0; $recurse = ($subdirs) ? $subdirs : 0;
$imagelist = array(); $imagelist = array();
@@ -25,26 +27,38 @@ global $sql,$parm;
{ {
sort($imagelist); sort($imagelist);
} }
if(!$fullpath && (count($paths) > 1))
{
$fullpath = TRUE;
}
$multi = ($multiple == "TRUE" || $multiple == "1") ? "multiple='multiple' style='height:{$height}'" : "style='float:left'"; $multi = ($multiple == "TRUE" || $multiple == "1") ? "multiple='multiple' style='height:{$height}'" : "style='float:left'";
$width = ($width) ? $width : "*"; $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=\"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"; <option value=''>".$label."</option>\n";
foreach($imagelist as $icon) foreach($imagelist as $icon)
{ {
$dir = str_replace($paths,"",$icon['path']); $dir = str_replace($paths,"",$icon['path']);
$selected = ($default == $dir.$icon['fname']) ? " selected='selected'" : "";
if(!$filter || ($filter && ereg($filter,$dir.$icon['fname']))) if(!$filter || ($filter && ereg($filter,$dir.$icon['fname'])))
{ {
$text .= "<option value='".$dir.$icon['fname']."'".$selected.">".$dir.$icon['fname']."</option>\n"; $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>"; $text .= "</select>";
$pvw_default = ($default) ? $path.$default : e_IMAGE_ABS."generic/blank.gif"; $pvw_default = ($default) ? $path.$default : e_IMAGE_ABS."generic/blank.gif";
$text .= "&nbsp;<img id='{$name}_prev' src='{$pvw_default}' alt='' style='width:{$width};height:{$height}' />\n"; if($default[0]=="{")
{
$pvw_default = $tp->replaceConstants($default);
}
$text .= "&nbsp;<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"; return "\n\n<!-- Start Image Selector -->\n\n".$text."\n\n<!-- End Image Selector -->\n\n";

View 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>";