add faceoff migration

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8964 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
flyskyko 2011-08-31 06:58:24 +00:00
parent ae5cf5a0e8
commit 5cd8e57f0e
13 changed files with 149 additions and 41 deletions

View file

@ -1005,4 +1005,42 @@
<value xml:lang="ko"><![CDATA[설치된 레이아웃]]></value>
<value xml:lang="en"><![CDATA[Installed Layout]]></value>
</item>
</lang>
<item name="faceoff_export">
<value xml:lang="ko"><![CDATA[FaceOff 레이아웃 내보내기]]></value>
<value xml:lang="en"><![CDATA[Export FaceOff layout]]></value>
</item>
<item name="about_faceoff_export">
<value xml:lang="ko"><![CDATA[FaceOff 레이아웃을 tar 파일로 내보낼 수 있습니다. 백업 받은 FaceOff 레이아웃을 일반 레이아웃으로 변경하세요.]]></value>
<value xml:lang="en"><![CDATA[You can download current edited layout. Use this, you can change FaceOff layout to general layout.]]></value>
</item>
<item name="faceoff_migration" type="array">
<item name="0">
<value xml:lang="ko"><![CDATA[FaceOff 레이아웃은 지원이 중단될 예정입니다. 반드시 안내에 따라 FaceOff 레이아웃을 일반 레이아웃으로 변경하여 주시기 바랍니다.]]></value>
<value xml:lang="en"><![CDATA[FaceOff layout will deprecated. You must change faceoff layout to general layout.]]></value>
</item>
<item name="1">
<value xml:lang="ko"><![CDATA[FaceOff 레이아웃 변경 안내]]></value>
<value xml:lang="en"><![CDATA[Instruction of change FaceOff layout to general layout]]></value>
</item>
<item name="2">
<value xml:lang="ko"><![CDATA[사용 중인 FaceOff 레이아웃의 내보내기를 통해 레이아웃을 백업 받습니다.]]></value>
<value xml:lang="en"><![CDATA[Export FaceOff layout.]]></value>
</item>
<item name="3">
<value xml:lang="ko"><![CDATA[내려받은 tar 파일의 압축을 해제합니다.]]></value>
<value xml:lang="en"><![CDATA[Untar downloaded tar file.]]></value>
</item>
<item name="4">
<value xml:lang="ko"><![CDATA[폴더명을 임의의 이름으로 변경합니다.]]></value>
<value xml:lang="en"><![CDATA[Change folder name to any name.]]></value>
</item>
<item name="5">
<value xml:lang="ko"><![CDATA[FTP를 통해 ./layouts에 업로드합니다.]]></value>
<value xml:lang="en"><![CDATA[Upload it at ./layouts.]]></value>
</item>
<item name="6">
<value xml:lang="ko"><![CDATA[레이아웃 목록에서 업로드한 레이아웃을 이용하여 레이아웃을 생성합니다. 이때 레이아웃 경로가 업로드한 경로가 맞는지 확인하세요. 로고 이미지 등 레이아웃 설정은 다시 하셔야 합니다.]]></value>
<value xml:lang="en"><![CDATA[Insert new layout from installed layout. You make sure that check layout's path. And you re-set layout configuration.]]></value>
</item>
</item>
</lang>

View file

@ -19,6 +19,8 @@
* Insert a title into "layouts" table in order to create a layout
**/
function procLayoutAdminInsert() {
if(Context::get('layout') == 'faceoff') return $this->stop('not supported');
// Get information to create a layout
$site_module_info = Context::get('site_module_info');
$args->site_srl = (int)$site_module_info->site_srl;
@ -377,7 +379,7 @@
FileHandler::writeFile($file,$content);
// write faceoff.css
$css = Context::get('css');
$css = stripslashes(Context::get('css'));
$css_file = $oLayoutModel->getUserLayoutFaceOffCss($layout_srl);
FileHandler::writeFile($css_file,$css);
@ -441,7 +443,6 @@
}
}
// deprecated
/**
* @brief faceoff export
*
@ -451,15 +452,71 @@
if(!$layout_srl) return new Object('-1','msg_invalid_request');
require_once(_XE_PATH_.'libs/tar.class.php');
// Get a list of files to zip
$oLayoutModel = &getModel('layout');
// Copy files to temp path
$file_path = $oLayoutModel->getUserLayoutPath($layout_srl);
$target_path = $oLayoutModel->getUserLayoutPath(0);
FileHandler::copyDir($file_path, $target_path);
// replace path and ini config
$ini_config = $oLayoutModel->getUserLayoutIniConfig(0);
$file_list = $oLayoutModel->getUserLayoutFileList($layout_srl);
unset($file_list[2]);
foreach($file_list as $file)
{
if (preg_match('/^images/', $file)) continue;
// replace path
$file = $target_path . $file;
$content = FileHandler::readFile($file);
$pattern = '/(http:\/\/[^ ]+)?(\.\/)?' . str_replace('/', '\/', (str_replace('./', '', $file_path))) . '/';
if (basename($file) == 'faceoff.css' || basename($file) == 'layout.css')
$content = preg_replace($pattern, '../', $content);
else
$content = preg_replace($pattern, './', $content);
// replace ini config
foreach($ini_config as $key => $value)
{
$content = str_replace('{$layout_info->faceoff_ini_config[\'' . $key . '\']}', $value, $content);
}
FileHandler::writeFile($file, $content);
}
// make info.xml
$info_file = $target_path . 'conf/info.xml';
FileHandler::copyFile('./modules/layout/faceoff/conf/info.xml', $info_file);
$content = FileHandler::readFile($info_file);
$content = str_replace('type="faceoff"', '', $content);
FileHandler::writeFile($info_file, $content);
$file_list[] = 'conf/info.xml';
// make css file
$css_file = $target_path . 'css/layout.css';
FileHandler::copyFile('./modules/layout/faceoff/css/layout.css', $css_file);
$content = FileHandler::readFile('./modules/layout/tpl/css/widget.css');
FileHandler::writeFile($css_file, "\n" . $content, 'a');
$content = FileHandler::readFile($target_path . 'faceoff.css');
FileHandler::writeFile($css_file, "\n" . $content, 'a');
$content = FileHandler::readFile($target_path . 'layout.css');
FileHandler::writeFile($css_file, "\n" . $content, 'a');
// css load
$content = FileHandler::readFile($target_path . 'layout.html');
$content = "<load target=\"css/layout.css\" />\n" . $content;
FileHandler::writeFile($target_path . 'layout.html', $content);
unset($file_list[3]);
unset($file_list[1]);
$file_list[] = 'css/layout.css';
// Compress the files
$tar = new tar();
$user_layout_path = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath($layout_srl));
$user_layout_path = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath(0));
chdir($user_layout_path);
$replace_path = getNumberingPath($layout_srl,3);
foreach($file_list as $key => $file) $tar->addFile($file,$replace_path,'__LAYOUT_PATH__');
foreach($file_list as $key => $file) $tar->addFile($file);
$stream = $tar->toTarStream();
$filename = 'faceoff_' . date('YmdHis') . '.tar';
@ -473,6 +530,10 @@
echo $stream;
// Close Context and then exit
Context::close();
// delete temp path
FileHandler::removeDir($target_path);
exit();
}
@ -482,6 +543,8 @@
*
**/
function procLayoutAdminUserLayoutImport(){
return $this->stop('not supported');
// check upload
if(!Context::isUploaded()) exit();
$file = Context::get('file');

View file

@ -103,6 +103,8 @@
// Get layout info
$layout = Context::get('layout');
if ($layout == 'faceoff') return $this->stop('not supported');
$layout_info = $oModel->getLayoutInfo($layout, null, $type);
if (!$layout_info) return $this->stop('msg_invalid_request');
@ -248,12 +250,6 @@
$security = new Security();
$security->encodeHTML('layout_code_css', 'layout_code', 'widget_list..title');
// debugPrint(Context::get('selected_layout'));
// debugPrint(Context::get('layout_code_css'));
// debugPrint(Context::get('layout_code'));
// debugPrint(Context::get('layout_image_list'));
// debugPrint(Context::get('layout_image_path'));
// debugPrint(Context::get('widget_list'));
}
/**

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View file

@ -1,11 +1,36 @@
<h1 class="h1">{$lang->installed_layout}</h1>
<div cond="$layout == 'faceoff'" class="message error">
<p>
FaceOff 레이아웃은 지원이 중단될 예정입니다. 반드시 아래 안내에 따라 FaceOff 레이아웃을 일반 레이아웃으로 변경하여 주시기 바랍니다.
</p>
<p>{$lang->faceoff_migration[0]}</p>
<p><a href="#faceoff_migration_info" class="modalAnchor">{$lang->faceoff_migration[1]}</a></p>
</div>
<div cond="$layout == 'faceoff'" id="faceoff_migration_info" class="modal">
<div class="fg">
<ol>
<li>
<p>{$lang->faceoff_migration[2]}</p>
<img src="./faceoff_migration/01.png" alt="" />
</li>
<li>
<p>{$lang->faceoff_migration[3]}</p>
<img src="./faceoff_migration/02.png" alt="" />
</li>
<li>
<p>{$lang->faceoff_migration[4]}</p>
<img src="./faceoff_migration/03.png" alt="" />
</li>
<li>
<p>{$lang->faceoff_migration[5]}</p>
<img src="./faceoff_migration/04.png" alt="" />
</li>
<li>
<p>{$lang->faceoff_migration[6]}</p>
<img src="./faceoff_migration/05.png" alt="" />
</li>
</ol>
</div>
</div>
<div cond="$XE_VALIDATOR_MESSAGE" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
</div>

View file

@ -40,7 +40,7 @@
</block>
<block cond="!$layout->title">
<td class="title">
<p><a href="{getUrl('act', 'dispLayoutAdminInstanceList', 'path', urlencode($layout->path))}">{$layout->layout}</a></p>
<p><a href="{getUrl('act', 'dispLayoutAdminInstanceList', 'type', $type, 'layout', $layout->layout)}">{$layout->layout}</a></p>
<p cond="$layout->need_update == 'Y'" class="update">
{$lang->msg_avail_update} <a href="{$layout->update_url}&amp;return_url={urlencode(getRequestUriByServerEnviroment())}">{$lang->msg_do_you_like_update}</a>
</p>

View file

@ -50,29 +50,15 @@
<block cond="$selected_layout->type == 'faceoff'">
<fieldset class="section">
<h3 class="h3">{$lang->layout_migration}</h3>
<p>{nl2br($lang->about_layout_migration)}</p>
<form class="form" ruleset="userLayoutImport" action="./" method="post" enctype="multipart/form-data">
<input type="hidden" name="module" value="layout" />
<input type="hidden" name="act" value="procLayoutAdminUserLayoutImport" />
<input type="hidden" name="layout_srl" value="{$layout_srl}" />
<ul>
<h3 class="h3">{$lang->faceoff_export}</h3>
<p>{nl2br($lang->about_faceoff_export)}</p>
<ul class="form">
<li>
<p class="q">{$lang->layout_export}</p>
<p class="a"><span class="btn small"><a href="{getUrl('', 'act', 'procLayoutAdminUserLayoutExport', 'layout_srl', $layout_srl)}">{$lang->layout_btn_export}</a></span></p>
<p class="desc">{$lang->about_layout_export}</p>
</li>
<li>
<p class="q">{$lang->layout_import}</p>
<p class="a"><input type="file" name="file" /></p>
<p class="desc">{$lang->about_layout_import}</p>
</li>
</ul>
<div class="btnArea">
<span class="btn medium"><input type="submit" value="{$lang->cmd_submit}" /></span>
</div>
</form>
</fieldset>
</block>
@ -101,4 +87,4 @@
<span class="btn medium"><button type="submit" name="mode" value="save">{$lang->cmd_save}</button></span>
</div>
</form>
</fieldset>
</fieldset>

View file

@ -38,6 +38,6 @@
</tbody>
</table>
</div>
<div class="btnArea">
<div cond="$layout_info->layout != 'faceoff'" class="btnArea">
<span class="btn small"><a href="{getUrl('act', 'dispLayoutAdminInsert', 'layout', $layout_info->layout)}">{$lang->cmd_insert}</a></span>
</div>
</div>

View file

@ -125,13 +125,13 @@
<li>
<p class="q">{$lang->not_apply_menu}</p>
<p class="a">
<input type="checkbox" name="apply_layout" value="Y" />{$lang->about_not_apply_menu}
<input type="checkbox" name="apply_layout" id="apply_layout" value="Y" /> <label for="apply_layout">{$lang->about_not_apply_menu}</label>
</p>
</li>
<li cond="$selected_layout->layout_type == 'M'">
<p class="q">{$lang->apply_mobile_view}</p>
<p class="a">
<input type="checkbox" name="apply_mobile_view" value="Y" />{$lang->about_apply_mobile_view}
<input type="checkbox" name="apply_mobile_view" id="apply_mobile_layout" value="Y" /> <label for="apply_mobile_layout">{$lang->about_apply_mobile_view}</label>
</p>
</li>
</ul>
@ -142,4 +142,4 @@
</span>
</div>
</form>
</form>