Minahito
minah****@users*****
2006年 1月 19日 (木) 21:07:59 JST
Index: xoops2jp/html/modules/user/admin/forms/UserAdminEditForm.class.php diff -u xoops2jp/html/modules/user/admin/forms/UserAdminEditForm.class.php:1.1.2.4 xoops2jp/html/modules/user/admin/forms/UserAdminEditForm.class.php:1.1.2.5 --- xoops2jp/html/modules/user/admin/forms/UserAdminEditForm.class.php:1.1.2.4 Tue Jan 17 19:34:57 2006 +++ xoops2jp/html/modules/user/admin/forms/UserAdminEditForm.class.php Thu Jan 19 21:07:59 2006 @@ -7,6 +7,8 @@ */ class User_UserAdminEditForm extends XCube_ActionForm { + var $_mIsNew; + function getTokenName() { return "module.user.UserAdminEditForm.Token"; @@ -65,7 +67,8 @@ $this->mFieldProperties['uname']->addVar('maxlength', 25); $this->mFieldProperties['email'] =& new XCube_FieldProperty($this); - $this->mFieldProperties['email']->setDependsByArray(array('maxlength')); + $this->mFieldProperties['email']->addMessage('required', _AD_USER_ERROR_REQUIRED, _AD_USER_LANG_EMAIL, '60'); + $this->mFieldProperties['email']->setDependsByArray(array('required', 'maxlength')); $this->mFieldProperties['email']->addMessage('maxlength', _AD_USER_ERROR_MAXLENGTH, _AD_USER_LANG_EMAIL, '60'); $this->mFieldProperties['email']->addVar('maxlength', 60); @@ -177,6 +180,16 @@ $this->mFieldProperties['user_mailok']->setDependsByArray(array('')); } + function validateUname() + { + if ($this->get('uname') != null) { + $handler =& xoops_gethandler('user'); + if ($handler->getCount(new Criteria('uname', $this->get('uname'))) > 0) { + $this->addErrorMessage(_AD_USER_ERROR_UNAME_NO_UNIQUE); + } + } + } + function validateGroups() { $groupHandler =& xoops_gethandler('group'); @@ -197,6 +210,9 @@ $this->set('vpass', ''); } } + elseif($this->_mIsNew) { + $this->addErrorMessage(_AD_USER_ERROR_PASSWORD_REQUIRED); + } } function validateUmode() @@ -234,6 +250,8 @@ $this->setVar('bio', $obj->get('bio')); $this->setVar('user_intrest', $obj->get('user_intrest')); $this->setVar('user_mailok', $obj->get('user_mailok')); + + $this->_mIsNew = $obj->isNew(); $groups =& $obj->getGroups(); $i = 0;