Merge branch 'tsj_fixbug' into 'master'
* Fix bug. See merge request easycorp/zentaopms!7382
This commit is contained in:
@@ -160,6 +160,12 @@ SELECT t1.`group`, 'api', 'editCatalog' FROM `zt_grouppriv` AS t1 WHERE t1.`modu
|
||||
INSERT IGNORE INTO `zt_grouppriv` (`group`, `module`, `method`)
|
||||
SELECT t1.`group`, 'api', 'deleteCatalog' FROM `zt_grouppriv` AS t1 WHERE t1.`module` = 'doc' AND t1.`method` = 'catalog';
|
||||
|
||||
INSERT IGNORE INTO `zt_grouppriv` (`group`, `module`, `method`)
|
||||
SELECT t1.`group`, 'doc', 'create' FROM `zt_grouppriv` AS t1 WHERE t1.`module` = 'doc' AND t1.`method` = 'manageBook';
|
||||
|
||||
INSERT IGNORE INTO `zt_grouppriv` (`group`, `module`, `method`)
|
||||
SELECT t1.`group`, 'doc', 'custom2export' FROM `zt_grouppriv` AS t1 WHERE t1.`module` = 'doc' AND t1.`method` = 'wiki2export';
|
||||
|
||||
UPDATE `zt_grouppriv` SET `method` = 'mySpace' WHERE `module` = 'doc' AND `method` = 'browse';
|
||||
|
||||
ALTER TABLE `zt_account`
|
||||
|
||||
@@ -1306,7 +1306,7 @@ class actionModel extends model
|
||||
|
||||
$shadowProducts = $this->dao->select('id')->from(TABLE_PRODUCT)->where('shadow')->eq(1)->fetchPairs();
|
||||
$projectMultiples = $this->dao->select('id,type,multiple')->from(TABLE_PROJECT)->where('id')->in($projectIdList)->fetchAll('id');
|
||||
$docList = $this->loadModel('doc')->getPrivDocs();
|
||||
$docList = $this->loadModel('doc')->getPrivDocs('', 0, 'all');
|
||||
$apiList = $this->loadModel('api')->getPrivApis();
|
||||
$docLibList = $this->doc->getLibs('hasApi');
|
||||
|
||||
|
||||
+14
-2
@@ -1035,14 +1035,26 @@ class apiModel extends model
|
||||
/**
|
||||
* Get priv Apis..
|
||||
*
|
||||
* @param string $mode all
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getPrivApis()
|
||||
public function getPrivApis($mode = '')
|
||||
{
|
||||
$libs = $this->loadModel('doc')->getLibs('api');
|
||||
$libs = $this->dao->select('*')->from(TABLE_DOCLIB)
|
||||
->where('type')->eq('api')
|
||||
->andWhere('vision')->eq($this->config->vision)
|
||||
->fetchAll('id');
|
||||
|
||||
$this->loadModel('doc');
|
||||
foreach($libs as $libID => $lib)
|
||||
{
|
||||
if(!$this->doc->checkPrivLib($lib)) unset($libs[$libID]);
|
||||
}
|
||||
|
||||
return $this->dao->select('id')->from(TABLE_API)
|
||||
->where('lib')->in(array_keys($libs))
|
||||
->beginIF($mode != 'all')->andWhere('deleted')->eq(0)->fi()
|
||||
->fetchAll('id');
|
||||
}
|
||||
}
|
||||
|
||||
+18
-20
@@ -75,13 +75,13 @@ class docModel extends model
|
||||
*/
|
||||
public function getLibs($type = '', $extra = '', $appendLibs = '', $objectID = 0, $excludeType = '')
|
||||
{
|
||||
if($type == 'all' or $type == 'includeDeleted')
|
||||
if(in_array($type, array('all', 'includeDeleted', 'hasApi')))
|
||||
{
|
||||
$stmt = $this->dao->select('*')->from(TABLE_DOCLIB)
|
||||
->where('type')->ne('api')
|
||||
->where('vision')->eq($this->config->vision)
|
||||
->beginIF($type == 'all')->andWhere('deleted')->eq(0)->fi()
|
||||
->beginIF($type != 'hasApi')->andWhere('type')->ne('api')->fi()
|
||||
->beginIF($excludeType)->andWhere('type')->notin($excludeType)->fi()
|
||||
->andWhere('vision')->eq($this->config->vision)
|
||||
->orderBy('id_asc')
|
||||
->query();
|
||||
}
|
||||
@@ -90,7 +90,7 @@ class docModel extends model
|
||||
$stmt = $this->dao->select('*')->from(TABLE_DOCLIB)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('vision')->eq($this->config->vision)
|
||||
->beginIF($type != 'hasApi')->andWhere('type')->eq($type)->fi()
|
||||
->beginIF($type)->andWhere('type')->eq($type)->fi()
|
||||
->beginIF(!$type)->andWhere('type')->ne('api')->fi()
|
||||
->beginIF($objectID and strpos(',product,project,execution,', ",$type,") !== false)->andWhere($type)->eq($objectID)->fi()
|
||||
->orderBy('id_asc')
|
||||
@@ -1263,6 +1263,8 @@ class docModel extends model
|
||||
*/
|
||||
public function checkPrivLib($object, $extra = '')
|
||||
{
|
||||
if(empty($object)) return false;
|
||||
|
||||
if($this->app->user->admin and $object->type != 'mine') return true;
|
||||
|
||||
if($object->acl == 'open') return true;
|
||||
@@ -1322,18 +1324,11 @@ class docModel extends model
|
||||
{
|
||||
if(!isset($object->lib)) return false;
|
||||
|
||||
$libType = $this->dao->select('type')->from(TABLE_DOCLIB)->where('id')->eq($object->lib)->fetch('type');
|
||||
if($this->app->user->admin and $libType != 'mine') return true;
|
||||
$lib = $this->getLibById($object->lib);
|
||||
if($this->app->user->admin and !empty($lib) and $lib->type != 'mine') return true;
|
||||
|
||||
static $extraDocLibs;
|
||||
if($extraDocLibs === null) $extraDocLibs = $this->getPrivLibsByDoc();
|
||||
|
||||
static $libs;
|
||||
if($libs === null) $libs = $this->getLibs('all');
|
||||
if(isset($libs[$object->lib]) and isset($extraDocLibs[$object->lib])) unset($extraDocLibs[$object->lib]);
|
||||
|
||||
if($object->acl == 'open' and !isset($extraDocLibs[$object->lib])) return true;
|
||||
if($object->acl == 'public' and !isset($extraDocLibs[$object->lib])) return true;
|
||||
if(!$this->checkPrivLib($lib)) return false;
|
||||
if(in_array($object->acl, array('open', 'public'))) return true;
|
||||
|
||||
$account = ",{$this->app->user->account},";
|
||||
if(isset($object->addedBy) and $object->addedBy == $this->app->user->account) return true;
|
||||
@@ -3088,15 +3083,18 @@ class docModel extends model
|
||||
if($type != 'project') $libTree = array_values($libTree[$type]);
|
||||
if($type == 'mine')
|
||||
{
|
||||
$libType = zget($this->app->rawParams, 'type', '');
|
||||
$libType = strtolower($libType);
|
||||
|
||||
$myLib = new stdclass();
|
||||
$myLib->id = 0;
|
||||
$myLib->name = $this->lang->doc->myLib;
|
||||
$myLib->type = 'min';
|
||||
$myLib->type = 'mine';
|
||||
$myLib->objectType = 'doc';
|
||||
$myLib->objectID = 0;
|
||||
$myLib->active = 0;
|
||||
$myLib->hasAction = false;
|
||||
$myLib->active = zget($this->app->rawParams, 'type', '') == 'mine' ? 1 : 0;
|
||||
$myLib->active = $libType == 'mine' ? 1 : 0;
|
||||
$myLib->children = $libTree;
|
||||
|
||||
$myView = new stdclass();
|
||||
@@ -3106,7 +3104,7 @@ class docModel extends model
|
||||
$myView->objectType = 'doc';
|
||||
$myView->objectID = 0;
|
||||
$myView->hasAction = false;
|
||||
$myView->active = zget($this->app->rawParams, 'type', '') == 'view' ? 1 : 0;
|
||||
$myView->active = $libType == 'view' ? 1 : 0;
|
||||
|
||||
$myCollection = new stdclass();
|
||||
$myCollection->id = 0;
|
||||
@@ -3115,7 +3113,7 @@ class docModel extends model
|
||||
$myCollection->objectType = 'doc';
|
||||
$myCollection->objectID = 0;
|
||||
$myCollection->hasAction = false;
|
||||
$myCollection->active = zget($this->app->rawParams, 'type', '') == 'collect' ? 1 : 0;
|
||||
$myCollection->active = $libType == 'collect' ? 1 : 0;
|
||||
|
||||
$myCreation = new stdclass();
|
||||
$myCreation->id = 0;
|
||||
@@ -3124,7 +3122,7 @@ class docModel extends model
|
||||
$myCreation->objectType = 'doc';
|
||||
$myCreation->objectID = 0;
|
||||
$myCreation->hasAction = false;
|
||||
$myCreation->active = zget($this->app->rawParams, 'type', '') == 'createdby' ? 1 : 0;
|
||||
$myCreation->active = $libType == 'createdby' ? 1 : 0;
|
||||
|
||||
$libTree = array();
|
||||
$libTree[] = $myLib;
|
||||
|
||||
@@ -69,6 +69,7 @@ html[lang^='zh-'] .operatorWidth {width: 90px !important;}
|
||||
#save-query {float: unset !important; position: absolute; right: 50px;}
|
||||
#save-query .text {top: 0px;}
|
||||
#save-query .text:after {border-bottom: 0px solid #0c64eb;}
|
||||
#<?php echo $formId;?> [id^='valueBox'] > div.picker span.picker-selection-text {padding-right: 10px;}
|
||||
</style>
|
||||
<?php if($style != 'simple'):?>
|
||||
<div id='toggle-queries'>
|
||||
@@ -131,7 +132,7 @@ foreach($fieldParams as $fieldName => $param)
|
||||
/* Print value. */
|
||||
echo "<td id='valueBox$fieldNO' style='overflow:visible'>";
|
||||
if(isset($config->moreLinks["field{$currentField}"])) $config->moreLinks["value$fieldNO"] = $config->moreLinks["field{$currentField}"];
|
||||
if($param['control'] == 'select') echo html::select("value$fieldNO", $param['values'], $formSession["value$fieldNO"], "class='form-control searchSelect chosen' max_drop_width='400'");
|
||||
if($param['control'] == 'select') echo html::select("value$fieldNO", $param['values'], $formSession["value$fieldNO"], "class='form-control searchSelect chosen' data-max_drop_width='0'");
|
||||
if($param['control'] == 'input')
|
||||
{
|
||||
$fieldName = $formSession["field$fieldNO"];
|
||||
@@ -199,7 +200,7 @@ foreach($fieldParams as $fieldName => $param)
|
||||
$selected = $formSession["value$fieldNO"];
|
||||
if(!isset($param['values'][$selected])) $config->moreLinks["value$fieldNO"] = $config->moreLinks["field{$currentField}"];
|
||||
}
|
||||
if($param['control'] == 'select') echo html::select("value$fieldNO", $param['values'], $formSession["value$fieldNO"], "class='form-control searchSelect chosen'");
|
||||
if($param['control'] == 'select') echo html::select("value$fieldNO", $param['values'], $formSession["value$fieldNO"], "class='form-control searchSelect chosen' data-max_drop_width='0'");
|
||||
|
||||
if($param['control'] == 'input')
|
||||
{
|
||||
@@ -217,7 +218,7 @@ foreach($fieldParams as $fieldName => $param)
|
||||
$placeholder = "placeholder='{$lang->search->queryTips}'";;
|
||||
}
|
||||
|
||||
echo html::input("value$fieldNO", $fieldValue, "class='form-control $extraClass searchInput' $placeholder");
|
||||
echo html::input("value$fieldNO", $fieldValue, "class='form-control $extraClass searchInput' $placeholder data-max_drop_width='0'");
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
@@ -515,9 +516,7 @@ $(function()
|
||||
$searchForm.find("#value" + fieldNO).picker(
|
||||
{
|
||||
chosenMode: true,
|
||||
dropWidth: 'auto',
|
||||
minAutoDropWidth: '100%',
|
||||
maxAutoDropWidth: 350
|
||||
dropWidth: '100%'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user