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

This commit is contained in:
Uwe Steinmann 2025-01-21 09:59:55 +01:00
commit 72a6ee9407
34 changed files with 1236 additions and 703 deletions

View File

@ -315,6 +315,10 @@
--------------------------------------------------------------------------------
Changes in version 5.1.37
--------------------------------------------------------------------------------
- do not show chart by category if there are no categories
- documents in certain folders can be excluded from dashboard, could be useful
for folders containing archived documents
- migrate from Slim 3 to Slim 4 (check for extension updates)
--------------------------------------------------------------------------------
Changes in version 5.1.36

View File

@ -8,7 +8,8 @@
"robthree/twofactorauth": "^1.5",
"sabre/dav": "^4.",
"sabre/xml": "*",
"slim/slim": "^3.0",
"slim/slim": "^4.0",
"guzzlehttp/psr7": "*",
"erusev/parsedown": "*",
"erusev/parsedown-extra": "*",
"mibe/feedwriter": "^1.1",
@ -23,6 +24,7 @@
"dragonmantank/cron-expression": "^3",
"zf1/zend-search-lucene": "*",
"symfony/http-foundation": "^5.4",
"php-di/php-di": "^6.4",
"seeddms/core": "dev-master",
"seeddms/lucene": "dev-master",
"seeddms/preview": "dev-master",
@ -69,5 +71,4 @@
}
}
]
}

View File

