Skip to content

Commit

Permalink
看板管理增加一个隐藏的功能
Browse files Browse the repository at this point in the history
  • Loading branch information
weichaoduo committed Jan 21, 2022
1 parent 0c60efa commit c854f89
Show file tree
Hide file tree
Showing 11 changed files with 257 additions and 684 deletions.
18 changes: 18 additions & 0 deletions app/classes/AgileLogic.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,24 @@ public function getBoardsByProject($projectId)
return $boards;
}

/**
* @param $projectId
* @return array
* @throws \Exception
*/
public function getHidedBoardsByProject($projectId)
{
$boards = [];
$model = new AgileBoardModel();
$otherBoards = $model->getsByAll($projectId);
foreach ($otherBoards as $otherBoard) {
if ($otherBoard['is_hide']==1 ) {
$boards[] = $otherBoard;;
}
}
return $boards;
}

/**
* @param $projectId
* @return bool
Expand Down
54 changes: 54 additions & 0 deletions app/ctrl/Agile.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,37 @@ public function setBoardDefault()
$this->ajaxSuccess('操作成功', $_POST);
}

/**
* @throws \Exception
*/
public function setBoardHide()
{
$projectId = null;
if (isset($_POST['project_id'])) {
$projectId = (int)$_POST['project_id'];
}
if (empty($projectId)) {
$this->ajaxFailed('参数错误', '项目id不能为空');
}

$boardId = null;
if (isset($_POST['id'])) {
$boardId = (int)$_POST['id'];
}
if (empty($boardId)) {
$err['id'] = '看板id不能为空';
$this->ajaxFailed('参数错误', $err, parent::AJAX_FAILED_TYPE_FORM_ERROR);
}
$model = new AgileBoardModel();
$board = $model->getById($boardId);
if($board['project_id']!=$projectId){
$this->ajaxFailed('参数错误', '项目id错误');
}
$model->updateById($boardId, ['is_hide'=>'1']);

$this->ajaxSuccess('操作成功', $_POST);
}

/**
* 添加一个迭代
* @throws \Exception
Expand Down Expand Up @@ -926,6 +957,29 @@ public function fetchBoardsByProject()
$this->ajaxSuccess('success', $data);
}

/**
* @throws \Exception
*/
public function fetchHidedBoards()
{
$projectId = null;
if (isset($_GET['project_id'])) {
$projectId = (int)$_GET['project_id'];
}
if (empty($projectId)) {
$this->ajaxFailed('参数错误', '项目数据错误');
}
$agileLogic = new AgileLogic();
$boards = $agileLogic->getHidedBoardsByProject($projectId);
$i = 0;
foreach ($boards as &$board) {
$i++;
$board['i'] = $i;
}
$data['boards'] = $boards;
$this->ajaxSuccess('success', $data);
}

