[xoops-cvslog 1436] CVS update: xoops2jp/html/modules/base/admin/actions

Back to archive index

Minahito minah****@users*****
2005年 12月 27日 (火) 19:29:31 JST


Index: xoops2jp/html/modules/base/admin/actions/LegacyHelpAction.class.php
diff -u /dev/null xoops2jp/html/modules/base/admin/actions/LegacyHelpAction.class.php:1.1.2.1
--- /dev/null	Tue Dec 27 19:29:31 2005
+++ xoops2jp/html/modules/base/admin/actions/LegacyHelpAction.class.php	Tue Dec 27 19:29:30 2005
@@ -0,0 +1,101 @@
+<?php
+/**
+ * @version $Id: LegacyHelpAction.class.php,v 1.1.2.1 2005/12/27 10:29:30 minahito Exp $
+ */
+
+/**
+ * This class extends Smarty to mediate the collision compiled file name.
+ */
+class Legacy_HelpSmarty extends Smarty
+{
+	var $mDirname = null;
+	var $mModuleObject = null;
+	var $mFilename = null;
+
+	function Legacy_HelpSmarty()
+	{
+		parent::Smarty();
+
+		$this->compile_id = null;
+		$this->_canUpdateFromFile = true;
+		$this->compile_check = true;
+		$this->compile_dir = XOOPS_COMPILE_PATH;
+		$this->left_delimiter = "<{";
+		$this->right_delimiter = "}>";
+
+//		$this->register_modifier("helpurl", "Legacy_modifier_helpurl");
+	}
+	
+	function _get_auto_filename($autoBase, $autoSource = null, $auotId = null)
+	{
+		$autoSource = $this->mDirname . "_help_" . $autoSource;
+		return parent::_get_auto_filename($autoBase, $autoSource, $auotId);
+	}
+}
+
+
+/**
+ * This action will show the information of a module specified to user.
+ */
+class LegacyHelpAction extends LegacyAdminAction
+{
+	var $mModuleObject = null;
+	var $mContents = null;
+	
+	function getDefaultView(&$controller, &$xoopsUser)
+	{
+		//
+		// TODO We must change the following lines to ActionForm.
+		//
+		$dirname = $_GET['dirname'];
+		if (!preg_match("/^[a-z\_]+$/i", $dirname)) {
+			return LEGACY_ADMIN_FRAME_VIEW_ERROR;
+		}
+
+		if (!is_dir(XOOPS_MODULE_PATH . "/" . $dirname)) {
+			return LEGACY_ADMIN_FRAME_VIEW_ERROR;
+		}
+
+		$moduleHandler =& xoops_gethandler('module');
+		$this->mModuleObject =& $moduleHandler->getByDirname($dirname);
+		
+		$language =& $controller->getConfig('language');
+
+		$helpfile = $this->mModuleObject->getHelp();
+
+		//
+		// Smarty
+		//
+		$smarty =& new Legacy_HelpSmarty();
+
+		//
+		// file check
+		//
+		$template_dir = XOOPS_MODULE_PATH . "/" . $dirname . "/language/" . $language;
+		if (!file_exists($template_dir . "/" . $helpfile)) {
+			$template_dir = XOOPS_MODULE_PATH . "/" . $dirname . "/language/english";
+			if (!file_exists($template_dir . "/" . $helpfile)) {
+				return LEGACY_ADMIN_FRAME_VIEW_ERROR;
+			}
+		}
+
+		$smarty->template_dir = $template_dir;
+		$this->mContents = $smarty->fetch("file:" . $helpfile);
+
+		return LEGACY_ADMIN_FRAME_VIEW_SUCCESS;
+	}
+
+	function executeViewSuccess(&$controller, &$xoopsUser, &$renderer)
+	{
+		$renderer->setTemplateName("help.html");
+		$renderer->setAttribute('module', $this->mModuleObject);
+		$renderer->setAttribute('contents', $this->mContents);
+	}
+
+	function executeViewError(&$controller, &$xoopsUser, &$renderer)
+	{
+		XCube_Utils::redirectHeader('./index.php?action=ModuleList', 1, "*Module not found*");
+	}
+}
+
+?>
\ No newline at end of file


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