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

This commit is contained in:
Uwe Steinmann 2022-04-29 18:32:59 +02:00
commit 8907c2f20a
9 changed files with 45 additions and 46 deletions

View File

@ -412,7 +412,7 @@ class Settings { /* {{{ */
* @param string $var value
* @return true/false
*/
function boolVal($var) { /* {{{ */
protected static function boolVal($var) { /* {{{ */
$var = strtolower(strval($var));
switch ($var) {
case 'true':
@ -465,7 +465,7 @@ class Settings { /* {{{ */
* @param string $stringValue string value
*
*/
function setViewOnlineFileTypesFromString($stringValue) { /* {{{ */
protected function setViewOnlineFileTypesFromString($stringValue) { /* {{{ */
$this->_viewOnlineFileTypes = explode(";", $stringValue);
} /* }}} */
@ -475,7 +475,7 @@ class Settings { /* {{{ */
* @return string value
*
*/
function getViewOnlineFileTypesToString() { /* {{{ */
protected function getViewOnlineFileTypesToString() { /* {{{ */
return implode(";", $this->_viewOnlineFileTypes);
} /* }}} */
@ -485,7 +485,7 @@ class Settings { /* {{{ */
* @param string $stringValue string value
*
*/
function setEditOnlineFileTypesFromString($stringValue) { /* {{{ */
protected function setEditOnlineFileTypesFromString($stringValue) { /* {{{ */
$this->_editOnlineFileTypes = explode(";", $stringValue);
} /* }}} */
@ -495,7 +495,7 @@ class Settings { /* {{{ */
* @return string value
*
*/
function getEditOnlineFileTypesToString() { /* {{{ */
protected function getEditOnlineFileTypesToString() { /* {{{ */
return implode(";", $this->_editOnlineFileTypes);
} /* }}} */
@ -1279,7 +1279,7 @@ class Settings { /* {{{ */
* If none was found a final try will be made checking /etc/seeddms
* @return NULL|string config directory
*/
static function getConfigDir() { /* {{{ */
protected static function getConfigDir() { /* {{{ */
if(defined("SEEDDMS_CONFIG_FILE"))
return dirname(SEEDDMS_CONFIG_FILE);
elseif(getenv("SEEDDMS_CONFIG_FILE"))
@ -1781,5 +1781,22 @@ class Settings { /* {{{ */
$this->_extensions[$extname]['__disable__'] = true;
} /* }}} */
/**
* Get maximum upload size
*
* Determine the maximum upload size by checking the php config
* variables upload_max_filesize, post_max_size and the seeddms
* setting maxUploadSize
* @return int
*/
public function getMaximumUploadSize() { /* {{{ */
$mus = [];
$mus[] = SeedDMS_Core_File::parse_filesize(ini_get("upload_max_filesize"));
$mus[] = SeedDMS_Core_File::parse_filesize(ini_get("post_max_size"));
if(is_numeric($this->_maxUploadSize) && $this->_maxUploadSize > 0)
$mus[] = SeedDMS_Core_File::parse_filesize($this->_maxUploadSize);
return min($mus);
} /* }}} */
} /* }}} */

View File

@ -152,7 +152,7 @@ class UI extends UI_Default {
$view->setParam('workflowmode', $settings->_workflowMode);
$view->setParam('checkoutdir', $settings->_checkOutDir);
$view->setParam('partitionsize', SeedDMS_Core_File::parse_filesize( $settings->_partitionSize));
$view->setParam('maxuploadsize', SeedDMS_Core_File::parse_filesize($settings->_maxUploadSize));
$view->setParam('maxuploadsize', $settings->getMaximumUploadSize());
$view->setParam('showmissingtranslations', $settings->_showMissingTranslations);
$view->setParam('defaultsearchmethod', $settings->_defaultSearchMethod);
$view->setParam('cachedir', $settings->_cacheDir);

View File

@ -41,12 +41,23 @@ function getConvertDateFormat() { /* {{{ */
return 'yyyy-mm-dd';
} /* }}} */
/**
* Return a human readable date string
*
* This function formats a timestamp according to the date format
* settings. If no timestamp is passed the current date is used.
* If null or an empty string is passed, then an empty string
* is returned. If $timestamp is numeric it will be taken as a unix
* timestamp. If $timestamp is a string it will be parѕed with strtotime().
*/
function getReadableDate($timestamp=0) { /* {{{ */
global $settings;
if(!$timestamp)
if($timestamp === 0)
$timestamp = time();
elseif(!is_numeric($timestamp))
elseif($timestamp && is_string($timestamp))
$timestamp = strtotime($timestamp);
elseif(!is_numeric($timestamp))
return '';
if($settings->_dateformat)
return date($settings->_dateformat, $timestamp);
else

View File

@ -186,11 +186,7 @@ console.log(params);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true), "view_folder", $folder);
$mus2 = SeedDMS_Core_File::parse_filesize(ini_get("upload_max_filesize"));
if($maxuploadsize && $maxuploadsize < $mus2)
$msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($maxuploadsize);
else
$msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($mus2);
$msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($maxuploadsize);
$this->warningMsg($msg);
$this->contentHeading(getMLText("add_document"));

View File

@ -126,11 +126,7 @@ $(document).ready( function() {
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document);
$this->contentHeading(getMLText("linked_files"));
$mus2 = SeedDMS_Core_File::parse_filesize(ini_get("upload_max_filesize"));
if($maxuploadsize && $maxuploadsize < $mus2)
$msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($maxuploadsize);
else
$msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($mus2);
$msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($maxuploadsize);
$this->warningMsg($msg);
?>

View File

@ -197,26 +197,8 @@ console.log(element);
}
}
if($enablelargefileupload) {
if($maxuploadsize) {
$msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($maxuploadsize);
} else {
$msg = '';
}
} else {
$msg = getMLText("max_upload_size").": ".ini_get( "upload_max_filesize");
}
$mus2 = SeedDMS_Core_File::parse_filesize(ini_get("upload_max_filesize"));
if($maxuploadsize && $maxuploadsize < $mus2)
$msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($maxuploadsize);
else
$msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($mus2);
if(0 && $enablelargefileupload) {
$msg .= "<p>".sprintf(getMLText('link_alt_updatedocument'), "out.AddMultiDocument.php?folderid=".$folder->getID()."&showtree=".showtree())."</p>";
}
if($msg)
$this->warningMsg($msg);
$msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($maxuploadsize);
$this->warningMsg($msg);
if ($document->isCheckedOut()) {
$msg = getMLText('document_is_checked_out_update');

View File

@ -217,11 +217,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
echo "SeedDMSUpload.setUrl('".$this->params['settings']->_httpRoot."op/op.Ajax.php');";
echo "SeedDMSUpload.setAbortBtnLabel('".getMLText("cancel")."');";
echo "SeedDMSUpload.setEditBtnLabel('');";
$mus2 = SeedDMS_Core_File::parse_filesize(ini_get("upload_max_filesize"));
if($maxuploadsize && $maxuploadsize < $mus2)
echo "SeedDMSUpload.setMaxFileSize($maxuploadsize);\n";
else
echo "SeedDMSUpload.setMaxFileSize($mus2);\n";
echo "SeedDMSUpload.setMaxFileSize($maxuploadsize);\n";
echo "SeedDMSUpload.setMaxFileSizeMsg('".getMLText("uploading_maxsize")."');";
}
?>

View File

@ -470,11 +470,12 @@ $('body').on('click', '.order-btn', function(ev) {
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$maxuploadsize = $this->params['maxuploadsize'];
$this->contentHeading(getMLText("dropupload"), true);
if ($folder->getAccessMode($user) >= M_READWRITE) {
?>
<div id="draganddrophandler" class="well alert alert-warning" data-droptarget="folder_<?php echo $folder->getID(); ?>" data-target="<?php echo $folder->getID(); ?>" data-uploadformtoken="<?php echo createFormKey(''); ?>"><?php printMLText('drop_files_here'); ?></div>
<div id="draganddrophandler" class="well alert alert-warning" data-droptarget="folder_<?php echo $folder->getID(); ?>" data-target="<?php echo $folder->getID(); ?>" data-uploadformtoken="<?php echo createFormKey(''); ?>"><?php printMLText('drop_files_here', ['maxuploadsize'=>SeedDMS_Core_File::format_filesize($maxuploadsize)]); ?></div>
<?php
} else {
$this->errorMsg(getMLText('access_denied'));

View File

@ -489,7 +489,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
if ($pageType!=null && strcasecmp($pageType, "noNav")) {
// echo "<div class=\"fixed-top\" style=\"z-index: 1029; margin-top: 51px;\">";
echo "<nav class=\"navbar navbar-expand-lg bg-light navbar-light\">\n";
echo "<nav class=\"navbar navbar-expand-lg mb-4 bg-light navbar-light\">\n";
echo '<a class="navbar-brand">'.getMLText('nav_brand_'.$pageType).'</a>';
echo "<button class=\"navbar-toggler\" type=\"button\" data-toggle=\"collapse\" data-target=\"#navbarPageContent\" aria-controls=\"navbarMain\" aria-expanded=\"false\" aria-label=\"Toggle navigation\">\n";
echo " <span class=\"navbar-toggler-icon\"></span>\n";