issue 369 when ruleset file modified, then ruleset js file must dynamic recreate

this bug fixed
document.controller.php file : indent changed


git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9495 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2011-10-05 09:00:37 +00:00
parent 0016c7963a
commit 5afc0b7587
3 changed files with 28 additions and 21 deletions

View file

@ -1121,7 +1121,14 @@ class Context {
* @brief Add the js file
* @deprecated
**/
function addJsFile($file, $optimized = false, $targetie = '',$index=0, $type='head') {
function addJsFile($file, $optimized = false, $targetie = '',$index=0, $type='head', $isRuleset = false) {
if($isRuleset)
{
$validator = new Validator($file);
$validator->setCacheDir('files/cache');
$file = $validator->getJsPath();
}
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$self->oFrontEndFileHandler->loadFile(array($file, $type, $targetie, $index));
}

View file

@ -222,15 +222,13 @@
if (strpos($m[1],'@') !== false){
$path = str_replace('@', '', $m[1]);
$validator = new Validator("./files/ruleset/{$path}.xml");
$validator->setCacheDir('files/cache');
$matches[1] = '<?php Context::addJsFile("'.$validator->getJsPath().'") ?'.'>'.$matches[1];
$path = './files/ruleset/'.$path.'.xml';
}else if(preg_match('@(?:^|\.?/)(modules/[\w-]+)@', $this->path, $mm)) {
$module_path = $mm[1];
$validator = new Validator("{$module_path}/ruleset/{$m[1]}.xml");
$validator->setCacheDir('files/cache');
$matches[1] = '<?php Context::addJsFile("'.$validator->getJsPath().'") ?'.'>'.$matches[1];
$path = $module_path.'/ruleset/'.$m[1].'.xml';
}
//assign to addJsFile method for js dynamic recache
$matches[1] = '<?php Context::addJsFile("'.$path.'", false, "", 0, "head", true) ?'.'>'.$matches[1];
}
}

View file

@ -479,6 +479,8 @@ class documentController extends document {
executeQuery('document.deleteDeclared', $args);
// Delete extra variable
$this->deleteDocumentExtraVars($oDocument->get('module_srl'), $oDocument->document_srl);
//this
// Call a trigger (after)
if($output->toBool()) {
$trigger_obj = $oDocument->getObjectVars();
@ -500,20 +502,20 @@ class documentController extends document {
$oDB->commit();
//remove from cache
$oCacheHandler = &CacheHandler::getInstance('object');
if($oCacheHandler->isSupport())
{
$cache_key = 'object:'.$document_srl;
$oCacheHandler->delete($cache_key);
$cache_object = $oCacheHandler->get('module_list_documents');
if(isset($cache_object) && is_array($cache_object)){
foreach ($cache_object as $object){
$cache_key_object = $object;
$oCacheHandler->delete($cache_key_object);
}
}elseif(!is_array($cache_object)) {
$oCacheHandler->delete($cache_key_object);
}
$oCacheHandler = &CacheHandler::getInstance('object');
if($oCacheHandler->isSupport())
{
$cache_key = 'object:'.$document_srl;
$oCacheHandler->delete($cache_key);
$cache_object = $oCacheHandler->get('module_list_documents');
if(isset($cache_object) && is_array($cache_object)){
foreach ($cache_object as $object){
$cache_key_object = $object;
$oCacheHandler->delete($cache_key_object);
}
}elseif(!is_array($cache_object)) {
$oCacheHandler->delete($cache_key_object);
}
$oCacheHandler->delete('module_list_documents');
$cache_key = 'object_document_item:'.$document_srl;
$oCacheHandler->delete($cache_key);