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);
}
/**

View file

@ -17,6 +17,7 @@
<th scope="col" class="nowr">{$lang->regdate}</th>
<th scope="col" class="nowr">{$lang->cmd_layout_management}</th>
<th scope="col" class="nowr">{$lang->cmd_layout_edit}</th>
<th scope="col" class="nowr">{$lang->cmd_copy}</th>
<th scope="col" class="nowr">{$lang->cmd_delete}</th>
</tr>
</thead>
@ -32,6 +33,7 @@
<td class="nowr">{zdate($item->regdate, "Y-m-d")}</td>
<td class="nowr"><a href="{getUrl('act', 'dispLayoutAdminModify', 'layout_srl', $item->layout_srl)}">{$lang->cmd_layout_management}</a></td>
<td class="nowr"><a href="{getUrl('act', 'dispLayoutAdminEdit', 'layout_srl', $item->layout_srl)}">{$lang->cmd_layout_edit}</a></td>
<td class="nowr"><a href="{getUrl('', 'module', 'layout', 'act', 'dispLayoutAdminCopyLayout', 'layout_srl', $item->layout_srl)}" onclick="popopen(this.href);return false;" title="{$lang->cmd_copy}">{$lang->cmd_copy}</a></td>
<td class="nowr">
<form class="layout_delete_form" ruleset="deleteLayout" action="./" method="post">
<input type="hidden" name="module" value="layout" />