[xoops-cvslog 1525] CVS update: xoops2jp/html/modules/base/class

Back to archive index

Minahito minah****@users*****
2005年 12月 30日 (金) 17:26:24 JST


Index: xoops2jp/html/modules/base/class/Legacy_AdminRenderSystem.class.php
diff -u xoops2jp/html/modules/base/class/Legacy_AdminRenderSystem.class.php:1.1.2.10 xoops2jp/html/modules/base/class/Legacy_AdminRenderSystem.class.php:1.1.2.11
--- xoops2jp/html/modules/base/class/Legacy_AdminRenderSystem.class.php:1.1.2.10	Sat Dec 24 15:46:05 2005
+++ xoops2jp/html/modules/base/class/Legacy_AdminRenderSystem.class.php	Fri Dec 30 17:26:24 2005
@@ -8,6 +8,9 @@
 define('LEGACY_ADMIN_RENDER_TEMPLATE_DIRNAME', "templates");
 define('_TMP_THEME_NAME', "admin");
 
+define('LEGACY_ADMIN_RENDER_FALLBACK_PATH', XOOPS_MODULE_PATH . "/base/admin/theme");
+define('LEGACY_ADMIN_RENDER_FALLBACK_URL', XOOPS_MODULE_URL . "/base/admin/theme");
+
 require_once XOOPS_ROOT_PATH."/class/smarty/Smarty.class.php";
 
 /**
@@ -34,6 +37,7 @@
 		$this->right_delimiter = "}>";
 
 		$this->register_modifier("theme", "Legacy_modifier_theme");
+		$this->register_function("stylesheet", "Legacy_function_stylesheet");
 	}
 	
 	function setModulePrefix($prefix)
@@ -138,8 +142,17 @@
 			$this->mSmarty->append('xoops_lblocks',$result);
 		}
 
-		$this->mSmarty->template_dir=XOOPS_ROOT_PATH."/themes/admin/";
-		$this->mSmarty->setModulePrefix("");
+		//
+		// Check Theme or Fallback
+		//
+		if (file_exists(XOOPS_ROOT_PATH."/themes/"._TMP_THEME_NAME."/admin_theme.html")) {
+			$this->mSmarty->template_dir=XOOPS_THEME_PATH."/"._TMP_THEME_NAME;
+		}
+		else {
+			$this->mSmarty->template_dir=LEGACY_ADMIN_RENDER_FALLBACK_PATH;
+		}
+
+		$this->mSmarty->setModulePrefix('');
 		$result=$this->mSmarty->fetch("file:admin_theme.html");
 
 		$target->setResult($result);
@@ -188,9 +201,7 @@
 			return XOOPS_THEME_URL . "/" . _TMP_THEME_NAME . "/" . $string;
 		}
 
-		// TEMP
-		// TODO We must return FALLBACK_URL here.
-		return "hoge";
+		return LEGACY_ADMIN_RENDER_FALLBACK_URL . "/" . $string;
 	}
 	else {
 		$dirname = $moduleObject->getVar('dirname');
@@ -212,11 +223,31 @@
 			return XOOPS_MODULE_URL . "/" . $dirname . "/admin/templates/" . $string;
 		}
 
-		// TEMP
-		// TODO We must return FALLBACK_URL here.
-		return "fallback";
+		return LEGACY_ADMIN_RENDER_FALLBACK_URL . "/" . $string;
 	}
 }
 
+function Legacy_function_stylesheet($params, &$smarty)
+{
+	$file = $params['file'];
+
+	$theme = null;
+
+	// TODO We must remove Hard-Coding
+	$themePath = XOOPS_THEME_PATH . "/" . _TMP_THEME_NAME . "/" . $file;
+	if (file_exists($themePath)) {
+		$theme = _TMP_THEME_NAME;
+		$url = XOOPS_MODULE_URL . "/base/admin/css.php?theme=${theme}&file=${file}";
+	}
+	else {
+		$url = XOOPS_MODULE_URL . "/base/admin/css.php?file=${file}";
+	}
+
+	// TEMP
+	// TODO We must return FALLBACK_URL here.
+
+	print '<link rel="stylesheet" type="text/css" media="all" href="' . $url . '" />';
+}
+
 
 ?>
\ No newline at end of file


xoops-cvslog メーリングリストの案内
Back to archive index