Minahito
minah****@users*****
2006年 1月 29日 (日) 00:49:28 JST
Index: xoops2jp/html/modules/base/admin/forms/SmilesFilterForm.class.php diff -u /dev/null xoops2jp/html/modules/base/admin/forms/SmilesFilterForm.class.php:1.1.2.1 --- /dev/null Sun Jan 29 00:49:28 2006 +++ xoops2jp/html/modules/base/admin/forms/SmilesFilterForm.class.php Sun Jan 29 00:49:28 2006 @@ -0,0 +1,56 @@ +<?php + +require_once XOOPS_MODULE_PATH . "/base/class/AbstractFilterForm.class.php"; + +define('SMILES_SORT_KEY_DEFAULT', 0); +define('SMILES_SORT_KEY_ID', 1); +define('SMILES_SORT_KEY_CODE', 2); +define('SMILES_SORT_KEY_SMILE_URL', 3); +define('SMILES_SORT_KEY_EMOTION', 4); +define('SMILES_SORT_KEY_DISPLAY', 5); +define('SMILES_SORT_KEY_MAXVALUE', 5); + +class Legacy_SmilesFilterForm extends Legacy_AbstractFilterForm +{ + var $mSort = 0; + var $_mSortKeys = array( + SMILES_SORT_KEY_DEFAULT => 'id', + SMILES_SORT_KEY_ID => 'id', + SMILES_SORT_KEY_CODE => 'code', + SMILES_SORT_KEY_SMILE_URL => 'smile_url', + SMILES_SORT_KEY_EMOTION => 'emotion', + SMILES_SORT_KEY_DISPLAY => 'display' + ); + var $_mCriteria = null; + + function fetch() + { + $this->mSort = isset($_REQUEST['sort']) ? intval($_REQUEST['sort']) : 0; + + if ($this->mSort > SMILES_SORT_KEY_MAXVALUE) { + $this->mSort = SMILES_SORT_KEY_DEFAULT; + } + + if (isset($_REQUEST['id'])) { + $this->_mCriteria->add(new Criteria('id', array(XOBJ_DTYPE_INT, xoops_getrequest('id')))); + } + + if (isset($_REQUEST['code'])) { + $this->_mCriteria->add(new Criteria('code', array(XOBJ_DTYPE_STRING, xoops_getrequest('code')))); + } + + if (isset($_REQUEST['smile_url'])) { + $this->_mCriteria->add(new Criteria('smile_url', array(XOBJ_DTYPE_STRING, xoops_getrequest('smile_url')))); + } + + if (isset($_REQUEST['emotion'])) { + $this->_mCriteria->add(new Criteria('emotion', array(XOBJ_DTYPE_STRING, xoops_getrequest('emotion')))); + } + + if (isset($_REQUEST['display'])) { + $this->_mCriteria->add(new Criteria('display', array(XOBJ_DTYPE_BOOL, xoops_getrequest('display')))); + } + } +} + +?> Index: xoops2jp/html/modules/base/admin/forms/SmilesAdminEditForm.class.php diff -u /dev/null xoops2jp/html/modules/base/admin/forms/SmilesAdminEditForm.class.php:1.1.2.1 --- /dev/null Sun Jan 29 00:49:28 2006 +++ xoops2jp/html/modules/base/admin/forms/SmilesAdminEditForm.class.php Sun Jan 29 00:49:28 2006 @@ -0,0 +1,86 @@ +<?php + +require_once XOOPS_ROOT_PATH . "/class/XCube_ActionForm.class.php"; + +class Legacy_SmilesAdminEditForm extends XCube_ActionForm +{ + var $mOldFileName = null; + var $_mIsNew = null; + var $mFormFile = null; + + function getTokenName() + { + return "module.base.SmilesAdminEditForm.TOKEN"; + } + + function prepare() + { + // + // Set form properties + // + $this->mFormProperties['id'] =& new XCube_IntProperty('id'); + $this->mFormProperties['code'] =& new XCube_StringProperty('code'); + $this->mFormProperties['smile_url'] =& new XCube_ImageFileProperty('smile_url'); + $this->mFormProperties['emotion'] =& new XCube_StringProperty('emotion'); + $this->mFormProperties['display'] =& new XCube_BoolProperty('display'); + + // + // Set field properties + // + + $this->mFieldProperties['id'] =& new XCube_FieldProperty($this); + $this->mFieldProperties['id']->setDependsByArray(array('required')); + $this->mFieldProperties['id']->addMessage('required', _AD_BASE_ERROR_REQUIRED, _AD_BASE_LANG_ID); + + $this->mFieldProperties['code'] =& new XCube_FieldProperty($this); + $this->mFieldProperties['code']->setDependsByArray(array('required','maxlength')); + $this->mFieldProperties['code']->addMessage('required', _AD_BASE_ERROR_REQUIRED, _AD_BASE_LANG_CODE, '50'); + $this->mFieldProperties['code']->addMessage('maxlength', _AD_BASE_ERROR_MAXLENGTH, _AD_BASE_LANG_CODE, '50'); + $this->mFieldProperties['code']->addVar('maxlength', '50'); + + $this->mFieldProperties['smile_url'] =& new XCube_FieldProperty($this); + $this->mFieldProperties['smile_url']->setDependsByArray(array('extension')); + $this->mFieldProperties['smile_url']->addMessage('extension', _AD_BASE_ERROR_EXTENSION); + $this->mFieldProperties['smile_url']->addVar('extension', 'jpg,gif,png'); + + $this->mFieldProperties['emotion'] =& new XCube_FieldProperty($this); + $this->mFieldProperties['emotion']->setDependsByArray(array('required','maxlength')); + $this->mFieldProperties['emotion']->addMessage('required', _AD_BASE_ERROR_REQUIRED, _AD_BASE_LANG_EMOTION, '75'); + $this->mFieldProperties['emotion']->addMessage('maxlength', _AD_BASE_ERROR_MAXLENGTH, _AD_BASE_LANG_EMOTION, '75'); + $this->mFieldProperties['emotion']->addVar('maxlength', '75'); + } + + function validateSmile_url() + { + if ($this->_mIsNew && $this->get('smile_url') == null) { + $this->addErrorMessage(_AD_BASE_ERROR_SMILE_URL_REQUIED); + } + } + + function load(&$obj) + { + $this->set('id', $obj->get('id')); + $this->set('code', $obj->get('code')); + $this->set('emotion', $obj->get('emotion')); + $this->set('display', $obj->get('display')); + + $this->_mIsNew = $obj->isNew(); + $this->mOldFileName = $obj->get('smile_url'); + } + + function update(&$obj) + { + $obj->set('id', $this->get('id')); + $obj->set('code', $this->get('code')); + $obj->set('emotion', $this->get('emotion')); + $obj->set('display', $this->get('display')); + + $this->mFormFile = $this->get('smile_url'); + if ($this->mFormFile != null) { + $this->mFormFile->setRandomToBodyName('smil'); // Fix your prefix + $obj->set('smile_url', $this->mFormFile->getFileName()); + } + } +} + +?> Index: xoops2jp/html/modules/base/admin/forms/SmilesAdminDeleteForm.class.php diff -u /dev/null xoops2jp/html/modules/base/admin/forms/SmilesAdminDeleteForm.class.php:1.1.2.1 --- /dev/null Sun Jan 29 00:49:28 2006 +++ xoops2jp/html/modules/base/admin/forms/SmilesAdminDeleteForm.class.php Sun Jan 29 00:49:28 2006 @@ -0,0 +1,39 @@ +<?php + +require_once XOOPS_ROOT_PATH . "/class/XCube_ActionForm.class.php"; + +class Legacy_SmilesAdminDeleteForm extends XCube_ActionForm +{ + function getTokenName() + { + return "module.base.SmilesAdminDeleteForm.TOKEN"; + } + + function prepare() + { + // + // Set form properties + // + $this->mFormProperties['id'] =& new XCube_IntProperty('id'); + + // + // Set field properties + // + + $this->mFieldProperties['id'] =& new XCube_FieldProperty($this); + $this->mFieldProperties['id']->setDependsByArray(array('required')); + $this->mFieldProperties['id']->addMessage('required', _AD_BASE_ERROR_REQUIRED, _AD_BASE_LANG_ID); + } + + function load(&$obj) + { + $this->set('id', $obj->get('id')); + } + + function update(&$obj) + { + $obj->set('id', $this->get('id')); + } +} + +?>