From 04d8264594f5738ad771acc79026a32debaf5086 Mon Sep 17 00:00:00 2001 From: lia Date: Wed, 18 Apr 2007 21:41:58 +0000 Subject: [PATCH] content: ideas 1228 : added option to use all icons or just the 'tmp' icons (for both icons and attachments). Useful if you want to reuse the same icons and attachments in multiple content items --- e107_plugins/content/content_shortcodes.php | 36 +++++++++++-------- .../content/handlers/content_class.php | 6 ++-- .../content/handlers/content_form_class.php | 32 ++++++++++++++--- .../languages/English/lan_content_admin.php | 6 ++-- 4 files changed, 56 insertions(+), 24 deletions(-) diff --git a/e107_plugins/content/content_shortcodes.php b/e107_plugins/content/content_shortcodes.php index 9bcab1e15..4ffa4cbe5 100644 --- a/e107_plugins/content/content_shortcodes.php +++ b/e107_plugins/content/content_shortcodes.php @@ -1485,31 +1485,37 @@ if($show['enddate']===true){ SC_END SC_BEGIN CONTENTFORM_UPLOAD -global $row, $rs, $show, $checkicon, $checkattach, $checkimages, $content_tmppath_icon, $content_tmppath_file, $content_tmppath_image; +global $row, $rs, $show, $content_pref; if($show['upload']===true){ $text = ""; if(!FILE_UPLOADS){ $text .= "".CONTENT_ADMIN_ITEM_LAN_21.""; }else{ - if(!is_writable($content_tmppath_icon)){ - $text .= "".CONTENT_ADMIN_ITEM_LAN_22." ".$content_tmppath_icon." ".CONTENT_ADMIN_ITEM_LAN_23."
"; + if($show['icon']===true){ + if(!is_writable($content_pref['content_icon_path_tmp'])){ + $text .= "".CONTENT_ADMIN_ITEM_LAN_22." ".$content_pref['content_icon_path_tmp']." ".CONTENT_ADMIN_ITEM_LAN_23."
"; + } } - if(!is_writable($content_tmppath_file)){ - $text .= "".CONTENT_ADMIN_ITEM_LAN_22." ".$content_tmppath_file." ".CONTENT_ADMIN_ITEM_LAN_23."
"; + if($show['attach']===true){ + if(!is_writable($content_pref['content_file_path_tmp'])){ + $text .= "".CONTENT_ADMIN_ITEM_LAN_22." ".$content_pref['content_file_path_tmp']." ".CONTENT_ADMIN_ITEM_LAN_23."
"; + } } - if(!is_writable($content_tmppath_image)){ - $text .= "".CONTENT_ADMIN_ITEM_LAN_22." ".$content_tmppath_image." ".CONTENT_ADMIN_ITEM_LAN_23."
"; + if($show['images']===true){ + if(!is_writable($content_pref['content_image_path_tmp'])){ + $text .= "".CONTENT_ADMIN_ITEM_LAN_22." ".$content_pref['content_image_path_tmp']." ".CONTENT_ADMIN_ITEM_LAN_23."
"; + } } $text .= "
".$rs -> form_select_open("uploadtype")." - ".($checkicon ? $rs -> form_option(CONTENT_ADMIN_ITEM_LAN_114, "0", "1") : '')." - ".($checkattach ? $rs -> form_option(CONTENT_ADMIN_ITEM_LAN_115, "0", "2") : '')." - ".($checkimages ? $rs -> form_option(CONTENT_ADMIN_ITEM_LAN_116, "0", "3") : '')." + ".($show['icon'] ? $rs -> form_option(CONTENT_ADMIN_ITEM_LAN_114, "0", "1") : '')." + ".($show['attach'] ? $rs -> form_option(CONTENT_ADMIN_ITEM_LAN_115, "0", "2") : '')." + ".($show['images'] ? $rs -> form_option(CONTENT_ADMIN_ITEM_LAN_116, "0", "3") : '')." ".$rs -> form_select_close()." - - - + ".($show['icon'] ? "" : '')." + ".($show['attach'] ? "" : '')." + ".($show['images'] ? "" : '')." "; } $text .= "
"; @@ -1528,9 +1534,9 @@ if($show['icon']===true){ }else{ foreach($iconlist as $icon){ if(file_exists($icon['path']."thumb_".$icon['fname'])){ - $img = ""; + $img = ""; }else{ - $img = ""; + $img = ""; } $text .= "".$img." "; } diff --git a/e107_plugins/content/handlers/content_class.php b/e107_plugins/content/handlers/content_class.php index 1f0869660..5fe1aa5c0 100644 --- a/e107_plugins/content/handlers/content_class.php +++ b/e107_plugins/content/handlers/content_class.php @@ -12,8 +12,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/content/handlers/content_class.php,v $ -| $Revision: 1.21 $ -| $Date: 2007-04-18 20:46:04 $ +| $Revision: 1.22 $ +| $Date: 2007-04-18 21:41:58 $ | $Author: lisa_ $ +---------------------------------------------------------------+ */ @@ -54,6 +54,8 @@ class content{ $cp['content_admin_layout'] = ''; //should the option for choosing a layout template be shown $cp['content_admin_customtags'] = ''; //should options for adding additional data be shown $cp['content_admin_presettags'] = ''; //should preset data tags be shown + $cp['content_admin_loadicons'] = 0; //load all icons, or only the 'tmp' icons, when assigning an icon + $cp['content_admin_loadattach'] = 0; //load all attachments, or only the 'tmp' attachments, when assigning an attachment //ADMIN CREATE CATEGORY FORM $cp['content_admincat_subheading'] = '1'; //should subheading be available diff --git a/e107_plugins/content/handlers/content_form_class.php b/e107_plugins/content/handlers/content_form_class.php index 00e0f0f6e..57ce97e42 100644 --- a/e107_plugins/content/handlers/content_form_class.php +++ b/e107_plugins/content/handlers/content_form_class.php @@ -12,8 +12,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/content/handlers/content_form_class.php,v $ -| $Revision: 1.16 $ -| $Date: 2007-04-18 21:13:23 $ +| $Revision: 1.17 $ +| $Date: 2007-04-18 21:41:58 $ | $Author: lisa_ $ +---------------------------------------------------------------+ */ @@ -213,7 +213,7 @@ class contentform{ } function show_create_content($mode, $userid="", $username=""){ - global $qs, $sql, $ns, $rs, $aa, $fl, $tp, $content_shortcodes, $content_pref, $plugintable, $plugindir, $pref, $eArrayStorage, $message, $row, $show, $content_author_name_value, $content_author_name_js, $content_author_email_value, $content_author_email_js, $content_author_id, $months, $ne_day, $ne_month, $ne_year, $current_year, $end_day, $end_month, $end_year, $checkicon, $checkattach, $checkimages, $content_tmppath_icon, $content_tmppath_file, $content_tmppath_image, $iconlist, $checkattachnumber, $filelist, $checkimagesnumber, $imagelist, $CONTENTFORM_CATEGORY, $CONTENTFORM_CUSTOM, $CONTENTFORM_CUSTOM_KEY, $CONTENTFORM_CUSTOM_VALUE, $CONTENT_ADMIN_CONTENT_CREATE_CUSTOMSTART, $CONTENT_ADMIN_CONTENT_CREATE_CUSTOMTABLE, $CONTENT_ADMIN_CONTENT_CREATE_CUSTOMEND, $CONTENTFORM_PRESET, $CONTENT_ADMIN_CONTENT_CREATE, $CONTENT_ADMIN_BUTTON; + global $qs, $sql, $ns, $rs, $aa, $fl, $tp, $content_shortcodes, $content_pref, $plugintable, $plugindir, $pref, $eArrayStorage, $message, $row, $show, $content_author_name_value, $content_author_name_js, $content_author_email_value, $content_author_email_js, $content_author_id, $months, $ne_day, $ne_month, $ne_year, $current_year, $end_day, $end_month, $end_year, $content_tmppath_icon, $content_tmppath_file, $content_tmppath_image, $iconlist, $checkattachnumber, $filelist, $checkimagesnumber, $imagelist, $CONTENTFORM_CATEGORY, $CONTENTFORM_CUSTOM, $CONTENTFORM_CUSTOM_KEY, $CONTENTFORM_CUSTOM_VALUE, $CONTENT_ADMIN_CONTENT_CREATE_CUSTOMSTART, $CONTENT_ADMIN_CONTENT_CREATE_CUSTOMTABLE, $CONTENT_ADMIN_CONTENT_CREATE_CUSTOMEND, $CONTENTFORM_PRESET, $CONTENT_ADMIN_CONTENT_CREATE, $CONTENT_ADMIN_BUTTON; $months = array(CONTENT_ADMIN_DATE_LAN_0, CONTENT_ADMIN_DATE_LAN_1, CONTENT_ADMIN_DATE_LAN_2, CONTENT_ADMIN_DATE_LAN_3, CONTENT_ADMIN_DATE_LAN_4, CONTENT_ADMIN_DATE_LAN_5, CONTENT_ADMIN_DATE_LAN_6, CONTENT_ADMIN_DATE_LAN_7, CONTENT_ADMIN_DATE_LAN_8, CONTENT_ADMIN_DATE_LAN_9, CONTENT_ADMIN_DATE_LAN_10, CONTENT_ADMIN_DATE_LAN_11); @@ -610,14 +610,22 @@ class contentform{ $show['upload'] = false; } if($checkicon){ - $iconlist = $fl->get_files($content_pref['content_icon_path_tmp'],"",$rejectlist); + $list1 = $fl->get_files($content_pref['content_icon_path_tmp'],"",$rejectlist); + if(varsettrue($content_pref['content_admin_loadicons'])){ + $list2 = $fl->get_files($content_pref['content_icon_path'],"",$rejectlist); + } + $iconlist = ($list2) ? array_merge($list1, $list2) : $list1; $show['icon'] = true; }else{ $show['icon'] = false; $hidden .= $rs -> form_hidden("content_icon", $row['content_icon']); } if($checkattach){ - $filelist = $fl->get_files($content_pref['content_file_path_tmp'],"",$rejectlist); + $list1 = $fl->get_files($content_pref['content_file_path_tmp'],"",$rejectlist); + if(varsettrue($content_pref['content_admin_loadattach'])){ + $list2 = $fl->get_files($content_pref['content_file_path'],"",$rejectlist); + } + $filelist = ($list2) ? array_merge($list1, $list2) : $list1; $show['attach'] = true; }else{ $show['attach'] = false; @@ -1860,6 +1868,20 @@ class contentform{ $TOPIC_FIELD .= $rs -> form_select_close(); $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND); + //content_admin_loadicons + $TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_176; + $TOPIC_FIELD = " + ".$rs -> form_radio("content_admin_loadicons", "1", ($content_pref['content_admin_loadicons'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30." + ".$rs -> form_radio("content_admin_loadicons", "0", ($content_pref['content_admin_loadicons'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31; + $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND); + + //content_admin_loadattach + $TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_177; + $TOPIC_FIELD = " + ".$rs -> form_radio("content_admin_loadattach", "1", ($content_pref['content_admin_loadattach'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30." + ".$rs -> form_radio("content_admin_loadattach", "0", ($content_pref['content_admin_loadattach'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31; + $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND); + //content_admin_custom_preset_ $TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_6; $TOPIC_HEADING = CONTENT_ADMIN_OPT_LAN_7; diff --git a/e107_plugins/content/languages/English/lan_content_admin.php b/e107_plugins/content/languages/English/lan_content_admin.php index b17044f43..e9beb0c33 100644 --- a/e107_plugins/content/languages/English/lan_content_admin.php +++ b/e107_plugins/content/languages/English/lan_content_admin.php @@ -4,8 +4,8 @@ | e107 website system - Language File. | | $Source: /cvs_backup/e107_0.8/e107_plugins/content/languages/English/lan_content_admin.php,v $ -| $Revision: 1.10 $ -| $Date: 2007-04-10 14:34:39 $ +| $Revision: 1.11 $ +| $Date: 2007-04-18 21:41:58 $ | $Author: lisa_ $ +----------------------------------------------------------------------------+ */ @@ -691,4 +691,6 @@ define("CONTENT_ADMIN_OPT_LAN_172", "numeric value to show that amount of levels define("CONTENT_ADMIN_OPT_LAN_173", "include 'home' in the breadcrumb"); define("CONTENT_ADMIN_OPT_LAN_174", "include the content start page in the breadcrumb"); define("CONTENT_ADMIN_OPT_LAN_175", "show menu only on content pages of this top level category?"); +define("CONTENT_ADMIN_OPT_LAN_176", "when assigning an icons, load all icons ? (default is disabled = only load tmp icons) useful if you want to reuse the same icons"); +define("CONTENT_ADMIN_OPT_LAN_177", "when assigning an attachment, load all ? (default is disabled = only load tmp attachments) useful if you want to reuse the same attachments"); ?> \ No newline at end of file