public function fetchBoardInfoById()
{
$projectId = null;
Expand Down
1 change: 0 additions & 1 deletion app/ctrl/Invite.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use main\app\model\user\UserTokenModel;
use main\app\model\user\LoginlogModel;
use main\app\model\user\EmailVerifyCodeModel;
use \main\lib\CaptchaBuilder;
use main\app\classes\SettingsLogic;

/**
Expand Down
20 changes: 13 additions & 7 deletions app/ctrl/Passport.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
use main\app\model\user\UserTokenModel;
use main\app\model\user\LoginlogModel;
use main\app\model\user\EmailVerifyCodeModel;
use \main\lib\CaptchaBuilder;
use main\app\classes\SettingsLogic;

/**
Expand Down Expand Up @@ -214,16 +213,17 @@ public function pageOutputCaptcha($mode)
if (!in_array($mode, array('login', 'reg'))) {
$mode = 'login';
}
$builder = new CaptchaBuilder;
$builder = new \Gregwar\Captcha\CaptchaBuilder;
$builder->build(150, 40);
if ($mode == 'login') {
$_SESSION['captcha_login'] = $builder->getPhrase();
$_SESSION['login_captcha'] = $builder->getPhrase();
$_SESSION['login_captcha_time'] = time();
}
if ($mode == 'reg') {
$_SESSION['captcha_reg'] = $builder->getPhrase();
$_SESSION['reg_captcha'] = $builder->getPhrase();
$_SESSION['reg_captcha_time'] = time();
}
header('Content-type: image/jpeg');
$builder->output();
echo $builder->inline();
}

/**
Expand Down Expand Up @@ -293,7 +293,13 @@ public function doLogin(
$settingModel = SettingModel::getInstance();
$muchErrTimesCaptcha = $settingModel->getSettingValue('muchErrorTimesCaptcha');
$ipAddress = getIp();
$reqVerifyCode = isset($_REQUEST['vcode']) ? $_REQUEST['vcode'] : false;
$reqVerifyCode = isset($_REQUEST['vcode']) ? strtolower($_REQUEST['vcode']) : false;
$loginRequireCaptcha = SettingModel::getInstance()->getSettingValue('login_require_captcha');
if($loginRequireCaptcha=='1'){
if($reqVerifyCode===false || $reqVerifyCode!=strtolower($_SESSION['login_captcha'])){
$this->ajaxFailed('提 示', ['vcode'=>'验证码错误'], parent::AJAX_FAILED_TYPE_FORM_ERROR);
}
}
$arr = $this->auth->checkIpErrorTimes($reqVerifyCode, $ipAddress, $times, $muchErrTimesCaptcha);
list($ret, $retCode, $tip) = $arr;
if (!$ret) {
Expand Down
107 changes: 93 additions & 14 deletions app/view/twig/agile/board.twig
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@
</div>


{% verbatim %}<script type="text/html" id="board_list_tpl">
{% verbatim %}
<script type="text/html" id="board_list_tpl">
{{#boards}}
<tr id="tr_data_id_{{id}}">
<th scope="row"> {{i}}</th>
<td>{{name}}</td>
Expand All @@ -220,39 +220,70 @@
<a class="btn btn-transparent btn-action list_for_default " style="color:blue" title="设置默认" href="javascript:void(0);" data-id="{{id}}">设置</a>{{/if_eq}}</td>
<td>{{weight}}</td>
<td>
{{#if_eq is_system '1'}}
{{#if_eq sprint_id 0}}系统内置{{^}}迭代{{/if_eq}}
{{#if_eq range_type 'all'}}
{{#if_eq sprint_id 0}}系统内置{{/if_eq}}
{{^}}
<a class="btn btn-transparent btn-action list_for_edit" title="编辑看板" href="javascript:void(0);" style="color:blue" data-id="{{id}}">
<i class="fa fa-pencil-square-o"></i>
</a>
<a class="btn btn-transparent btn-action list_for_delete" title="删除看板" class="list_for_delete" style="color:blue" data-id="{{id}}" href="javascript:void(0)">
<i class="fa fa-trash-o"></i>
{{#if_eq is_hide '1'}}
<a class="btn btn-transparent btn-action list_for_display" title="显示看板" style="color:blue" data-id="{{id}}" href="javascript:void(0)">
<i class="fa fa-eye"></i>
</a>
{{^}}
<a class="btn btn-transparent btn-action list_for_hide" title="隐藏看板" style="color:blue" data-id="{{id}}" href="javascript:void(0)">
<i class="fa fa-ban"></i>
</a>
{{/if_eq}}
{{#if_eq is_system 0}}
<a class="btn btn-transparent btn-action list_for_delete" title="删除看板" style="color:red" data-id="{{id}}" href="javascript:void(0)">
<i class="fa fa-trash-o"></i>
</a>
{{/if_eq}}
{{/if_eq}}
</td>
</tr>
{{/boards}}
</script>{% endverbatim %}
</script>

<script type="text/html" id="hide_board_list_tpl">
{{#boards}}
<tr id="tr_data_id_{{id}}">
<th scope="row"> {{i}}</th>
<td>{{name}}</td>
<td>{{range_type}}</td>
<!--<td>{{#if_eq is_filter_backlog 1}} 是 {{^}} 否 {{/if_eq}}</td>
<td>{{#if_eq is_filter_closed 1}} 是 {{^}} 否 {{/if_eq}}</td>
<td>{{weight}}</td>-->
<td>
<a class="btn btn-transparent btn-action list_for_display" title="恢复显示" class="list_for_display" style="color:blue" data-id="{{id}}" href="javascript:void(0)">
<i class="fa fa-eye"></i>
</a>
</td>
</tr>
{{/boards}}
</script>

{% endverbatim %}

<form id="form-board_setting2" action="#" name="form-board_setting2" method="post">
<div class="modal board_setting-modal" id="modal-board_setting">

<div class="form-horizontal" id="form-board_setting">

<input type="hidden" name="project_id" value="<?= project_id ?>">
<input type="hidden" name="form_board_id" id ="form_board_id" value="">

<div class="modal-dialog" style="width: 60%;">
<div class="modal-content modal-middle">
<div class="modal-header">
<a class="close js-key-modal-close1" data-dismiss="modal" href="#">×</a>
<h3 id="board-header-title" class="modal-header-title">看板管理</h3>
</div>

<div id="board_table" class="modal-body" style="min-height: 400px">

<div class="panel">
<table class="table table-hover">
<thead>
Expand All @@ -272,12 +303,14 @@
</div>
</div>
<div class="modal-footer form-actions" id="action-board_list">
<button type="button" class="btn btn-default" id="btn-show_hided_board">
<i class="fa fa-eye"></i> 已隐藏的看板
</button>
<button type="button" class="btn btn-info" id="btn-show_add_board">
<i class="fa fa-plus"></i> 创建看板
</button>
<a class="btn btn-cancel" data-dismiss="modal" href="javascript:;" onclick="$board_setting.refreshBoards()">关 闭</a>
</div>

<div id="board_add_form" class="modal-body hide" style="min-height: 400px">
<div class="form-group">
<div class="col-sm-2"> 看板名称:</div>
Expand Down Expand Up @@ -427,6 +460,43 @@

</div>
</form>
<div class="modal board_setting-modal" id="modal-hided-boards">
<input type="hidden" name="project_id" value="<?= project_id ?>">
<div class="modal-dialog" style="width: 60%;">
<div class="modal-content modal-middle">
<div class="modal-header">
<a class="close js-key-modal-close1" data-dismiss="modal" href="#">×</a>
<h3 id="board-header-title" class="modal-header-title">已隐藏的看板</h3>
</div>
<div id="board_table" class="modal-body" style="min-height: 400px">
<div class="panel">
<table class="table table-hover">
<thead>
<tr>
<th>#</th>
<th>名称</th>
<th>数据范围</th>
<th>操作</th>
</tr>
</thead>
<tbody id="hide_board_list_render_id">

</tbody>
</table>
</div>
</div>
<div class="modal-footer form-actions" id="action-board_list">
<button type="button" class="btn btn-info" id="btn-back_board_list2">
返回看板管理
</button>
<a class="btn btn-cancel" data-dismiss="modal" href="javascript:$('#modal-hided-boards').hide();" >关 闭</a>
</div>

</div>

</div>

</div>
<div class="modal" id="modal-issue_move">
<form class="js-quick-submit js-upload-blob-form form-horizontal" id="form_issue_move"
action="/agile/board_issue_move"
Expand Down Expand Up @@ -789,9 +859,18 @@
$('#action-board_form').show();
$('#board_table').hide();
$('#action-board_list').hide();
$('#modal-hided-boards').hide();
window.$board_setting.showCreateBoardById('');
});
//
// 显示已隐藏看板
$('#btn-show_hided_board').bind('click', function () {
$('#modal-hided-boards').show();
window.$board_setting.fetchHidedBoards();
});
$('#btn-back_board_list2').bind('click', function () {
$('#modal-hided-boards').hide();
});
$('#btn-display-create-board').bind('click', function () {
$('#btn-setting_board').click();
$('#btn-show_add_board').click();
Expand Down
Loading

0 comments on commit c854f89

Please sign in to comment.