Skip to content

Commit

Permalink
Merge pull request #1550 from YJSoft/feature/menudesc
Browse files Browse the repository at this point in the history
#476 메뉴 설명 기능 구현
  • Loading branch information
bnu committed Jul 6, 2015
2 parents 5a65c9d + 6c096cd commit 82ebba2
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 20 deletions.
3 changes: 3 additions & 0 deletions modules/menu/lang/lang.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1002,4 +1002,7 @@ Menu không phải là người quản lý, nhiệm vụ của nó chỉ là li
<value xml:lang="ko"><![CDATA[스킨 없음]]></value>
<value xml:lang="jp"><![CDATA[スキン無し]]></value>
</item>
<item name="menu_desc">
<value xml:lang="ko"><![CDATA[메뉴 설명]]></value>
</item>
</lang>
19 changes: 16 additions & 3 deletions modules/menu/menu.admin.controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ public function procMenuAdminInsertItem($request = NULL)

// recreate menu cache file
$this->makeXmlFile($request->menu_srl);

if(!$isProc)
{
return $this->get('menu_item_srl');
Expand Down Expand Up @@ -504,6 +504,9 @@ private function _insertShortcut(&$request)
$args->is_shortcut = $request->is_shortcut;
$args->url = '#';
}

if($request->menu_desc) $args->desc = $request->menu_desc;
else $args->desc = '';

$args->menu_item_srl = getNextSequence();
$args->listorder = -1*$args->menu_item_srl;
Expand Down Expand Up @@ -536,6 +539,9 @@ private function _insertMenu(&$request, $isProc)

if($request->menu_name_key) $args->name = $request->menu_name_key;
else $args->name = $request->menu_name;

if($request->menu_desc) $args->desc = $request->menu_desc;
else $args->desc = '';

if($request->module_id && strncasecmp('http', $request->module_id, 4) === 0)
{
Expand Down Expand Up @@ -719,6 +725,9 @@ public function procMenuAdminUpdateItem()
{
$args->name = $request->menu_name;
}

if($request->menu_desc) $args->desc = $request->menu_desc;
else $args->desc = '';

if(count($args->group_srls) == 0)
{
Expand Down Expand Up @@ -1880,6 +1889,7 @@ function getXmlTree($source_node, $tree, $site_srl, $domain)
$name_str = sprintf('$_names = array(%s); print $_names[$lang_type];', $name_arr_str);

$url = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->url);
$desc = str_replace(array('&','"',"'"),array('&amp;','&quot;','\\\''),$node->desc);
if(preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url))
{
$href = "getSiteUrl('$domain', '','mid','$node->url')";
Expand Down Expand Up @@ -1915,7 +1925,7 @@ function getXmlTree($source_node, $tree, $site_srl, $domain)
if($group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))',$group_srls,$group_srls == -1?1:0);
else $group_check_code = "true";
$attribute = sprintf(
'node_srl="%s" parent_srl="%s" menu_name_key=\'%s\' text="<?php if(%s) { %s }?>" url="<?php print(%s?"%s":"")?>" href="<?php print(%s?%s:"")?>" is_shortcut="%s" open_window="%s" expand="%s" normal_btn="%s" hover_btn="%s" active_btn="%s" link="<?php if(%s) {?>%s<?php }?>"',
'node_srl="%s" parent_srl="%s" menu_name_key=\'%s\' text="<?php if(%s) { %s }?>" url="<?php print(%s?"%s":"")?>" href="<?php print(%s?%s:"")?>" is_shortcut="%s" desc="%s" open_window="%s" expand="%s" normal_btn="%s" hover_btn="%s" active_btn="%s" link="<?php if(%s) {?>%s<?php }?>"',
$menu_item_srl,
$node->parent_srl,
addslashes($node->name),
Expand All @@ -1926,6 +1936,7 @@ function getXmlTree($source_node, $tree, $site_srl, $domain)
$group_check_code,
$href,
$is_shortcut,
$desc,
$open_window,
$expand,
$normal_btn,
Expand Down Expand Up @@ -1981,6 +1992,7 @@ function getPhpCacheCode($source_node, $tree, $site_srl, $domain)
// List variables
$href = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->href);
$url = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->url);
$desc = str_replace(array('&','"',"'"),array('&amp;','&quot;','\\\''),$node->desc);
if(preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
{
$href = "getSiteUrl('$domain', '','mid','$node->url')";
Expand Down Expand Up @@ -2030,7 +2042,7 @@ function getPhpCacheCode($source_node, $tree, $site_srl, $domain)
}
// Create properties (check if it belongs to the menu node by url_list. It looks a trick but fast and powerful)
$attribute = sprintf(
'"node_srl"=>"%s","parent_srl"=>"%s","menu_name_key"=>\'%s\',"isShow"=>(%s?true:false),"text"=>(%s?$_menu_names[%d][$lang_type]:""),"href"=>(%s?%s:""),"url"=>(%s?"%s":""),"is_shortcut"=>"%s","open_window"=>"%s","normal_btn"=>"%s","hover_btn"=>"%s","active_btn"=>"%s","selected"=>(array(%s)&&in_array(Context::get("mid"),array(%s))?1:0),"expand"=>"%s", "list"=>array(%s), "link"=>(%s? ( array(%s)&&in_array(Context::get("mid"),array(%s)) ?%s:%s):""),',
'"node_srl"=>"%s","parent_srl"=>"%s","menu_name_key"=>\'%s\',"isShow"=>(%s?true:false),"text"=>(%s?$_menu_names[%d][$lang_type]:""),"href"=>(%s?%s:""),"url"=>(%s?"%s":""),"is_shortcut"=>"%s","desc"=>\'%s\',"open_window"=>"%s","normal_btn"=>"%s","hover_btn"=>"%s","active_btn"=>"%s","selected"=>(array(%s)&&in_array(Context::get("mid"),array(%s))?1:0),"expand"=>"%s", "list"=>array(%s), "link"=>(%s? ( array(%s)&&in_array(Context::get("mid"),array(%s)) ?%s:%s):""),',
$node->menu_item_srl,
$node->parent_srl,
addslashes($node->name),
Expand All @@ -2042,6 +2054,7 @@ function getPhpCacheCode($source_node, $tree, $site_srl, $domain)
$group_check_code,
$url,
$is_shortcut,
$desc,
$open_window,
$normal_btn,
$hover_btn,
Expand Down
3 changes: 2 additions & 1 deletion modules/menu/menu.admin.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ function dispMenuAdminSiteMap()
$menuItems = new stdClass();
$menuItems->menuSrl = $value->menu_srl;
$menuItems->title = $value->title;
$menuItems->desc = $value->desc;
$menuItems->menuItems = $menu;
$menuList[] = $menuItems;
}
Expand Down Expand Up @@ -194,4 +195,4 @@ function _arrangeMenuItem($menuItems)
}
}
/* End of file menu.admin.view.php */
/* Location: ./modules/menu/menu.admin.view.php */
/* Location: ./modules/menu/menu.admin.view.php */
13 changes: 12 additions & 1 deletion modules/menu/menu.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ function checkUpdate()
$temp_menus = executeQueryArray('menu.getMenuByTitle', $args);
if($temp_menus->toBool() && count($temp_menus->data)) return true;

