[xoops-cvslog 3004] CVS update: xoops2jp/html/modules/base/admin/forms

Zurück zum Archiv-Index

Minahito minah****@users*****
2006年 5月 12日 (金) 19:14:22 JST


Index: xoops2jp/html/modules/base/admin/forms/PreferenceEditForm.class.php
diff -u /dev/null xoops2jp/html/modules/base/admin/forms/PreferenceEditForm.class.php:1.1.2.1
--- /dev/null	Fri May 12 19:14:22 2006
+++ xoops2jp/html/modules/base/admin/forms/PreferenceEditForm.class.php	Fri May 12 19:14:22 2006
@@ -0,0 +1,142 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_ROOT_PATH . "/class/XCube_ActionForm.class.php";
+
+class Legacy_PreferenceEditForm extends XCube_ActionForm
+{
+	var $mKeyName = "confcat_id";
+	var $mKeyValue = 0;
+	
+	function Legacy_PreferenceEditForm(&$category)
+	{
+		parent::XCube_ActionForm();
+		$this->mKeyValue = $category->get('confcat_id');
+	}
+	
+	function getTokenName()
+	{
+		return "module.base.PreferenceEditForm.TOKEN" . $this->mId;
+	}
+	
+	function getCategoryId()
+	{
+		return $this->mKeyValue;
+	}
+
+	function getModuleId()
+	{
+		return 0;
+	}
+
+	function prepare(&$configArr)
+	{
+		//
+		// Set form properties
+		//
+		foreach ($configArr as $config) {
+			switch ($config->get('conf_valuetype')) {
+				case 'text':
+					if ($config->get('conf_formtype') == 'textarea') {
+						$this->mFormProperties[$config->get('conf_name')] =& new XCube_TextProperty($config->get('conf_name'));
+					}
+					else {
+						$this->mFormProperties[$config->get('conf_name')] =& new XCube_StringProperty($config->get('conf_name'));
+					}
+					$this->set($config->get('conf_name'), $config->get('conf_value'));
+					break;
+
+				case 'float':
+					$this->mFormProperties[$config->get('conf_name')] =& new XCube_FloatProperty($config->get('conf_name'));
+					$this->set($config->get('conf_name'), $config->get('conf_value'));
+					
+					$this->mFieldProperties[$config->get('conf_name')] =& new XCube_FieldProperty($this);
+					$this->mFieldProperties[$config->get('conf_name')]->setDependsByArray(array('required'));
+					$this->mFieldProperties[$config->get('conf_name')]->addMessage('required', _AD_BASE_ERROR_REQUIRED, $config->get('conf_title'));
+					break;
+
+				case 'int':
+					$this->mFormProperties[$config->get('conf_name')] =& new XCube_IntProperty($config->get('conf_name'));
+					$this->set($config->get('conf_name'), $config->get('conf_value'));
+					
+					$this->mFieldProperties[$config->get('conf_name')] =& new XCube_FieldProperty($this);
+					$this->mFieldProperties[$config->get('conf_name')]->setDependsByArray(array('required'));
+					$this->mFieldProperties[$config->get('conf_name')]->addMessage('required', _AD_BASE_ERROR_REQUIRED, $config->get('conf_title'));
+					break;
+					
+				case 'other':
+					$this->mFormProperties[$config->get('conf_name')] =& new XCube_StringProperty($config->get('conf_name'));
+					$this->set($config->get('conf_name'), $config->get('conf_value'));
+					break;
+
+				case 'array':
+					if($config->get('conf_formtype') == 'textarea') {
+						$this->mFormProperties[$config->get('conf_name')] =& new XCube_StringProperty($config->get('conf_name'));
+						$this->set($config->get('conf_name'), implode("|", unserialize($config->get('conf_value'))));
+					}
+					else {
+						$this->mFormProperties[$config->get('conf_name')] =& new XCube_StringArrayProperty($config->get('conf_name'));
+						$t_arr = unserialize($config->get('conf_value'));
+						foreach ($t_arr as $_key => $_value) {
+							$this->set($config->get('conf_name'), $_key, $_value);
+						}
+					}
+					break;
+			}
+		}
+	}
+
+	function getImploadValue($key)
+	{
+		$value = $this->get($key);
+		return is_array($value) ? implode("|", $value) : $value;
+	}
+	
+	function update(&$configArr)
+	{
+		foreach (array_keys($configArr) as $key) {
+			$value = $this->get($configArr[$key]->get('conf_name'));
+			
+			if ($configArr[$key]->get('conf_valuetype') == 'array') {
+				if (is_array($value)) {
+					$configArr[$key]->set('conf_value', serialize($value));
+				}
+				else {
+					$configArr[$key]->set('conf_value', serialize(explode("|", $value)));
+				}
+			}
+			else {
+				$configArr[$key]->set('conf_value', $value);
+			}
+		}
+	}
+}
+
+class Legacy_ModulePreferenceEditForm extends Legacy_PreferenceEditForm
+{
+	var $mKeyName = "confmod_id";
+
+	function Legacy_ModulePreferenceEditForm(&$module)
+	{
+		parent::XCube_ActionForm();
+		$this->mKeyValue = $module->get('mid');
+	}
+	
+	function getTokenName()
+	{
+		return "module.base.ModulePreferenceEditForm.TOKEN" . $this->mId;
+	}
+	
+	function getCategoryId()
+	{
+		return 0;
+	}
+
+	function getModuleId()
+	{
+		return $this->mKeyValue;
+	}
+}
+
+?>
Index: xoops2jp/html/modules/base/admin/forms/ImageAdminEditForm.class.php
diff -u /dev/null xoops2jp/html/modules/base/admin/forms/ImageAdminEditForm.class.php:1.1.2.1
--- /dev/null	Fri May 12 19:14:22 2006
+++ xoops2jp/html/modules/base/admin/forms/ImageAdminEditForm.class.php	Fri May 12 19:14:22 2006
@@ -0,0 +1,93 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_ROOT_PATH . "/class/XCube_ActionForm.class.php";
+require_once XOOPS_MODULE_PATH . "/base/class/Legacy_Validator.class.php";
+
+class Base_ImageAdminEditForm extends XCube_ActionForm
+{
+	function getTokenName()
+	{
+		return "module.base.ImageAdminEditForm.TOKEN";
+	}
+
+	function prepare()
+	{
+		//
+		// Set form properties
+		//
+		$this->mFormProperties['image_id'] =& new XCube_IntProperty('image_id');
+		$this->mFormProperties['image_name'] =& new XCube_StringProperty('image_name');
+		$this->mFormProperties['image_nicename'] =& new XCube_StringProperty('image_nicename');
+		$this->mFormProperties['image_mimetype'] =& new XCube_StringProperty('image_mimetype');
+		$this->mFormProperties['image_created'] =& new XCube_IntProperty('image_created');
+		$this->mFormProperties['image_display'] =& new XCube_BoolProperty('image_display');
+		$this->mFormProperties['image_weight'] =& new XCube_IntProperty('image_weight');
+		$this->mFormProperties['imgcat_id'] =& new XCube_IntProperty('imgcat_id');
+	
+		//
+		// Set field properties
+		//
+	
+		$this->mFieldProperties['image_id'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['image_id']->setDependsByArray(array('required'));
+		$this->mFieldProperties['image_id']->addMessage('required', _AD_BASE_ERROR_REQUIRED, _AD_BASE_LANG_IMAGE_ID);
+	
+		$this->mFieldProperties['image_name'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['image_name']->setDependsByArray(array('required','maxlength'));
+		$this->mFieldProperties['image_name']->addMessage('required', _AD_BASE_ERROR_REQUIRED, _AD_BASE_LANG_IMAGE_NAME, '30');
+		$this->mFieldProperties['image_name']->addMessage('maxlength', _AD_BASE_ERROR_MAXLENGTH, _AD_BASE_LANG_IMAGE_NAME, '30');
+		$this->mFieldProperties['image_name']->addVar('maxlength', '30');
+	
+		$this->mFieldProperties['image_nicename'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['image_nicename']->setDependsByArray(array('required','maxlength'));
+		$this->mFieldProperties['image_nicename']->addMessage('required', _AD_BASE_ERROR_REQUIRED, _AD_BASE_LANG_IMAGE_NICENAME, '255');
+		$this->mFieldProperties['image_nicename']->addMessage('maxlength', _AD_BASE_ERROR_MAXLENGTH, _AD_BASE_LANG_IMAGE_NICENAME, '255');
+		$this->mFieldProperties['image_nicename']->addVar('maxlength', '255');
+	
+		$this->mFieldProperties['image_mimetype'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['image_mimetype']->setDependsByArray(array('required','maxlength'));
+		$this->mFieldProperties['image_mimetype']->addMessage('required', _AD_BASE_ERROR_REQUIRED, _AD_BASE_LANG_IMAGE_MIMETYPE, '30');
+		$this->mFieldProperties['image_mimetype']->addMessage('maxlength', _AD_BASE_ERROR_MAXLENGTH, _AD_BASE_LANG_IMAGE_MIMETYPE, '30');
+		$this->mFieldProperties['image_mimetype']->addVar('maxlength', '30');
+	
+		$this->mFieldProperties['image_created'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['image_created']->setDependsByArray(array('required'));
+		$this->mFieldProperties['image_created']->addMessage('required', _AD_BASE_ERROR_REQUIRED, _AD_BASE_LANG_IMAGE_CREATED);
+	
+		$this->mFieldProperties['image_weight'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['image_weight']->setDependsByArray(array('required'));
+		$this->mFieldProperties['image_weight']->addMessage('required', _AD_BASE_ERROR_REQUIRED, _AD_BASE_LANG_IMAGE_WEIGHT);
+	
+		$this->mFieldProperties['imgcat_id'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['imgcat_id']->setDependsByArray(array('required'));
+		$this->mFieldProperties['imgcat_id']->addMessage('required', _AD_BASE_ERROR_REQUIRED, _AD_BASE_LANG_IMGCAT_ID);
+	}
+
+	function load(&$obj)
+	{
+		$this->set('image_id', $obj->get('image_id'));
+		$this->set('image_name', $obj->get('image_name'));
+		$this->set('image_nicename', $obj->get('image_nicename'));
+		$this->set('image_mimetype', $obj->get('image_mimetype'));
+		$this->set('image_created', $obj->get('image_created'));
+		$this->set('image_display', $obj->get('image_display'));
+		$this->set('image_weight', $obj->get('image_weight'));
+		$this->set('imgcat_id', $obj->get('imgcat_id'));
+	}
+
+	function update(&$obj)
+	{
+		$obj->set('image_id', $this->get('image_id'));
+		$obj->set('image_name', $this->get('image_name'));
+		$obj->set('image_nicename', $this->get('image_nicename'));
+		$obj->set('image_mimetype', $this->get('image_mimetype'));
+		$obj->set('image_created', $this->get('image_created'));
+		$obj->set('image_display', $this->get('image_display'));
+		$obj->set('image_weight', $this->get('image_weight'));
+		$obj->set('imgcat_id', $this->get('imgcat_id'));
+	}
+}
+
+?>


xoops-cvslog メーリングリストの案内
Zurück zum Archiv-Index