mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
issue 70 multilingual developement in module module.
but yet not completed at js git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8839 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
52bab54234
commit
e7b9691c62
9 changed files with 283 additions and 74 deletions
|
|
@ -145,46 +145,50 @@
|
|||
'subMenu'=>array('rss'),
|
||||
),
|
||||
9=>array(
|
||||
'module'=>'module',
|
||||
'subMenu'=>array('multilingual'),
|
||||
),
|
||||
10=>array(
|
||||
'module'=>'importer',
|
||||
'subMenu'=>array('importer'),
|
||||
),
|
||||
10=>array(
|
||||
11=>array(
|
||||
'module'=>'admin',
|
||||
'subMenu'=>array('theme'),
|
||||
),
|
||||
11=>array(
|
||||
12=>array(
|
||||
'module'=>'autoinstall',
|
||||
'subMenu'=>array('easyInstall'),
|
||||
),
|
||||
12=>array(
|
||||
13=>array(
|
||||
'module'=>'layout',
|
||||
'subMenu'=>array('installedLayout'),
|
||||
),
|
||||
13=>array(
|
||||
14=>array(
|
||||
'module'=>'module',
|
||||
'subMenu'=>array('installedModule'),
|
||||
),
|
||||
14=>array(
|
||||
15=>array(
|
||||
'module'=>'widget',
|
||||
'subMenu'=>array('installedWidget'),
|
||||
),
|
||||
15=>array(
|
||||
16=>array(
|
||||
'module'=>'addon',
|
||||
'subMenu'=>array('installedAddon'),
|
||||
),
|
||||
16=>array(
|
||||
17=>array(
|
||||
'module'=>'editor',
|
||||
'subMenu'=>array('editor'),
|
||||
),
|
||||
17=>array(
|
||||
18=>array(
|
||||
'module'=>'spamfilter',
|
||||
'subMenu'=>array('spamFilter'),
|
||||
),
|
||||
18=>array(
|
||||
19=>array(
|
||||
'module'=>'admin',
|
||||
'subMenu'=>array('adminConfiguration', 'adminMenuSetup'),
|
||||
),
|
||||
19=>array(
|
||||
20=>array(
|
||||
'module'=>'file',
|
||||
'subMenu'=>array('fileUpload'),
|
||||
),
|
||||
|
|
@ -246,6 +250,7 @@
|
|||
case 'file':
|
||||
case 'poll':
|
||||
case 'rss':
|
||||
case 'multilingual':
|
||||
case 'importer':
|
||||
return 'content';
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<action name="dispModuleAdminModuleAdditionSetup" type="view" standalone="true" />
|
||||
<action name="dispModuleAdminModuleGrantSetup" type="view" standalone="true" />
|
||||
<action name="dispModuleAdminCopyModule" type="view" standalone="true" />
|
||||
<action name="dispModuleAdminLangcode" type="view" standalone="true" />
|
||||
<action name="dispModuleAdminLangcode" type="view" standalone="true" menu_name="multilingual" menu_index="true" />
|
||||
|
||||
<action name="dispModuleFileBox" type="view" standalone="true" />
|
||||
<action name="dispModuleFileBoxAdd" type="view" standalone="true" />
|
||||
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
<action name="getModuleAdminModuleList" type="model" standalone="true" />
|
||||
<action name="getModuleAdminLangCode" type="model" standalone="true" />
|
||||
<action name="getModuleAdminLangListByName" type="model" standalone="true" />
|
||||
|
||||
<action name="procModuleAdminInsertCategory" type="controller" standalone="true" ruleset="insertCategory" />
|
||||
<action name="procModuleAdminUpdateCategory" type="controller" standalone="true" ruleset="updateCategory" />
|
||||
|
|
@ -56,5 +57,18 @@
|
|||
<title xml:lang="mn">Installed Module</title>
|
||||
<title xml:lang="tr">Installed Module</title>
|
||||
</menu>
|
||||
<menu name="multilingual">
|
||||
<title xml:lang="en">Multilingual</title>
|
||||
<title xml:lang="ko">다국어</title>
|
||||
<title xml:lang="zh-CN">Multilingual</title>
|
||||
<title xml:lang="jp">Multilingual</title>
|
||||
<title xml:lang="es">Multilingual</title>
|
||||
<title xml:lang="ru">Multilingual</title>
|
||||
<title xml:lang="fr">Multilingual</title>
|
||||
<title xml:lang="zh-TW">Multilingual</title>
|
||||
<title xml:lang="vi">Multilingual</title>
|
||||
<title xml:lang="mn">Multilingual</title>
|
||||
<title xml:lang="tr">Multilingual</title>
|
||||
</menu>
|
||||
</menus>
|
||||
</module>
|
||||
|
|
|
|||
|
|
@ -420,6 +420,12 @@
|
|||
$site_module_info = Context::get('site_module_info');
|
||||
$args->site_srl = (int)$site_module_info->site_srl;
|
||||
$args->name = str_replace(' ','_',Context::get('lang_code'));
|
||||
$args->lang_name = str_replace(' ','_',Context::get('lang_name'));
|
||||
if(!empty($args->lang_name)) $args->name = $args->lang_name;
|
||||
|
||||
// if args->name is empty, random generate for user define language
|
||||
if(empty($args->name)) $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100));
|
||||
|
||||
if(!$args->name) return new Object(-1,'msg_invalid_request');
|
||||
// Check whether a language code exists
|
||||
$output = executeQueryArray('module.getLang', $args);
|
||||
|
|
@ -442,6 +448,12 @@
|
|||
$this->makeCacheDefinedLangCode($args->site_srl);
|
||||
|
||||
$this->add('name', $args->name);
|
||||
$this->setMessage("success_saved", 'info');
|
||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispModuleAdminLangcode');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -452,11 +464,20 @@
|
|||
$site_module_info = Context::get('site_module_info');
|
||||
$args->site_srl = (int)$site_module_info->site_srl;
|
||||
$args->name = str_replace(' ','_',Context::get('name'));
|
||||
$args->lang_name = str_replace(' ','_',Context::get('lang_name'));
|
||||
if(!empty($args->lang_name)) $args->name = $args->lang_name;
|
||||
if(!$args->name) return new Object(-1,'msg_invalid_request');
|
||||
|
||||
$output = executeQuery('module.deleteLang', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
$this->makeCacheDefinedLangCode($args->site_srl);
|
||||
|
||||
$this->setMessage("success_deleted", 'info');
|
||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispModuleAdminLangcode');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function procModuleAdminGetList()
|
||||
|
|
|
|||
|
|
@ -180,5 +180,34 @@
|
|||
$output = $this->getLangCode($site_module_info->site_srl, '$user_lang->'.$name);
|
||||
$this->add('langs', $output);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return lang list
|
||||
**/
|
||||
function getModuleAdminLangListByName()
|
||||
{
|
||||
$args = Context::getRequestVars();
|
||||
if(!$args->site_srl) $args->site_srl = 0;
|
||||
$args->langName = $args->lang_name;
|
||||
$columnList = array('lang_code', 'value');
|
||||
|
||||
$langList = array();
|
||||
$output = executeQueryArray('module.getLangListByName', $args, $columnList);
|
||||
if($output->toBool()) $langList = $output->data;
|
||||
|
||||
$this->add('lang_list', $langList);
|
||||
$this->add('lang_name', $args->langName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return current lang list
|
||||
**/
|
||||
function getLangListByLangcode($args)
|
||||
{
|
||||
$output = executeQueryArray('module.getLangListByLangcode', $args);
|
||||
if(!$output->toBool()) return array();
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@
|
|||
/**
|
||||
* @brief Language codes
|
||||
**/
|
||||
function dispModuleAdminLangcode() {
|
||||
/*function dispModuleAdminLangcode() {
|
||||
// Get the language file of the current site
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$args->site_srl = (int)$site_module_info->site_srl;
|
||||
|
|
@ -195,7 +195,35 @@
|
|||
$this->setLayoutFile('popup_layout');
|
||||
// Set a template file
|
||||
$this->setTemplateFile('module_langcode');
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* @brief Language codes
|
||||
**/
|
||||
function dispModuleAdminLangcode() {
|
||||
// Get the language file of the current site
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$args->site_srl = (int)$site_module_info->site_srl;
|
||||
$args->langCode = Context::get('lang_type');
|
||||
$args->page = Context::get('page'); // /< Page
|
||||
$args->list_count = 30; // /< the number of posts to display on a single page
|
||||
$args->page_count = 5; // /< the number of pages that appear in the page navigation
|
||||
$args->sort_index = 'name';
|
||||
$args->order_type = 'asc';
|
||||
$args->search_target = Context::get('search_target'); // /< search (title, contents ...)
|
||||
$args->search_keyword = Context::get('search_keyword'); // /< keyword to search
|
||||
|
||||
$oModuleAdminModel = &getAdminModel('module');
|
||||
$output = $oModuleAdminModel->getLangListByLangcode($args);
|
||||
|
||||
Context::set('total_count', $output->total_count);
|
||||
Context::set('total_page', $output->total_page);
|
||||
Context::set('page', $output->page);
|
||||
Context::set('lang_code_list', $output->data);
|
||||
Context::set('page_navigation', $output->page_navigation);
|
||||
|
||||
// Set a template file
|
||||
$this->setTemplateFile('module_langcode');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
20
modules/module/queries/getLangListByLangcode.xml
Normal file
20
modules/module/queries/getLangListByLangcode.xml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<query id="getLangListByLangcode" action="select">
|
||||
<tables>
|
||||
<table name="lang" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="name" />
|
||||
<column name="value" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="site_srl" var="site_srl" notnull="notnull" filter="number" />
|
||||
<condition operation="in" column="lang_code" var="langCode" pipe="and" />
|
||||
<condition operation="like" column="value" var="search_keyword" pipe="and" />
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="sort_index" default="list_order" order="order_type" />
|
||||
<list_count var="list_count" default="20" />
|
||||
<page_count var="page_count" default="10" />
|
||||
<page var="page" default="1" />
|
||||
</navigation>
|
||||
</query>
|
||||
15
modules/module/queries/getLangListByName.xml
Normal file
15
modules/module/queries/getLangListByName.xml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<query id="getLangList" action="select">
|
||||
<tables>
|
||||
<table name="lang" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="*" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="site_srl" var="site_srl" notnull="notnull" filter="number" />
|
||||
<condition operation="in" column="name" var="langName" pipe="and" />
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="sort_index" default="lang_code" order="order_type" />
|
||||
</navigation>
|
||||
</query>
|
||||
32
modules/module/tpl/js/multilingual.js
Normal file
32
modules/module/tpl/js/multilingual.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
jQuery(function($){
|
||||
|
||||
$('li')
|
||||
.delegate('button._edit', 'click', function(){
|
||||
var $this = $(this);
|
||||
/*, site_srl = $this.data('site_srl');
|
||||
currentClickedSiteObject = $this;*/
|
||||
|
||||
var formObj = $this.parents().find('form').first();
|
||||
|
||||
// TODO : 모듈 목록을 찾아서 셀렉트 박스에 할당
|
||||
var params = new Array();
|
||||
var response_tags = ['error', 'message', 'lang_list', 'lang_name'];
|
||||
params['lang_name'] = formObj.find('input[name=lang_name]').val();
|
||||
|
||||
exec_xml('module','getModuleAdminLangListByName',params, completeGetModuleList, response_tags);
|
||||
});
|
||||
});
|
||||
|
||||
function completeGetModuleList(ret_obj, response_tags)
|
||||
{
|
||||
var langName = ret_obj['lang_name'];
|
||||
var langList = ret_obj['lang_list']['item'];
|
||||
if(!jQuery.isArray(langList)) langList = [langList];
|
||||
var htmlListBuffer = '';
|
||||
|
||||
for(var x in langList)
|
||||
{
|
||||
var objLang = langList[x];
|
||||
jQuery('#' + langName + '_' + objLang.lang_code).val(objLang.value);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,65 +1,110 @@
|
|||
<!--%import("./filter/insert_lang.xml")-->
|
||||
<!--%import("./js/module_admin.js")-->
|
||||
<!--%import("../../common/css/popup.css")-->
|
||||
|
||||
<div id="popHeader">
|
||||
<h3 class="xeAdmin">{$lang->lang_code}</h3>
|
||||
</div>
|
||||
|
||||
<div id="popBody">
|
||||
<table cellspacing="0" class="colTable">
|
||||
<col width="50%"/>
|
||||
<col width="50%"/>
|
||||
<tr>
|
||||
<td>
|
||||
<table cellspacing="0" class="rowTable">
|
||||
<tbody>
|
||||
<!--@foreach($lang_list as $key => $val)-->
|
||||
<tr>
|
||||
<td>
|
||||
<div class="fl"><a href="#" onclick="doInsertLangCode('{$val->name}','{$target}'); return false;">{$val->name}</a></div>
|
||||
<div class="fr">
|
||||
<a href="{getUrl('name',$val->name)}" class="buttonSet buttonActive"><span>{$lang->cmd_select}</span></a>
|
||||
<a href="#" onclick="if(confirm('{$lang->confirm_delete}')) doDeleteLang('{$val->name}','{$target}'); return false;" class="buttonSet buttonDelete"><span>{$lang->cmd_select}</span></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!--@end-->
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
<td>
|
||||
<form action="./" method="post" onsubmit="return procFilter(this, insert_lang)" id="menu_fo">
|
||||
<input type="hidden" name="target" value="{$target}" />
|
||||
<table cellspacing="0" class="rowTable">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><div>{$lang->lang_code}</div></th>
|
||||
<td>
|
||||
<input type="text" name="lang_code" value="{$name}" class="inputTypeText w200" />
|
||||
</td>
|
||||
</tr>
|
||||
<!--@foreach($lang_supported as $key => $val)-->
|
||||
<tr>
|
||||
<th scope="row"><div>{$val}</div></th>
|
||||
<td>
|
||||
<textarea name="{$key}" class="inputTypeTextArea" style="height:40px; width:90%;">{$selected_lang[$key]}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<!--@end-->
|
||||
<tr>
|
||||
<th class="button" colspan="2">
|
||||
<span class="button black strong"><input type="submit" value="{$lang->cmd_save}"></span>
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!--%import("js/multilingual.js")-->
|
||||
<div class="content" id="content">
|
||||
<div cond="$XE_VALIDATOR_MESSAGE" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
|
||||
<p>{$XE_VALIDATOR_MESSAGE}</p>
|
||||
</div>
|
||||
<h1 class="h1">Multilingual</h1>
|
||||
<p>현재 12 종류의 다국어 문자를 지원할 수 있습니다. 다른 종류의 다국어 지원을 원하는 경우 /common/lang/ 폴더의 다국어 가운데 하나의 세트를 번역해서 XE 개발자(contact@xpressengine.com)에게 보내주세요.</p>
|
||||
<div class="mLangEdit ko">
|
||||
<!-- 한국어일 때 "mLangEdit ko" | 영어일 때 "mLangEdit ko" | ... -->
|
||||
<div class="btnArea">
|
||||
<span class="btn"><a href="#addWord" class="modalAnchor">새로운 단어 또는 문장 추가...</a></span>
|
||||
</div>
|
||||
<ul>
|
||||
<!--@foreach($lang_code_list AS $key=>$value)-->
|
||||
{@$langName = $value->name}
|
||||
<li>
|
||||
<form action="./" method="post" class="form" id="langForm_{$langName}" >
|
||||
<input type="hidden" name="act" value="procModuleAdminInsertLang" />
|
||||
<input type="hidden" name="lang_name" value="{$langName}" />
|
||||
<strong>{$value->value}</strong> <button type="button" class="side text _edit">Edit</button>
|
||||
<ul>
|
||||
<!--@foreach($lang_supported AS $key2=>$value2)-->
|
||||
<li class="{$key2}"><label for="{$langName}_{$key2}">{$value2}</label> <textarea rows="1" cols="42" name="{$key2}" id="{$langName}_{$key2}"></textarea></li>
|
||||
<!--@end-->
|
||||
</ul>
|
||||
<div class="btnArea">
|
||||
<button type="submit" name="act" value="procModuleAdminInsertLang">{$lang->cmd_save}</button>
|
||||
<button type="submit" name="act" value="procModuleAdminDeleteLang">{$lang->cmd_delete}</button>
|
||||
</div>
|
||||
</form>
|
||||
</li>
|
||||
<!--@end-->
|
||||
</ul>
|
||||
<div class="btnArea">
|
||||
<span class="btn"><a href="#addWord" class="modalAnchor">새로운 단어 또는 문장 추가...</a></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal" id="addWord">
|
||||
<form action="" class="mLangEdit fg form">
|
||||
<h2 class="h2">새로운 단어 또는 문장 추가</h2>
|
||||
|
||||
<form action="./" method="post" class="form" id="langForm_new" >
|
||||
<input type="hidden" name="act" value="procModuleAdminInsertLang" />
|
||||
<ul>
|
||||
<!--@foreach($lang_supported AS $key2=>$value2)-->
|
||||
<li class="{$key2}"><label for="{$langName}_{$key2}">{$value2}</label> <textarea rows="1" cols="42" name="{$key2}" id="{$langName}_{$key2}"></textarea></li>
|
||||
<!--@end-->
|
||||
</ul>
|
||||
<div class="btnArea">
|
||||
<span class="btn small"><button type="submit">Save</button></span>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
</div>
|
||||
// 다국어 추가 삭제 관리 페이지 프로토타입. 태곤의 TO DO.
|
||||
<script type="text/javascript">
|
||||
jQuery(function(){ doFillLangName() });
|
||||
jQuery(function($){
|
||||
var ml = $('.mLangEdit');
|
||||
ml.find('>ul>li>ul').hide().end().find('>ul>li>.btnArea').hide(); // 하위 목록과 버튼 숨김
|
||||
ml.find('>ul>li>.side').click(function(){ // Edit 버튼을 클릭하면
|
||||
var tpi = $(this).parent('li');
|
||||
ml.find('>ul>li>ul:visible, >ul>li>.btnArea:visible') // 열린 하위 목록과 버튼 숨김
|
||||
.slideUp(200)
|
||||
.parent('li')
|
||||
.removeClass('active');
|
||||
tpi.children('ul:hidden, .btnArea:hidden') // 닫힌 하위 목록과 버튼 열기
|
||||
.slideDown(200)
|
||||
.parent('li')
|
||||
.addClass('active');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="search">
|
||||
<form action="" class="pagination">
|
||||
<input type="hidden" name="error_return_url" value="" />
|
||||
<input type="hidden" name="module" value="{$module}" />
|
||||
<input type="hidden" name="act" value="{$act}" />
|
||||
<input cond="$search_keyword" type="hidden" name="search_keyword" value="{$search_keyword}" />
|
||||
<input cond="$search_target" type="hidden" name="search_target" value="{$search_target}" />
|
||||
|
||||
<a href="{getUrl('page', '')}" class="direction">« FIRST</a>
|
||||
<block cond="$page_navigation->first_page + $page_navigation->page_count > $page_navigation->last_page && $page_navigation->page_count != $page_navigation->total_page">
|
||||
<a href="{getUrl('page', '')}">1</a>
|
||||
<a href="#goTo" class="tgSimple" title="{$lang->cmd_go_to_page}">...</a>
|
||||
</block>
|
||||
<!--@while($page_no = $page_navigation->getNextPage())-->
|
||||
{@$last_page = $page_no}
|
||||
<strong cond="$page_no == $page">{$page_no}</strong>
|
||||
<a cond="$page_no != $page" href="{getUrl('page', $page_no)}">{$page_no}</a>
|
||||
<!--@end-->
|
||||
<block cond="$last_page != $page_navigation->last_page">
|
||||
<a href="#goTo" class="tgSimple" title="{$lang->cmd_go_to_page}">...</a>
|
||||
<a href="{getUrl('page', $page_navigation->last_page)}">{$page_navigation->last_page}</a>
|
||||
</block>
|
||||
<a href="{getUrl('page', $page_navigation->last_page)}" class="direction">LAST »</a>
|
||||
<span id="goTo" class="tgContent">
|
||||
<input name="page" title="{$lang->cmd_go_to_page}" />
|
||||
<button type="submit">Go</button>
|
||||
</span>
|
||||
</form>
|
||||
|
||||
<form action="./" method="get">
|
||||
<input type="hidden" name="module" value="{$module}" />
|
||||
<input type="hidden" name="act" value="{$act}" />
|
||||
<input type="hidden" name="search_target" value="value" />
|
||||
<input title="search_keyword" name="search_keyword" value="{htmlspecialchars($search_keyword)}" />
|
||||
<input type="submit" value="Search" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue