issue 1522 when copy layout, change resource file path in layout.html, layout.css file

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.3.1@10898 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2012-07-16 02:16:52 +00:00
parent 508c32963d
commit f653aea372
2 changed files with 18 additions and 5 deletions

View file

@ -698,7 +698,7 @@
$sourceImagePath = $oLayoutModel->getUserLayoutImagePath($sourceLayoutSrl);
$targetImagePath = $oLayoutModel->getUserLayoutImagePath($targetLayoutSrl);
FileHandler::makeDir($targetimagePath);
FileHandler::makeDir($targetImagePath);
$sourceFileList = $oLayoutModel->getUserLayoutFileList($sourceLayoutSrl);
foreach($sourceFileList as $key => $file)
@ -706,13 +706,24 @@
if(is_readable($sourceLayoutPath.$file))
{
FileHandler::copyFile($sourceLayoutPath.$file, $targetLayoutPath.$file);
if($file == 'layout.html' || $file == 'layout.css')
{
$this->_changeFilepathInSource($targetLayoutPath.$file, $sourceImagePath, $targetImagePath);
}
}
}
}
/*$sourceImageFiles = FileHandler::readDir($sourceImagePath);
if(is_array($sourceImageFiles))
{
}*/
/**
* Change resource file path in Layout file
* @param string $file
* @return void
*/
function _changeFilepathInSource($file, $source, $target)
{
$content = FileHandler::readFile($file);
$content = str_replace($source, $target, $content);
FileHandler::writeFile($file, $content);
}
/**