* code for task #44321.

This commit is contained in:
王怡栋
2021-11-18 11:20:39 +08:00
parent fc50ece3e2
commit 3510f6ef63
7 changed files with 93 additions and 10 deletions
+42
View File
@@ -0,0 +1,42 @@
<?php
/**
* The doclibs entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class doclibsEntry extends Entry
{
/**
* GET method.
*
* @access public
* @return void
*/
public function get()
{
$type = $this->param('type', 0);
$objectID = $this->param('objectID', 0);
$libs = $this->loadModel('doc')->getLibs($type, $this->param('extra', ''), $this->param('appendLibs', ''), $objectID);
$result = array();
foreach($libs as $libID => $libName)
{
$lib = new stdclass();
$lib->id = $libID;
$lib->name = $libName;
$result[] = $lib;
}
$lib = new stdclass();
$lib->id = 'files';
$lib->name = $this->lang->doclib->files;
$result[] = $lib;
return $this->send(200, array('libs' => array_values($result)));
}
}
+38
View File
@@ -0,0 +1,38 @@
<?php
/**
* The docs entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class docsEntry extends Entry
{
/**
* GET method.
*
* @access public
* @return void
*/
public function get($libID = 0)
{
if(empty($libID)) $libID = $this->param('lib', 0);
if(empty($libID)) return $this->sendError(400, 'Need lib id.');
$docTree = $this->loadModel('doc')->getDocTree($libID);
foreach($docTree as $i => $module)
{
if(empty($module->id))
{
unset($docTree[$i]);
foreach($module->children as $doc) $docTree[] = $doc;
}
}
return $this->send(200, array_values($docTree));
}
}
+5
View File
@@ -97,6 +97,11 @@ $routes['/risks/:id'] = 'risk';
$routes['/departments'] = 'departments';
$routes['/departments/:id'] = 'department';
$routes['/doclibs'] = 'doclibs';
$routes['/doclibs/:id'] = 'docs';
$routes['/docs'] = 'docs';
$routes['/docs/:id'] = 'doc';
$routes['/reports'] = 'reports';
$routes['/z/folders'] = 'zfolders';
+1 -1
View File
@@ -1511,7 +1511,7 @@ class bugModel extends model
->beginIF(!empty($productID))->andWhere('product')->eq($productID)->fi()
->beginIF($type == 'unresolved')->andWhere('status')->eq('active')->fi()
->beginIF($type == 'noclosed')->andWhere('status')->ne('closed')->fi()
->beginIF($type == 'assigntome')->andWhere('assignedTo')->eq($this->app->user->account)->fi()
->beginIF($type == 'assignedtome')->andWhere('assignedTo')->eq($this->app->user->account)->fi()
->beginIF($type == 'openedbyme')->andWhere('openedBy')->eq($this->app->user->account)->fi()
->beginIF($build)->andWhere("CONCAT(',', openedBuild, ',') like '%,$build,%'")->fi()
->beginIF($excludeBugs)->andWhere('id')->notIN($excludeBugs)->fi()
+2 -2
View File
@@ -52,7 +52,7 @@ $uid = uniqid('');
cssData: 'html,body {background: none}.article-content{overflow:visible}.article-content, .article-content table td, .article-content table th {line-height: 1.3846153846; font-size: 13px;}.article-content .table-auto {width: auto!important; max-width: 100%;}',
placeholder: <?php echo json_encode($lang->noticePasteImg);?>,
placeholderStyle: {fontSize: '13px', color: '#888'},
pasteImage: {postUrl: createLink('file', 'ajaxPasteImage', 'uid=' + kuid)},
pasteImage: {postUrl: createLink('file', 'ajaxPasteImg', 'uid=' + kuid)},
syncAfterBlur: true,
allowFileManager: false,
spellcheck: false
@@ -90,7 +90,7 @@ $uid = uniqid('');
{
items: editorTool,
placeholder: $editor.attr('placeholder') || options.placeholder || '',
pasteImage: {postUrl: createLink('file', 'ajaxPasteImage', 'uid=' + kuid), placeholder: $editor.attr('placeholder') || <?php echo json_encode($lang->noticePasteImg);?>},
pasteImage: {postUrl: createLink('file', 'ajaxPasteImg', 'uid=' + kuid), placeholder: $editor.attr('placeholder') || <?php echo json_encode($lang->noticePasteImg);?>},
});
try
+4 -6
View File
@@ -80,6 +80,7 @@ class docModel extends model
->where('deleted')->eq(0)
->beginIF($type)->andWhere('type')->eq($type)->fi()
->beginIF(!$type)->andWhere('type')->ne('api')->fi()
->beginIF($objectID and strpos(',product,project,execution,', ",$type,"))->andWhere($type)->eq($objectID)->fi()
->orderBy('`order`, id desc')->query();
}
@@ -88,7 +89,7 @@ class docModel extends model
$executions = $this->loadModel('execution')->getPairs();
$libPairs = array();
while ($lib = $stmt->fetch())
while($lib = $stmt->fetch())
{
if($lib->product != 0 and !isset($products[$lib->product])) continue;
if($lib->execution != 0 and !isset($executions[$lib->execution])) continue;
@@ -110,7 +111,7 @@ class docModel extends model
if(!empty($appendLibs))
{
$stmt = $this->dao->select('*')->from(TABLE_DOCLIB)->where('id')->in($appendLibs)->orderBy('`order`, id desc')->query();
while ($lib = $stmt->fetch())
while($lib = $stmt->fetch())
{
if(!isset($libPairs[$lib->id]) and $this->checkPrivLib($lib, $extra)) $libPairs[$lib->id] = $lib->name;
}
@@ -1623,10 +1624,7 @@ class docModel extends model
static $docGroups;
if(empty($docGroups))
{
$docs = $this->dao->select('*')->from(TABLE_DOC)
->where('lib')->eq((int)$libID)
->andWhere('deleted')->eq(0)
->fetchAll();
$docs = $this->dao->select('*')->from(TABLE_DOC)->where('lib')->eq((int)$libID)->andWhere('deleted')->eq(0)->fetchAll();
$docGroups = array();
foreach($docs as $doc)
{
+1 -1
View File
@@ -333,7 +333,7 @@ class file extends control
* @access public
* @return void
*/
public function ajaxPasteImage($uid = '')
public function ajaxPasteImg($uid = '')
{
if($_POST) die($this->file->pasteImage($this->post->editor, $uid));
}