diff --git a/framework/model.class.php b/framework/model.class.php index 1fe33cc6ab..db11f1d62e 100644 --- a/framework/model.class.php +++ b/framework/model.class.php @@ -111,7 +111,7 @@ class model extends baseModel $html = ''; $type = $type == 'browse' ? 'list' : 'button'; - if($enabled) $html = common::buildIconButton($module, $method, $params, $data, $type, $icon, $target, $class, $onlyBody, $misc, $title); + $html = common::buildIconButton($module, $method, $params, $data, $type, $icon, $target, $class, $onlyBody, $misc, $title, '', $enabled); return $html; } diff --git a/module/bug/model.php b/module/bug/model.php index 1d774237ea..c78afc7972 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -3234,10 +3234,17 @@ class bugModel extends model ->fetchPairs('id'); } + /** + * Build operateMenu. + * + * @param object $bug + * @param string $type + * @access public + * @return void + */ public function buildOperateMenu($bug, $type = 'view') { $menu = ''; - $menuType = $type == 'browse' ? 'list' : 'button'; $params = "bugID=$bug->id"; $extraParams = "extras=bugID=$bug->id"; if($this->app->tab == 'project') $extraParams .= ",projectID={$bug->project}"; @@ -3246,22 +3253,22 @@ class bugModel extends model $convertParams = "productID=$bug->product&branch=$bug->branch&moduleID=0&from=bug&bugID=$bug->id"; $toStoryParams = "product=$bug->product&branch=$bug->branch&module=0&story=0&execution=0&bugID=$bug->id"; - $menu .= $this->buildMenu('bug', 'confirmBug', $params, $bug, $menuType, 'ok', '', "iframe", true); - if($type == 'view') $menu .= $this->buildMenu('bug', 'assignTo', $params, $bug, $menuType, '', '', "iframe", true); - $menu .= $this->buildMenu('bug', 'resolve', $params, $bug, $menuType, 'checked', '', "iframe", true); - $menu .= $this->buildMenu('bug', 'close', $params, $bug, $menuType, '', '', "text-danger iframe showinonlybody", true); - $menu .= $this->buildMenu('bug', 'activate', $params, $bug, $menuType, '', '', "text-success iframe showinonlybody", true); + $menu .= $this->buildMenu('bug', 'confirmBug', $params, $bug, $type, 'ok', '', "iframe", true); + if($type == 'view') $menu .= $this->buildMenu('bug', 'assignTo', $params, $bug, $type, '', '', "iframe", true); + $menu .= $this->buildMenu('bug', 'resolve', $params, $bug, $type, 'checked', '', "iframe", true); + $menu .= $this->buildMenu('bug', 'close', $params, $bug, $type, '', '', "text-danger iframe showinonlybody", true); + if($type == 'view') $menu .= $this->buildMenu('bug', 'activate', $params, $bug, $type, '', '', "text-success iframe showinonlybody", true); if($this->app->tab != 'product') { - $menu .= $this->buildMenu('bug', 'toStory', $toStoryParams, $bug, $menuType, $this->lang->icons['story'], '', '', '', "data-app='product'", $this->lang->bug->toStory); - $menu .= $this->buildMenu('bug', 'createCase', $convertParams, $bug, $menuType, 'sitemap'); + $menu .= $this->buildMenu('bug', 'toStory', $toStoryParams, $bug, $type, $this->lang->icons['story'], '', '', '', "data-app='product'", $this->lang->bug->toStory); + $menu .= $this->buildMenu('bug', 'createCase', $convertParams, $bug, $type, 'sitemap'); } - $menu .= "
"; + if($type == 'view') $menu .= "
"; $menu .= $this->buildFlowMenu('bug', $bug, $type, 'direct'); - $menu .= "
"; - $menu .= $this->buildMenu('bug', 'edit', $params, $bug, $menuType); - if($this->app->tab != 'product') $menu .= $this->buildMenu('bug', 'create', $copyParams, $bug, $menuType, 'copy'); - $menu .= $this->buildMenu('bug', 'delete', $params, $bug, $menuType, 'trash', 'hiddenwin', "showinonlybody"); + if($type == 'view') $menu .= "
"; + $menu .= $this->buildMenu('bug', 'edit', $params, $bug, $type); + if($this->app->tab != 'product') $menu .= $this->buildMenu('bug', 'create', $copyParams, $bug, $type, 'copy'); + $menu .= $this->buildMenu('bug', 'delete', $params, $bug, $type, 'trash', 'hiddenwin', "showinonlybody"); return $menu; } } diff --git a/module/common/model.php b/module/common/model.php index 089d3d58ec..bd79bb382d 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -1564,7 +1564,7 @@ EOD; * @access public * @return void */ - public static function buildIconButton($module, $method, $vars = '', $object = '', $type = 'button', $icon = '', $target = '', $extraClass = '', $onlyBody = false, $misc = '', $title = '', $programID = 0) + public static function buildIconButton($module, $method, $vars = '', $object = '', $type = 'button', $icon = '', $target = '', $extraClass = '', $onlyBody = false, $misc = '', $title = '', $programID = 0, $extraEnabled = '') { if(isonlybody() and strpos($extraClass, 'showinonlybody') === false) return false; @@ -1578,7 +1578,11 @@ EOD; /* Judge the $method of $module clickable or not, default is clickable. */ $clickable = true; - if(is_object($object)) + if(is_bool($extraEnabled)) + { + $clickable = $extraEnabled; + } + else if(is_object($object)) { if($app->getModuleName() != $module) $app->control->loadModel($module); $modelClass = class_exists("ext{$module}Model") ? "ext{$module}Model" : $module . "Model"; @@ -1623,7 +1627,6 @@ EOD; if(!$clickable) $class .= ' disabled'; if($icon) $class .= ' icon-' . $icon; - /* Create the icon link. */ if($clickable) {