* Finish task #56467.

This commit is contained in:
zhouxin
2022-06-10 01:22:12 +00:00
parent 4e40722b6d
commit ee8af517fa
6 changed files with 76 additions and 9 deletions
+58 -4
View File
@@ -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->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)
@@ -838,17 +876,33 @@ 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);
}
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']);