* fix main navbar print to page unexpected.
This commit is contained in:
+34
-29
@@ -742,7 +742,7 @@ class commonModel extends model
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public static function createMenuLink($menuItem, $group)
|
||||
public static function createMenuLink($menuItem)
|
||||
{
|
||||
global $app;
|
||||
$link = $menuItem->link;
|
||||
@@ -1104,11 +1104,12 @@ class commonModel extends model
|
||||
/**
|
||||
* Print the main menu.
|
||||
*
|
||||
* @param bool $printHtml
|
||||
* @static
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public static function printMainMenu()
|
||||
public static function printMainMenu(bool $printHtml = true): string
|
||||
{
|
||||
global $app, $lang, $config;
|
||||
|
||||
@@ -1124,19 +1125,18 @@ class commonModel extends model
|
||||
$currentModule = $app->rawModule;
|
||||
$currentMethod = $app->rawMethod;
|
||||
|
||||
if($isTutorialMode and defined('WIZARD_MODULE')) $currentModule = WIZARD_MODULE;
|
||||
if($isTutorialMode and defined('WIZARD_METHOD')) $currentMethod = WIZARD_METHOD;
|
||||
if($isTutorialMode && isset($_SESSION['wizardModule'])) $currentModule = $_SESSION['wizardModule'];
|
||||
if($isTutorialMode && isset($_SESSION['wizardMethod'])) $currentMethod = $_SESSION['wizardMethod'];
|
||||
|
||||
/* Print all main menus. */
|
||||
$menu = customModel::getMainMenu();
|
||||
$lastMenu = end($menu);
|
||||
$menu = customModel::getMainMenu();
|
||||
|
||||
echo "<ul class='nav nav-default'>\n";
|
||||
$menuHtml = "<ul class='nav nav-default'>\n";
|
||||
foreach($menu as $menuItem)
|
||||
{
|
||||
if(isset($menuItem->hidden) and $menuItem->hidden and (!isset($menuItem->tutorial) or !$menuItem->tutorial)) continue;
|
||||
if(empty($menuItem->link)) continue;
|
||||
if($menuItem->divider) echo "<li class='divider'></li>";
|
||||
if($menuItem->divider) $menuHtml .= "<li class='divider'></li>";
|
||||
|
||||
/* Init the these vars. */
|
||||
$alias = isset($menuItem->alias) ? $menuItem->alias : '';
|
||||
@@ -1159,11 +1159,11 @@ class commonModel extends model
|
||||
if($menuItem->link['module'] == 'execution' and $menuItem->link['method'] == 'more')
|
||||
{
|
||||
$executionID = $menuItem->link['vars'];
|
||||
commonModel::buildMoreButton($executionID);
|
||||
commonModel::buildMoreButton((int)$executionID, $printHtml);
|
||||
}
|
||||
elseif($menuItem->link['module'] == 'app' and $menuItem->link['method'] == 'serverlink')
|
||||
{
|
||||
commonModel::buildAppButton();
|
||||
commonModel::buildAppButton($printHtml);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1172,7 +1172,7 @@ class commonModel extends model
|
||||
$target = '';
|
||||
$module = '';
|
||||
$method = '';
|
||||
$link = commonModel::createMenuLink($menuItem, $tab);
|
||||
$link = commonModel::createMenuLink($menuItem);
|
||||
|
||||
if($menuItem->link['module'] == 'project' and $menuItem->link['method'] == 'other') $link = 'javascript:void(0);';
|
||||
|
||||
@@ -1236,22 +1236,23 @@ class commonModel extends model
|
||||
$label .= "<span class='caret'></span>";
|
||||
$dropMenu = "<ul class='dropdown-menu'>{$dropMenu}</ul>";
|
||||
|
||||
echo "<li class='$class $active' data-id='$menuItem->name'>" . html::a($link, $label, $target, $misc) . $dropMenu . "</li>\n";
|
||||
$menuHtml .= "<li class='$class $active' data-id='$menuItem->name'>" . html::a($link, $label, $target, $misc) . $dropMenu . "</li>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<li class='$class $active' data-id='$menuItem->name'>" . html::a($link, $label, $target, $misc) . "</li>\n";
|
||||
$menuHtml .= "<li class='$class $active' data-id='$menuItem->name'>" . html::a($link, $label, $target, $misc) . "</li>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<li class='$class $active' data-id='$menuItem->name'>$menuItem->text</li>\n";
|
||||
$menuHtml .= "<li class='$class $active' data-id='$menuItem->name'>$menuItem->text</li>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "</ul>\n";
|
||||
$menuHtml .= "</ul>\n";
|
||||
|
||||
if($printHtml) echo $menuHtml;
|
||||
return $activeMenu;
|
||||
}
|
||||
|
||||
@@ -1773,18 +1774,19 @@ EOF;
|
||||
* Build more executions button.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param bool $printHtml
|
||||
* @static
|
||||
* @access public
|
||||
* @return void
|
||||
* @return bool
|
||||
*/
|
||||
public static function buildMoreButton($executionID)
|
||||
public static function buildMoreButton(int $executionID, bool $printHtml = true): bool
|
||||
{
|
||||
if(defined('TUTORIAL')) return;
|
||||
|
||||
global $lang, $app;
|
||||
|
||||
if(commonModel::isTutorialMode()) return false;
|
||||
|
||||
$object = $app->dbh->query('SELECT project,`type` FROM ' . TABLE_EXECUTION . " WHERE `id` = '$executionID'")->fetch();
|
||||
if(empty($object)) return;
|
||||
if(empty($object)) return false;
|
||||
|
||||
$executionPairs = array();
|
||||
$userCondition = !$app->user->admin ? " AND `id` " . helper::dbIN($app->user->view->sprints) : '';
|
||||
@@ -1802,7 +1804,7 @@ EOF;
|
||||
$executionPairs[$execution->id] = $execution->name;
|
||||
}
|
||||
|
||||
if(empty($executionPairs)) return;
|
||||
if(empty($executionPairs)) return false;
|
||||
|
||||
$html = "<li class='divider'></li><li class='dropdown dropdown-hover'><a href='javascript:;' data-toggle='dropdown'>{$lang->more}<span class='caret'></span></a>";
|
||||
$html .= "<ul class='dropdown-menu'>";
|
||||
@@ -1820,22 +1822,24 @@ EOF;
|
||||
|
||||
$html .= "</ul></li>\n";
|
||||
|
||||
echo $html;
|
||||
if($printHtml) echo $html;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build devops app button.
|
||||
*
|
||||
* @param bool $printHtml
|
||||
* @static
|
||||
* @access public
|
||||
* @return void
|
||||
* @return bool
|
||||
*/
|
||||
public static function buildAppButton()
|
||||
public static function buildAppButton(bool $printHtml = true): bool
|
||||
{
|
||||
if(defined('TUTORIAL')) return;
|
||||
global $app, $config, $lang;
|
||||
|
||||
$pipelinePairs = array();
|
||||
if(commonModel::isTutorialMode()) return false;
|
||||
|
||||
$condition = '';
|
||||
if(!$app->user->admin)
|
||||
{
|
||||
@@ -1844,11 +1848,11 @@ EOF;
|
||||
{
|
||||
if(commonModel::hasPriv($pipelineType, 'browse')) $types .= "'$pipelineType',";
|
||||
}
|
||||
if(empty($types)) return;
|
||||
if(empty($types)) return false;
|
||||
$condition .= ' AND `type` in (' . trim($types, ',') . ')';
|
||||
}
|
||||
$pipelineList = $app->dbh->query("SELECT `type`,name,url FROM " . TABLE_PIPELINE . " WHERE `deleted` = '0' $condition order by type")->fetchAll();
|
||||
if(empty($pipelineList)) return;
|
||||
if(empty($pipelineList)) return false;
|
||||
|
||||
$appCommon = isset($lang->db->custom['devopsMenu']['menu']['app']) ? $lang->db->custom['devopsMenu']['menu']['app'] : $lang->app->common;
|
||||
$html = "<li class='dropdown dropdown-hover'><a href='javascript:;' data-toggle='dropdown'>{$appCommon}<span class='caret'></span></a>";
|
||||
@@ -1860,7 +1864,8 @@ EOF;
|
||||
}
|
||||
$html .= "</ul></li>\n";
|
||||
|
||||
echo $html;
|
||||
if($printHtml) echo $html;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user