// 2015. 06. 15 add column desc
if(!$oDB->isColumnExists('menu_item', 'desc'))
{
return true;
}

return false;
}
Expand All @@ -68,6 +73,12 @@ function moduleUpdate() {
{
$oDB->addIndex('menu', 'idx_title', array('title'));
}

// 2015. 06. 15 add column desc
if(!$oDB->isColumnExists('menu_item', 'desc'))
{
$oDB->addColumn('menu_item', 'desc','varchar',250,"",true);
}

// 1.7(maserati) shortcut column add and mirgration
if(!$oDB->isColumnExists('menu_item', 'is_shortcut'))
Expand Down Expand Up @@ -227,4 +238,4 @@ function recompileCache()
}
}
/* End of file menu.class.php */
/* Location: ./modules/menu/menu.class.php */
/* Location: ./modules/menu/menu.class.php */
3 changes: 2 additions & 1 deletion modules/menu/queries/insertMenuItem.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<column name="parent_srl" var="parent_srl" filter="number" default="0" />
<column name="menu_srl" var="menu_srl" filter="number" notnull="notnull" />
<column name="name" var="name" notnull="notnull" />
<column name="desc" var="desc" />
<column name="url" var="url" />
<column name="is_shortcut" var="is_shortcut" notnull="notnull" default="N" />
<column name="open_window" var="open_window" />
Expand All @@ -18,4 +19,4 @@
<column name="listorder" var="listorder" notnull="notnull" />
<column name="regdate" var="regdate" default="curdate()" />
</columns>
</query>
</query>
3 changes: 2 additions & 1 deletion modules/menu/queries/updateMenuItem.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<column name="menu_srl" var="menu_srl" />
<column name="parent_srl" var="parent_srl" />
<column name="name" var="name" notnull="notnull" />
<column name="desc" var="desc" />
<column name="url" var="url" />
<column name="is_shortcut" var="is_shortcut" />
<column name="open_window" var="open_window" />
Expand All @@ -18,4 +19,4 @@
<conditions>
<condition operation="equal" column="menu_item_srl" var="menu_item_srl" filter="number" notnull="notnull" />
</conditions>
</query>
</query>
3 changes: 2 additions & 1 deletion modules/menu/schemas/menu_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<column name="parent_srl" type="number" size="12" notnull="notnull" default="0" />
<column name="menu_srl" type="number" size="12" notnull="notnull" index="idx_menu_srl" />
<column name="name" type="text" />
<column name="desc" type="varchar" size="250" />
<column name="url" type="varchar" size="250" />
<column name="is_shortcut" type="char" size="1" default="N" />
<column name="open_window" type="char" size="1" default="N" />
Expand All @@ -13,4 +14,4 @@
<column name="group_srls" type="text" />
<column name="listorder" type="number" size="11" default="0" index="idx_listorder" />
<column name="regdate" type="date" index="idx_regdate" />
</table>
</table>
33 changes: 21 additions & 12 deletions modules/menu/tpl/sitemap.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ <h1 class="_title"></h1>
<input id="menuName2" class="_menuName lang_code" type="text" required>
</div>
</li>
<li>
<div class="multilingual x_input-append">
<label for="lang_menuDesc2">{$lang->menu_desc}</label>
<input id="menuDesc2" class="_menuDesc lang_code" type="text" required>
</div>
</li>
<li class="typePage">
<label for="mid1">{$lang->menu_id} <a href="#help_menuId" class="x_icon-question-sign" data-admin-toggle="#mid1_help">{$lang->help}</a></label>
<div id="mid1_help" class="x_alert x_alert-info" style="display:none;width:169px">
Expand Down Expand Up @@ -223,6 +229,12 @@ <h1>{$lang->general_settings}</h1>
<input id="menuName" class="_menuName lang_code" type="text" required>
</div>
</li>
<li>
<div class="multilingual x_input-append">
<label for="lang_menuDesc">{$lang->menu_desc}</label>
<input id="menuDesc" class="_menuDesc lang_code" type="text" required>
</div>
</li>
<li style="padding:6px 0 0 0">
<label><input type="checkbox" class="_newWindow" title="{$lang->menu_open_window}"> {$lang->menu_open_window}</label>
</li>
Expand Down Expand Up @@ -1847,6 +1859,7 @@ <h1>{$lang->full_settings}</h1>
});
$('#add_menu ._save').bind("click", function(){
var sMenuName = $('#add_menu ._menuName').val();
var sMenuDesc = $('#add_menu ._menuDesc').val();
var sUrl = $('#add_menu ._mid').val();
var sTargetKey = "module_id";

Expand Down Expand Up @@ -1895,21 +1908,14 @@ <h1>{$lang->full_settings}</h1>
params['act'] = "procMenuAdminInsertItem";
params['menu_name_key'] = "";
params['menu_name'] = sMenuName;
params['menu_desc'] = sMenuDesc;
params['module_type'] = sSelectedModuleName;
params['menu_open_window'] = "N";
params['menu_expand'] = "N";
params['is_shortcut'] = isShortCut;
params['parent_srl'] = sSelectedMenuSrl;
params[sTargetKey] = sUrl;

/*
Array
(
[error] => "0"
[message] => "등록했습니다."
[menu_item_srl] => "2"
)
*/

$.exec_json("menu.procMenuAdminInsertItem", params, function(htData){
// select the newly created menu
//$._xeAdminVar.sSelectOnload = htData.menu_item_srl;
Expand Down Expand Up @@ -1937,6 +1943,7 @@ <h1>{$lang->full_settings}</h1>

//$(this).find('#menuName').val(htInfo.sText);
$(this).find('#menuName').val(htInfo.sMenuNameKey);
$(this).find('#menuDesc').val(htInfo.desc);
//menu_name_key

$(this).find('#mid2').val(htInfo.url);
Expand All @@ -1952,9 +1959,9 @@ <h1>{$lang->full_settings}</h1>
showMenuSelector($(this).find('._menuSelector_menuTreeContainer'), htInfo.url);
}else{
// URL shortcut
var htInfo_url = htInfo.url;
htInfo_url = htInfo_url.replace(/&amp;/g, '&');
htInfo.url = htInfo_url;
var htInfo_url = htInfo.url;
htInfo_url = htInfo_url.replace(/&amp;/g, '&');
htInfo.url = htInfo_url;
$(this).find('a[href="#fix_linkUrl"]').click();
$(this).find('._url_link').val($('<div />').text(htInfo.url).text());

Expand Down Expand Up @@ -1990,6 +1997,7 @@ <h1>{$lang->full_settings}</h1>
var htInfo = htNodeInfo[$._xeAdminVar.sSelectedMenuSrl];

var sMenuName = $('#default ._menuName').val();
var sMenuDesc = $('#default ._menuDesc').val();
var sMID;

var sNewWindow = $('#default ._newWindow').attr("checked")?"Y":"N";
Expand All @@ -2015,6 +2023,7 @@ <h1>{$lang->full_settings}</h1>
}
params['menu_item_srl'] = sSelectedMenuSrl;
params['menu_name'] = sMenuName;
params['menu_desc'] = sMenuDesc;
params['menu_open_window'] = sNewWindow;
params['menu_expand'] = sLeaveUnfolded;
params['browser_title'] = sBrowserTitle;
Expand Down

0 comments on commit 82ebba2

Please sign in to comment.