Index: trunk/xpressme_integration_kit/class/check_blocks_class.php
===================================================================
--- trunk/xpressme_integration_kit/class/check_blocks_class.php	(revision 596)
+++ trunk/xpressme_integration_kit/class/check_blocks_class.php	(revision 598)
@@ -68,4 +68,10 @@
 	foreach ( $_POST as $k => $v )
 	{
+		if ( preg_match( "/^amid:/", $k ) )
+		{
+			$op  = 'remove_all_block';
+			$mid = intval( str_replace("amid:", "", $k) );
+			break;
+		}
 		if ( preg_match( "/^mid:/", $k ) )
 		{
@@ -106,5 +112,5 @@
 }
 
-function remove_block()
+function remove_all_block()
 {
 	$text = "<h1>Remove xoops block table</h1>\n";
@@ -141,4 +147,55 @@
 	return $text;
 }
+function remove_block()
+{
+	$text = "<h1>Remove xoops block table</h1>\n";
+
+	$error = false;
+	$block_objs =& $this->_get_block_object_orber_num_bymodule_id( $this->module_id);
+	$module_obj =& $this->_get_module_object_bymodule_id( $this->module_id );
+	$infos    =& $module_obj->getInfo('blocks');
+
+	foreach ( $infos as $num => $info )
+	{
+		$block_err = false;
+		if ( !isset( $block_objs[ $num ] ) ){
+			$block_err = true;
+		} else {
+			$block_obj = $block_objs[ $num ];
+			if ( isset($info['file']) && ( $info['file'] != $block_obj->getVar('func_file', 'n') ) ) $block_err = true;
+			if ( isset($info['show_func']) && ( $info['show_func'] != $block_obj->getVar('show_func', 'n') ) ) $block_err = true;
+			if ( isset($info['edit_func']) && ( $info['edit_func'] != $block_obj->getVar('edit_func', 'n') ) ) $block_err = true;
+			if ( isset($info['template']) && ( $info['template'] != $block_obj->getVar('template', 'n') ) ) $block_err = true;
+			if ( isset($info['options']) ){
+				$option_arr_1 = explode( '|', $info['options'] );
+				$option_arr_2 = explode( '|', $block_obj->getVar('options', 'n') );
+			
+				$excludes_block = array();
+			
+				if (in_array($info['file'],$excludes_block)){
+					if ( count($option_arr_1) > count($option_arr_2) ) $block_err = true;
+				} else {
+					if ( count($option_arr_1) != count($option_arr_2) ) $block_err = true;
+				}
+			}
+		}
+		if ($block_err){
+			$ret = $this->_delete_block( $block_obj );
+			if ( !$ret ) $error = true;
+		}
+	}
+
+	if ( !$error ) {
+		$text .= '<h4 style="color:#0000ff">Success</h4>'."\n";
+	} else {
+		$text .= '<h4 style="color:#ff0000">Failed</h4>'."\n";
+	}
+
+	$url = $this->_build_url_module_update( $module_obj->getVar('dirname', 'n') );
+	$text .= '<a href="'.$url.'">GO to Module Update: '.$module_obj->getVar('name', 's')."</a><br /><br />\n";
+//	$text .= '<a href="check_blocks.php">Check xoops block table</a><br />'."\n";
+
+	return $text;
+}
 
 //--------------------------------------------------------
@@ -190,6 +247,9 @@
 {
 	$this->_error_flag = false;
-
-	$name = htmlspecialchars( $info['name'] );
+	
+	$bid = $block_obj->getVar('bid', 'n');
+	$edit_url = $this->_build_url_block_edit( $bid );
+	$name = '<a href="' . $edit_url . '">'. htmlspecialchars( $info['name'] ). '</a>';
+//	$name = htmlspecialchars( $info['name'] );
 
 	if ( isset($info['file']) && ( $info['file'] != $block_obj->getVar('func_file', 'n') ) )
@@ -295,5 +355,17 @@
 	return $url;
 }
-
+function _build_url_block_edit( $bid )
+{
+	$dir_name = $this->module_dirname;
+	if (file_exists(XOOPS_ROOT_PATH . '/modules/altsys/admin/index.php')){
+//		$url = XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname=xp_trunk&op=edit&bid='.$bid;
+		$url = XOOPS_URL.'/modules/'.$dir_name.'/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$dir_name.'xp_trunk&op=edit&bid='.$bid;
+	} else if ( $this->_xoops_version == '2.1' ) {
+		$url = XOOPS_URL.'/modules/legacy/admin/index.php?action=BlockEdit&bid='.$bid;
+	} else {
+		$url = XOOPS_URL.'/modules/system/admin.php?fct=blocksadmin&op=mod&bid='.$bid;
+	}
+	return $url;
+}
 //--------------------------------------------------------
 // user handler
