一、创建BUG界面

1.在/opt/zbox/app/zentao/module/bug/ext/view路径下创建create.yyt.html.hook.php文件,在文件中增加要添加的字段代码:

<?php
$html  = '<tr>';
$html .= '<th></th>';
$html .= '<th hidden>';
$html .= $lang->bug->probability;
$html .= '</th>';
$html .= '<td>';//出现概率
$html .= '<div class="input-group">';
$html .= '<span class="input-group-addon" style="border-radius: 4px;">';
$html .= $lang->bug->probability;
$html .= '</span>';
//$html .= '<span class="input-control has-icon-right required">';
//$html .= '<input type="text" value style="width: 70px" name="probability" id="probability" autocomplete="off" class="form-control" ;">';
//$html .= '</span>';
$html .= '<select id="probability" name="probability" style="width: 100px" autocomplete="off" class="form-control" >';
$html .= '<option>必现</option>';
$html .= '<option>高概率</option>';
$html .= '<option>低概率</option>';
$html .= '<option>极低概率</option>';
$html .= '</select>';//是否用例发现
$html .= '<span class="input-group-addon step-type-toggle">';
$html .= '<div class="checkbox-primary">';
$html .= '<input value="否" name="iscasefind" id="iscasefind" type="checkbox" class="step-group-toggle">';
$html .= '<label class="checkbox-inline">';
$html .= $lang->bug->iscasefind;
$html .= '</label>';
$html .= '</div>';
$html .= '</span>';//用例编号
$html .= '<span class="input-group-addon" style="border-radius: 4px;">';
$html .= $lang->bug->caseno;
$html .= '</span>';
$html .= '<span class="input-control has-icon-right">';
$html .= '<input type="text" value style="width: 210px" name="caseno" id="caseno" autocomplete="off" class="form-control" ;">';$html .= '</span>';
$html .= '</div>';
$html .= '<div  style="visibility:hidden;color: #ff5d5d" id="casenoerror">『用例编号』不能为空</div>';
$html .= '</td>';$html .= '</div>';
$html .= '</tr>';
?><script>$('#severity').closest('tr').after(<?php echo json_encode($html);?>);
</script><script>document.getElementById('submit').onclick=function check(){var iscasefind = document.getElementById('iscasefind').checked;if (iscasefind==true){document.getElementById('iscasefind').value='是';}else{document.getElementById('iscasefind').value='否';}if(document.getElementById('iscasefind').value == '是'){var no = document.getElementById('caseno').value;if (no==''){document.getElementById('casenoerror').style.visibility="visible";return false;}else{document.getElementById('casenoerror').style.visibility="hidden";}}}
</script>

2.在/opt/zbox/app/zentao/module/bug/ext/lang/zh-cn路径创建create.php文件,里面设置增加的界面需要访问的属性的值

<?php
/*yyt*/
$lang->bug->probability      = '出现概率';
$lang->bug->iscasefind       = '用例发现';
$lang->bug->caseno           = '用例编号';
/*yyt*/

二、在model文件的create方法中增加iscasefind字段的默认值

三、在数据库中给表增加字段

