mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-02 16:52:16 +09:00
Close Connection when there is no connection value.
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@13161 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
034a5c0288
commit
f70ce644ce
1410 changed files with 7188 additions and 53541 deletions
|
|
@ -1074,4 +1074,13 @@
|
|||
<item name="use_site_default_layout">
|
||||
<value xml:lang="ko"><![CDATA[사이트 기본 레이아웃 사용]]></value>
|
||||
</item>
|
||||
<item name="msg_unabled_preview">
|
||||
<value xml:lang="ko"><![CDATA[해당 메뉴 타입의 페이지가 하나도 없어 미리보기가 불가능합니다.]]></value>
|
||||
</item>
|
||||
<item name="article_preview_title">
|
||||
<value xml:lang="ko"><![CDATA[문서의 제목입니다.]]></value>
|
||||
</item>
|
||||
<item name="article_preview_content">
|
||||
<value xml:lang="ko"><![CDATA[무궁화 꽃이 피었습니다.]]></value>
|
||||
</item>
|
||||
</lang>
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ class layoutAdminController extends layout
|
|||
$layoutInfo = $oLayoutModel->getLayout($layout_srl);
|
||||
if($layoutInfo)
|
||||
{
|
||||
$layoutList = $oLayoutModel->getLayoutInstanceList($layoutInfo->site_srl, $layoutInfo->layout_type, $layoutInfo->layout, array('layout_srl'));
|
||||
$layoutList = $oLayoutModel->getLayoutInstanceList($layoutInfo->site_srl, $layoutInfo->layout_type, $layoutInfo->layout, array('layout_srl', 'layout'));
|
||||
if(count($layoutList) <= 1)
|
||||
{
|
||||
// uninstall package
|
||||
|
|
@ -304,11 +304,16 @@ class layoutAdminController extends layout
|
|||
|
||||
if($packageSrl)
|
||||
{
|
||||
$oAutoinstallAdminController->uninstallPackageByPackageSrl($packageSrl);
|
||||
$output = $oAutoinstallAdminController->uninstallPackageByPackageSrl($packageSrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
$oAutoinstallAdminController->uninstallPackageByPath($path);
|
||||
$output = $oAutoinstallAdminController->uninstallPackageByPath($path);
|
||||
}
|
||||
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return new Object(-1, $output->message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -736,6 +741,17 @@ class layoutAdminController extends layout
|
|||
$args = new stdClass();
|
||||
$args->extra_vars = $output->extra_vars;
|
||||
$extra_vars = unserialize($args->extra_vars);
|
||||
|
||||
if($layout->extra_var_count) {
|
||||
$reg = "/^.\/files\/attach\/images\/([0-9]+)\/(.*)/";
|
||||
foreach($extra_vars as $key => $val) {
|
||||
if($layout->extra_var->{$key}->type == 'image') {
|
||||
if(!preg_match($reg,$val,$matches)) continue;
|
||||
$image_list[$key]->filename = $matches[2];
|
||||
$image_list[$key]->old_file = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$oModuleController = &getController('module');
|
||||
$layout_config = new stdClass();
|
||||
|
|
@ -744,7 +760,7 @@ class layoutAdminController extends layout
|
|||
// Get information to create a layout
|
||||
$args->site_srl = (int)$layout->site_srl;
|
||||
$args->layout = $layout->layout;
|
||||
$args->layout_type = $layout->type;
|
||||
$args->layout_type = $layout->layout_type;
|
||||
if(!$args->layout_type) $args->layout_type = "P";
|
||||
|
||||
$oDB = &DB::getInstance();
|
||||
|
|
@ -762,6 +778,15 @@ class layoutAdminController extends layout
|
|||
$args->layout_srl = getNextSequence();
|
||||
$args->title = $value;
|
||||
|
||||
if(is_array($image_list)) {
|
||||
foreach($image_list as $key=>$val) {
|
||||
$new_file = sprintf("./files/attach/images/%s/%s", $args->layout_srl,$val->filename);
|
||||
FileHandler::copyFile($val->old_file, $new_file);
|
||||
$extra_vars->{$key} = $new_file;
|
||||
}
|
||||
$args->extra_vars = serialize($extra_vars);
|
||||
}
|
||||
|
||||
// for header script
|
||||
$oModuleController->insertModulePartConfig('layout', $args->layout_srl, $layout_config);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,10 +23,31 @@ class layoutAdminModel extends layout
|
|||
|
||||
Context::set('is_sitemap', '1');
|
||||
$script = '<script src="./modules/layout/tpl/js/layout_modify.js"></script>';
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
$oTemplate = TemplateHandler::getInstance();
|
||||
$html = $oTemplate->compile($this->module_path.'tpl/', 'layout_info_view');
|
||||
|
||||
$this->add('html', $script.$html);
|
||||
preg_match_all('/<!--#JSPLUGIN:(.*)-->/', $html, $m);
|
||||
$pluginList = $m[1];
|
||||
|
||||
foreach($pluginList as $plugin)
|
||||
{
|
||||
$info = Context::getJavascriptPluginInfo($plugin);
|
||||
if(!$info)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach($info->jsList as $js)
|
||||
{
|
||||
$script .= sprintf('<script src="%s"></script>', $js);
|
||||
}
|
||||
foreach($info->cssList as $css)
|
||||
{
|
||||
$csss .= sprintf('<link rel="stylesheet" href="%s" />', $css);
|
||||
}
|
||||
}
|
||||
|
||||
$this->add('html', $csss . $script . $html);
|
||||
|
||||
if($isReturn)
|
||||
{
|
||||
|
|
@ -170,6 +191,14 @@ class layoutAdminModel extends layout
|
|||
return 0;
|
||||
}
|
||||
|
||||
$oModel = getModel('layout');
|
||||
$layout_info = $oModel->getLayout($designInfo->{$target});
|
||||
|
||||
if(!$layout_info)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return $designInfo->{$target};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,14 @@ class layoutModel extends layout
|
|||
$args->layout_type = $layout_type;
|
||||
$output = executeQueryArray('layout.getLayoutList', $args, $columnList);
|
||||
|
||||
foreach($output->data as $no => &$val)
|
||||
{
|
||||
if(!$this->isExistsLayoutFile($val->layout, $layout_type))
|
||||
{
|
||||
unset($output->data[$no]);
|
||||
}
|
||||
}
|
||||
|
||||
$oLayoutAdminModel = getAdminModel('layout');
|
||||
$siteDefaultLayoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($layout_type, $site_srl);
|
||||
if($siteDefaultLayoutSrl)
|
||||
|
|
@ -126,9 +134,16 @@ class layoutModel extends layout
|
|||
$instanceList = array();
|
||||
if(is_array($output->data))
|
||||
{
|
||||
foreach($output->data as $iInfo)
|
||||
foreach($output->data as $no => $iInfo)
|
||||
{
|
||||
$instanceList[] = $iInfo->layout;
|
||||
if($this->isExistsLayoutFile($iInfo->layout, $layoutType))
|
||||
{
|
||||
$instanceList[] = $iInfo->layout;
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($output->data[$no]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -184,11 +199,56 @@ class layoutModel extends layout
|
|||
if($isCreateInstance)
|
||||
{
|
||||
$output = executeQueryArray('layout.getLayoutList', $args, $columnList);
|
||||
|
||||
if(is_array($output->data))
|
||||
{
|
||||
foreach($output->data as $no => $iInfo)
|
||||
{
|
||||
if(!$this->isExistsLayoutFile($iInfo->layout, $layoutType))
|
||||
{
|
||||
unset($output->data[$no]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $output->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* If exists layout file returns true
|
||||
*
|
||||
* @param string $layout layout name
|
||||
* @param string $layoutType P or M
|
||||
* @return bool
|
||||
*/
|
||||
function isExistsLayoutFile($layout, $layoutType)
|
||||
{
|
||||
//TODO If remove a support themes, remove this codes also.
|
||||
if($layoutType == 'P')
|
||||
{
|
||||
$pathPrefix = _XE_PATH_ . 'layouts/';
|
||||
$themePathFormat = _XE_PATH_ . 'themes/%s/layouts/%s';
|
||||
}
|
||||
else
|
||||
{
|
||||
$pathPrefix = _XE_PATH_ . 'm.layouts/';
|
||||
$themePathFormat = _XE_PATH_ . 'themes/%s/m.layouts/%s';
|
||||
}
|
||||
|
||||
if(strpos($layout, '|@|') !== FALSE)
|
||||
{
|
||||
list($themeName, $layoutName) = explode('|@|', $layout);
|
||||
$path = sprintf($themePathFormat, $themeName, $layoutName);
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = $pathPrefix . $layout;
|
||||
}
|
||||
|
||||
return is_readable($path . '/layout.html');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get one of layout information created in the DB
|
||||
* Return DB info + XML info of the generated layout
|
||||
|
|
@ -725,7 +785,7 @@ class layoutModel extends layout
|
|||
* Get ini configurations and make them an array.
|
||||
* @param int $layout_srl
|
||||
* @param string $layout_name
|
||||
* @return array
|
||||
* @return array
|
||||
*/
|
||||
function getUserLayoutIniConfig($layout_srl, $layout_name=null)
|
||||
{
|
||||
|
|
@ -809,9 +869,9 @@ class layoutModel extends layout
|
|||
function getUserLayoutHtml($layout_srl)
|
||||
{
|
||||
$src = $this->getUserLayoutPath($layout_srl). 'layout.html';
|
||||
$temp = $this->getUserLayoutTempHtml($layout_srl);
|
||||
if($this->useUserLayoutTemp == 'temp')
|
||||
{
|
||||
$temp = $this->getUserLayoutTempHtml($layout_srl);
|
||||
if(!file_exists(FileHandler::getRealPath($temp))) FileHandler::copyFile($src,$temp);
|
||||
return $temp;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,154 +39,180 @@ class layoutView extends layout
|
|||
*/
|
||||
public function dispLayoutPreviewWithModule()
|
||||
{
|
||||
// admin check
|
||||
// this act is admin view but in normal view because do not load admin css/js files
|
||||
$logged_info = Context::get('logged_info');
|
||||
if($logged_info->is_admin != 'Y')
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
|
||||
$content = '';
|
||||
$layoutSrl = Context::get('layout_srl');
|
||||
$layoutVars = Context::get('layout_vars');
|
||||
$layoutVars = json_decode($layoutVars);
|
||||
|
||||
$moduleSrl = Context::get('target_module_srl');
|
||||
$module = Context::get('module_name');
|
||||
$mid = Context::get('target_mid');
|
||||
$skin = Context::get('skin');
|
||||
$skinVars = Context::get('skin_vars');
|
||||
$skinVars = json_decode($skinVars);
|
||||
|
||||
$skinType = Context::get('skin_type');
|
||||
$type = ($skinType == 'M') ? 'mobile' : 'view';
|
||||
|
||||
if($module == 'ARTICLE')
|
||||
try
|
||||
{
|
||||
$module = 'page';
|
||||
$page_type = 'ARTICLE';
|
||||
$document_srl = 0;
|
||||
}
|
||||
|
||||
if($module)
|
||||
{
|
||||
$oModuleModel = getModel('module');
|
||||
$xml_info = $oModuleModel->getModuleActionXml($module);
|
||||
//create content
|
||||
if(!$mid && !$moduleSrl)
|
||||
// admin check
|
||||
// this act is admin view but in normal view because do not load admin css/js files
|
||||
$logged_info = Context::get('logged_info');
|
||||
if($logged_info->is_admin != 'Y')
|
||||
{
|
||||
if($skin && !$module)
|
||||
throw new Exception(Context::getLang('msg_invalid_request'));
|
||||
}
|
||||
|
||||
// if module is 'ARTiCLE' and from site design setting, make content directly
|
||||
if($module == 'ARTICLE' && !$mid)
|
||||
{
|
||||
$oDocumentModel = &getModel('document');
|
||||
$oDocument = $oDocumentModel->getDocument(0, true);
|
||||
|
||||
$t = Context::getLang('article_preview_title');
|
||||
|
||||
$c = '';
|
||||
for($i = 0; $i < 4; $i++)
|
||||
{
|
||||
return $this->stop(-1, 'msg_invalid_request');
|
||||
$c .= '<p>';
|
||||
for($j = 0; $j < 20; $j++)
|
||||
{
|
||||
$c .= Context::getLang('article_preview_content') . ' ';
|
||||
}
|
||||
$c .= '</p>';
|
||||
}
|
||||
|
||||
$oModule = ModuleHandler::getModuleInstance($module, $type);
|
||||
$oModule->setAct($xml_info->default_index_act);
|
||||
$module_info = new stdClass();
|
||||
$module_info->module = $module;
|
||||
$module_info->module_type = $type;
|
||||
$module_info->page_type = $page_type;
|
||||
$module_info->document_srl= $document_srl;
|
||||
$oModule->setModuleInfo($module_info, $xml_info);
|
||||
$oModule->proc();
|
||||
$attr = new stdClass();
|
||||
$attr->title = $t;
|
||||
$attr->content = $c;
|
||||
$attr->document_srl = -1;
|
||||
$oDocument->setAttribute($attr, FALSE);
|
||||
|
||||
Context::set('oDocument', $oDocument);
|
||||
|
||||
if ($skinType == 'M')
|
||||
{
|
||||
$templatePath = './modules/page/m.skins/' . $skin;
|
||||
$templateFile = 'mobile';
|
||||
}
|
||||
else
|
||||
{
|
||||
$templatePath = './modules/page/skins/' . $skin;
|
||||
$templateFile = 'content';
|
||||
}
|
||||
|
||||
$oTemplate = TemplateHandler::getInstance();
|
||||
$content = $oTemplate->compile($templatePath, $templateFile);
|
||||
}
|
||||
|
||||
// else use real module
|
||||
else
|
||||
{
|
||||
$oModuleHandler = new ModuleHandler($module, '', $mid, '', $moduleSrl);
|
||||
$oModuleHandler->act = '';
|
||||
$oModuleHandler->init();
|
||||
$oModule = $oModuleHandler->procModule();
|
||||
$content = $this->procRealModule($module, $mid, $skin, $skinType);
|
||||
}
|
||||
Context::set('content', $content);
|
||||
|
||||
if($oModule->toBool())
|
||||
// find layout
|
||||
if($layoutSrl)
|
||||
{
|
||||
if($skin)
|
||||
if($layoutSrl == -1)
|
||||
{
|
||||
$skinDir = ($skinType == 'M') ? 'm.skins' : 'skins';
|
||||
$template_path = sprintf("%s%s/%s/",$oModule->module_path, $skinDir, $skin);
|
||||
$oModule->setTemplatePath($template_path);
|
||||
$site_srl = ($oModule) ? $oModule->module_info->site_srl : 0;
|
||||
$designInfoFile = sprintf(_XE_PATH_.'/files/site_design/design_%s.php', $site_srl);
|
||||
@include($designInfoFile);
|
||||
|
||||
if(is_array($skinVars))
|
||||
if($skinType == 'M')
|
||||
{
|
||||
foreach($skinVars as $key => $val)
|
||||
{
|
||||
$oModule->module_info->{$key} = $val;
|
||||
}
|
||||
$layoutSrl = $designInfo->mlayout_srl;
|
||||
}
|
||||
else
|
||||
{
|
||||
$layoutSrl = $designInfo->layout_srl;
|
||||
}
|
||||
}
|
||||
|
||||
require_once("./classes/display/HTMLDisplayHandler.php");
|
||||
$handler = new HTMLDisplayHandler();
|
||||
$output = $handler->toDoc($oModule);
|
||||
Context::set('content', $output);
|
||||
}
|
||||
else
|
||||
{
|
||||
Context::set('content', Context::getLang('not_support_layout_preview'));
|
||||
$oLayoutModel = getModel('layout');
|
||||
$layoutInfo = $oLayoutModel->getLayout($layoutSrl);
|
||||
|
||||
// If there is no layout, pass it.
|
||||
if($layoutInfo)
|
||||
{
|
||||
// Adhoc...
|
||||
|
||||
// Input extra_vars into $layout_info
|
||||
if($layoutInfo->extra_var_count)
|
||||
{
|
||||
|
||||
foreach($layoutInfo->extra_var as $var_id => $val)
|
||||
{
|
||||
if($val->type == 'image')
|
||||
{
|
||||
if(preg_match('/^\.\/files\/attach\/images\/(.+)/i', $val->value))
|
||||
{
|
||||
$val->value = Context::getRequestUri() . substr($val->value, 2);
|
||||
}
|
||||
}
|
||||
$layoutInfo->{$var_id} = $val->value;
|
||||
}
|
||||
}
|
||||
|
||||
// Set menus into context
|
||||
if($layoutInfo->menu_count)
|
||||
{
|
||||
foreach($layoutInfo->menu as $menu_id => $menu)
|
||||
{
|
||||
// set default menu set(included home menu)
|
||||
if(!$menu->menu_srl || $menu->menu_srl == -1)
|
||||
{
|
||||
$oMenuAdminController = getAdminController('menu');
|
||||
$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
|
||||
|
||||
if(file_exists($homeMenuCacheFile))
|
||||
{
|
||||
@include($homeMenuCacheFile);
|
||||
}
|
||||
|
||||
if(!$menu->menu_srl)
|
||||
{
|
||||
$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
|
||||
$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
|
||||
$layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl;
|
||||
}
|
||||
else
|
||||
{
|
||||
$menu->xml_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->xml_file);
|
||||
$menu->php_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->php_file);
|
||||
}
|
||||
}
|
||||
if(file_exists($menu->php_file))
|
||||
{
|
||||
@include($menu->php_file);
|
||||
}
|
||||
Context::set($menu_id, $menu);
|
||||
}
|
||||
}
|
||||
|
||||
Context::set('layout_info', $layoutInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
catch(Exception $e)
|
||||
{
|
||||
Context::set('content', Context::getLang('layout_preview_content'));
|
||||
}
|
||||
|
||||
if($layoutSrl)
|
||||
{
|
||||
if($layoutSrl == -1)
|
||||
{
|
||||
$site_srl = ($oModule) ? $oModule->module_info->site_srl : 0;
|
||||
$designInfoFile = sprintf(_XE_PATH_.'/files/site_design/design_%s.php', $site_srl);
|
||||
@include($designInfoFile);
|
||||
$layoutSrl = $designInfo->layout_srl;
|
||||
}
|
||||
|
||||
$oLayoutModel = getModel('layout');
|
||||
$layoutInfo = $oLayoutModel->getLayout($layoutSrl);
|
||||
|
||||
if(!$layoutInfo)
|
||||
{
|
||||
return new Object(-1, 'msg_invalid_request');
|
||||
}
|
||||
|
||||
// Set names and values of extra_vars to $layout_info
|
||||
if($layoutInfo->extra_var_count)
|
||||
{
|
||||
foreach($layoutInfo->extra_var as $var_id => $val)
|
||||
{
|
||||
$layoutInfo->{$var_id} = $val->value;
|
||||
}
|
||||
}
|
||||
|
||||
if($layoutVars)
|
||||
{
|
||||
foreach($layoutVars as $key => $val)
|
||||
{
|
||||
$layoutInfo->{$key} = $val;
|
||||
}
|
||||
}
|
||||
|
||||
// menu in layout information becomes an argument for Context:: set
|
||||
if($layoutInfo->menu_count)
|
||||
{
|
||||
foreach($layoutInfo->menu as $menu_id => $menu)
|
||||
{
|
||||
if(file_exists($menu->php_file)) @include($menu->php_file);
|
||||
Context::set($menu_id, $menu);
|
||||
}
|
||||
}
|
||||
|
||||
Context::set('layout_info', $layoutInfo);
|
||||
$content = '<div class="message error"><p id="preview_error">' . $e->getMessage() . '</p></div>';
|
||||
Context::set('content', $content);
|
||||
$layoutSrl = 0;
|
||||
}
|
||||
|
||||
// Compile
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
$oTemplate = TemplateHandler::getInstance();
|
||||
Context::clearHtmlHeader();
|
||||
if($layoutSrl)
|
||||
|
||||
if($layoutInfo)
|
||||
{
|
||||
$layout_path = $layoutInfo->path;
|
||||
$editLayoutTPL = $this->getRealLayoutFile($layoutSrl);
|
||||
$editLayoutCSS = $this->getRealLayoutCSS($layoutSrl);
|
||||
if($editLayoutCSS != '')
|
||||
{
|
||||
Context::addCSSFile($editLayoutCSS);
|
||||
}
|
||||
$layout_file = 'layout';
|
||||
$oModuleModel = getModel('module');
|
||||
$part_config= $oModuleModel->getModulePartConfig('layout',$layoutSrl);
|
||||
$part_config = $oModuleModel->getModulePartConfig('layout', $layoutSrl);
|
||||
Context::addHtmlHeader($part_config->header_script);
|
||||
}
|
||||
else
|
||||
|
|
@ -194,16 +220,94 @@ class layoutView extends layout
|
|||
$layout_path = './common/tpl';
|
||||
$layout_file = 'default_layout';
|
||||
}
|
||||
$layout_tpl = $oTemplate->compile($layout_path, $layout_file);
|
||||
|
||||
$layout_tpl = $oTemplate->compile($layout_path, $layout_file, $editLayoutTPL);
|
||||
Context::set('layout','none');
|
||||
|
||||
// Convert widgets and others
|
||||
$oContext = &Context::getInstance();
|
||||
$oContext = Context::getInstance();
|
||||
Context::set('layout_tpl', $layout_tpl);
|
||||
Context::set('admin_bar', 'false');
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('layout_preview');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content of real module
|
||||
*
|
||||
* @param string $module module name
|
||||
* @param string $mid module id
|
||||
* @param string $skin skin name
|
||||
* @param string $skinType PC(P) or mobile(M)
|
||||
* @return string content of real module
|
||||
*/
|
||||
private function procRealModule($module, $mid, $skin, $skinType)
|
||||
{
|
||||
// if form site design and preview module, find target module
|
||||
if($module && !$mid)
|
||||
{
|
||||
$args = new stdClass();
|
||||
$args->module = $module;
|
||||
$output = executeQuery('layout.getOneModuleInstanceByModuleName', $args);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
throw new Exception($output->getMessage());
|
||||
}
|
||||
|
||||
// if there is no module instance, error...
|
||||
if(!$output->data)
|
||||
{
|
||||
throw new Exception(Context::getLang('msg_unabled_preview'));
|
||||
}
|
||||
|
||||
$mid = current($output->data)->mid;
|
||||
}
|
||||
|
||||
// if form site design and preview layout, find start module
|
||||
elseif(!$module && !$mid)
|
||||
{
|
||||
$oModuleModel = getModel('module');
|
||||
$columnList = array('modules.mid', 'sites.index_module_srl');
|
||||
$startModuleInfo = $oModuleModel->getSiteInfo(0, $columnList);
|
||||
$mid = $startModuleInfo->mid;
|
||||
}
|
||||
|
||||
$oModuleHandler = new ModuleHandler('', '', $mid, '', '');
|
||||
|
||||
// Adhoc...
|
||||
$oModuleHandler->act = '';
|
||||
|
||||
$oModuleHandler->init();
|
||||
|
||||
// Adhoc...
|
||||
$oModuleHandler->module_info->use_mobile = 'Y';
|
||||
$oModuleHandler->module_info->is_skin_fix = 'Y';
|
||||
$oModuleHandler->module_info->is_mskin_fix = 'Y';
|
||||
|
||||
if($skinType == 'M')
|
||||
{
|
||||
Mobile::setMobile(TRUE);
|
||||
$oModuleHandler->module_info->mskin = $skin;
|
||||
}
|
||||
else
|
||||
{
|
||||
Mobile::setMobile(FALSE);
|
||||
$oModuleHandler->module_info->skin = $skin;
|
||||
}
|
||||
|
||||
// Proc module
|
||||
$oModule = $oModuleHandler->procModule();
|
||||
if(!$oModule->toBool())
|
||||
{
|
||||
throw new Exception(Context::getLang('not_support_layout_preview'));
|
||||
}
|
||||
|
||||
// get module html
|
||||
require_once("./classes/display/HTMLDisplayHandler.php");
|
||||
$handler = new HTMLDisplayHandler();
|
||||
return $handler->toDoc($oModule);
|
||||
}
|
||||
|
||||
/**
|
||||
* Preview a layout
|
||||
* @return void|Object (void : success, Object : fail)
|
||||
|
|
@ -269,6 +373,40 @@ class layoutView extends layout
|
|||
$this->setTemplateFile('layout_preview');
|
||||
}
|
||||
|
||||
private function getRealLayoutFile($layoutSrl)
|
||||
{
|
||||
$oLayoutModel = getModel('layout');
|
||||
$layoutFile = $oLayoutModel->getUserLayoutHtml($layoutSrl);
|
||||
|
||||
if(file_exists($layoutFile))
|
||||
{
|
||||
return $layoutFile;
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function getRealLayoutCSS($layoutSrl)
|
||||
{
|
||||
$oLayoutModel = getModel('layout');
|
||||
$cssFile = $oLayoutModel->getUserLayoutCss($layoutSrl);
|
||||
|
||||
if(file_exists($cssFile))
|
||||
{
|
||||
return $cssFile;
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
/* End of file layout.view.php */
|
||||
/* Location: ./modules/layout/layout.view.php */
|
||||
|
|
|
|||
18
modules/layout/queries/getOneModuleInstanceByModuleName.xml
Normal file
18
modules/layout/queries/getOneModuleInstanceByModuleName.xml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<query id="getOneModuleInstanceByModuleName" action="select">
|
||||
<tables>
|
||||
<table name="modules" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="mid" />
|
||||
<column name="module_srl" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="module" var="module" notnull="notnull" />
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="sort_index" default="regdate" order="order_type" />
|
||||
<list_count var="d" default="1" />
|
||||
<page_count var="d" default="10" />
|
||||
<page var="d" default="1" />
|
||||
</navigation>
|
||||
</query>
|
||||
|
|
@ -1,10 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ruleset version="1.5.0">
|
||||
<customrules>
|
||||
<rule name="imageExtension" type="regex" test="/\.(gif|jpg|jpeg|gif|png|swf|flv)$/i" />
|
||||
<rule name="imageExtension" type="regex" test="/\.(gif|jpg|jpeg|gif|png|swf|flv)$/i">
|
||||
<message xml:lang="ko">%s은 gif, png, jpg, swf, flv 파일만 가능합니다.</message>
|
||||
</rule>
|
||||
</customrules>
|
||||
<fields>
|
||||
<field name="user_layout_image['name']" required="true" rule="imageExtension" />
|
||||
<field name="user_layout_image" required="true" rule="imageExtension">
|
||||
<title xml:lang="ko">파일</title>
|
||||
</field>
|
||||
<field name="layout_srl" required="true" rule="number" />
|
||||
</fields>
|
||||
</ruleset>
|
||||
|
|
|
|||
|
|
@ -1,15 +1,23 @@
|
|||
<script>
|
||||
var newTitle = '{$lang->new_title}';
|
||||
var layoutTitle = '{$layout->layout_title}';
|
||||
var addLang = '{$lang->cmd_insert}';
|
||||
</script>
|
||||
<load target="js/layout_admin.js" usecdn="true" />
|
||||
|
||||
<form action="./" method="post" id="__layout_copy">
|
||||
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/layout/tpl/copy_layout/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
|
||||
<p>{$XE_VALIDATOR_MESSAGE}</p>
|
||||
</div>
|
||||
|
||||
<form action="./" method="post">
|
||||
<div class="x_modal-header">
|
||||
<h1>{$lang->cmd_layout_copy}</h1>
|
||||
</div>
|
||||
<div class="x_modal-body x_form-horizontal">
|
||||
<div class="x_modal-body x_form-horizontal" id="inputDiv">
|
||||
<input type="hidden" name="layout" value="{$layout->layout}" />
|
||||
<input type="hidden" name="act" value="procLayoutAdminCopyLayout" />
|
||||
<input type="hidden" name="layout_srl" value="{$layout->layout_srl}" />
|
||||
<input type="hidden" name="xe_validator_id" value="modules/layout/tpl/copy_layout/1" />
|
||||
<div class="x_control-group">
|
||||
<div class="x_control-label">{$lang->layout_name}</div>
|
||||
<div class="x_controls">{$layout->title}</div>
|
||||
|
|
@ -29,7 +37,7 @@ var addLang = '{$lang->cmd_insert}';
|
|||
</div>
|
||||
</div>
|
||||
<div class="x_modal-footer">
|
||||
<button type="button" class="x_btn x_pull-left" data-hide="#__layout_copy">{$lang->cmd_close}</button>
|
||||
<button type="button" class="x_btn x_pull-left" onclick="window.close();">{$lang->cmd_close}</button>
|
||||
<input type="submit" value="{$lang->cmd_save}" class="x_btn x_btn-primary x_pull-right" />
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<div class="x_page-header">
|
||||
<h1>
|
||||
{$lang->installed_layout} <a class="x_icon-question-sign" href="./help/index.html#UMAN_advanced_installed_layout" target="_blank">{$lang->help}</a>
|
||||
{$lang->installed_layout} <a class="x_icon-question-sign" href="./admin/help/index.html#UMAN_advanced_installed_layout" target="_blank">{$lang->help}</a>
|
||||
<span cond="$layout_info" class="path" title="{$layout_info->layout}">> {$layout_info->title} v{$layout_info->version}</span>
|
||||
<span cond="$selected_layout" class="path" title="{$selected_layout->layout}">> {$selected_layout->title} v{$selected_layout->version}</span>
|
||||
<span cond="$selected_layout" class="path">> {$selected_layout->layout_title}</span>
|
||||
|
|
@ -52,6 +52,16 @@
|
|||
</div>
|
||||
</section>
|
||||
|
||||
<div cond="$XE_VALIDATOR_MESSAGE" class="x_alert x_alert-{$XE_VALIDATOR_MESSAGE_TYPE}">
|
||||
{@
|
||||
$validator_ids = array(
|
||||
'modules/layout/tpl/layout_all_instance_list/1' => 1,
|
||||
'modules/autoinstall/tpl/uninstall/1' => 1,
|
||||
'modules/layouts/tpl/layout_edit/1' => 1,
|
||||
'modules/layout/tpl/lyaout_info_view/1' => 1,
|
||||
'modules/layout/tpl/layout_instance_list/1' => 1,
|
||||
'modules/layout/tpl/layout_instance_list/2' => 1
|
||||
);
|
||||
}
|
||||
<div cond="$XE_VALIDATOR_MESSAGE && isset($validator_ids[$XE_VALIDATOR_ID])" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
|
||||
<p>{$XE_VALIDATOR_MESSAGE}</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
<block cond="$use_multilang">
|
||||
<div id="langEdit" class="langEdit tgContent">
|
||||
<ul class="langList"></ul>
|
||||
<div class="langInput form">
|
||||
<h2>{$lang->multilingual} <strong>{$lang->cmd_modify}</strong> | <a href="#langEdit">{$lang->cmd_insert}</a></h2>
|
||||
<ul>
|
||||
{@
|
||||
/* move current language to the top */
|
||||
$a = array($lang_type=>$lang_supported[$lang_type]);
|
||||
unset($lang_supported[$lang_type]);
|
||||
$lang_supported = array_merge($a, $lang_supported);
|
||||
}
|
||||
<li loop="$lang_supported=>$code,$name" class="{$code}"><label for="{$code}_var1">{$name}</label> <input type="text" value="" id="{$code}_var1" /></li>
|
||||
</ul>
|
||||
<div class="action">
|
||||
<div class="btnArea">
|
||||
<input class="btn" type="submit" value="{$lang->use}|{$lang->use_after_save}" />
|
||||
</div>
|
||||
<p><a href="{getUrl('act','dispModuleAdminLangcode')}">{$lang->multilingual_manager}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</block>
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
<block cond="$use_multilang_textarea">
|
||||
<style>
|
||||
#langEditTextarea textarea { width: 258px; }
|
||||
</style>
|
||||
|
||||
<div id="langEditTextarea" class="langEdit tgContent">
|
||||
<ul class="langList"></ul>
|
||||
<div class="langInput form">
|
||||
<h2>{$lang->multilingual} <strong>{$lang->cmd_modify}</strong> | <a href="#langEdit">{$lang->cmd_insert}</a></h2>
|
||||
<ul>
|
||||
{@
|
||||
/* move current language to the top */
|
||||
$a = array($lang_type=>$lang_supported[$lang_type]);
|
||||
unset($lang_supported[$lang_type]);
|
||||
$lang_supported = array_merge($a, $lang_supported);
|
||||
}
|
||||
<li loop="$lang_supported=>$code,$name" class="{$code}"><label for="{$code}_var1">{$name}</label> <textarea id="{$code}_var1" rows="8" cols="42"></textarea></li>
|
||||
</ul>
|
||||
<div class="action">
|
||||
<div class="btnArea">
|
||||
<input class="btn" type="submit" value="{$lang->use}|{$lang->use_after_save}" />
|
||||
</div>
|
||||
<p><a href="{getUrl('act','dispModuleAdminLangcode')}">{$lang->multilingual_manager}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</block>
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
<include target="header.html" />
|
||||
<include target="sub_tab.html" />
|
||||
|
||||
<table class="x_table x_table-striped x_table-hover dsTg">
|
||||
<caption>
|
||||
<div class="x_pull-right x_btn-group">
|
||||
|
|
|
|||
|
|
@ -51,16 +51,21 @@ function deleteFile(layout_srl,filename){
|
|||
|
||||
function addLayoutCopyInputbox()
|
||||
{
|
||||
var html = '<tr>';
|
||||
html += '<td><input type="text" name="title[]" size="50" /></td>';
|
||||
html += '<td><input class="btn" type="button" value="'+addLang+'" onclick="addLayoutCopyInputbox()" /></td>';
|
||||
html += '</tr>';
|
||||
var html = '<div class="x_control-group">';
|
||||
html += '<label class="x_control-label" for="">'+newTitle+'</label>';
|
||||
html += '<div class="x_controls">';
|
||||
html += '<span class="x_input-append">';
|
||||
html += '<input type="text" name="title[]" required placeholder="'+layoutTitle+'" />';
|
||||
html += '<input type="button" value="'+addLang+'" onclick="addLayoutCopyInputbox()" class="x_btn" />';
|
||||
html += '</span>';
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
|
||||
var it = jQuery('#inputTable');
|
||||
var it = jQuery('#inputDiv');
|
||||
it.append(html);
|
||||
|
||||
it.find('SPAN.btn').hide();
|
||||
it.find('TR:last-child SPAN.btn').show();
|
||||
|
||||
it.find('input.x_btn').hide();
|
||||
it.find('>div:last-child').find('input.x_btn').show();
|
||||
}
|
||||
|
||||
(function($){
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
<input type="hidden" name="act" value="procLayoutAdminDelete" />
|
||||
<input type="hidden" name="layout_srl" value="{$item->layout_srl}" />
|
||||
<input class="x_btn x_btn-link" type="submit" value="{$lang->cmd_delete}" />
|
||||
<input type="hidden" name="xe_validator_id" value="modules/layout/tpl/layout_all_instance_list/1" />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<include target="header.html" />
|
||||
<load target="js/adminEdit.js" usecdn="true" />
|
||||
<p>{nl2br($lang->about_layout_code)}</p>
|
||||
|
||||
<section class="section">
|
||||
<h1>{$lang->layout_image_repository}</h1>
|
||||
<p>{nl2br($lang->about_layout_image_repository)}</p>
|
||||
|
|
@ -30,12 +29,17 @@
|
|||
</li>
|
||||
</ul>
|
||||
|
||||
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/layout/tpl/layout_edit/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
|
||||
<p>{$XE_VALIDATOR_MESSAGE}</p>
|
||||
</div>
|
||||
|
||||
<form ruleset="imageUpload" action="./" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="module" value="layout" />
|
||||
<input type="hidden" name="act" value="procLayoutAdminUserImageUpload" />
|
||||
<input type="hidden" name="layout_srl" value="{$layout_srl}" />
|
||||
<input type="hidden" name="xe_validator_id" value="modules/layout/tpl/layout_edit/1" />
|
||||
<p>
|
||||
<input type="file" class="overlap" name="user_layout_image" value="" title="{$lang->uploaded_file}" />
|
||||
<input type="file" name="user_layout_image" value="" title="{$lang->uploaded_file}" />
|
||||
<span class="x_help-inline">{$lang->msg_layout_image_target}</span>
|
||||
</p>
|
||||
<div class="x_clearfix btnArea">
|
||||
|
|
@ -60,6 +64,7 @@
|
|||
<input type="hidden" name="module" value="layout" />
|
||||
<input type="hidden" name="layout_srl" value="{$layout_srl}" />
|
||||
<input type="hidden" name="act" value="procLayoutAdminCodeUpdate" />
|
||||
<input type="hidden" name="xe_validator_id" value="modules/layouts/tpl/layout_edit/1" />
|
||||
|
||||
<section class="section">
|
||||
<h1>HTML</h1>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
<section class="section">
|
||||
<h1>{$lang->layout_image_repository}</h1>
|
||||
<p>{nl2br($lang->about_layout_image_repository)}</p>
|
||||
|
|
@ -30,12 +31,8 @@
|
|||
<input type="hidden" name="module" value="layout" />
|
||||
<input type="hidden" name="act" value="procLayoutAdminUserImageUpload" />
|
||||
<input type="hidden" name="layout_srl" value="{$layout_srl}" />
|
||||
<p>
|
||||
<span class="x_btn fileBtn0">
|
||||
{$lang->uploaded_file} <input style="background: none" type="file" name="user_layout_image" value="" title="{$lang->uploaded_file}" />
|
||||
</span>
|
||||
<div><span class="x_help-inline">{$lang->msg_layout_image_target}</span></div>
|
||||
</p>
|
||||
<input type="file" name="user_layout_image" value="" title="{$lang->uploaded_file}" />
|
||||
<p>{$lang->msg_layout_image_target}</p>
|
||||
<div class="x_clearfix btnArea">
|
||||
<div class="x_pull-right">
|
||||
<button type="submit" class="x_btn x_btn-primary">{$lang->cmd_upload}</button>
|
||||
|
|
@ -100,3 +97,4 @@
|
|||
</span>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<input type="hidden" name="layout_srl" value="{$layout_srl}" />
|
||||
<input type="hidden" name="layout" value="{$selected_layout->layout}" />
|
||||
<input type="hidden" name="_layout_type" value="{$selected_layout->layout_type}" />
|
||||
<input type="hidden" name="xe_validator_id" value="modules/layout/tpl/lyaout_info_view/1" />
|
||||
<!--// For submit config. Do not delete this division. -->
|
||||
<div></div>
|
||||
</form>
|
||||
|
|
@ -12,19 +13,19 @@
|
|||
<section id="layout_config" class="x_form-horizontal">
|
||||
<div cond="$selected_layout->path" class="x_control-group">
|
||||
<label class="x_control-label">{$lang->path}</label>
|
||||
<div class="x_controls">
|
||||
<div class="x_controls" style="padding-top:5px">
|
||||
{$selected_layout->path}
|
||||
</div>
|
||||
</div>
|
||||
<div cond="$selected_layout->description" class="x_control-group">
|
||||
<label class="x_control-label">{$lang->description}</label>
|
||||
<div class="x_controls">
|
||||
<div class="x_controls" style="padding-top:5px">
|
||||
{$selected_layout->description}
|
||||
</div>
|
||||
</div>
|
||||
<div cond="$selected_layout->author" class="x_control-group">
|
||||
<label class="x_control-label">{$lang->author}</label>
|
||||
<div class="x_controls">
|
||||
<div class="x_controls" style="padding-top:5px">
|
||||
<block loop="$selected_layout->author=>$author_info">
|
||||
<!--@if($author_info->homepage)-->
|
||||
<a href="{$author_info->homepage}" target="_blank">{$author_info->name}</a>
|
||||
|
|
@ -73,7 +74,7 @@
|
|||
{@$cnt ++}
|
||||
</block>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="{$name}">{$var->title}</label>
|
||||
<label class="x_control-label" for="{$name}"|cond="$var->type!='text'&&$var->type!='textarea'" for="lang_{$name}"|cond="$var->type=='text'||$var->type=='textarea'">{$var->title}</label>
|
||||
<div class="x_controls">
|
||||
<div cond="$var->type == 'text'">
|
||||
<input type="text" name="{$name}" id="{$name}" class="lang_code" value="<!--@if(strpos($var->value, "$user_lang->") !== false)-->{htmlspecialchars($var->value)}<!--@else-->{$var->value}<!--@end-->" />
|
||||
|
|
@ -160,6 +161,10 @@
|
|||
</section>
|
||||
|
||||
<div class="x_clearfix btnArea">
|
||||
<span class="etc">
|
||||
<a cond="$layout" class="x_btn" href="{getUrl('', 'module', 'admin', 'act', 'dispLayoutAdminInstanceList', 'layout', $selected_layout->layout)}">{$lang->cmd_list}</a>
|
||||
<a cond="!$layout" class="x_btn" href="{getUrl('', 'module', 'admin', 'act', 'dispLayoutAdminAllInstanceList')}">{$lang->cmd_list}</a>
|
||||
</span>
|
||||
<span class="x_btn-group x_pull-right">
|
||||
<input class="x_btn x_btn-primary" type="submit" value="{$lang->cmd_save}" onclick="doSubmitConfig()"/>
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ xe.lang.confirm_delete = '{$lang->confirm_delete}';
|
|||
<input type="hidden" name="act" value="procLayoutAdminDelete" />
|
||||
<input type="hidden" name="layout_srl" value="{$layout->layout_srl}" />
|
||||
<input class="x_btn x_btn-link" type="submit" value="{$lang->cmd_delete}" />
|
||||
<input type="hidden" name="xe_validator_id" value="modules/layout/tpl/layout_instance_list/1" />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -47,12 +48,13 @@ xe.lang.confirm_delete = '{$lang->confirm_delete}';
|
|||
</div>
|
||||
|
||||
<section id="insertLayout" class="x_modal">
|
||||
<form ruleset="insertLayout" action="./" class="x_form-horizontal">
|
||||
<form action="./" method="post" ruleset="insertLayout" class="x_form-horizontal">
|
||||
<input type="hidden" name="module" value="layout" />
|
||||
<input type="hidden" name="act" value="procLayoutAdminInsert" />
|
||||
<input type="hidden" name="layout" value="{$layout_info->layout}" />
|
||||
<input type="hidden" name="_layout_type" value="{$type}" />
|
||||
<input type="hidden" name="success_return_url" value="{getUrl('act', 'dispLayoutAdminInstanceList')}" />
|
||||
<input type="hidden" name="xe_validator_id" value="modules/layout/tpl/layout_instance_list/2" />
|
||||
<div class="x_modal-header">
|
||||
<h1>{$lang->cmd_insert}</h1>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue