[xoops-cvslog 1229] CVS update: xoops2jp/html/modules/legacyRender/kernel

Back to archive index

Minahito minah****@users*****
2005年 11月 28日 (月) 22:45:54 JST


Index: xoops2jp/html/modules/legacyRender/kernel/Legacy_RenderSystem.class.php
diff -u xoops2jp/html/modules/legacyRender/kernel/Legacy_RenderSystem.class.php:1.1.2.2 xoops2jp/html/modules/legacyRender/kernel/Legacy_RenderSystem.class.php:1.1.2.3
--- xoops2jp/html/modules/legacyRender/kernel/Legacy_RenderSystem.class.php:1.1.2.2	Sat Nov 26 14:59:57 2005
+++ xoops2jp/html/modules/legacyRender/kernel/Legacy_RenderSystem.class.php	Mon Nov 28 22:45:54 2005
@@ -1,74 +1,16 @@
 <?php
 /**
- * @version $Id: Legacy_RenderSystem.class.php,v 1.1.2.2 2005/11/26 05:59:57 minahito Exp $
+ * @version $Id: Legacy_RenderSystem.class.php,v 1.1.2.3 2005/11/28 13:45:54 minahito Exp $
  */
 
-class Legacy_DialogRenderTarget extends XCube_RenderTarget
-{
-	function sendHeader()
-	{
-		header('Content-Type:text/html; charset='._CHARSET);
-		header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
-		header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
-		header('Cache-Control: no-store, no-cache, must-revalidate');
-		header('Cache-Control: post-check=0, pre-check=0', false);
-		header('Pragma: no-cache');
-	}
-	
-	function isGlobal()
-	{
-		return true;
-	}
-	
-	function isTheme()
-	{
-		return false;
-	}
-	
-	function getTemplateName()
-	{
-		return "legacy_render_dialog.html";
-	}
-
-	function display(&$renderSystem)
-	{
-		$this->sendHeader();
-		print $this->getResult();
-	}
-}
-
-class Legacy_ScreenRenderTarget extends XCube_RenderTarget
-{
-	function sendHeader()
-	{
-		header('Content-Type:text/html; charset='._CHARSET);
-		header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
-		header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
-		header('Cache-Control: no-store, no-cache, must-revalidate');
-		header('Cache-Control: post-check=0, pre-check=0', false);
-		header('Pragma: no-cache');
-	}
-
-	function isGlobal()
-	{
-		return true;
-	}
-	
-	function isTheme()
-	{
-		return true;
-	}
-
-	function display(&$renderSystem)
-	{
-		$this->sendHeader();
-		print $this->getResult();
-	}
-}
+require_once XOOPS_ROOT_PATH."/modules/legacyRender/kernel/Legacy_RenderTarget.class.php";
 
 
 /**
  * Compatible render system with XOOPS 2 Themes & Templates.
+ *
+ * This manages theme and main render-target directly. And, this realizes
+ * variable-sharing-mechanism with using smarty.
  */
 class Legacy_RenderSystem extends XCube_RenderSystem
 {
@@ -78,27 +20,29 @@
 	var $mBlockShowFlags;
 	var $mBlockContents;
 	
+	/**
+	 * Temporary
+	 */
+	var $mThemeRenderTarget;
+	
+	/**
+	 * Temporary
+	 */
+	var $mMainRenderTarget;
+	
 	var $_mContentsData=null;
 
 	function Legacy_RenderSystem(&$controller)
 	{
 		parent::XCube_RenderSystem($controller);
 		$this->mBlockContents=array();
-		$this->mRenderTarget=new Legacy_ScreenRenderTarget();
 	}
 	
 	function setDialogRenderMode()
 	{
-		$this->mRenderTarget=new Legacy_DialogRenderTarget();
+		die("DEPRECATED");
 	}
 	
-	/**
-	 * @return bool
-	 */
-	function isDialogRenderMode()
-	{
-	}
-
 	function prepare()
 	{
 		require_once XOOPS_ROOT_PATH."/class/template.php";
@@ -169,7 +113,7 @@
 
 		$this->mXoopsTpl->assign($arr);
 	}
-	
+
 	function setAttribute($key,$value)
 	{
 		$this->mRenderTarget->setAttribute($key,$value);
@@ -179,9 +123,10 @@
 	{
 		$this->mRenderTarget->getAttribute($key);
 	}
-	
-	function renderBlock(&$blockProcedure)
+
+	function renderBlock(&$target)
 	{
+		/**
 		$cacheTime = $blockProcedure->getCacheTime();
 		if(!$cacheTime) {
 			$this->mXoopsTpl->xoops_setCaching(0);
@@ -190,20 +135,26 @@
             $this->mXoopsTpl->xoops_setCaching(2);
             $this->mXoopsTpl->xoops_setCacheTime($bcachetime);
 		}
+		*/
 
-		$templateName=$blockProcedure->getTemplateName();
-	
-		$this->mXoopsTpl->assign_by_ref("block",$blockProcedure->getResult());
+		//
+		// Temporary
+		//
+		$this->mXoopsTpl->xoops_setCaching(0);
 
-		$renderResult=&$this->mXoopsTpl->fetchBlock($templateName,$blockProcedure->getId());
-		
-		$this->mXoopsTpl->clear_assign('block');
+		foreach($target->getAttributes() as $key=>$value) {
+			$this->mXoopsTpl->assign($key,$value);
+		}
 
-		$this->mBlockShowFlags[$blockProcedure->getEntryIndex()] = true;
-		$this->mBlockContents[$blockProcedure->getEntryIndex()][] = array(
-								'title'=>$blockProcedure->getTitle(),
-								'content'=>$renderResult,
-								'weight'=>$blockProcedure->getWeight());
+		$result=&$this->mXoopsTpl->fetchBlock($target->getTemplateName(),$target->getAttribute("mid"));
+		$target->setResult($result);
+		
+		//
+		// Reset
+		//
+		foreach($target->getAttributes() as $key=>$value) {
+			$this->mXoopsTpl->clear_assign($key);
+		}
 	}
 	
 	function _render(&$target)
@@ -220,7 +171,61 @@
 		}
 	}
 	
-	function _renderTheme(&$target)
+	function renderWithTarget(&$target)
+	{
+		//
+		// The following lines are temporary until we will finish changing the style!
+		//
+		switch($target->getType()) {
+			case XCUBE_RENDER_TARGET_TYPE_BLOCK:
+				$this->renderTheme($target);
+				break;
+
+			case XCUBE_RENDER_TARGET_TYPE_MAIN:
+				$this->renderMain($target);
+				break;
+
+			case XCUBE_RENDER_TARGET_TYPE_THEME:
+				$this->renderTheme($target);
+				break;
+
+			case XCUBE_RENDER_TARGET_TYPE_BUFFER:
+			default:
+				break;
+		}
+	}
+
+	function renderMain(&$target)
+	{
+		$cachedTemplateId = isset($GLOBLAS['xoopsCachedTemplateId']) ? $GLOBLAS['xoopsCachedTemplateId'] : null;
+
+		foreach($target->getAttributes() as $key=>$value) {
+			$this->mXoopsTpl->assign($key,$value);
+		}
+
+		foreach($this->mRenderTarget->getAttributes() as $key=>$value) {
+			$this->mXoopsTpl->assign($key,$value);
+		}
+
+		if ($target->getTemplateName()) {
+		    if ($cachedTemplateId!==null) {
+		        $contents=$this->mXoopsTpl->fetch('db:'.$target->getTemplateName(), $xoopsCachedTemplateId);
+		    } else {
+		        $contents=$this->mXoopsTpl->fetch('db:'.$target->getTemplateName());
+		    }
+		} else {
+		    if ($cachedTemplateId!==null) {
+		        $this->mXoopsTpl->assign('dummy_content', $target->getAttribute("stdout_buffer"));
+		        $contents=$this->mXoopsTpl->fetch($GLOBALS['xoopsCachedTemplate'], $xoopsCachedTemplateId);
+		    } else {
+		        $contents=$target->getAttribute("stdout_buffer");
+		    }
+		}
+		
+		$target->setResult($contents);
+	}
+
+	function renderTheme(&$target)
 	{
 		//
 		// Assign from attributes of the render-target.
@@ -233,7 +238,7 @@
 		// [TODO]
 		// We must implement with a render-target.
 		//
-		$this->_processLegacyTemplate();
+		// $this->_processLegacyTemplate();
 
 		//
 		// Assign module informations.
@@ -252,7 +257,7 @@
 		// assing
 		/// @todo I must move these to somewhere.
 		$assignNameMap = array(
-				XOOPS_SIDEBLOCK_LEFT=>array('showflag'=>'xoops_showllock','block'=>'xoops_lblocks'),
+				XOOPS_SIDEBLOCK_LEFT=>array('showflag'=>'xoops_showlblock','block'=>'xoops_lblocks'),
 				XOOPS_CENTERBLOCK_LEFT=>array('showflag'=>'xoops_showcblock','block'=>'xoops_clblocks'),
 				XOOPS_CENTERBLOCK_RIGHT=>array('showflag'=>'xoops_showcblock','block'=>'xoops_crblocks'),
 				XOOPS_CENTERBLOCK_CENTER=>array('showflag'=>'xoops_showcblock','block'=>'xoops_ccblocks'),
@@ -267,71 +272,21 @@
 				}
 			}
 		}
