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

Back to archive index

Minahito minah****@users*****
2006年 5月 25日 (木) 18:28:50 JST


Index: xoops2jp/html/modules/base/actions/ImageListAction.class.php
diff -u /dev/null xoops2jp/html/modules/base/actions/ImageListAction.class.php:1.1.2.1
--- /dev/null	Thu May 25 18:28:50 2006
+++ xoops2jp/html/modules/base/actions/ImageListAction.class.php	Thu May 25 18:28:50 2006
@@ -0,0 +1,91 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_MODULE_PATH . "/base/class/PageNavigator.class.php";
+require_once XOOPS_MODULE_PATH . "/base/class/AbstractListAction.class.php";
+require_once XOOPS_MODULE_PATH . "/base/forms/ImageFilterForm.class.php";
+
+class Legacy_ImageListAction extends Legacy_AbstractListAction
+{
+	var $mImgcatId = null;
+	
+	function prepare(&$controller, &$xoopsUser)
+	{
+		$controller->setDialogMode(true);
+	}
+	
+	function &_getHandler()
+	{
+		$handler =& xoops_getmodulehandler('image');
+		return $handler;
+	}
+
+	function &_getFilterForm(&$navi)
+	{
+		$filter =& new Legacy_ImageFilterForm($navi);
+		return $filter;
+	}
+
+	function _getBaseUrl()
+	{
+		return "./index.php?action=ImageList";
+	}
+	
+	function getDefaultView(&$contoller, &$xoopsUser)
+	{
+		$result = parent::getDefaultView($controller, $xoopsUser);
+		if ($result == LEGACY_FRAME_VIEW_INDEX) {
+			$this->mImgcatId = xoops_getrequest('imgcat_id');
+			$handler =& xoops_getmodulehandler('imagecategory');
+			$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->mNavi);
+		
+		$render->setAttribute('imgcatId', $this->mImgcatId);
+		
+		$handler =& xoops_getmodulehandler('imagecategory');
+		
+		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/base/actions/ImageUploadAction.class.php
diff -u /dev/null xoops2jp/html/modules/base/actions/ImageUploadAction.class.php:1.1.2.1
--- /dev/null	Thu May 25 18:28:50 2006
+++ xoops2jp/html/modules/base/actions/ImageUploadAction.class.php	Thu May 25 18:28:50 2006
@@ -0,0 +1,77 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_MODULE_PATH . "/base/admin/actions/ImageEditAction.class.php";
+require_once XOOPS_MODULE_PATH . "/base/forms/ImageUploadForm.class.php";
+
+class Legacy_ImageUploadAction extends Legacy_ImageEditAction
+{
+	var $mCategory = null;
+
+	function prepare(&$controller, &$xoopsUser)
+	{
+		parent::prepare($controller, $xoopsUser);
+		$controller->setDialogMode(true);
+	}
+	
+	function &_getHandler()
+	{
+		$handler =& xoops_getmodulehandler('image');
+		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 hasPerm(&$controller, &$xoopsUser)
+	{
+		$groups = array();
+		if (is_object($xoopsUser)) {
+			$groups =& $xoopsUser->getGroups();
+		}
+		else {
+			$groups = array(XOOPS_GROUP_ANONYMOUS);
+		}
+			
+		$handler =& xoops_getmodulehandler('imagecategory');
+		$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("./index.php?action=ImageList&imgcat_id=" . $this->mActionForm->get('imgcat_id') . "&target=" . xoops_getrequest('target'));
+	}
+
+	function executeViewError(&$controller, &$xoopsUser, &$render)
+	{
+		redirect_header("./index.php?action=ImageList", 1, _MD_BASE_ERROR_DBUPDATE_FAILED);
+	}
+}
+
+?>


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