Merge branch '201_zhouxin_56467' into 'master'
201 zhouxin 56467 See merge request easycorp/zentaopms!3853
This commit is contained in:
+27
-25
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
global $lang;
|
||||
global $lang, $app;
|
||||
|
||||
$config->doc = new stdclass();
|
||||
$config->doc->createlib = new stdclass();
|
||||
@@ -35,28 +35,30 @@ $config->doc->iconList['word'] = 'word';
|
||||
$config->doc->iconList['ppt'] = 'ppt';
|
||||
$config->doc->iconList['excel'] = 'excel';
|
||||
|
||||
$config->doc->search['module'] = 'doc';
|
||||
$config->doc->search['fields']['title'] = $lang->doc->title;
|
||||
$config->doc->search['fields']['id'] = $lang->doc->id;
|
||||
$config->doc->search['fields']['product'] = $lang->doc->product;
|
||||
$config->doc->search['fields']['execution'] = $lang->doc->execution;
|
||||
$config->doc->search['fields']['lib'] = $lang->doc->lib;
|
||||
$config->doc->search['fields']['module'] = $lang->doc->module;
|
||||
$config->doc->search['fields']['keywords'] = $lang->doc->keywords;
|
||||
$config->doc->search['fields']['addedBy'] = $lang->doc->addedBy;
|
||||
$config->doc->search['fields']['addedDate'] = $lang->doc->addedDate;
|
||||
$config->doc->search['fields']['editedBy'] = $lang->doc->editedBy;
|
||||
$config->doc->search['fields']['editedDate'] = $lang->doc->editedDate;
|
||||
$config->doc->search['fields']['version'] = $lang->doc->version;
|
||||
$config->doc->search['module'] = 'doc';
|
||||
$config->doc->search['fields']['title'] = $lang->doc->title;
|
||||
$config->doc->search['fields']['id'] = $lang->doc->id;
|
||||
$config->doc->search['fields']['product'] = $lang->doc->product;
|
||||
if($app->rawMethod == 'contribute') $config->doc->search['fields']['project'] = $lang->doc->project;
|
||||
$config->doc->search['fields']['execution'] = $lang->doc->execution;
|
||||
$config->doc->search['fields']['lib'] = $lang->doc->lib;
|
||||
$config->doc->search['fields']['module'] = $lang->doc->module;
|
||||
$config->doc->search['fields']['keywords'] = $lang->doc->keywords;
|
||||
$config->doc->search['fields']['addedBy'] = $lang->doc->addedBy;
|
||||
$config->doc->search['fields']['addedDate'] = $lang->doc->addedDate;
|
||||
$config->doc->search['fields']['editedBy'] = $lang->doc->editedBy;
|
||||
$config->doc->search['fields']['editedDate'] = $lang->doc->editedDate;
|
||||
$config->doc->search['fields']['version'] = $lang->doc->version;
|
||||
|
||||
$config->doc->search['params']['title'] = array('operator' => 'include', 'control' => 'input', 'values' => '');
|
||||
$config->doc->search['params']['keywords'] = array('operator' => 'include', 'control' => 'input', 'values' => '');
|
||||
$config->doc->search['params']['product'] = array('operator' => '=', 'control' => 'select', 'values' => '');
|
||||
$config->doc->search['params']['module'] = array('operator' => 'belong', 'control' => 'select', 'values' => '');
|
||||
$config->doc->search['params']['execution'] = array('operator' => '=', 'control' => 'select', 'values' => '');
|
||||
$config->doc->search['params']['lib'] = array('operator' => '=', 'control' => 'select', 'values' => '' );
|
||||
$config->doc->search['params']['addedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
|
||||
$config->doc->search['params']['addedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
|
||||
$config->doc->search['params']['editedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
|
||||
$config->doc->search['params']['editedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
|
||||
$config->doc->search['params']['version'] = array('operator' => '=', 'control' => 'input', 'values' => '');
|
||||
$config->doc->search['params']['title'] = array('operator' => 'include', 'control' => 'input', 'values' => '');
|
||||
$config->doc->search['params']['keywords'] = array('operator' => 'include', 'control' => 'input', 'values' => '');
|
||||
$config->doc->search['params']['product'] = array('operator' => '=', 'control' => 'select', 'values' => '');
|
||||
$config->doc->search['params']['module'] = array('operator' => 'belong', 'control' => 'select', 'values' => '');
|
||||
if($app->rawMethod == 'contribute') $config->doc->search['params']['project'] = array('operator' => '=', 'control' => 'select', 'values' => '');
|
||||
$config->doc->search['params']['execution'] = array('operator' => '=', 'control' => 'select', 'values' => '');
|
||||
$config->doc->search['params']['lib'] = array('operator' => '=', 'control' => 'select', 'values' => '' );
|
||||
$config->doc->search['params']['addedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
|
||||
$config->doc->search['params']['addedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
|
||||
$config->doc->search['params']['editedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
|
||||
$config->doc->search['params']['editedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
|
||||
$config->doc->search['params']['version'] = array('operator' => '=', 'control' => 'input', 'values' => '');
|
||||
|
||||
@@ -156,6 +156,7 @@ global $config;
|
||||
/* Query condition list. */
|
||||
$lang->doc->allProduct = 'All' . $lang->productCommon . 's';
|
||||
$lang->doc->allExecutions = 'All' . $lang->executionCommon . 's';
|
||||
$lang->doc->allProjects = 'All' . $lang->projectCommon . 's';
|
||||
|
||||
$lang->doc->libTypeList['product'] = $lang->productCommon . ' Library';
|
||||
if($config->systemMode == 'new') $lang->doc->libTypeList['project'] = 'Project Library';
|
||||
|
||||
@@ -156,6 +156,7 @@ global $config;
|
||||
/* 查询条件列表 */
|
||||
$lang->doc->allProduct = '所有' . $lang->productCommon;
|
||||
$lang->doc->allExecutions = '所有' . $lang->executionCommon;
|
||||
$lang->doc->allProjects = '所有' . $lang->projectCommon;
|
||||
|
||||
$lang->doc->libTypeList['product'] = $lang->productCommon . '文档库';
|
||||
if($config->systemMode == 'new') $lang->doc->libTypeList['project'] = '项目文档库';
|
||||
|
||||
+105
-4
@@ -337,6 +337,44 @@ class docModel extends model
|
||||
{
|
||||
$docs = $this->getDocs(0, 0, $sort, $pager);
|
||||
}
|
||||
elseif($browseType == 'bySearch')
|
||||
{
|
||||
if($queryID)
|
||||
{
|
||||
$query = $this->loadModel('search')->getQuery($queryID);
|
||||
if($query)
|
||||
{
|
||||
$this->session->set('contributeDocQuery', $query->sql);
|
||||
$this->session->set('contributeDocForm', $query->form);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set('contributeDocQuery', ' 1 = 1');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($this->session->contributeDocQuery == false) $this->session->set('contributeDocQuery', ' 1 = 1');
|
||||
}
|
||||
|
||||
$query = $this->getDocQuery($this->session->contributeDocQuery);
|
||||
$docIDList = $this->dao->select('objectID')->from(TABLE_ACTION)
|
||||
->where('objectType')->eq('doc')
|
||||
->andWhere('actor')->eq($this->app->user->account)
|
||||
->andWhere('action')->eq('edited')
|
||||
->fetchAll('objectID');
|
||||
$docs = $this->dao->select('*')->from(TABLE_DOC)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere($query)
|
||||
->andWhere('lib')->in($allLibs)
|
||||
->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi()
|
||||
->andWhere('addedBy', 1)->eq($this->app->user->account)
|
||||
->orWhere('id')->in(array_keys($docIDList))
|
||||
->markRight(1)
|
||||
->orderBy($sort)
|
||||
->page($pager)
|
||||
->fetchAll('id');
|
||||
}
|
||||
elseif($browseType == "openedbyme")
|
||||
{
|
||||
$docs = $this->dao->select('*')->from(TABLE_DOC)
|
||||
@@ -443,6 +481,51 @@ class docModel extends model
|
||||
return $docs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace all in query.
|
||||
*
|
||||
* @param string $query
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getDocQuery($query)
|
||||
{
|
||||
$allLibs = "`lib` = 'all'";
|
||||
if(strpos($query, $allLibs) !== false)
|
||||
{
|
||||
$libs = $this->loadModel('doc')->getLibs('all', 'withObject');
|
||||
$query = str_replace($allLibs, '1', $query);
|
||||
$query = $query . ' AND `lib` ' . helper::dbIN($libs);
|
||||
}
|
||||
|
||||
$allProject = "`project` = 'all'";
|
||||
if(strpos($query, $allProject) !== false)
|
||||
{
|
||||
$projectIDList = $this->loadModel('bug')->getAllProjectIds();
|
||||
if(is_array($projectIDList)) $projectIDList = implode(',', $projectIDList);
|
||||
$query = str_replace($allProject, '1', $query);
|
||||
$query = $query . ' AND `project` in (' . $projectIDList . ')';
|
||||
}
|
||||
|
||||
$allProduct = "`product` = 'all'";
|
||||
if(strpos($query, $allProduct) !== false)
|
||||
{
|
||||
$products = $this->app->user->view->products;
|
||||
$query = str_replace($allProduct, '1', $query);
|
||||
$query = $query . ' AND `product` ' . helper::dbIN($products);
|
||||
}
|
||||
|
||||
$allExecutions = "`execution` = 'all'";
|
||||
if(strpos($query, $allExecutions) !== false)
|
||||
{
|
||||
$executions = $this->loadModel('execution')->getPairs();
|
||||
$query = str_replace($allExecutions, '1', $query);
|
||||
$query = $query . ' AND `execution` ' . helper::dbIN(array_keys($executions));
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get projects, executions and products by docIdList.
|
||||
*
|
||||
@@ -838,17 +921,35 @@ class docModel extends model
|
||||
*/
|
||||
public function buildSearchForm($libID, $libs, $queryID, $actionURL, $type)
|
||||
{
|
||||
$this->loadModel('product');
|
||||
|
||||
if($this->app->rawMethod == 'contribute')
|
||||
{
|
||||
$this->config->doc->search['module'] = 'contributeDoc';
|
||||
$products = $this->product->getPairs();
|
||||
$this->config->doc->search['params']['project']['values'] = array('' => '') + $this->loadModel('project')->getPairsByProgram() + array('all' => $this->lang->doc->allProjects);
|
||||
$this->config->doc->search['params']['execution']['values'] = array('' => '') + $this->loadModel('execution')->getPairs() + array('all' => $this->lang->doc->allExecutions);
|
||||
$this->config->doc->search['params']['lib']['values'] = array('' => '') + $this->loadModel('doc')->getLibs('all', 'withObject') + array('all' => $this->lang->doclib->all);
|
||||
|
||||
unset($this->config->doc->search['fields']['module']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$products = $this->product->getPairs('nocode', $this->session->project);
|
||||
$this->config->doc->search['params']['execution']['values'] = array('' => '') + $this->loadModel('execution')->getPairs($this->session->project, 'all', 'noclosed') + array('all' => $this->lang->doc->allExecutions);
|
||||
$this->config->doc->search['params']['lib']['values'] = array('' => '', $libID => ($libID ? $libs[$libID] : 0), 'all' => $this->lang->doclib->all);
|
||||
}
|
||||
|
||||
|
||||
$this->config->doc->search['actionURL'] = $actionURL;
|
||||
$this->config->doc->search['queryID'] = $queryID;
|
||||
$this->config->doc->search['params']['product']['values'] = array('' => '') + $this->loadModel('product')->getPairs('nocode', $this->session->project) + array('all' => $this->lang->doc->allProduct);
|
||||
$this->config->doc->search['params']['execution']['values'] = array('' => '') + $this->loadModel('execution')->getPairs($this->session->project, 'all', 'noclosed') + array('all' => $this->lang->doc->allExecutions);
|
||||
$this->config->doc->search['params']['lib']['values'] = array('' => '', $libID => ($libID ? $libs[$libID] : 0), 'all' => $this->lang->doclib->all);
|
||||
$this->config->doc->search['params']['product']['values'] = array('' => '') + $products + array('all' => $this->lang->doc->allProduct);
|
||||
|
||||
/* Get the modules. */
|
||||
$moduleOptionMenu = $this->loadModel('tree')->getOptionMenu($libID, 'doc', $startModuleID = 0);
|
||||
$this->config->doc->search['params']['module']['values'] = $moduleOptionMenu;
|
||||
|
||||
if($type == 'index' || $type == 'objectLibs' || $libID == 0)
|
||||
if($type == 'index' || $type == 'objectLibs' || ($this->app->rawMethod != 'contribute' and $libID == 0))
|
||||
{
|
||||
unset($this->config->doc->search['fields']['module']);
|
||||
unset($this->config->doc->search['fields']['lib']);
|
||||
|
||||
+20
-3
@@ -678,12 +678,26 @@ EOF;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function doc($type = 'openedbyme', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
/**
|
||||
* doc page of my.
|
||||
*
|
||||
* @param string $type
|
||||
* @param int $param
|
||||
* @param string $orderBy
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function doc($type = 'openedbyme', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
{
|
||||
/* Save session, load lang. */
|
||||
$uri = $this->app->getURI(true);
|
||||
if($this->app->viewType != 'json') $this->session->set('docList', $uri, 'doc');
|
||||
$this->loadModel('doc');
|
||||
if($this->app->viewType != 'json') $this->session->set('docList', $uri, 'doc');
|
||||
|
||||
$queryID = ($type == 'bySearch') ? (int)$param : 0;
|
||||
|
||||
$this->session->set('productList', $uri, 'product');
|
||||
$this->session->set('executionList', $uri, 'execution');
|
||||
@@ -696,7 +710,10 @@ EOF;
|
||||
/* Append id for secend sort. */
|
||||
$sort = common::appendOrder($orderBy);
|
||||
|
||||
$docs = $this->doc->getDocsByBrowseType($type, 0, 0, $sort, $pager);
|
||||
$docs = $this->doc->getDocsByBrowseType($type, $queryID, 0, $sort, $pager);
|
||||
|
||||
$actionURL = $this->createLink('my', $this->app->rawMethod, "mode=doc&browseType=bySearch&queryID=myQueryID");
|
||||
$this->loadModel('doc')->buildSearchForm(0, array(), $queryID, $actionURL, 'contribute');
|
||||
|
||||
/* Assign. */
|
||||
$this->view->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->doc;
|
||||
|
||||
@@ -20,16 +20,19 @@
|
||||
echo html::a(inlink($app->rawMethod, "mode=doc&type=editedbyme"), "<span class='text'>{$lang->doc->editedByMe}</span>" . ($type == 'editedbyme' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'editedbyme' ? ' btn-active-text' : '') . "'");
|
||||
?>
|
||||
</div>
|
||||
<a class="btn btn-link querybox-toggle" id='bysearchTab'><i class="icon icon-search muted"></i> <?php echo $lang->my->byQuery;?></a>
|
||||
</div>
|
||||
<div id="mainContent" class='main-table'>
|
||||
<div id="mainContent">
|
||||
<?php if(empty($docs)):?>
|
||||
<div class="cell<?php if($type == 'bySearch') echo ' show';?>" id="queryBox" data-module=<?php echo 'contributeDoc';?>></div>
|
||||
<div class="table-empty-tip">
|
||||
<p>
|
||||
<span class="text-muted"><?php echo $lang->doc->noDoc;?></span>
|
||||
</p>
|
||||
</div>
|
||||
<?php else:?>
|
||||
<form id='projectForm' method='post' data-ride='table' data-checkable='false'>
|
||||
<div class="cell<?php if($type == 'bySearch') echo ' show';?>" id="queryBox" data-module=<?php echo 'contributeDoc';?>></div>
|
||||
<form id='projectForm' class="main-table" method='post' data-ride='table' data-checkable='false'>
|
||||
<table class='table table-fixed' id='docList'>
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -37,13 +37,12 @@
|
||||
</div>
|
||||
<div id="mainContent">
|
||||
<?php $dataModule = $app->rawMethod == 'work' ? 'workTask' : 'contributeTask';?>
|
||||
<div class="cell<?php if($type == 'bySearch') echo ' show';?>" id="queryBox" data-module=<?php echo $dataModule;?>></div>
|
||||
<?php if(empty($tasks)):?>
|
||||
<div class="cell<?php if($type == 'bySearch') echo ' show';?>" id="queryBox" data-module=<?php echo $dataModule;?>></div>
|
||||
<div class="table-empty-tip">
|
||||
<p><span class="text-muted"><?php echo $lang->task->noTask;?></span></p>
|
||||
</div>
|
||||
<?php else:?>
|
||||
<div class="cell<?php if($type == 'bySearch') echo ' show';?>" id="queryBox" data-module=<?php echo $dataModule;?>></div>
|
||||
<form id='myTaskForm' class="main-table table-task skip-iframe-modal" method="post">
|
||||
<?php $canBatchEdit = (common::hasPriv('task', 'batchEdit') and $type == 'assignedTo');?>
|
||||
<?php $canBatchClose = (common::hasPriv('task', 'batchClose') and $type != 'closedBy');?>
|
||||
|
||||
Reference in New Issue
Block a user