Index: trunk/xpressme_integration_kit/blocks/archives_block.php
===================================================================
--- trunk/xpressme_integration_kit/blocks/archives_block.php	(revision 483)
+++ trunk/xpressme_integration_kit/blocks/archives_block.php	(revision 484)
@@ -28,5 +28,5 @@
 
 		$form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />";
-	    $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";
+		$form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES));
 		$form .= "<br />";
 		$a_month = _MB_XP2_ARC_MONTH ;
Index: trunk/xpressme_integration_kit/blocks/authors_block.php
===================================================================
--- trunk/xpressme_integration_kit/blocks/authors_block.php	(revision 483)
+++ trunk/xpressme_integration_kit/blocks/authors_block.php	(revision 484)
@@ -28,5 +28,5 @@
 			
 		$form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />";
-	    $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";
+		$form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES));
 		$form .= "<br />";
 		$form .= yes_no_radio_option('options[2]', _MB_XP2_SHOW_NUM_OF_POST , $optioncount);
Index: trunk/xpressme_integration_kit/blocks/block_common.php
===================================================================
--- trunk/xpressme_integration_kit/blocks/block_common.php	(revision 483)
+++ trunk/xpressme_integration_kit/blocks/block_common.php	(revision 484)
@@ -103,5 +103,5 @@
 
     $option = "<option value=\"0\" ";
-    if ($isAll) $form .= " selected=\"selected\"";
+    if ($isAll) $option .= " selected=\"selected\"";
     $option .= ">"._MB_XP2_ALL ."</option>";
 
@@ -146,4 +146,56 @@
 endif;
 
+if(!function_exists("block_template_setting")):
+function block_template_setting($mydirname,$option_name = '',$value='')
+{
+	$temp_parm = explode(':' , $value);
+	if (empty($temp_parm[1])) {
+		$filename=$temp_parm[0];
+		$temp_type = 'db';
+	} else  {
+		$filename=$temp_parm[1];
+		$temp_type = $temp_parm[0];
+	}
+
+	$none_prefix_filename = '';
+	$pattern = '^' . $mydirname . '_(.*).html';
+	if (preg_match('/' . $pattern . '/' , $filename, $match)){ // file prefix check
+		$none_prefix_filename = $match[1];
+	}
+	
+	$output = _MB_XP2_THISTEMPLATE . "\n";
+	$output .= 	'<input type="hidden" size="50" name="' . $option_name . '" value="' . $value .'"/>' . "\n";
+    $output .= '&nbsp;<select name="template_type" onclick="Template_Make()">' ."\n";
+	switch ($temp_type){
+		case 'db':
+		case 'DB':
+			$output .=  '<option value="0" selected="selected">db</option>';
+			$output .=  '<option value="1">file</option>';
+			break;
+		default:
+			$output .=  '<option value="0">db</option>';
+			$output .=  '<option value="1" selected="selected">file</option>';
+	}
+	$output .= '</select>';
+	$output .= '<b>:'.$mydirname . '_</b>';
+	$output .= '<input type="text" size="30" name="none_prefix_file" value="'. $none_prefix_filename. '"  onChange="Template_Make()"/><b>.html</b><br />';
+    $output .= '
+<script type="text/javascript">
+	function Template_Make(){
+		var type_element = document.getElementsByName("template_type").item(0);
+		var name_element = document.getElementsByName("none_prefix_file").item(0);
+		var real_element = document.getElementsByName("' .$option_name . '").item(0);
+
+		var file_name = "' . $mydirname . '_" + name_element.value + ".html";
+		if (type_element.value ==0) var tmp_type = "db:"; else var tmp_type = "file:";
+		real_element.value = tmp_type + file_name;
+	}
+</script>
+';
+    
+    return $output;
+
+}
+endif;
 
 ?>
Index: trunk/xpressme_integration_kit/blocks/calender_block.php
===================================================================
--- trunk/xpressme_integration_kit/blocks/calender_block.php	(revision 483)
+++ trunk/xpressme_integration_kit/blocks/calender_block.php	(revision 484)
@@ -26,5 +26,5 @@
 
 		$form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />\n";
-	    $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";
+		$form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES));
 		$form .= "<br />";
 		$form .= _MB_XP2_SUN_COLOR .": <input type='text' name='options[2]' value='" . $sun_color . "' /><br />\n";
Index: trunk/xpressme_integration_kit/blocks/category_block.php
===================================================================
--- trunk/xpressme_integration_kit/blocks/category_block.php	(revision 483)
+++ trunk/xpressme_integration_kit/blocks/category_block.php	(revision 484)
@@ -35,5 +35,5 @@
 
 		$form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />";
-	    $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";
+		$form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES));
 		$form .= "<br />";
 		$form .= _MB_XP2_CAT_ALL_STR . "  <input type='text' name='options[2]' value='" . $show_option_all . "' /><br />";
Index: trunk/xpressme_integration_kit/blocks/enhanced_block.php
===================================================================
--- trunk/xpressme_integration_kit/blocks/enhanced_block.php	(revision 483)
+++ trunk/xpressme_integration_kit/blocks/enhanced_block.php	(revision 484)
@@ -22,10 +22,11 @@
 		$include_file = empty( $options[2] ) ? '' : $options[2] ;
 		
+		require_once(XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/blocks/block_common.php');
 
 		$form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />";
-	    $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";
+		$form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES));
 		$form .= "<br />";
 		$form .= _MB_XP2_ENHACED_FILE .":<br />\n";
-		$form .= '&emsp;' . _MB_XP2_FILE_NAME . ": my_<input type='text' name='options[2]' value='" . $include_file . "' />_block.php<br>\n";
+		$form .= '&emsp;' . _MB_XP2_FILE_NAME . ": <b>my_</b><input type='text' name='options[2]' value='" . $include_file . "' /><b>_block.php</b><br>\n";
 		$form .= '&emsp;' . _MB_XP2_MAKE_ENHACED_FILE . "<br>\n";
 		return $form;
Index: trunk/xpressme_integration_kit/blocks/meta_block.php
===================================================================
--- trunk/xpressme_integration_kit/blocks/meta_block.php	(revision 483)
+++ trunk/xpressme_integration_kit/blocks/meta_block.php	(revision 484)
@@ -31,5 +31,5 @@
 
 		$form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />";
-	    $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";
+		$form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES));
 		$form .= "<br />";
 		$form .= yes_no_radio_option('options[2]', _MB_XP2_META_WP_LINK , $wp_link) . "<br />\n";
Index: trunk/xpressme_integration_kit/blocks/page_block.php
===================================================================
--- trunk/xpressme_integration_kit/blocks/page_block.php	(revision 483)
+++ trunk/xpressme_integration_kit/blocks/page_block.php	(revision 484)
@@ -35,5 +35,5 @@
 
 		$form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />";
-	    $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";
+		$form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES));
 		$form .= "<br />";
 		$form .= _MB_XP2_PAGE_ORDERBY .": ";
Index: trunk/xpressme_integration_kit/blocks/popular_posts_block.php
===================================================================
--- trunk/xpressme_integration_kit/blocks/popular_posts_block.php	(revision 483)
+++ trunk/xpressme_integration_kit/blocks/popular_posts_block.php	(revision 484)
@@ -28,7 +28,6 @@
 		
 		require_once(XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/blocks/block_common.php');
-
 		$form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />\n";
-	    $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";
+		$form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES));
 		$form .= "<br />\n";
 		$form .= _MB_XP2_COUNT .": <input type='text' name='options[2]' value='" . $disp_count . "' /><br />\n";
Index: trunk/xpressme_integration_kit/blocks/recent_comments_block.php
===================================================================
--- trunk/xpressme_integration_kit/blocks/recent_comments_block.php	(revision 483)
+++ trunk/xpressme_integration_kit/blocks/recent_comments_block.php	(revision 484)
@@ -30,5 +30,5 @@
 		
 		$form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />\n";
-	    $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";
+		$form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES));
 		$form .= "<br />";
 		$form .= _MB_XP2_COUNT .": <input type='text' size='3' name='options[2]' value='" . $disp_count . "' /><br />\n";
Index: trunk/xpressme_integration_kit/blocks/recent_posts_content_block.php
===================================================================
--- trunk/xpressme_integration_kit/blocks/recent_posts_content_block.php	(revision 483)
+++ trunk/xpressme_integration_kit/blocks/recent_posts_content_block.php	(revision 484)
@@ -34,5 +34,6 @@
 		
 		$form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />\n";
-	    $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";
+		$form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES));
+		$form .= "<br />";
 		$form .= _MB_XP2_COUNT .": <input type='text' size='3' name='options[2]' value='" . $disp_count . "' /><br />\n";
 		$form .= yes_no_radio_option('options[3]', _MB_XP2_P_EXCERPT , $excerpt) . "<br />\n";
Index: trunk/xpressme_integration_kit/blocks/recent_posts_list_block.php
===================================================================
--- trunk/xpressme_integration_kit/blocks/recent_posts_list_block.php	(revision 483)
+++ trunk/xpressme_integration_kit/blocks/recent_posts_list_block.php	(revision 484)
@@ -31,5 +31,5 @@
 
 		$form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />\n";
-	    $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";
+		$form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES));
 		$form .= "<br />\n";	
 		$form .= _MB_XP2_COUNT .": <input type='text' size='3' name='options[2]' value='" . $disp_count . "' /><br />\n";
Index: trunk/xpressme_integration_kit/blocks/search_block.php
===================================================================
--- trunk/xpressme_integration_kit/blocks/search_block.php	(revision 483)
+++ trunk/xpressme_integration_kit/blocks/search_block.php	(revision 484)
@@ -25,5 +25,5 @@
 		
 		$form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />";
-	    $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";
+		$form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES));
 		$form .= "<br />";		
 		$form .= _MB_XP2_SEARCH_LENGTH .": <input type='text' size='3' name='options[2]' value='" . $disp_count . "' /><br />";
Index: trunk/xpressme_integration_kit/blocks/tag_cloud_block.php
===================================================================
--- trunk/xpressme_integration_kit/blocks/tag_cloud_block.php	(revision 483)
+++ trunk/xpressme_integration_kit/blocks/tag_cloud_block.php	(revision 484)
@@ -32,5 +32,5 @@
 
 		$form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />";
-	    $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";
+		$form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES));
 		$form .= "<br />";
 		$form .= _MB_XP2_CLOUD_SMALLEST .": <input type='text' size='4' name='options[2]' value='" . $smallest . "' /><br />";
Index: trunk/xpressme_integration_kit/blocks/widget_block.php
===================================================================
--- trunk/xpressme_integration_kit/blocks/widget_block.php	(revision 483)
+++ trunk/xpressme_integration_kit/blocks/widget_block.php	(revision 484)
@@ -46,5 +46,5 @@
 
 		$form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />";
-	    $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";
+		$form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES));
 		$form .= "<br />" . yes_no_radio_option('options[2]', _MB_XP2_WIDGET_TITLE_SHOW , $title_show);
 		$form .= "<br />";