alter table zt_bug add column `probability` char(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;alter table zt_bug add column `iscasefind` varchar(25) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;alter table zt_bug add column `caseno` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;

四、要在BUG浏览界面能够自定义展示新增的字段

1.在/opt/zbox/app/zentao/module/bug/ext/config路径下创建bug模块config.php文件的扩展文件create.php

<?php
/*yyt*/
$config->bug->datatable->fieldList['probability']['title']    = 'probability';
$config->bug->datatable->fieldList['probability']['fixed']    = 'left';
$config->bug->datatable->fieldList['probability']['width']    = '100';
$config->bug->datatable->fieldList['probability']['required']    = 'no';$config->bug->datatable->fieldList['iscasefind']['title']    = 'iscasefind';
$config->bug->datatable->fieldList['iscasefind']['fixed']    = 'right';
$config->bug->datatable->fieldList['iscasefind']['width']    = '100';
$config->bug->datatable->fieldList['iscasefind']['required']    = 'no';
$config->bug->datatable->fieldList['caseno']['title']    = 'caseno';
$config->bug->datatable->fieldList['caseno']['fixed']    = 'right';
$config->bug->datatable->fieldList['caseno']['width']    = '100';
$config->bug->datatable->fieldList['caseno']['required']    = 'no';
/*yyt*/

2.在/opt/zbox/app/zentao/module/bug/ext/model路径下增加model的扩展printCell.php

<?php
/*** Print cell data.** @param  object $col* @param  object $bug* @param  array  $users* @param  array  $builds* @param  array  $branches* @param  array  $modulePairs* @param  array  $executions* @param  array  $plans* @param  array  $stories* @param  array  $tasks* @param  string $mode* @access public* @return void*/
public function printCell($col, $bug, $users, $builds, $branches, $modulePairs, $executions = array(), $plans = array(), $stories = array(), $tasks = array(), $mode = 'datatable')
{/* Check the product is closed. */$canBeChanged = common::canBeChanged('bug', $bug);$canBatchEdit         = ($canBeChanged and common::hasPriv('bug', 'batchEdit'));$canBatchConfirm      = ($canBeChanged and common::hasPriv('bug', 'batchConfirm'));$canBatchClose        = common::hasPriv('bug', 'batchClose');$canBatchActivate     = ($canBeChanged and common::hasPriv('bug', 'batchActivate'));$canBatchChangeBranch = ($canBeChanged and common::hasPriv('bug', 'batchChangeBranch'));$canBatchChangeModule = ($canBeChanged and common::hasPriv('bug', 'batchChangeModule'));$canBatchResolve      = ($canBeChanged and common::hasPriv('bug', 'batchResolve'));$canBatchAssignTo     = ($canBeChanged and common::hasPriv('bug', 'batchAssignTo'));$canBatchAction = ($canBatchEdit or $canBatchConfirm or $canBatchClose or $canBatchActivate or $canBatchChangeBranch or $canBatchChangeModule or $canBatchResolve or $canBatchAssignTo);$canView = common::hasPriv('bug', 'view');$hasCustomSeverity = false;foreach($this->lang->bug->severityList as $severityKey => $severityValue){if(!empty($severityKey) and (string)$severityKey != (string)$severityValue){$hasCustomSeverity = true;break;}}$bugLink = helper::createLink('bug', 'view', "bugID=$bug->id");$account = $this->app->user->account;$id = $col->id;if($col->show){$class = "c-$id";$title = '';if($id == 'id')     $class .= ' cell-id';if($id == 'status'){$class .= ' bug-' . $bug->status;$title  = "title='" . $this->processStatus('bug', $bug) . "'";}if($id == 'confirmed'){$class .= ' text-center';}//yytif ($id == 'probability'){$class .=' text-left';}if ($id == 'iscasefind'){$class .=' text-left';}//yytif($id == 'title'){$class .= ' text-left';$title  = "title='{$bug->title}'";}if($id == 'type'){$title  = "title='" . zget($this->lang->bug->typeList, $bug->type) . "'";}if($id == 'assignedTo'){$class .= ' has-btn text-left';if($bug->assignedTo == $account) $class .= ' red';}if($id == 'resolvedBy'){$class .= ' c-user';$title  = "title='" . zget($users, $bug->resolvedBy) . "'";}if($id == 'deadline' && isset($bug->delay) && $bug->status == 'active') $class .= ' delayed';if(strpos(',type,execution,story,plan,task,openedBuild,', ",{$id},") !== false) $class .= ' text-ellipsis';echo "<td class='" . $class . "' $title>";if(isset($this->config->bizVersion)) $this->loadModel('flow')->printFlowCell('bug', $bug, $id);switch($id){case 'id':if($canBatchAction){echo html::checkbox('bugIDList', array($bug->id => '')) . html::a(helper::createLink('bug', 'view', "bugID=$bug->id"), sprintf('%03d', $bug->id));}else{printf('%03d', $bug->id);}break;case 'severity':$severityValue     = zget($this->lang->bug->severityList, $bug->severity);$hasCustomSeverity = !is_numeric($severityValue);if($hasCustomSeverity){echo "<span class='label-severity-custom' data-severity='{$bug->severity}' title='" . $severityValue . "'>" . $severityValue . "</span>";}else{echo "<span class='label-severity' data-severity='{$bug->severity}' title='" . $severityValue . "'></span>";}break;case 'pri':echo "<span class='label-pri label-pri-" . $bug->pri . "' title='" . zget($this->lang->bug->priList, $bug->pri, $bug->pri) . "'>";echo zget($this->lang->bug->priList, $bug->pri, $bug->pri);echo "</span>";break;case 'confirmed':$class = 'confirm' . $bug->confirmed;echo "<span class='$class'>" . zget($this->lang->bug->confirmedList, $bug->confirmed, $bug->confirmed) . "</span> ";break;case 'title':if($bug->branch and isset($branches[$bug->branch]))    echo "<span class='label label-outline label-badge'>{$branches[$bug->branch]}</span> ";if($bug->module and isset($modulePairs[$bug->module])) echo "<span class='label label-gray label-badge'>{$modulePairs[$bug->module]}</span> ";echo $canView ? html::a($bugLink, $bug->title, null, "style='color: $bug->color'") : "<span style='color: $bug->color'>{$bug->title}</span>";break;case 'branch':echo zget($branches, $bug->branch, '');break;case 'execution':echo zget($executions, $bug->execution, '');break;case 'plan':echo zget($plans, $bug->plan, '');break;case 'story':if(isset($stories[$bug->story])){$story = $stories[$bug->story];echo common::hasPriv('story', 'view') ? html::a(helper::createLink('story', 'view', "storyID=$story->id", 'html', true), $story->title, '', "class='iframe'") : $story->title;}break;case 'task':if(isset($tasks[$bug->task])){$task = $tasks[$bug->task];echo common::hasPriv('task', 'view') ? html::a(helper::createLink('task', 'view', "taskID=$task->id", 'html', true), $task->name, '', "class='iframe'") : $task->name;}break;case 'toTask':if(isset($tasks[$bug->toTask])){$task = $tasks[$bug->toTask];echo common::hasPriv('task', 'view') ? html::a(helper::createLink('task', 'view', "taskID=$task->id", 'html', true), $task->name, '', "class='iframe'") : $task->name;}break;case 'type':echo zget($this->lang->bug->typeList, $bug->type);break;case 'status':echo "<span class='status-bug status-{$bug->status}'>";echo $this->processStatus('bug', $bug);echo  '</span>';break;case 'activatedCount':echo $bug->activatedCount;break;case 'activatedDate':echo substr($bug->activatedDate, 5, 11);break;case 'keywords':echo $bug->keywords;break;case 'os':echo zget($this->lang->bug->osList, $bug->os);break;case 'browser':echo zget($this->lang->bug->browserList, $bug->browser);break;case 'mailto':$mailto = explode(',', $bug->mailto);foreach($mailto as $account){$account = trim($account);if(empty($account)) continue;echo zget($users, $account) . " &nbsp;";}break;case 'found':echo zget($users, $bug->found);break;case 'openedBy':echo zget($users, $bug->openedBy);break;case 'openedDate':echo substr($bug->openedDate, 5, 11);break;case 'openedBuild':$builds = array_flip($builds);foreach(explode(',', $bug->openedBuild) as $build){$buildID = zget($builds, $build, '');if($buildID == 'trunk'){echo $build;}elseif($buildID and common::hasPriv('build', 'view')){echo html::a(helper::createLink('build', 'view', "buildID=$buildID"), $build, '', "title='$bug->openedBuild'");}}break;case 'assignedTo':$this->printAssignedHtml($bug, $users);break;case 'assignedDate':echo substr($bug->assignedDate, 5, 11);break;case 'deadline':echo $bug->deadline;break;//yytcase 'iscasefind':echo $bug->iscasefind;break;case 'probability':echo $bug->probability;break;case 'caseno':echo $bug->caseno;break;//yytcase 'resolvedBy':echo zget($users, $bug->resolvedBy, $bug->resolvedBy);break;case 'resolution':echo zget($this->lang->bug->resolutionList, $bug->resolution);break;case 'resolvedDate':echo substr($bug->resolvedDate, 5, 11);break;case 'resolvedBuild':echo $bug->resolvedBuild;break;case 'closedBy':echo zget($users, $bug->closedBy);break;case 'closedDate':echo substr($bug->closedDate, 5, 11);break;case 'lastEditedBy':echo zget($users, $bug->lastEditedBy);break;case 'lastEditedDate':echo substr($bug->lastEditedDate, 5, 11);break;case 'actions':$params = "bugID=$bug->id";if($canBeChanged){common::printIcon('bug', 'confirmBug', $params, $bug, 'list', 'ok',      '', 'iframe', true);common::printIcon('bug', 'resolve',    $params, $bug, 'list', 'checked', '', 'iframe', true);common::printIcon('bug', 'close',      $params, $bug, 'list', '',        '', 'iframe', true);common::printIcon('bug', 'edit',       $params, $bug, 'list');common::printIcon('bug', 'create',     "product=$bug->product&branch=$bug->branch&extra=$params", $bug, 'list', 'copy');}else{common::printIcon('bug', 'close', $params, $bug, 'list', '', '', 'iframe', true);}break;}echo '</td>';}
}
?>

五、在BUG详情界面展示新增的字段

1.在/opt/zbox/app/zentao/module/bug/ext/view路径下创建view的扩展view.yyt.html.hook.php

<?php
//出现概率
$html  = '<tr>';
$html .= '<th>';
$html .= $lang->bug->probability;
$html .= '</th>';
$html .= '<td>';
$html .= $bug->probability;
$html .= '</td>';
$html .= '</tr>';//是否用例发现
$html .= '<tr>';
$html .= '<th>';
$html .= $lang->bug->iscasefind;
$html .= '</th>';
$html .= '<td>';
$html .= $bug->iscasefind;
$html .= '</td>';
$html .= '</tr>';//用例编号
$html .= '<tr>';
$html .= '<th>';
$html .= $lang->bug->caseno;
$html .= '</th>';
$html .= '<td>';
$html .= $bug->caseno;
$html .= '</td>';
$html .= '</tr>';
?><script>$('span.label-pri').closest('tr').after(<?php echo json_encode($html);?>);
</script>

六、BUG修改界面添加对应字段

1、在module\bug\ext\view目录下新增edit.html的扩展文件

<?php
//出现概率
$html  = '<tr>';
$html .= '<th>';
$html .= $lang->bug->probability;
$html .= '</th>';
$html .= '<td>';
$html .= '<select id="probability" name="probability" class="form-control chosen chosen-controled" style="display: none;" >';
$html .= '<option id="probability1" value="必现">必现</option>';
$html .= '<option id="probability2" value="高概率">高概率</option>';
$html .= '<option id="probability3" value="低概率">低概率</option>';
$html .= '<option id="probability4" value="极低概率">极低概率</option>';
$html .= '</select>';
$html .= '</td>';
$html .= '</tr>';//用例发现
$html .= '<tr>';
$html .= '<th>';
$html .= $lang->bug->iscasefind;
$html .= '</th>';
$html .= '<td>';
$html .= '<select id="iscasefind" name="iscasefind" class="form-control chosen chosen-controled" style="display: none;" >';
$html .= '<option id="iscasefind1" value="是">是</option>';
$html .= '<option id="iscasefind2" value="否">否</option>';
$html .= '</select>';
$html .= '</td>';
$html .= '</tr>';//用例编号
$html .= '<tr>';
$html .= '<th>';
$html .= $lang->bug->caseno;
$html .= '</th>';
$html .= '<td>';
$html .= '<input type="text" id="caseno" name="caseno" value class="form-control" autocomplete="off">';
$html .= '</input>';
$html .= '</td>';
$html .= '</tr>';$selectedProbability  = $bug->probability;
$selectedIscasefind   = $bug->iscasefind;
$defCaseno            = $bug->caseno;?><script>$('#pri').closest('tr').after(<?php echo json_encode($html);?>);
</script>//出现概率默认值继承BUG
<script>str = <?php echo json_encode($selectedIscasefind);?>;obj = document.getElementById("probability");for(i=0;i<obj.length;i++){if(obj[i].value==str)obj[i].selected = true;}
</script>//用例发现默认值继承BUG
<script>str = <?php echo json_encode($selectediscasefind);?>;obj = document.getElementById("iscasefind");for(i=0;i<obj.length;i++){if(obj[i].value==str)obj[i].selected = true;}
</script>//用例编号默认值继承BUG
<script>document.getElementById("caseno").value=<?php echo json_encode($defCaseno);?>;</script>

创建BUG时增加字段相关推荐

  1. mysql创建表的时候日期给个默认值_mysql 创建表时 日期字段默认值为当前时间...

    mysql 创建表时 日期字段默认值为当前时间 mysql version 5.1 在mysql创建表的时候经常会遇到创建日期字段需要设置当前时间为默认值的时候,就如sqlserver2000一样,把 ...

  2. 因祸得福——创建视图时改变字段的类型

       是福不是祸,是祸躲不过.这里要说的不是霍,而是祸.既是祸,也是福.哈哈! 次因:              大家可以看到,问题是出在了EntityModule中,用泛型向datagridview ...

  3. 如何在调用Marketing Cloud contact创建API时增加对扩展字段的支持

    需求:扩展字段"微信ID"是我创建出来的extension field,我想用Marketing Cloud提供的contact creation API,在创建contact时也 ...

  4. oracle视图可以带日期变量么,创建视图时日期字段如何只都天

    原表有很多字段,我现在创建视图只取CALL_TYPE,START_DATE,BILLING_NBR,CHARGE1 这几个字段,然后 CALL_TYPE 这个字段的时间我只想看到天,YYYY/MM/D ...

  5. 【Groovy】MOP 元对象协议与元编程 ( Expando 动态类 | 创建动态类 | 为动态类增加字段和方法 )

    文章目录 一.Expando 动态类简介 二.动态类创建 三.为动态类增加字段和方法 四.完整代码示例 一.Expando 动态类简介 Groovy 运行时 , 可以动态地创建一个类 , 该类称为 & ...

  6. asp怎么循环增加字段和字段对应的值_索引该怎么创建?

    1.2.索引 B+Tree 结构的特性: ①.B+Tree 只有叶子节点会存储真实的数据,非叶子节点只会存储索引字段值: ②.B+Tree的叶子节点之间使用 双向链表 链接,所以更加适合范围查询和排序 ...

  7. blob类型_MySQL:创建表时如何选择合适的字段类型

    最近需要对表加一个字段,同时觉得前期建立表的时候有点粗暴,没有加很对限制,比如有些字符串长度是有限制的,在创建表时字段也没有对其进行限制.所以想借着这次加字段对表字段也进行一个优化,在优化之前先看了点 ...

  8. 创建shap文件的属性字段类型区别_在ArcGIS中为Shapefile属性表增加字段

    摘要: 属性描述了要素的相关特性,并存储于表中.在创建新的属性表或是向已有的属性表中增加字段的时候,必须指明数据类型和字段属性,比如精度(Precision)或长度(Length).数据类型的选择和相 ...

  9. Web终端连接资产支持重新连接等操作,支持创建授权时自动推送账号,JumpServer堡垒机v3.1.0发布

    2023年3月20日,JumpServer开源堡垒机正式发布v3.1.0版本.在这一版本中,JumpServer支持对Web终端会话进行重新连接,用户可以在Web终端界面快速打开已经连接超时的会话,或 ...

最新文章

  1. 程序是一座城,八年来我深陷其中
  2. linux下svn客户端安装及环境配置
  3. 消费者最关心的就是你的用户体验,以及保证产品品质,保证价格和服务
  4. compareHist函数 例子
  5. python 形参 拷贝_Day124:python中的变量、引用、拷贝
  6. php 空函数,PHP 中函数 isset(), empty(), is_null() 的区别
  7. 【翻译】.NET 5 Preview8发布
  8. linux 缩小链接库体积,两个奇技淫巧,将 Docker 镜像体积减小 99%
  9. CTC 解码算法之 prefix beam search
  10. 2019PKU\THU WC题解
  11. 软件著作权申请文档模版
  12. 优炫数据库收到来自重庆市统计局的感谢信
  13. 国家省、市、县、镇/街道地址
  14. VGA和HDMI传输距离是否有要求?
  15. 小程序推广二维码生成
  16. 【CTF题解NO.00003】moeCTF 2020 - official write up by arttnba3
  17. 区块链零知识证明:STARKs, Part II
  18. excel数据导入mysql被截取_Excel导入数据库时出现的文本截断问题解决方案
  19. php xdebug remote_host 多个,卓象程序员:PHPStudy PHPStorm XDebug调试
  20. 安装EA后win10提示系统资源不足,无法完成请求服务的解决方法

热门文章

  1. FL Studio教程之Fruity Blood Overdrive插件
  2. tenda w311mi驱动安装-ubuntu
  3. 京东风控团队带你全方位解读特征工程
  4. matlab 函数不定参数,matlab function定义一个函数,但一直出来说输入参数数目不足。我用的是2014版本,不知道数目原因啊?...
  5. spring的继承与依赖
  6. 大厂常考机器学习面试题
  7. 数据库系统—实体联系模型
  8. Linux系统中的超级用户,普通用户,特殊用户(特殊用户)3种类型
  9. 读张萌《人生效率手册》
  10. CSS空格和换行的处理