* Adjust the icon of story.

This commit is contained in:
chencongzhi520@gmail.com
2012-07-02 01:23:59 +00:00
parent b0fb9c5761
commit 52a94383bc
3 changed files with 47 additions and 67 deletions
+8 -29
View File
@@ -31,10 +31,10 @@ var browseType = '<?php echo $browseType;?>';
<span id='bysearchTab' ><a href='#'><span class='icon-search'></span><?php echo $lang->product->searchStory;?></a></span>
</div>
<div class='f-right'>
<?php common::printLink('story', 'export', "productID=$productID&orderBy=$orderBy", '&nbsp;', '', "class='export icon-green-big-export' title='{$lang->export}'", false); ?>
<?php common::printLink('story', 'report', "productID=$productID&browseType=$browseType&moduleID=$moduleID", '&nbsp;', '', "class='icon-green-big-report' title='{$lang->story->report->common}'", false); ?>
<?php if(common::hasPriv('story', 'create')) echo html::a($this->createLink('story', 'batchCreate', "productID=$productID&moduleID=$moduleID"), '&nbsp;', '', "class='icon-green-big-story-batchCreate' title='{$lang->story->batchCreate}'"); ?>
<?php if(common::hasPriv('story', 'create')) echo html::a($this->createLink('story', 'create', "productID=$productID&moduleID=$moduleID"), '&nbsp;', '', "class='icon-green-big-story-create' title='{$lang->story->create}'"); ?>
<?php common::printIcon('story', 'export', "productID=$productID&orderBy=$orderBy", '', 'big');?>
<?php common::printIcon('story', 'report', "productID=$productID&browseType=$browseType&moduleID=$moduleID", '', 'big');?>
<?php common::printIcon('story', 'batchCreate', "productID=$productID&moduleID=$moduleID", '', 'big');?>
<?php common::printIcon('story', 'create', "productID=$productID&moduleID=$moduleID", '', 'big'); ?>
</div>
</div>
<div id='querybox' class='<?php if($browseType !='bysearch') echo 'hidden';?>'><?php echo $searchForm;?></div>
@@ -95,31 +95,10 @@ var browseType = '<?php echo $browseType;?>';
<td class='a-right'>
<?php
$vars = "story={$story->id}";
if(common::hasPriv('story', 'change'))
{
if($story->status != 'closed')
{
echo html::a($this->inLink('story', 'change', $vars), '&nbsp;', '', "class='icon-green-small-story-change' title='{$lang->story->change}'", false);
}
else
{
echo "<span class='icon-gray-small-story-change' title='{$lang->story->change}'>&nbsp;</span>";
}
}
if(common::hasPriv('story', 'review'))
{
if($story->status == 'draft' or $story->status == 'changed')
{
echo html::a($this->inLink('review', $vars), '&nbsp;', '', "class='icon-green-small-story-review' title='{$lang->story->review}'", false);
}
else
{
echo "<span class='icon-gray-small-story-review' title='{$lang->story->review}'>&nbsp;</span>";
}
}
common::printLink('story', 'edit', "storyID=$story->id", '&nbsp;', '', "class='icon-green-small-edit' title='{$lang->edit}'", false);
common::printLink('testcase', 'create', "productID=$story->product&module=0&from=&param=0&$vars", '&nbsp;', '', "class='icon-green-small-story-createCase' title='{$lang->story->createCase}'", false);
common::printIcon('story', 'change', $vars, $story);
common::printIcon('story', 'review', $vars, $story);
common::printIcon('story', 'edit', "storyID=$story->id", $story);
common::printIcon('story', 'createCase', "productID=$story->product&module=0&from=&param=0&$vars", $story, 'small', 'createCase');
?>
</td>
</tr>
+20
View File
@@ -1265,4 +1265,24 @@ class storyModel extends model
->beginIF($this->session->storyQueryCondition != false)->where($this->session->storyQueryCondition)->fi()
->groupBy('version')->orderBy('value')->fetchAll();
}
/**
* Adjust the action clickable.
*
* @param object $story
* @param string $action
* @access public
* @return void
*/
public function isClickable($story, $action)
{
$action = strtolower($action);
if($action == 'change') return $story->status != 'closed';
if($action == 'review') return $story->status == 'draft' or $story->status == 'changed';
if($action == 'close') return $story->status != 'closed';
if($action == 'activate') return $story->status == 'closed' and $story->closedReason == 'postponed';
return true;
}
}
+19 -38
View File
@@ -18,28 +18,28 @@
$browseLink = $app->session->storyList != false ? $app->session->storyList : $this->createLink('product', 'browse', "productID=$story->product&moduleID=$story->module");
if(!$story->deleted)
{
if(!($story->status != 'closed' and common::printLink('story', 'change', "storyID=$story->id", $lang->story->change))) echo $lang->story->change . ' ';
if(!(($story->status == 'draft' or $story->status == 'changed') and common::printLink('story', 'review', "storyID=$story->id", $lang->story->review))) echo $lang->story->review . ' ';
if(!($story->status != 'closed' and common::printLink('story', 'close', "storyID=$story->id", $lang->story->close))) echo $lang->story->close . ' ';
if(!($story->status == 'closed' and $story->closedReason == 'postponed' and common::printLink('story', 'activate', "storyID=$story->id", $lang->story->activate))) echo $lang->story->activate . ' ';
ob_start();
if(!common::printLink('testcase', 'create', "productID=$story->product&moduleID=0&from=&param=0&storyID=$story->id", $lang->story->createCase)) echo $lang->story->createCase . ' ';
if($this->story->isClickable($story, 'change')) common::printLink('story', 'change', "storyID=$story->id", $lang->story->change);
if($this->story->isClickable($story, 'review')) common::printLink('story', 'review', "storyID=$story->id", $lang->story->review);
if($this->story->isClickable($story, 'close')) common::printLink('story', 'close', "storyID=$story->id", $lang->story->close);
if($this->story->isClickable($story, 'activate')) common::printLink('story', 'activate', "storyID=$story->id", $lang->story->activate);
if(!common::printLink('story', 'edit', "storyID=$story->id", '&nbsp;', '', "class='icon-edit'")) echo "<span class='icon-edit'></span>";
if(common::hasPriv('story', 'edit')) echo html::a('#comment', '&nbsp;', '', "class='icon-comment' onclick='setComment()'");
if($this->story->isClickable($story, 'toCase')) common::printSplitIcon();
common::printLink('testcase', 'create', "productID=$story->product&moduleID=0&from=&param=0&storyID=$story->id", $lang->story->createCase);
common::printLink('story', 'create', "productID=$story->product&moduleID=$story->module&storyID=$story->id", '&nbsp;', '', "class='icon-copy'");
if($this->story->isClickable($story, 'edit')) common::printSplitIcon();
common::printIcon('story', 'edit', "storyID=$story->id", '', 'big');
common::printCommentIcon('story');
common::printIcon('story', 'create', "productID=$story->product&moduleID=$story->module&storyID=$story->id", '', 'big', 'copy');
common::printIcon('story', 'delete', "storyID=$story->id", '', 'big', '', 'hiddenwin');
common::printLink('story', 'delete', "storyID=$story->id", '&nbsp;', 'hiddenwin', "class='icon-delete'");
}
echo html::a($browseLink, ' ', '', "class='icon-goback'");
if($preAndNext->pre)
{
echo html::a($this->inLink('view', "storyID={$preAndNext->pre->id}&version={$preAndNext->pre->version}"), '&nbsp;', '', "class='icon-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}&version={$preAndNext->next->version}"), '&nbsp;', '', "class='icon-next' id='next' title='{$preAndNext->next->id}{$lang->colon}{$preAndNext->next->title}'");
if($this->story->isClickable('story', 'goback')) common::printSplitIcon();
common::printRPN($browseLink, $preAndNext);
$actionLinks = ob_get_contents();
ob_clean();
echo $actionLinks;
}
?>
</div>
@@ -58,26 +58,7 @@
</fieldset>
<?php echo $this->fetch('file', 'printFiles', array('files' => $story->files, 'fieldset' => 'true'));?>
<?php include '../../common/view/action.html.php';?>
<div class='a-center' style='font-size:16px; font-weight:bold'>
<?php
if(!$story->deleted)
{
if(!($story->status != 'closed' and common::printLink('story', 'change', "storyID=$story->id", $lang->story->change))) echo $lang->story->change . ' ';
if(!(($story->status == 'draft' or $story->status == 'changed') and common::printLink('story', 'review', "storyID=$story->id", $lang->story->review))) echo $lang->story->review . ' ';
if(!($story->status != 'closed' and common::printLink('story', 'close', "storyID=$story->id", $lang->story->close))) echo $lang->story->close . ' ';
if(!($story->status == 'closed' and $story->closedReason == 'postponed' and common::printLink('story', 'activate', "storyID=$story->id", $lang->story->activate))) echo $lang->story->activate . ' ';
if(!common::printLink('testcase', 'create', "productID=$story->product&moduleID=0&from=&param=0&storyID=$story->id", $lang->story->createCase)) echo $lang->story->createCase . ' ';
if(!common::printLink('story', 'edit', "storyID=$story->id", '&nbsp;', '', "class='icon-edit'")) echo "<span class='icon-edit'></span>";
if(common::hasPriv('story', 'edit')) echo html::a('#comment', '&nbsp;', '', "class='icon-comment' onclick='setComment()'");
common::printLink('story', 'delete', "storyID=$story->id", '&nbsp;', 'hiddenwin', "class='icon-delete'");
}
echo html::a($browseLink, '&nbsp;', '', "class='icon-goback'");
?>
</div>
<div class='a-center actionlink'><?php echo $actionLinks;?></div>
<div id='comment' class='hidden'>
<fieldset>
<legend><?php echo $lang->comment;?></legend>