Merge branch 'master' of https://git.zcorp.cc/easycorp/zentaopms
This commit is contained in:
@@ -283,17 +283,17 @@ class block extends control
|
||||
|
||||
if(empty($block)) return $html;
|
||||
|
||||
if(isset($block->params->num) and !isset($block->params->count)) $block->params->count = $block->params->num;
|
||||
|
||||
$code = $block->code;
|
||||
if($code == 'statistic' or $code == 'list' or $code == 'overview') $code = $block->module . ucfirst($code);
|
||||
|
||||
$function = 'print' . ucfirst($code) . 'Block';
|
||||
if(method_exists('blockZen', $function)) $this->blockZen->$function($blockID);
|
||||
if(method_exists('blockZen', $function)) $this->blockZen->$function($block);
|
||||
|
||||
$params = $block->params;
|
||||
if(isset($params->num) and !isset($params->count)) $params->count = $params->num;
|
||||
if(!$this->selfCall)
|
||||
{
|
||||
$this->app->user = $this->dao->select('*')->from(TABLE_USER)->where('ranzhi')->eq($params->account)->fetch();
|
||||
$this->app->user = $this->dao->select('*')->from(TABLE_USER)->where('ranzhi')->eq($block->params->account)->fetch();
|
||||
if(empty($this->app->user))
|
||||
{
|
||||
$this->app->user = new stdclass();
|
||||
@@ -318,12 +318,12 @@ class block extends control
|
||||
$moreLink = '';
|
||||
if(isset($this->config->block->modules[$module]->moreLinkList->{$code}))
|
||||
{
|
||||
list($moduleName, $method, $vars) = explode('|', sprintf($this->config->block->modules[$module]->moreLinkList->{$code}, isset($params->type) ? $params->type : ''));
|
||||
list($moduleName, $method, $vars) = explode('|', sprintf($this->config->block->modules[$module]->moreLinkList->{$code}, isset($block->params->type) ? $block->params->type : ''));
|
||||
$this->view->moreLink = $this->createLink($moduleName, $method, $vars);
|
||||
}
|
||||
$this->view->moreLink = $moreLink;
|
||||
|
||||
$viewType = (isset($params->viewType) and $params->viewType == 'json') ? 'json' : 'html';
|
||||
$viewType = (isset($block->params->viewType) and $block->params->viewType == 'json') ? 'json' : 'html';
|
||||
if($viewType == 'json')
|
||||
{
|
||||
unset($this->view->app);
|
||||
|
||||
@@ -756,18 +756,16 @@ class blockZen extends block
|
||||
/**
|
||||
* Print product statistic block.
|
||||
*
|
||||
* @param object $block
|
||||
* @access public
|
||||
* @param string $storyType requirement|story
|
||||
* @return void
|
||||
*/
|
||||
public function printProductStatisticBlock($storyType = 'story')
|
||||
public function printProductStatisticBlock($block)
|
||||
{
|
||||
if(!empty($this->params->type) and preg_match('/[^a-zA-Z0-9_]/', $this->params->type)) return;
|
||||
$status = isset($block->params->type) ? $block->params->type : '';
|
||||
$count = isset($block->params->count) ? $block->params->count : '';
|
||||
|
||||
$status = isset($this->params->type) ? $this->params->type : '';
|
||||
$count = isset($this->params->count) ? $this->params->count : '';
|
||||
|
||||
$products = $this->loadModel('product')->getOrderedProducts($status, $count);
|
||||
$products = $this->loadModel('product')->getOrderedProducts($status, (int)$count);
|
||||
$productIdList = array_keys($products);
|
||||
|
||||
if(empty($products))
|
||||
@@ -780,7 +778,7 @@ class blockZen extends block
|
||||
$stories = $this->dao->select('product, stage, COUNT(status) AS count')->from(TABLE_STORY)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('product')->in($productIdList)
|
||||
->beginIF($storyType)->andWhere('type')->eq($storyType)->fi()
|
||||
->andWhere('type')->eq('story')
|
||||
->groupBy('product, stage')
|
||||
->fetchGroup('product', 'stage');
|
||||
|
||||
|
||||
@@ -432,7 +432,7 @@ class productModel extends model
|
||||
}
|
||||
else
|
||||
{
|
||||
$products = $this->getList('', $status, $num, 0, $shadow);
|
||||
$products = $this->getList(0, $status, $num, 0, $shadow);
|
||||
}
|
||||
|
||||
if(empty($products)) return $products;
|
||||
|
||||
@@ -52,20 +52,6 @@ class projectModel extends model
|
||||
return $this->app->user->admin || str_contains(",{$this->app->user->view->projects},", ",{$projectID},");
|
||||
}
|
||||
|
||||
/**
|
||||
* Show accessDenied response.
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
public function accessDenied()
|
||||
{
|
||||
if(defined('TUTORIAL')) return true;
|
||||
|
||||
$this->session->set('project', '');
|
||||
return print(js::alert($this->lang->project->accessDenied) . js::locate(helper::createLink('project', 'index')));
|
||||
}
|
||||
|
||||
/**
|
||||
* Judge an action is clickable or not.
|
||||
*
|
||||
@@ -123,7 +109,7 @@ class projectModel extends model
|
||||
}
|
||||
|
||||
$this->session->set('project', (int)key($projects), $this->app->tab);
|
||||
$this->accessDenied();
|
||||
print($this->projectTao->accessDenied());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -797,6 +797,19 @@ class projectTao extends projectModel
|
||||
->fetchAll('project');
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回请求被拒绝的跳转信息。
|
||||
* return accessDenied response.
|
||||
*
|
||||
* @access protected
|
||||
* @return string
|
||||
*/
|
||||
protected function accessDenied(): string
|
||||
{
|
||||
$this->session->set('project', '');
|
||||
return js::alert($this->lang->project->accessDenied) . js::locate(helper::createLink('project', 'index'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过项目ID获取Bug数量统计。
|
||||
* Get the number of bugs associated with the project.
|
||||
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
|
||||
su('admin');
|
||||
|
||||
$project = zdTable('project');
|
||||
$project->id->range('2-3');
|
||||
$project->type->range("project");
|
||||
$project->gen(2);
|
||||
|
||||
/**
|
||||
|
||||
title=测试 projectModel->accessDenied();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 执行$_SESSION['project'] @2
|
||||
|
||||
- 执行$_SESSION['project'] @0
|
||||
|
||||
*/
|
||||
|
||||
global $tester;
|
||||
$tester->loadModel('project');
|
||||
|
||||
$tester->project->saveState(2, array(2 => ''));
|
||||
r($_SESSION['project']) && p() && e('2');
|
||||
|
||||
$tester->project->accessDenied();
|
||||
r($_SESSION['project']) && p() && e('0');
|
||||
@@ -67,7 +67,6 @@ fields:
|
||||
note: "脚本创建日期"
|
||||
range: "(M)-(w)"
|
||||
type: timestamp
|
||||
prefix: "DateTime"
|
||||
postfix: ""
|
||||
format: "YY/MM/DD"
|
||||
- field: scriptStatus
|
||||
|
||||
@@ -57,7 +57,6 @@ fields:
|
||||
note: "创建日期"
|
||||
range: "(M)-(w)"
|
||||
type: timestamp
|
||||
prefix: "DateTime"
|
||||
postfix: ""
|
||||
format: "YY/MM/DD"
|
||||
- field: left
|
||||
|
||||
@@ -58,7 +58,6 @@ fields:
|
||||
note: "添加时间"
|
||||
range: "(M)-(w)"
|
||||
type: timestamp
|
||||
prefix: "DateTime"
|
||||
postfix: ""
|
||||
format: "YY/MM/DD"
|
||||
- field: downloads
|
||||
|
||||
@@ -114,7 +114,6 @@ fields:
|
||||
note: "创建日期"
|
||||
range: "(M)-(w)"
|
||||
type: timestamp
|
||||
prefix: "DateTime"
|
||||
postfix: ""
|
||||
format: "YY/MM/DD"
|
||||
- field: editedBy
|
||||
|
||||
@@ -163,10 +163,10 @@ class fields
|
||||
if(!empty($rule['range']) or $rule['range'] === '0') $ruleArr[$index]['range'] = $rule['range'];
|
||||
}
|
||||
|
||||
if(!empty($rule['prefix']) or $rule['range'] === '0') $ruleArr[$index]['prefix'] = $rule['prefix'];
|
||||
if(!empty($rule['postfix']) or $rule['range'] === '0') $ruleArr[$index]['postfix'] = $rule['postfix'];
|
||||
if(!empty($rule['type']) or $rule['range'] === '0') $ruleArr[$index]['type'] = $rule['type'];
|
||||
if(!empty($rule['format']) or $rule['range'] === '0') $ruleArr[$index]['format'] = $rule['format'];
|
||||
if(!empty($rule['prefix']) or $rule['prefix'] === '0') $ruleArr[$index]['prefix'] = $rule['prefix'];
|
||||
if(!empty($rule['postfix']) or $rule['postfix'] === '0') $ruleArr[$index]['postfix'] = $rule['postfix'];
|
||||
if(!empty($rule['type']) or $rule['type'] === '0') $ruleArr[$index]['type'] = $rule['type'];
|
||||
if(!empty($rule['format']) or $rule['format'] === '0') $ruleArr[$index]['format'] = $rule['format'];
|
||||
|
||||
$index ++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user