From 9713a948cada3adc332f5f8aa5abfc34f6ff08f6 Mon Sep 17 00:00:00 2001 From: mcfly Date: Tue, 19 Feb 2008 19:33:45 +0000 Subject: [PATCH] Clicking on image will paste bbcoce into 'target', also added code to convert [[ and ]] to { and } in sortcode parms --- e107_admin/newspost.php | 13 +-- e107_files/shortcode/imageselector.sc | 116 +++++++++++++++----------- e107_handlers/shortcode_handler.php | 5 +- 3 files changed, 76 insertions(+), 58 deletions(-) diff --git a/e107_admin/newspost.php b/e107_admin/newspost.php index 8277228d6..d9898c5ce 100644 --- a/e107_admin/newspost.php +++ b/e107_admin/newspost.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $ -| $Revision: 1.10 $ -| $Date: 2007-10-26 21:51:05 $ -| $Author: e107steved $ +| $Revision: 1.11 $ +| $Date: 2008-02-19 19:33:45 $ +| $Author: mcfly_e107 $ +---------------------------------------------------------------+ */ @@ -546,15 +546,18 @@ class newspost ".LAN_NEWS_23."

"; - $parms = "name=news_thumbnail"; + $parms = "name=news_thumbnail"; $parms .= "&path=".e_IMAGE."newspost_images/"; $parms .= "&default=".$_POST['news_thumbnail']; $parms .= "&width=100px"; $parms .= "&height=100px"; $parms .= "&multiple=TRUE"; $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}}"); $text .= "
diff --git a/e107_files/shortcode/imageselector.sc b/e107_files/shortcode/imageselector.sc index 81d2c4c23..e167c64e0 100644 --- a/e107_files/shortcode/imageselector.sc +++ b/e107_files/shortcode/imageselector.sc @@ -1,64 +1,78 @@ -// $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; - 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,$fullpath) = explode(",",$parm); - } +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,$fullpath,$click_target,$click_prefix,$click_postfix) = explode(",",$parm); +} - require_once(e_HANDLER."file_class.php"); - $fl = new e_file; +require_once(e_HANDLER."file_class.php"); +$fl = new e_file; - $paths = explode("|",$path); - $recurse = ($subdirs) ? $subdirs : 0; - $imagelist = array(); +$paths = explode("|",$path); +$recurse = ($subdirs) ? $subdirs : 0; +$imagelist = array(); - foreach($paths as $path) +foreach($paths as $path) +{ + $imagelist += $fl->get_files($path,".jpg|.gif|.png|.JPG|.GIF|.PNG", 'standard', $recurse); +} + +if($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 .= ""; - if(!$fullpath && (count($paths) > 1)) - { - $fullpath = TRUE; - } +$pvw_default = ($default) ? $path.$default : e_IMAGE_ABS."generic/blank.gif"; +if($default[0]=="{") +{ + $pvw_default = $tp->replaceConstants($default); +} - $multi = ($multiple == "TRUE" || $multiple == "1") ? "multiple='multiple' style='height:{$height}'" : "style='float:left'"; - $width = ($width) ? $width : "*"; - $height = ($height) ? $height : "*"; - $label = ($label) ? $label : " -- -- "; +if(varset($click_target)) +{ + $pre = varset($click_prefix); + $post = varset($click_postfix); + $text .= ""; +} +$text .= " \n"; +if(varset($click_target)) +{ + $text .= ""; +} - $text .= ""; - - $pvw_default = ($default) ? $path.$default : e_IMAGE_ABS."generic/blank.gif"; - if($default[0]=="{") - { - $pvw_default = $tp->replaceConstants($default); - } - $text .= " \n"; +//$text .= " \n"; - return "\n\n\n\n".$text."\n\n\n\n"; \ No newline at end of file +return "\n\n\n\n".$text."\n\n\n\n"; \ No newline at end of file diff --git a/e107_handlers/shortcode_handler.php b/e107_handlers/shortcode_handler.php index 192b2dafe..05a5d8416 100644 --- a/e107_handlers/shortcode_handler.php +++ b/e107_handlers/shortcode_handler.php @@ -12,8 +12,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/shortcode_handler.php,v $ -| $Revision: 1.10 $ -| $Date: 2008-02-13 02:57:17 $ +| $Revision: 1.11 $ +| $Date: 2008-02-19 19:33:45 $ | $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ @@ -116,6 +116,7 @@ class e_shortcode $sc_mode = ''; } $parm = trim($parm); + $parm = str_replace(array('[[', ']]'), array('{', '}'), $parm); if (E107_DBG_BBSC) {