Merge branch 'mine_doc' into release/zentaopms_18.3

This commit is contained in:
caoyanyi
2023-04-06 10:49:31 +08:00
7 changed files with 62 additions and 12 deletions

View File

@@ -265,7 +265,7 @@ class feishuapi
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
if($_SERVER['HTTPS'] != 'on')
if(!isset($_SERVER['HTTPS']) or $_SERVER['HTTPS'] != 'on')
{
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

View File

@@ -506,7 +506,7 @@ class admin extends control
if(stripos($table, 'searchindex') !== false)
{
$mysqlVersion = $this->loadModel('install')->getMysqlVersion();
$mysqlVersion = $this->loadModel('install')->getDatabaseVersion();
if($mysqlVersion < 5.6) continue;
}

View File

@@ -79,6 +79,7 @@ class doc extends control
$browseType = strtolower($browseType);
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
$moduleID = ($browseType == 'bymodule') ? (int)$param : 0;
$libID = ($browseType == 'bylib') ? (int)$param : 0;
/* Set header and position. */
$this->view->title = $this->lang->doc->common;
@@ -103,13 +104,22 @@ class doc extends control
$this->app->rawMethod = 'recent';
}
$libs = $this->doc->getLibsByObject('mine', 0);
$libTree = $this->doc->getLibTree($libID, $libs, 'mine', 0);
$this->view->moduleID = $moduleID;
$this->view->docs = $this->doc->getDocsByBrowseType($browseType, $queryID, $moduleID, $sort, $pager);
$this->view->users = $this->user->getPairs('noletter');
$this->view->orderBy = $orderBy;
$this->view->browseType = $browseType;
$this->view->param = $param;
$this->view->libID = $libID;
$this->view->libTree = $libTree;
$this->view->pager = $pager;
$this->view->type = 'mine';
$this->view->objectID = 0;
$this->view->canExport = 0;
$this->view->libType = 'mine';
$this->display();
}
@@ -126,7 +136,7 @@ class doc extends control
{
if(!empty($_POST))
{
$libID = $this->doc->createlib();
$libID = $this->doc->createLib();
if(!dao::isError())
{
if($type == 'project' and $this->post->project) $objectID = $this->post->project;
@@ -167,21 +177,38 @@ class doc extends control
if($execution->type == 'stage') $this->lang->doc->execution = str_replace($this->lang->executionCommon, $this->lang->project->stage, $this->lang->doc->execution);
}
if($type == 'custom') unset($this->lang->doclib->aclList['default']);
if($type != 'custom')
$acl = 'default';
if($type == 'custom')
{
$acl = 'open';
unset($this->lang->doclib->aclList['default']);
}
elseif($type == 'mine')
{
$acl = 'private';
unset($this->lang->doclib->aclList['open']);
unset($this->lang->doclib->aclList['default']);
$this->lang->doclib->aclList = $this->lang->doclib->mySpaceAclList['private'];
}
if($type != 'custom' and $type != 'mine')
{
$this->lang->doclib->aclList['default'] = sprintf($this->lang->doclib->aclList['default'], $this->lang->{$type}->common);
$this->lang->doclib->aclList['private'] = sprintf($this->lang->doclib->privateACL, $this->lang->{$type}->common);
unset($this->lang->doclib->aclList['open']);
}
$this->app->loadLang('api');
$this->lang->api->aclList['default'] = sprintf($this->lang->api->aclList['default'], $this->lang->{$type}->common);
if($type != 'mine')
{
$this->app->loadLang('api');
$this->lang->api->aclList['default'] = sprintf($this->lang->api->aclList['default'], $this->lang->{$type}->common);
}
$this->view->groups = $this->loadModel('group')->getPairs();
$this->view->users = $this->user->getPairs('nocode|noclosed');
$this->view->objects = $objects;
$this->view->type = $type;
$this->view->acl = $acl;
$this->view->objectID = $objectID;
$this->display();
}

View File

@@ -1479,15 +1479,15 @@ class docModel extends model
*/
public function getLibsByObject($type, $objectID, $mode = '', $appendLib = 0)
{
if($type == 'custom' or $type == 'book')
if($type == 'custom' or $type == 'mine')
{
$objectLibs = $this->dao->select('*')->from(TABLE_DOCLIB)
->where('deleted')->eq(0)
->andWhere('vision')->eq($this->config->vision)
->andWhere('type')->eq($type)
->beginIF(!empty($appendLib))->orWhere('id')->eq($appendLib)->fi()
->beginIF($type == 'custom')->orderBy('`order` asc, id_asc')->fi()
->beginIF($type == 'book')->orderBy('`order` asc, id_asc')->fi()
->beginIF($type == 'mine')->orWhere('addedBy')->eq($this->app->user->account)->fi()
->orderBy('`order` asc, id_asc')
->fetchAll('id');
}
elseif($type != 'product' and $type != 'project' and $type != 'execution')

View File

@@ -16,7 +16,30 @@
<?php js::set('docLang', $lang->doc);?>
<?php js::set('confirmDelete', $lang->doc->confirmDelete)?>
<?php js::set('appTab', $app->tab)?>
<?php js::set('treeData', $libTree)?>
<div class="cell<?php if($browseType == 'bySearch') echo ' show';?>" id="queryBox" data-module=<?php echo $type . 'Doc';?>></div>
<div id="mainMenu" class="clearfix">
<div id="leftBar" class="btn-toolbar pull-left">
<?php if(!empty($libTree)):?>
<?php foreach($lang->doc->featureBar['tableContents'] as $barType => $barName):?>
<?php $active = $barType == $browseType ? 'btn-active-text' : '';?>
<?php $linkParams = $app->rawMethod == 'tablecontents' ? "type=$type&objectID=$objectID&libID=$libID&moduleID=$moduleID&browseType=$barType": "objectID=$objectID&libID=$libID&moduleID=$moduleID&browseType=$barType";?>
<?php echo html::a($this->createLink('doc', $app->rawMethod, $linkParams), $barName, '', "class='btn btn-link $active' id='{$barType}Tab'");?>
<?php endforeach;?>
<a class="btn btn-link querybox-toggle" id='bysearchTab'><i class="icon icon-search muted"></i> <?php echo $lang->doc->searchDoc;?></a>
<?php endif;?>
</div>
<div class="btn-toolbar pull-right">
<?php
if(common::hasPriv('doc', 'createLib'))
{
echo html::a(helper::createLink('doc', 'createLib', "type=mine"), '<i class="icon icon-plus"></i> ' . $this->lang->doc->createLib, '', 'class="btn btn-secondary iframe" data-width="800px"');
}
if($libID and common::hasPriv('doc', 'create')) echo $this->doc->printCreateBtn($lib, 'mine', 0, 0);
?>
</div>
</div>
<div id='mainContent'class="fade <?php if(!empty($libTree)) echo 'flex';?>">
<?php if(empty($libTree)):?>
<div class="table-empty-tip">

View File

@@ -60,7 +60,7 @@
<tr id="aclBox">
<th><?php echo $lang->doclib->control;?></th>
<td>
<?php echo html::radio('acl', $lang->doclib->aclList, $type == 'custom' ? 'open' : 'default', "onchange='toggleAcl(this.value, \"lib\")'", 'block')?>
<?php echo html::radio('acl', $lang->doclib->aclList, $acl, "onchange='toggleAcl(this.value, \"lib\")'", 'block')?>
</td>
</tr>
<tr id='whiteListBox' class='hidden'>

View File

@@ -2008,7 +2008,7 @@ class upgradeModel extends model
if(!file_exists($sqlFile)) return false;
$this->saveLogs('Run Method ' . __FUNCTION__);
$mysqlVersion = $this->loadModel('install')->getMysqlVersion();
$mysqlVersion = $this->loadModel('install')->getDatabaseVersion();
$ignoreCode = '|1050|1054|1060|1091|1061|';
/* Read the sql file to lines, remove the comment lines, then join theme by ';'. */