Minahito
minah****@users*****
2006年 4月 25日 (火) 12:58:58 JST
Index: xoops2jp/html/modules/legacyRender/admin/forms/BannerAdminEditForm.class.php diff -u xoops2jp/html/modules/legacyRender/admin/forms/BannerAdminEditForm.class.php:1.1.2.1 xoops2jp/html/modules/legacyRender/admin/forms/BannerAdminEditForm.class.php:1.1.2.2 --- xoops2jp/html/modules/legacyRender/admin/forms/BannerAdminEditForm.class.php:1.1.2.1 Mon Apr 24 16:30:22 2006 +++ xoops2jp/html/modules/legacyRender/admin/forms/BannerAdminEditForm.class.php Tue Apr 25 12:58:58 2006 @@ -20,11 +20,8 @@ $this->mFormProperties['bid'] =& new XCube_IntProperty('bid'); $this->mFormProperties['cid'] =& new XCube_IntProperty('cid'); $this->mFormProperties['imptotal'] =& new XCube_IntProperty('imptotal'); - $this->mFormProperties['impmade'] =& new XCube_IntProperty('impmade'); - $this->mFormProperties['clicks'] =& new XCube_IntProperty('clicks'); $this->mFormProperties['imageurl'] =& new XCube_StringProperty('imageurl'); $this->mFormProperties['clickurl'] =& new XCube_StringProperty('clickurl'); - $this->mFormProperties['date'] =& new XCube_IntProperty('date'); $this->mFormProperties['htmlbanner'] =& new XCube_BoolProperty('htmlbanner'); $this->mFormProperties['htmlcode'] =& new XCube_TextProperty('htmlcode'); @@ -41,38 +38,43 @@ $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', 'bannerclient'); + $this->mFieldProperties['cid']->addVar('module', 'legacyRender'); $this->mFieldProperties['imptotal'] =& new XCube_FieldProperty($this); $this->mFieldProperties['imptotal']->setDependsByArray(array('required')); $this->mFieldProperties['imptotal']->addMessage('required', _AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_IMPTOTAL); - $this->mFieldProperties['impmade'] =& new XCube_FieldProperty($this); - $this->mFieldProperties['impmade']->setDependsByArray(array('required')); - $this->mFieldProperties['impmade']->addMessage('required', _AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_IMPMADE); - - $this->mFieldProperties['clicks'] =& new XCube_FieldProperty($this); - $this->mFieldProperties['clicks']->setDependsByArray(array('required')); - $this->mFieldProperties['clicks']->addMessage('required', _AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_CLICKS); - $this->mFieldProperties['imageurl'] =& new XCube_FieldProperty($this); - $this->mFieldProperties['imageurl']->setDependsByArray(array('required','maxlength')); - $this->mFieldProperties['imageurl']->addMessage('required', _AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_IMAGEURL, '255'); + $this->mFieldProperties['imageurl']->setDependsByArray(array('maxlength')); $this->mFieldProperties['imageurl']->addMessage('maxlength', _AD_LEGACYRENDER_ERROR_MAXLENGTH, _AD_LEGACYRENDER_LANG_IMAGEURL, '255'); $this->mFieldProperties['imageurl']->addVar('maxlength', '255'); $this->mFieldProperties['clickurl'] =& new XCube_FieldProperty($this); - $this->mFieldProperties['clickurl']->setDependsByArray(array('required','maxlength')); - $this->mFieldProperties['clickurl']->addMessage('required', _AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_CLICKURL, '255'); + $this->mFieldProperties['clickurl']->setDependsByArray(array('maxlength')); $this->mFieldProperties['clickurl']->addMessage('maxlength', _AD_LEGACYRENDER_ERROR_MAXLENGTH, _AD_LEGACYRENDER_LANG_CLICKURL, '255'); $this->mFieldProperties['clickurl']->addVar('maxlength', '255'); - - $this->mFieldProperties['date'] =& new XCube_FieldProperty($this); - $this->mFieldProperties['date']->setDependsByArray(array('required')); - $this->mFieldProperties['date']->addMessage('required', _AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_DATE); - - $this->mFieldProperties['htmlcode'] =& new XCube_FieldProperty($this); - $this->mFieldProperties['htmlcode']->setDependsByArray(array('required')); - $this->mFieldProperties['htmlcode']->addMessage('required', _AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_HTMLCODE); + } + + function validate() + { + parent::validate(); + + // + // If htmlbanner is clicked, htmlbanner is requreid. + // + if ($this->get('htmlbanner')) { + if (strlen($this->get('htmlcode')) == 0) { + $this->addErrorMessage(XCube_Utils::formatMessage(_AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_HTMLCODE)); + } + } + else { + if (strlen($this->get('imageurl')) == 0) { + $this->addErrorMessage(XCube_Utils::formatMessage(_AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_IMAGEURL)); + } + if (strlen($this->get('clickurl')) == 0) { + $this->addErrorMessage(XCube_Utils::formatMessage(_AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_CLICKURL)); + } + } } function load(&$obj) @@ -80,11 +82,8 @@ $this->set('bid', $obj->get('bid')); $this->set('cid', $obj->get('cid')); $this->set('imptotal', $obj->get('imptotal')); - $this->set('impmade', $obj->get('impmade')); - $this->set('clicks', $obj->get('clicks')); $this->set('imageurl', $obj->get('imageurl')); $this->set('clickurl', $obj->get('clickurl')); - $this->set('date', $obj->get('date')); $this->set('htmlbanner', $obj->get('htmlbanner')); $this->set('htmlcode', $obj->get('htmlcode')); } @@ -94,11 +93,8 @@ $obj->set('bid', $this->get('bid')); $obj->set('cid', $this->get('cid')); $obj->set('imptotal', $this->get('imptotal')); - $obj->set('impmade', $this->get('impmade')); - $obj->set('clicks', $this->get('clicks')); $obj->set('imageurl', $this->get('imageurl')); $obj->set('clickurl', $this->get('clickurl')); - $obj->set('date', $this->get('date')); $obj->set('htmlbanner', $this->get('htmlbanner')); $obj->set('htmlcode', $this->get('htmlcode')); }