-
-		if($target->isTheme()) {
-			$this->mXoopsTpl->xoops_setCaching(0);
 		
-			$themeSet = $this->mController->mConfig['theme_set'];
-
-			//< test
-			$this->mRenderTarget->setResult($this->mXoopsTpl->fetch($themeSet."/theme.html"));
+		//
+		// Render result, and set it to the RenderBuffer of the $target.
+		//
+		$result=null;
+		if($target->getAttribute("isFileTheme")) {
+			$result=$this->mXoopsTpl->fetch($target->getTemplateName()."/theme.html");
 		}
 		else {
 			$result=$this->mXoopsTpl->fetch("db:".$target->getTemplateName());
-			$target->setResult($result);
 		}
-	}
-	
-	function display()
-	{
-		$this->render();
-		$this->mRenderTarget->display($this);
 
-		$this->mController->mDebugger->displayLog();
+		$target->setResult($result);
 	}
 	
-	/**
-	 *
-	 */
-	function _processStartPage()
-	{
-		$this->mTemplateName = isset($GLOBALS['xoopsOption']['template_main']) ? $GLOBALS['xoopsOption']['template_main'] : null;
-
-		if(!$this->mTemplateName) {
-			require_once XOOPS_ROOT_PATH.'/include/old_theme_functions.php';
-			$GLOBALS['xoopsTheme']['thename'] = $GLOBALS['xoopsConfig']['theme_set'];
-			ob_start();
-		}
-    }
-
-	function _processLegacyTemplate()
-	{
-		if(!$this->mTemplateName)
-			$this->mTemplateName = isset($GLOBALS['xoopsOption']['template_main']) ? $GLOBALS['xoopsOption']['template_main'] : null;
-		
-		$contents=null;
-
-		$cachedTemplateId = isset($GLOBLAS['xoopsCachedTemplateId']) ? $GLOBLAS['xoopsCachedTemplateId'] : null;
-
-		if ($this->mTemplateName) {
-		    if ($cachedTemplateId!==null) {
-		        $contents=$this->mXoopsTpl->fetch('db:'.$this->mTemplateName, $xoopsCachedTemplateId);
-		    } else {
-		        $contents=$this->mXoopsTpl->fetch('db:'.$this->mTemplateName);
-		    }
-		} else {
-		    if ($cachedTemplateId!==null) {
-		        $this->mXoopsTpl->assign('dummy_content', ob_get_contents());
-		        $contents=$this->mXoopsTpl->fetch($GLOBALS['xoopsCachedTemplate'], $xoopsCachedTemplateId);
-		    } else {
-		        $contents=ob_get_contents();
-		    }
-		    ob_end_clean();
-		}
-
-		$this->mXoopsTpl->assign('xoops_contents',$contents);
-	}
-
 	function renderMessageBox(&$messageBox)
 	{
 		$ret="";
@@ -380,6 +335,94 @@
 
 		return $ret;
 	}
