Index: /trunk/xpressme_integration_kit/blocks/block_common.php
===================================================================
--- /trunk/xpressme_integration_kit/blocks/block_common.php	(revision 434)
+++ /trunk/xpressme_integration_kit/blocks/block_common.php	(revision 435)
@@ -69,5 +69,81 @@
 endif;
 
+if(!function_exists("categorie_select")):
+function categorie_select($option_name = '',$value='',$row_num=0 ,$sort_column = 'ID', $sort_order = 'asc')
+{
+    $mydirpath = dirname(dirname(__FILE__));
+	$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
+	if ($mydirname == 'wordpress'){
+		$wp_prefix = 'wp_';
+	} else {
+		$wp_prefix = $mydirname . '_';
+	}
+	$xoopsDB =& Database::getInstance();
+	$myts =& MyTextSanitizer::getInstance();
+    $selected = explode(',' , $value);
+	$isAll = (count($selected)==0||empty($selected[0]))?true:false;
+    $sort_column = 'cat_'.$sort_column;
+    if (empty($row_num)) $size = ''; else $size = 'size="' . $row_num . '"';
+	include $mydirpath.'/wp-includes/version.php';
+	if ($wp_db_version < 6124) {
+		$db_xpress_categories = $xoopsDB->prefix($wp_prefix . 'categories');
+		$query = "
+	    	SELECT cat_ID, cat_name, category_nicename,category_parent 
+	    	FROM $db_xpress_categories 
+	    	WHERE cat_ID > 0 
+	        ";
+		$query .= " ORDER BY $sort_column $sort_order";
 
+    } else {
+    	$db_xpress_terms = $xoopsDB->prefix($wp_prefix . 'terms');
+    	$db_xpress_term_taxonomy = $xoopsDB->prefix($wp_prefix . 'term_taxonomy');
+    	$query = "
+			SELECT $db_xpress_terms.term_id as cat_ID , $db_xpress_terms.name as cat_name , $db_xpress_term_taxonomy.taxonomy 
+			FROM $db_xpress_terms LEFT JOIN $db_xpress_term_taxonomy ON $db_xpress_terms.term_id = $db_xpress_term_taxonomy.term_id 
+			WHERE $db_xpress_term_taxonomy.taxonomy = 'category' 
+        ";
+		$query .= " ORDER BY $sort_column $sort_order";
+    }
+	$res =  $xoopsDB->query($query, 0, 0);
+	$option = "\t<option value=\"0\" ";
+	if ($isAll) $option .= " selected=\"selected\"";
+	$option .= ">"._MB_XP2_ALL ."</option>\n";
+
+    if ($res !== false){
+ 		while($row = $xoopsDB->fetchArray($res)){
+            $cat_name = $row['cat_name'];
+            $cat_ID = $row['cat_ID'];
+            $option .= "\t<option value=\"".$cat_ID."\"";
+            if (in_array($cat_ID, $selected))
+                $option .= ' selected="selected"';
+            $option .= '>';
+            $option .= $myts->htmlspecialchars($cat_name);
+            $option .= "</option>\n";
+        }
+    }
+    $output = _MB_XP2_CATS_SELECT ."<br />\n";
+    $output .= 	"<input type='hidden' name='$option_name' value='$value' />\n";
+    $output .= '&nbsp;&nbsp;<select name="categorie" '.$size.' multiple="multiple" onclick="CatSelect()">' ."\n";
+    $output .= $option;
+    $output .= '</select><br />';
+    $output .= '
+<script type="text/javascript">
+    function CatSelect(){
+        var idx=new Array();
+        var sel=document.forms["blockform"].elements["categorie"].options;
+        for(var i=0, n=0; i<sel.length; i++){
+            if(sel[i].selected){ idx[n++]=sel[i].value; }
+        }
+        if(idx.length>0){
+        	document.forms["blockform"].elements["' .$option_name . '"].value = idx;
+		}
+    }
+</script>
+';
+    
+    return $output;
+
+}
+endif;
 
 ?>
Index: /trunk/xpressme_integration_kit/blocks/popular_posts_block.php
===================================================================
--- /trunk/xpressme_integration_kit/blocks/popular_posts_block.php	(revision 434)
+++ /trunk/xpressme_integration_kit/blocks/popular_posts_block.php	(revision 435)
@@ -23,5 +23,5 @@
 		$time_format = empty( $options[5] ) ? '' : $options[5] ;
 		$tag_select = $options[6] ;
-		$selected = array_slice($options, 7); // get allowed cats
+		$cat_select = empty( $options[7] ) ? '0' : $options[7] ;
 
 		$mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
@@ -44,17 +44,5 @@
 		}
 
-	    $form .= _MB_XP2_CATS_SELECT ."<br />\n";
-	    $isAll = (count($selected)==0||empty($selected[0]))?true:false;
-	    $form .= "&nbsp;&nbsp;<select name=\"options[]\" multiple=\"multiple\">";
-	    $form .= "<option value=\"0\" ";
-	    if ($isAll) $form .= " selected=\"selected\"";
-	    $form .= ">"._MB_XP2_ALL ."</option>";
-		ob_start();
-		dropdown_cats_options('ID','asc',$selected);
-		$list_str = ob_get_contents();
-		ob_end_clean();
-	    $form .= $list_str. "</select><br />";
-//	    $form .="<br /><input type='text' size='60' name='options[5]' value='".htmlspecialchars($this_template,ENT_QUOTES)."' />";
-
+		$form .= categorie_select('options[7]' , $cat_select);
 		return $form;
 	}
Index: /trunk/xpressme_integration_kit/blocks/recent_posts_content_block.php
===================================================================
--- /trunk/xpressme_integration_kit/blocks/recent_posts_content_block.php	(revision 434)
+++ /trunk/xpressme_integration_kit/blocks/recent_posts_content_block.php	(revision 435)
@@ -19,13 +19,13 @@
 		$mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
 		$this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_recent_posts_content_block.html' : trim( $options[1] );
-		$day_select = ($options[2])?intval($options[2]):0;
-		$day_size = ($options[3])?intval($options[3]):0;
-		$disp_count =  ($options[4])?intval($options[4]):10;
-		$excerpt = empty( $options[5] ) ? false : true ;
-		$excerpt_size =  ($options[6])?intval($options[6]):100;
-		$date_format = empty( $options[7] ) ? '' : $options[7] ;
-		$time_format = empty( $options[8] ) ? '' : $options[8] ;
-		$tag_select = $options[9] ;
-	    $selected = array_slice($options,10); // get allowed cats
+		$disp_count =  ($options[2])?intval($options[2]):10;
+		$excerpt = empty( $options[3] ) ? false : true ;
+		$excerpt_size =  ($options[4])?intval($options[4]):100;
+		$date_format = empty( $options[5] ) ? '' : $options[5] ;
+		$time_format = empty( $options[6] ) ? '' : $options[6] ;
+		$tag_select = $options[7] ;
+		$cat_select = empty( $options[8] ) ? '0' : $options[8] ;
+		$day_select = ($options[9])?intval($options[9]):0;
+		$day_size = ($options[10])?intval($options[10]):0;
 
 		$mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
@@ -35,6 +35,22 @@
 		$form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />\n";
 	    $form .= "<input type='hidden' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";
