mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-11 13:02:15 +09:00
Use Rhymix action, not standalone .xml.php file, to load document category info
This commit is contained in:
parent
a609478db4
commit
34f05b08de
4 changed files with 55 additions and 34 deletions
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
<action name="getDocumentMenu" type="model" />
|
<action name="getDocumentMenu" type="model" />
|
||||||
<action name="getDocumentCategories" type="model" permission="all-managers" />
|
<action name="getDocumentCategories" type="model" permission="all-managers" />
|
||||||
|
<action name="getDocumentCategoryTree" type="model" permission="all-managers" />
|
||||||
<action name="getDocumentCategoryTplInfo" type="model" permission="manager" check_var="module_srl" />
|
<action name="getDocumentCategoryTplInfo" type="model" permission="manager" check_var="module_srl" />
|
||||||
<action name="getDocumentVotedMemberList" type="model" permission="root" />
|
<action name="getDocumentVotedMemberList" type="model" permission="root" />
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -964,6 +964,27 @@ class DocumentModel extends Document
|
||||||
$this->add('categories', $output);
|
$this->add('categories', $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get category list in tree format
|
||||||
|
*/
|
||||||
|
public function getDocumentCategoryTree()
|
||||||
|
{
|
||||||
|
$module_srl = Context::get('module_srl');
|
||||||
|
if ($module_srl <= 0)
|
||||||
|
{
|
||||||
|
throw new Rhymix\Framework\Exceptions\TargetNotFound;
|
||||||
|
}
|
||||||
|
$filename = self::getCategoryPhpFile($module_srl);
|
||||||
|
if (!$filename)
|
||||||
|
{
|
||||||
|
throw new Rhymix\Framework\Exceptions\TargetNotFound;
|
||||||
|
}
|
||||||
|
|
||||||
|
include $filename;
|
||||||
|
|
||||||
|
$this->add('categories', $menu->list ?? []);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wanted to set document information
|
* Wanted to set document information
|
||||||
* @return object
|
* @return object
|
||||||
|
|
@ -1003,10 +1024,6 @@ class DocumentModel extends Document
|
||||||
*/
|
*/
|
||||||
public function getCategoryHTML($module_srl)
|
public function getCategoryHTML($module_srl)
|
||||||
{
|
{
|
||||||
$category_xml_file = self::getCategoryXmlFile($module_srl);
|
|
||||||
|
|
||||||
Context::set('category_xml_file', $category_xml_file);
|
|
||||||
|
|
||||||
Context::loadJavascriptPlugin('ui.tree');
|
Context::loadJavascriptPlugin('ui.tree');
|
||||||
|
|
||||||
// Get a list of member groups
|
// Get a list of member groups
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,10 @@
|
||||||
var simpleTreeCollection;
|
var simpleTreeCollection;
|
||||||
var max_menu_depth = 999;
|
var max_menu_depth = 999;
|
||||||
var lang_confirm_delete = "{$lang->confirm_delete}";
|
var lang_confirm_delete = "{$lang->confirm_delete}";
|
||||||
var xml_url = "{$category_xml_file}";
|
var category_module_srl = "{$module_info->module_srl}";
|
||||||
|
|
||||||
jQuery(function($){
|
jQuery(function($){
|
||||||
Tree(xml_url);
|
Tree(category_module_srl);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -37,7 +37,6 @@
|
||||||
<input type="hidden" name="module" value="document" />
|
<input type="hidden" name="module" value="document" />
|
||||||
<input type="hidden" name="act" value="procDocumentInsertCategory" />
|
<input type="hidden" name="act" value="procDocumentInsertCategory" />
|
||||||
<input type="hidden" name="module_srl" value="{$module_info->module_srl}" />
|
<input type="hidden" name="module_srl" value="{$module_info->module_srl}" />
|
||||||
<input type="hidden" name="xml_file" value="{$category_xml_file}" />
|
|
||||||
<input type="hidden" name="success_return_url" value="{getRequestUriByServerEnviroment()}" />
|
<input type="hidden" name="success_return_url" value="{getRequestUriByServerEnviroment()}" />
|
||||||
<input type="hidden" name="parent_srl" value="{$category_info->parent_srl}" />
|
<input type="hidden" name="parent_srl" value="{$category_info->parent_srl}" />
|
||||||
<input type="hidden" name="category_srl" value="{$category_info->category_srl}" />
|
<input type="hidden" name="category_srl" value="{$category_info->category_srl}" />
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,7 @@
|
||||||
* @brief document 모듈의 category tree javascript
|
* @brief document 모듈의 category tree javascript
|
||||||
**/
|
**/
|
||||||
|
|
||||||
function Tree(url){
|
function Tree(category_module_srl) {
|
||||||
var $ = jQuery;
|
|
||||||
|
|
||||||
// clear tree;
|
// clear tree;
|
||||||
$('#menu > ul > li > ul').remove();
|
$('#menu > ul > li > ul').remove();
|
||||||
|
|
@ -20,13 +19,14 @@ function Tree(url){
|
||||||
}
|
}
|
||||||
|
|
||||||
//ajax get data and transeform ul il
|
//ajax get data and transeform ul il
|
||||||
$.get(url,function(data){
|
exec_json('document.getDocumentCategoryTree', { module_srl: category_module_srl }, function(data) {
|
||||||
$(data).find("node").each(function(i){
|
var callback;
|
||||||
var text = $(this).attr("text");
|
callback = function(item) {
|
||||||
var node_srl = $(this).attr("node_srl");
|
var text = item.text;
|
||||||
var parent_srl = $(this).attr("parent_srl");
|
var node_srl = item.node_srl;
|
||||||
var color = $(this).attr("color");
|
var parent_srl = item.parent_srl;
|
||||||
var url = $(this).attr("url");
|
var color = item.color;
|
||||||
|
var url = item.url;
|
||||||
|
|
||||||
// node
|
// node
|
||||||
var node = '';
|
var node = '';
|
||||||
|
|
@ -73,7 +73,17 @@ function Tree(url){
|
||||||
$('#menu ul.simpleTree > li > ul').append(node);
|
$('#menu ul.simpleTree > li > ul').append(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
// look for children
|
||||||
|
if (item.list) {
|
||||||
|
item.list.forEach(function(child) {
|
||||||
|
callback(child);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
data.categories.forEach(function(item) {
|
||||||
|
callback(item);
|
||||||
|
});
|
||||||
|
|
||||||
//button show hide
|
//button show hide
|
||||||
$("#menu li").each(function(){
|
$("#menu li").each(function(){
|
||||||
|
|
@ -94,7 +104,7 @@ function Tree(url){
|
||||||
},
|
},
|
||||||
afterMove:function(destination, source, pos){
|
afterMove:function(destination, source, pos){
|
||||||
if(destination.size() == 0){
|
if(destination.size() == 0){
|
||||||
Tree(xml_url);
|
Tree(category_module_srl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var module_srl = $("#fo_category input[name=module_srl]").val();
|
var module_srl = $("#fo_category input[name=module_srl]").val();
|
||||||
|
|
@ -111,7 +121,7 @@ function Tree(url){
|
||||||
$.exec_json("document.procDocumentMoveCategory",{ "module_srl":module_srl,"parent_srl":parent_srl,"target_srl":target_srl,"source_srl":source_srl},
|
$.exec_json("document.procDocumentMoveCategory",{ "module_srl":module_srl,"parent_srl":parent_srl,"target_srl":target_srl,"source_srl":source_srl},
|
||||||
function(data){
|
function(data){
|
||||||
$('#category_info').html('');
|
$('#category_info').html('');
|
||||||
if(data.error > 0) Tree(xml_url);
|
if(data.error > 0) Tree(category_module_srl);
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
@ -133,12 +143,10 @@ function Tree(url){
|
||||||
,docToFolderConvert:true
|
,docToFolderConvert:true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// open all node
|
// open all node
|
||||||
nodeToggleAll();
|
nodeToggleAll();
|
||||||
|
|
||||||
},"xml");
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearValue(){
|
function clearValue(){
|
||||||
|
|
@ -223,8 +231,8 @@ function deleteNode(node){
|
||||||
,"module_srl":jQuery("#fo_category [name=module_srl]").val()
|
,"module_srl":jQuery("#fo_category [name=module_srl]").val()
|
||||||
};
|
};
|
||||||
|
|
||||||
jQuery.exec_json('document.procDocumentDeleteCategory', params, function(data){
|
exec_json('document.procDocumentDeleteCategory', params, function(data){
|
||||||
if(data.error==0) Tree(xml_url);
|
if(data.error==0) Tree(category_module_srl);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -232,7 +240,7 @@ function deleteNode(node){
|
||||||
/* 카테고리 아이템 입력후 */
|
/* 카테고리 아이템 입력후 */
|
||||||
function completeInsertCategory(ret_obj) {
|
function completeInsertCategory(ret_obj) {
|
||||||
jQuery('#category_info').html("");
|
jQuery('#category_info').html("");
|
||||||
Tree(xml_url);
|
Tree(category_module_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideCategoryInfo() {
|
function hideCategoryInfo() {
|
||||||
|
|
@ -241,9 +249,5 @@ function hideCategoryInfo() {
|
||||||
|
|
||||||
/* 카테고리 목록 갱신 */
|
/* 카테고리 목록 갱신 */
|
||||||
function doReloadTreeCategory(module_srl) {
|
function doReloadTreeCategory(module_srl) {
|
||||||
var params = {'module_srl':module_srl};
|
exec_json('document.procDocumentMakeXmlFile', { module_srl: module_srl }, completeInsertCategory);
|
||||||
|
|
||||||
// 서버에 요청하여 해당 노드의 정보를 수정할 수 있도록 한다.
|
|
||||||
var response_tags = new Array('error','message', 'xml_file');
|
|
||||||
exec_xml('document', 'procDocumentMakeXmlFile', params, completeInsertCategory, response_tags, params);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue