1
0
mirror of https://github.com/e107inc/e107.git synced 2025-06-07 19:35:47 +02:00

Clicking on image will paste bbcoce into 'target', also added code to convert [[ and ]] to { and } in sortcode parms

This commit is contained in:
mcfly 2008-02-19 19:33:45 +00:00
parent a421a18142
commit 9713a948ca
3 changed files with 76 additions and 58 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.10 $ | $Revision: 1.11 $
| $Date: 2007-10-26 21:51:05 $ | $Date: 2008-02-19 19:33:45 $
| $Author: e107steved $ | $Author: mcfly_e107 $
+---------------------------------------------------------------+ +---------------------------------------------------------------+
*/ */
@ -553,6 +553,9 @@ class newspost
$parms .= "&height=100px"; $parms .= "&height=100px";
$parms .= "&multiple=TRUE"; $parms .= "&multiple=TRUE";
$parms .= "&label=-- ".LAN_NEWS_48." --"; $parms .= "&label=-- ".LAN_NEWS_48." --";
$parms .= "&click_target=data";
$parms .= "&click_prefix=[img][[e_IMAGE]]newspost_images/";
$parms .= "&click_postfix=[/img]";
$text .= $tp->parseTemplate("{IMAGESELECTOR={$parms}}"); $text .= $tp->parseTemplate("{IMAGESELECTOR={$parms}}");

View File

@ -1,47 +1,48 @@
// $Id: imageselector.sc,v 1.4 2008-01-16 10:52:33 e107coders Exp $ // $Id: imageselector.sc,v 1.5 2008-02-19 19:33:45 mcfly_e107 Exp $
global $sql,$parm,$tp; 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 else
{ // comma separated parms. { // comma separated parms.
list($name,$path,$default,$width,$height,$multiple,$label,$subdirs,$filter,$fullpath) = explode(",",$parm); list($name,$path,$default,$width,$height,$multiple,$label,$subdirs,$filter,$fullpath,$click_target,$click_prefix,$click_postfix) = 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();
foreach($paths as $path) foreach($paths as $path)
{ {
$imagelist += $fl->get_files($path,".jpg|.gif|.png|.JPG|.GIF|.PNG", 'standard', $recurse); $imagelist += $fl->get_files($path,".jpg|.gif|.png|.JPG|.GIF|.PNG", 'standard', $recurse);
} }
if($imagelist) if($imagelist)
{ {
sort($imagelist); sort($imagelist);
} }
if(!$fullpath && (count($paths) > 1)) if(!$fullpath && (count($paths) > 1))
{ {
$fullpath = TRUE; $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=\"replaceSC('$name',this.form,'{$name}_prev');\"> $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']);
if(!$filter || ($filter && ereg($filter,$dir.$icon['fname']))) if(!$filter || ($filter && ereg($filter,$dir.$icon['fname'])))
@ -50,15 +51,28 @@ global $sql,$parm,$tp;
$selected = ($default == $pth.$icon['fname']) ? " selected='selected'" : ""; $selected = ($default == $pth.$icon['fname']) ? " selected='selected'" : "";
$text .= "<option value='".$pth.$icon['fname']."'".$selected.">".$dir.$icon['fname']."</option>\n"; $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";
if($default[0]=="{") if($default[0]=="{")
{ {
$pvw_default = $tp->replaceConstants($default); $pvw_default = $tp->replaceConstants($default);
} }
$text .= "&nbsp;<span id='{$name}_prev'><img src='{$pvw_default}' alt='' style='width:{$width};height:{$height}' /></span>\n";
if(varset($click_target))
{
$pre = varset($click_prefix);
$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";
if(varset($click_target))
{
$text .= "</a>";
}
//$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

@ -12,8 +12,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_handlers/shortcode_handler.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/shortcode_handler.php,v $
| $Revision: 1.10 $ | $Revision: 1.11 $
| $Date: 2008-02-13 02:57:17 $ | $Date: 2008-02-19 19:33:45 $
| $Author: mcfly_e107 $ | $Author: mcfly_e107 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@ -116,6 +116,7 @@ class e_shortcode
$sc_mode = ''; $sc_mode = '';
} }
$parm = trim($parm); $parm = trim($parm);
$parm = str_replace(array('[[', ']]'), array('{', '}'), $parm);
if (E107_DBG_BBSC) if (E107_DBG_BBSC)
{ {