Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2022-05-10 18:33:41 +02:00
commit dfedd201dd
4 changed files with 86 additions and 49 deletions

View File

@ -226,6 +226,8 @@
Changes in version 5.1.26
--------------------------------------------------------------------------------
- add hook additionalDocumentContentInfo
- add restapi function 'statstotal'
- custom attributes of type 'date' regard the date format
--------------------------------------------------------------------------------
Changes in version 5.1.25

View File

@ -4153,6 +4153,24 @@ class SeedDMS_Core_DMS {
$res['total'] = $sum;
}
return $resArr;
case 'docstotal':
$queryStr = "SELECT count(*) AS total FROM `tblDocuments`";
$resArr = $this->db->getResultArray($queryStr);
if(is_bool($resArr) && $resArr == false)
return false;
return (int) $resArr[0]['total'];
case 'folderstotal':
$queryStr = "SELECT count(*) AS total FROM `tblFolders`";
$resArr = $this->db->getResultArray($queryStr);
if(is_bool($resArr) && $resArr == false)
return false;
return (int) $resArr[0]['total'];
case 'userstotal':
$queryStr = "SELECT count(*) AS total FROM `tblUsers`";
$resArr = $this->db->getResultArray($queryStr);
if(is_bool($resArr) && $resArr == false)
return false;
return (int) $resArr[0]['total'];
case 'sizeperuser':
$queryStr = "SELECT ".$this->db->concat(array('c.`fullName`', "' ('", 'c.`login`', "')'"))." AS `key`, sum(`fileSize`) AS total FROM `tblDocuments` a LEFT JOIN `tblDocumentContent` b ON a.id=b.`document` LEFT JOIN `tblUsers` c ON a.`owner`=c.`id` GROUP BY a.`owner`, c.`fullName`";
$resArr = $this->db->getResultArray($queryStr);

View File

@ -2324,6 +2324,22 @@ class RestapiController { /* {{{ */
return $response->withJson(array('success'=>true, 'message'=>'', 'data'=>''), 200);
} /* }}} */
function getStatsTotal($request, $response) { /* {{{ */
$dms = $this->container->dms;
$userobj = $this->container->userobj;
$check = $this->checkIfAdmin($request, $response);
if($check !== true)
return $check;
$data = [];
foreach(array('docstotal', 'folderstotal', 'userstotal') as $type) {
$total = $dms->getStatisticalData($type);
$data[$type] = $total;
}
return $response->withJson(array('success'=>true, 'message'=>'', 'data'=>$data), 200);
} /* }}} */
} /* }}} */
class TestController { /* {{{ */
@ -2512,6 +2528,7 @@ $app->put('/categories/{id}/name', \RestapiController::class.':changeCategoryNam
$app->get('/attributedefinitions', \RestapiController::class.':getAttributeDefinitions');
$app->put('/attributedefinitions/{id}/name', \RestapiController::class.':changeAttributeDefinitionName');
$app->get('/echo/{data}', \TestController::class.':echoData');
$app->get('/statstotal', \RestapiController::class.':getStatsTotal');
$app->run();
?>

View File

@ -1940,7 +1940,7 @@ $(document).ready(function() {
$content .= "<input type=\"checkbox\" id=\"".$fieldname."_".$attrdef->getId()."\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"1\" ".($objvalue ? 'checked' : '')." />";
break;
case SeedDMS_Core_AttributeDefinition::type_date:
$objvalue = $attribute ? (is_object($attribute) ? $attribute->getValue() : $attribute) : '';
$objvalue = $attribute ? getReadableDate((is_object($attribute) ? $attribute->getValue() : $attribute)) : '';
$dateformat = getConvertDateFormat($this->params['settings']->_dateformat);
$content .= '<span class="input-append date span12 datepicker" data-date="'.getReadableDate().'" data-date-format="'.$dateformat.'" data-date-language="'.str_replace('_', '-', $this->params['session']->getLanguage()).'">
<input id="'.$fieldname.'_'.$attrdef->getId().($namepostfix ? '_'.$namepostfix : '').'" class="span6" size="16" name="'.$fieldname.'['.$attrdef->getId().']'.($namepostfix ? '['.$namepostfix.']' : '').'" type="text" value="'.($objvalue ? $objvalue : '').'">