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

Back to archive index

Minahito minah****@users*****
2005年 12月 16日 (金) 19:01:58 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.7 xoops2jp/html/modules/base/class/Legacy_AdminRenderSystem.class.php:1.1.2.8
--- xoops2jp/html/modules/base/class/Legacy_AdminRenderSystem.class.php:1.1.2.7	Wed Dec 14 17:34:40 2005
+++ xoops2jp/html/modules/base/class/Legacy_AdminRenderSystem.class.php	Fri Dec 16 19:01:57 2005
@@ -1,116 +1,148 @@
-<?php
-
-//
-// TODO
-//
-require_once XOOPS_ROOT_PATH."/modules/legacyRender/kernel/Legacy_RenderSystem.class.php";
-
-define("LEGACY_ADMIN_RENDER_TEMPLATE_DIRNAME","templates");
-
-/**
- * [TODO]
- * We depends on Legacy_RenderSystem that a add-in module defines. We must stop
- * this situation.
- */
-class Legacy_AdminRenderSystem extends Legacy_RenderSystem
-{
-	var $mSmarty;
-	
-	function prepare()
-	{
-		require_once XOOPS_ROOT_PATH."/class/smarty/Smarty.class.php";
-		
-		$this->mSmarty=new Smarty();
-		$this->mSmarty->compile_dir=XOOPS_COMPILE_PATH;
-		$this->mSmarty->left_delimiter="<{";
-		$this->mSmarty->right_delimiter="}>";
-
-		$this->mSmarty->assign(array("xoops_url"=>XOOPS_URL,
-		                              "xoops_rootpath"=>XOOPS_ROOT_PATH,
-		                              "xoops_langcode"=>_LANGCODE,
-		                              "xoops_charset"=>_CHARSET,
-		                              "xoops_version"=>XOOPS_VERSION,
-		                              "xoops_upload_url"=>XOOPS_UPLOAD_URL));
-
-		$this->mSmarty->register_modifier("theme","Legacy_modifier_theme");
-	}
-	
-	function renderBlock(&$target)
-	{
-		$this->mSmarty->template_dir=XOOPS_ROOT_PATH."/modules/base/admin/templates/blocks";
-
-		foreach($target->getAttributes() as $key=>$value) {
-			$this->mSmarty->assign($key,$value);
-		}
-		
-		$result=&$this->mSmarty->fetch($target->getTemplateName());
-		$target->setResult($result);
-		
-		//
-		// Reset
-		//
-		foreach($target->getAttributes() as $key=>$value) {
-			$this->mSmarty->clear_assign($key);
-		}
-	}
-	
-	function renderTheme(&$target)
-	{
-		$this->mController->mDebugger->displayLog();
-
-		//
-		// Assign from attributes of the render-target.
-		//
-		foreach($target->getAttributes() as $key=>$value) {
-			$this->mSmarty->assign($key,$value);
-		}
-
-		$this->mSmarty->assign("currentModule",$this->mController->mModuleController->mModuleObject);
-
-		//
-		// Theme rendering
-		//
-		foreach($this->mBlockContents[0] as $result) {
-			$this->mSmarty->append('xoops_lblocks',$result);
-		}
-
-		$this->mSmarty->template_dir=XOOPS_ROOT_PATH."/themes/admin/";
-		$result=$this->mSmarty->fetch("file:admin_theme.html");
-
-		$target->setResult($result);
-	}
-
-	function renderMain(&$target)
-	{
-		//
-		// Assign from attributes of the render-target.
-		//
-		foreach($target->getAttributes() as $key=>$value) {
-			$this->mSmarty->assign($key,$value);
-		}
-
-		$result=null;
-		if($target->getTemplateName()) {
-			$this->mSmarty->template_dir=$this->mController->mModuleController->getModuleDir() . "/". LEGACY_ADMIN_RENDER_TEMPLATE_DIRNAME;
-			$result=$this->mSmarty->fetch("file:".$this->mTemplateName);
-		}
-		else {
-			$result=$target->getAttribute("stdout_buffer");
-		}
-		
-		$target->setResult($result);
-	}
-}
-
-/**
- * Return URL string by "overriding" rule
- * (Now, test implement)
- */
-function Legacy_modifier_theme($string)
-{
-	// TEST
-	// I will modify this function to oveeride system.
-	return XOOPS_THEME_URL."/admin/".$string;
-}
-
+<?php
+
+//
+// TODO
+//
+require_once XOOPS_ROOT_PATH."/modules/legacyRender/kernel/Legacy_RenderSystem.class.php";
+
+define("LEGACY_ADMIN_RENDER_TEMPLATE_DIRNAME","templates");
+
+require_once XOOPS_ROOT_PATH."/class/smarty/Smarty.class.php";
+
+/**
+ * This class extends Smarty to mediate the collision compiled file name.
+ */
+class Legacy_AdminSmarty extends Smarty
+{
+	var $mModulePrefix = null;
+	
+	function Legacy_AdminSmarty()
+	{
+		parent::Smarty();
+
+		$this->compile_dir = XOOPS_COMPILE_PATH;
+		$this->left_delimiter = "<{";
+		$this->right_delimiter = "}>";
+
+		$this->register_modifier("theme", "Legacy_modifier_theme");
+	}
+	
+	function setModulePrefix($prefix)
+	{
+		$this->mModulePrefix = $prefix;
+	}
+	
+	function _get_auto_filename($autoBase, $autoSource = null, $auotId = null)
+	{
+		$autoSource = $this->mModulePrefix . "_admin_" . $autoSource;
+		return parent::_get_auto_filename($autoBase, $autoSource, $auotId);
+	}
+}
+
+/**
+ * [TODO]
+ * We depends on Legacy_RenderSystem that a add-in module defines. We must stop
+ * this situation.
+ */
+class Legacy_AdminRenderSystem extends Legacy_RenderSystem
+{
+	var $mSmarty;
+	
+	function prepare()
+	{
+		$this->mSmarty=new Legacy_AdminSmarty();
+
+		$this->mSmarty->assign(array("xoops_url"=>XOOPS_URL,
+		                              "xoops_rootpath"=>XOOPS_ROOT_PATH,
+		                              "xoops_langcode"=>_LANGCODE,
+		                              "xoops_charset"=>_CHARSET,
+		                              "xoops_version"=>XOOPS_VERSION,
+		                              "xoops_upload_url"=>XOOPS_UPLOAD_URL));
+
+	}
+	
+	function renderBlock(&$target)
+	{
+		$this->mSmarty->template_dir=XOOPS_ROOT_PATH."/modules/base/admin/templates/blocks";
+
+		foreach($target->getAttributes() as $key=>$value) {
+			$this->mSmarty->assign($key,$value);
+		}
+		
+		$this->mSmarty->setModulePrefix("base");
+		$result=&$this->mSmarty->fetch($target->getTemplateName());
+		$target->setResult($result);
+		
+		//
+		// Reset
+		//
+		foreach($target->getAttributes() as $key=>$value) {
+			$this->mSmarty->clear_assign($key);
+		}
+	}
+	
+	function renderTheme(&$target)
+	{
+		$this->mController->mDebugger->displayLog();
+
+		//
+		// Assign from attributes of the render-target.
+		//
+		foreach($target->getAttributes() as $key=>$value) {
+			$this->mSmarty->assign($key,$value);
+		}
+
+		$this->mSmarty->assign("currentModule",$this->mController->mModuleController->mModuleObject);
+
+		//
+		// Theme rendering
+		//
+		foreach($this->mBlockContents[0] as $result) {
+			$this->mSmarty->append('xoops_lblocks',$result);
+		}
+
+		$this->mSmarty->template_dir=XOOPS_ROOT_PATH."/themes/admin/";
+		$this->mSmarty->setModulePrefix("");
+		$result=$this->mSmarty->fetch("file:admin_theme.html");
+
+		$target->setResult($result);
+	}
+
+	function renderMain(&$target)
+	{
+		//
+		// Assign from attributes of the render-target.
+		//
+		foreach($target->getAttributes() as $key=>$value) {
+			$this->mSmarty->assign($key,$value);
+		}
+
+		$result=null;
+		if($target->getTemplateName()) {
+			$this->mSmarty->template_dir=$this->mController->mModuleController->getModuleDir() . "/". LEGACY_ADMIN_RENDER_TEMPLATE_DIRNAME;
+			$this->mSmarty->setModulePrefix($this->mController->mModuleController->getModuleDir());
+			$result=$this->mSmarty->fetch("file:".$this->mTemplateName);
+		}
+		else {
+			$result=$target->getAttribute("stdout_buffer");
+		}
+		
+		$target->setResult($result);
+	}
+}
+
+/**
+ * Return URL string by "overriding" rule.
+ * (Now, test implement)
+ * 1) Search file in specified theme directory.
+ * 2) Search file in current module template directory.
+ * 3) Search file in fallback theme directory.
+ */
+function Legacy_modifier_theme($string)
+{
+	// TEST
+	// I will modify this function to oveeride system.
+	return XOOPS_THEME_URL."/admin/".$string;
+}
+
 ?>
\ No newline at end of file


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