* Modify the module tree on the left side of the editor.
This commit is contained in:
@@ -1087,7 +1087,8 @@ class devModel extends model
|
||||
if(!in_array($type, array('module', 'table'))) return $tree;
|
||||
|
||||
$objects = $type == 'module' ? $this->getModules() : $this->getTables();
|
||||
foreach($this->lang->dev->groupList as $moduleKey => $moduleName)
|
||||
$groupList = array_merge($this->lang->dev->groupList, $this->lang->dev->endGroupList);
|
||||
foreach($groupList as $moduleKey => $moduleName)
|
||||
{
|
||||
if(empty($objects[$moduleKey])) continue;
|
||||
$module = new stdclass();
|
||||
|
||||
@@ -36,8 +36,8 @@ class editor extends control
|
||||
$this->app->loadLang('dev');
|
||||
$this->view->title = $this->lang->editor->common;
|
||||
$this->view->position[] = $this->lang->editor->common;
|
||||
$this->view->modules = $this->loadModel('dev')->getModules();
|
||||
$this->view->tab = $type;
|
||||
$this->view->moduleTree = $this->loadModel('dev')->getTree($type, 'module');
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,3 +9,9 @@ td.w-200px a:hover {font-weight:bold;}
|
||||
#mainContent .module-content {padding: 0;}
|
||||
#sidebar .module-tree {overflow-y: auto;}
|
||||
#sidebar .module-tree .panel-heading {padding: 4px 10px;}
|
||||
|
||||
/* module-tree. */
|
||||
#moduleTree.tree ul {margin-bottom: 0;}
|
||||
#moduleTree .active {background-color: #fff;}
|
||||
#menuTree > li.has-list > ul > li {padding-left: 10px;}
|
||||
#menuTree > li.has-list > ul > li.has-list {padding-left: 15px;}
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
$(function()
|
||||
{
|
||||
$('.side-col a').click(function()
|
||||
{
|
||||
$(this).closest('.side-col').find('a.text-primary').removeClass('text-primary');
|
||||
$(this).addClass('text-primary');
|
||||
});
|
||||
initModule();
|
||||
setHeight();
|
||||
$(window).resize(setHeight);
|
||||
});
|
||||
@@ -21,3 +17,33 @@ function setHeight()
|
||||
$('#sidebar .module-tree,#mainContent .module-col,#extendWin').css('height', paneHeight);
|
||||
$(' #mainContent .module-content, #editWin').css('height', paneHeight - 6);
|
||||
}
|
||||
|
||||
/**
|
||||
* Init module tree by zui.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function initModule()
|
||||
{
|
||||
$('#moduleTree').tree(
|
||||
{
|
||||
data: moduleTree,
|
||||
initialState: 'active',
|
||||
itemCreator: function($li, item)
|
||||
{
|
||||
$li.append('<a data-module="' + item.key + '" data-has-children="' + (item.children ? !!item.children.length : false) + '" href=# title="' + item.title + '">' + item.title + '</a>');
|
||||
if (item.active) $li.addClass('active open in');
|
||||
}
|
||||
});
|
||||
|
||||
$('#moduleTree').on('click', 'a', function(e)
|
||||
{
|
||||
var target = $(e.target);
|
||||
if (target.attr('data-has-children') === 'true') return;
|
||||
$('#extendWin').attr('src', createLink('editor', 'extend', 'moduleDir=' + target.attr('data-module')));
|
||||
|
||||
$(this).closest('.side-col').find('li.active').removeClass('active');
|
||||
$(this).parent().addClass('active');
|
||||
})
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
?>
|
||||
<?php include $app->getModuleRoot() . 'dev/view/header.html.php';?>
|
||||
<?php js::set('moduleTree', $moduleTree);?>
|
||||
<?php if(common::hasPriv('editor', 'turnon')):?>
|
||||
<div id='mainMenu' class='clearfix menu-secondary'>
|
||||
<div class="pull-left">
|
||||
@@ -26,35 +27,7 @@
|
||||
<div class='cell module-tree'>
|
||||
<div class='panel panel-sm with-list'>
|
||||
<div class='panel-heading'><i class='icon-list'></i> <strong><?php echo $lang->editor->moduleList?></strong></div>
|
||||
<?php foreach($lang->dev->groupList as $group => $groupName):?>
|
||||
<?php if(!empty($modules[$group])):?>
|
||||
<div class='modulegroup'><?php echo $groupName?></div>
|
||||
<?php foreach($modules[$group] as $module):?>
|
||||
<?php $moduleName = zget($lang->dev->tableList, $module, $module);?>
|
||||
<?php echo html::a(inlink('extend', "moduleDir=$module"), $moduleName, 'extendWin');?>
|
||||
<?php endforeach;?>
|
||||
<?php endif;?>
|
||||
<?php endforeach;?>
|
||||
<?php foreach($lang->dev->endGroupList as $group => $groupName):?>
|
||||
<?php if(!empty($modules[$group])):?>
|
||||
<div class='modulegroup'><?php echo $groupName?></div>
|
||||
<?php foreach($modules[$group] as $module):?>
|
||||
<?php
|
||||
$moduleName = $module;
|
||||
if(isset($lang->dev->tableList[$module]))
|
||||
{
|
||||
$moduleName = $lang->dev->tableList[$module];
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!isset($lang->{$module}->common)) $app->loadLang($module);
|
||||
$moduleName = isset($lang->{$module}->common) ? $lang->{$module}->common : $module;
|
||||
}
|
||||
?>
|
||||
<?php echo html::a(inlink('extend', "moduleDir=$module"), $moduleName, 'extendWin');?>
|
||||
<?php endforeach;?>
|
||||
<?php endif;?>
|
||||
<?php endforeach;?>
|
||||
<div id="moduleTree" class="menu-active-primary menu-hover-primary"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user