Minahito
minah****@users*****
2006年 5月 17日 (水) 16:19:56 JST
Index: xoops2jp/html/modules/legacyRender/admin/forms/TplfileCloneForm.class.php diff -u /dev/null xoops2jp/html/modules/legacyRender/admin/forms/TplfileCloneForm.class.php:1.1.2.1 --- /dev/null Wed May 17 16:19:56 2006 +++ xoops2jp/html/modules/legacyRender/admin/forms/TplfileCloneForm.class.php Wed May 17 16:19:56 2006 @@ -0,0 +1,62 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +require_once XOOPS_MODULE_PATH . "/legacyRender/admin/forms/TplfileEditForm.class.php"; +require_once XOOPS_MODULE_PATH . "/base/class/Legacy_Validator.class.php"; + +class LegacyRender_TplfileCloneForm extends TplfileEditForm +{ + function getTokenName() + { + return "module.legacyRender.TplfileCloneForm.TOKEN"; + } + + function prepare() + { + parent::prepare(); + + // + // Set form properties + // + $this->mFormProperties['tpl_tplset'] =& new XCube_StringProperty('tpl_tplset'); + + // + // Set field properties + // + $this->mFieldProperties['tpl_tplset'] =& new XCube_FieldProperty($this); + $this->mFieldProperties['tpl_tplset']->setDependsByArray(array('required')); + $this->mFieldProperties['tpl_tplset']->addMessage('required', _AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_TPL_TPLSET); + } + + function validateTpl_tplset() + { + $tplset = $this->get('tpl_tplset'); + + $handler =& xoops_getmodulehandler('tplset', 'legacyRender'); + $criteria =& new Criteria('tplset_name', $this->get('tpl_tplset')); + $objs =& $handler->getObjects($criteria); + + if (count($objs) == 0) { + $this->addErrorMessage(_AD_LEGACYRENDER_ERROR_TPLSET_WRONG); + } + } + + function load(&$obj) + { + parent::load($obj); + $this->set('tpl_tplset', $obj->get('tpl_tplset')); + } + + function update(&$obj) + { + $obj->loadSource(); + + $obj->setVar('tpl_desc', $this->get('tpl_desc')); + $obj->setVar('tpl_lastmodified', time()); + + $obj->Source->setVar('tpl_source', $this->get('tpl_source')); + } +} + +?>