+ finish task #1392.

This commit is contained in:
wangyidong
2013-06-19 07:21:15 +00:00
parent 359c927510
commit 435557012c
17 changed files with 153 additions and 399 deletions
+1
View File
@@ -25,6 +25,7 @@ class common extends control
$this->common->setCompany();
$this->common->setUser();
$this->common->loadConfigFromDB();
if($this->config->default->view == 'mhtml') $this->common->setMobileMenu();
$this->app->loadLang('company');
}
+57 -5
View File
@@ -225,6 +225,54 @@ class commonModel extends model
echo html::select('', $app->lang->themes, $app->cookie->theme, 'onchange="selectTheme(this.value)"');
}
public function setMobileMenu()
{
$menu = new stdclass();
$role = isset($this->app->user->role) ? $this->app->user->role : '';
$this->config->locate = new stdclass();
$this->config->locate->module = 'my';
$this->config->locate->method = 'todo';
$this->config->locate->params = '';
$todo = $this->lang->my->menu->todo['link'];
$task = $this->lang->my->menu->task;
$story = $this->lang->my->menu->story;
$bug = $this->lang->my->menu->bug;
$project = $this->lang->menu->project . '|locate=no&&status=doing&projectID=1';
$product = $this->lang->menu->product . '|locate=no&productID=1';
if($role == 'dev' or $role == 'td' or $role == 'pm')
{
$menu = array('todo' => $todo, 'task' => $task, 'bug' => $bug, 'product' => $product, 'project' => $project);
}
elseif($role == 'pd' or $role == 'po')
{
$menu = array('todo' => $todo, 'story' => $story, 'bug' => $bug, 'product' => $product, 'project' => $project);
}
elseif($role == 'qa' or $role == 'qd')
{
$menu = array('todo' => $todo, 'bug' => $bug, 'project' => $project, 'product' => $product);
}
elseif($role == 'top')
{
$menu = array('project' => $project, 'product' => $product, 'todo' => $todo);
$this->config->locate->module = 'project';
$this->config->locate->method = 'index';
$this->config->locate->params = 'locate=no&status=doing';
}
else
{
$menu = array('todo' => $todo, 'task' => $task, 'bug' => $bug, 'project' => $project, 'product' => $product);
}
unset($this->lang->menuOrder);
$this->lang->menu = new stdclass();
$this->lang->menu = $menu;
}
/**
* Print the main menu.
*
@@ -233,13 +281,14 @@ class commonModel extends model
* @access public
* @return void
*/
public static function printMainmenu($moduleName)
public static function printMainmenu($moduleName, $methodName = '')
{
global $app, $lang;
echo "<ul>\n";
/* Set the main main menu. */
$mainMenu = $moduleName;
if($moduleName == 'my') $mainMenu = $methodName;
if(isset($lang->menugroup->$moduleName)) $mainMenu = $lang->menugroup->$moduleName;
/* Sort menu according to menuOrder. */
@@ -261,16 +310,19 @@ class commonModel extends model
}
}
$activeName = $app->getViewType() == 'mhtml' ? 'ui-btn-active' : 'active';
/* Print all main menus. */
foreach($lang->menu as $menuKey => $menu)
{
$active = $menuKey == $mainMenu ? "class='active'" : '';
list($menuLabel, $module, $method) = explode('|', $menu);
$active = $menuKey == $mainMenu ? "class='$activeName'" : '';
$link = explode('|', $menu);
list($menuLabel, $module, $method) = $link;
$vars = isset($link[3]) ? $link[3] : '';
if(common::hasPriv($module, $method))
{
$link = helper::createLink($module, $method);
echo "<li $active><nobr><a href='$link' id='menu$menuKey'>$menuLabel</a></nobr></li>\n";
$link = helper::createLink($module, $method, $vars);
echo "<li $active><nobr><a href='$link' $active id='menu$menuKey'>$menuLabel</a></nobr></li>\n";
}
}
-1
View File
@@ -5,7 +5,6 @@ include 'colorbox.html.php';
include 'chosen.html.php';
//include 'validation.html.php';
?>
<?php if(empty($_GET['onlybody']) or $_GET['onlybody'] != 'yes'):?>
<div id='header'>
<table class='cont' id='topbar'>
<tr>
+1 -2
View File
@@ -2,8 +2,7 @@
<?php if($extView = $this->getExtViewFile(__FILE__)){include $extView; return helper::cd();}?>
<iframe frameborder='0' name='hiddenwin' id='hiddenwin' scrolling='no' class='<?php print($config->debug ? 'debugwin' : 'hidden');?>'></iframe>
</div>
<?php $onlybody = zget($_GET, 'onlybody', 'no');
js::set('onlybody', $onlybody); // set the onlybody var.
<?php
if(isset($pageJS)) js::execute($pageJS); // load the js for current page.
/* Load hook files for current page. */
+2
View File
@@ -5,6 +5,8 @@ include 'm.header.lite.html.php';
<?php if(empty($_GET['onlybody']) or $_GET['onlybody'] != 'yes'):?>
<div data-role="header">
<div data-role="navbar">
<?php commonModel::printMainmenu($this->moduleName, $this->methodName)?>
</ul>
</div>
</div>
<?php endif;?>