-		$form .= "<br />";
-		$form .= _MB_XP2_DAY_SELECT . ':' . _MB_XP2_DAY_BETWEEN . '<select name="options[2]">';
+		$form .= _MB_XP2_COUNT .": <input type='text' name='options[2]' value='" . $disp_count . "' /><br />\n";
+		$form .= yes_no_radio_option('options[3]', _MB_XP2_P_EXCERPT , $excerpt) . "<br />\n";
+		$form .= _MB_XP2_P_EXCERPT_SIZE .": <input type='text' name='options[4]' value='" . $excerpt_size . "' /><br />\n";
+		$form .= _MB_XP2_DATE_FORMAT .": <input type='text' name='options[5]' value='" . $date_format . "' /><br />\n";
+		$form .= _MB_XP2_TIME_FORMAT .": <input type='text' name='options[6]' value='" . $time_format . "' /><br />\n";
+		
+		include $mydirpath .'/wp-includes/version.php' ;
+		if (wp_version_compare($wp_version, '>=','2.3')){
+			$form .= "<br />\n";
+			$form .= _MB_XP2_TAGS_SELECT .": <input type='text' name='options[7]' value='" . $tag_select . "' /><br />\n";
+		} else {
+			$form .= "<input type='hidden' name='options[7]' value='' /><br />\n";
+		}
+		
+	    $form .= categorie_select('options[8]' , $cat_select);
+	    
+	    $form .= "<br />";
+		$form .= _MB_XP2_DAY_SELECT . ':' . _MB_XP2_DAY_BETWEEN . '<select name="options[9]">';
 		switch ($day_select){
 		case 1:
@@ -55,33 +71,5 @@
 		$form .= '</select>';
 		
-		$form .= ' ' . _MB_XP2_DAYS_AND . " <input type='text' size='2' name='options[3]' value='" . $day_size . "' />" . _MB_XP2_DAYS_AGO . "<br />\n";
-
-		$form .= _MB_XP2_COUNT .": <input type='text' name='options[4]' value='" . $disp_count . "' /><br />\n";
-		$form .= yes_no_radio_option('options[5]', _MB_XP2_P_EXCERPT , $excerpt) . "<br />\n";
-		$form .= _MB_XP2_P_EXCERPT_SIZE .": <input type='text' name='options[6]' value='" . $excerpt_size . "' /><br />\n";
-		$form .= _MB_XP2_DATE_FORMAT .": <input type='text' name='options[7]' value='" . $date_format . "' /><br />\n";
-		$form .= _MB_XP2_TIME_FORMAT .": <input type='text' name='options[8]' value='" . $time_format . "' /><br />\n";
-		
-		include $mydirpath .'/wp-includes/version.php' ;
-		if (wp_version_compare($wp_version, '>=','2.3')){
-			$form .= "<br />\n";
-			$form .= _MB_XP2_TAGS_SELECT .": <input type='text' name='options[9]' value='" . $tag_select . "' /><br />\n";
-		} else {
-			$form .= "<input type='hidden' name='options[9]' value='' /><br />\n";
-		}
-		
-	    $form .= _MB_XP2_CATS_SELECT ."<br />\n";
-	    $isAll = (count($selected)==0||empty($selected[0]))?true:false;
-	    $form .= "&nbsp;&nbsp;<select name=\"options[]\" multiple=\"multiple\">\n";
-	    $form .= "\t<option value=\"0\" ";
-	    if ($isAll) $form .= " selected=\"selected\"";
-	    $form .= ">"._MB_XP2_ALL ."</option>\n";
-		ob_start();
-		dropdown_cats_options('ID','asc',$selected);
-		$list_str = ob_get_contents();
-		ob_end_clean();
-	    $form .= $list_str. "</select><br />\n";
-	    
-//	    $form .="<br /><input type='text' size='60' name='options[11]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' />";
+		$form .= ' ' . _MB_XP2_DAYS_AND . " <input type='text' size='2' name='options[10]' value='" . $day_size . "' />" . _MB_XP2_DAYS_AGO . "<br />\n";
 
 		return $form;
Index: /trunk/xpressme_integration_kit/blocks/recent_posts_list_block.php
===================================================================
--- /trunk/xpressme_integration_kit/blocks/recent_posts_list_block.php	(revision 434)
+++ /trunk/xpressme_integration_kit/blocks/recent_posts_list_block.php	(revision 435)
@@ -24,5 +24,5 @@
 		$time_format = empty( $options[6] ) ? '' : $options[6] ;
 		$tag_select = $options[7] ;
-		$selected = array_slice($options,8); // get allowed cats
+		$cat_select = empty( $options[8] ) ? '0' : $options[8] ;
 
 		$mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
@@ -47,17 +47,5 @@
 		}
 
-	    $form .= _MB_XP2_CATS_SELECT ."<br />\n";
-	    $isAll = (count($selected)==0||empty($selected[0]))?true:false;
-	    $form .= "&nbsp;&nbsp;<select name=\"options[]\" multiple=\"multiple\">\n";
-	    $form .= "\t<option value=\"0\" ";
-	    if ($isAll) $form .= " selected=\"selected\"";
-	    $form .= ">"._MB_XP2_ALL ."</option>\n";
-		ob_start();
-		dropdown_cats_options('ID','asc',$selected);
-		$list_str = ob_get_contents();
-		ob_end_clean();
-	    $form .= $list_str. "</select><br />\n";
-	    
-//	    $form .="<br /><input type='text' size='60' name='options[5]' value='".htmlspecialchars($this_template,ENT_QUOTES)."' />";
+	    $form .= categorie_select('options[8]' , $cat_select);
 
 		return $form;
Index: /trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/popular_posts_block_theme.php
===================================================================
--- /trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/popular_posts_block_theme.php	(revision 434)
+++ /trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/popular_posts_block_theme.php	(revision 435)
@@ -9,5 +9,7 @@
 	$time_format = empty( $options[5] ) ? '' : $options[5] ;
 	$tag_select = $options[6] ;
-	$selected = array_slice($options, 7); // get allowed cats
+	$cat_select = empty( $options[7] ) ? '0' : $options[7] ;
+	
+	$selected = explode(',' , $cat_select);
 
 	$mydirpath = get_xpress_dir_path();
@@ -15,10 +17,7 @@
 	if (empty($date_format)) $date_format = get_settings('date_format');
 	if (empty($time_format)) $time_format = get_settings('time_format');
-	if (array_search(0,$selected)===0) {
-		$cat_select = false;
-	}else {
-		$cat_select = true;			
-	}
-	$cat_id = implode(',',$selected);
+	if (array_search(0,$selected)===0) $cat_select = 0;
+	
+	$cat_select;
 	$block = array();
 	$item_no = 0;	
@@ -58,5 +57,5 @@
 
 	 	if ($cat_select) {
-	 		$where .= " AND ($term_taxonomy.term_id IN ($cat_id))";
+	 		$where .= " AND ($term_taxonomy.term_id IN ($cat_select))";
 		}
 		
@@ -75,5 +74,5 @@
 		
 	 	if ($cat_select) {
-	 		$where .= " AND ($post2cat_tb.category_id IN ($cat_id))";
+	 		$where .= " AND ($post2cat_tb.category_id IN ($cat_select))";
 		}
 	}
Index: /trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/recent_posts_content_block_theme.php
===================================================================
--- /trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/recent_posts_content_block_theme.php	(revision 434)
+++ /trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/recent_posts_content_block_theme.php	(revision 435)
@@ -6,14 +6,16 @@
 	$mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
 	$this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_recent_posts_content_block.html' : trim( $options[1] );
-	$day_select = ($options[2])?intval($options[2]):0;
-	$day_size = ($options[3])?intval($options[3]):0;
-	$disp_count =  ($options[4])?intval($options[4]):10;
-	$excerpt = empty( $options[5] ) ? false : true ;
-	$excerpt_size =  ($options[6])?intval($options[6]):100;
-	$date_format = empty( $options[7] ) ? '' : $options[7] ;
-	$time_format = empty( $options[8] ) ? '' : $options[8] ;
-	$tag_select = $options[9] ;
-    $selected = array_slice($options,10); // get allowed cats
-
+	$disp_count =  ($options[2])?intval($options[2]):10;
+	$excerpt = empty( $options[3] ) ? false : true ;
+	$excerpt_size =  ($options[4])?intval($options[4]):100;
+	$date_format = empty( $options[5] ) ? '' : $options[5] ;
+	$time_format = empty( $options[6] ) ? '' : $options[6] ;
+	$tag_select = $options[7] ;
+	$cat_select = empty( $options[8] ) ? '0' : $options[8] ;
+	$day_select = ($options[9])?intval($options[9]):0;
+	$day_size = ($options[10])?intval($options[10]):0;
+
+	$selected = explode(',' , $cat_select);
+	
 	$mydirpath = get_xpress_dir_path();
 	
@@ -21,5 +23,6 @@
 	if (empty($time_format)) $time_format = get_settings('time_format');
 	if(empty($tag_select)) $tag_where = ''; else $tag_where = "tag='$tag_select'&";
-	
+	if (array_search(0,$selected)===0) $cat_select = 0;
+
 	$selected_author_id = xpress_selected_author_id('echo=0');	
 	if (!empty($selected_author_id)){
@@ -37,9 +40,8 @@
 	if (!is_null($wpdb)){
 		$wp_query->in_the_loop = true;		//for use the_tags() in multi lopp 
-		if (array_search(0,$selected)===0) {
+		if ($cat_select) {
+			$r = new WP_Query($author_where . $tag_where ."cat=$cat_select&showposts=$disp_count&what_to_show=posts&nopaging=0&post_status=publish");
+		} else {
 			$r = new WP_Query($author_where . $tag_where ."showposts=$disp_count&what_to_show=posts&nopaging=0&post_status=publish");
-		} else {
-			$cat_id = implode(',',$selected);
-			$r = new WP_Query($author_where . $tag_where ."cat=$cat_id&showposts=$disp_count&what_to_show=posts&nopaging=0&post_status=publish");
 		}
 		while($r->have_posts()){			
Index: /trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/recent_posts_list_block_theme.php
===================================================================
--- /trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/recent_posts_list_block_theme.php	(revision 434)
+++ /trunk/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/recent_posts_list_block_theme.php	(revision 435)
@@ -10,5 +10,7 @@
 	$time_format = empty( $options[6] ) ? '' : $options[6] ;
 	$tag_select = $options[7] ;
-	$selected = array_slice($options,8); // get allowed cats
+	$cat_select = empty( $options[8] ) ? '0' : $options[8] ;
+	
+	$selected = explode(',' , $cat_select);
 
 	$mydirpath = get_xpress_dir_path();
@@ -17,4 +19,5 @@
 	if (empty($time_format)) $time_format = get_settings('time_format');
 	if(empty($tag_select)) $tag_where = ''; else $tag_where = "tag='$tag_select'&";
+	if (array_search(0,$selected)===0) $cat_select = 0;
 
 	$selected_author_id = xpress_selected_author_id('echo=0');	
@@ -30,10 +33,8 @@
 	if (!is_null($wpdb)){
 		$wp_query->in_the_loop = true;		//for use the_tags() in multi lopp 
-		if (array_search(0,$selected)===0) {
+		if ($cat_select) {
+			$r = new WP_Query($author_where . $tag_where . "cat=$cat_select&showposts=$disp_count&what_to_show=posts&nopaging=0&post_status=publish");
+		} else {
 			$r = new WP_Query($author_where . $tag_where ."showposts=$disp_count&what_to_show=posts&nopaging=0&post_status=publish");
-
-		} else {
-			$cat_id = implode(',',$selected);
-			$r = new WP_Query($author_where . $tag_where . "cat=$cat_id&showposts=$disp_count&what_to_show=posts&nopaging=0&post_status=publish");
 		}
 		while($r->have_posts()){			
Index: /trunk/xpressme_integration_kit/xoops_version.php
===================================================================
--- /trunk/xpressme_integration_kit/xoops_version.php	(revision 434)
+++ /trunk/xpressme_integration_kit/xoops_version.php	(revision 435)
@@ -144,5 +144,5 @@
 	'edit_func' 	=> "b_". $mydirname . "_content_edit" ,
 	'template'		=> '' ,
-	'options'		=> $mydirname. '||0|0|10|0|100||||0' ,
+	'options'		=> $mydirname. '||10|0|100||||0|0|0' ,
 	'can_clone'		=> true ,
 	'func_num'		=> $b_no,
