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

This commit is contained in:
Uwe Steinmann 2023-06-19 16:51:15 +02:00
commit 0fd0293f35
31 changed files with 437 additions and 344 deletions

View File

@ -267,6 +267,10 @@
--------------------------------------------------------------------------------
- check error msg after calling AddDocument and UpdateDocument controller
in webdav module
- more verbose log messages
- show errors of none activated extensions and do not allow to activate it,
if there are errors (e.g. missing php extensions)
- move Approve/ReviewDocument in a controller
--------------------------------------------------------------------------------
Changes in version 5.1.31

View File

@ -7,36 +7,38 @@
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2010-2013 Uwe Steinmann
* @copyright Copyright (C) 2010-2023 Uwe Steinmann
* @version Release: @package_version@
*/
/**
* Class which does the busines logic for downloading a document
* Class which does the busines logic for approving a document
*
* @category DMS
* @package SeedDMS
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2010-2013 Uwe Steinmann
* @copyright Copyright (C) 2010-2023 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_Controller_ApproveDocument extends SeedDMS_Controller_Common {
public function run() {
public $oldstatus;
public $newstatus;
public function run() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$settings = $this->params['settings'];
$document = $this->params['document'];
$content = $this->params['content'];
$approvalstatus = $this->params['approvalstatus'];
$approvaltype = $this->params['approvaltype'];
$group = $this->params['group'];
$comment = $this->params['comment'];
$file = $this->params['file'];
/* Get the document id and name before removing the document */
$docname = $document->getName();
$documentid = $document->getID();
$approvaltype = $this->params['type'];
$approvalstatus = $this->params['status'];
$approvalcomment = $this->params['comment'];
$approvalfile = $this->params['file'];
$approvalgroup = $this->params['group'];
$overallStatus = $content->getStatus();
$this->oldstatus = $overallStatus['status'];
$this->newstatus = $this->oldstatus;
if(!$this->callHook('preApproveDocument', $content)) {
}
@ -44,36 +46,35 @@ class SeedDMS_Controller_ApproveDocument extends SeedDMS_Controller_Common {
$result = $this->callHook('approveDocument', $content);
if($result === null) {
if ($approvaltype == "ind") {
$approvalLogID = $content->setApprovalByInd($user, $user, $approvalstatus, $comment, $file);
if($approvalLogID === false || 0 > $approvalLogID) {
$this->error = 1;
$this->errormsg = "approval_update_failed";
return false;
}
$approvalLogID = $content->setApprovalByInd($user, $user, $approvalstatus, $approvalcomment, $approvalfile);
} elseif ($approvaltype == "grp") {
$approvalLogID = $content->setApprovalByGrp($group, $user, $approvalstatus, $comment, $file);
if($approvalLogID === false || 0 > $approvalLogID) {
$this->error = 1;
$this->errormsg = "approval_update_failed";
return false;
}
$approvalLogID = $content->setApprovalByGrp($approvalgroup, $user, $approvalstatus, $approvalcomment, $approvalfile);
} else {
$this->errormsg = "approval_wrong_type";
return false;
}
if($approvalLogID === false || 0 > $approvalLogID) {
$this->errormsg = "approval_update_failed";
return false;
}
}
/* Check to see if the overall status for the document version needs to be
* updated.
*/
$result = $this->callHook('approveUpdateDocumentStatus', $content);
if($result === null) {
/* If document was rejected, set the document status to S_REJECTED right away */
if ($approvalstatus == -1){
if($content->setStatus(S_REJECTED,$comment,$user)) {
$this->callHook('postApproveDocument', $content, S_REJECTED);
if($approvalstatus == -1) {
$this->newstatus = S_REJECTED;
if($content->setStatus(S_REJECTED, $approvalcomment, $user)) {
if(isset($GLOBALS['SEEDDMS_HOOKS']['approveDocument'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['approveDocument'] as $hookObj) {
if (method_exists($hookObj, 'postApproveDocument')) {
$hookObj->postApproveDocument(null, $content, S_REJECTED);
}
}
}
}
} else {
$docApprovalStatus = $content->getApprovalStatus();
if (is_bool($docApprovalStatus) && !$docApprovalStatus) {
$this->error = 1;
$this->errormsg = "cannot_retrieve_approval_snapshot";
return false;
}
@ -91,8 +92,15 @@ class SeedDMS_Controller_ApproveDocument extends SeedDMS_Controller_Common {
// count of the approvals required for this document.
if ($approvalCT == $approvalTotal) {
// Change the status to released.
if($content->setStatus(S_RELEASED, getMLText("automatic_status_update"), $user)) {
$this->callHook('postApproveDocument', $content, S_RELEASED);
$this->newstatus=S_RELEASED;
if($content->setStatus($this->newstatus, getMLText("automatic_status_update"), $user)) {
if(isset($GLOBALS['SEEDDMS_HOOKS']['approveDocument'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['approveDocument'] as $hookObj) {
if (method_exists($hookObj, 'postApproveDocument')) {
$hookObj->postApproveDocument(null, $content, S_RELEASED);
}
}
}
}
}
}
@ -102,6 +110,6 @@ class SeedDMS_Controller_ApproveDocument extends SeedDMS_Controller_Common {
}
return true;
}
} /* }}} */
}

View File

@ -7,72 +7,70 @@
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2010-2013 Uwe Steinmann
* @copyright Copyright (C) 2010-2023 Uwe Steinmann
* @version Release: @package_version@
*/
/**
* Class which does the busines logic for downloading a document
* Class which does the busines logic for reviewing a document
*
* @category DMS
* @package SeedDMS
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2010-2013 Uwe Steinmann
* @copyright Copyright (C) 2010-2023 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_Controller_ReviewDocument extends SeedDMS_Controller_Common {
public function run() {
public function run() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$settings = $this->params['settings'];
$document = $this->params['document'];
$content = $this->params['content'];
$reviewstatus = $this->params['reviewstatus'];
$reviewtype = $this->params['reviewtype'];
$group = $this->params['group'];
$comment = $this->params['comment'];
$file = $this->params['file'];
/* Get the document id and name before removing the document */
$docname = $document->getName();
$documentid = $document->getID();
$reviewtype = $this->params['type'];
$reviewstatus = $this->params['status'];
$reviewcomment = $this->params['comment'];
$reviewfile = $this->params['file'];
$reviewgroup = $this->params['group'];
$overallStatus = $content->getStatus();
$this->oldstatus = $overallStatus['status'];
$this->newstatus = $this->oldstatus;
if(!$this->callHook('preReviewDocument', $content)) {
}
$result = $this->callHook('reviewDocument', $content);
if($result === null) {
if ($reviewtype == "ind") {
$reviewLogID = $content->setReviewByInd($user, $user, $reviewstatus, $comment, $file);
if($reviewLogID === false || 0 > $reviewLogID) {
$this->error = 1;
$this->errormsg = "review_update_failed";
return false;
}
} elseif ($reviewtype == "grp") {
$reviewLogID = $content->setReviewByGrp($group, $user, $reviewstatus, $comment, $file);
if($reviewLogID === false || 0 > $reviewLogID) {
$this->error = 1;
$this->errormsg = "review_update_failed";
return false;
}
$reviewLogID = $content->setReviewByInd($user, $user, $reviewstatus, $reviewcomment, $reviewfile);
} elseif($reviewtype == "grp") {
$reviewLogID = $content->setReviewByGrp($reviewgroup, $user, $reviewstatus, $reviewcomment, $reviewfile);
} else {
$this->errormsg = "review_wrong_type";
return false;
}
if($reviewLogID === false || 0 > $reviewLogID) {
$this->errormsg = "review_update_failed";
return false;
}
}
/* Check to see if the overall status for the document version needs to be
* updated.
*/
$result = $this->callHook('reviewUpdateDocumentStatus', $content);
if($result === null) {
if ($reviewstatus == -1){
if($content->setStatus(S_REJECTED,$comment,$user)) {
if($reviewstatus == -1) {
$this->newstatus = S_REJECTED;
if($content->setStatus(S_REJECTED, $reviewcomment, $user)) {
if(isset($GLOBALS['SEEDDMS_HOOKS']['reviewDocument'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['reviewDocument'] as $hookObj) {
if (method_exists($hookObj, 'postReviewDocument')) {
$hookObj->postReviewDocument(null, $content, S_REJECTED);
}
}
}
}
} else {
$docReviewStatus = $content->getReviewStatus();
if (is_bool($docReviewStatus) && !$docReviewStatus) {
$this->error = 1;
$this->errormsg = "cannot_retrieve_review_snapshot";
return false;
}
@ -91,32 +89,35 @@ class SeedDMS_Controller_ReviewDocument extends SeedDMS_Controller_Common {
if ($reviewCT == $reviewTotal) {
$docApprovalStatus = $content->getApprovalStatus();
if (is_bool($docApprovalStatus) && !$docApprovalStatus) {
$this->error = 1;
$this->errormsg = "cannot_retrieve_approval_snapshot";
return false;
}
$approvalCT = 0;
$approvalTotal = 0;
foreach ($docApprovalStatus as $dastat) {
if ($dastat["status"] == 1) {
foreach($docApprovalStatus as $dastat) {
if($dastat["status"] == 1) {
$approvalCT++;
}
if ($dastat["status"] != -2) {
if($dastat["status"] != -2) {
$approvalTotal++;
}
}
// If the approvals received is less than the approvals total, then
// change status to pending approval.
if ($approvalCT<$approvalTotal) {
$newStatus=S_DRAFT_APP;
}
else {
if($approvalCT < $approvalTotal) {
$this->newstatus = S_DRAFT_APP;
} else {
// Otherwise, change the status to released.
$newStatus=S_RELEASED;
$this->newstatus = S_RELEASED;
}
if ($content->setStatus($newStatus, getMLText("automatic_status_update"), $user)) {
// Send notification to subscribers.
if($content->setStatus($this->newstatus, getMLText("automatic_status_update"), $user)) {
if(isset($GLOBALS['SEEDDMS_HOOKS']['reviewDocument'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['reviewDocument'] as $hookObj) {
if (method_exists($hookObj, 'postReviewDocument')) {
$hookObj->postReviewDocument(null, $content, $this->newstatus);
}
}
}
}
}
}
@ -126,6 +127,5 @@ class SeedDMS_Controller_ReviewDocument extends SeedDMS_Controller_Common {
}
return true;
}
} /* }}} */
}

View File

@ -14,14 +14,14 @@ apache.
Here is a detailed list of requirements:
1. A web server with at least php 7.3
1. A web server with at least php 7.4
2. A mysql database, unless you use SQLite
3. The php installation must have support for `pdo_mysql`, `pdo_pgsql` or `pdo_sqlite`,
`php_gd2`, `php_mbstring`, `php_xml`
4. Depending on the configuration the extensions `php_ldap`, `php_mycrypt`,
`php_gmp`, `php_libsodium` must be installed
`php_gmp`, `php_libsodium`, `php_imagick` must be installed
5. Various command line programms to convert files into text for indexing
pdftotext, catdoc, xls2csv or scconvert, cat, id3 (optional, only needed
pdftotext, catdoc, xls2csv or scconvert, cat, id3 (all optional, only needed
for fulltext search)
6. ImageMagic (the convert program) is needed for creating preview images
7. A bunch of packages from Packagist which all ship with the seeddms-quickstart
@ -29,7 +29,7 @@ Here is a detailed list of requirements:
It is highly recommended to use the quickstart archive
(seeddms-quickstart-x.y.z.tar.gz) because it includes all software packages
(excluding those listing above in item 1. to 6.) for running SeedDMS. Hence,
(excluding those listed above in item 1. to 6.) for running SeedDMS. Hence,
you still need a working web server with PHP and in addition a mysql or
PostgreSQL database unless you intend to use SQLite.
@ -99,7 +99,7 @@ SECURITY CONSIDERATIONS
You should always access your SeedDMS installation through
a secured https connection, unless you precisly know what you are doing.
SeedDMS ships an .htaccess file which already has some common security
SeedDMS ships an `.htaccess` file which already has some common security
http headers set. In order for them to apply you need to activate the
headers module. On Debian/GNU Linux this can be done with

View File

@ -23,8 +23,7 @@ smtp port: 465
Gmail
---------
smtp server: smtp.gmail.com
smtp port: 587
note: you have to turn on 'Less secure app access' in your google account,
otherwise you will not be able to send mail. It will quit with an error
complaining about wrong credentials
smtp server: ssl://smtp.gmail.com
smtp port: 465
note: since June, 2022 you will no longer be able to turn on 'Less secure app access' in your google account. Instead you need to turn on 2-Step Verification first and than
create an App Password (https://support.google.com/accounts/answer/185833)

View File

@ -159,6 +159,7 @@ class SeedDMS_ConversionServiceExec extends SeedDMS_ConversionServiceBase {
/* %s was just added because the commands to convert to text/plain used
* it instead of %f for the input file
* %f = input file
* %if = format (jpg, png, pdf, gif)
* %o = output file
* %m = mime type
* %w = width
@ -175,6 +176,12 @@ class SeedDMS_ConversionServiceExec extends SeedDMS_ConversionServiceBase {
}
return false;
}
if(!empty($ret['stderr'])) {
if($this->logger) {
$this->logger->log('Conversion from '.$this->from.' to '.$this->to.' with cmd "'.$this->cmd.'" failed: '.$ret['stderr'], PEAR_LOG_ERR);
}
return false;
}
$end = microtime(true);
if($this->logger) {
$this->logger->log('Conversion from '.$this->from.' to '.$this->to.' with cmd "'.$this->cmd.'" took '.($end-$start).' sec.', PEAR_LOG_DEBUG);

View File

@ -287,6 +287,8 @@ class Settings { /* {{{ */
var $_enableRecursiveCount = false;
// maximum number of documents or folders when counted recursively
var $_maxRecursiveCount = 10000;
// number of days in the past of the dashboard
var $_daysPastDashboard = 7;
// enable/disable help
var $_enableHelp = true;
// enable/disable language selection menu
@ -578,6 +580,7 @@ class Settings { /* {{{ */
$this->_enableFolderTree = Settings::boolVal($tab["enableFolderTree"]);
$this->_enableRecursiveCount = Settings::boolVal($tab["enableRecursiveCount"]);
$this->_maxRecursiveCount = intval($tab["maxRecursiveCount"]);
$this->_daysPastDashboard = intval($tab["daysPastDashboard"]);
$this->_enableHelp = Settings::boolVal($tab["enableHelp"]);
$this->_enableLanguageSelector = Settings::boolVal($tab["enableLanguageSelector"]);
$this->_enableThemeSelector = Settings::boolVal($tab["enableThemeSelector"]);
@ -981,6 +984,7 @@ class Settings { /* {{{ */
$this->setXMLAttributValue($node, "enableFolderTree", $this->_enableFolderTree);
$this->setXMLAttributValue($node, "enableRecursiveCount", $this->_enableRecursiveCount);
$this->setXMLAttributValue($node, "maxRecursiveCount", $this->_maxRecursiveCount);
$this->setXMLAttributValue($node, "daysPastDashboard", $this->_daysPastDashboard);
$this->setXMLAttributValue($node, "enableHelp", $this->_enableHelp);
$this->setXMLAttributValue($node, "enableLanguageSelector", $this->_enableLanguageSelector);
$this->setXMLAttributValue($node, "enableThemeSelector", $this->_enableThemeSelector);

View File

@ -335,7 +335,7 @@ class SeedDMS_View_Common {
* @param boolean $hsc set to false if htmlspecialchars() shall not be called
* @return string link
*/
protected function html_link($view='', $urlparams=array(), $linkparams=array(), $link, $hsc=true, $nocheck=false, $wrap=array()) { /* {{{ */
protected function html_link($view, $urlparams, $linkparams, $link, $hsc=true, $nocheck=false, $wrap=array()) { /* {{{ */
if(!$nocheck)
if(!$this->check_view_access($view))
return '';

View File

@ -484,7 +484,7 @@ foreach($file_ary as $file) {
$controller->setParam('maxsizeforfulltext', $settings->_maxSizeForFullText);
$controller->setParam('defaultaccessdocs', $settings->_defaultAccessDocs);
if(!$document = $controller()) {
if(!($document = $controller())) {
$err = $controller->getErrorMsg();
if(is_string($err))
$errmsg = getMLText($err);
@ -509,7 +509,7 @@ foreach($file_ary as $file) {
}
}
add_log_line("?name=".$name."&folderid=".$folderid);
add_log_line("add document ".$document->getId()." in folder ".$folder->getId());
}
header("Location:../out/out.ViewFolder.php?folderid=".$folderid."&showtree=".$_POST["showtree"]);

View File

@ -123,7 +123,7 @@ for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
}
}
add_log_line("?name=".$name."&documentid=".$documentid);
add_log_line("add file '".$name."' to document ".$documentid);
header("Location:../out/out.ViewDocument.php?documentid=".$documentid."&currenttab=attachments");

View File

@ -316,7 +316,7 @@ switch($command) {
}
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_move_folder'), 'data'=>''));
add_log_line();
add_log_line("move folder ".$mfolder->getId()." to ".$folder->getId());
} else {
header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>'Error moving folder', 'data'=>''));
@ -362,7 +362,7 @@ switch($command) {
}
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_move_document'), 'data'=>''));
add_log_line();
add_log_line("move document ".$mdocument->getId()." to folder ".$folder->getId());
} else {
header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>'Error moving document', 'data'=>''));
@ -405,7 +405,7 @@ switch($command) {
if($mdocument->remove()) {
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_transfer_content'), 'data'=>''));
add_log_line();
add_log_line("transfer content of document ".$mdocument->getId()." to document ".$targetdoc->getId());
} else {
header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>'Error removing source document', 'data'=>''));
@ -452,7 +452,7 @@ switch($command) {
if($targetdoc->addDocumentLink($mdocument->getID(), $user->getID(), false)) {
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_link_document'), 'data'=>''));
add_log_line();
add_log_line("link document ".$mdocument->getId()." to ".$targetdoc->getId());
} else {
header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>'Error linking document', 'data'=>''));
@ -509,7 +509,7 @@ switch($command) {
}
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_folder_deleted'), 'data'=>''));
add_log_line();
add_log_line("delete folder ".$folder->getId());
} else {
header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>getMLText('error_remove_folder'), 'data'=>''));
@ -554,7 +554,7 @@ switch($command) {
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_deleted'), 'data'=>''));
add_log_line();
add_log_line("delete document ".$document->getId());
} else {
header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>getMLText('error_remove_document')."<br />".getMLText($controller->getErrorMsg()), 'data'=>''));
@ -586,6 +586,7 @@ switch($command) {
} else {
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_unlocked'), 'data'=>''));
add_log_line("unlock document ".$document->getId());
}
} else {
header('Content-Type: application/json');
@ -598,7 +599,7 @@ switch($command) {
} else {
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_locked'), 'data'=>''));
add_log_line();
add_log_line("lock document ".$document->getId());
}
}
} else {
@ -632,7 +633,7 @@ switch($command) {
}
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_name_changed'), 'data'=>''));
add_log_line();
add_log_line("set name '".$_REQUEST['name']."' of document ".$document->getId());
}
} else {
header('Content-Type: application/json');
@ -663,7 +664,7 @@ switch($command) {
} else {
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_mimetype_changed'), 'data'=>''));
add_log_line();
add_log_line("set mimetype '".$realmimetype."' of document ".$document->getId().":".$content->getVersion());
}
} else {
header('Content-Type: application/json');
@ -878,7 +879,7 @@ switch($command) {
}
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_added'), 'data'=>$document->getID()));
add_log_line();
add_log_line("add document ".$document->getId()." in folder ".$folder->getId());
} else {
header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_request_token'), 'data'=>''));
@ -1027,7 +1028,7 @@ switch($command) {
}
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_added'), 'data'=>$document->getID()));
add_log_line();
add_log_line("add file '".$name."' to document ".$document->getId());
}
} else {
header('Content-Type: application/json');

View File

@ -87,64 +87,31 @@ if($_FILES["approvalfile"]["tmp_name"]) {
}
}
$controller->setParam('document', $document);
$controller->setParam('content', $content);
$controller->setParam('approvalstatus', $_POST["approvalStatus"]);
$controller->setParam('approvaltype', $_POST["approvalType"]);
if ($_POST["approvalType"] == "grp") {
$group = $dms->getGroup($_POST['approvalGroup']);
$controller->setParam('comment', $_POST['comment']);
$controller->setParam('type', $_POST['approvalType']);
$controller->setParam('status', $_POST['approvalStatus']);
$controller->setParam('content', $latestContent);
$controller->setParam('file', !empty($_FILES["approvalfile"]["tmp_name"]) ? $_FILES["approvalfile"]["tmp_name"] : '');
$controller->setParam('group', !empty($_POST['approvalGroup']) ? $dms->getGroup($_POST['approvalGroup']) : null);
if(!$controller()) {
$err = $controller->getErrorMsg();
if(is_string($err))
$errmsg = getMLText($err);
elseif(is_array($err)) {
$errmsg = getMLText($err[0], $err[1]);
} else {
$errmsg = $err;
}
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),$errmsg);
} else {
$group = null;
}
if($_FILES["approvalfile"]["tmp_name"])
$file = $_FILES["approvalfile"]["tmp_name"];
else
$file = '';
$controller->setParam('group', $group);
$controller->setParam('comment', $_POST["comment"]);
$controller->setParam('file', $file);
if(!$controller->run()) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText($controller->getErrorMsg()));
}
if ($_POST["approvalType"] == "ind" || $_POST["approvalType"] == "grp") {
// Send an email notification to the document updater.
if($notifier) {
$approvelog = $latestContent->getApproveLog();
$notifier->sendSubmittedApprovalMail($latestContent, $user, $approvelog ? $approvelog[0] : false);
if($controller->oldstatus != $controller->newstatus)
$notifier->sendChangedDocumentStatusMail($latestContent, $user, $controller->oldstatus);
}
}
/* Send notification about status change only if status has actually changed */
$newdocstatus = $content->getStatus();
if($olddocstatus['status'] != $newdocstatus['status']) {
// Send notification to subscribers.
if($notifier) {
$nl=$document->getNotifyList();
$folder = $document->getFolder();
$subject = "document_status_changed_email_subject";
$message = "document_status_changed_email_body";
$params = array();
$params['name'] = $document->getName();
$params['folder_path'] = $folder->getFolderPathPlain();
$params['status'] = getOverallStatusText($olddocstatus['status']).' → '.getOverallStatusText($newdocstatus['status']);
$params['new_status_code'] = $newdocstatus['status'];
$params['old_status_code'] = $olddocstatus['status'];
$params['comment'] = $document->getComment();
$params['username'] = $user->getFullName();
$params['sitename'] = $settings->_siteName;
$params['http_root'] = $settings->_httpRoot;
$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
$notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
foreach ($nl["groups"] as $grp) {
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
}
}
// TODO: if user os not owner send notification to owner
}
add_log_line("?documentid=".$_POST['documentid']."&version=".$_POST['version']."&approvalType=".$_POST['approvalType']."&approvalStatus=".$_POST['approvalStatus']);
header("Location:../out/out.ViewDocument.php?documentid=".$documentid."&currenttab=revapp");

View File

@ -99,7 +99,7 @@ if ($notifier){
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_rm_document')));
add_log_line("?documentid=".$documentid);
add_log_line("delete document ".$documentid);
header("Location:../out/out.ViewFolder.php?folderid=".$folder->getID());

View File

@ -87,30 +87,33 @@ if($_FILES["reviewfile"]["tmp_name"]) {
}
}
$controller->setParam('document', $document);
$controller->setParam('content', $content);
$controller->setParam('reviewstatus', $_POST["reviewStatus"]);
$controller->setParam('reviewtype', $_POST["reviewType"]);
if ($_POST["reviewType"] == "grp") {
$group = $dms->getGroup($_POST['reviewGroup']);
$controller->setParam('comment', $_POST['comment']);
$controller->setParam('type', $_POST['reviewType']);
$controller->setParam('status', $_POST['reviewStatus']);
$controller->setParam('content', $latestContent);
$controller->setParam('file', !empty($_FILES["reviewfile"]["tmp_name"]) ? $_FILES["reviewfile"]["tmp_name"] : '');
$controller->setParam('group', !empty($_POST['reviewGroup']) ? $dms->getGroup($_POST['reviewGroup']) : null);
if(!$controller()) {
$err = $controller->getErrorMsg();
if(is_string($err))
$errmsg = getMLText($err);
elseif(is_array($err)) {
$errmsg = getMLText($err[0], $err[1]);
} else {
$errmsg = $err;
}
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),$errmsg);
} else {
$group = null;
}
if($_FILES["reviewfile"]["tmp_name"])
$file = $_FILES["reviewfile"]["tmp_name"];
else
$file = '';
$controller->setParam('group', $group);
$controller->setParam('comment', $_POST["comment"]);
$controller->setParam('file', $file);
if(!$controller->run()) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText($controller->getErrorMsg()));
}
if ($_POST["reviewType"] == "ind" || $_POST["reviewType"] == "grp") {
if($notifier) {
$reviewlog = $latestContent->getReviewLog();
$notifier->sendSubmittedReviewMail($latestContent, $user, $reviewlog ? $reviewlog[0] : false);
if($controller->oldstatus != $controller->newstatus)
$notifier->sendChangedDocumentStatusMail($latestContent, $user, $controller->oldstatus);
// Notify approvers, if necessary.
if ($controller->newstatus == S_DRAFT_APP) {
$notifier->sendApprovalRequestMail($latestContent, $user);
}
}
}

View File

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

View File

@ -409,7 +409,7 @@ default:
}
}
add_log_line("?documentid=".$documentid);
add_log_line("update document ".$documentid." with version ".$content->getVersion());
header("Location:../out/out.ViewDocument.php?documentid=".$documentid);
?>

View File

@ -24,6 +24,7 @@ if($view) {
$view->setParam('previewConverters', isset($settings->_converters['preview']) ? $settings->_converters['preview'] : array());
$view->setParam('convertToPdf', $settings->_convertToPdf);
$view->setParam('timeout', $settings->_cmdTimeout);
$view->setParam('dayspastdashboard', (int) $settings->_daysPastDashboard);
$view->setParam('accessobject', $accessop);
$view->setParam('xsendfile', $settings->_enableXsendfile);
$view($_GET);

View File

@ -80,6 +80,7 @@ if($view) {
$view->setParam('folder', $folder);
$view->setParam('document', $document);
$view->setParam('version', $content);
$view->setParam('reviewid', (int) $_GET['reviewid']);
$view->setParam('accessobject', $accessop);
$view($_GET);
exit;

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 ApproveDocument view
*
@ -31,7 +26,7 @@
*/
class SeedDMS_View_ApproveDocument extends SeedDMS_Theme_Style {
function js() { /* {{{ */
public function js() { /* {{{ */
header('Content-Type: application/javascript; charset=UTF-8');
parent::jsTranslations(array('js_form_error', 'js_form_errors'));
?>
@ -69,48 +64,10 @@ $(document).ready(function() {
$this->printFileChooserJs();
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
protected function showForm($approvalStatus) { /* {{{ */
$document = $this->params['document'];
$content = $this->params['version'];
$approveid = $this->params['approveid'];
$approvals = $content->getApprovalStatus();
foreach($approvals as $approval) {
if($approval['approveID'] == $approveid) {
$approvalStatus = $approval;
break;
}
}
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/jquery-validation/jquery.validate.js"></script>'."\n", 'js');
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/styles/validation-default.js"></script>'."\n", 'js');
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document);
$this->contentHeading(getMLText("add_approval"));
// Display the Approval form.
$approvaltype = ($approvalStatus['type'] == 0) ? 'ind' : 'grp';
if($approvalStatus["status"]!=0) {
print "<table class=\"table table-condensed table-sm\"><thead><tr>";
print "<th>".getMLText("status")."</th>";
print "<th>".getMLText("comment")."</th>";
print "<th>".getMLText("last_update")."</th>";
print "</tr></thead><tbody><tr>";
print "<td>";
printApprovalStatusText($approvalStatus["status"]);
print "</td>";
print "<td>".htmlspecialchars($approvalStatus["comment"])."</td>";
$indUser = $dms->getUser($approvalStatus["userID"]);
print "<td>".$approvalStatus["date"]." - ". htmlspecialchars($indUser->getFullname()) ."</td>";
print "</tr></tbody></table><br>\n";
}
?>
<form class="form-horizontal" method="post" action="../op/op.ApproveDocument.php" id="form<?= $approvaltype ?>" name="form<?= $approvaltype ?>" enctype="multipart/form-data">
<?php echo createHiddenFieldWithKey('approvedocument'); ?>
@ -155,6 +112,50 @@ $(document).ready(function() {
<input type='hidden' name='version' value='<?php echo $content->getVersion(); ?>'/>
</form>
<?php
} /* }}} */
public function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$content = $this->params['version'];
$approveid = $this->params['approveid'];
$approvals = $content->getApprovalStatus();
foreach($approvals as $approval) {
if($approval['approveID'] == $approveid) {
$approvalStatus = $approval;
break;
}
}
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/jquery-validation/jquery.validate.js"></script>'."\n", 'js');
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/styles/validation-default.js"></script>'."\n", 'js');
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document);
$this->contentHeading(getMLText("add_approval"));
// Display the Approval form.
if($approvalStatus["status"]!=0) {
print "<table class=\"table table-condensed table-sm\"><thead><tr>";
print "<th>".getMLText("status")."</th>";
print "<th>".getMLText("comment")."</th>";
print "<th>".getMLText("last_update")."</th>";
print "</tr></thead><tbody><tr>";
print "<td>";
printApprovalStatusText($approvalStatus["status"]);
print "</td>";
print "<td>".htmlspecialchars($approvalStatus["comment"])."</td>";
$indUser = $dms->getUser($approvalStatus["userID"]);
print "<td>".$approvalStatus["date"]." - ". htmlspecialchars($indUser->getFullname()) ."</td>";
print "</tr></tbody></table><br>\n";
}
$this->showForm($approvalStatus);
$this->contentEnd();
$this->htmlEndPage();
} /* }}} */

View File

@ -1638,11 +1638,11 @@ $(document).ready(function() {
echo self::getFileChooserHtml($varname, $multiple, $accept);
} /* }}} */
function printDateChooser($defDate = '', $varName, $lang='', $dateformat='', $startdate='', $enddate='', $weekstart=null) { /* {{{ */
function printDateChooser($defDate, $varName, $lang='', $dateformat='', $startdate='', $enddate='', $weekstart=null) { /* {{{ */
echo self::getDateChooser($defDate, $varName, $lang, $dateformat, $startdate, $enddate, $weekstart);
} /* }}} */
function getDateChooser($defDate = '', $varName, $lang='', $dateformat='', $startdate='', $enddate='', $weekstart=null, $placeholder='', $nogroup=false) { /* {{{ */
function getDateChooser($defDate, $varName, $lang='', $dateformat='', $startdate='', $enddate='', $weekstart=null, $placeholder='', $nogroup=false) { /* {{{ */
if(!$dateformat)
$dateformat = getConvertDateFormat();
$content = '';
@ -1659,7 +1659,7 @@ $(document).ready(function() {
return $content;
} /* }}} */
function __printDateChooser($defDate = -1, $varName) { /* {{{ */
function __printDateChooser($defDate, $varName) { /* {{{ */
if ($defDate == -1)
$defDate = mktime();

View File

@ -53,6 +53,7 @@ class SeedDMS_View_Calendar extends SeedDMS_Theme_Style {
$previewer->setConversionMgr($conversionmgr);
else
$previewer->setConverters($previewconverters);
$document->verifyLastestContentExpriry();
echo $this->documentListRow($document, $previewer);
echo "</tbody>\n</table>\n";
}
@ -264,7 +265,7 @@ class SeedDMS_View_Calendar extends SeedDMS_Theme_Style {
if ($item['document']->getAccessMode($user) >= M_READ)
$arr[] = array(
'start'=>$item['date'],
'title'=>$item['document']->getName()." (".$item['version'].")\n".getOverallStatusText($item['status']), //$item['msg'],
'title'=>$item['document']->getName().(isset($item['version']) ? " (".$item['version'].")" : "").(isset($item['status']) ? "\n".getOverallStatusText($item['status']) : ''),
'allDay'=>isset($item['allday']) ? $item['allday'] : false,
'color'=>$color,
'type'=>$item['type'],
@ -472,6 +473,21 @@ $(document).ready(function() {
$this->columnStart(8);
?>
<div id="calendar" style="margin-bottom: 20px;"></div>
<div id="cal_legend">
<?php
$legend = [];
$legend[] = ['color'=>'ff4455', 'text'=>'expired'];
$legend[] = ['color'=>'20a820', 'text'=>'updated'];
$legend[] = ['color'=>'c3bf00', 'text'=>'timeline_add_file'];
$legend[] = ['color'=>'129a02', 'text'=>'released'];
$legend[] = ['color'=>'a8a8a8', 'text'=>'status_change'];
$legend[] = ['color'=>'20a8a8', 'text'=>'undefined'];
$legend[] = ['color'=>'3a87ad', 'text'=>'event'];
foreach($legend as $item) {
echo "<span style='margin-right: 1em;'><i class='fa fa-circle' style='color: #".$item['color'].";'></i> ".getMLText($item['text'])."</span>";
}
?>
</div>
<?php
$this->columnEnd();
$this->columnStart(4);

View File

@ -66,6 +66,7 @@ class SeedDMS_View_Dashboard extends SeedDMS_Theme_Style {
$previewwidth = $this->params['previewWidthList'];
$previewconverters = $this->params['previewConverters'];
$timeout = $this->params['timeout'];
$dayspastdashboard = $this->params['dayspastdashboard'];
$xsendfile = $this->params['xsendfile'];
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
@ -75,7 +76,7 @@ class SeedDMS_View_Dashboard extends SeedDMS_Theme_Style {
$previewer->setConverters($previewconverters);
echo $this->contentHeading(getMLText('new_documents'));
$documents = $dms->getLatestChanges('newdocuments', mktime(0, 0, 0)-7*86400, time());
$documents = $dms->getLatestChanges('newdocuments', mktime(0, 0, 0)-$dayspastdashboard*86400, time());
if (count($documents) > 0) {
$this->printList($documents, $previewer);
}
@ -89,6 +90,7 @@ class SeedDMS_View_Dashboard extends SeedDMS_Theme_Style {
$previewwidth = $this->params['previewWidthList'];
$previewconverters = $this->params['previewConverters'];
$timeout = $this->params['timeout'];
$dayspastdashboard = $this->params['dayspastdashboard'];
$xsendfile = $this->params['xsendfile'];
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
@ -98,7 +100,7 @@ class SeedDMS_View_Dashboard extends SeedDMS_Theme_Style {
$previewer->setConverters($previewconverters);
echo $this->contentHeading(getMLText('updated_documents'));
$documents = $dms->getLatestChanges('updateddocuments', mktime(0, 0, 0)-7*86400, time());
$documents = $dms->getLatestChanges('updateddocuments', mktime(0, 0, 0)-$dayspastdashboard*86400, time());
if (count($documents) > 0) {
$this->printList($documents, $previewer);
}
@ -112,6 +114,7 @@ class SeedDMS_View_Dashboard extends SeedDMS_Theme_Style {
$previewwidth = $this->params['previewWidthList'];
$previewconverters = $this->params['previewConverters'];
$timeout = $this->params['timeout'];
$dayspastdashboard = $this->params['dayspastdashboard'];
$xsendfile = $this->params['xsendfile'];
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
@ -121,7 +124,7 @@ class SeedDMS_View_Dashboard extends SeedDMS_Theme_Style {
$previewer->setConverters($previewconverters);
echo $this->contentHeading(getMLText('status_change'));
$documents = $dms->getLatestChanges('statuschange', mktime(0, 0, 0)-7*86400, time());
$documents = $dms->getLatestChanges('statuschange', mktime(0, 0, 0)-$dayspastdashboard*86400, time());
if (count($documents) > 0) {
$this->printList($documents, $previewer);
}

View File

@ -215,9 +215,10 @@ class SeedDMS_View_ExtensionMgr extends SeedDMS_Theme_Style {
$errmsgs = array();
foreach($extconf as $extname=>$extconf) {
$errmsgs = array();
$check = $extmgr->checkExtensionByDir($extname);
if(!$settings->extensionIsDisabled($extname)) {
// if(!isset($extconf['disable']) || $extconf['disable'] == false) {
if(!$extmgr->checkExtensionByDir($extname))
if(!$check)
echo "<tr class=\"table-danger error\" ref=\"".$extname."\">";
else
echo "<tr class=\"table-success success\" ref=\"".$extname."\">";
@ -250,7 +251,7 @@ class SeedDMS_View_ExtensionMgr extends SeedDMS_Theme_Style {
echo "<a href=\"../out/out.Settings.php?currenttab=extensions#".$extname."\" title=\"".getMLText('configure_extension')."\"><i class=\"fa fa-cogs\"></i></a>";
if($settings->_enableExtensionDownload)
echo "<form style=\"display: inline-block; margin: 0px;\" method=\"post\" action=\"../op/op.ExtensionMgr.php\" id=\"".$extname."-download\">".createHiddenFieldWithKey('extensionmgr')."<input type=\"hidden\" name=\"action\" value=\"download\" /><input type=\"hidden\" name=\"extname\" value=\"".$extname."\" /><a class=\"download\" data-extname=\"".$extname."\" title=\"".getMLText('download_extension')."\"><i class=\"fa fa-download\"></i></a></form>";
if(is_writeable($settings->_configFilePath)) {
if(is_writeable($settings->_configFilePath) && $check) {
if(!$settings->extensionIsDisabled($extname)) {
echo ' <a href="#" class="toggle" data-extname="'.$extname.'" title="'.getMLText('disable_extension').'"><i class="fa fa-check"</i></a>';
} else {

View File

@ -61,6 +61,7 @@ document.form1.email.focus();
$this->htmlStartPage(getMLText("password_forgotten"), "passwordforgotten");
$this->globalBanner();
$this->contentStart();
echo "<div id=\"login_wrapper\">\n";
$this->pageNavigation(getMLText("password_forgotten"));
?>
@ -101,6 +102,7 @@ document.form1.email.focus();
</form>
<p><a href="../out/out.Login.php"><?php echo getMLText("login"); ?></a></p>
<?php
echo "</div>\n";
$this->contentEnd();
$this->htmlEndPage();
} /* }}} */

View File

@ -69,47 +69,10 @@ $(document).ready(function() {
$this->printFileChooserJs();
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
protected function showForm($reviewStatus) { /* {{{ */
$document = $this->params['document'];
$content = $this->params['version'];
$reviews = $content->getReviewStatus();
foreach($reviews as $review) {
if($review['reviewID'] == $_GET['reviewid']) {
$reviewStatus = $review;
break;
}
}
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/jquery-validation/jquery.validate.js"></script>'."\n", 'js');
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/styles/validation-default.js"></script>'."\n", 'js');
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document);
$this->contentHeading(getMLText("submit_review"));
// Display the Review form.
$reviewtype = ($reviewStatus['type'] == 0) ? 'ind' : 'grp';
if($reviewStatus["status"]!=0) {
print "<table class=\"table table-condensed table-sm\"><thead><tr>";
print "<th>".getMLText("status")."</th>";
print "<th>".getMLText("comment")."</th>";
print "<th>".getMLText("last_update")."</th>";
print "</tr></thead><tbody><tr>";
print "<td>";
printReviewStatusText($reviewStatus["status"]);
print "</td>";
print "<td>".htmlspecialchars($reviewStatus["comment"])."</td>";
$indUser = $dms->getUser($reviewStatus["userID"]);
print "<td>".$reviewStatus["date"]." - ". htmlspecialchars($indUser->getFullname()) ."</td>";
print "</tr></tbody></table><br>\n";
}
?>
<form class="form-horizontal" method="post" action="../op/op.ReviewDocument.php" id="form<?= $reviewtype ?>" name="form<?= $reviewtype ?>" enctype="multipart/form-data">
<?php echo createHiddenFieldWithKey('reviewdocument'); ?>
@ -154,6 +117,50 @@ $(document).ready(function() {
<input type='hidden' name='version' value='<?php echo $content->getVersion() ?>'/>
</form>
<?php
} /* }}} */
public function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$content = $this->params['version'];
$reviewid = $this->params['reviewid'];
$reviews = $content->getReviewStatus();
foreach($reviews as $review) {
if($review['reviewID'] == $reviewid) {
$reviewStatus = $review;
break;
}
}
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/jquery-validation/jquery.validate.js"></script>'."\n", 'js');
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/styles/validation-default.js"></script>'."\n", 'js');
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document);
$this->contentHeading(getMLText("submit_review"));
if($reviewStatus["status"]!=0) {
print "<table class=\"table table-condensed table-sm\"><thead><tr>";
print "<th>".getMLText("status")."</th>";
print "<th>".getMLText("comment")."</th>";
print "<th>".getMLText("last_update")."</th>";
print "</tr></thead><tbody><tr>";
print "<td>";
printReviewStatusText($reviewStatus["status"]);
print "</td>";
print "<td>".htmlspecialchars($reviewStatus["comment"])."</td>";
$indUser = $dms->getUser($reviewStatus["userID"]);
print "<td>".$reviewStatus["date"]." - ". htmlspecialchars($indUser->getFullname()) ."</td>";
print "</tr></tbody></table><br>\n";
}
// Display the Review form.
$this->showForm($reviewStatus);
$this->contentEnd();
$this->htmlEndPage();
} /* }}} */

View File

@ -386,6 +386,7 @@ if(($kkk = $this->callHook('getFullSearchEngine')) && is_array($kkk))
<?php $this->showConfigOption('settings_expandFolderTree', 'expandFolderTree', array(' 0'=>'settings_expandFolderTree_val0', ' 1'=>'settings_expandFolderTree_val1', ' 2'=>'settings_expandFolderTree_val2'), false, true); ?>
<?php $this->showConfigCheckbox('settings_enableRecursiveCount', 'enableRecursiveCount'); ?>
<?php $this->showConfigText('settings_maxRecursiveCount', 'maxRecursiveCount'); ?>
<?php $this->showConfigText('settings_daysPastDashboard', 'daysPastDashboard'); ?>
<?php $this->showConfigCheckbox('settings_enableLanguageSelector', 'enableLanguageSelector'); ?>
<?php $this->showConfigCheckbox('settings_enableHelp', 'enableHelp'); ?>
<?php $this->showConfigCheckbox('settings_enableThemeSelector', 'enableThemeSelector'); ?>

View File

@ -692,7 +692,7 @@ $(document).ready( function() {
if(is_string($item))
echo "<li class=\"nav-item\">".$item."</li>";
elseif(is_array($item)) {
echo "<li class=\"nav-item m-1\"><a class=\"_nav-link btn btn-mini btn-outline-primary btn-sm".(!empty($item['class']) ? ' '. $item['class'] : '')."\"".(isset($item['link']) ? " href=\"".$item['link']."\"" : '').(!empty($item['target']) ? ' target="'.$item['target'].'"' : '');
echo "<li class=\"nav-item m-1\"><a class=\"_nav-link btn btn-mini btn-outline-primary btn-sm".(!empty($item['class']) ? ' '. $item['class'] : '')."\"".(isset($item['link']) ? " href=\"".$item['link']."\"" : '').(!empty($item['target']) ? ' target="'.$item['target'].'"' : '').(!empty($item['title']) ? ' title="'.getMLText($item['title']).'"' : '');
if(!empty($item['attributes'])) {
foreach($item['attributes'] as $attr) {
echo ' '.$attr[0].'="'.$attr[1].'"';

View File

@ -819,7 +819,7 @@ function onAddClipboard(ev) { /* {{{ */
}
}
SeedDMSUpload.handleFileUpload = function(files,obj,statusbar) {
SeedDMSUpload.handleFileUpload = function(items,obj,statusbar) {
/* target is set for the quick upload area */
var target_id = obj.data('target');
var target_type = 'folder';
@ -839,31 +839,45 @@ function onAddClipboard(ev) { /* {{{ */
}
}
if(target_type == 'folder' && target_id) {
for (var i = 0; i < files.length; i++) {
if(files[i].size <= maxFileSize) {
var fd = new FormData();
fd.append('targettype', target_type);
fd.append('folderid', target_id);
fd.append('formtoken', obj.data('uploadformtoken'));
if (typeof obj.data('comment') !== 'undefined') {
fd.append('comment', obj.data('comment'));
}
if (typeof obj.data('keywords') !== 'undefined') {
fd.append('keywords', obj.data('keywords'));
}
fd.append('userfile', files[i]);
fd.append('command', 'uploaddocument');
this.getFormData(fd, obj.data('attributes'), 'attributes');
this.getFormData(fd, obj.data('categories'), 'categories');
// fd.append('path', files[i].webkitRelativePath);
for (var i = 0; i < items.length; i++) {
var item = items[i].webkitGetAsEntry();
if (item.isFile) {
item.file(function(file) {
if(file.size <= maxFileSize) {
var fd = new FormData();
fd.append('targettype', target_type);
fd.append('folderid', target_id);
fd.append('formtoken', obj.data('uploadformtoken'));
if (typeof obj.data('comment') !== 'undefined') {
fd.append('comment', obj.data('comment'));
}
if (typeof obj.data('keywords') !== 'undefined') {
fd.append('keywords', obj.data('keywords'));
}
fd.append('userfile', file);
fd.append('command', 'uploaddocument');
SeedDMSUpload.getFormData(fd, obj.data('attributes'), 'attributes');
SeedDMSUpload.getFormData(fd, obj.data('categories'), 'categories');
// fd.append('path', file.webkitRelativePath);
statusbar.parent().show();
var status = new SeedDMSUpload.createStatusbar(statusbar);
status.setFileNameSize(files[i].name,files[i].size);
SeedDMSUpload.sendFileToServer(fd,status,afteruploadfunc);
} else {
statusbar.parent().show();
var status = new SeedDMSUpload.createStatusbar(statusbar);
status.setFileNameSize(file.name,file.size);
SeedDMSUpload.sendFileToServer(fd,status,afteruploadfunc);
} else {
noty({
text: maxFileSizeMsg + '<br /><em>' + file.name + ' (' + file.size + ' Bytes)</em>',
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 5000
});
}
});
} else if(item.isDirectory) {
noty({
text: maxFileSizeMsg + '<br /><em>' + files[i].name + ' (' + files[i].size + ' Bytes)</em>',
text: 'Folders currently not supported',
type: 'error',
dismissQueue: true,
layout: 'topRight',
@ -945,9 +959,12 @@ $(document).ready(function() { /* {{{ */
$(this).css('border', '0px dotted #0B85A1');
e.preventDefault();
var files = e.originalEvent.dataTransfer.files;
var items = e.originalEvent.dataTransfer.items;
//We need to send dropped files to Server
SeedDMSUpload.handleFileUpload(files, $(this), $(this));
if(items.length > 0) {
SeedDMSUpload.handleFileUpload(items, $(this), $(this));
}
});
$(document).on('dragenter', '.droptarget', function (e) {
@ -974,9 +991,10 @@ $(document).ready(function() { /* {{{ */
target_name = $(e.currentTarget).data('name')+''; // Force this to be a string
if(target_type == 'folder') {
var files = e.originalEvent.dataTransfer.files;
if(files.length > 0) {
var items = e.originalEvent.dataTransfer.items;
if(items.length > 0) {
// console.log('Drop '+files.length+' files on '+target_type+' '+target_id);
SeedDMSUpload.handleFileUpload(files,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/);
SeedDMSUpload.handleFileUpload(items,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/);
} else {
var source_info = JSON.parse(e.originalEvent.dataTransfer.getData("text"));
source_type = source_info.type;
@ -1075,9 +1093,10 @@ $(document).ready(function() { /* {{{ */
}
} else if(target_type == 'document') {
var files = e.originalEvent.dataTransfer.files;
if(files.length > 0) {
var items = e.originalEvent.dataTransfer.items;
if(items.length > 0) {
// console.log('Drop '+files.length+' files on '+target_type+' '+target_id);
SeedDMSUpload.handleFileUpload(files,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/);
SeedDMSUpload.handleFileUpload(items,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/);
} else {
var source_info = JSON.parse(e.originalEvent.dataTransfer.getData("text"));
source_type = source_info.type;
@ -1160,8 +1179,9 @@ $(document).ready(function() { /* {{{ */
}
} else if(target_type == 'attachment') {
var files = e.originalEvent.dataTransfer.files;
if(files.length > 0) {
SeedDMSUpload.handleFileUpload(files,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/);
var items = e.originalEvent.dataTransfer.items;
if(items.length > 0) {
SeedDMSUpload.handleFileUpload(items,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/);
}
}
});

View File

@ -1590,11 +1590,11 @@ $(document).ready(function() {
echo self::getFileChooserHtml($varname, $multiple, $accept);
} /* }}} */
function printDateChooser($defDate = '', $varName, $lang='', $dateformat='', $startdate='', $enddate='', $weekstart=null) { /* {{{ */
function printDateChooser($defDate, $varName, $lang='', $dateformat='', $startdate='', $enddate='', $weekstart=null) { /* {{{ */
echo self::getDateChooser($defDate, $varName, $lang, $dateformat, $startdate, $enddate, $weekstart);
} /* }}} */
function getDateChooser($defDate = '', $varName, $lang='', $dateformat='', $startdate='', $enddate='', $weekstart=null, $placeholder='', $nogroup=false) { /* {{{ */
function getDateChooser($defDate, $varName, $lang='', $dateformat='', $startdate='', $enddate='', $weekstart=null, $placeholder='', $nogroup=false) { /* {{{ */
if(!$dateformat)
$dateformat = getConvertDateFormat();
$content = '';
@ -1610,7 +1610,7 @@ $(document).ready(function() {
return $content;
} /* }}} */
function __printDateChooser($defDate = -1, $varName) { /* {{{ */
function __printDateChooser($defDate, $varName) { /* {{{ */
if ($defDate == -1)
$defDate = mktime();

View File

@ -3,7 +3,7 @@ body { /* Add top padding for full-width layout */
}
#login_wrapper {
margin: auto auto;
width: 360px;
width: 460px;
}
@media (max-width: 575px) {
#login_wrapper {

View File

@ -763,7 +763,7 @@ function onAddClipboard(ev) { /* {{{ */
timeout: 1500
});
if(editBtnLabel)
status.statusbar.after($('<a href="'+seeddms_webroot+'out/out.EditDocument.php?documentid=' + data.data + '" class="btn btn-mini btn-primary">' + editBtnLabel + '</a>'));
status.statusbar.after($('<a href="'+seeddms_webroot+'out/out.EditDocument.php?documentid=' + data.data + '" class="btn btn-mini btn-sm btn-primary">' + editBtnLabel + '</a>'));
if(callback) {
callback();
}
@ -793,7 +793,7 @@ function onAddClipboard(ev) { /* {{{ */
this.filename = $("<div class='filename'></div>").appendTo(this.statusbar);
this.size = $("<div class='filesize'></div>").appendTo(this.statusbar);
this.progressBar = $("<div class='progress'><div class='bar bg-success'></div></div>").appendTo(this.statusbar);
this.abort = $("<div class='btn btn-mini btn-danger'>" + abortBtnLabel + "</div>").appendTo(this.statusbar);
this.abort = $("<div class='btn btn-mini btn-sm btn-danger'>" + abortBtnLabel + "</div>").appendTo(this.statusbar);
// $('.statusbar').empty();
obj.after(this.statusbar);
this.setFileNameSize = function(name,size) {
@ -850,7 +850,7 @@ function onAddClipboard(ev) { /* {{{ */
}
}
SeedDMSUpload.handleFileUpload = function(files,obj,statusbar) {
SeedDMSUpload.handleFileUpload = function(items,obj,statusbar) {
/* target is set for the quick upload area */
var target_id = obj.data('target');
var target_type = 'folder';
@ -870,37 +870,57 @@ function onAddClipboard(ev) { /* {{{ */
}
}
if(target_type == 'folder' && target_id) {
for (var i = 0; i < files.length; i++) {
if(files[i].size <= maxFileSize) {
var fd = new FormData();
fd.append('targettype', target_type);
fd.append('folderid', target_id);
fd.append('formtoken', obj.data('uploadformtoken'));
if (typeof obj.data('comment') !== 'undefined') {
fd.append('comment', obj.data('comment'));
}
if (typeof obj.data('keywords') !== 'undefined') {
fd.append('keywords', obj.data('keywords'));
}
fd.append('userfile', files[i]);
fd.append('command', 'uploaddocument');
this.getFormData(fd, obj.data('attributes'), 'attributes');
this.getFormData(fd, obj.data('categories'), 'categories');
// fd.append('path', files[i].webkitRelativePath);
for (var i = 0; i < items.length; i++) {
var item = items[i]; //.webkitGetAsEntry();
if (item.isFile) {
item.file(function(file) {
if(file.size <= maxFileSize) {
var fd = new FormData();
fd.append('targettype', target_type);
fd.append('folderid', target_id);
fd.append('formtoken', obj.data('uploadformtoken'));
if (typeof obj.data('comment') !== 'undefined') {
fd.append('comment', obj.data('comment'));
}
if (typeof obj.data('keywords') !== 'undefined') {
fd.append('keywords', obj.data('keywords'));
}
fd.append('userfile', file);
fd.append('command', 'uploaddocument');
SeedDMSUpload.getFormData(fd, obj.data('attributes'), 'attributes');
SeedDMSUpload.getFormData(fd, obj.data('categories'), 'categories');
// fd.append('path', file.webkitRelativePath);
statusbar.parent().show();
var status = new SeedDMSUpload.createStatusbar(statusbar);
status.setFileNameSize(files[i].name,files[i].size);
SeedDMSUpload.sendFileToServer(fd,status,afteruploadfunc);
} else {
statusbar.parent().show();
var status = new SeedDMSUpload.createStatusbar(statusbar);
status.setFileNameSize(file.name,file.size);
SeedDMSUpload.sendFileToServer(fd,status,afteruploadfunc);
} else {
noty({
text: maxFileSizeMsg + '<br /><em>' + file.name + ' (' + file.size + ' Bytes)</em>',
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 5000
});
}
});
} else if(item.isDirectory) {
var dirReader = item.createReader();
dirReader.readEntries(function(entries) {
SeedDMSUpload.handleFileUpload(entries, obj, statusbar);
});
/*
noty({
text: maxFileSizeMsg + '<br /><em>' + files[i].name + ' (' + files[i].size + ' Bytes)</em>',
text: 'Folders currently not supported',
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 5000
});
*/
}
}
} else if(target_type == 'document' && target_id) {
@ -976,9 +996,20 @@ $(document).ready(function() { /* {{{ */
$(this).css('border', '0px dotted #0B85A1');
e.preventDefault();
var files = e.originalEvent.dataTransfer.files;
var items = e.originalEvent.dataTransfer.items;
//We need to send dropped files to Server
SeedDMSUpload.handleFileUpload(files, $(this), $(this));
console.log(items[0]);
console.log(items[0].webkitGetAsEntry());
newitems = [];
if(items.length > 0) {
for (var i=0; i<items.length; i++) {
newitems.push(items[i].webkitGetAsEntry());
}
console.log(newitems);
SeedDMSUpload.handleFileUpload(newitems, $(this), $(this));
}
});
$(document).on('dragenter', '.droptarget', function (e) {
@ -1005,9 +1036,14 @@ $(document).ready(function() { /* {{{ */
target_name = $(e.currentTarget).data('name')+''; // Force this to be a string
if(target_type == 'folder') {
var files = e.originalEvent.dataTransfer.files;
if(files.length > 0) {
var items = e.originalEvent.dataTransfer.items;
if(items.length > 0) {
// console.log('Drop '+files.length+' files on '+target_type+' '+target_id);
SeedDMSUpload.handleFileUpload(files,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/);
newitems = [];
for (var i=0; i<items.length; i++) {
newitems.push(items[i].webkitGetAsEntry());
}
SeedDMSUpload.handleFileUpload(newitems,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/);
} else {
var source_info = JSON.parse(e.originalEvent.dataTransfer.getData("text"));
source_type = source_info.type;
@ -1118,9 +1154,14 @@ $(document).ready(function() { /* {{{ */
}
} else if(target_type == 'document') {
var files = e.originalEvent.dataTransfer.files;
if(files.length > 0) {
var items = e.originalEvent.dataTransfer.items;
if(items.length > 0) {
// console.log('Drop '+files.length+' files on '+target_type+' '+target_id);
SeedDMSUpload.handleFileUpload(files,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/);
newitems = [];
for (var i=0; i<items.length; i++) {
newitems.push(items[i].webkitGetAsEntry());
}
SeedDMSUpload.handleFileUpload(newitems,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/);
} else {
var source_info = JSON.parse(e.originalEvent.dataTransfer.getData("text"));
source_type = source_info.type;
@ -1210,8 +1251,13 @@ $(document).ready(function() { /* {{{ */
}
} else if(target_type == 'attachment') {
var files = e.originalEvent.dataTransfer.files;
if(files.length > 0) {
SeedDMSUpload.handleFileUpload(files,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/);
var items = e.originalEvent.dataTransfer.items;
if(items.length > 0) {
newitems = [];
for (var i=0; i<items.length; i++) {
newitems.push(items[i].webkitGetAsEntry());
}
SeedDMSUpload.handleFileUpload(newitems,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/);
}
}
});