@ -59,7 +59,7 @@ class SeedDMS_Controller_UpdateDocument extends SeedDMS_Controller_Common {
$content = $this->callHook('updateDocument');
if($content === null) {
$filesize = SeedDMS_Core_File::fileSize($userfiletmp);
if($contentResult=$document->addContent($comment, $user, $userfiletmp, utf8_basename($userfilename), $filetype, $userfiletype, $reviewers, $approvers, $version=0, $attributes, $workflow, $initialdocumentstatus)) {
if($contentResult=$document->addContent($comment, $user, $userfiletmp, utf8_basename($userfilename), $filetype, $userfiletype, $reviewers, $approvers, 0, $attributes, $workflow, $initialdocumentstatus)) {
if ($this->hasParam('expires')) {
if($document->setExpires($this->getParam('expires'))) {

55
doc/README.Restapi.md Normal file
View File

@ -0,0 +1,55 @@
# How to access the Rest API
Below are various examples on how to access the Rest API. Some of them
start by calling the `login` endpoint which creates a cookie based
session which is stored in a local file named `cookies.txt`.
The authentication is done with the user `admin`. You may use any other
user as well.
You may as well pass `-H Authorization: <api key>` instead of `-b cookies.txt`
to `curl` after setting the api key in the configuration of your SeedDMS.
Of course, in that case you will not need the initial call of the `login`
endpoint.
The examples often use the `jq` programm for formating the returned
json data.
## Initial test
The `echo` endpoint does not require any authentication.
```
#!/bin/sh
BASEURL="https://your-domain/"
curl --silent -X GET ${BASEURL}restapi/index.php/echo/test | jq '.'
```
## Getting list of users
```
#!/bin/sh
BASEURL="https://your-domain/"
curl --silent -F "user=admin" -F "pass=admin" -b cookies.txt -c cookies.txt ${BASEURL}restapi/index.php/login | jq
curl --silent -b cookies.txt -X GET "${BASEURL}restapi/index.php/users" | jq '.'
```
## Getting meta data of a folder
```
#!/bin/sh
BASEURL="https://your-domain/"
curl --silent -H "Authorization: <api key>" -X GET "${BASEURL}restapi/index.php/folder/1" | jq '.'
```
## Notes
Make sure to encode the data properly when using restapi functions which uses
put. If you use curl with PHP, then encode the data as the following
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));

View File

@ -48,18 +48,18 @@ class SeedDMS_Auth_Middleware_Session { /* {{{ */
*
* @return \Psr\Http\Message\ResponseInterface
*/
public function __invoke($request, $response, $next) {
public function __invoke($request, $handler) {
// $this->container has the DI
$dms = $this->container->dms;
$settings = $this->container->config;
$logger = $this->container->logger;
$dms = $this->container->get('dms');
$settings = $this->container->get('config');
$logger = $this->container->get('logger');
$userobj = null;
if ($this->container->has('userobj')) {
$userobj = $this->container->userobj;
$userobj = $this->container->get('userobj');
}
if ($userobj) {
$response = $next($request, $response);
$response = $handler->handle($request);
return $response;
}
@ -100,9 +100,9 @@ class SeedDMS_Auth_Middleware_Session { /* {{{ */
} else {
return $response->withStatus(403);
}
$this->container['userobj'] = $userobj;
$this->container->set('userobj', $userobj);
$response = $next($request, $response);
$response = $handler->handle($request);
return $response;
}
} /* }}} */

View File

@ -35,7 +35,9 @@ class SeedDMS_ConversionServiceHtmlToText extends SeedDMS_ConversionServiceBase
public function convert($infile, $target = null, $params = array()) {
$d = new DOMDocument;
libxml_use_internal_errors(true);
$d->loadHTMLFile($infile);
libxml_clear_errors();
$body = $d->getElementsByTagName('body')->item(0);
$str = '';
foreach($body->childNodes as $childNode) {

View File

@ -94,6 +94,12 @@ class SeedDMS_ConversionServiceImageToImage extends SeedDMS_ConversionServiceBas
case 'image/gif':
$im = @imagecreatefromgif($infile);
break;
case 'image/webp':
$im = @imagecreatefromwebp($infile);
break;
case 'image/avif':
$im = @imagecreatefromavif($infile);
break;
}
if($im) {
$width = imagesx($im);

View File

@ -82,22 +82,24 @@ class SeedDMS_Download_Mgr {
$objPHPExcel = new PhpOffice\PhpSpreadsheet\Spreadsheet();
$objPHPExcel->getProperties()->setCreator("SeedDMS")->setTitle("Metadata");
$sheet = $objPHPExcel->setActiveSheetIndex(0);
$sheet->setTitle(getMLText('documents'));
$i = 1;
$col = 0;
$col = 1;
foreach($this->header as $h)
$sheet->setCellValueByColumnAndRow($col++, $i, $h);
foreach($this->extraheader as $h)
$sheet->setCellValueByColumnAndRow($col++, $i, $h);
$i++;
foreach($items as $item) {
if($item->isType('documentcontent')) {
$document = $item->getDocument();
$dms = $document->_dms;
$status = $item->getStatus();
$reviewStatus = $item->getReviewStatus();
$approvalStatus = $item->getApprovalStatus();
$col = 0;
$col = 1;
$sheet->setCellValueByColumnAndRow($col++, $i, $document->getID());
$sheet->setCellValueByColumnAndRow($col++, $i, $document->getName());
$sheet->setCellValueByColumnAndRow($col++, $i, $document->getID()."-".$item->getOriginalFileName());
@ -174,6 +176,7 @@ class SeedDMS_Download_Mgr {
$i = max($l, $k);
$i++;
}
}
$objWriter = new PhpOffice\PhpSpreadsheet\Writer\Xlsx($objPHPExcel);
$objWriter->save($file);

View File

@ -406,7 +406,7 @@ class SeedDMS_Extension_Mgr {
*/
public function checkExtensionByName($extname, $extconf, $options=array()) { /* {{{ */
if(isset($this->configcache[$extname])) {
return $this->configcache[$extname];
// return $this->configcache[$extname];
}
$this->errmsgs = array();
@ -494,19 +494,6 @@ class SeedDMS_Extension_Mgr {
return $this->configcache[$extname];
} /* }}} */
static protected function rrmdir($dir) { /* {{{ */
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($dir."/".$object) == "dir") self::rrmdir($dir."/".$object); else unlink($dir."/".$object);
}
}
reset($objects);
rmdir($dir);
}
} /* }}} */
/**
* Update an extension
*
@ -522,7 +509,7 @@ class SeedDMS_Extension_Mgr {
$newdir = addDirSep($this->cachedir)."ext.new";
/* First remove a left over from a previous extension */
if(file_exists($newdir)) {
self::rrmdir($newdir);
SeedDMS_Utils::rrmdir($newdir);
}
if(!mkdir($newdir, 0755)) {
$this->errmsgs[] = "Cannot create temp. extension directory";
@ -542,7 +529,7 @@ class SeedDMS_Extension_Mgr {
/* Check if extension is complete and fullfills the constraints */
if(!self::checkExtensionByDir($newdir)) {
self::rrmdir($newdir);
SeedDMS_Utils::rrmdir($newdir);
return false;
}
@ -553,11 +540,11 @@ class SeedDMS_Extension_Mgr {
if(!is_dir($this->extdir)) {
if(!mkdir($this->extdir, 0755)) {
$this->errmsgs[] = "Cannot create extension directory";
self::rrmdir($newdir);
SeedDMS_Utils::rrmdir($newdir);
return false;
}
} elseif(is_dir($this->extdir ."/". $extname)) {
$this->rrmdir($this->extdir ."/". $extname);
SeedDMS_Utils::rrmdir($this->extdir ."/". $extname);
}
/* Move the temp. created ext directory to the final location */
/* rename() may fail if dirs are moved from one device to another.
@ -579,7 +566,7 @@ class SeedDMS_Extension_Mgr {
* has been copied.
*/
$this->errmsgs[] = "Cannot move temp. extension directory to final destination";
$this->rrmdir($this->extdir ."/". $extname);
SeedDMS_Utils::rrmdir($this->extdir ."/". $extname);
return false;
}

View File

@ -209,7 +209,7 @@ class SeedDMS_FulltextService {
if($this->index)
return $this->index;
if($this->services[0]) {
if($this->services) {
if($recreate)
$this->index = $this->services[0]['Indexer']::create($this->services[0]['Conf']);
else
@ -222,7 +222,7 @@ class SeedDMS_FulltextService {
public function Search() { /* {{{ */
if($this->search)
return $this->search;
if($this->services[0]) {
if($this->services) {
$this->search = new $this->services[0]['Search']($this->index);
return $this->search;
} else {

View File

@ -323,6 +323,8 @@ class Settings { /* {{{ */
var $_maxRecursiveCount = 10000;
// number of days in the past of the dashboard
var $_daysPastDashboard = 7;
// list of folders not considered for dashboard
var $_excludeFoldersDashboard = [];
// enable/disable help
var $_enableHelp = true;
// enable/disable language selection menu
@ -624,6 +626,8 @@ class Settings { /* {{{ */
$this->_enableRecursiveCount = Settings::boolVal($tab["enableRecursiveCount"]);
$this->_maxRecursiveCount = intval($tab["maxRecursiveCount"]);
$this->_daysPastDashboard = intval($tab["daysPastDashboard"]);
if(trim(strval($tab["excludeFoldersDashboard"])))
$this->_excludeFoldersDashboard = explode(',',strval($tab["excludeFoldersDashboard"]));
$this->_enableHelp = Settings::boolVal($tab["enableHelp"]);
$this->_enableLanguageSelector = Settings::boolVal($tab["enableLanguageSelector"]);
$this->_enableThemeSelector = Settings::boolVal($tab["enableThemeSelector"]);
@ -1055,6 +1059,7 @@ class Settings { /* {{{ */
$this->setXMLAttributValue($node, "enableRecursiveCount", $this->_enableRecursiveCount);
$this->setXMLAttributValue($node, "maxRecursiveCount", $this->_maxRecursiveCount);
$this->setXMLAttributValue($node, "daysPastDashboard", $this->_daysPastDashboard);
$this->setXMLAttributValue($node, "excludeFoldersDashboard", implode(',', $this->_excludeFoldersDashboard));
$this->setXMLAttributValue($node, "enableHelp", $this->_enableHelp);
$this->setXMLAttributValue($node, "enableLanguageSelector", $this->_enableLanguageSelector);
$this->setXMLAttributValue($node, "enableThemeSelector", $this->_enableThemeSelector);

View File

@ -63,6 +63,8 @@ if (extension_loaded('gd') || extension_loaded('imagick')) {
$conversionmgr->addService(new SeedDMS_ConversionServiceImageToImage('image/png', 'image/png'))->setLogger($logger);
$conversionmgr->addService(new SeedDMS_ConversionServiceImageToImage('image/jpg', 'image/png'))->setLogger($logger);
$conversionmgr->addService(new SeedDMS_ConversionServiceImageToImage('image/gif', 'image/png'))->setLogger($logger);
$conversionmgr->addService(new SeedDMS_ConversionServiceImageToImage('image/webp', 'image/png'))->setLogger($logger);
$conversionmgr->addService(new SeedDMS_ConversionServiceImageToImage('image/avif', 'image/png'))->setLogger($logger);
}
if (extension_loaded('imagick')) {

View File

@ -813,6 +813,7 @@ class SeedDMS_RecentChangesTask extends SeedDMS_SchedulerTaskBase { /* {{{ */
$params['__body__'] = $body;
$params['__body_html__'] = $bodyhtml;
$params['__skip_footer__'] = true;
$params['sitename'] = $settings->_siteName;
$email->toIndividual('', $u, 'recentchanges_mail_subject', '', $params);

View File

@ -1264,6 +1264,34 @@ function getColorBrightness($color) { /* {{{ */
return $brightness;
} /* }}} */
/**
* Class with various utility methods
*
* This class will sooner or later comprise the functions above
*
*/
class SeedDMS_Utils { /* {{{ */
/**
* Recursively remove a directory on disc
*
* @param string $dir name of directory
*/
static public function rrmdir($dir) { /* {{{ */
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($dir."/".$object) == "dir") self::rrmdir($dir."/".$object); else unlink($dir."/".$object);
}
}
reset($objects);
rmdir($dir);
}
} /* }}} */
} /* }}} */
/**
* Class for creating encrypted api keys
*

View File

@ -31,6 +31,9 @@
require "inc/inc.Settings.php";
use DI\ContainerBuilder;
use Slim\Factory\AppFactory;
if(true) {
require_once("inc/inc.Utils.php");
require_once("inc/inc.LogInit.php");
@ -39,7 +42,9 @@ if(true) {
require_once("inc/inc.Extension.php");
require_once("inc/inc.DBInit.php");
$c = new \Slim\Container(); //Create Your container
$containerBuilder = new \DI\ContainerBuilder();
$c = $containerBuilder->build();
/*
$c['notFoundHandler'] = function ($c) use ($settings, $dms) {
return function ($request, $response) use ($c, $settings, $dms) {
$uri = $request->getUri();
@ -62,25 +67,42 @@ if(true) {
->withHeader('Location', isset($settings->_siteDefaultPage) && strlen($settings->_siteDefaultPage)>0 ? $settings->_httpRoot.$settings->_siteDefaultPage : $settings->_httpRoot."out/out.ViewFolder.php");
};
};
$app = new \Slim\App($c);
*/
AppFactory::setContainer($c);
$app = AppFactory::create();
/* put lots of data into the container, because if slim instanciates
* a class by itself (with the help from the DI container), it will
* pass the container to the constructor of the instanciated class.
*/
$container = $app->getContainer();
$container['dms'] = $dms;
$container['config'] = $settings;
$container['conversionmgr'] = $conversionmgr;
$container['logger'] = $logger;
$container['fulltextservice'] = $fulltextservice;
$container['notifier'] = $notifier;
$container['authenticator'] = $authenticator;
$container->set('dms', $dms);
$container->set('config', $settings);
$container->set('conversionmgr', $conversionmgr);
$container->set('logger', $logger);
$container->set('fulltextservice', $fulltextservice);
$container->set('notifier', $notifier);
$container->set('authenticator', $authenticator);
if(isset($GLOBALS['SEEDDMS_HOOKS']['initDMS'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['initDMS'] as $hookObj) {
if (method_exists($hookObj, 'addMiddleware')) {
$hookObj->addMiddleware($app);
}
}
}
$app->get('/', function($request, $response) {
return $response
->withHeader('Location', '/out/out.ViewFolder.php')
->withStatus(302);
});
if(isset($GLOBALS['SEEDDMS_HOOKS']['initDMS'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['initDMS'] as $hookObj) {
if (method_exists($hookObj, 'addRoute')) {
// FIXME: pass $app only just like initRestAPI. $app has a container
// which contains all other objects
$hookObj->addRoute(array('dms'=>$dms, 'app'=>$app, 'settings'=>$settings, 'conversionmgr'=>$conversionmgr, 'authenticator'=>$authenticator, 'fulltextservice'=>$fulltextservice, 'logger'=>$logger));
// } else {
// include("inc/inc.Authentication.php");
// if (method_exists($hookObj, 'addRouteAfterAuthentication')) {
// $hookObj->addRouteAfterAuthentication(array('dms'=>$dms, 'app'=>$app, 'settings'=>$settings, 'user'=>$user));
// }
}
}
}

View File

@ -119,7 +119,7 @@ CREATE TABLE `tblUserSubstitutes` (
PRIMARY KEY (`id`),
UNIQUE KEY `user` (`user`,`substitute`),
CONSTRAINT `tblUserSubstitutes_user` FOREIGN KEY (`user`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE,
CONSTRAINT `tblUserSubstitutes_substitute` FOREIGN KEY (`user`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE
CONSTRAINT `tblUserSubstitutes_substitute` FOREIGN KEY (`substitute`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE
);
-- --------------------------------------------------------

View File

@ -41,7 +41,7 @@ CREATE TABLE `tblUserSubstitutes` (
PRIMARY KEY (`id`),
UNIQUE (`user`, `substitute`),
CONSTRAINT `tblUserSubstitutes_user` FOREIGN KEY (`user`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE,
CONSTRAINT `tblUserSubstitutes_substitute` FOREIGN KEY (`user`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE
CONSTRAINT `tblUserSubstitutes_substitute` FOREIGN KEY (`substitute`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tblDocumentCheckOuts` (

View File

@ -51,6 +51,47 @@ if ($document->getAccessMode($user, 'addDocumentFile') < M_READWRITE) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
}
function reArrayFiles(&$file_post) {
$file_ary = array();
$file_count = count($file_post['name']);
$file_keys = array_keys($file_post);
for ($i=0; $i<$file_count; $i++) {
if($file_post['error'][$i] != 4) { // no file uploaded
foreach ($file_keys as $key) {
$file_ary[$i][$key] = $file_post[$key][$i];
}
$file_ary[$i]['source'] = 'upload';
}
}
return $file_ary;
}
if(!empty($_FILES['userfile'])) {
$file_ary = reArrayFiles($_FILES['userfile']);
} else {
$file_ary = array();
}
if($settings->_dropFolderDir) {
if(isset($_POST["dropfolderfileaddfileform"]) && $_POST["dropfolderfileaddfileform"]) {
$fullfile = $settings->_dropFolderDir.'/'.$user->getLogin().'/'.$_POST["dropfolderfileaddfileform"];
if(file_exists($fullfile)) {
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mimetype = finfo_file($finfo, $fullfile);
$file_ary[] = array(
'tmp_name' => $fullfile,
'type' => $mimetype,
'name' => $_POST["dropfolderfileaddfileform"],
'size' => filesize($fullfile),
'error' => 0,
'source' => 'dropfolder'
);
}
}
}
$prefix = 'userfile';
if(isset($_POST[$prefix.'-fine-uploader-uuids']) && $_POST[$prefix.'-fine-uploader-uuids']) {
$uuids = explode(';', $_POST[$prefix.'-fine-uploader-uuids']);
@ -60,34 +101,43 @@ if(isset($_POST[$prefix.'-fine-uploader-uuids']) && $_POST[$prefix.'-fine-upload
if(file_exists($fullfile)) {
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mimetype = finfo_file($finfo, $fullfile);
$_FILES["userfile"]['tmp_name'][] = $fullfile;
$_FILES["userfile"]['type'][] = $mimetype;
$_FILES["userfile"]['name'][] = isset($names[$i]) ? $names[$i] : $uuid;
$_FILES["userfile"]['size'][] = filesize($fullfile);
$_FILES["userfile"]['error'][] = 0;
$file_ary[] = array(
'tmp_name' => $fullfile,
'type' => $mimetype,
'name' => isset($names[$i]) ? $names[$i] : $uuid,
'size' => filesize($fullfile),
'error' => 0,
'source' => 'upload',
);
}
}
}
if(!$file_ary) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_failed"));
}
$maxuploadsize = SeedDMS_Core_File::parse_filesize($settings->_maxUploadSize);
for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
if ($_FILES["userfile"]["size"][$file_num]==0) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_zerosize"));
foreach($file_ary as $file) {
if($file['error']==1) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_maxsize"));
}
if ($maxuploadsize && $_FILES["userfile"]["size"][$file_num] > $maxuploadsize) {
UI::exitError(getMLText("folder_title", array("documentname" => $document->getName())),getMLText("uploading_maxsize"));
}
if (is_uploaded_file($_FILES["userfile"]["tmp_name"][$file_num]) && $_FILES['userfile']['error'][$file_num] != 0){
if($file['error']!=0) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_failed"));
}
if($_FILES["userfile"]["error"][$file_num]) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
if ($file["size"]==0) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_zerosize"));
}
if ($maxuploadsize && $file["size"] > $maxuploadsize) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_maxsize"));
}
}
if(count($_FILES["userfile"]["tmp_name"]) == 1 && !empty($_POST['name']))
foreach($file_ary as $file) {
if(count($file_ary) == 1 && !empty($_POST['name']))
$name = $_POST["name"];
else
$name = $_FILES["userfile"]['name'][$file_num];
$name = $file['name'];
$comment = $_POST["comment"];
$version = (int) $_POST["version"];
$public = (isset($_POST["public"]) && $_POST["public"] == 'true') ? 1 : 0;
@ -99,9 +149,9 @@ for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
}
}
$userfiletmp = $_FILES["userfile"]["tmp_name"][$file_num];
$userfiletype = $_FILES["userfile"]["type"][$file_num];
$userfilename = $_FILES["userfile"]["name"][$file_num];
$userfiletmp = $file["tmp_name"];
$userfiletype = $file["type"];
$userfilename = $file["name"];
$fileType = ".".pathinfo($userfilename, PATHINFO_EXTENSION);

View File

@ -239,9 +239,10 @@ if($newfolder) {
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('error_importfs')));
else {
if(isset($_GET['remove']) && $_GET["remove"]) {
$cmd = 'rm -rf '.$dirname;
$ret = null;
system($cmd, $ret);
SeedDMS_Utils::rrmdir($dirname);
// $cmd = 'rm -rf '.$dirname;
// $ret = null;
// system($cmd, $ret);
}
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_importfs', array('docs'=>$doccount, 'folders'=>$foldercount))));
}

View File

@ -150,6 +150,7 @@ if ($action == "saveSettings")
setBoolValue("enableRecursiveCount");
setIntValue("maxRecursiveCount");
setIntValue("daysPastDashboard");
setArrayValue("excludeFoldersDashboard");
setBoolValue("enableLanguageSelector");
setBoolValue("enableHelp");
setBoolValue("enableThemeSelector");

View File

@ -25,6 +25,7 @@ if($view) {
$view->setParam('convertToPdf', $settings->_convertToPdf);
$view->setParam('timeout', $settings->_cmdTimeout);
$view->setParam('dayspastdashboard', (int) $settings->_daysPastDashboard);
$view->setParam('excludedfolders', $settings->_excludeFoldersDashboard);
$view->setParam('accessobject', $accessop);
$view->setParam('xsendfile', $settings->_enableXsendfile);
$view($_GET);

View File

@ -40,6 +40,7 @@ if($view) {
$view->setParam('previewWidthList', $settings->_previewWidthList);
$view->setParam('timeout', $settings->_cmdTimeout);
$view->setParam('xsendfile', $settings->_enableXsendfile);
$view->setParam('tasksinmenu', []);
$view($_GET);
exit;
}

File diff suppressed because it is too large Load Diff

View File

@ -35,11 +35,16 @@ class SeedDMS_View_AddFile extends SeedDMS_Theme_Style {
$enablelargefileupload = $this->params['enablelargefileupload'];
$partitionsize = $this->params['partitionsize'];
$maxuploadsize = $this->params['maxuploadsize'];
$dropfolderdir = $this->params['dropfolderdir'];
header('Content-Type: application/javascript; charset=UTF-8');
parent::jsTranslations(array('js_form_error', 'js_form_errors'));
if($enablelargefileupload)
$this->printFineUploaderJs($this->params['settings']->_httpRoot.'op/op.UploadChunks.php', $partitionsize, $maxuploadsize);
if($dropfolderdir) {
$this->printDropFolderChooserJs("addfileform");
}
$this->printFileChooserJs();
?>
@ -58,14 +63,18 @@ $(document).ready( function() {
}
return false;
}, "<?php printMLText("js_no_file");?>");
$("#form1").validate({
$("#addfileform").validate({
debug: false,
ignore: ":hidden:not(.do_validate)",
<?php
if($enablelargefileupload) {
?>
submitHandler: function(form) {
userfileuploader.uploadStoredFiles();
/* fileuploader may not have any files if drop folder is used */
if(userfileuploader.getUploads().length)
userfileuploader.uploadStoredFiles();
else
form.submit();
},
<?php
}
@ -74,14 +83,18 @@ $(document).ready( function() {
<?php
if($enablelargefileupload) {
?>
fineuploaderuuids: {
fineuploader: [ userfileuploader ]
'userfile-fine-uploader-uuids': {
fineuploader: [ userfileuploader, $('#dropfolderfileaddfileform') ]
}
<?php
} else {
?>
'userfile[]': {
required: true
require_from_group: [1, ".fileupload-group"],
maxsize: <?= $maxuploadsize ?>
},
dropfolderfileaddfileform: {
require_from_group: [1, ".fileupload-group"]
}
<?php
}
@ -113,6 +126,7 @@ $(document).ready( function() {
$enablelargefileupload = $this->params['enablelargefileupload'];
$uploadedattachmentispublic = $this->params['uploadedattachmentispublic'];
$maxuploadsize = $this->params['maxuploadsize'];
$dropfolderdir = $this->params['dropfolderdir'];
$this->htmlAddHeader('<script type="text/javascript" src="'.$this->params['settings']->_httpRoot.'views/'.$this->theme.'/vendors/jquery-validation/jquery.validate.js"></script>'."\n", 'js');
$this->htmlAddHeader('<script type="text/javascript" src="'.$this->params['settings']->_httpRoot.'views/'.$this->theme.'/styles/validation-default.js"></script>'."\n", 'js');
@ -132,7 +146,7 @@ $(document).ready( function() {
?>
<form class="form-horizontal" action="../op/op.AddFile.php" enctype="multipart/form-data" method="post" name="form1" id="form1">
<form class="form-horizontal" action="../op/op.AddFile.php" enctype="multipart/form-data" method="post" name="addfileform" id="addfileform">
<input type="hidden" name="documentid" value="<?php print $document->getId(); ?>">
<?php
$this->contentContainerStart();
@ -140,6 +154,12 @@ $(document).ready( function() {
getMLText("local_file"),
($enablelargefileupload ? $this->getFineUploaderHtml() : $this->getFileChooserHtml('userfile[]', false))
);
if($dropfolderdir) {
$this->formField(
getMLText("dropfolder_file"),
$this->getDropFolderChooserHtml("addfileform")
);
}
$options = array();
$options[] = array("", getMLText('document'));
$versions = $document->getContent();
@ -198,4 +218,3 @@ $(document).ready( function() {
} /* }}} */
}
?>

View File

@ -1879,7 +1879,7 @@ $(document).ready(function() {
/**
* This function is deprecated. Don't use it anymore. There is a generic
* folderSelected and documentSelected function in application.js
* If you extra functions to be called then define them in your own js code
* If you need extra functions to be called then define them in your own js code
*/
function printDocumentChooserJs($form, $formname='') { /* {{{ */
if(!$formname)
@ -1946,7 +1946,7 @@ function folderSelected<?php echo $formid ?>(id, name) {
/**
* This function is deprecated. Don't use it anymore. There is a generic
* folderSelected and documentSelected function in application.js
* If you extra functions to be called then define them in your own js code
* If you need extra functions to be called then define them in your own js code
*/
function printFolderChooserJs($form, $formname='') { /* {{{ */
if(!$formname)

View File

@ -13,11 +13,6 @@
* @version Release: @package_version@
*/
/**
* Include parent class
*/
//require_once("class.Bootstrap.php");
/**
* Class which outputs the html page for Charts view
*
@ -229,8 +224,28 @@ $(document).ready( function() {
}
} /* }}} */
function show() { /* {{{ */
$this->dms = $this->params['dms'];
/**
* Check if it makes sense to show the chart
*
* e.g. it doesn't make sense to show the documents by category if
* there are no categories.
*
* @param string $type
* @return boolean
*/
private function showChart($type) { /* {{{ */
$dms = $this->params['dms'];
if($type == 'docspercategory') {
if($cats = $dms->getDocumentCategories())
return true;
else
return false;
}
return true;
} /* }}} */
public function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$data = $this->params['data'];
$type = $this->params['type'];
@ -251,7 +266,8 @@ $(document).ready( function() {
$this->contentHeading(getMLText("chart_selection"));
$this->contentContainerStart();
foreach(array('docsperuser', 'foldersperuser', 'sizeperuser', 'sizepermonth','docspermimetype', 'docspercategory', 'docsperstatus', 'docspermonth', 'docsaccumulated') as $atype) {
echo "<div><a href=\"?type=".$atype."\">".getMLText('chart_'.$atype.'_title')."</a></div>\n";
if($this->showChart($atype))
echo "<div><a href=\"?type=".$atype."\">".getMLText('chart_'.$atype.'_title')."</a></div>\n";
}
$this->contentContainerEnd();
$this->columnEnd();

View File

@ -69,6 +69,7 @@ class SeedDMS_View_Dashboard extends SeedDMS_Theme_Style {
$previewconverters = $this->params['previewConverters'];
$timeout = $this->params['timeout'];
$dayspastdashboard = $this->params['dayspastdashboard'];
$excludedfolders = $this->params['excludedfolders'];
$xsendfile = $this->params['xsendfile'];
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
@ -80,6 +81,11 @@ class SeedDMS_View_Dashboard extends SeedDMS_Theme_Style {
echo $this->contentHeading(getMLText('new_documents'));
$documents = $dms->getLatestChanges('newdocuments', mktime(0, 0, 0)-$dayspastdashboard*86400, time());
$documents = SeedDMS_Core_DMS::filterAccess($documents, $user, M_READ);
foreach($documents as $i=>$doc) {
$fl = explode(':', $doc->getFolderList());
if(array_intersect($fl, $excludedfolders))
unset($documents[$i]);
}
if (count($documents) > 0) {
$this->printList($documents, $previewer);
}
@ -94,6 +100,7 @@ class SeedDMS_View_Dashboard extends SeedDMS_Theme_Style {
$previewconverters = $this->params['previewConverters'];
$timeout = $this->params['timeout'];
$dayspastdashboard = $this->params['dayspastdashboard'];
$excludedfolders = $this->params['excludedfolders'];
$xsendfile = $this->params['xsendfile'];
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
@ -105,6 +112,11 @@ class SeedDMS_View_Dashboard extends SeedDMS_Theme_Style {
echo $this->contentHeading(getMLText('updated_documents'));
$documents = $dms->getLatestChanges('updateddocuments', mktime(0, 0, 0)-$dayspastdashboard*86400, time());
$documents = SeedDMS_Core_DMS::filterAccess($documents, $user, M_READ);
foreach($documents as $i=>$doc) {
$fl = explode(':', $doc->getFolderList());
if(array_intersect($fl, $excludedfolders))
unset($documents[$i]);
}
if (count($documents) > 0) {
$this->printList($documents, $previewer);
}
@ -119,6 +131,7 @@ class SeedDMS_View_Dashboard extends SeedDMS_Theme_Style {
$previewconverters = $this->params['previewConverters'];
$timeout = $this->params['timeout'];
$dayspastdashboard = $this->params['dayspastdashboard'];
$excludedfolders = $this->params['excludedfolders'];
$xsendfile = $this->params['xsendfile'];
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
@ -130,6 +143,11 @@ class SeedDMS_View_Dashboard extends SeedDMS_Theme_Style {
echo $this->contentHeading(getMLText('status_change'));
$documents = $dms->getLatestChanges('statuschange', mktime(0, 0, 0)-$dayspastdashboard*86400, time());
$documents = SeedDMS_Core_DMS::filterAccess($documents, $user, M_READ);
foreach($documents as $i=>$doc) {
$fl = explode(':', $doc->getFolderList());
if(array_intersect($fl, $excludedfolders))
unset($documents[$i]);
}
if (count($documents) > 0) {
$this->printList($documents, $previewer);
}
@ -156,7 +174,7 @@ class SeedDMS_View_Dashboard extends SeedDMS_Theme_Style {
$timeout = $this->params['timeout'];
$xsendfile = $this->params['xsendfile'];
$this->htmlStartPage(getMLText("calendar"));
$this->htmlStartPage(getMLText("dashboard"));
$this->globalNavigation();
$this->contentStart();

View File

@ -116,7 +116,7 @@ class SeedDMS_View_Info extends SeedDMS_Theme_Style {
$this->contentHeading(getMLText("missing_php_functions_and_classes"));
$missingfunc = [];
foreach(array('proc_open', 'openssl_cipher_iv_length') as $funcname) {
foreach(array('proc_open', 'openssl_cipher_iv_length', 'system') as $funcname) {
if(!function_exists($funcname)) {
$missingfunc[] = $funcname; //getMLText('func_'.$funcname."_missing")
}

View File

@ -621,11 +621,11 @@ $(document).ready( function() {
echo "</td>";
echo "<td>";
print "<div class=\"list-action\">";
print "<a class=\"addtask\" data-extension=\"".$extname."\" data-task=\"".$taskname."\" href=\"../out/out.SchedulerTaskMgr.php?extension=".$extname."&task=".$taskname."\" title=\"".getMLText("add_task")."\"><i class=\"fa fa-plus\"></i></a>";
$t = $scheduler->getTasksByExtension($extname, $taskname);
if($t) {
print "<a class=\"listtasks\" data-extension=\"".$extname."\" data-task=\"".$taskname."\" href=\"../out/out.SchedulerTaskMgr.php?extension=".$extname."&task=".$taskname."\" title=\"".getMLText("list_tasks")."\"><i class=\"fa fa-list\"></i></a>";
}
print "<a class=\"addtask\" data-extension=\"".$extname."\" data-task=\"".$taskname."\" href=\"../out/out.SchedulerTaskMgr.php?extension=".$extname."&task=".$taskname."\" title=\"".getMLText("add_task")."\"><i class=\"fa fa-plus\"></i></a>";
print "</div>";
echo "</td>";
echo "</tr>";

View File

@ -258,6 +258,35 @@ class SeedDMS_View_Settings extends SeedDMS_Theme_Style {
<?php
} /* }}} */
protected function showConfigFolderNoTree($title, $name, $allowempty=true, $multiple=true, $size=0) { /* {{{ */
$settings = $this->params['settings'];
$dms = $this->params['dms'];
?>
<tr title="<?= getMLText($title."_desc") ?>">
<td><?= getMLText($title) ?></td>
<td>
<?php
if(is_array($settings->{"_".$name}))
$selections = $settings->{"_".$name};
else
$selections = explode(',', $settings->{"_".$name});
echo "<select class=\"chzn-select-folder\"".($allowempty ? " data-allow-clear=\"true\"" : "")." name=\"".$name.($multiple ? "[]" : "")."\"".($multiple ? " multiple" : "").($size ? " size=\"".$size."\"" : "")." data-placeholder=\"".getMLText("select_folder")."\" style=\"width: 100%;\">";
if($allowempty)
echo "<option value=\"\"></option>";
foreach($selections as $selid) {
if ($f = $dms->getFolder($selid)) {
echo "<option value=\"".$selid."\"";
echo " selected";
echo ">".htmlspecialchars($f->getName())."</option>";
}
}
echo "</select>";
?>
</td>
</tr>
<?php
} /* }}} */
protected function showConfigGroup($title, $name, $allowempty=false, $multiple=false, $size=0) { /* {{{ */
$settings = $this->params['settings'];
$dms = $this->params['dms'];
@ -455,6 +484,7 @@ if(($kkk = $this->callHook('getFullSearchEngine')) && is_array($kkk))
<?php $this->showConfigCheckbox('settings_enableRecursiveCount', 'enableRecursiveCount'); ?>
<?php $this->showConfigText('settings_maxRecursiveCount', 'maxRecursiveCount'); ?>
<?php $this->showConfigText('settings_daysPastDashboard', 'daysPastDashboard'); ?>
<?php $this->showConfigFolderNoTree('settings_excludeFoldersDashboard', 'excludeFoldersDashboard'); ?>
<?php $this->showConfigCheckbox('settings_enableLanguageSelector', 'enableLanguageSelector'); ?>
<?php $this->showConfigCheckbox('settings_enableHelp', 'enableHelp'); ?>
<?php $this->showConfigCheckbox('settings_enableThemeSelector', 'enableThemeSelector'); ?>

View File

@ -196,14 +196,9 @@ class SeedDMS_View_Tasks extends SeedDMS_Theme_Style {
} /* }}} */
/**
* Returns the html needed for the task list in the menu
* Returns the number of tasks
*
* This function renders the tasks in a way suitable to be
* used as a menu
*
* @param array $clipboard clipboard containing two arrays for both
* documents and folders.
* @return string html code
* @return array list of tasks an its number
*/
function countTasks() { /* {{{ */
$dms = $this->params['dms'];

View File

@ -1618,17 +1618,17 @@ $(document).ready(function() { /* {{{ */
$.ajax({url: seeddms_webroot+'out/out.Tasks.php',
type: 'GET',
dataType: "json",
data: {action: 'mytasks'},
data: {action: 'counttasks'},
success: function(data) {
if(data) {
if((typeof data.data.approval != 'undefined' && approval_count != data.data.approval.length) ||
(typeof data.data.review != 'undefined' && review_count != data.data.review.length) ||
(typeof data.data.workflow != 'undefined' && workflow_count != data.data.workflow.length)) {
if((typeof data.data.approval != 'undefined' && approval_count != data.data.approval) ||
(typeof data.data.review != 'undefined' && review_count != data.data.review) ||
(typeof data.data.workflow != 'undefined' && workflow_count != data.data.workflow)) {
// $("#menu-tasks").html('Loading').hide().load('../out/out.Tasks.php?action=menutasks').fadeIn('500')
$('#menu-tasks > div.ajax').trigger('update', {folderid: seeddms_folder});
approval_count = typeof data.data.approval != 'undefined' ? data.data.approval.length : 0;
review_count = typeof data.data.review != 'undefined' ? data.data.review.length : 0;
workflow_count = typeof data.data.workflow != 'undefined' ? data.data.workflow.length : 0;
approval_count = typeof data.data.approval != 'undefined' ? data.data.approval : 0;
review_count = typeof data.data.review != 'undefined' ? data.data.review : 0;
workflow_count = typeof data.data.workflow != 'undefined' ? data.data.workflow : 0;
}
}
},

View File

@ -1817,7 +1817,7 @@ $(document).ready(function() {
/**
* This function is deprecated. Don't use it anymore. There is a generic
* folderSelected and documentSelected function in application.js
* If you extra functions to be called then define them in your own js code
* If you need extra functions to be called then define them in your own js code
*/
function printDocumentChooserJs($form, $formname='') { /* {{{ */
if(!$formname)
@ -1886,7 +1886,7 @@ function folderSelected<?php echo $formid ?>(id, name) {
/**
* This function is deprecated. Don't use it anymore. There is a generic
* folderSelected and documentSelected function in application.js
* If you extra functions to be called then define them in your own js code
* If you need extra functions to be called then define them in your own js code
*/
function printFolderChooserJs($form, $formname='') { /* {{{ */
if(!$formname)

View File

@ -1697,17 +1697,17 @@ $(document).ready(function() { /* {{{ */
$.ajax({url: seeddms_webroot+'out/out.Tasks.php',
type: 'GET',
dataType: "json",
data: {action: 'mytasks'},
data: {action: 'counttasks'},
success: function(data) {
if(data) {
if((typeof data.data.approval != 'undefined' && approval_count != data.data.approval.length) ||
(typeof data.data.review != 'undefined' && review_count != data.data.review.length) ||
(typeof data.data.workflow != 'undefined' && workflow_count != data.data.workflow.length)) {
if((typeof data.data.approval != 'undefined' && approval_count != data.data.approval) ||
(typeof data.data.review != 'undefined' && review_count != data.data.review) ||
(typeof data.data.workflow != 'undefined' && workflow_count != data.data.workflow)) {
// $("#menu-tasks").html('Loading').hide().load('../out/out.Tasks.php?action=menutasks').fadeIn('500')
$('#menu-tasks > div.ajax').trigger('update', {folderid: seeddms_folder});
approval_count = typeof data.data.approval != 'undefined' ? data.data.approval.length : 0;
review_count = typeof data.data.review != 'undefined' ? data.data.review.length : 0;
workflow_count = typeof data.data.workflow != 'undefined' ? data.data.workflow.length : 0;
approval_count = typeof data.data.approval != 'undefined' ? data.data.approval : 0;
review_count = typeof data.data.review != 'undefined' ? data.data.review : 0;
workflow_count = typeof data.data.workflow != 'undefined' ? data.data.workflow : 0;
}
}
},