mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
issue 1527 copy extra keys when module copied
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10198 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
b5d4bfe9dc
commit
c780878499
3 changed files with 35 additions and 0 deletions
|
|
@ -112,6 +112,9 @@
|
|||
// 2011. 10. 25 status index check
|
||||
if(!$oDB->isIndexExists("documents", "idx_module_status")) return true;
|
||||
|
||||
// 2012. 02. 27 Add a trigger to copy extra keys when the module is copied
|
||||
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -293,6 +296,12 @@
|
|||
if(!$oDB->isIndexExists("documents", "idx_module_status"))
|
||||
$oDB->addIndex("documents", "idx_module_status", array("module_srl","status"));
|
||||
|
||||
// 2012. 02. 27 Add a trigger to copy extra keys when the module is copied
|
||||
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after'))
|
||||
{
|
||||
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after');
|
||||
}
|
||||
|
||||
return new Object(0,'success_updated');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1831,5 +1831,26 @@ class documentController extends document {
|
|||
if(!$obj->status && $obj->is_secret == 'Y') $obj->status = $this->getConfigStatus('secret');
|
||||
if(!$obj->status && $obj->is_secret != 'Y') $obj->status = $this->getConfigStatus('public');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief copy extra keys when module copied
|
||||
**/
|
||||
function triggerCopyModuleExtraKeys(&$obj)
|
||||
{
|
||||
$oDocumentModel = &getModel('document');
|
||||
$documentExtraKeys = $oDocumentModel->getExtraKeys($obj->originModuleSrl);
|
||||
|
||||
if(is_array($documentExtraKeys) && is_array($obj->moduleSrlList))
|
||||
{
|
||||
$oDocumentController=&getController('document');
|
||||
foreach($obj->moduleSrlList AS $key=>$value)
|
||||
{
|
||||
foreach($documentExtraKeys AS $extraItem)
|
||||
{
|
||||
$oDocumentController->insertDocumentExtraKey($value, $extraItem->idx, $extraItem->name, $extraItem->type, $extraItem->is_required , $extraItem->search , $extraItem->default , $extraItem->desc, $extraItem->eid) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -123,6 +123,8 @@
|
|||
$oDB = &DB::getInstance();
|
||||
$oDB->begin();
|
||||
// Copy a module
|
||||
$triggerObj->originModuleSrl = $module_srl;
|
||||
$triggerObj->moduleSrlList = array();
|
||||
foreach($clones as $mid => $browser_title) {
|
||||
$clone_args = null;
|
||||
$clone_args = clone($module_info);
|
||||
|
|
@ -138,8 +140,11 @@
|
|||
if(count($grant)) $oModuleController->insertModuleGrants($module_srl, $grant);
|
||||
if ($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
|
||||
|
||||
array_push($triggerObj->moduleSrlList, $module_srl);
|
||||
}
|
||||
|
||||
$output = ModuleHandler::triggerCall('module.procModuleAdminCopyModule', 'after', $triggerObj);
|
||||
|
||||
$oDB->commit();
|
||||
$this->setMessage('success_registed');
|
||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue