[xoops-cvslog 6517] CVS update: xoops2jp/html/modules/legacy/actions

Back to archive index

NobuNobu nobun****@users*****
2007年 4月 30日 (月) 16:30:45 JST


Index: xoops2jp/html/modules/legacy/actions/BackendAction.class.php
diff -u /dev/null xoops2jp/html/modules/legacy/actions/BackendAction.class.php:1.1.4.1
--- /dev/null	Mon Apr 30 16:30:45 2007
+++ xoops2jp/html/modules/legacy/actions/BackendAction.class.php	Mon Apr 30 16:30:45 2007
@@ -0,0 +1,109 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+class Legacy_BackendAction extends Legacy_Action
+{
+	var $mItems = array();
+	
+	/**
+	 * The spec of getRSS():
+	 * append your RSS item to $eventArgs array. You don't need to sanitize your values. Use raw value.
+	 * 
+	 *  $item['title']
+	 *  $item['link'] ... permanent link
+	 *  $item['guid'] ... permanent link
+	 *  $item['pubdate'] ... unixtime
+	 *  $item['description'] ... not required. 
+	 *  $item['category'] ... not required. 
+	 *  $item['author'] ... not required. 
+	 *  
+	 * @var XCube_Delegate
+	 */
+	var $mGetRSSItems = null;
+	
+	function Legacy_BackendAction($flag)
+	{
+		parent::Legacy_Action($flag);
+		
+		$this->mGetRSSItems =& new XCube_Delegate();
+		$this->mGetRSSItems->register('Legacy_BackendAction.GetRSSItems');
+	}
+	
+	function getDefaultView(&$controll, &$xoopsUser)
+	{
+		$items = array();
+		$this->mGetRSSItems->call(new XCube_Ref($items));
+
+		$sortArr = array();
+		foreach ($items as $item) {
+			$i = intval($item['pubdate']);
+			for (; isset($sortArr[$i]) ; $i++);
+			
+			$sortArr[$i] = $item;
+		}
+		krsort($sortArr);
+	    $this->mItems = $sortArr;
+		return LEGACY_FRAME_VIEW_INDEX;
+	}
+	
+	function executeViewIndex(&$controller, &$xoopsUser, &$render)
+	{
+		$xoopsConfig = $controller->mRoot->mContext->mXoopsConfig;
+		
+		//
+		// Set up the render buffer.
+		//
+		$renderSystem =& $controller->mRoot->getRenderSystem('Legacy_RenderSystem');
+		
+		$renderTarget =& $renderSystem->createRenderTarget('main');
+
+		$renderTarget->setTemplateName("legacy_rss.html");
+		
+		$renderTarget->setAttribute('channel_title', $xoopsConfig['sitename']);
+		$renderTarget->setAttribute('channel_link', XOOPS_URL . '/');
+		$renderTarget->setAttribute('channel_desc', $xoopsConfig['slogan']);
+		$renderTarget->setAttribute('channel_lastbuild', formatTimestamp(time(), 'rss'));
+		$renderTarget->setAttribute('channel_webmaster', $xoopsConfig['adminmail']);
+		$renderTarget->setAttribute('channel_editor', $xoopsConfig['adminmail']);
+		$renderTarget->setAttribute('channel_category', 'News');
+		$renderTarget->setAttribute('channel_generator', 'XOOPS Cube');
+		$renderTarget->setAttribute('image_url', XOOPS_URL . '/images/logo.gif');
+		
+		$dimention = getimagesize(XOOPS_ROOT_PATH . '/images/logo.gif');
+
+		$width = 0;		
+		if (empty($dimention[0])) {
+			$width = 88;
+		}
+		else {
+			$width = ($dimention[0] > 144) ? 144 : $dimention[0];
+		}
+		
+		$height = 0;
+		if (empty($dimention[1])) {
+			$height = 31;
+		} else {
+			$height = ($dimention[1] > 400) ? 400 : $dimention[1];
+		}
+		
+		$renderTarget->setAttribute('image_width', $width);
+		$renderTarget->setAttribute('image_height', $height);
+		$renderTarget->setAttribute('items', $this->mItems);
+
+		//
+		// Rendering
+		//
+		$renderSystem->render($renderTarget);
+		
+		if (function_exists('mb_http_output')) {
+			mb_http_output('pass');
+		}
+		header ('Content-Type:text/xml; charset=utf-8');
+		
+		
+		print xoops_utf8_encode($renderTarget->getResult());
+		
+		exit(0);
+	}
+}
Index: xoops2jp/html/modules/legacy/actions/ImageListAction.class.php
diff -u /dev/null xoops2jp/html/modules/legacy/actions/ImageListAction.class.php:1.1.4.1
--- /dev/null	Mon Apr 30 16:30:45 2007
+++ xoops2jp/html/modules/legacy/actions/ImageListAction.class.php	Mon Apr 30 16:30:45 2007
@@ -0,0 +1,93 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_MODULE_PATH . "/legacy/class/AbstractListAction.class.php";
+require_once XOOPS_MODULE_PATH . "/legacy/forms/ImageFilterForm.class.php";
+
+class Legacy_ImageListAction extends Legacy_AbstractListAction
+{
+	var $mImgcatId = null;
+	
+	function prepare(&$controller, &$xoopsUser)
+	{
+		$controller->setDialogMode(true);
+		
+		$root =& $controller->mRoot;
+		$root->mLanguageManager->loadModuleMessageCatalog('legacy');
+	}
+	
+	function &_getHandler()
+	{
+		$handler =& xoops_getmodulehandler('image', 'legacy');
+		return $handler;
+	}
+
+	function &_getFilterForm()
+	{
+		$filter =& new Legacy_ImageFilterForm($this->_getPageNavi(), $this->_getHandler());
+		return $filter;
+	}
+
+	function _getBaseUrl()
+	{
+		return XOOPS_URL . "/imagemanager.php?op=list";
+	}
+	
+	function getDefaultView(&$controller, &$xoopsUser)
+	{
+		$result = parent::getDefaultView($controller, $xoopsUser);
+		if ($result == LEGACY_FRAME_VIEW_INDEX) {
+			$this->mImgcatId = xoops_getrequest('imgcat_id');
+			$handler =& xoops_getmodulehandler('imagecategory', 'legacy');
+			$this->mCategory =& $handler->get($this->mImgcatId );
+		}
+		
+		return $result;
+	}
+
+	function executeViewIndex(&$controller, &$xoopsUser, &$render)
+	{
+		$render->setTemplateName("legacy_image_list.html");
+		
+		foreach (array_keys($this->mObjects) as $key) {
+			$this->mObjects[$key]->loadImagecategory();
+		}
+		
+		$render->setAttribute("objects", $this->mObjects);
+		$render->setAttribute("pageNavi", $this->mFilter->mNavi);
+		
+		$render->setAttribute('imgcatId', $this->mImgcatId);
+		
+		$handler =& xoops_getmodulehandler('imagecategory', 'legacy');
+		
+		if (is_object($xoopsUser)) {
+			$groups = $xoopsUser->getGroups();
+		}
+		else {
+			$groups = array(XOOPS_GROUP_ANONYMOUS);
+		}
+		$categoryArr =& $handler->getObjectsWithReadPerm($groups);
+		
+		$render->setAttribute('categoryArr', $categoryArr);
+		
+		//
+		// If current category object exists, check the permission of uploading.
+		//
+		$hasUploadPerm = null;
+		if ($this->mCategory != null) {
+			$hasUploadPerm = $this->mCategory->hasUploadPerm($groups);
+		}
+		$render->setAttribute('hasUploadPerm', $hasUploadPerm);
+		$render->setAttribute("category", $this->mCategory);
+		
+		$render->setAttribute('target', xoops_getrequest('target'));
+	}
+
+	function executeViewError(&$controller, &$xoopsUser, &$render)
+	{
+		$controller->executeForward("./index.php?Action=ImageList");
+	}
+}
+
+?>
Index: xoops2jp/html/modules/legacy/actions/ImageUploadAction.class.php
diff -u /dev/null xoops2jp/html/modules/legacy/actions/ImageUploadAction.class.php:1.1.4.1
--- /dev/null	Mon Apr 30 16:30:45 2007
+++ xoops2jp/html/modules/legacy/actions/ImageUploadAction.class.php	Mon Apr 30 16:30:45 2007
@@ -0,0 +1,80 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_MODULE_PATH . "/legacy/admin/actions/ImageEditAction.class.php";
+require_once XOOPS_MODULE_PATH . "/legacy/forms/ImageUploadForm.class.php";
+
+class Legacy_ImageUploadAction extends Legacy_ImageEditAction
+{
+	var $mCategory = null;
+
+	function prepare(&$controller, &$xoopsUser)
+	{
+		parent::prepare($controller, $xoopsUser);
+		$controller->setDialogMode(true);
+		
+		$root =& $controller->mRoot;
+		$root->mLanguageManager->loadModuleMessageCatalog('legacy');
+	}
+	
+	function &_getHandler()
+	{
+		$handler =& xoops_getmodulehandler('image', 'legacy');
+		return $handler;
+	}
+
+	function _setupObject()
+	{
+		$this->mObjectHandler =& $this->_getHandler();
+		$this->mObject =& $this->mObjectHandler->create();
+		$this->mObject->set('imgcat_id', xoops_getrequest('imgcat_id'));
+	}
+
+	function _setupActionForm()
+	{
+		$this->mActionForm =& new Legacy_ImageUploadForm();
+		$this->mActionForm->prepare();
+	}
+	
+	function hasPermission(&$controller, &$xoopsUser)
+	{
+		$groups = array();
+		if (is_object($xoopsUser)) {
+			$groups = $xoopsUser->getGroups();
+		}
+		else {
+			$groups = array(XOOPS_GROUP_ANONYMOUS);
+		}
+			
+		$handler =& xoops_getmodulehandler('imagecategory', 'legacy');
+		$this->mCategory =& $handler->get(xoops_getrequest('imgcat_id'));
+		if (!is_object($this->mCategory ) || (is_object($this->mCategory) && !$this->mCategory->hasUploadPerm($groups))) {
+			return false;
+		}
+
+		return true;
+	}
+
+	function executeViewInput(&$controller, &$xoopsUser, &$render)
+	{
+		$render->setTemplateName("legacy_image_upload.html");
+		$render->setAttribute('actionForm', $this->mActionForm);
+		$render->setAttribute('object', $this->mObject);
+		
+		$render->setAttribute('category', $this->mCategory);
+		$render->setAttribute('target', xoops_getrequest('target'));
+	}
+
+	function executeViewSuccess(&$controller, &$xoopsUser, &$render)
+	{
+		$controller->executeForward(XOOPS_URL . "/imagemanager.php?imgcat_id=" . $this->mActionForm->get('imgcat_id') . "&target=" . xoops_getrequest('target'));
+	}
+
+	function executeViewError(&$controller, &$xoopsUser, &$render)
+	{
+		redirect_header(XOOPS_URL . "/imagemanager.php", 1, _MD_LEGACY_ERROR_DBUPDATE_FAILED);
+	}
+}
+
+?>
Index: xoops2jp/html/modules/legacy/actions/MiscFriendAction.class.php
diff -u /dev/null xoops2jp/html/modules/legacy/actions/MiscFriendAction.class.php:1.1.4.1
--- /dev/null	Mon Apr 30 16:30:45 2007
+++ xoops2jp/html/modules/legacy/actions/MiscFriendAction.class.php	Mon Apr 30 16:30:45 2007
@@ -0,0 +1,74 @@
+<?php
+/**
+ * @package Legacy
+ * @version $Id: MiscFriendAction.class.php,v 1.1.4.1 2007/04/30 07:30:45 nobunobu Exp $
+ */
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_MODULE_PATH . "/legacy/class/AbstractListAction.class.php";
+require_once XOOPS_MODULE_PATH . "/legacy/forms/MiscFriendForm.class.php";
+
+class Legacy_MiscFriendAction extends Legacy_Action
+{
+	var $mActionForm = null;
+	var $mMailer = null;
+	
+	function hasPermission(&$controller, &$xoopsUser)
+	{
+		return is_object($xoopsUser);
+	}
+
+	function prepare(&$controller, &$xoopsUser)
+	{
+		$this->mActionForm =& new Legacy_MiscFriendForm();
+		$this->mActionForm->prepare();
+	}
+
+	function getDefaultView(&$controller, &$xoopsUser)
+	{
+		$this->mActionForm->load($xoopsUser);
+		return LEGACY_FRAME_VIEW_INPUT;
+	}
+	
+	function execute(&$controller, &$xoopsUser)
+	{
+		$this->mActionForm->fetch();
+		$this->mActionForm->validate();
+		
+		if ($this->mActionForm->hasError()) {
+			return LEGACY_FRAME_VIEW_INPUT;
+		}
+		
+		$this->mMailer =& getMailer();
+		$this->mMailer->setTemplate("tellfriend.tpl");
+		$this->mMailer->assign("SITENAME", $this->mRoot->mContext->getXoopsConfig('sitename'));
+		$this->mMailer->assign("ADMINMAIL", $this->mRoot->mContext->getXoopsConfig('adminmail'));
+		$this->mMailer->assign("SITEURL", XOOPS_URL . '/');
+		
+		$this->mActionForm->update($this->mMailer);
+		
+		$this->mMailer->setSubject(sprintf(_MSC_INTSITE, $this->mRoot->mContext->getXoopsConfig('sitename')));
+		
+		return $this->mMailer->send() ? LEGACY_FRAME_VIEW_SUCCESS : LEGACY_FRAME_VIEW_ERROR;
+	}
+	
+	function executeViewInput(&$controller, &$xoopsUser, &$render)
+	{
+		$render->setTemplateName("legacy_misc_friend.html");
+		$render->setAttribute('actionForm', $this->mActionForm);
+	}
+
+	function executeViewSuccess(&$controller, &$xoopsUser, &$render)
+	{
+		$render->setTemplateName("legacy_misc_friend_success.html");
+	}
+
+	function executeViewError(&$controller, &$xoopsUser, &$render)
+	{
+		$render->setTemplateName("legacy_misc_friend_error.html");
+		$render->setAttribute('xoopsMailer', $this->mMailer);
+	}
+}
+
+?>
Index: xoops2jp/html/modules/legacy/actions/MiscSmiliesAction.class.php
diff -u /dev/null xoops2jp/html/modules/legacy/actions/MiscSmiliesAction.class.php:1.1.4.1
--- /dev/null	Mon Apr 30 16:30:45 2007
+++ xoops2jp/html/modules/legacy/actions/MiscSmiliesAction.class.php	Mon Apr 30 16:30:45 2007
@@ -0,0 +1,57 @@
+<?php
+/**
+ * @package Legacy
+ * @version $Id: MiscSmiliesAction.class.php,v 1.1.4.1 2007/04/30 07:30:45 nobunobu Exp $
+ */
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_MODULE_PATH . "/legacy/class/AbstractListAction.class.php";
+require_once XOOPS_MODULE_PATH . "/legacy/forms/SmilesFilterForm.class.php";
+
+class Legacy_MiscSmiliesAction extends Legacy_AbstractListAction
+{
+	/**
+	 * @var string
+	 */
+	var $mTargetName = null;
+
+	function &_getHandler()
+	{
+		$handler =& xoops_getmodulehandler('smiles', 'legacy');
+		return $handler;
+	}
+
+	function &_getFilterForm()
+	{
+		$filter =& new Legacy_SmilesFilterForm($this->_getPageNavi(), $this->_getHandler());
+		return $filter;
+	}
+
+	function _getBaseUrl()
+	{
+		return "./misc.php?type=Smilies";
+	}
+
+	function getDefaultView(&$controller, &$xoopsUser)
+	{
+		$this->mTargetName = xoops_getrequest('target');
+		return parent::getDefaultView($controller, $xoopsUser);
+	}
+	
+	function executeViewIndex(&$controller, &$xoopsUser, &$render)
+	{
+		//
+		// Because this action's template uses BASE message catalog, load it.
+		//
+		$root =& $controller->mRoot;
+		$root->mLanguageManager->loadModuleMessageCatalog('legacy');
+		
+		$render->setTemplateName("legacy_misc_smilies.html");
+		$render->setAttribute("objects", $this->mObjects);
+		$render->setAttribute("pageNavi", $this->mFilter->mNavi);
+		$render->setAttribute("targetName", $this->mTargetName);
+	}
+}
+
+?>
Index: xoops2jp/html/modules/legacy/actions/MiscSslloginAction.class.php
diff -u /dev/null xoops2jp/html/modules/legacy/actions/MiscSslloginAction.class.php:1.1.4.1
--- /dev/null	Mon Apr 30 16:30:45 2007
+++ xoops2jp/html/modules/legacy/actions/MiscSslloginAction.class.php	Mon Apr 30 16:30:45 2007
@@ -0,0 +1,28 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+/**
+ * TODO This action should be implemented by base. We must move it to user.
+ */
+class Legacy_MiscSslloginAction extends Legacy_Action
+{
+	function getDefaultView(&$controller, &$xoopsUser)
+	{
+		return LEGACY_FRAME_VIEW_INDEX;
+	}
+	
+	function executeViewIndex(&$controller, &$xoopsUser, &$render)
+	{
+		//
+		// Because this action's template uses USER message catalog, load it.
+		//
+		$root =& $controller->mRoot;
+		$root->mLanguageManager->loadModuleMessageCatalog('user');
+
+		$render->setTemplateName("legacy_misc_ssllogin.html");
+		$render->setAttribute("message", @sprintf(_US_LOGGINGU, $xoopsUser->getVar('uname')));
+	}
+}
+
+?>
Index: xoops2jp/html/modules/legacy/actions/NotifyCancelAction.class.php
diff -u /dev/null xoops2jp/html/modules/legacy/actions/NotifyCancelAction.class.php:1.1.4.1
--- /dev/null	Mon Apr 30 16:30:45 2007
+++ xoops2jp/html/modules/legacy/actions/NotifyCancelAction.class.php	Mon Apr 30 16:30:45 2007
@@ -0,0 +1,22 @@
+<?php
+/**
+ * @package Legacy
+ * @version $Id: NotifyCancelAction.class.php,v 1.1.4.1 2007/04/30 07:30:45 nobunobu Exp $
+ */
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+class Legacy_NotifyCancelAction extends Legacy_Action
+{
+	function getDefaultView(&$contoller, &$xoopsUser)
+	{
+		$contoller->executeForward(XOOPS_URL . '/');
+	}
+
+	function execute(&$contoller, &$xoopsUser)
+	{
+		$contoller->executeForward(XOOPS_URL . '/');
+	}
+}
+
+?>
Index: xoops2jp/html/modules/legacy/actions/NotifyDeleteAction.class.php
diff -u /dev/null xoops2jp/html/modules/legacy/actions/NotifyDeleteAction.class.php:1.1.4.1
--- /dev/null	Mon Apr 30 16:30:45 2007
+++ xoops2jp/html/modules/legacy/actions/NotifyDeleteAction.class.php	Mon Apr 30 16:30:45 2007
@@ -0,0 +1,87 @@
+<?php
+/**
+ * @package Legacy
+ * @version $Id: NotifyDeleteAction.class.php,v 1.1.4.1 2007/04/30 07:30:45 nobunobu Exp $
+ */
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_ROOT_PATH . "/include/notification_functions.php";
+
+require_once XOOPS_MODULE_PATH . "/legacy/forms/NotifyDeleteForm.class.php";
+
+/**
+ * List up notifications. This action is like notifications.php (when $op is
+ * 'list').
+ */
+class Legacy_NotifyDeleteAction extends Legacy_Action
+{
+	var $mModules = array();
+	var $mActionForm = null;
+	
+	var $mErrorMessage = null;
+	
+	function prepare(&$controller, &$xoopsUser)
+	{
+		$controller->mRoot->mLanguageManager->loadPageTypeMessageCatalog('notification');
+		$controller->mRoot->mLanguageManager->loadModuleMessageCatalog('legacy');
+		
+		$this->mActionForm =& new Legacy_NotifyDeleteForm();
+		$this->mActionForm->prepare();
+	}
+
+	function hasPermission(&$controller, &$xoopsUser)
+	{
+		return is_object($xoopsUser);
+	}
+
+	/**
+	 * This member function is a special case. Because the confirm is must, it
+	 * uses token error for displaying confirm.
+	 */	
+	function execute(&$contoller, &$xoopsUser)
+	{
+		$this->mActionForm->fetch();
+		$this->mActionForm->validate();
+		
+		//
+		// If input values are error, the action form returns fatal error flag.
+		// If it's not fatal, display confirm form.
+		//
+		if ($this->mActionForm->hasError()) {
+			return $this->mActionForm->mFatalError ? LEGACY_FRAME_VIEW_ERROR : LEGACY_FRAME_VIEW_INPUT;
+		}
+
+		//
+		// Execute deleting.
+		//
+		$successFlag = true;
+		$handler =& xoops_gethandler('notification');
+		foreach ($this->mActionForm->mNotifiyIds as $t_idArr) {
+			$t_notify =& $handler->get($t_idArr['id']);
+			if (is_object($t_notify) && $t_notify->get('not_uid') == $xoopsUser->get('uid') && $t_notify->get('not_modid') == $t_idArr['modid']) {
+				$successFlag = $successFlag & $handler->delete($t_notify);
+			}
+		}
+		
+		return $successFlag ? LEGACY_FRAME_VIEW_SUCCESS : LEGACY_FRAME_VIEW_ERROR;
+	}
+		
+	function executeViewInput(&$controller, &$xoopsUser, &$render)
+	{
+		$render->setTemplateName("legacy_notification_delete.html");
+		$render->setAttribute('actionForm', $this->mActionForm);
+	}
+
+	function executeViewSuccess(&$controller, &$xoopsUser, &$render)
+	{
+		$controller->executeForward(XOOPS_URL . "/notifications.php");
+	}
+
+	function executeViewError(&$controller, &$xoopsUser, &$render)
+	{
+		$controller->executeRedirect(XOOPS_URL . "/notifications.php", 2, _NOT_NOTHINGTODELETE);
+	}
+}
+
+?>
Index: xoops2jp/html/modules/legacy/actions/NotifyListAction.class.php
diff -u /dev/null xoops2jp/html/modules/legacy/actions/NotifyListAction.class.php:1.1.4.1
--- /dev/null	Mon Apr 30 16:30:45 2007
+++ xoops2jp/html/modules/legacy/actions/NotifyListAction.class.php	Mon Apr 30 16:30:45 2007
@@ -0,0 +1,152 @@
+<?php
+/**
+ * @package Legacy
+ * @version $Id: NotifyListAction.class.php,v 1.1.4.1 2007/04/30 07:30:45 nobunobu Exp $
+ */
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_ROOT_PATH . "/include/notification_functions.php";
+
+require_once XOOPS_MODULE_PATH . "/legacy/forms/NotifyDeleteForm.class.php";
+
+/**
+ * List up notifications. This action is like notifications.php (when $op is
+ * 'list').
+ */
+class Legacy_NotifyListAction extends Legacy_Action
+{
+	var $mModules = array();
+	var $mActionForm = null;
+	
+	function prepare(&$controller, &$xoopsUser)
+	{
+		$root =& $controller->mRoot;
+		$root->mLanguageManager->loadPageTypeMessageCatalog('notification');
+		$root->mLanguageManager->loadModuleMessageCatalog('legacy');
+		
+		$this->mActionForm =& new Legacy_NotifyDeleteForm();
+		$this->mActionForm->prepare();
+	}
+	
+	function hasPermission(&$controller, &$xoopsUser)
+	{
+		return is_object($xoopsUser);
+	}
+
+	function getDefaultView(&$contoller, &$xoopsUser)
+	{
+		$criteria =& new Criteria('not_uid', $xoopsUser->get('uid'));
+		$criteria->setSort('not_modid, not_category, not_itemid');
+		
+		$handler =& xoops_gethandler('notification');
+		$notificationArr =& $handler->getObjects($criteria);
+
+		$moduleHandler =& xoops_gethandler('module');
+		
+		$prev_modid = -1;
+		$prev_category = -1;
+		$prev_item = -1;
+		foreach ($notificationArr as $notify) {
+			$t_modid = $notify->get('not_modid');
+			
+			$module =& $moduleHandler->get($t_modid);
+			if (!is_object($module)) {
+				continue;
+			}
+			
+			if ($t_modid != $prev_modid) {
+				$prev_modid = $t_modid;
+				$prev_category = -1;
+				$prev_item = -1;
+				
+				$this->mModules[$t_modid] = array (
+					'id' => $t_modid,
+					'name' => $module->getShow('name'),
+					'categories' => array()
+				);
+
+
+				//
+				// [ToDo] (Original)
+				// note, we could auto-generate the url from the id
+				// and category info... (except when category has multiple
+				// subscription scripts defined...)
+				// OR, add one more option to xoops_version 'view_from'
+				// which tells us where to redirect... BUT, e.g. forums, it
+				// still wouldn't give us all the required info... e.g. the
+				// topic ID doesn't give us the ID of the forum which is
+				// a required argument...
+				
+				//
+				// Get the lookup function, if exists
+				//
+				$notifyConfig = $module->getInfo('notification');
+				$lookupFunc = '';
+				if (!empty($notifyConfig['lookup_file'])) {
+					$t_filepath = XOOPS_ROOT_PATH . '/modules/' . $module->get('dirname') . '/' . $notifyConfig['lookup_file'];
+					if (file_exists($t_filepath)) {
+						require_once $t_filepath;
+						if (!empty($notifyConfig['lookup_func']) && function_exists($notifyConfig['lookup_func'])) {
+							$lookupFunc = $notifyConfig['lookup_func'];
+						}
+					}
+				}
+			}
+			
+			$t_category = $notify->get('not_category');
+			if ($t_category != $prev_category) {
+				$prev_category = $t_category;
+				$prev_item = -1;
+				$categoryInfo =& notificationCategoryInfo($t_category, $t_modid);
+			}
+			
+			$t_item = $notify->get('not_itemid');
+			if ($t_item != $prev_item) {
+				$prev_item = $t_item;
+				if (!empty($lookupFunc)) {
+					$itemInfo = $lookupFunc($t_category, $t_item);
+				}
+				else {
+					$itemInfo = array ('name' => '[' . _NOT_NAMENOTAVAILABLE . ']', 'url' => '');
+				}
+				$this->mModules[$t_modid]['categories'][$t_category]['items'][$t_item] = array(
+					'id' => $t_item,
+					'name' => $itemInfo['name'],
+					'url' => $itemInfo['url'],
+					'notifications' => array()
+				);
+			}
+			
+			$eventInfo =& notificationEventInfo($t_category, $notify->get('not_event'), $notify->get('not_modid'));
+			$this->mModules[$t_modid]['categories'][$t_category]['items'][$t_item]['notifications'][] = array(
+				'id' => $notify->get('not_id'),
+				'module_id' => $notify->get('not_modid'),
+				'category' => $notify->get('not_category'),
+				'category_title' => $categoryInfo['title'],
+				'item_id' => $notify->get('not_itemid'),
+				'event' => $notify->get('not_event'),
+				'event_title' => $eventInfo['title'],
+				'user_id' => $notify->get('not_uid')
+			);
+		}
+		
+		return LEGACY_FRAME_VIEW_INDEX;
+	}
+
+	function executeViewIndex(&$controller, &$xoopsUser, &$render)
+	{
+		$render->setTemplateName("legacy_notification_list.html");
+		
+		$render->setAttribute('modules', $this->mModules);
+		$render->setAttribute('currentUser', $xoopsUser);
+		$render->setAttribute('actionForm', $this->mActionForm);
+	}
+
+	function executeViewError(&$controller, &$xoopsUser, &$render)
+	{
+		$controller->executeForward("./index.php?Action=ImageList");
+	}
+}
+
+?>
Index: xoops2jp/html/modules/legacy/actions/SearchAction.class.php
diff -u /dev/null xoops2jp/html/modules/legacy/actions/SearchAction.class.php:1.1.4.1
--- /dev/null	Mon Apr 30 16:30:45 2007
+++ xoops2jp/html/modules/legacy/actions/SearchAction.class.php	Mon Apr 30 16:30:45 2007
@@ -0,0 +1,54 @@
+<?php
+/**
+ * @package Legacy
+ * @version $Id: SearchAction.class.php,v 1.1.4.1 2007/04/30 07:30:45 nobunobu Exp $
+ */
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_MODULE_PATH . "/legacy/actions/SearchResultsAction.class.php";
+require_once XOOPS_MODULE_PATH . "/legacy/forms/SearchResultsForm.class.php";
+
+class Legacy_SearchAction extends Legacy_SearchResultsAction
+{
+	function getDefaultView(&$controller, &$xoopsUser)
+	{
+		$root =& $controller->mRoot;
+		$service =& $root->mServiceManager->getService("LegacySearch");
+		if (is_object($service)) {
+			$client =& $root->mServiceManager->createClient($service);
+
+			$this->mModules = $client->call('getActiveModules', array());
+		}
+		
+		return LEGACY_FRAME_VIEW_INDEX;
+	}
+	
+	function _getSelectedMids()
+	{
+		$ret = array();
+		foreach(array_keys($this->mModules) as $key) {
+			$ret[] = $this->mModules[$key]['mid'];
+		}
+		
+		return $ret;
+	}
+	
+	function executeViewIndex(&$controller, &$xoopsUser, &$render)
+	{
+		$render->setTemplateName("legacy_search_form.html");
+	
+		$render->setAttribute('actionForm', $this->mActionForm);
+			
+		$render->setAttribute('moduleArr', $this->mModules);
+
+		//
+		// If the request include $mids, setAttribute it. If it don't include, 
+		// setAttribute $mid or $this->mModules.
+		//		
+		$render->setAttribute('selectedMidArr', $this->_getSelectedMids());
+		$render->setAttribute('searchRuleMessage', @sprintf(_SR_KEYTOOSHORT, $this->mConfig['keyword_min']));
+	}
+}
+
+?>
Index: xoops2jp/html/modules/legacy/actions/SearchResultsAction.class.php
diff -u /dev/null xoops2jp/html/modules/legacy/actions/SearchResultsAction.class.php:1.1.4.1
--- /dev/null	Mon Apr 30 16:30:45 2007
+++ xoops2jp/html/modules/legacy/actions/SearchResultsAction.class.php	Mon Apr 30 16:30:45 2007
@@ -0,0 +1,154 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_MODULE_PATH . "/legacy/forms/SearchResultsForm.class.php";
+
+define('LEGACY_SEARCH_RESULT_MAXHIT', 5);
+define('LEGACY_SEARCH_SHOWALL_MAXHIT', 20);
+
+class Legacy_SearchResultsAction extends Legacy_Action
+{
+	var $mActionForm = null;
+	var $mSearchResults = array();
+	var $mModules = array();
+	
+	var $mConfig = array();
+	
+	function prepare(&$controller, &$xoopsUser)
+	{
+		$root =& $controller->mRoot;
+		$root->mLanguageManager->loadPageTypeMessageCatalog('search');
+		$root->mLanguageManager->loadModuleMessageCatalog('legacy');
+		
+		$handler =& xoops_gethandler('config');
+		$this->mConfig =& $handler->getConfigsByCat(XOOPS_CONF_SEARCH);
+		
+		$this->_setupActionForm();
+	}
+	
+	function _setupActionForm()
+	{
+		$this->mActionForm =& new Legacy_SearchResultsForm($this->mConfig['keyword_min']);
+		$this->mActionForm->prepare();
+	}
+	
+	function hasPermission(&$controller, &$xoopsUser)
+	{
+		if ($this->mConfig['enable_search'] != 1) {
+			$controller->executeRedirect(XOOPS_URL . '/', 3, _MD_LEGACY_ERROR_SEARCH_NOT_ENABLED);
+			return false;
+		}
+		return true;
+	}
+	
+	function _getMaxHit()
+	{
+		return LEGACY_SEARCH_RESULT_MAXHIT;
+	}
+	
+	function getDefaultView(&$controller, &$xoopsUser)
+	{
+		$root =& $controller->mRoot;
+		$service =& $root->mServiceManager->getService("LegacySearch");
+		
+		if (is_object($service)) {
+			$client =& $root->mServiceManager->createClient($service);
+			$this->mModules = $client->call('getActiveModules', array());
+		}
+		
+		$this->mActionForm->fetch();
+		$this->mActionForm->validate();
+		
+		if ($this->mActionForm->hasError()) {
+			return LEGACY_FRAME_VIEW_INDEX;
+		}
+
+		//
+		// TODO ErrorHandling
+		//
+		if (is_object($service)) {
+			$this->mActionForm->update($params);
+			
+			$handler =& xoops_gethandler('module');
+			foreach ($this->_getSelectedMids() as $mid) {
+				$t_module =& $handler->get($mid);
+				if (is_object($t_module)) {
+					$module = array();
+					
+					$module['mid'] = $mid;
+					$module['name'] = $t_module->get('name');
+					
+					$params['mid'] = $mid;
+					$module['results'] = $this->_doSearch($client, $xoopsUser, $params);
+					
+					if (count($module['results']) > 0) {
+						$module['has_more'] = (count($module['results']) >= $this->_getMaxHit()) ? true : false;
+						$this->mSearchResults[] = $module;
+					}
+				}
+			}
+		}
+		else {
+			return LEGACY_FRAME_VIEW_ERROR;
+		}
+
+		return LEGACY_FRAME_VIEW_INDEX;
+	}
+	
+	function _doSearch(&$client, &$xoopsUser, &$params)
+	{
+		$root =& XCube_Root::getSingleton();
+		$timezone = $root->mContext->getXoopsConfig('server_TZ') * 3600;
+		
+		$results = $client->call('searchItems', $params);
+		
+		return $results;
+	}
+	
+	function execute(&$controller, &$xoopsUser)
+	{
+		return $this->getDefaultView($controller, $xoopsUser);
+	}
+	
+	function executeViewIndex(&$controller, &$xoopsUser, &$render)
+	{
+		$render->setTemplateName($this->_getTemplateName());
+	
+		$render->setAttribute('actionForm', $this->mActionForm);
+			
+		$render->setAttribute('searchResults', $this->mSearchResults);
+		$render->setAttribute('moduleArr', $this->mModules);
+
+		//
+		// If the request include $mids, setAttribute it. If it don't include, 
+		// setAttribute $mid or $this->mModules.
+		//		
+		$render->setAttribute('selectedMidArr', $this->_getSelectedMids());
+		$render->setAttribute('searchRuleMessage', @sprintf(_SR_KEYTOOSHORT, $this->mConfig['keyword_min']));
+	}
+	
+	function _getTemplateName()
+	{
+		return "legacy_search_results.html";
+	}
+	
+	function _getSelectedMids()
+	{
+		$ret = $this->mActionForm->get('mids');
+		if (!count($ret)) {
+			foreach ($this->mModules as $module) {
+				$ret[] = $module['mid'];
+			}
+		}
+		
+		return $ret;
+	}
+
+	function executeViewError(&$controller, &$xoopsUser, &$render)
+	{
+		$controller->executeForward(XOOPS_URL . '/');
+	}
+}
+
+?>
Index: xoops2jp/html/modules/legacy/actions/SearchShowallAction.class.php
diff -u /dev/null xoops2jp/html/modules/legacy/actions/SearchShowallAction.class.php:1.1.4.1
--- /dev/null	Mon Apr 30 16:30:45 2007
+++ xoops2jp/html/modules/legacy/actions/SearchShowallAction.class.php	Mon Apr 30 16:30:45 2007
@@ -0,0 +1,52 @@
+<?php
+/**
+ * @package Legacy
+ * @version $Id: SearchShowallAction.class.php,v 1.1.4.1 2007/04/30 07:30:45 nobunobu Exp $
+ */
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_MODULE_PATH . "/legacy/actions/SearchResultsAction.class.php";
+require_once XOOPS_MODULE_PATH . "/legacy/forms/SearchShowallForm.class.php";
+
+class Legacy_SearchShowallAction extends Legacy_SearchResultsAction
+{
+	function _setupActionForm()
+	{
+		$this->mActionForm =& new Legacy_SearchShowallForm($this->mConfig['keyword_min']);
+		$this->mActionForm->prepare();
+	}
+	
+	function _getTemplateName()
+	{
+		return "legacy_search_showall.html";
+	}
+	
+	function _getSelectedMids()
+	{
+		$ret = array();
+		$ret[] = $this->mActionForm->get('mid');
+		
+		return $ret;
+	}
+	
+	function _getMaxHit()
+	{
+		return LEGACY_SEARCH_SHOWALL_MAXHIT;
+	}
+	
+	function executeViewIndex(&$controller, &$xoopsUser, &$render)
+	{
+		parent::executeViewIndex($controller, $xoopsUser, $render);
+		
+		$prevStart = $this->mActionForm->get('start') - LEGACY_SEARCH_SHOWALL_MAXHIT;
+		if ($prevStart < 0) {
+			$prevStart = 0;
+		}
+		
+		$render->setAttribute('prevStart', $prevStart);
+		$render->setAttribute('nextStart', $this->mActionForm->get('start') + LEGACY_SEARCH_SHOWALL_MAXHIT);
+	}
+}
+
+?>
Index: xoops2jp/html/modules/legacy/actions/SearchShowallbyuserAction.class.php
diff -u /dev/null xoops2jp/html/modules/legacy/actions/SearchShowallbyuserAction.class.php:1.1.4.1
--- /dev/null	Mon Apr 30 16:30:45 2007
+++ xoops2jp/html/modules/legacy/actions/SearchShowallbyuserAction.class.php	Mon Apr 30 16:30:45 2007
@@ -0,0 +1,54 @@
+<?php
+/**
+ * @package Legacy
+ * @version $Id: SearchShowallbyuserAction.class.php,v 1.1.4.1 2007/04/30 07:30:45 nobunobu Exp $
+ */
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_MODULE_PATH . "/legacy/actions/SearchShowallAction.class.php";
+require_once XOOPS_MODULE_PATH . "/legacy/forms/SearchShowallbyuserForm.class.php";
+
+class Legacy_SearchShowallbyuserAction extends Legacy_SearchShowallAction
+{
+	function _setupActionForm()
+	{
+		$this->mActionForm =& new Legacy_SearchShowallbyuserForm(0);
+		$this->mActionForm->prepare();
+	}
+	
+	function _getTemplateName()
+	{
+		return "legacy_search_showallbyuser.html";
+	}
+	
+	function _getSelectedMids()
+	{
+		$ret = array();
+		$ret[] = $this->mActionForm->get('mid');
+		
+		return $ret;
+	}
+	
+	function _doSearch(&$client, &$xoopsUser, &$params)
+	{
+		return $client->call('searchItemsOfUser', $params);
+	}
+
+	function _getMaxHit()
+	{
+		return LEGACY_SEARCH_SHOWALL_MAXHIT;
+	}
+	
+	function executeViewIndex(&$controller, &$xoopsUser, &$render)
+	{
+		parent::executeViewIndex($controller, $xoopsUser, $render);
+		
+		$handler =& xoops_gethandler('user');
+		$user =& $handler->get($this->mActionForm->get('uid'));
+		
+		$render->setAttribute('targetUser', $user);
+	}
+}
+
+?>
Index: xoops2jp/html/modules/legacy/actions/index.html
diff -u /dev/null xoops2jp/html/modules/legacy/actions/index.html:1.1.4.1
--- /dev/null	Mon Apr 30 16:30:45 2007
+++ xoops2jp/html/modules/legacy/actions/index.html	Mon Apr 30 16:30:45 2007
@@ -0,0 +1 @@
+ <script>history.go(-1);</script>
\ No newline at end of file


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