Minahito
minah****@users*****
2005年 12月 19日 (月) 23:01:17 JST
Index: xoops2jp/html/modules/base/admin/class/ModuleUtils.class.php diff -u xoops2jp/html/modules/base/admin/class/ModuleUtils.class.php:1.1.2.1 xoops2jp/html/modules/base/admin/class/ModuleUtils.class.php:1.1.2.2 --- xoops2jp/html/modules/base/admin/class/ModuleUtils.class.php:1.1.2.1 Fri Dec 16 18:56:39 2005 +++ xoops2jp/html/modules/base/admin/class/ModuleUtils.class.php Mon Dec 19 23:01:16 2005 @@ -211,38 +211,41 @@ { $isNew = $block->isNew(); - $blockHandler=&xoops_gethandler('block'); - $blockObj=&$blockHandler->create(); + $blockHandler =& xoops_gethandler('block'); + $blockObj =& $blockHandler->create(); - if(!$blockHandler->insert($block)) { - $log->addError("ERROR : Could not install block whose name is ".$blockObj->getVar('name')); + if (!$blockHandler->insert($block)) { + $log->addError("ERROR : Could not install block whose name is " . $blockObj->getVar('name')); + + return false; } else { - $log->addReport("block ".$block->getVar('name')." has been installed"); + $log->addReport("block " . $block->getVar('name') . " has been installed"); - $tplHandler=&xoops_gethandler('tplfile'); + $tplHandler =& xoops_gethandler('tplfile'); - if(!Legacy_ModuleUtils::installBlockTemplate($module, $block)) { - $log->addError("ERROR : Could not install block template ".$block->getVar('name')); + if (!Legacy_ModuleUtils::installBlockTemplate($module, $block)) { + $log->addError("Could not install block template " . $block->getVar('name')); } // // Process of a permission. // if ($isNew) { - $gpermHandler=&xoops_gethandler('groupperm'); - $bperm=&$gpermHandler->create(); - $bperm->setVar('gperm_groupid',XOOPS_GROUP_ADMIN); - $bperm->setVar('gperm_itemid',$block->getVar('bid')); - $bperm->setVar('gperm_name','block_read'); - $bperm->setVar('gperm_modid',1); - if(!$gpermHandler->insert($bperm)) { - $log->addWarn("Could not set block permission ".$tplfile->getVar('bid')); + $gpermHandler =& xoops_gethandler('groupperm'); + $bperm =& $gpermHandler->create(); + $bperm->setVar('gperm_groupid', XOOPS_GROUP_ADMIN); + $bperm->setVar('gperm_itemid', $block->getVar('bid')); + $bperm->setVar('gperm_name', 'block_read'); + $bperm->setVar('gperm_modid', 1); + if (!$gpermHandler->insert($bperm)) { + $log->addWarn("Could not set block permission " . $tplfile->getVar('bid')); } } + + return true; } - return true; } function unInstallBlock(&$module, &$block) @@ -252,6 +255,8 @@ } /** + * Save the information of block's template specified and the source code of it + * to database. * @return bool */ function installBlockTemplate(&$module, &$block) @@ -283,11 +288,7 @@ $tplfile->setVar('tpl_source', $tplSource); $tplfile->setVar('tpl_lastmodified',time()); - $result = $tplHandler->insert($tplfile); - - // - // TODO We must install to tpl_source table. - // + return $tplHandler->insert($tplfile); } }