+
+
+	//
+	// There must not be the following functions here!
+	//
+	//
+
+	/**
+	 * @deprecated
+	 */
+	function sendHeader()
+	{
+		header('Content-Type:text/html; charset='._CHARSET);
+		header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
+		header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
+		header('Cache-Control: no-store, no-cache, must-revalidate');
+		header('Cache-Control: post-check=0, pre-check=0', false);
+		header('Pragma: no-cache');
+	}
+
+	/**
+	 * @deprecated
+	 */
+	function showXoopsHeader($closeHead=true)
+	{
+		global $xoopsConfig;
+		$myts =& MyTextSanitizer::getInstance();
+		if ($xoopsConfig['gzip_compression'] == 1) {
+			ob_start("ob_gzhandler");
+		} else {
+			ob_start();
+		}
+
+		$this->sendHeader();
+		$this->_renderHeader($closeHead);
+	}
+	
+	// TODO never direct putput
+	/**
+	 * @deprecated
+	 */
+	function _renderHeader($closehead=true)
+	{
+		global $xoopsConfig, $xoopsTheme, $xoopsConfigMetaFooter;
+
+		echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>";
+
+		echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'._LANGCODE.'" lang="'._LANGCODE.'">
+		<head>
+		<meta http-equiv="content-type" content="text/html; charset='._CHARSET.'" />
+		<meta http-equiv="content-language" content="'._LANGCODE.'" />
+		<meta name="robots" content="'.htmlspecialchars($xoopsConfigMetaFooter['meta_robots']).'" />
+		<meta name="keywords" content="'.htmlspecialchars($xoopsConfigMetaFooter['meta_keywords']).'" />
+		<meta name="description" content="'.htmlspecialchars($xoopsConfigMetaFooter['meta_desc']).'" />
+		<meta name="rating" content="'.htmlspecialchars($xoopsConfigMetaFooter['meta_rating']).'" />
+		<meta name="author" content="'.htmlspecialchars($xoopsConfigMetaFooter['meta_author']).'" />
+		<meta name="copyright" content="'.htmlspecialchars($xoopsConfigMetaFooter['meta_copyright']).'" />
+		<meta name="generator" content="XOOPS" />
+		<title>'.htmlspecialchars($xoopsConfig['sitename']).'</title>
+		<script type="text/javascript" src="'.XOOPS_URL.'/include/xoops.js"></script>
+		';
+		$themecss = getcss($xoopsConfig['theme_set']);
+		echo '<link rel="stylesheet" type="text/css" media="all" href="'.XOOPS_URL.'/xoops.css" />';
+		if ($themecss) {
+			echo '<link rel="stylesheet" type="text/css" media="all" href="'.$themecss.'" />';
+			//echo '<style type="text/css" media="all"><!-- @import url('.$themecss.'); --></style>';
+		}
+		if ($closehead) {
+			echo '</head><body>';
+		}
+	}
+	
+	/**
+	 * @deprecated
+	 */
+	function _renderFooter()
+	{
+		echo '</body></html>';
+	    ob_end_flush();
+	}
+	
+	/**
+	 * @deprecated
+	 */
+	function showXoopsFooter()
+	{
+		$this->_renderFooter();
+	}
 }
 
 


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