Minahito
minah****@users*****
2006年 4月 25日 (火) 14:17:19 JST
Index: xoops2jp/html/modules/legacyRender/admin/forms/BannerclientAdminEditForm.class.php diff -u xoops2jp/html/modules/legacyRender/admin/forms/BannerclientAdminEditForm.class.php:1.1.2.1 xoops2jp/html/modules/legacyRender/admin/forms/BannerclientAdminEditForm.class.php:1.1.2.2 --- xoops2jp/html/modules/legacyRender/admin/forms/BannerclientAdminEditForm.class.php:1.1.2.1 Mon Apr 24 16:30:22 2006 +++ xoops2jp/html/modules/legacyRender/admin/forms/BannerclientAdminEditForm.class.php Tue Apr 25 14:17:19 2006 @@ -30,10 +30,8 @@ // $this->mFieldProperties['cid'] =& new XCube_FieldProperty($this); - $this->mFieldProperties['cid']->setDependsByArray(array('required','objectExsist')); + $this->mFieldProperties['cid']->setDependsByArray(array('required')); $this->mFieldProperties['cid']->addMessage('required', _AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_CID); - $this->mFieldProperties['cid']->addMessage('objectExist', _AD_LEGACYRENDER_ERROR_OBJECT_EXIST, _AD_LEGACYRENDER_LANG_CID); - $this->mFieldProperties['cid']->addVar('handler', 'bannerfinish'); $this->mFieldProperties['name'] =& new XCube_FieldProperty($this); $this->mFieldProperties['name']->setDependsByArray(array('required','maxlength')); @@ -42,32 +40,43 @@ $this->mFieldProperties['name']->addVar('maxlength', '60'); $this->mFieldProperties['contact'] =& new XCube_FieldProperty($this); - $this->mFieldProperties['contact']->setDependsByArray(array('required','maxlength')); - $this->mFieldProperties['contact']->addMessage('required', _AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_CONTACT, '60'); + $this->mFieldProperties['contact']->setDependsByArray(array('maxlength')); $this->mFieldProperties['contact']->addMessage('maxlength', _AD_LEGACYRENDER_ERROR_MAXLENGTH, _AD_LEGACYRENDER_LANG_CONTACT, '60'); $this->mFieldProperties['contact']->addVar('maxlength', '60'); $this->mFieldProperties['email'] =& new XCube_FieldProperty($this); - $this->mFieldProperties['email']->setDependsByArray(array('required','maxlength')); - $this->mFieldProperties['email']->addMessage('required', _AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_EMAIL, '60'); + $this->mFieldProperties['email']->setDependsByArray(array('maxlength','email')); + $this->mFieldProperties['email']->addMessage('email', _AD_LEGACYRENDER_ERROR_EMAIL, _AD_LEGACYRENDER_LANG_EMAIL, '60'); $this->mFieldProperties['email']->addMessage('maxlength', _AD_LEGACYRENDER_ERROR_MAXLENGTH, _AD_LEGACYRENDER_LANG_EMAIL, '60'); $this->mFieldProperties['email']->addVar('maxlength', '60'); $this->mFieldProperties['login'] =& new XCube_FieldProperty($this); - $this->mFieldProperties['login']->setDependsByArray(array('required','maxlength')); - $this->mFieldProperties['login']->addMessage('required', _AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_LOGIN, '10'); + $this->mFieldProperties['login']->setDependsByArray(array('maxlength')); $this->mFieldProperties['login']->addMessage('maxlength', _AD_LEGACYRENDER_ERROR_MAXLENGTH, _AD_LEGACYRENDER_LANG_LOGIN, '10'); $this->mFieldProperties['login']->addVar('maxlength', '10'); $this->mFieldProperties['passwd'] =& new XCube_FieldProperty($this); - $this->mFieldProperties['passwd']->setDependsByArray(array('required','maxlength')); - $this->mFieldProperties['passwd']->addMessage('required', _AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_PASSWD, '10'); + $this->mFieldProperties['passwd']->setDependsByArray(array('maxlength')); $this->mFieldProperties['passwd']->addMessage('maxlength', _AD_LEGACYRENDER_ERROR_MAXLENGTH, _AD_LEGACYRENDER_LANG_PASSWD, '10'); $this->mFieldProperties['passwd']->addVar('maxlength', '10'); + } + + function validateLogin() + { + if (strlen($this->get('login')) > 0) { + $handler =& xoops_getmodulehandler('bannerclient', 'legacyRender'); + $t_objs =& $handler->getObjects(new Criteria('login', $this->get('login'))); + if (count($t_objs) > 0) { + $this->addErrorMessage(_AD_LEGACYRENDER_ERROR_LOGIN_REPETITION); + } + } + } - $this->mFieldProperties['extrainfo'] =& new XCube_FieldProperty($this); - $this->mFieldProperties['extrainfo']->setDependsByArray(array('required')); - $this->mFieldProperties['extrainfo']->addMessage('required', _AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_EXTRAINFO); + function validatePasswd() + { + if (strlen($this->get('login')) > 0 && strlen($this->get('passwd')) == 0) { + $this->addErrorMessage(XCube_Utils::formatMessage(_AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_PASSWD)); + } } function load(&$obj)