* task #7129, add program swapper menu to header.

This commit is contained in:
Catouse
2020-05-07 14:50:59 +08:00
parent 8b45bf767d
commit 97474dcac5
4 changed files with 36 additions and 12 deletions
+1 -3
View File
@@ -28,9 +28,7 @@ if($extHookFiles) foreach($extHookFiles as $extHookFile) include $extHookFile;
<header id='header'>
<div id='mainHeader'>
<div class='container'>
<hgroup id='heading'>
<h1 id='companyname' title='<?php echo $heading;?>'<?php if(strlen($heading) > 36) echo " class='long-name'" ?>><?php echo html::a(helper::createLink('index'), $heading);?></h1>
</hgroup>
<?php if(($moduleName == 'program' || $isProgram) && isset($lang->programSwapper)) echo $lang->programSwapper;?>
<nav id='navbar'><?php $isProgram ? commonModel::printMainmenu($this->moduleName) : common::printModuleMenu($this->moduleName);?></nav>
<div id='toolbar'>
<div id="userMenu">
+20
View File
@@ -7,8 +7,24 @@ class program extends control
$this->loadModel('project');
}
/**
* Common actions.
*
* @param int $projectID
* @access public
* @return object current object
*/
public function commonAction($projectID = 0, $extra = '')
{
/* Set menu. */
$selectHtml = $this->project->select('', $projectID, 0, $this->app->getModuleName(), $this->app->getMethodName(), $extra);
$this->lang->programSwapper = $selectHtml;
}
public function index($status = 'all', $orderBy = 'order_desc', $recTotal = 0, $recPerPage = 10, $pageID = 1)
{
$this->commonAction();
if(common::hasPriv('program', 'create')) $this->lang->pageActions = html::a($this->createLink('program', 'create'), "<i class='icon icon-sm icon-plus'></i> " . $this->lang->program->create, '', "class='btn btn-primary'");
$programType = $this->cookie->programType;
@@ -29,6 +45,8 @@ class program extends control
public function create($type = 'scrum', $copyProgramID = '')
{
$this->commonAction();
if($_POST)
{
$projectID = $this->program->create();
@@ -72,6 +90,8 @@ class program extends control
public function edit($projectID = 0)
{
$this->commonAction();
$project = $this->project->getByID($projectID);
if($_POST)
+14 -8
View File
@@ -118,7 +118,8 @@ class projectModel extends model
}
$projectIndex .= '</ul></div></div>';
$projectIndex .= $selectHtml;
$this->lang->programSwapper = $selectHtml;
}
$this->lang->modulePageNav = $projectIndex;
@@ -168,18 +169,23 @@ class projectModel extends model
*/
public function select($projects, $projectID, $buildID, $currentModule, $currentMethod, $extra = '')
{
if(!$projectID) return;
$isMobile = $this->app->viewType == 'mhtml';
setCookie("lastProject", $projectID, $this->config->cookieLife, $this->config->webRoot, '', false, true);
$currentProject = $this->getById($projectID);
$currentProjectName = '';
if($projectID)
{
setCookie("lastProject", $projectID, $this->config->cookieLife, $this->config->webRoot, '', false, true);
$currentProject = $this->getById($projectID);
$currentProjectName = $currentProject->name;
}
else if($isMobile) return;
else $currentProjectName = $this->lang->project->allProjects;
$dropMenuLink = helper::createLink('project', 'ajaxGetDropMenu', "objectID=$projectID&module=$currentModule&method=$currentMethod&extra=$extra");
$output = "<div class='btn-group angle-btn'><div class='btn-group'><button data-toggle='dropdown' type='button' class='btn btn-limit' id='currentItem' title='{$currentProject->name}'>{$currentProject->name} <span class='caret'></span></button><div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList' data-url='$dropMenuLink'>";
$output = "<div class='btn-group' id='swapper'><button data-toggle='dropdown' type='button' class='btn btn-limit' id='currentItem' title='{$currentProjectName}'>{$currentProjectName} <i class='icon icon-swap'></i></button><div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList' data-url='$dropMenuLink'>";
$output .= '<div class="input-control search-box has-icon-left has-icon-right search-example"><input type="search" class="form-control search-input" /><label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label><a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a></div>';
$output .= "</div></div></div>";
if($isMobile) $output = "<a id='currentItem' href=\"javascript:showSearchMenu('project', '$projectID', '$currentModule', '$currentMethod', '$extra')\">{$currentProject->name} <span class='icon-caret-down'></span></a><div id='currentItemDropMenu' class='hidden affix enter-from-bottom layer'></div>";
$output .= "</div></div>";
if($isMobile) $output = "<a id='currentItem' href=\"javascript:showSearchMenu('project', '$projectID', '$currentModule', '$currentMethod', '$extra')\">{$currentProjectName} <span class='icon-caret-down'></span></a><div id='currentItemDropMenu' class='hidden affix enter-from-bottom layer'></div>";
return $output;
}
File diff suppressed because one or more lines are too long