Minahito
minah****@users*****
2006年 4月 27日 (木) 19:24:00 JST
Index: xoops2jp/html/modules/user/admin/forms/MailjobAdminDeleteForm.class.php diff -u /dev/null xoops2jp/html/modules/user/admin/forms/MailjobAdminDeleteForm.class.php:1.1.2.1 --- /dev/null Thu Apr 27 19:24:00 2006 +++ xoops2jp/html/modules/user/admin/forms/MailjobAdminDeleteForm.class.php Thu Apr 27 19:24:00 2006 @@ -0,0 +1,42 @@ +<?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 User_MailjobAdminDeleteForm extends XCube_ActionForm +{ + function getTokenName() + { + return "module.user.MailjobAdminDeleteForm.TOKEN"; + } + + function prepare() + { + // + // Set form properties + // + $this->mFormProperties['mailjob_id'] =& new XCube_IntProperty('mailjob_id'); + + // + // Set field properties + // + + $this->mFieldProperties['mailjob_id'] =& new XCube_FieldProperty($this); + $this->mFieldProperties['mailjob_id']->setDependsByArray(array('required')); + $this->mFieldProperties['mailjob_id']->addMessage('required', _AD_USER_ERROR_REQUIRED, _AD_USER_LANG_MAILJOB_ID); + } + + function load(&$obj) + { + $this->set('mailjob_id', $obj->get('mailjob_id')); + } + + function update(&$obj) + { + $obj->set('mailjob_id', $this->get('mailjob_id')); + } +} + +?> Index: xoops2jp/html/modules/user/admin/forms/MailjobAdminSendForm.class.php diff -u /dev/null xoops2jp/html/modules/user/admin/forms/MailjobAdminSendForm.class.php:1.1.2.1 --- /dev/null Thu Apr 27 19:24:00 2006 +++ xoops2jp/html/modules/user/admin/forms/MailjobAdminSendForm.class.php Thu Apr 27 19:24:00 2006 @@ -0,0 +1,37 @@ +<?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 User_MailjobAdminSendForm extends XCube_ActionForm +{ + function getTokenName() + { + return "module.user.MailjobAdminSendForm.TOKEN"; + } + + function prepare() + { + // + // Set form properties + // + $this->mFormProperties['mailjob_id'] =& new XCube_IntProperty('mailjob_id'); + + // + // Set field properties + // + + $this->mFieldProperties['mailjob_id'] =& new XCube_FieldProperty($this); + $this->mFieldProperties['mailjob_id']->setDependsByArray(array('required')); + $this->mFieldProperties['mailjob_id']->addMessage('required', _AD_USER_ERROR_REQUIRED, _AD_USER_LANG_MAILJOB_ID); + } + + function load(&$obj) + { + $this->set('mailjob_id', $obj->get('mailjob_id')); + } +} + +?> Index: xoops2jp/html/modules/user/admin/forms/MailjobAdminEditForm.class.php diff -u /dev/null xoops2jp/html/modules/user/admin/forms/MailjobAdminEditForm.class.php:1.1.2.1 --- /dev/null Thu Apr 27 19:24:00 2006 +++ xoops2jp/html/modules/user/admin/forms/MailjobAdminEditForm.class.php Thu Apr 27 19:24:00 2006 @@ -0,0 +1,97 @@ +<?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 User_MailjobAdminEditForm extends XCube_ActionForm +{ + function getTokenName() + { + return "module.user.MailjobAdminEditForm.TOKEN" . $this->get('mailjob_id'); + } + + function prepare() + { + // + // Set form properties + // + $this->mFormProperties['mailjob_id'] =& new XCube_IntProperty('mailjob_id'); + $this->mFormProperties['title'] =& new XCube_StringProperty('title'); + $this->mFormProperties['body'] =& new XCube_TextProperty('body'); + $this->mFormProperties['from_name'] =& new XCube_StringProperty('from_name'); + $this->mFormProperties['from_email'] =& new XCube_StringProperty('from_email'); + $this->mFormProperties['is_pm'] =& new XCube_BoolProperty('is_pm'); + $this->mFormProperties['is_mail'] =& new XCube_BoolProperty('is_mail'); + + // + // Set field properties + // + + $this->mFieldProperties['mailjob_id'] =& new XCube_FieldProperty($this); + $this->mFieldProperties['mailjob_id']->setDependsByArray(array('required')); + $this->mFieldProperties['mailjob_id']->addMessage('required', _AD_USER_ERROR_REQUIRED, _AD_USER_LANG_MAILJOB_ID); + + $this->mFieldProperties['title'] =& new XCube_FieldProperty($this); + $this->mFieldProperties['title']->setDependsByArray(array('required','maxlength')); + $this->mFieldProperties['title']->addMessage('required', _AD_USER_ERROR_REQUIRED, _AD_USER_LANG_TITLE, '255'); + $this->mFieldProperties['title']->addMessage('maxlength', _AD_USER_ERROR_MAXLENGTH, _AD_USER_LANG_TITLE, '255'); + $this->mFieldProperties['title']->addVar('maxlength', '255'); + + $this->mFieldProperties['body'] =& new XCube_FieldProperty($this); + $this->mFieldProperties['body']->setDependsByArray(array('required')); + $this->mFieldProperties['body']->addMessage('required', _AD_USER_ERROR_REQUIRED, _AD_USER_LANG_BODY); + + $this->mFieldProperties['from_name'] =& new XCube_FieldProperty($this); + $this->mFieldProperties['from_name']->setDependsByArray(array('maxlength')); + $this->mFieldProperties['from_name']->addMessage('maxlength', _AD_USER_ERROR_MAXLENGTH, '255'); + $this->mFieldProperties['from_name']->addVar('maxlength', '255'); + + $this->mFieldProperties['from_email'] =& new XCube_FieldProperty($this); + $this->mFieldProperties['from_email']->setDependsByArray(array('maxlength', 'email')); + $this->mFieldProperties['from_email']->addMessage('maxlength', _AD_USER_ERROR_MAXLENGTH, '255'); + $this->mFieldProperties['from_email']->addVar('maxlength', '255'); + $this->mFieldProperties['from_email']->addMessage('email', _AD_USER_ERROR_EMAIL, _AD_USER_LANG_FROM_EMAIL); + } + + function validateFrom_email() + { + if ($this->get('is_mail') && strlen($this->get('from_email')) == 0) { + $this->addErrorMessage(XCube_Utils::formatMessage(_AD_USER_ERROR_REQUIRED, _AD_USER_LANG_FROM_EMAIL)); + } + } + + function validate() + { + parent::validate(); + + if (!$this->get('is_pm') && !$this->get('is_mail')) { + $this->addErrorMessage(_AD_USER_ERROR_MAILJOB_SEND_MEANS); + } + } + + function load(&$obj) + { + $this->set('mailjob_id', $obj->get('mailjob_id')); + $this->set('title', $obj->get('title')); + $this->set('body', $obj->get('body')); + $this->set('from_name', $obj->get('from_name')); + $this->set('from_email', $obj->get('from_email')); + $this->set('is_pm', $obj->get('is_pm')); + $this->set('is_mail', $obj->get('is_mail')); + } + + function update(&$obj) + { + $obj->set('mailjob_id', $this->get('mailjob_id')); + $obj->set('title', $this->get('title')); + $obj->set('body', $this->get('body')); + $obj->set('from_name', $this->get('from_name')); + $obj->set('from_email', $this->get('from_email')); + $obj->set('is_pm', $this->get('is_pm')); + $obj->set('is_mail', $this->get('is_mail')); + } +} + +?> Index: xoops2jp/html/modules/user/admin/forms/MailjobFilterForm.class.php diff -u /dev/null xoops2jp/html/modules/user/admin/forms/MailjobFilterForm.class.php:1.1.2.3 --- /dev/null Thu Apr 27 19:24:00 2006 +++ xoops2jp/html/modules/user/admin/forms/MailjobFilterForm.class.php Thu Apr 27 19:24:00 2006 @@ -0,0 +1,64 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +require_once XOOPS_MODULE_PATH . "/user/class/AbstractFilterForm.class.php"; + +define('MAILJOB_SORT_KEY_MAILJOB_ID', 1); +define('MAILJOB_SORT_KEY_TITLE', 2); +define('MAILJOB_SORT_KEY_BODY', 3); +define('MAILJOB_SORT_KEY_FROM_NAME', 4); +define('MAILJOB_SORT_KEY_FROM_EMAIL', 5); +define('MAILJOB_SORT_KEY_IS_PM', 6); +define('MAILJOB_SORT_KEY_IS_MAIL', 7); +define('MAILJOB_SORT_KEY_CREATE_UNIXTIME', 8); +define('MAILJOB_SORT_KEY_MAXVALUE', 8); + +define('MAILJOB_SORT_KEY_DEFAULT', -MAILJOB_SORT_KEY_CREATE_UNIXTIME); + +class User_MailjobFilterForm extends User_AbstractFilterForm +{ + var $mSort = 0; + var $mSortKeys = array( + MAILJOB_SORT_KEY_MAILJOB_ID => 'mailjob_id', + MAILJOB_SORT_KEY_TITLE => 'title', + MAILJOB_SORT_KEY_BODY => 'body', + MAILJOB_SORT_KEY_FROM_NAME => 'from_name', + MAILJOB_SORT_KEY_FROM_EMAIL => 'from_email', + MAILJOB_SORT_KEY_IS_PM => 'is_pm', + MAILJOB_SORT_KEY_IS_MAIL => 'is_mail', + MAILJOB_SORT_KEY_CREATE_UNIXTIME => 'create_unixtime' + ); + var $_mCriteria = null; + + function fetch() + { + $this->mSort = isset($_REQUEST['sort']) ? intval($_REQUEST['sort']) : MAILJOB_SORT_KEY_DEFAULT; + + if ($this->mSort > MAILJOB_SORT_KEY_MAXVALUE) { + $this->mSort = MAILJOB_SORT_KEY_DEFAULT; + } + + if (isset($_REQUEST['title'])) { + // + // TODO like + // + $this->_mNavi->addExtra('title', xoops_getrequest('title')); + $this->_mCriteria->add(new Criteria('title', array(XOBJ_DTYPE_STRING, xoops_getrequest('title')))); + } + + if (isset($_REQUEST['is_pm'])) { + $this->_mNavi->addExtra('is_pm', xoops_getrequest('is_pm')); + $this->_mCriteria->add(new Criteria('is_pm', array(XOBJ_DTYPE_BOOL, xoops_getrequest('is_pm')))); + } + + if (isset($_REQUEST['is_mail'])) { + $this->_mNavi->addExtra('is_mail', xoops_getrequest('is_mail')); + $this->_mCriteria->add(new Criteria('is_mail', array(XOBJ_DTYPE_BOOL, xoops_getrequest('is_mail')))); + } + + $this->_mCriteria->addSort($this->getSort(), $this->getOrder()); + } +} + +?>