Index: trunk/include/onupdate.php
===================================================================
--- trunk/include/onupdate.php	(revision 96)
+++ trunk/include/onupdate.php	(revision 102)
@@ -133,46 +133,8 @@
 	}
 	
-	// TEMPLATES (all templates have been already removed by modulesadmin)
-
-	$tplfile_handler =& xoops_gethandler( 'tplfile' ) ;
-	$tpl_path = dirname( dirname( __FILE__ ) ).'/templates/source' ;
-	if( $handler = @opendir( $tpl_path . '/' ) ) {
-		while( ( $file = readdir( $handler ) ) !== false ) {
-			if( substr( $file , 0 , 1 ) == '.' ) continue ;
-			$file_path = $tpl_path . '/' . $file ;
-			if( is_file( $file_path ) ) {
-				$mtime = intval( @filemtime( $file_path ) ) ;
-				$tplfile =& $tplfile_handler->create() ;
-				$tplfile->setVar( 'tpl_source' , file_get_contents( $file_path ) , true ) ;
-				$tplfile->setVar( 'tpl_refid' , $mid ) ;
-				$tplfile->setVar( 'tpl_tplset' , 'default' ) ;
-				$tplfile->setVar( 'tpl_file' , $mydirname . '_' . $file ) ;
-				$tplfile->setVar( 'tpl_desc' , '' , true ) ;
-				$tplfile->setVar( 'tpl_module' , $mydirname ) ;
-				$tplfile->setVar( 'tpl_lastmodified' , $mtime ) ;
-				$tplfile->setVar( 'tpl_lastimported' , 0 ) ;
-				$tplfile->setVar( 'tpl_type' , 'block' ) ;
-				if( ! $tplfile_handler->insert( $tplfile ) ) {
-					$msgs[] = '<span style="color:#flockf0000;">ERROR: Could not insert template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> to the database.</span>';
-				} else {
-					$tplid = $tplfile->getVar( 'tpl_id' ) ;
-					$msgs[] = 'Template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> added to the database. (ID: <b>'.$tplid.'</b>)';
-					// generate compiled file
-					include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ;
-					include_once XOOPS_ROOT_PATH.'/class/template.php' ;
-					if( ! xoops_template_touch( $tplid ) ) {
-						$msgs[] = '<span style="color:#ff0000;">ERROR: Failed compiling template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b>.</span>';
-					} else {
-						$msgs[] = 'Template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> compiled.</span>';
-					}
-				}
-			}
-		}
-		closedir( $handler ) ;
-	}
-	include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ;
-	include_once XOOPS_ROOT_PATH.'/class/template.php' ;
-	xoops_template_clear_module_cache( $mid ) ;
-
+	// make templates
+	include_once XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/include/xpress_templates_make.php' ;
+	$t_mess = xpress_templates_make($mid,$mydirname);
+	$ret = array_merge($ret,$t_mess);
 	
 	return true ;
