diff --git a/module/bug/model.php b/module/bug/model.php
index cc3b1f7a52..75efdbcfef 100644
--- a/module/bug/model.php
+++ b/module/bug/model.php
@@ -1067,4 +1067,25 @@ class bugModel extends model
}
return $bugs;
}
+
+ /**
+ * Adjust the action is clickable.
+ *
+ * @param string $bug
+ * @param string $action
+ * @access public
+ * @return void
+ */
+ public function isClickable($object, $action)
+ {
+ $action = strtolower($action);
+
+ if($action == 'confirmbug') return $object->status == 'active' and $object->confirmed == 0;
+ if($action == 'resolve') return $object->status == 'active';
+ if($action == 'close') return $object->status == 'resolved';
+ if($action == 'activate') return $object->status != 'active';
+ if($action == 'tostory') return $object->status == 'active';
+
+ return true;
+ }
}
diff --git a/module/bug/view/browse.html.php b/module/bug/view/browse.html.php
index f968b01885..567a22b187 100644
--- a/module/bug/view/browse.html.php
+++ b/module/bug/view/browse.html.php
@@ -37,10 +37,10 @@ var customed = ;
?>
- bug->export}'"); ?>
+
bug->customFields, '', "class='iframe'"); ?>
- bug->report->common}'"); ?>
- bug->create}'"); ?>
+
+
'>
@@ -136,33 +136,10 @@ var customed = ;
id";
- if(common::hasPriv('bug', 'resolve'))
- {
- if($bug->status == 'active')
- {
- echo html::a($this->inLink('resolve', $params), ' ', '', "class='icon-green-small-bug-resolve' title='{$lang->bug->resolve}'", false);
- }
- else
- {
- echo " ";
-
- }
- }
-
- if(common::hasPriv('bug', 'close'))
- {
- if($bug->status == 'resolved')
- {
- echo html::a($this->inLink('close', $params), ' ', '', "class='icon-green-small-bug-close' title='{$lang->bug->close}'", false);
- }
- else
- {
- echo " ";
- }
- }
-
- common::printLink('bug', 'edit', $params, ' ', '', "class='icon-green-small-edit' title='{$lang->bug->edit}'", false);
- common::printLink('bug', 'create', "product=$bug->product&extra=bugID=$bug->id", ' ', '', "class='icon-green-small-copy' title='{$lang->copy}'", false);
+ common::printIcon('bug', 'resolve', $params, $bug);
+ common::printIcon('bug', 'close', $params, $bug);
+ common::printIcon('bug', 'edit', $params, $bug);
+ common::printIcon('bug', 'create', "product=$bug->product&extra=bugID=$bug->id", $bug, 'small', 'copy');
?>
|
diff --git a/module/bug/view/view.html.php b/module/bug/view/view.html.php
index f74e06e5d6..967fccaec7 100644
--- a/module/bug/view/view.html.php
+++ b/module/bug/view/view.html.php
@@ -21,94 +21,32 @@
$convertParams = "productID=$productID&moduleID=0&from=bug&bugID=$bug->id";
if(!$bug->deleted)
{
- if(common::hasPriv('bug', 'confirmBug'))
- {
- if($bug->status == 'active' and $bug->confirmed == 0)
- {
- echo html::a($this->inLink('confirmBug', $params), $lang->bug->buttonConfirm);
- }
- else
- {
- echo $lang->bug->buttonConfirm . ' ';
- }
- }
+ ob_start();
+ if($this->bug->isClickable($bug, 'confirmBug')) common::printLink('bug', 'confirmBug', $params, $lang->bug->buttonConfirm);
common::printLink('bug', 'assignTo', $params, $lang->bug->buttonAssign);
+ if($this->bug->isClickable($bug, 'resolve')) common::printLink('bug', 'resolve', $params, $lang->bug->buttonResolve);
+ if($this->bug->isClickable($bug, 'close')) common::printLink('bug', 'close', $params, $lang->bug->buttonClose);
+ if($this->bug->isClickable($bug, 'activate')) common::printLink('bug', 'activate', $params, $lang->bug->buttonActivate);
- if(common::hasPriv('bug', 'resolve'))
+ if($this->bug->isClickable($bug, 'toStory'))
{
- if($bug->status == 'active')
- {
- echo html::a($this->inLink('resolve', $params), $lang->bug->buttonResolve);
- }
- else
- {
- echo $lang->bug->buttonResolve . ' ';
- }
- }
-
- if(common::hasPriv('bug', 'close'))
- {
- if($bug->status == 'resolved')
- {
- echo html::a($this->inLink('close', $params), $lang->bug->buttonClose);
- }
- else
- {
- echo $lang->bug->buttonClose . ' ';
- }
- }
-
- if(common::hasPriv('bug', 'activate'))
- {
- if($bug->status == 'closed' or $bug->status == 'resolved')
- {
- echo html::a($this->inLink('activate', $params), $lang->bug->buttonActivate);
- }
- else
- {
- echo $lang->bug->buttonActivate . ' ';
- }
- }
- if(common::hasPriv('bug', 'confirmBug') or common::hasPriv('bug', 'assignTo') or common::hasPriv('bug', 'resolve') or common::hasPriv('bug', 'close') or common::hasPriv('bug', 'activate'))
- {
- echo "";
- }
-
- if(common::hasPriv('story', 'create'))
- {
- if($bug->status == 'active')
- {
- echo html::a($this->createLink('story', 'create', "product=$bug->product&module=0&story=0&project=0&bugID=$bug->id"), $lang->bug->toStory);
- }
- else
- {
- echo $lang->bug->toStory . ' ';
- }
+ common::printSplitIcon();
+ common::printLink('story', 'create', "product=$bug->product&module=0&story=0&project=0&bugID=$bug->id", $lang->bug->toStory);
}
common::printLink('testcase', 'create', $convertParams, $lang->bug->buttonCreateTestcase);
- if(common::hasPriv('story', 'create') or common::hasPriv('testcase', 'create'))
- {
- echo "";
- }
- common::printLink('bug', 'edit', $params, ' ', '', "class='icon-green-big-edit' title={$lang->bug->edit}");
- if(common::hasPriv('bug', 'edit')) echo html::a('#comment', ' ', '', "class='icon-green-big-comment' title={$lang->comment} onclick='setComment()'");
- common::printLink('bug', 'create', $copyParams, ' ', '', "class='icon-green-big-copy' title={$lang->copy}");
- common::printLink('bug', 'delete', $params, ' ', 'hiddenwin', "class='icon-green-big-delete' title={$lang->delete}");
- if(common::hasPriv('bug', 'edit') or common::hasPriv('bug', 'create') or common::hasPriv('bug', 'delete'))
- {
- echo "";
- }
- }
+ if($this->bug->isClickable($bug, 'edit')) common::printSplitIcon();
+ common::printIcon('bug', 'edit', $params, '', 'big');
+ common::printCommentIcon('bug');
+ common::printIcon('bug', 'create', $copyParams, '', 'big', 'copy');
+ common::printIcon('bug', 'delete', $params, '', 'big', '', 'hiddenwin');
- echo html::a($browseLink, ' ', '', "class='icon-green-big-goback' title={$lang->goback}");
- if($preAndNext->pre)
- {
- echo html::a($this->inLink('view', "storyID={$preAndNext->pre->id}"), ' ', '', "class='icon-green-big-pre' id='pre' title='{$preAndNext->pre->id}{$lang->colon}{$preAndNext->pre->title}'");
- }
- if($preAndNext->next)
- {
- echo html::a($this->inLink('view', "storyID={$preAndNext->next->id}"), ' ', '', "class='icon-green-big-next' id='next' title='{$preAndNext->next->id}{$lang->colon}{$preAndNext->next->title}'");
+ if($this->bug->isClickable($bug, 'goback')) common::printSplitIcon();
+ common::printRPN($browseLink, $preAndNext);
+
+ $actionLinks = ob_get_contents();
+ ob_end_clean();
+ echo $actionLinks;
}
?>
@@ -123,92 +61,7 @@
fetch('file', 'printFiles', array('files' => $bug->files, 'fieldset' => 'true'));?>
-
- deleted)
- {
- if(common::hasPriv('bug', 'confirmBug'))
- {
- if($bug->status == 'active' and $bug->confirmed == 0)
- {
- echo html::a($this->inLink('confirmBug', $params), $lang->bug->buttonConfirm);
- }
- else
- {
- echo $lang->bug->buttonConfirm . ' ';
- }
- }
- common::printLink('bug', 'assignTo', $params, $lang->bug->buttonAssign);
-
- if(common::hasPriv('bug', 'resolve'))
- {
- if($bug->status == 'active')
- {
- echo html::a($this->inLink('resolve', $params), $lang->bug->buttonResolve);
- }
- else
- {
- echo $lang->bug->buttonResolve . ' ';
- }
- }
-
- if(common::hasPriv('bug', 'close'))
- {
- if($bug->status == 'resolved')
- {
- echo html::a($this->inLink('close', $params), $lang->bug->buttonClose);
- }
- else
- {
- echo $lang->bug->buttonClose . ' ';
- }
- }
-
- if(common::hasPriv('bug', 'activate'))
- {
- if($bug->status == 'closed' or $bug->status == 'resolved')
- {
- echo html::a($this->inLink('activate', $params), $lang->bug->buttonActivate);
- }
- else
- {
- echo $lang->bug->buttonActivate . ' ';
- }
- }
- if(common::hasPriv('bug', 'confirmBug') or common::hasPriv('bug', 'assignTo') or common::hasPriv('bug', 'resolve') or common::hasPriv('bug', 'close') or common::hasPriv('bug', 'activate'))
- {
- echo "";
- }
-
- if(common::hasPriv('story', 'create'))
- {
- if($bug->status == 'active')
- {
- echo html::a($this->createLink('story', 'create', "product=$bug->product&module=0&story=0&project=0&bugID=$bug->id"), $lang->bug->toStory);
- }
- else
- {
- echo $lang->bug->toStory . ' ';
- }
- }
- common::printLink('testcase', 'create', $convertParams, $lang->bug->buttonCreateTestcase);
- if(common::hasPriv('story', 'create') or common::hasPriv('testcase', 'create'))
- {
- echo "";
- }
-
- common::printLink('bug', 'edit', $params, ' ', '', "class='icon-green-big-edit' title={$lang->bug->edit}");
- if(common::hasPriv('bug', 'edit')) echo html::a('#comment', ' ', '', "class='icon-green-big-comment' title={$lang->comment} onclick='setComment()'");
- common::printLink('bug', 'create', $copyParams, ' ', '', "class='icon-green-big-copy' title={$lang->copy}");
- common::printLink('bug', 'delete', $params, ' ', 'hiddenwin', "class='icon-green-big-delete' title={$lang->delete}");
- if(common::hasPriv('bug', 'edit') or common::hasPriv('bug', 'create') or common::hasPriv('bug', 'delete'))
- {
- echo "";
- }
- }
- echo html::a($browseLink, ' ', '', "class='icon-green-big-goback' title={$lang->goback}");
- ?>
-
+ deleted) echo $actionLinks;?>